From 95004da9ca0effd75b19eb77fe3b2cd932ad5ce9 Mon Sep 17 00:00:00 2001 From: dx <1242347652@qq.com> Date: Fri, 14 Feb 2025 15:59:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A7=E6=B3=95=E7=AD=BE=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/enums/ErrorCodeConstants.java | 14 ++ .../InspectionsLogController.java | 40 +++- .../vo/InspectionsLogAppListVO.java | 24 ++ .../vo/InspectionsLogPageReqVO.java | 6 +- .../vo/InspectionsLogRespVO.java | 9 +- .../vo/InspectionsLogSaveReqVO.java | 2 +- .../admin/signinlog/SignInLogController.java | 2 +- .../signinlog/vo/SignInLogPageReqVO.java | 13 +- .../admin/signinlog/vo/SignInLogRespVO.java | 14 +- .../signinlog/vo/SignInLogSaveReqVO.java | 12 + .../admin/taskinfo/TaskInfoController.java | 3 +- .../inspectionslog/InspectionsLogDO.java | 8 +- .../dal/dataobject/signinlog/SignInLogDO.java | 12 +- .../inspectionslog/InspectionsLogMapper.java | 4 +- .../dal/mysql/signinlog/SignInLogMapper.java | 4 +- .../system/service/dept/DeptServiceImpl.java | 1 + .../EnterpriseInspectionsService.java | 5 +- .../EnterpriseInspectionsServiceImpl.java | 69 ++++-- .../inspectionslog/InspectionsLogService.java | 10 +- .../InspectionsLogServiceImpl.java | 221 +++++++++++++----- .../signinlog/SignInLogServiceImpl.java | 1 - .../service/taskinfo/TaskInfoServiceImpl.java | 5 +- 22 files changed, 378 insertions(+), 101 deletions(-) create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogAppListVO.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 a9e37a4..5effb1e 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 @@ -192,4 +192,18 @@ public interface ErrorCodeConstants { ErrorCode ENTERPRISE_INSPECTIONS_STATUS_ERROR = new ErrorCode(1-003-002-000, "此状态下,不能转发执法任务"); ErrorCode ENTERPRISE_INSPECTIONS_STATUS_ERROR2 = new ErrorCode(1-003-002-001, "任务不能转给自己"); + + ErrorCode SIGN_IN_LOG_ERROR = new ErrorCode(1-003-005-001, "打卡记录不存在"); + + ErrorCode SIGN_IN_LOG_ERROR2 = new ErrorCode(1-003-005-001, "已经打卡,不能重复打卡"); + + ErrorCode SIGN_IN_LOG_ERROR3 = new ErrorCode(1-003-005-002, "此状态不能打卡"); + + ErrorCode SIGN_IN_LOG_ERROR4 = new ErrorCode(1-003-005-003, "执行人还未打卡"); + + ErrorCode SIGN_IN_LOG_ERROR5 = new ErrorCode(1-003-005-003, "只有当前企业执行人才能提交审核"); + + ErrorCode SIGN_IN_LOG_ERROR6 = new ErrorCode(1-003-005-003, "超过2人才能打开"); + + } 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 72e0760..8beddf5 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,7 +1,9 @@ package cn.iocoder.yudao.module.system.controller.admin.inspectionslog; +import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.PassOnSaveVO; import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; @@ -35,6 +37,7 @@ import javax.validation.Valid; @RestController @RequestMapping("/system/inspections-log") @Validated +@Slf4j public class InspectionsLogController { @Resource @@ -42,11 +45,26 @@ public class InspectionsLogController { @Resource private FileInfoService fileInfoService; - @PostMapping("/create") - @Operation(summary = "创建检查结果日志") - @PreAuthorize("@ss.hasPermission('system:inspections-log:create')") - public CommonResult createInspectionsLog(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) { - return success(inspectionsLogService.createInspectionsLog(createReqVO)); + @PostMapping("/signIn") + @Operation(summary = "创建打卡") + public CommonResult createInspectionsLog(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) { + inspectionsLogService.createInspectionsLog(createReqVO); + return success("打卡成功"); + } + + @PutMapping("/confirmSignIn") + @Operation(summary = "确认打卡") + public CommonResult confirmSignIn(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) { + log.info("createReqVO:{}", createReqVO); + inspectionsLogService.confirmSignIn(createReqVO); + return success("打卡成功"); + } + + @GetMapping("/signInList") + @Operation(summary = "打卡记录") +// @PreAuthorize("@ss.hasPermission('system:inspections-log:create')") + public CommonResult> signInList(Long inspectionsId) { + return success(inspectionsLogService.signInList(inspectionsId)); } @PutMapping("/cooperateWithSignIn") @@ -83,9 +101,17 @@ public class InspectionsLogController { return success(BeanUtils.toBean(inspectionsLog, InspectionsLogRespVO.class)); } - @GetMapping("/page") + @PostMapping("/inspectionsAudit") + @Operation(summary = "审核") + @PreAuthorize("@ss.hasPermission('system:enterpriseinspections:index')") + public CommonResult inspectionsAudit(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) { + inspectionsLogService.inspectionsAudit(createReqVO); + return success("审核成功"); + } + + @GetMapping("/appList") @Operation(summary = "获得检查结果日志分页") - @PreAuthorize("@ss.hasPermission('system:inspections-log:query')") +// @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/inspectionslog/vo/InspectionsLogAppListVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogAppListVO.java new file mode 100644 index 0000000..abcddd9 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogAppListVO.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo; + +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +@Data +public class InspectionsLogAppListVO { + + private Long userId; + + private String realName; + + private String deptName; + + private String avtar; + + private LocalDateTime time; + + private Boolean isInspect; + +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java index a7b3a03..82a1ad5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java @@ -21,8 +21,8 @@ public class InspectionsLogPageReqVO extends PageParam { @Schema(description = "检查状态1.签到2.通过.3整改", example = "2") private Integer status; - @Schema(description = "检查人员签到位置信息,格式:经纬度") - private String gpsLocation; + @Schema(description = "默认状态", example = "2") + private Integer mrStatus; @Schema(description = "反馈信息") private String feedBack; @@ -37,4 +37,4 @@ public class InspectionsLogPageReqVO extends PageParam { @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 index b2ddc59..2f47c5e 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 @@ -27,10 +27,6 @@ public class InspectionsLogRespVO { @DictFormat("Inspections_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 private Integer status; - @Schema(description = "检查人员签到位置信息,格式:经纬度") - @ExcelProperty("检查人员签到位置信息,格式:经纬度") - private String gpsLocation; - @Schema(description = "反馈信息") @ExcelProperty("反馈信息") private String feedBack; @@ -50,4 +46,9 @@ public class InspectionsLogRespVO { @Schema(description = "相关文件") private List> fileList; + @Schema(description = "执法人员列表", example = "李四") + @ExcelProperty("执法人员列表") + private List userList; + + } 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 404ff66..a6ee30d 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 @@ -10,7 +10,7 @@ import java.util.*; @Data public class InspectionsLogSaveReqVO { - @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2308") + @Schema(description = "主键", example = "2308") private Long id; @Schema(description = "检查记录id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18375") 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 index 4f5614e..54ede80 100644 --- 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 @@ -39,7 +39,7 @@ public class SignInLogController { @Resource private SignInLogService signInLogService; - @PostMapping("/create") + @PostMapping("/signIn") @Operation(summary = "创建协调人员打卡记录") @PreAuthorize("@ss.hasPermission('system:sign-in-log:create')") public CommonResult createSignInLog(@Valid @RequestBody SignInLogSaveReqVO createReqVO) { 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 index 54e3a55..a9e558d 100644 --- 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 @@ -21,8 +21,19 @@ public class SignInLogPageReqVO extends PageParam { @Schema(description = "用户id", example = "30997") private Long userId; + @Schema(description = "用户名称", example = "张三") + private String realName; + + /** + * 检查人员签到位置信息,格式:经纬度 + */ + private String gpsLocation; + + //知否是执行人 + private Boolean isInspect; + @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 index bac7c2f..eb593b7 100644 --- 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 @@ -24,8 +24,20 @@ public class SignInLogRespVO { @ExcelProperty("用户id") private Long userId; + @Schema(description = "用户名称", example = "张三") + @ExcelProperty("用户名称") + private String realName; + + /** + * 检查人员签到位置信息,格式:经纬度 + */ + private String gpsLocation; + + //知否是执行人 + private Boolean isInspect; + @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 index 4cf334c..f8c2133 100644 --- 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 @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.signinlog.vo; +import com.alibaba.excel.annotation.ExcelProperty; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; @@ -17,4 +18,15 @@ public class SignInLogSaveReqVO { @Schema(description = "用户id", example = "30997") private Long userId; + @Schema(description = "用户名称", example = "张三") + private String realName; + + /** + * 检查人员签到位置信息,格式:经纬度 + */ + private String gpsLocation; + + //知否是执行人 + private Boolean isInspect; + } 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 4514411..1e65152 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 @@ -161,8 +161,7 @@ public class TaskInfoController { //发布部门 final Long userId = Long.valueOf(taskInfo.getCreator()); AdminUserDO user = adminUserMapper.selectById(userId); - log.info("useruseruser:{}", user); - if (user.getDeptId() != null) { + if (user != null && user.getDeptId() != null) { final DeptDO dept = deptService.getDept(user.getDeptId()); taskInfo.setDeptName(dept.getName()); } 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 a6e3004..31a4340 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 @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog; +import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO; import com.sun.xml.bind.v2.TODO; import lombok.*; import java.util.*; @@ -38,10 +39,6 @@ public class InspectionsLogDO extends BaseDO { * 枚举 {@link TODO Inspections_status 对应的类} */ private Integer status; - /** - * 检查人员签到位置信息,格式:经纬度 - */ - private String gpsLocation; /** * 反馈信息 */ @@ -55,6 +52,9 @@ public class InspectionsLogDO extends BaseDO { */ private String inspectName; + @TableField(exist = false) + private List userList; + //协同人员的id 还是要加上 会有同名的情况 private String cooperateWithIds; //协同人员是否可以看到任务记录 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 index 9e8af32..e167396 100644 --- 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 @@ -36,4 +36,14 @@ public class SignInLogDO extends BaseDO { */ private Long userId; -} \ No newline at end of file + private String realName; + + /** + * 检查人员签到位置信息,格式:经纬度 + */ + private String gpsLocation; + + //知否是执行人 + private Boolean isInspect; + +} 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 index 6ed1422..00a21a2 100644 --- 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 @@ -21,7 +21,7 @@ public interface InspectionsLogMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(InspectionsLogDO::getInspectionsId, reqVO.getInspectionsId()) .eqIfPresent(InspectionsLogDO::getStatus, reqVO.getStatus()) - .eqIfPresent(InspectionsLogDO::getGpsLocation, reqVO.getGpsLocation()) + .gtIfPresent(InspectionsLogDO::getStatus, reqVO.getMrStatus()) .eqIfPresent(InspectionsLogDO::getFeedBack, reqVO.getFeedBack()) .likeIfPresent(InspectionsLogDO::getCooperateWithName, reqVO.getCooperateWithName()) .likeIfPresent(InspectionsLogDO::getInspectName, reqVO.getInspectName()) @@ -29,4 +29,4 @@ public interface InspectionsLogMapper extends BaseMapperX { .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/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 index 367dd8c..f6c899f 100644 --- 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 @@ -5,6 +5,7 @@ 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 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.*; @@ -21,8 +22,9 @@ public interface SignInLogMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(SignInLogDO::getInsId, reqVO.getInsId()) .eqIfPresent(SignInLogDO::getUserId, reqVO.getUserId()) + .eqIfPresent(SignInLogDO::getGpsLocation, reqVO.getGpsLocation()) .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/dept/DeptServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java index 94a4435..5ffbbd3 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java @@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptSaveReqV import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; import cn.iocoder.yudao.module.system.dal.mysql.dept.DeptMapper; import cn.iocoder.yudao.module.system.dal.redis.RedisKeyConstants; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; import com.google.common.annotations.VisibleForTesting; import lombok.extern.slf4j.Slf4j; import org.springframework.cache.annotation.CacheEvict; 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 fca80e8..9f06899 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.inspectionslog.InspectionsLogDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import javax.validation.Valid; @@ -49,7 +50,9 @@ public interface EnterpriseInspectionsService { List getListByUserIdAndTaskName(Long userId, String taskName); - int deleteEnterpriseInspectionsTaskId(Long taskId); + int deleteEnterpriseInspectionsTaskId(Long taskId); + + InspectionsLogDO getInspectionsLogNew(Long inspectionsId); /** * 获得企业检查记录表,用于记录与企业相关的环保检查信息。分页 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 0e96ebb..f1666f8 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 @@ -5,6 +5,7 @@ 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.signinlog.SignInLogDO; 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; @@ -14,11 +15,13 @@ 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.signinlog.SignInLogMapper; 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.inspectionslog.InspectionsLogService; 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; @@ -80,6 +83,8 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe private UserRoleMapper userRoleMapper; @Resource private RoleMapper roleMapper; + @Resource + private SignInLogMapper signInLogMapper; @Override public Long createEnterpriseInspections(EnterpriseInspectionsSaveReqVO createReqVO) { @@ -90,6 +95,25 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe return enterpriseInspections.getId(); } + /** + * 根据执行记录id查询打卡记录 + * + * @param inspectionsId + * @Author dx + * @Date 2025-02-14 上午11:55 + **/ + public List getSingnInLogList(Long inspectionsId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(InspectionsLogDO::getInspectionsId, inspectionsId); + wrapper.eq(InspectionsLogDO::getStatus, 1); + wrapper.orderByDesc(InspectionsLogDO::getCreateTime); + List list = inspectionsLogMapper.selectList(wrapper); + if (list != null) { + return signInLogMapper.selectList(new LambdaQueryWrapper().eq(SignInLogDO::getInsId, list.get(0).getId())); + } + return Collections.emptyList(); + } + @Override @@ -243,8 +267,20 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe final InspectionsLogDO inspectionsLogNew = this.getInspectionsLogNew(item.getId()); if (inspectionsLogNew != null) { item.setInspectionStatus(inspectionsLogNew.getStatus()); - item.setInspectName(inspectionsLogNew.getInspectName()); - item.setCooperateWithName(inspectionsLogNew.getCooperateWithName()); + //执行人,协同执法 + //查询打卡记录 + final List singnInLogList = this.getSingnInLogList(item.getId()); + if (singnInLogList != null && singnInLogList.size() > 0) { + final List collect = singnInLogList.stream().filter(signInLogDO -> signInLogDO.getIsInspect() == false).map(item2 -> item2.getRealName()).collect(Collectors.toList()); + if (collect != null && collect.size() > 0) { + item.setCooperateWithName(collect.toString()); + } + final List collect2 = singnInLogList.stream().filter(signInLogDO -> signInLogDO.getIsInspect() == true).map(item2 -> item2.getRealName()).collect(Collectors.toList()); + if (collect2 != null && collect2.size() > 0) { + item.setInspectName(collect2.toString()); + } + } + item.setExecTime(inspectionsLogNew.getCreateTime()); //根据执法人员id 查询其所属部门 final Long userId = Long.valueOf(inspectionsLogNew.getCreator()); @@ -314,18 +350,18 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe enterpriseInspectionsMapper.updateById(enterpriseInspectionsDO); - if (enterpriseInspectionsDO.getStatus() == 4) { - 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); - } +// if (enterpriseInspectionsDO.getStatus() == 4) { +// 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); @@ -355,6 +391,7 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe } //获得检测记录最新一条 + @Override public InspectionsLogDO getInspectionsLogNew(Long inspectionsId) { QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("inspections_id", inspectionsId); @@ -364,8 +401,10 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe return null; } return inspectionsLogDOS.get(0); - } + + + @Override public List getEnterpriseInspectionsList(EnterpriseInspectionsPageReqVO pageReqVO) { return enterpriseInspectionsMapper.selectList(pageReqVO); 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 77a7c84..327f1a9 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 @@ -5,6 +5,7 @@ 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.module.system.dal.dataobject.signinlog.SignInLogDO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import javax.validation.Valid; @@ -22,7 +23,7 @@ public interface InspectionsLogService { * @param createReqVO 创建信息 * @return 编号 */ - Long createInspectionsLog(@Valid InspectionsLogSaveReqVO createReqVO); + void createInspectionsLog(@Valid InspectionsLogSaveReqVO createReqVO); /** * 更新检查结果日志 @@ -57,4 +58,11 @@ public interface InspectionsLogService { List list(InspectionsLogPageReqVO pageReqVO); void cooperateWithSignIn(Long inspectionsLogId); + + void confirmSignIn(InspectionsLogSaveReqVO createReqVO); + + void inspectionsAudit(InspectionsLogSaveReqVO createReqVO); + + List signInList(Long inspectionsId); + } 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 e37e0a4..a7046a9 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,6 @@ package cn.iocoder.yudao.module.system.service.inspectionslog; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; 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; @@ -7,7 +8,10 @@ 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.dept.DeptService; +import cn.iocoder.yudao.module.system.service.enterpriseinspections.EnterpriseInspectionsService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import com.alibaba.excel.util.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.stereotype.Service; @@ -15,6 +19,8 @@ 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.inspectionslog.vo.*; import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -49,70 +55,67 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { private TaskInfoMapper taskInfoMapper; @Resource private SignInLogMapper signInLogMapper; + @Resource + private EnterpriseInspectionsService enterpriseInspectionsService; + @Resource + private DeptService deptService; @Override - public Long - - + @Transactional + public void createInspectionsLog(InspectionsLogSaveReqVO createReqVO) { + //查询执法记录 + EnterpriseInspectionsDO inspections = enterpriseInspectionsMapper.selectById(createReqVO.getInspectionsId()); + if (inspections == null) { + throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); + } - 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); + final AdminUserDO user = adminUserService.getUser(loginUserId); - 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); - } + //根据查询出的列表判断执行到哪一步 + final InspectionsLogDO inspectionsLogNew = enterpriseInspectionsService.getInspectionsLogNew(createReqVO.getInspectionsId()); + + //没有记录和整改状态为打卡 + if (inspectionsLogNew == null || (inspectionsLogNew != null && inspectionsLogNew.getStatus() == 3)) { + createReqVO.setStatus(0); + InspectionsLogDO inspectionsLog = BeanUtils.toBean(createReqVO, InspectionsLogDO.class); + final int insert = inspectionsLogMapper.insert(inspectionsLog); + if (insert > 0) { + final SignInLogDO signInLogDO = new SignInLogDO(); + signInLogDO.setInsId(inspectionsLog.getId()); + signInLogDO.setUserId(loginUserId); + signInLogDO.setRealName(user.getRealName()); + signInLogDO.setGpsLocation(createReqVO.getGpsLocation()); + if (loginUserId == inspections.getUserId()) { + signInLogDO.setIsInspect(true); + } + signInLogMapper.insert(signInLogDO); + } - // 插入 - InspectionsLogDO inspectionsLog = BeanUtils.toBean(createReqVO, InspectionsLogDO.class); - inspectionsLogMapper.insert(inspectionsLog); + } else { - //整改需要重新创建子任务 - if (list != null && createReqVO.getStatus() != null && createReqVO.getStatus() == 3) { + //查看打卡记录 + final List signInLog = this.getSignInLog(inspectionsLogNew.getId()); + if (signInLog == null) { + throw exception(SIGN_IN_LOG_ERROR); + } - //查询父任务,和执法记录 - EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(createReqVO.getInspectionsId()); - if (enterpriseInspectionsDO == null) { - throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); + //查看当前用户是否已打卡 + final List collect = signInLog.stream().map(SignInLogDO::getUserId).collect(Collectors.toList()); + if(collect.contains(loginUserId)) { + throw exception(SIGN_IN_LOG_ERROR2); } - //添加子任务 - 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(); + signInLogMapper.insert(new SignInLogDO().setInsId(inspectionsLogNew.getId()).setUserId(loginUserId).setRealName(user.getRealName())); + } + } + + public List getSignInLog(Long insId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SignInLogDO::getInsId, insId); + return signInLogMapper.selectList(wrapper); } @Override @@ -145,7 +148,45 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { @Override public PageResult getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO) { - return inspectionsLogMapper.selectPage(pageReqVO); + //不显示待确认签到的状态 + pageReqVO.setPageNo(-1); + if (pageReqVO.getStatus() == null) { + pageReqVO.setMrStatus(0); + } + final PageResult inspectionsLogDOPageResult = inspectionsLogMapper.selectPage(pageReqVO); + if (inspectionsLogDOPageResult.getList() != null && inspectionsLogDOPageResult.getList().size() > 0) { + inspectionsLogDOPageResult.getList().forEach(item->{ + item.setUserList(this.getInspectionsLogAppListVO(item.getId())); + }); + } + + return inspectionsLogDOPageResult; + } + + //封装 + public List getInspectionsLogAppListVO(Long insId) { + List appListVO = new ArrayList<>(); + final List signInLog = this.getSignInLog(insId); + if (signInLog != null && signInLog.size() > 0) { + signInLog.forEach(signInLogDO->{ + final AdminUserDO user = adminUserService.getUser(signInLogDO.getUserId()); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + InspectionsLogAppListVO appListVO1 = new InspectionsLogAppListVO(); + appListVO1.setRealName(signInLogDO.getRealName()); + appListVO1.setTime(signInLogDO.getCreateTime()); + appListVO1.setUserId(signInLogDO.getUserId()); + appListVO1.setIsInspect(signInLogDO.getIsInspect()); + final DeptDO dept = deptService.getDept(user.getDeptId()); + if (dept != null) { + appListVO1.setDeptName(dept.getName()); + } + appListVO1.setAvtar(user.getAvatar()); + appListVO.add(appListVO1); + }); + } + return appListVO; } @Override @@ -192,4 +233,78 @@ public class InspectionsLogServiceImpl implements InspectionsLogService { signInLogMapper.insert(signInLogDO); } + @Override + public void confirmSignIn(InspectionsLogSaveReqVO createReqVO) { + + //查询执法记录 + final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(createReqVO.getInspectionsId()); + if (enterpriseInspectionsDO == null) { + throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); + } + //根据查询出的列表判断执行到哪一步 + final InspectionsLogDO inspectionsLogNew = enterpriseInspectionsService.getInspectionsLogNew(createReqVO.getInspectionsId()); + if (inspectionsLogNew == null) { + throw exception(INSPECTIONS_LOG_NOT_EXISTS); + } + + final List signInLog = this.getSignInLog(inspectionsLogNew.getId()); + if (signInLog == null) { + throw exception(SIGN_IN_LOG_ERROR); + } + + //打卡记录里面必须有执行人 + final List collect = signInLog.stream().map(item -> item.getUserId()).collect(Collectors.toList()); + if(!collect.contains(enterpriseInspectionsDO.getUserId())) { + throw exception(SIGN_IN_LOG_ERROR4); + } + + if (signInLog.size() < 2) { + throw exception(SIGN_IN_LOG_ERROR6); + } + + //查看状态等于0 并且起到人员大于2 修改状态 + if (inspectionsLogNew.getStatus() == 0) { + inspectionsLogNew.setStatus(1); + inspectionsLogMapper.updateById(inspectionsLogNew); + } + } + + @Override + @Transactional + public void inspectionsAudit(InspectionsLogSaveReqVO createReqVO) { + + //查询执法记录 + final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(createReqVO.getInspectionsId()); + if (enterpriseInspectionsDO == null) { + throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS); + } + + //只有当前企业执行人才能提交审核 + if (enterpriseInspectionsDO.getUserId() != getLoginUserId()) { + throw exception(SIGN_IN_LOG_ERROR5); + } + + InspectionsLogDO updateObj = BeanUtils.toBean(createReqVO, InspectionsLogDO.class); + inspectionsLogMapper.insert(updateObj); + + //修改执行记录状态 + + } + + @Override + public List signInList(Long inspectionsId) { + + //查询最新状态 + final InspectionsLogDO inspectionsLogDO = enterpriseInspectionsService.getInspectionsLogNew(inspectionsId); + if (inspectionsLogDO != null) { + //如果当前状态不是待确认打卡的状态报错 + if (inspectionsLogDO.getStatus() != 0) { + throw exception(SIGN_IN_LOG_ERROR3); + } + //根据记录查询 + return this.getInspectionsLogAppListVO(inspectionsLogDO.getId()); + } + return Collections.emptyList(); + } + } 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 index c94949b..c60e896 100644 --- 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 @@ -71,5 +71,4 @@ public class SignInLogServiceImpl implements SignInLogService { 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/taskinfo/TaskInfoServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java index cd808bb..f986d0f 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 @@ -250,6 +250,7 @@ public class TaskInfoServiceImpl implements TaskInfoService { } 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); @@ -261,7 +262,9 @@ public class TaskInfoServiceImpl implements TaskInfoService { } item.setTaskExecNum(0); + List enterpriseInspectionsDOList = enterpriseInspectionsMapper.selectList(wrapper); + log.info("enterpriseInspectionsDOList:{}", enterpriseInspectionsDOList); if (enterpriseInspectionsDOList != null && enterpriseInspectionsDOList.size() > 0) { item.setTaskExecNum(enterpriseInspectionsDOList.size()); final List collect = enterpriseInspectionsDOList.stream().filter(res -> res.getStatus() == 5).collect(Collectors.toList()); @@ -283,8 +286,6 @@ 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());