Browse Source

执法记录小程序接口

master
DX 2 months ago
parent
commit
6b6502d6d4
  1. 12
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java
  2. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsPageReqVO.java
  3. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java
  4. 20
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/SelectUserChangeVO.java
  5. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java
  6. 96
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/SignInLogController.java
  7. 28
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogPageReqVO.java
  8. 31
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogRespVO.java
  9. 20
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/signinlog/vo/SignInLogSaveReqVO.java
  10. 40
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java
  11. 8
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java
  12. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java
  13. 12
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java
  14. 39
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/signinlog/SignInLogDO.java
  15. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java
  16. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java
  17. 28
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/signinlog/SignInLogMapper.java
  18. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java
  19. 128
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java
  20. 18
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java
  21. 56
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogService.java
  22. 75
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/signinlog/SignInLogServiceImpl.java
  23. 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java
  24. 36
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java
  25. 40
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java
  26. 5
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/weixin/TokenValidatorService.java

12
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<String> passOn(@Valid @RequestBody PassOnSaveVO passOnSaveVO) {
enterpriseInspectionsService.passOn(passOnSaveVO);
return success("添加成功");
}
@GetMapping("/changeSelectUser")
@Operation(summary = "根据部门返回部门下的其他人员")
// @PreAuthorize("@ss.hasPermission('system:enterprise-inspections:create')")
public CommonResult<List<SelectUserChangeVO>> 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<PageResult<EnterpriseInspectionsRespVO>> getEnterpriseInspectionsPage(@Valid EnterpriseInspectionsPageReqVO pageReqVO) {
PageResult<EnterpriseInspectionsDO> pageResult = enterpriseInspectionsService.getEnterpriseInspectionsPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, EnterpriseInspectionsRespVO.class));

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

4
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<String> tagList;

20
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<String> roleName;
@Schema(description = "部门名称", example = "29150")
private String avatar;
}

4
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<Boolean> cooperateWithSignIn(Long inspectionsLogId) {
inspectionsLogService.cooperateWithSignIn(inspectionsLogId);
@ -88,8 +88,6 @@ public class InspectionsLogController {
@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));
}

96
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<Long> createSignInLog(@Valid @RequestBody SignInLogSaveReqVO createReqVO) {
return success(signInLogService.createSignInLog(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新协调人员打卡记录")
@PreAuthorize("@ss.hasPermission('system:sign-in-log:update')")
public CommonResult<Boolean> 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<Boolean> 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<SignInLogRespVO> 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<PageResult<SignInLogRespVO>> getSignInLogPage(@Valid SignInLogPageReqVO pageReqVO) {
PageResult<SignInLogDO> 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<SignInLogDO> list = signInLogService.getSignInLogPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "协调人员打卡记录.xls", "数据", SignInLogRespVO.class,
BeanUtils.toBean(list, SignInLogRespVO.class));
}
}

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

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

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

40
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<TaskInfoRespVO> appGet(@RequestParam("id") Long id) {
TaskInfoDO taskInfo = taskInfoService.getTaskInfo(id);
if (taskInfo != null) {
//标签
final List<TagLibraryDO> 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')")

8
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<TagLibraryDO> tagLibraryIds;
//任务总数
@TableField(exist = false)
private Integer taskExecNum;
//已完成数
@TableField(exist = false)
private Integer taskFinishNum;
@TableField(exist = false)
//任务标签
private List<String> tagList;
//发布部门
private String deptName;

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

12
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<String> tagList;
//任务标签
@TableField(exist = false)
private String taskTag;
//执法部门
@TableField(exist = false)
private String department;

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

4
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<String> tagList;
//发布部门
@TableField(exist = false)
private String deptName;
}

2
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<EnterpriseInspe
default PageResult<EnterpriseInspectionsDO> selectPage(EnterpriseInspectionsPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<EnterpriseInspectionsDO>()
.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));
}

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

3
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<EnterpriseInspectionsDO> getEnterpriseInspectionsList(EnterpriseInspectionsPageReqVO pageReqVO);
List<SelectUserChangeVO> changeSelectUser(Long deptId);
}

128
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<EnterpriseInspectionsDO> 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<AdminUserDO> adminUserDOS = adminUserMapper.selectList(new QueryWrapper<AdminUserDO>().eq("dept_id", pageReqVO.getDepartmentId()));
if (adminUserDOS != null || adminUserDOS.size() > 0) {
final List<Long> 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<TaskTagDO> wrapper = new QueryWrapper<>();
wrapper.eq("task_id", taskInfoDO.getId());
final List<TaskTagDO> taskTagDOS = taskTagMapper.selectList(wrapper);
List<String> 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<TagLibraryDO> 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<EnterpriseInspectionsDO> getEnterpriseInspectionsList(EnterpriseInspectionsPageReqVO pageReqVO) {
return enterpriseInspectionsMapper.selectList(pageReqVO);
}
@Override
public List<SelectUserChangeVO> changeSelectUser(Long deptId) {
List<SelectUserChangeVO> list = new ArrayList<>();
List<AdminUserDO> adminUserDOS;
LambdaQueryWrapper<AdminUserDO> 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<UserRoleDO> roleDOQueryWrapper = new QueryWrapper<>();
roleDOQueryWrapper.eq("user_id", item.getId());
List<UserRoleDO> userRoleDOS = userRoleMapper.selectList(roleDOQueryWrapper);
if (userRoleDOS != null && userRoleDOS.size() > 0) {
//查询角色名称
List<Long> roleIds = userRoleDOS.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
List<RoleDO> roleDOS = roleMapper.selectBatchIds(roleIds);
if (roleDOS != null && roleDOS.size() > 0) {
List<String> roleNames = roleDOS.stream().map(RoleDO::getName).collect(Collectors.toList());
userChangeVO.setRoleName(roleNames);
}
}
list.add(userChangeVO);
});
};
return list;
}
}

18
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<InspectionsLogDO> list(InspectionsLogPageReqVO pageReqVO) {
QueryWrapper<InspectionsLogDO> 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);
}
}

56
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<SignInLogDO> getSignInLogPage(SignInLogPageReqVO pageReqVO);
}

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

6
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<TagLibraryDO> list(String[] codeList);
List<TagLibraryDO> childrenList(Long id);
//根据任务id差标签
List<TagLibraryDO> listByTaskId(Long taskId);
//根据企业id标签查标签
List<TagLibraryDO> listByEnterpriseId(Long enterpriseId);
}

36
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<TagLibraryDO> listByTaskId(Long taskId) {
LambdaQueryWrapper<TaskTagDO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TaskTagDO::getTaskId, taskId);
final List<TaskTagDO> taskTagDOS = taskTagMapper.selectList(wrapper);
if (taskTagDOS != null && taskTagDOS.size() > 0) {
final List<TagLibraryDO> tagLibraryDOS = tagLibraryMapper.selectByIds(taskTagDOS.stream().map(TaskTagDO::getTagId).collect(Collectors.toList()));
return tagLibraryDOS;
}
return null;
}
@Override
public List<TagLibraryDO> listByEnterpriseId(Long enterpriseId) {
LambdaQueryWrapper<EnterpriseTagDO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EnterpriseTagDO::getEnterpriseId, enterpriseId);
final List<EnterpriseTagDO> enterpriseTagDOS = enterpriseTagMapper.selectList(wrapper);
if (enterpriseTagDOS != null && enterpriseTagDOS.size() > 0) {
final List<TagLibraryDO> tagLibraryDOS = tagLibraryMapper.selectByIds(enterpriseTagDOS.stream().map(EnterpriseTagDO::getTagId).collect(Collectors.toList()));
return tagLibraryDOS;
}
return null;
}
// 递归构建树
private List<TagLibraryDO> buildTree(List<TagLibraryDO> tags, Integer parentId) {
List<TagLibraryDO> tree = new ArrayList<>();

40
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<TaskTagDO> wrapper = new LambdaQueryWrapper<>();
wrapper.in(TaskTagDO::getTaskId, pageReqVO.getTagList());
wrapper.in(TaskTagDO::getTagId, pageReqVO.getTagList());
final List<TaskTagDO> 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<EnterpriseInspectionsDO> 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<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);
}
} else if (user1.getPostIds().contains(5l)) {
//自己
wrapper.eq("user_id", loginUserId);
}
item.setTaskExecNum(0);
List<EnterpriseInspectionsDO> 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<TaskInfoDO> collect = taskInfoDOPageResult.getList().stream().filter(res -> res.getTaskExecNum() > 0).collect(Collectors.toList());

5
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/weixin/TokenValidatorService.java

@ -1,8 +1,11 @@
package cn.iocoder.yudao.module.system.service.weixin;
import org.springframework.stereotype.Service;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
@Service
public class TokenValidatorService {
public static boolean validateToken(String token, String signature, String timestamp, String nonce) {
String[] arr = new String[]{token, timestamp, nonce};
@ -35,4 +38,4 @@ public class TokenValidatorService {
}
return null;
}
}
}

Loading…
Cancel
Save