Browse Source

执法签到

master
DX 2 months ago
parent
commit
95004da9ca
  1. 14
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java
  2. 40
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java
  3. 24
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogAppListVO.java
  4. 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java
  5. 9
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java
  6. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java
  7. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/SignInLogController.java
  8. 13
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogPageReqVO.java
  9. 14
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogRespVO.java
  10. 12
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogSaveReqVO.java
  11. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java
  12. 8
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java
  13. 12
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/signinlog/SignInLogDO.java
  14. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/inspectionslog/InspectionsLogMapper.java
  15. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/signinlog/SignInLogMapper.java
  16. 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java
  17. 5
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java
  18. 69
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java
  19. 10
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java
  20. 221
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java
  21. 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogServiceImpl.java
  22. 5
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java

14
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人才能打开");
}

40
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<Long> createInspectionsLog(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) {
return success(inspectionsLogService.createInspectionsLog(createReqVO));
@PostMapping("/signIn")
@Operation(summary = "创建打卡")
public CommonResult<String> createInspectionsLog(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) {
inspectionsLogService.createInspectionsLog(createReqVO);
return success("打卡成功");
}
@PutMapping("/confirmSignIn")
@Operation(summary = "确认打卡")
public CommonResult<String> 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<List<InspectionsLogAppListVO>> 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<String> 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<PageResult<InspectionsLogRespVO>> getInspectionsLogPage(@Valid InspectionsLogPageReqVO pageReqVO) {
PageResult<InspectionsLogDO> pageResult = inspectionsLogService.getInspectionsLogPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, InspectionsLogRespVO.class));

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

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

9
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<Map<String, String>> fileList;
@Schema(description = "执法人员列表", example = "李四")
@ExcelProperty("执法人员列表")
private List<InspectionsLogAppListVO> userList;
}

2
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")

2
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<Long> createSignInLog(@Valid @RequestBody SignInLogSaveReqVO createReqVO) {

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

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

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

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

8
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<InspectionsLogAppListVO> userList;
//协同人员的id 还是要加上 会有同名的情况
private String cooperateWithIds;
//协同人员是否可以看到任务记录

12
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;
}
private String realName;
/**
* 检查人员签到位置信息格式经纬度
*/
private String gpsLocation;
//知否是执行人
private Boolean isInspect;
}

4
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<InspectionsLogDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<InspectionsLogDO>()
.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<InspectionsLogDO> {
.orderByDesc(InspectionsLogDO::getId));
}
}
}

4
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<SignInLogDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<SignInLogDO>()
.eqIfPresent(SignInLogDO::getInsId, reqVO.getInsId())
.eqIfPresent(SignInLogDO::getUserId, reqVO.getUserId())
.eqIfPresent(SignInLogDO::getGpsLocation, reqVO.getGpsLocation())
.betweenIfPresent(SignInLogDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(SignInLogDO::getId));
}
}
}

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

5
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<EnterpriseInspectionsDO> getListByUserIdAndTaskName(Long userId, String taskName);
int deleteEnterpriseInspectionsTaskId(Long taskId);
int deleteEnterpriseInspectionsTaskId(Long taskId);
InspectionsLogDO getInspectionsLogNew(Long inspectionsId);
/**
* 获得企业检查记录表用于记录与企业相关的环保检查信息分页

69
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<SignInLogDO> getSingnInLogList(Long inspectionsId) {
LambdaQueryWrapper<InspectionsLogDO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(InspectionsLogDO::getInspectionsId, inspectionsId);
wrapper.eq(InspectionsLogDO::getStatus, 1);
wrapper.orderByDesc(InspectionsLogDO::getCreateTime);
List<InspectionsLogDO> list = inspectionsLogMapper.selectList(wrapper);
if (list != null) {
return signInLogMapper.selectList(new LambdaQueryWrapper<SignInLogDO>().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<SignInLogDO> singnInLogList = this.getSingnInLogList(item.getId());
if (singnInLogList != null && singnInLogList.size() > 0) {
final List<String> collect = singnInLogList.stream().filter(signInLogDO -> signInLogDO.getIsInspect() == false).map(item2 -> item2.getRealName()).collect(Collectors.toList());
if (collect != null && collect.size() > 0) {
item.setCooperateWithName(collect.toString());
}
final List<String> collect2 = singnInLogList.stream().filter(signInLogDO -> signInLogDO.getIsInspect() == true).map(item2 -> item2.getRealName()).collect(Collectors.toList());
if (collect2 != null && collect2.size() > 0) {
item.setInspectName(collect2.toString());
}
}
item.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<InspectionsLogDO> 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<EnterpriseInspectionsDO> getEnterpriseInspectionsList(EnterpriseInspectionsPageReqVO pageReqVO) {
return enterpriseInspectionsMapper.selectList(pageReqVO);

10
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<InspectionsLogDO> list(InspectionsLogPageReqVO pageReqVO);
void cooperateWithSignIn(Long inspectionsLogId);
void confirmSignIn(InspectionsLogSaveReqVO createReqVO);
void inspectionsAudit(InspectionsLogSaveReqVO createReqVO);
List<InspectionsLogAppListVO> signInList(Long inspectionsId);
}

221
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<InspectionsLogDO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(InspectionsLogDO::getInspectionsId, createReqVO.getInspectionsId());
wrapper.orderByDesc(InspectionsLogDO::getCreateTime);
List<InspectionsLogDO> 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<SignInLogDO> 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<Long> 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<SignInLogDO> getSignInLog(Long insId) {
LambdaQueryWrapper<SignInLogDO> 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<InspectionsLogDO> getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO) {
return inspectionsLogMapper.selectPage(pageReqVO);
//不显示待确认签到的状态
pageReqVO.setPageNo(-1);
if (pageReqVO.getStatus() == null) {
pageReqVO.setMrStatus(0);
}
final PageResult<InspectionsLogDO> inspectionsLogDOPageResult = inspectionsLogMapper.selectPage(pageReqVO);
if (inspectionsLogDOPageResult.getList() != null && inspectionsLogDOPageResult.getList().size() > 0) {
inspectionsLogDOPageResult.getList().forEach(item->{
item.setUserList(this.getInspectionsLogAppListVO(item.getId()));
});
}
return inspectionsLogDOPageResult;
}
//封装
public List<InspectionsLogAppListVO> getInspectionsLogAppListVO(Long insId) {
List<InspectionsLogAppListVO> appListVO = new ArrayList<>();
final List<SignInLogDO> signInLog = this.getSignInLog(insId);
if (signInLog != null && signInLog.size() > 0) {
signInLog.forEach(signInLogDO->{
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<SignInLogDO> signInLog = this.getSignInLog(inspectionsLogNew.getId());
if (signInLog == null) {
throw exception(SIGN_IN_LOG_ERROR);
}
//打卡记录里面必须有执行人
final List<Long> 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<InspectionsLogAppListVO> 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();
}
}

1
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<SignInLogDO> getSignInLogPage(SignInLogPageReqVO pageReqVO) {
return signInLogMapper.selectPage(pageReqVO);
}
}

5
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<AdminUserDO> adminUserDOS = adminUserMapper.selectList(new QueryWrapper<AdminUserDO>().eq("dept_id", user1.getDeptId()));
if (adminUserDOS != null || adminUserDOS.size() > 0) {
final List<Long> 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<EnterpriseInspectionsDO> enterpriseInspectionsDOList = enterpriseInspectionsMapper.selectList(wrapper);
log.info("enterpriseInspectionsDOList:{}", enterpriseInspectionsDOList);
if (enterpriseInspectionsDOList != null && enterpriseInspectionsDOList.size() > 0) {
item.setTaskExecNum(enterpriseInspectionsDOList.size());
final List<EnterpriseInspectionsDO> 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<TaskInfoDO> collect = taskInfoDOPageResult.getList().stream().filter(res -> res.getTaskExecNum() > 0).collect(Collectors.toList());

Loading…
Cancel
Save