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 48d4a27..5227328 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 @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; @@ -47,12 +48,19 @@ public class EnterpriseInspectionsController { @PostMapping("/passOn") @Operation(summary = "执法记录变更") - @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:create')") + @PreAuthorize("@ss.hasPermission('system:enterpriseinspections:index')") public CommonResult passOn(@Valid @RequestBody PassOnSaveVO passOnSaveVO) { enterpriseInspectionsService.passOn(passOnSaveVO); return success("添加成功"); } + @GetMapping("/changeSelectUser") + @Operation(summary = "根据部门返回部门下的其他人员") +// @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:create')") + public CommonResult> changeSelectUser(Long deptId) { + return success(enterpriseInspectionsService.changeSelectUser(deptId)); + } + @PutMapping("/update") @Operation(summary = "更新企业检查记录表,用于记录与企业相关的环保检查信息。") @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:update')") @@ -90,7 +98,7 @@ public class EnterpriseInspectionsController { @GetMapping("/page") @Operation(summary = "获得企业检查记录表,用于记录与企业相关的环保检查信息。分页") - @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')") +// @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')") public CommonResult> getEnterpriseInspectionsPage(@Valid EnterpriseInspectionsPageReqVO pageReqVO) { PageResult pageResult = enterpriseInspectionsService.getEnterpriseInspectionsPage(pageReqVO); return success(BeanUtils.toBean(pageResult, EnterpriseInspectionsRespVO.class)); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsPageReqVO.java index a4be474..2b56c17 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsPageReqVO.java @@ -45,5 +45,8 @@ public class EnterpriseInspectionsPageReqVO extends PageParam { @Schema(description = "按部门") private Long departmentId; + @Schema(description = "按部门查询的用户id集合") + private List userIds; + } 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 d68cbc6..ec089b4 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 @@ -36,6 +36,10 @@ public class EnterpriseInspectionsRespVO { @ExcelProperty("企业名称") private String enterpriseName; + @Schema(description = "企业地址", example = "27002") + @ExcelProperty("企业地址") + private String enterpriseAddress; + @Schema(description = "任务类型", example = "27002") @ExcelProperty("任务类型") private List tagList; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/SelectUserChangeVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/SelectUserChangeVO.java new file mode 100644 index 0000000..c045328 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/SelectUserChangeVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +@Data +public class SelectUserChangeVO { + @Schema(description = "用户ID", example = "3876") + private Long userId; + @Schema(description = "用户姓名", example = "29150") + private String realName; + @Schema(description = "部门名称", example = "29150") + private List roleName; + @Schema(description = "部门名称", example = "29150") + private String avatar; + + +} 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 2583967..72e0760 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 @@ -50,7 +50,7 @@ public class InspectionsLogController { } @PutMapping("/cooperateWithSignIn") - @Operation(summary = "协同人员打开") + @Operation(summary = "协同人员打卡") @PreAuthorize("@ss.hasPermission('system:inspections-log:update')") public CommonResult cooperateWithSignIn(Long inspectionsLogId) { inspectionsLogService.cooperateWithSignIn(inspectionsLogId); @@ -88,8 +88,6 @@ 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)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/SignInLogController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/SignInLogController.java new file mode 100644 index 0000000..4f5614e --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/SignInLogController.java @@ -0,0 +1,96 @@ +package cn.iocoder.yudao.module.system.controller.admin.signinlog; + +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.signinlog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.signinlog.SignInLogDO; +import cn.iocoder.yudao.module.system.service.signinlog.SignInLogService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +@Tag(name = "管理后台 - 协调人员打卡记录") +@RestController +@RequestMapping("/system/sign-in-log") +@Validated +public class SignInLogController { + + @Resource + private SignInLogService signInLogService; + + @PostMapping("/create") + @Operation(summary = "创建协调人员打卡记录") + @PreAuthorize("@ss.hasPermission('system:sign-in-log:create')") + public CommonResult createSignInLog(@Valid @RequestBody SignInLogSaveReqVO createReqVO) { + return success(signInLogService.createSignInLog(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新协调人员打卡记录") + @PreAuthorize("@ss.hasPermission('system:sign-in-log:update')") + public CommonResult updateSignInLog(@Valid @RequestBody SignInLogSaveReqVO updateReqVO) { + signInLogService.updateSignInLog(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除协调人员打卡记录") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('system:sign-in-log:delete')") + public CommonResult deleteSignInLog(@RequestParam("id") Long id) { + signInLogService.deleteSignInLog(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得协调人员打卡记录") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:sign-in-log:query')") + public CommonResult getSignInLog(@RequestParam("id") Long id) { + SignInLogDO signInLog = signInLogService.getSignInLog(id); + return success(BeanUtils.toBean(signInLog, SignInLogRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得协调人员打卡记录分页") + @PreAuthorize("@ss.hasPermission('system:sign-in-log:query')") + public CommonResult> getSignInLogPage(@Valid SignInLogPageReqVO pageReqVO) { + PageResult pageResult = signInLogService.getSignInLogPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, SignInLogRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出协调人员打卡记录 Excel") + @PreAuthorize("@ss.hasPermission('system:sign-in-log:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportSignInLogExcel(@Valid SignInLogPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = signInLogService.getSignInLogPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "协调人员打卡记录.xls", "数据", SignInLogRespVO.class, + BeanUtils.toBean(list, SignInLogRespVO.class)); + } + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogPageReqVO.java new file mode 100644 index 0000000..54e3a55 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogPageReqVO.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.system.controller.admin.signinlog.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 SignInLogPageReqVO extends PageParam { + + @Schema(description = "执法记录id", example = "19972") + private Long insId; + + @Schema(description = "用户id", example = "30997") + private Long userId; + + @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/signinlog/vo/SignInLogRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogRespVO.java new file mode 100644 index 0000000..bac7c2f --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogRespVO.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.system.controller.admin.signinlog.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.*; + +@Schema(description = "管理后台 - 协调人员打卡记录 Response VO") +@Data +@ExcelIgnoreUnannotated +public class SignInLogRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "10998") + @ExcelProperty("主键") + private Long id; + + @Schema(description = "执法记录id", example = "19972") + @ExcelProperty("执法记录id") + private Long insId; + + @Schema(description = "用户id", example = "30997") + @ExcelProperty("用户id") + private Long userId; + + @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/signinlog/vo/SignInLogSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogSaveReqVO.java new file mode 100644 index 0000000..4cf334c --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogSaveReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.system.controller.admin.signinlog.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; + +@Schema(description = "管理后台 - 协调人员打卡记录新增/修改 Request VO") +@Data +public class SignInLogSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "10998") + private Long id; + + @Schema(description = "执法记录id", example = "19972") + private Long insId; + + @Schema(description = "用户id", example = "30997") + private Long userId; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java index 8620807..4514411 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.taskinfo; +import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.infra.api.job.JobApi; @@ -10,14 +11,18 @@ import cn.iocoder.yudao.module.system.controller.admin.tasktag.vo.TaskTagPageReq import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO; import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO; +import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; 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.user.AdminUserMapper; import cn.iocoder.yudao.module.system.service.dept.DeptService; import cn.iocoder.yudao.module.system.service.enterprise.EnterpriseService; import cn.iocoder.yudao.module.system.service.enterpriseinspections.EnterpriseInspectionsService; +import cn.iocoder.yudao.module.system.service.taglibrary.TagLibraryService; import cn.iocoder.yudao.module.system.service.tasktag.TaskTagService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; @@ -27,6 +32,7 @@ import io.swagger.v3.oas.annotations.Operation; import java.util.*; import java.io.IOException; +import java.util.stream.Collectors; import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -47,6 +53,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; +@Slf4j @Tag(name = "管理后台 - 任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。") @RestController @RequestMapping("/system/task-info") @@ -65,7 +72,10 @@ public class TaskInfoController { private TaskTagService taskTagService; @Resource private EnterpriseService enterpriseService; - + @Resource + private TagLibraryService tagLibraryService; + @Resource + private AdminUserMapper adminUserMapper; @PostMapping("/create") @Operation(summary = "创建任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。") @@ -135,6 +145,34 @@ public class TaskInfoController { } + + @GetMapping("/appGet") + @Operation(summary = "获得任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:task-info:query')") + public CommonResult appGet(@RequestParam("id") Long id) { + TaskInfoDO taskInfo = taskInfoService.getTaskInfo(id); + if (taskInfo != null) { + //标签 + final List tagLibraryDOS = tagLibraryService.listByTaskId(taskInfo.getId()); + if (CollUtil.isNotEmpty(tagLibraryDOS)) { + taskInfo.setTagList(tagLibraryDOS.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList())); + } + //发布部门 + final Long userId = Long.valueOf(taskInfo.getCreator()); + AdminUserDO user = adminUserMapper.selectById(userId); + log.info("useruseruser:{}", user); + if (user.getDeptId() != null) { + final DeptDO dept = deptService.getDept(user.getDeptId()); + taskInfo.setDeptName(dept.getName()); + } + + } + + return success(BeanUtils.toBean(taskInfo, TaskInfoRespVO.class)); + + } + @GetMapping("/page") @Operation(summary = "获得任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。分页") @PreAuthorize("@ss.hasPermission('system:task-info:query')") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java index 813ed2b..b67f19d 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java @@ -112,16 +112,18 @@ public class TaskInfoRespVO { private List tagLibraryIds; //任务总数 - @TableField(exist = false) private Integer taskExecNum; //已完成数 - @TableField(exist = false) private Integer taskFinishNum; - @TableField(exist = false) + //任务标签 private List tagList; + //发布部门 + private String deptName; + + diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java index 192e053..4037005 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java @@ -23,7 +23,7 @@ public class UserSaveReqVO { @Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao") @NotBlank(message = "用户账号不能为空") - @Pattern(regexp = "^[a-zA-Z0-9]{4,30}$", message = "用户账号由 数字、字母 组成") + @Pattern(regexp = "^[a-zA-Z0-9_]{4,30}$", message = "用户账号由 数字、字母 组成") @Size(min = 4, max = 30, message = "用户账号长度为 4-30 个字符") @DiffLogField(name = "用户账号") private String username; 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 c047432..f610cb8 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 @@ -57,12 +57,22 @@ public class EnterpriseInspectionsDO extends BaseDO { //企业名称 @TableField(exist = false) private String enterpriseName; + + //企业名称 + @TableField(exist = false) + private String enterpriseAddress; + //进度状态 @TableField(exist = false) private Integer inspectionStatus; - //标签集合 + //企业标签集合 @TableField(exist = false) private List tagList; + + //任务标签 + @TableField(exist = false) + private String taskTag; + //执法部门 @TableField(exist = false) private String department; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/signinlog/SignInLogDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/signinlog/SignInLogDO.java new file mode 100644 index 0000000..9e8af32 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/signinlog/SignInLogDO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.signinlog; + +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("sign_in_log") +@KeySequence("sign_in_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SignInLogDO extends BaseDO { + + /** + * 主键 + */ + @TableId + private Long id; + /** + * 执法记录id + */ + private Long insId; + /** + * 用户id + */ + private Long userId; + +} \ 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/taskinfo/TaskInfoDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java index 06905b9..4270eeb 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java @@ -115,4 +115,8 @@ public class TaskInfoDO extends BaseDO { @TableField(exist = false) private List tagList; + + //发布部门 + @TableField(exist = false) + private String deptName; } 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 fbb307e..bd341ac 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 @@ -20,10 +20,12 @@ public interface EnterpriseInspectionsMapper extends BaseMapperX selectPage(EnterpriseInspectionsPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(EnterpriseInspectionsDO::getTaskId, reqVO.getTaskId()) + .eqIfPresent(EnterpriseInspectionsDO::getUserId, reqVO.getUserId()) .eqIfPresent(EnterpriseInspectionsDO::getEnterpriseId, reqVO.getEnterpriseId()) .betweenIfPresent(EnterpriseInspectionsDO::getCreateTime, reqVO.getCreateTime()) .inIfPresent(EnterpriseInspectionsDO::getEnterpriseId, reqVO.getEnterpriseList()) .inIfPresent(EnterpriseInspectionsDO::getTaskId, reqVO.getTaskList()) + .inIfPresent(EnterpriseInspectionsDO::getUserId, reqVO.getUserIds()) .orderByDesc(EnterpriseInspectionsDO::getId)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/signinlog/SignInLogMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/signinlog/SignInLogMapper.java new file mode 100644 index 0000000..367dd8c --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/signinlog/SignInLogMapper.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.system.dal.mysql.signinlog; + +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.signinlog.SignInLogDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.admin.signinlog.vo.*; + +/** + * 协调人员打卡记录 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface SignInLogMapper extends BaseMapperX { + + default PageResult selectPage(SignInLogPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(SignInLogDO::getInsId, reqVO.getInsId()) + .eqIfPresent(SignInLogDO::getUserId, reqVO.getUserId()) + .betweenIfPresent(SignInLogDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(SignInLogDO::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/enterpriseinspections/EnterpriseInspectionsService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java index 424c076..fca80e8 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 @@ -4,6 +4,7 @@ import java.util.*; import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.*; import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import javax.validation.Valid; @@ -60,4 +61,6 @@ public interface EnterpriseInspectionsService { List getEnterpriseInspectionsList(EnterpriseInspectionsPageReqVO pageReqVO); + + List changeSelectUser(Long deptId); } 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 4887509..0e96ebb 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 @@ -3,6 +3,8 @@ 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.permission.RoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO; 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; @@ -10,10 +12,14 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.dal.mysql.dept.DeptMapper; import cn.iocoder.yudao.module.system.dal.mysql.enterprise.EnterpriseMapper; import cn.iocoder.yudao.module.system.dal.mysql.inspectionslog.InspectionsLogMapper; +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.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.dal.mysql.user.AdminUserMapper; import cn.iocoder.yudao.module.system.service.dept.DeptService; +import cn.iocoder.yudao.module.system.service.taglibrary.TagLibraryService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -66,6 +72,14 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe private AdminUserService adminUserService; @Resource private DeptService deptService; + @Resource + private TagLibraryService tagLibraryService; + @Resource + private AdminUserMapper adminUserMapper; + @Resource + private UserRoleMapper userRoleMapper; + @Resource + private RoleMapper roleMapper; @Override public Long createEnterpriseInspections(EnterpriseInspectionsSaveReqVO createReqVO) { @@ -148,7 +162,33 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe @Override public PageResult getEnterpriseInspectionsPage(EnterpriseInspectionsPageReqVO pageReqVO) { -// final Long userId = getLoginUserId(); + //根据角色显示不同 + /* + 管理员,局长,查全部 + 检查员,查自己的 + 队长 查本部门 + */ + Long loginUserId = getLoginUserId(); + final AdminUserDO user1 = adminUserService.getUser(loginUserId); + if (user1.getPostIds().contains(1l) || user1.getPostIds().contains(2l)) { + //全部 + } else if (user1.getPostIds().contains(4l)) { + //本部门 + pageReqVO.setDepartmentId(user1.getDeptId()); + + } else if (user1.getPostIds().contains(5l)) { + //自己 + pageReqVO.setUserId(loginUserId); + } + + //按照部门查询 + if (pageReqVO.getDepartmentId() != null) { + final List adminUserDOS = adminUserMapper.selectList(new QueryWrapper().eq("dept_id", pageReqVO.getDepartmentId())); + if (adminUserDOS != null || adminUserDOS.size() > 0) { + final List collect = adminUserDOS.stream().map(item -> item.getId()).collect(Collectors.toList()); + pageReqVO.setUserIds(collect); + } + } //根据企业名称查询 if (pageReqVO.getEnterpriseName() != null) { @@ -183,29 +223,22 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe } 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 != null && 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); } + + //查询企业标签 + final List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterpriseDO.getId()); + if (tagLibraryDOS != null) { + item.setTagList(tagLibraryDOS.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList())); + } + + item.setEnterpriseName(enterpriseDO.getEnterprisesName()); + item.setEnterpriseAddress(enterpriseDO.getAddress()); + //查询执行的最新一条记录 final InspectionsLogDO inspectionsLogNew = this.getInspectionsLogNew(item.getId()); if (inspectionsLogNew != null) { @@ -226,14 +259,15 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe } else { //根据执法人员id 查询其所属部门 - final Long userId = Long.valueOf(item.getUserId()); - final AdminUserDO user = adminUserService.getUser(userId); - item.setInspectionStatus(1); - item.setInspectName(user.getRealName()); - - if (user == null) { - throw exception(USER_NOT_EXISTS); + if (item.getUserId() != null) { + final Long userId = Long.valueOf(item.getUserId()); + final AdminUserDO user = adminUserService.getUser(userId); + item.setInspectName(user.getRealName()); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } } + } }); } @@ -244,7 +278,6 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe enterpriseInspectionsDOPageResult.setTotal(Long.valueOf(collect.size())); } - return enterpriseInspectionsDOPageResult; } @@ -297,10 +330,7 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe } else { throw exception(ENTERPRISE_INSPECTIONS_STATUS_ERROR); } - }); - - } @Override @@ -340,4 +370,44 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe public List getEnterpriseInspectionsList(EnterpriseInspectionsPageReqVO pageReqVO) { return enterpriseInspectionsMapper.selectList(pageReqVO); } + + @Override + public List changeSelectUser(Long deptId) { + List list = new ArrayList<>(); + + List adminUserDOS; + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.isNotNull(AdminUserDO::getRealName); + wrapper.ne(AdminUserDO::getId, 1L); + if (deptId != null) { + wrapper.eq(AdminUserDO::getDeptId, deptId); + } + adminUserDOS = adminUserMapper.selectList(wrapper); + + if (adminUserDOS != null && adminUserDOS.size() > 0) { + adminUserDOS.forEach(item-> { + SelectUserChangeVO userChangeVO = new SelectUserChangeVO(); + userChangeVO.setUserId(item.getId()); + userChangeVO.setRealName(item.getRealName()); + userChangeVO.setAvatar(item.getAvatar()); + + QueryWrapper roleDOQueryWrapper = new QueryWrapper<>(); + roleDOQueryWrapper.eq("user_id", item.getId()); + List userRoleDOS = userRoleMapper.selectList(roleDOQueryWrapper); + if (userRoleDOS != null && userRoleDOS.size() > 0) { + //查询角色名称 + List roleIds = userRoleDOS.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList()); + List roleDOS = roleMapper.selectBatchIds(roleIds); + if (roleDOS != null && roleDOS.size() > 0) { + List roleNames = roleDOS.stream().map(RoleDO::getName).collect(Collectors.toList()); + userChangeVO.setRoleName(roleNames); + } + } + list.add(userChangeVO); + }); + }; + + return list; + } } 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 8a5a2fa..e37e0a4 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,9 +1,11 @@ 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.signinlog.SignInLogDO; 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.signinlog.SignInLogMapper; 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; @@ -45,9 +47,16 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { private EnterpriseInspectionsMapper enterpriseInspectionsMapper; @Resource private TaskInfoMapper taskInfoMapper; + @Resource + private SignInLogMapper signInLogMapper; @Override - public Long createInspectionsLog(InspectionsLogSaveReqVO createReqVO) { + public Long + + + + + createInspectionsLog(InspectionsLogSaveReqVO createReqVO) { //当前用户id Long loginUserId = getLoginUserId(); AdminUserDO user = adminUserService.getUser(loginUserId); @@ -140,6 +149,7 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { } @Override + @Transactional public List list(InspectionsLogPageReqVO pageReqVO) { QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("inspections_id", pageReqVO.getInspectionsId()); @@ -174,6 +184,12 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { } inspectionsLogMapper.updateById(inspectionsLogDO); + + //插入协同人员打卡记录表 + SignInLogDO signInLogDO = new SignInLogDO(); + signInLogDO.setInsId(inspectionsLogId); + signInLogDO.setUserId(getLoginUserId()); + signInLogMapper.insert(signInLogDO); } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogService.java new file mode 100644 index 0000000..85ae52b --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogService.java @@ -0,0 +1,56 @@ +package cn.iocoder.yudao.module.system.service.signinlog; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.signinlog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.signinlog.SignInLogDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +import javax.validation.Valid; + +/** + * 协调人员打卡记录 Service 接口 + * + * @author 芋道源码 + */ +public interface SignInLogService { + + /** + * 创建协调人员打卡记录 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createSignInLog(@Valid SignInLogSaveReqVO createReqVO); + + /** + * 更新协调人员打卡记录 + * + * @param updateReqVO 更新信息 + */ + void updateSignInLog(@Valid SignInLogSaveReqVO updateReqVO); + + /** + * 删除协调人员打卡记录 + * + * @param id 编号 + */ + void deleteSignInLog(Long id); + + /** + * 获得协调人员打卡记录 + * + * @param id 编号 + * @return 协调人员打卡记录 + */ + SignInLogDO getSignInLog(Long id); + + /** + * 获得协调人员打卡记录分页 + * + * @param pageReqVO 分页查询 + * @return 协调人员打卡记录分页 + */ + PageResult getSignInLogPage(SignInLogPageReqVO pageReqVO); + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogServiceImpl.java new file mode 100644 index 0000000..c94949b --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogServiceImpl.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.system.service.signinlog; + +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.signinlog.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.signinlog.SignInLogDO; +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.signinlog.SignInLogMapper; + +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 SignInLogServiceImpl implements SignInLogService { + + @Resource + private SignInLogMapper signInLogMapper; + + @Override + public Long createSignInLog(SignInLogSaveReqVO createReqVO) { + // 插入 + SignInLogDO signInLog = BeanUtils.toBean(createReqVO, SignInLogDO.class); + signInLogMapper.insert(signInLog); + // 返回 + return signInLog.getId(); + } + + @Override + public void updateSignInLog(SignInLogSaveReqVO updateReqVO) { + // 校验存在 + validateSignInLogExists(updateReqVO.getId()); + // 更新 + SignInLogDO updateObj = BeanUtils.toBean(updateReqVO, SignInLogDO.class); + signInLogMapper.updateById(updateObj); + } + + @Override + public void deleteSignInLog(Long id) { + // 校验存在 + validateSignInLogExists(id); + // 删除 + signInLogMapper.deleteById(id); + } + + private void validateSignInLogExists(Long id) { + if (signInLogMapper.selectById(id) == null) { + throw exception(USER_NOT_EXISTS); + } + } + + @Override + public SignInLogDO getSignInLog(Long id) { + return signInLogMapper.selectById(id); + } + + @Override + public PageResult getSignInLogPage(SignInLogPageReqVO pageReqVO) { + return signInLogMapper.selectPage(pageReqVO); + } + +} 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 c256fec..3fc2657 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 @@ -56,4 +56,10 @@ public interface TagLibraryService { List list(String[] codeList); List childrenList(Long id); + + //根据任务id差标签 + List listByTaskId(Long taskId); + + //根据企业id标签查标签 + List listByEnterpriseId(Long enterpriseId); } 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 ca7a06b..6ceb520 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,10 @@ package cn.iocoder.yudao.module.system.service.taglibrary; +import cn.iocoder.yudao.module.system.dal.dataobject.enterprisetag.EnterpriseTagDO; +import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO; +import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMapper; +import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.apache.poi.ss.formula.functions.T; import org.springframework.stereotype.Service; @@ -15,6 +20,7 @@ import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; @@ -30,6 +36,10 @@ public class TagLibraryServiceImpl implements TagLibraryService { @Resource private TagLibraryMapper tagLibraryMapper; + @Resource + private TaskTagMapper taskTagMapper; + @Resource + private EnterpriseTagMapper enterpriseTagMapper; @Override public Integer createTagLibrary(TagLibrarySaveReqVO createReqVO) { @@ -104,6 +114,32 @@ public class TagLibraryServiceImpl implements TagLibraryService { return tagLibraryMapper.selectList(wrapper); } + @Override + public List listByTaskId(Long taskId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(TaskTagDO::getTaskId, taskId); + final List taskTagDOS = taskTagMapper.selectList(wrapper); + if (taskTagDOS != null && taskTagDOS.size() > 0) { + final List tagLibraryDOS = tagLibraryMapper.selectByIds(taskTagDOS.stream().map(TaskTagDO::getTagId).collect(Collectors.toList())); + return tagLibraryDOS; + } + + return null; + } + + @Override + public List listByEnterpriseId(Long enterpriseId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(EnterpriseTagDO::getEnterpriseId, enterpriseId); + final List enterpriseTagDOS = enterpriseTagMapper.selectList(wrapper); + if (enterpriseTagDOS != null && enterpriseTagDOS.size() > 0) { + final List tagLibraryDOS = tagLibraryMapper.selectByIds(enterpriseTagDOS.stream().map(EnterpriseTagDO::getTagId).collect(Collectors.toList())); + return tagLibraryDOS; + } + + return null; + } + // 递归构建树 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 83fb550..cd808bb 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 @@ -2,16 +2,20 @@ package cn.iocoder.yudao.module.system.service.taskinfo; import cn.hutool.core.convert.Convert; import cn.hutool.core.date.DateUtil; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.infra.api.job.JobApi; import cn.iocoder.yudao.module.system.controller.admin.tasktag.vo.TaskTagPageReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO; import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO; import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; 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.enterpriseinspections.EnterpriseInspectionsMapper; import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper; import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper; +import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import lombok.extern.slf4j.Slf4j; @@ -61,6 +65,10 @@ public class TaskInfoServiceImpl implements TaskInfoService { private EnterpriseInspectionsMapper enterpriseInspectionsMapper; @Resource private TagLibraryMapper tagLibraryMapper; + @Resource + private AdminUserService adminUserService; + @Resource + private AdminUserMapper adminUserMapper; @Override @Transactional @@ -192,12 +200,11 @@ public class TaskInfoServiceImpl implements TaskInfoService { //按标签查询 if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) { - log.info("pageReqVO.getTagList():{}", pageReqVO.getTagList()); LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(TaskTagDO::getTaskId, pageReqVO.getTagList()); + wrapper.in(TaskTagDO::getTagId, pageReqVO.getTagList()); final List taskTagDOS = taskTagMapper.selectList(wrapper); if (taskTagDOS != null && taskTagDOS.size() > 0) { - pageReqVO.setTagList(taskTagDOS.stream().map(TaskTagDO::getTagId).collect(Collectors.toList())); + pageReqVO.setTagList(taskTagDOS.stream().map(item->item.getTaskId()).collect(Collectors.toList())); } } @@ -229,7 +236,30 @@ public class TaskInfoServiceImpl implements TaskInfoService { taskInfoDOPageResult.getList().forEach(item->{ QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("task_id", item.getId()); - wrapper.eq("user_id", getLoginUserId()); + //根据不同的角色查询 + /* + 管理员,局长,查全部 + 检查员,查自己的 + 队长 查本部门 + */ + Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); + + final AdminUserDO user1 = adminUserService.getUser(loginUserId); + if (user1.getPostIds().contains(1l) || user1.getPostIds().contains(2l)) { + //全部 + } else if (user1.getPostIds().contains(4l)) { + //本部门 + final List adminUserDOS = adminUserMapper.selectList(new QueryWrapper().eq("dept_id", user1.getDeptId())); + if (adminUserDOS != null || adminUserDOS.size() > 0) { + final List collect = adminUserDOS.stream().map(res -> res.getId()).collect(Collectors.toList()); + wrapper.in("user_id", collect); + } + + } else if (user1.getPostIds().contains(5l)) { + //自己 + wrapper.eq("user_id", loginUserId); + } + item.setTaskExecNum(0); List enterpriseInspectionsDOList = enterpriseInspectionsMapper.selectList(wrapper); if (enterpriseInspectionsDOList != null && enterpriseInspectionsDOList.size() > 0) { @@ -253,6 +283,8 @@ public class TaskInfoServiceImpl implements TaskInfoService { }); } + log.info("taskInfoDOPageResult:{}", taskInfoDOPageResult.getList()); + //筛选出 TaskExecNum 为0的 if (taskInfoDOPageResult.getList() != null && taskInfoDOPageResult.getList().size() > 0) { final List collect = taskInfoDOPageResult.getList().stream().filter(res -> res.getTaskExecNum() > 0).collect(Collectors.toList());