From 04b489f53e2b7dc2869be3726b489c1cef376c17 Mon Sep 17 00:00:00 2001 From: dx <1242347652@qq.com> Date: Sat, 8 Feb 2025 17:32:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=89=A7=E6=B3=95=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/enums/ErrorCodeConstants.java | 1 + .../enterprise/EnterpriseController.java | 22 +++- .../enterprise/vo/EnterprisePageReqVO.java | 6 +- .../EnterpriseInspectionsController.java | 8 ++ .../vo/EnterpriseInspectionsRespVO.java | 36 +++++- .../InspectionsLogController.java | 104 ++++++++++++++++++ .../vo/InspectionsLogPageReqVO.java | 40 +++++++ .../vo/InspectionsLogRespVO.java | 50 +++++++++ .../vo/InspectionsLogSaveReqVO.java | 35 ++++++ .../taglibrary/TagLibraryController.java | 22 +++- .../taglibrary/vo/TagLibraryPageReqVO.java | 4 + .../admin/taglibrary/vo/TagLibraryRespVO.java | 5 + .../taglibrary/vo/TagLibrarySaveReqVO.java | 5 + .../app/task/AppTaskController.java | 53 +++++++++ .../dataobject/enterprise/EnterpriseDO.java | 5 - .../EnterpriseInspectionsDO.java | 27 ++++- .../inspectionslog/InspectionsLogDO.java | 58 ++++++++++ .../dataobject/taglibrary/TagLibraryDO.java | 2 + .../mysql/enterprise/EnterpriseMapper.java | 3 +- .../EnterpriseInspectionsMapper.java | 12 +- .../inspectionslog/InspectionsLogMapper.java | 32 ++++++ .../enterprise/EnterpriseServiceImpl.java | 59 +++++++++- .../EnterpriseInspectionsServiceImpl.java | 94 +++++++++++++++- .../inspectionslog/InspectionsLogService.java | 58 ++++++++++ .../InspectionsLogServiceImpl.java | 83 ++++++++++++++ .../service/taglibrary/TagLibraryService.java | 3 + .../taglibrary/TagLibraryServiceImpl.java | 31 ++++++ .../service/taskinfo/TaskInfoServiceImpl.java | 23 ++++ 28 files changed, 857 insertions(+), 24 deletions(-) create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/task/AppTaskController.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/inspectionslog/InspectionsLogMapper.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java index c836547..58de95e 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java @@ -186,4 +186,5 @@ public interface ErrorCodeConstants { ErrorCode ENTERPRISE_INSPECTIONS_NOT_EXISTS = new ErrorCode(1-003-001-005, "任务记录不存在"); + ErrorCode INSPECTIONS_LOG_NOT_EXISTS = new ErrorCode(1-003-001-006, "执法日志不存在"); } 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 1a3dc0f..85e078d 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 @@ -16,6 +16,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMappe import cn.iocoder.yudao.module.system.dal.mysql.fileInfo.FileInfoMapper; import cn.iocoder.yudao.module.system.dal.mysql.qualification.EnterpriseQualificationMapper; import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper; +import cn.iocoder.yudao.module.system.service.enterprisetag.EnterpriseTagService; import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService; import cn.iocoder.yudao.module.system.service.qualification.EnterpriseQualificationService; import cn.iocoder.yudao.module.system.service.taglibrary.TagLibraryService; @@ -189,7 +190,6 @@ public class EnterpriseController { @Operation(summary = "用户获得所属企业列表") public CommonResult> getEnterpriseByUserId(@Valid EnterprisePageReqVO pageReqVO) { final PageResult pageResult = enterpriseService.getEnterpriseByUserId(pageReqVO); - pageResult.getList().forEach(item->{ //企业审核状态 QueryWrapper auditLogDOQueryWrapper = new QueryWrapper<>(); @@ -211,14 +211,30 @@ public class EnterpriseController { item.setFiles(list); } + //企业标签 + 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()); + } + }); + } + + item.setTagList(tagList); }); return success(BeanUtils.toBean(pageResult, EnterpriseRespVO.class)); } - - @GetMapping("/export-excel") @Operation(summary = "导出企业 Excel") @PreAuthorize("@ss.hasPermission('system:enterprise:export')") 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 8d32687..18ce982 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 @@ -64,11 +64,11 @@ public class EnterprisePageReqVO extends PageParam { @Schema(description = "修改人") private String updater; - @Schema(description = "管理部门", example = "26433") - private Long deptId; - @Schema(description = "邀请人") private String inviterName; + @Schema(description = "根据标签类型过滤") + private List tagList; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java index e192c0b..bca3e83 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java @@ -79,6 +79,14 @@ public class EnterpriseInspectionsController { return success(BeanUtils.toBean(pageResult, EnterpriseInspectionsRespVO.class)); } + @GetMapping("/pcpage") + @Operation(summary = "PC端获得企业检查记录表,用于记录与企业相关的环保检查信息。分页") + @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')") + public CommonResult> getEnterpriseInspectionsPCPage(@Valid EnterpriseInspectionsPageReqVO pageReqVO) { + PageResult pageResult = enterpriseInspectionsService.getEnterpriseInspectionsPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, EnterpriseInspectionsRespVO.class)); + } + @GetMapping("/export-excel") @Operation(summary = "导出企业检查记录表,用于记录与企业相关的环保检查信息。 Excel") @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:export')") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java index 29233ee..95e0c16 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java @@ -20,12 +20,40 @@ public class EnterpriseInspectionsRespVO { @ExcelProperty("任务ID") private Long taskId; + @Schema(description = "任务名称", example = "29150") + @ExcelProperty("任务名称") + private String taskName; + @Schema(description = "企业ID", example = "27002") @ExcelProperty("企业ID") private Long enterpriseId; - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) - @ExcelProperty("创建时间") - private LocalDateTime createTime; + @Schema(description = "企业名称", example = "27002") + @ExcelProperty("企业名称") + private String enterpriseName; + + @Schema(description = "任务类型", example = "27002") + @ExcelProperty("任务类型") + private List tagList; + + @Schema(description = "进度状态", example = "1") + @ExcelProperty("进度状态") + private String inspectionStatus; + + @Schema(description = "执法部门", example = "一大队") + @ExcelProperty("执法部门") + private String department; + + @Schema(description = "执法人员", example = "张三") + @ExcelProperty("执法人员") + private String inspectName; + + @Schema(description = "协同执法人", example = "张三") + @ExcelProperty("协同执法人") + private String cooperateWithName; + + @Schema(description = "执法时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("执法时间") + private LocalDateTime execTime; -} \ No newline at end of file +} 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 new file mode 100644 index 0000000..835aaa0 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java @@ -0,0 +1,104 @@ +package cn.iocoder.yudao.module.system.controller.admin.inspectionslog; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO; +import cn.iocoder.yudao.module.system.service.inspectionslog.InspectionsLogService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +@Tag(name = "管理后台 - 检查结果日志") +@RestController +@RequestMapping("/system/inspections-log") +@Validated +public class InspectionsLogController { + + @Resource + private InspectionsLogService inspectionsLogService; + + @PostMapping("/create") + @Operation(summary = "创建检查结果日志") + @PreAuthorize("@ss.hasPermission('system:inspections-log:create')") + public CommonResult createInspectionsLog(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) { + return success(inspectionsLogService.createInspectionsLog(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新检查结果日志") + @PreAuthorize("@ss.hasPermission('system:inspections-log:update')") + public CommonResult updateInspectionsLog(@Valid @RequestBody InspectionsLogSaveReqVO updateReqVO) { + inspectionsLogService.updateInspectionsLog(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除检查结果日志") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('system:inspections-log:delete')") + public CommonResult deleteInspectionsLog(@RequestParam("id") Long id) { + inspectionsLogService.deleteInspectionsLog(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得检查结果日志") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:inspections-log:query')") + public CommonResult getInspectionsLog(@RequestParam("id") Long id) { + InspectionsLogDO inspectionsLog = inspectionsLogService.getInspectionsLog(id); + return success(BeanUtils.toBean(inspectionsLog, InspectionsLogRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得检查结果日志分页") + @PreAuthorize("@ss.hasPermission('system:inspections-log:query')") + public CommonResult> getInspectionsLogPage(@Valid InspectionsLogPageReqVO pageReqVO) { + PageResult pageResult = inspectionsLogService.getInspectionsLogPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, InspectionsLogRespVO.class)); + } + + @GetMapping("/list") + @Operation(summary = "pc端获得检查状态列表") + @PreAuthorize("@ss.hasPermission('system:inspections-log:query')") + public CommonResult> getInspectionsLogList(@Valid InspectionsLogPageReqVO pageReqVO) { + List list = inspectionsLogService.list(pageReqVO); + 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)); + } + +} 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 new file mode 100644 index 0000000..a7b3a03 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 检查结果日志分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class InspectionsLogPageReqVO extends PageParam { + + @Schema(description = "检查记录id", example = "18375") + private Long inspectionsId; + + @Schema(description = "检查状态1.签到2.通过.3整改", example = "2") + private Integer status; + + @Schema(description = "检查人员签到位置信息,格式:经纬度") + private String gpsLocation; + + @Schema(description = "反馈信息") + private String feedBack; + + @Schema(description = "协同人员姓名", example = "张三") + private String cooperateWithName; + + @Schema(description = "执法人员姓名", example = "李四") + private String inspectName; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file 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 new file mode 100644 index 0000000..b1aa3e1 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java @@ -0,0 +1,50 @@ +package cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; + +@Schema(description = "管理后台 - 检查结果日志 Response VO") +@Data +@ExcelIgnoreUnannotated +public class InspectionsLogRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2308") + @ExcelProperty("主键") + private Long id; + + @Schema(description = "检查记录id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18375") + @ExcelProperty("检查记录id") + private Long inspectionsId; + + @Schema(description = "检查状态1.签到2.通过.3整改", example = "2") + @ExcelProperty(value = "检查状态1.签到2.通过.3整改", converter = DictConvert.class) + @DictFormat("Inspections_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer status; + + @Schema(description = "检查人员签到位置信息,格式:经纬度") + @ExcelProperty("检查人员签到位置信息,格式:经纬度") + private String gpsLocation; + + @Schema(description = "反馈信息") + @ExcelProperty("反馈信息") + private String feedBack; + + @Schema(description = "协同人员姓名", example = "张三") + @ExcelProperty("协同人员姓名") + private String cooperateWithName; + + @Schema(description = "执法人员姓名", example = "李四") + @ExcelProperty("执法人员姓名") + private String inspectName; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file 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 new file mode 100644 index 0000000..351ce0f --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java @@ -0,0 +1,35 @@ +package cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import javax.validation.constraints.NotNull; +import java.util.*; + +@Schema(description = "管理后台 - 检查结果日志新增/修改 Request VO") +@Data +public class InspectionsLogSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2308") + private Long id; + + @Schema(description = "检查记录id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18375") + @NotNull(message = "检查记录id不能为空") + private Long inspectionsId; + + @Schema(description = "检查状态1.签到2.通过.3整改", example = "2") + private Integer status; + + @Schema(description = "检查人员签到位置信息,格式:经纬度") + private String gpsLocation; + + @Schema(description = "反馈信息") + private String feedBack; + + @Schema(description = "协同人员姓名", example = "张三") + private String cooperateWithName; + + @Schema(description = "执法人员姓名", example = "李四") + private String inspectName; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/TagLibraryController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/TagLibraryController.java index 88d4a6b..d9045f4 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/TagLibraryController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/TagLibraryController.java @@ -71,10 +71,30 @@ public class TagLibraryController { } @GetMapping("/page") - @Operation(summary = "获得企业标签分页") + @Operation(summary = "获得标签分页") @PreAuthorize("@ss.hasPermission('system:tag-library:query')") public CommonResult> getTagLibraryPage(TagLibraryPageReqVO pageReqVO) { List pageResult = tagLibraryService.getTagLibraryPage(pageReqVO); return success(BeanUtils.toBean(pageResult, TagLibraryRespVO.class)); } + + @GetMapping("/list") + @Operation(summary = "获得标签分页") + @PreAuthorize("@ss.hasPermission('system:tag-library:query')") + public CommonResult> getTagLibraryList(String[] codeList) { + List pageResult = tagLibraryService.list(codeList); + return success(BeanUtils.toBean(pageResult, TagLibraryRespVO.class)); + + } + + @GetMapping("/childrenList") + @Operation(summary = "获得标签分页") + @PreAuthorize("@ss.hasPermission('system:tag-library:query')") + public CommonResult> childrenList(Long id) { + List pageResult = tagLibraryService.childrenList(id); + return success(BeanUtils.toBean(pageResult, TagLibraryRespVO.class)); + + } + + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryPageReqVO.java index c54fd41..1072143 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryPageReqVO.java @@ -27,6 +27,10 @@ public class TagLibraryPageReqVO extends PageParam { @Schema(description = "1、企业标签2、执法标签", example = "2") private Integer tagType; + //助记 + @Schema(description = "英文助记", example = "2") + private String tagCode; + @Schema(description = "创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] createTime; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryRespVO.java index 1b8e579..640bbbf 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryRespVO.java @@ -37,6 +37,11 @@ public class TagLibraryRespVO { @ExcelProperty("排序") private Integer sort; + //助记 + @Schema(description = "英文助记", example = "2") + @ExcelProperty("英文助记") + private String tagCode; + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("创建时间") private LocalDateTime createTime; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibrarySaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibrarySaveReqVO.java index 1be6466..2d3a0ae 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibrarySaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibrarySaveReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo; +import com.alibaba.excel.annotation.ExcelProperty; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @@ -27,6 +28,10 @@ public class TagLibrarySaveReqVO { @Schema(description = "排序") private Integer sort; + //助记 + @Schema(description = "英文助记", example = "2") + private String tagCode; + @Schema(description = "1、企业标签2、执法标签", example = "2") private Integer tagType; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/task/AppTaskController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/task/AppTaskController.java new file mode 100644 index 0000000..72a58da --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/task/AppTaskController.java @@ -0,0 +1,53 @@ +package cn.iocoder.yudao.module.system.controller.app.task; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo.TaskInfoPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo.TaskInfoRespVO; +import cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo.TaskInfoSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.service.dept.DeptService; +import cn.iocoder.yudao.module.system.service.taskinfo.TaskInfoService; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。") +@RestController +@RequestMapping("/system/app/task-info") +@Validated +public class AppTaskController { + @Resource + private TaskInfoService taskInfoService; + @Resource + private AdminUserService adminUserService; + @Resource + private DeptService deptService; + + @GetMapping("/page") + @Operation(summary = "获得任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。分页") + @PreAuthorize("@ss.hasPermission('system:task-info:query')") + public CommonResult> getTaskInfoPage(@Valid TaskInfoPageReqVO pageReqVO) { + PageResult pageResult = taskInfoService.getTaskInfoPage(pageReqVO); + AdminUserDO user = adminUserService.getUser(SecurityFrameworkUtils.getLoginUserId()); + DeptDO dep= deptService.getDept( user.getDeptId()); + pageResult.getList().forEach(item->{ + item.setPublishDep(dep.getName()); + item.setCreateName(adminUserService.getUser(Long.valueOf(item.getCreator())).getRealName()); + }); + return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class)); + } +} 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 45863f9..275f666 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 @@ -80,11 +80,6 @@ public class EnterpriseDO extends BaseDO { */ private String gpsLocation; - /** - * 管理部门 - */ - private Long deptId; - @TableField(exist = false) private Integer audit; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java index ce4d46d..7473585 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; import java.time.LocalDateTime; @@ -35,5 +36,29 @@ public class EnterpriseInspectionsDO extends BaseDO { * 企业ID */ private Long enterpriseId; + //任务名称 + @TableField(exist = false) + private String taskName; + //企业名称 + @TableField(exist = false) + private String enterpriseName; + //进度状态 + @TableField(exist = false) + private Integer inspectionStatus; + //标签集合 + @TableField(exist = false) + private List tagList; + //执法部门 + @TableField(exist = false) + private String department; + //执法任务 + @TableField(exist = false) + private String inspectName; + //协同人员 + @TableField(exist = false) + private String cooperateWithName; + //执法时间 + @TableField(exist = false) + private LocalDateTime execTime; -} \ No newline at end of file +} 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 new file mode 100644 index 0000000..0e4f336 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java @@ -0,0 +1,58 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog; + +import com.sun.xml.bind.v2.TODO; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 检查结果日志 DO + * + * @author 芋道源码 + */ +@TableName("inspections_log") +@KeySequence("inspections_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class InspectionsLogDO extends BaseDO { + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 检查记录id + */ + private Long inspectionsId; + /** + * 检查状态1.签到2.通过.3整改 + * + * 枚举 {@link TODO Inspections_status 对应的类} + */ + private Integer status; + /** + * 检查人员签到位置信息,格式:经纬度 + */ + private String gpsLocation; + /** + * 反馈信息 + */ + private String feedBack; + /** + * 协同人员姓名 + */ + private String cooperateWithName; + /** + * 执法人员姓名 + */ + private String inspectName; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taglibrary/TagLibraryDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taglibrary/TagLibraryDO.java index 442a934..7fb441d 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taglibrary/TagLibraryDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taglibrary/TagLibraryDO.java @@ -45,6 +45,8 @@ public class TagLibraryDO extends BaseDO { private Integer tagType; //排序 private Integer sort; + //助记 + private String tagCode; @TableField(exist = false) private List children = new ArrayList<>(); // 子标签列表 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 c1a1d49..d252e46 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 @@ -31,10 +31,9 @@ public interface EnterpriseMapper extends BaseMapperX { .eqIfPresent(EnterpriseDO::getIntroduction, reqVO.getIntroduction()) .betweenIfPresent(EnterpriseDO::getEstablishmentDate, reqVO.getEstablishmentDate()) .eqIfPresent(EnterpriseDO::getGpsLocation, reqVO.getGpsLocation()) - .eqIfPresent(EnterpriseDO::getCreator, reqVO.getCreate()) .betweenIfPresent(EnterpriseDO::getCreateTime, reqVO.getCreateTime()) .eqIfPresent(EnterpriseDO::getUpdater, reqVO.getUpdater()) - .eqIfPresent(EnterpriseDO::getDeptId, reqVO.getDeptId()) + .or(w->w.eq(EnterpriseDO::getCreator, reqVO.getCreate())) .orderByDesc(EnterpriseDO::getId)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java index e1ab961..152ed44 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.enterpriseinspections; import java.util.*; +import java.util.stream.Collectors; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -25,4 +26,13 @@ public interface EnterpriseInspectionsMapper extends BaseMapperX selectPageGroup(EnterpriseInspectionsPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(EnterpriseInspectionsDO::getTaskId, reqVO.getTaskId()) + .eqIfPresent(EnterpriseInspectionsDO::getEnterpriseId, reqVO.getEnterpriseId()) + .betweenIfPresent(EnterpriseInspectionsDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(EnterpriseInspectionsDO::getId).groupBy(EnterpriseInspectionsDO::getTaskId) + ); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/inspectionslog/InspectionsLogMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/inspectionslog/InspectionsLogMapper.java new file mode 100644 index 0000000..6ed1422 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/inspectionslog/InspectionsLogMapper.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.system.dal.mysql.inspectionslog; + +import java.util.*; + +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.inspectionslog.InspectionsLogDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.*; + +/** + * 检查结果日志 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface InspectionsLogMapper extends BaseMapperX { + + default PageResult selectPage(InspectionsLogPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(InspectionsLogDO::getInspectionsId, reqVO.getInspectionsId()) + .eqIfPresent(InspectionsLogDO::getStatus, reqVO.getStatus()) + .eqIfPresent(InspectionsLogDO::getGpsLocation, reqVO.getGpsLocation()) + .eqIfPresent(InspectionsLogDO::getFeedBack, reqVO.getFeedBack()) + .likeIfPresent(InspectionsLogDO::getCooperateWithName, reqVO.getCooperateWithName()) + .likeIfPresent(InspectionsLogDO::getInspectName, reqVO.getInspectName()) + .betweenIfPresent(InspectionsLogDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(InspectionsLogDO::getId)); + } + +} \ No newline at end of file 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 b446dea..b1d1eb2 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 @@ -1,19 +1,30 @@ package cn.iocoder.yudao.module.system.service.enterprise; import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseauditlog.EnterpriseAuditLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.enterprisetag.EnterpriseTagDO; import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.dal.mysql.enterpriseauditlog.EnterpriseAuditLogMapper; +import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMapper; import cn.iocoder.yudao.module.system.dal.mysql.fileInfo.FileInfoMapper; +import cn.iocoder.yudao.module.system.dal.mysql.permission.RoleMapper; +import cn.iocoder.yudao.module.system.dal.mysql.permission.UserRoleMapper; import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService; +import cn.iocoder.yudao.module.system.service.permission.RoleService; 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 org.apache.tomcat.jni.FileInfo; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.*; import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -47,6 +58,10 @@ public class EnterpriseServiceImpl implements EnterpriseService { private AdminUserService adminUserService; @Resource private EnterpriseAuditLogMapper enterpriseAuditLogMapper; + @Resource + private EnterpriseTagMapper enterpriseTagMapper; + @Resource + private UserRoleMapper userRoleMapper; @Override @Transactional @@ -136,13 +151,51 @@ public class EnterpriseServiceImpl implements EnterpriseService { @Override public PageResult getEnterprisePage(EnterprisePageReqVO pageReqVO) { - return enterpriseMapper.selectPage(pageReqVO); + final PageResult enterpriseDOPageResult = enterpriseMapper.selectPage(pageReqVO); + return enterpriseDOPageResult; } @Override public PageResult getEnterpriseByUserId(EnterprisePageReqVO pageReqVO) { - pageReqVO.setCreate(getLoginUserId().toString()); - return enterpriseMapper.selectPage(pageReqVO); + //根据不同身份查询企业 + //专管员查询 user_id + //队长 查询部门 所有的 user_id in + QueryWrapper roleDOQueryWrapper = new QueryWrapper<>(); + roleDOQueryWrapper.eq("user_id", getLoginUserId()); + final List userRoleDOS = userRoleMapper.selectList(roleDOQueryWrapper); + final List collect = userRoleDOS.stream().map(item -> item.getRoleId()).collect(Collectors.toList()); + //判断 collect 里面是否包含 roleId = 11 + if (collect.contains(11L)) { +// //队长 +// pageReqVO.setUserId(null); +// pageReqVO.setDeptId(null); + } else if (collect.contains(155L)) { + //专管员 + pageReqVO.setUserId(getLoginUserId()); + } + +// pageReqVO.setCreate(getLoginUserId().toString()); + final PageResult enterpriseDOPageResult = enterpriseMapper.selectPage(pageReqVO); + + if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(EnterpriseTagDO::getTagId, pageReqVO.getTagList()); + List enterpriseTagDOList = enterpriseTagMapper.selectList(wrapper); + //根据enterpriseTagDOList 筛选 + List enterpriseDOList = new ArrayList<>(); + for (EnterpriseDO enterpriseDO : enterpriseDOPageResult.getList()) { + for (EnterpriseTagDO enterpriseTagDO : enterpriseTagDOList) { + if (enterpriseTagDO.getEnterpriseId().equals(enterpriseDO.getId())) { + enterpriseDOList.add(enterpriseDO); + break; + } + } + } + enterpriseDOPageResult.setList(enterpriseDOList); + enterpriseDOPageResult.setTotal(Long.valueOf(enterpriseDOList.size())); + } + + return enterpriseDOPageResult; } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java index 7718ca3..9691b6a 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java @@ -1,5 +1,21 @@ package cn.iocoder.yudao.module.system.service.enterpriseinspections; +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.inspectionslog.InspectionsLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; +import cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO; +import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.dal.mysql.enterprise.EnterpriseMapper; +import cn.iocoder.yudao.module.system.dal.mysql.inspectionslog.InspectionsLogMapper; +import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper; +import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper; +import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper; +import cn.iocoder.yudao.module.system.service.dept.DeptService; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; @@ -25,10 +41,25 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; */ @Service @Validated +@Slf4j public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsService { @Resource private EnterpriseInspectionsMapper enterpriseInspectionsMapper; + @Resource + private TaskInfoMapper taskInfoMapper; + @Resource + private InspectionsLogMapper inspectionsLogMapper; + @Resource + private EnterpriseMapper enterpriseMapper; + @Resource + private TaskTagMapper taskTagMapper; + @Resource + private TagLibraryMapper tagLibraryMapper; + @Resource + private AdminUserService adminUserService; + @Resource + private DeptService deptService; @Override public Long createEnterpriseInspections(EnterpriseInspectionsSaveReqVO createReqVO) { @@ -69,7 +100,68 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe @Override public PageResult getEnterpriseInspectionsPage(EnterpriseInspectionsPageReqVO pageReqVO) { - return enterpriseInspectionsMapper.selectPage(pageReqVO); + + final PageResult enterpriseInspectionsDOPageResult = enterpriseInspectionsMapper.selectPage(pageReqVO); + if (enterpriseInspectionsDOPageResult.getList().size() > 0 ) { + enterpriseInspectionsDOPageResult.getList().forEach(item->{ + + //查询任务相关 + final TaskInfoDO taskInfoDO = taskInfoMapper.selectById(item.getTaskId()); + if (taskInfoDO == null) { + throw exception(TASK_INFO_NOT_EXISTS); + } + item.setTaskName(taskInfoDO.getTitle()); + + //查询任务标签 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("task_id", taskInfoDO.getId()); + final List taskTagDOS = taskTagMapper.selectList(wrapper); + + List tagList = new ArrayList<>(); + if (!taskTagDOS.isEmpty() && taskTagDOS.size() > 0) { + taskTagDOS.forEach(taskTagItem->{ + final TagLibraryDO tagLibraryDO = tagLibraryMapper.selectById(taskTagItem.getTagId()); + if (tagLibraryDO != null) { + tagList.add(tagLibraryDO.getTagName()); + } + }); + } + + item.setTagList(tagList); + + //查询企业 + final EnterpriseDO enterpriseDO = enterpriseMapper.selectById(item.getEnterpriseId()); + if (enterpriseDO == null) { + throw exception(ENTERPRISE_NOT_EXISTS); + } + item.setEnterpriseName(enterpriseDO.getEnterprisesName()); + + //查询检查记录 + QueryWrapper inspectionsLogWrapper = new QueryWrapper<>(); + inspectionsLogWrapper.eq("inspections_id", item.getId()); + inspectionsLogWrapper.orderByDesc("create_time"); + final List inspectionsLogDOS = inspectionsLogMapper.selectList(inspectionsLogWrapper); + if (!inspectionsLogDOS.isEmpty() && inspectionsLogDOS.size() > 0) { + item.setInspectionStatus(inspectionsLogDOS.get(0).getStatus()); + item.setInspectName(inspectionsLogDOS.get(0).getInspectName()); + item.setCooperateWithName(inspectionsLogDOS.get(0).getCooperateWithName()); + item.setExecTime(inspectionsLogDOS.get(0).getCreateTime()); + //根据执法人员id 查询其所属部门 + final Long userId = Long.valueOf(inspectionsLogDOS.get(0).getCreator()); + final AdminUserDO user = adminUserService.getUser(userId); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + final DeptDO dept = deptService.getDept(user.getDeptId()); + item.setDepartment(dept.getName()); + + } + }); + } + + log.info("enterpriseInspectionsDOPageResult:{}", enterpriseInspectionsDOPageResult); + + return enterpriseInspectionsDOPageResult; } } 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 new file mode 100644 index 0000000..59bc0bf --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java @@ -0,0 +1,58 @@ +package cn.iocoder.yudao.module.system.service.inspectionslog; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; + +import javax.validation.Valid; + +/** + * 检查结果日志 Service 接口 + * + * @author 芋道源码 + */ +public interface InspectionsLogService { + + /** + * 创建检查结果日志 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createInspectionsLog(@Valid InspectionsLogSaveReqVO createReqVO); + + /** + * 更新检查结果日志 + * + * @param updateReqVO 更新信息 + */ + void updateInspectionsLog(@Valid InspectionsLogSaveReqVO updateReqVO); + + /** + * 删除检查结果日志 + * + * @param id 编号 + */ + void deleteInspectionsLog(Long id); + + /** + * 获得检查结果日志 + * + * @param id 编号 + * @return 检查结果日志 + */ + InspectionsLogDO getInspectionsLog(Long id); + + /** + * 获得检查结果日志分页 + * + * @param pageReqVO 分页查询 + * @return 检查结果日志分页 + */ + PageResult 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 new file mode 100644 index 0000000..9288709 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java @@ -0,0 +1,83 @@ +package cn.iocoder.yudao.module.system.service.inspectionslog; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + +import cn.iocoder.yudao.module.system.dal.mysql.inspectionslog.InspectionsLogMapper; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; + +/** + * 检查结果日志 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class InspectionsLogServiceImpl implements InspectionsLogService { + + @Resource + private InspectionsLogMapper inspectionsLogMapper; + + @Override + public Long createInspectionsLog(InspectionsLogSaveReqVO createReqVO) { + // 插入 + InspectionsLogDO inspectionsLog = BeanUtils.toBean(createReqVO, InspectionsLogDO.class); + inspectionsLogMapper.insert(inspectionsLog); + // 返回 + return inspectionsLog.getId(); + } + + @Override + public void updateInspectionsLog(InspectionsLogSaveReqVO updateReqVO) { + // 校验存在 + validateInspectionsLogExists(updateReqVO.getId()); + // 更新 + InspectionsLogDO updateObj = BeanUtils.toBean(updateReqVO, InspectionsLogDO.class); + inspectionsLogMapper.updateById(updateObj); + } + + @Override + public void deleteInspectionsLog(Long id) { + // 校验存在 + validateInspectionsLogExists(id); + // 删除 + inspectionsLogMapper.deleteById(id); + } + + private void validateInspectionsLogExists(Long id) { + if (inspectionsLogMapper.selectById(id) == null) { + throw exception(INSPECTIONS_LOG_NOT_EXISTS); + } + } + + @Override + public InspectionsLogDO getInspectionsLog(Long id) { + return inspectionsLogMapper.selectById(id); + } + + @Override + public PageResult getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO) { + return inspectionsLogMapper.selectPage(pageReqVO); + } + + @Override + public List list(InspectionsLogPageReqVO pageReqVO) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("inspections_id", pageReqVO.getInspectionsId()); + return inspectionsLogMapper.selectList(wrapper); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java index a3ec43b..c256fec 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java @@ -53,4 +53,7 @@ public interface TagLibraryService { */ List getTagLibraryPage(TagLibraryPageReqVO pageReqVO); + List list(String[] codeList); + + List childrenList(Long id); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java index e950530..ca7a06b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.system.service.taglibrary; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import org.apache.poi.ss.formula.functions.T; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo.*; @@ -73,6 +75,35 @@ public class TagLibraryServiceImpl implements TagLibraryService { return buildTree(list, 0); } + @Override + public List list(String[] codeList) { + List tagList = new ArrayList<>(); + if (codeList.length > 0) { + for (String item : codeList) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("tag_code", item); + TagLibraryDO tagLibraryDO = tagLibraryMapper.selectOne(wrapper); + if (tagLibraryDO != null) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("parent_id", tagLibraryDO.getId()); + List children = tagLibraryMapper.selectList(queryWrapper); + if (children.size() > 0) { + tagLibraryDO.setChildren(children); + } + tagList.add(tagLibraryDO); + } + } + } + return tagList; + } + + @Override + public List childrenList(Long id) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("parent_id", id); + return tagLibraryMapper.selectList(wrapper); + } + // 递归构建树 private List buildTree(List tags, Integer parentId) { List tree = new ArrayList<>(); 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 1178bcb..a05b21d 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 @@ -1,12 +1,16 @@ package cn.iocoder.yudao.module.system.service.taskinfo; +import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.module.infra.api.job.JobApi; 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.inspectionslog.InspectionsLogDO; import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO; import cn.iocoder.yudao.module.system.dal.mysql.enterprise.EnterpriseMapper; import cn.iocoder.yudao.module.system.dal.mysql.enterpriseinspections.EnterpriseInspectionsMapper; +import cn.iocoder.yudao.module.system.dal.mysql.inspectionslog.InspectionsLogMapper; import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; @@ -25,6 +29,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper; import javax.annotation.Resource; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; /** @@ -46,6 +51,8 @@ public class TaskInfoServiceImpl implements TaskInfoService { private EnterpriseMapper enterpriseMapper; @Resource private EnterpriseInspectionsMapper enterpriseInspectionsMapper; + @Resource + private InspectionsLogMapper inspectionsLogMapper; @Override @Transactional @@ -140,6 +147,22 @@ public class TaskInfoServiceImpl implements TaskInfoService { @Override public PageResult getTaskInfoPage(TaskInfoPageReqVO pageReqVO) { +// final Long loginUserId = getLoginUserId(); + //根据分配表反查任务表 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(EnterpriseInspectionsDO::getCreator, getLoginUserId()); + List list = enterpriseInspectionsMapper.selectList(wrapper); + if (!list.isEmpty() && list.size() > 0) { + final List> data = new ArrayList<>(); + list.forEach(item->{ +// Map map = new HashMap<>(); +// map.put("id", item.getTaskId().toString()); +// map.put("name", item.get) +// taskIds.add(item.getTaskId()); + }); + } + + return taskInfoMapper.selectPage(pageReqVO); } From c33bfbdc0c41af5d857cbc5c134b3062acfec483 Mon Sep 17 00:00:00 2001 From: dangxin <1242347652@qq.com> Date: Sun, 9 Feb 2025 16:24:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=89=A7=E6=B3=95=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E7=9A=84=E8=BD=AC=E5=8F=91=E5=92=8C=E5=88=9B=E5=BB=BA=E5=AD=90?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/enums/ErrorCodeConstants.java | 4 + .../EnterpriseInspectionsController.java | 7 ++ .../vo/PassOnSaveVO.java | 13 +++ .../InspectionsLogController.java | 9 ++ .../vo/InspectionsLogSaveReqVO.java | 9 ++ .../EnterpriseInspectionsDO.java | 10 ++ .../inspectionslog/InspectionsLogDO.java | 4 + .../EnterpriseInspectionsService.java | 1 + .../EnterpriseInspectionsServiceImpl.java | 70 +++++++++++++- .../inspectionslog/InspectionsLogService.java | 2 + .../InspectionsLogServiceImpl.java | 96 +++++++++++++++++++ .../service/taskinfo/TaskInfoServiceImpl.java | 3 +- .../src/main/resources/application-local.yaml | 4 +- 13 files changed, 224 insertions(+), 8 deletions(-) create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/PassOnSaveVO.java diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java index 58de95e..8fa1964 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java @@ -187,4 +187,8 @@ public interface ErrorCodeConstants { ErrorCode ENTERPRISE_INSPECTIONS_NOT_EXISTS = new ErrorCode(1-003-001-005, "任务记录不存在"); ErrorCode INSPECTIONS_LOG_NOT_EXISTS = new ErrorCode(1-003-001-006, "执法日志不存在"); + ErrorCode INSPECTIONS_SUCCESS = new ErrorCode(1-003-001-007, "已经完成执法, 不能进行其他操作"); + + ErrorCode ENTERPRISE_INSPECTIONS_STATUS_ERROR = new ErrorCode(1-003-002-000, "此状态下,不能转发执法任务"); + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java index bca3e83..d0a12fc 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java @@ -45,6 +45,13 @@ public class EnterpriseInspectionsController { return success(enterpriseInspectionsService.createEnterpriseInspections(createReqVO)); } + @PostMapping("/passOn") + @Operation(summary = "执法记录转交") + @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:create')") + public CommonResult passOn(@Valid @RequestBody PassOnSaveVO passOnSaveVO) { + return success(enterpriseInspectionsService.passOn(passOnSaveVO)); + } + @PutMapping("/update") @Operation(summary = "更新企业检查记录表,用于记录与企业相关的环保检查信息。") @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:update')") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/PassOnSaveVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/PassOnSaveVO.java new file mode 100644 index 0000000..32a944c --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/PassOnSaveVO.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo; + +import lombok.Data; + +import java.util.List; + +@Data +public class PassOnSaveVO { + //转交的执法记录id 转交是否需要审核 + private List inspectionsId; + //转给的专管员id + private Long userId; +} 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 835aaa0..53cc0f6 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 @@ -46,6 +46,15 @@ public class InspectionsLogController { return success(inspectionsLogService.createInspectionsLog(createReqVO)); } + @PutMapping("/cooperateWithSignIn") + @Operation(summary = "协同人员打开") + @PreAuthorize("@ss.hasPermission('system:inspections-log:update')") + public CommonResult cooperateWithSignIn(Long inspectionsLogId) { + inspectionsLogService.cooperateWithSignIn(inspectionsLogId); + return success(true); + } + + @PutMapping("/update") @Operation(summary = "更新检查结果日志") @PreAuthorize("@ss.hasPermission('system:inspections-log:update')") 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 351ce0f..404ff66 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 @@ -32,4 +32,13 @@ public class InspectionsLogSaveReqVO { @Schema(description = "执法人员姓名", example = "李四") private String inspectName; + //协同人员的id 还是要加上 会有同名的情况 + @Schema(description = "协同人员id", example = "1") + private String cooperateWithIds; + + //协同人员的id 还是要加上 会有同名的情况 + @Schema(description = "执法人ID", example = "1") + private Long inspectId; + + //协同人员是否可以看到任务记录 } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java index 7473585..be2a3fa 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java @@ -36,6 +36,16 @@ public class EnterpriseInspectionsDO extends BaseDO { * 企业ID */ private Long enterpriseId; + + /** + * 专管员id 如果只能在企业内修改专管员,这个userid 用来记录, 如果想修改企业的专管员,需要在任务里面 + * 任务里面重新选择企业 + */ + private Long userId; + + //状态 1.任务未启动 2. 任务已启动 3.已转交,未执行不展示 4.已转交,整改中,留痕 + private Integer status; + //任务名称 @TableField(exist = false) private String taskName; 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 0e4f336..03df04b 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 @@ -55,4 +55,8 @@ public class InspectionsLogDO extends BaseDO { */ private String inspectName; + //协同人员的id 还是要加上 会有同名的情况 + private String cooperateWithIds; + //协同人员是否可以看到任务记录 + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java index 246adf2..dbd72e8 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java @@ -53,4 +53,5 @@ public interface EnterpriseInspectionsService { */ PageResult getEnterpriseInspectionsPage(EnterpriseInspectionsPageReqVO pageReqVO); + void passOn(PassOnSaveVO passOnSaveVO); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java index 9691b6a..5323612 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java @@ -70,6 +70,8 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe return enterpriseInspections.getId(); } + + @Override public void updateEnterpriseInspections(EnterpriseInspectionsSaveReqVO updateReqVO) { // 校验存在 @@ -102,7 +104,7 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe public PageResult getEnterpriseInspectionsPage(EnterpriseInspectionsPageReqVO pageReqVO) { final PageResult enterpriseInspectionsDOPageResult = enterpriseInspectionsMapper.selectPage(pageReqVO); - if (enterpriseInspectionsDOPageResult.getList().size() > 0 ) { + if ( enterpriseInspectionsDOPageResult.getList() != null && enterpriseInspectionsDOPageResult.getList().size() > 0 ) { enterpriseInspectionsDOPageResult.getList().forEach(item->{ //查询任务相关 @@ -118,7 +120,7 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe final List taskTagDOS = taskTagMapper.selectList(wrapper); List tagList = new ArrayList<>(); - if (!taskTagDOS.isEmpty() && taskTagDOS.size() > 0) { + if (taskTagDOS != null && taskTagDOS.size() > 0) { taskTagDOS.forEach(taskTagItem->{ final TagLibraryDO tagLibraryDO = tagLibraryMapper.selectById(taskTagItem.getTagId()); if (tagLibraryDO != null) { @@ -141,7 +143,7 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe inspectionsLogWrapper.eq("inspections_id", item.getId()); inspectionsLogWrapper.orderByDesc("create_time"); final List inspectionsLogDOS = inspectionsLogMapper.selectList(inspectionsLogWrapper); - if (!inspectionsLogDOS.isEmpty() && inspectionsLogDOS.size() > 0) { + if (inspectionsLogDOS != null && inspectionsLogDOS.size() > 0) { item.setInspectionStatus(inspectionsLogDOS.get(0).getStatus()); item.setInspectName(inspectionsLogDOS.get(0).getInspectName()); item.setCooperateWithName(inspectionsLogDOS.get(0).getCooperateWithName()); @@ -159,9 +161,67 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe }); } - log.info("enterpriseInspectionsDOPageResult:{}", enterpriseInspectionsDOPageResult); - return enterpriseInspectionsDOPageResult; } + @Override + public void passOn(PassOnSaveVO passOnSaveVO) { + //查看任务状态,未签到, 整改 + + if (passOnSaveVO.getInspectionsId() == null || passOnSaveVO.getInspectionsId().size() == 0) { + throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); //请选择要转交的检查记录 + } + //循环记录id列表 + passOnSaveVO.getInspectionsId().forEach(item->{ + final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(item); + if (enterpriseInspectionsDO == null) { + throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); + } + + //未签到和整改状态可以转, 其他状态不能转 + if (enterpriseInspectionsDO.getStatus() == 1 || enterpriseInspectionsDO.getStatus() == 2) { + + InspectionsLogDO inspectionsLogNew = this.getInspectionsLogNew(item); + if (inspectionsLogNew != null && inspectionsLogNew.getStatus() == 3) { + //已经开始 就要判断是否是整改状态 整改状态才能转 + enterpriseInspectionsDO.setStatus(4); + } else { + enterpriseInspectionsDO.setStatus(3); + } + + enterpriseInspectionsMapper.updateById(enterpriseInspectionsDO); + + AdminUserDO user = adminUserService.getUser(passOnSaveVO.getUserId()); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + EnterpriseInspectionsDO inspectionsDO = new EnterpriseInspectionsDO(); + inspectionsDO.setEnterpriseId(enterpriseInspectionsDO.getEnterpriseId()); + inspectionsDO.setTaskId(enterpriseInspectionsDO.getTaskId()); + + inspectionsDO.setUserId(passOnSaveVO.getUserId()); + inspectionsDO.setInspectName(user.getRealName()); + enterpriseInspectionsMapper.insert(inspectionsDO); + } else { + throw exception(ENTERPRISE_INSPECTIONS_STATUS_ERROR); + } + + }); + + + } + + //获得检测记录最新一条 + public InspectionsLogDO getInspectionsLogNew(Long inspectionsId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("inspections_id", inspectionsId); + wrapper.orderByDesc("create_time"); + List inspectionsLogDOS = inspectionsLogMapper.selectList(wrapper); + if (inspectionsLogDOS == null || inspectionsLogDOS.size() == 0) { + return null; + } + return inspectionsLogDOS.get(0); + + } + } 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 59bc0bf..77a7c84 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 @@ -55,4 +55,6 @@ public interface InspectionsLogService { PageResult getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO); List list(InspectionsLogPageReqVO pageReqVO); + + void cooperateWithSignIn(Long inspectionsLogId); } 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 9288709..8a5a2fa 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 @@ -1,5 +1,12 @@ package cn.iocoder.yudao.module.system.service.inspectionslog; +import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO; +import cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.dal.mysql.enterpriseinspections.EnterpriseInspectionsMapper; +import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper; +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 org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -17,6 +24,8 @@ import cn.iocoder.yudao.module.system.dal.mysql.inspectionslog.InspectionsLogMap import javax.annotation.Resource; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; /** @@ -30,12 +39,69 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { @Resource private InspectionsLogMapper inspectionsLogMapper; + @Resource + private AdminUserService adminUserService; + @Resource + private EnterpriseInspectionsMapper enterpriseInspectionsMapper; + @Resource + private TaskInfoMapper taskInfoMapper; @Override public Long createInspectionsLog(InspectionsLogSaveReqVO createReqVO) { + //当前用户id + Long loginUserId = getLoginUserId(); + AdminUserDO user = adminUserService.getUser(loginUserId); + //根据查询出的列表判断执行到哪一步 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(InspectionsLogDO::getInspectionsId, createReqVO.getInspectionsId()); + wrapper.orderByDesc(InspectionsLogDO::getCreateTime); + List list = inspectionsLogMapper.selectList(wrapper); + + if (list == null || list.size() == 0) { + //签到 + createReqVO.setStatus(1); + createReqVO.setInspectId(loginUserId); + createReqVO.setInspectName(user.getRealName()); + } + + if (list != null && createReqVO.getStatus() != null && createReqVO.getStatus() == 1) { + //请不要重复签到 + throw exception(INSPECTIONS_SUCCESS); + } + + if (list != null && list.get(0).getStatus() == 2) { + throw exception(INSPECTIONS_SUCCESS); + } + // 插入 InspectionsLogDO inspectionsLog = BeanUtils.toBean(createReqVO, InspectionsLogDO.class); inspectionsLogMapper.insert(inspectionsLog); + + //整改需要重新创建子任务 + if (list != null && createReqVO.getStatus() != null && createReqVO.getStatus() == 3) { + + //查询父任务,和执法记录 + EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(createReqVO.getInspectionsId()); + if (enterpriseInspectionsDO == null) { + throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); + } + + //添加子任务 + TaskInfoDO taskInfo = new TaskInfoDO(); + taskInfo.setTitle(enterpriseInspectionsDO.getEnterpriseId() + "-" + "整改任务"); + taskInfo.setTaskType(1); //整改默认是普通专项任务类型 + taskInfo.setParentId(enterpriseInspectionsDO.getTaskId()); + taskInfo.setParentType(21); //父子任务类型 + taskInfoMapper.insert(taskInfo); + //添加执法记录 + EnterpriseInspectionsDO enterpriseInspectionsDO1 = new EnterpriseInspectionsDO(); + enterpriseInspectionsDO1.setUserId(getLoginUserId()); + enterpriseInspectionsDO1.setEnterpriseId(enterpriseInspectionsDO.getEnterpriseId()); + enterpriseInspectionsDO1.setTaskId(taskInfo.getId()); + enterpriseInspectionsDO1.setStatus(2); //整改任务默认是启动的状态 + enterpriseInspectionsMapper.insert(enterpriseInspectionsDO1); + } + // 返回 return inspectionsLog.getId(); } @@ -80,4 +146,34 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { 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); + } + + // 更新 + 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); + } + } 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 a05b21d..33c3da5 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 @@ -88,7 +88,8 @@ public class TaskInfoServiceImpl implements TaskInfoService { EnterpriseInspectionsDO inspection = new EnterpriseInspectionsDO(); inspection.setTaskId(taskInfo.getId()); inspection.setEnterpriseId(item); - inspection.setCreator(enterpriseDO.getUserId().toString()); + //专管员 + inspection.setUserId(enterpriseDO.getUserId()); list.add(inspection); }); diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index dbe9dd0..81a9141 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -46,7 +46,7 @@ spring: primary: master datasource: master: - url: jdbc:mysql://192.168.2.5:3306/hb-yudao?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例 + url: jdbc:mysql://127.0.0.1:3306/hb-yudao?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -55,7 +55,7 @@ spring: # url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例 username: root - password: jingke@123 + password: 123123 # username: sa # SQL Server 连接的示例 # password: Yudao@2024 # SQL Server 连接的示例 # username: SYSDBA # DM 连接的示例 From 840287f2b86bcf3039c3e9d698090822e494794a Mon Sep 17 00:00:00 2001 From: dx <1242347652@qq.com> Date: Mon, 10 Feb 2025 14:05:28 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=89=A7=E6=B3=95=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E8=BD=AC=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnterpriseInspectionsController.java | 15 +++++++-- .../InspectionsLogController.java | 15 ++++++++- .../vo/InspectionsLogRespVO.java | 5 ++- .../controller/admin/user/UserController.java | 6 ++++ .../admin/user/vo/user/DeptUserReqVO.java | 20 ++++++++++++ .../inspectionslog/InspectionsLogDO.java | 4 ++- .../EnterpriseInspectionsMapper.java | 2 +- .../EnterpriseInspectionsService.java | 2 ++ .../EnterpriseInspectionsServiceImpl.java | 9 ++++++ .../service/fileInfo/FileInfoService.java | 1 + .../service/fileInfo/FileInfoServiceImpl.java | 26 ++++++++++++++++ .../system/service/user/AdminUserService.java | 7 ++--- .../service/user/AdminUserServiceImpl.java | 31 ++++++++++++++++--- .../src/main/resources/application-local.yaml | 8 ++--- 14 files changed, 133 insertions(+), 18 deletions(-) create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/DeptUserReqVO.java diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java index d0a12fc..0dd30ee 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java @@ -48,8 +48,9 @@ public class EnterpriseInspectionsController { @PostMapping("/passOn") @Operation(summary = "执法记录转交") @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:create')") - public CommonResult passOn(@Valid @RequestBody PassOnSaveVO passOnSaveVO) { - return success(enterpriseInspectionsService.passOn(passOnSaveVO)); + public CommonResult passOn(@Valid @RequestBody PassOnSaveVO passOnSaveVO) { + enterpriseInspectionsService.passOn(passOnSaveVO); + return success("添加成功"); } @PutMapping("/update") @@ -86,6 +87,16 @@ public class EnterpriseInspectionsController { return success(BeanUtils.toBean(pageResult, EnterpriseInspectionsRespVO.class)); } + //listByUserIdAndTaskName + @GetMapping("/getListByUserIdAndTaskName") + @Operation(summary = "PC端获得企业检查记录表,用于记录与企业相关的环保检查信息。分页") + @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')") + public CommonResult> getListByUserIdAndTaskName(@RequestParam("userId") Long userId, + @RequestParam("taskName") String taskName) { + List pageResult = enterpriseInspectionsService.getListByUserIdAndTaskName(userId, taskName); + return success(BeanUtils.toBean(pageResult, EnterpriseInspectionsRespVO.class)); + } + @GetMapping("/pcpage") @Operation(summary = "PC端获得企业检查记录表,用于记录与企业相关的环保检查信息。分页") @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')") 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 53cc0f6..2583967 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 @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.inspectionslog; +import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; @@ -38,6 +39,8 @@ public class InspectionsLogController { @Resource private InspectionsLogService inspectionsLogService; + @Resource + private FileInfoService fileInfoService; @PostMapping("/create") @Operation(summary = "创建检查结果日志") @@ -54,7 +57,6 @@ public class InspectionsLogController { return success(true); } - @PutMapping("/update") @Operation(summary = "更新检查结果日志") @PreAuthorize("@ss.hasPermission('system:inspections-log:update')") @@ -86,6 +88,8 @@ public class InspectionsLogController { @PreAuthorize("@ss.hasPermission('system:inspections-log:query')") public CommonResult> getInspectionsLogPage(@Valid InspectionsLogPageReqVO pageReqVO) { PageResult pageResult = inspectionsLogService.getInspectionsLogPage(pageReqVO); + + return success(BeanUtils.toBean(pageResult, InspectionsLogRespVO.class)); } @@ -94,6 +98,15 @@ public class InspectionsLogController { @PreAuthorize("@ss.hasPermission('system:inspections-log:query')") public CommonResult> getInspectionsLogList(@Valid InspectionsLogPageReqVO pageReqVO) { List list = inspectionsLogService.list(pageReqVO); + + if (list != null && list.size() > 0) { + list.forEach(item->{ + //图片相关 + final List> fileList = fileInfoService.getFileList("644", "2", item.getId().toString()); + item.setFileList(fileList); + }); + } + return success(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/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 b1aa3e1..b2ddc59 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 @@ -47,4 +47,7 @@ public class InspectionsLogRespVO { @ExcelProperty("创建时间") private LocalDateTime createTime; -} \ No newline at end of file + @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/user/UserController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java index 3b89970..fbbfa10 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java @@ -132,6 +132,12 @@ public class UserController { return success(UserConvert.INSTANCE.convertSimpleList(list, deptMap)); } + @GetMapping({"/simple-zg-list"}) + @Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项") + public CommonResult> getSimpleUserZGList() { + return success(userService.getSimpleUserZGList()); + } + @GetMapping("/get") @Operation(summary = "获得用户详情") @Parameter(name = "id", description = "编号", required = true, example = "1024") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/DeptUserReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/DeptUserReqVO.java new file mode 100644 index 0000000..4ee73b3 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/DeptUserReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.system.controller.admin.user.vo.user; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class DeptUserReqVO { + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String realName; + + @Schema(description = "部门ID", example = "我是一个用户") + private Long deptId; + @Schema(description = "部门名称", example = "IT 部") + private String deptName; + +} 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 03df04b..a6e3004 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 @@ -58,5 +58,7 @@ public class InspectionsLogDO extends BaseDO { //协同人员的id 还是要加上 会有同名的情况 private String cooperateWithIds; //协同人员是否可以看到任务记录 - + //相关文件 + @TableField(exist = false) + private List> fileList; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java index 152ed44..1e9147e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java @@ -23,7 +23,7 @@ public interface EnterpriseInspectionsMapper extends BaseMapperX selectPageGroup(EnterpriseInspectionsPageReqVO reqVO) { diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java index dbd72e8..48d0984 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java @@ -54,4 +54,6 @@ public interface EnterpriseInspectionsService { PageResult getEnterpriseInspectionsPage(EnterpriseInspectionsPageReqVO pageReqVO); void passOn(PassOnSaveVO passOnSaveVO); + + List getListByUserIdAndTaskName(Long userId, String taskName); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java index 5323612..2574d13 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java @@ -14,6 +14,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper; import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper; import cn.iocoder.yudao.module.system.service.dept.DeptService; 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 lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -211,6 +212,14 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe } + @Override + public List getListByUserIdAndTaskName(Long userId, String taskName) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(EnterpriseInspectionsDO::getUserId, userId); + wrapper.eq(EnterpriseInspectionsDO::getTaskName, taskName); + return enterpriseInspectionsMapper.selectList(wrapper); + } + //获得检测记录最新一条 public InspectionsLogDO getInspectionsLogNew(Long inspectionsId) { QueryWrapper wrapper = new QueryWrapper<>(); 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 99ac82a..108f145 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 @@ -53,4 +53,5 @@ public interface FileInfoService { */ PageResult getFileInfoPage(FileInfoPageReqVO pageReqVO); + List> getFileList(String dictType, String 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 1f78139..f2b99ec 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 @@ -1,10 +1,14 @@ package cn.iocoder.yudao.module.system.service.fileInfo; +import cn.iocoder.yudao.module.infra.api.file.FileApi; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; + 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; @@ -30,6 +34,9 @@ public class FileInfoServiceImpl implements FileInfoService { @Resource private FileInfoMapper fileInfoMapper; + @Resource + private FileApi fileApi; + @Override public Long createFileInfo(FileInfoSaveReqVO createReqVO) { // 插入 @@ -72,4 +79,23 @@ public class FileInfoServiceImpl implements FileInfoService { return fileInfoMapper.selectPage(pageReqVO); } + @Override + public List> getFileList(String dictType, String dictData, String unitId) { + + List> mapList = new ArrayList<>(); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(FileInfoDO::getDictType, dictType); + wrapper.eq(FileInfoDO::getDictData, dictData); + wrapper.eq(FileInfoDO::getUnitId, unitId); + final List collect = fileInfoMapper.selectList(wrapper).stream().map(res -> res.getInfraFileId()).collect(Collectors.toList()); + + if (!collect.isEmpty()) { + final List> list = fileApi.listFile(collect); + mapList.addAll(list); + } + + return mapList; + } + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java index fe948dd..ae04b4e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java @@ -7,10 +7,7 @@ import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthRegisterReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportExcelVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportRespVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; import cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo.UserAuditLogSaveReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import com.xingyuv.jushauth.model.AuthUser; @@ -229,4 +226,6 @@ public interface AdminUserService { AdminUserDO autoRegisterUser(AuthUser authUser, int userType); void userAudit(UserAuditLogSaveReqVO auditLogSaveReqVO); + + List getSimpleUserZGList(); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java index df56022..81d5215 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java @@ -17,10 +17,7 @@ import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthRegisterReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportExcelVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportRespVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; import cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo.UserAuditLogSaveReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; import cn.iocoder.yudao.module.system.dal.dataobject.dept.UserPostDO; @@ -36,6 +33,7 @@ import cn.iocoder.yudao.module.system.service.dept.PostService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.tenant.TenantService; import cn.iocoder.yudao.module.system.service.userAuditlog.UserAuditLogService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.mzt.logapi.context.LogRecordContext; import com.mzt.logapi.service.impl.DiffParseFunction; @@ -52,6 +50,7 @@ import javax.validation.ConstraintViolationException; import java.io.InputStream; import java.time.LocalDateTime; import java.util.*; +import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; @@ -93,6 +92,8 @@ public class AdminUserServiceImpl implements AdminUserService { private ConfigApi configApi; @Resource private UserAuditLogMapper userAuditLogMapper; + @Resource + private AdminUserMapper adminUserMapper; @Override @Transactional(rollbackFor = Exception.class) @@ -579,6 +580,28 @@ public class AdminUserServiceImpl implements AdminUserService { } + @Override + public List getSimpleUserZGList() { + + List list = new ArrayList<>(); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.isNotNull(AdminUserDO::getRealName); + wrapper.eq(AdminUserDO::getStatus, CommonStatusEnum.ENABLE.getStatus()); + wrapper.isNotNull(AdminUserDO::getDeptId); + + final List adminUserDOS = userMapper.selectList(wrapper); + adminUserDOS.forEach(item->{ + DeptUserReqVO deptUserReqVO = new DeptUserReqVO(); + deptUserReqVO.setId(item.getId()); + deptUserReqVO.setRealName(item.getRealName()); + final DeptDO dept = deptService.getDept(item.getDeptId()); + deptUserReqVO.setDeptName(dept.getName()); + list.add(deptUserReqVO); + }); + + return list; + } + public void bindSocialUser(Long userId, AuthUser authUser) { // SocialUserDO socialUser = new SocialUserDO(); // socialUser.setUserId(userId); diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 81a9141..09ccef5 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -46,7 +46,7 @@ spring: primary: master datasource: master: - url: jdbc:mysql://127.0.0.1:3306/hb-yudao?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例 + url: jdbc:mysql://192.168.2.5:3306/hb-yudao?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -55,7 +55,7 @@ spring: # url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例 username: root - password: 123123 + password: jingke@123 # username: sa # SQL Server 连接的示例 # password: Yudao@2024 # SQL Server 连接的示例 # username: SYSDBA # DM 连接的示例 @@ -185,8 +185,8 @@ wx: mp: # 公众号配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档 # app-id: wx041349c6f39b268b # 测试号(牛希尧提供的) # secret: 5abee519483bc9f8cb37ce280e814bd0 - app-id: wx5b23ba7a5589ecbb # 测试号(自己的) - secret: 2a7b3b20c537e52e74afd395eb85f61f + app-id: wx6d80755768234f3b # 测试号(自己的) + secret: c8180f2ab1b8454d403c7aa336782e21 # app-id: wxa69ab825b163be19 # 测试号(Kongdy 提供的) # secret: bd4f9fab889591b62aeac0d7b8d8b4a0 # 存储配置,解决 AccessToken 的跨节点的共享