Browse Source

执法记录相关

master
DX 2 months ago
parent
commit
04b489f53e
  1. 1
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java
  2. 22
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java
  3. 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java
  4. 8
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java
  5. 36
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java
  6. 104
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java
  7. 40
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java
  8. 50
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java
  9. 35
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java
  10. 22
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/TagLibraryController.java
  11. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryPageReqVO.java
  12. 5
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryRespVO.java
  13. 5
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibrarySaveReqVO.java
  14. 53
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/task/AppTaskController.java
  15. 5
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java
  16. 27
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java
  17. 58
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java
  18. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taglibrary/TagLibraryDO.java
  19. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java
  20. 12
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java
  21. 32
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/inspectionslog/InspectionsLogMapper.java
  22. 59
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java
  23. 94
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java
  24. 58
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java
  25. 83
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java
  26. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java
  27. 31
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java
  28. 23
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java

1
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java

@ -186,4 +186,5 @@ public interface ErrorCodeConstants {
ErrorCode ENTERPRISE_INSPECTIONS_NOT_EXISTS = new ErrorCode(1-003-001-005, "任务记录不存在");
ErrorCode INSPECTIONS_LOG_NOT_EXISTS = new ErrorCode(1-003-001-006, "执法日志不存在");
}

22
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java

@ -16,6 +16,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMappe
import cn.iocoder.yudao.module.system.dal.mysql.fileInfo.FileInfoMapper;
import cn.iocoder.yudao.module.system.dal.mysql.qualification.EnterpriseQualificationMapper;
import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper;
import cn.iocoder.yudao.module.system.service.enterprisetag.EnterpriseTagService;
import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService;
import cn.iocoder.yudao.module.system.service.qualification.EnterpriseQualificationService;
import cn.iocoder.yudao.module.system.service.taglibrary.TagLibraryService;
@ -189,7 +190,6 @@ public class EnterpriseController {
@Operation(summary = "用户获得所属企业列表")
public CommonResult<PageResult<EnterpriseRespVO>> getEnterpriseByUserId(@Valid EnterprisePageReqVO pageReqVO) {
final PageResult<EnterpriseDO> pageResult = enterpriseService.getEnterpriseByUserId(pageReqVO);
pageResult.getList().forEach(item->{
//企业审核状态
QueryWrapper<EnterpriseAuditLogDO> auditLogDOQueryWrapper = new QueryWrapper<>();
@ -211,14 +211,30 @@ public class EnterpriseController {
item.setFiles(list);
}
//企业标签
QueryWrapper<EnterpriseTagDO> enterpriseDOQueryWrapper = new QueryWrapper<>();
enterpriseDOQueryWrapper.eq("enterprise_id", item.getId());
final List<EnterpriseTagDO> enterpriseTagDOS = enterpriseTagMapper.selectList(enterpriseDOQueryWrapper);
List<String> tagList = new ArrayList<>();
if (!enterpriseTagDOS.isEmpty() && enterpriseTagDOS.size() > 0) {
enterpriseTagDOS.forEach(tagItem-> {
QueryWrapper<TagLibraryDO> tagLibraryDOQueryWrapper = new QueryWrapper<>();
tagLibraryDOQueryWrapper.eq("id", tagItem.getTagId());
TagLibraryDO tagLibraryDO = tagLibraryMapper.selectOne(tagLibraryDOQueryWrapper);
if (tagLibraryDO != null) {
tagList.add(tagLibraryDO.getTagName());
}
});
}
item.setTagList(tagList);
});
return success(BeanUtils.toBean(pageResult, EnterpriseRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出企业 Excel")
@PreAuthorize("@ss.hasPermission('system:enterprise:export')")

6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java

@ -64,11 +64,11 @@ public class EnterprisePageReqVO extends PageParam {
@Schema(description = "修改人")
private String updater;
@Schema(description = "管理部门", example = "26433")
private Long deptId;
@Schema(description = "邀请人")
private String inviterName;
@Schema(description = "根据标签类型过滤")
private List<Long> tagList;
}

8
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java

@ -79,6 +79,14 @@ public class EnterpriseInspectionsController {
return success(BeanUtils.toBean(pageResult, EnterpriseInspectionsRespVO.class));
}
@GetMapping("/pcpage")
@Operation(summary = "PC端获得企业检查记录表,用于记录与企业相关的环保检查信息。分页")
@PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')")
public CommonResult<PageResult<EnterpriseInspectionsRespVO>> getEnterpriseInspectionsPCPage(@Valid EnterpriseInspectionsPageReqVO pageReqVO) {
PageResult<EnterpriseInspectionsDO> pageResult = enterpriseInspectionsService.getEnterpriseInspectionsPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, EnterpriseInspectionsRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出企业检查记录表,用于记录与企业相关的环保检查信息。 Excel")
@PreAuthorize("@ss.hasPermission('system:enterprise-inspections:export')")

36
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java

@ -20,12 +20,40 @@ public class EnterpriseInspectionsRespVO {
@ExcelProperty("任务ID")
private Long taskId;
@Schema(description = "任务名称", example = "29150")
@ExcelProperty("任务名称")
private String taskName;
@Schema(description = "企业ID", example = "27002")
@ExcelProperty("企业ID")
private Long enterpriseId;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "企业名称", example = "27002")
@ExcelProperty("企业名称")
private String enterpriseName;
@Schema(description = "任务类型", example = "27002")
@ExcelProperty("任务类型")
private List<String> tagList;
@Schema(description = "进度状态", example = "1")
@ExcelProperty("进度状态")
private String inspectionStatus;
@Schema(description = "执法部门", example = "一大队")
@ExcelProperty("执法部门")
private String department;
@Schema(description = "执法人员", example = "张三")
@ExcelProperty("执法人员")
private String inspectName;
@Schema(description = "协同执法人", example = "张三")
@ExcelProperty("协同执法人")
private String cooperateWithName;
@Schema(description = "执法时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("执法时间")
private LocalDateTime execTime;
}
}

104
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/InspectionsLogController.java

@ -0,0 +1,104 @@
package cn.iocoder.yudao.module.system.controller.admin.inspectionslog;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO;
import cn.iocoder.yudao.module.system.service.inspectionslog.InspectionsLogService;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@Tag(name = "管理后台 - 检查结果日志")
@RestController
@RequestMapping("/system/inspections-log")
@Validated
public class InspectionsLogController {
@Resource
private InspectionsLogService inspectionsLogService;
@PostMapping("/create")
@Operation(summary = "创建检查结果日志")
@PreAuthorize("@ss.hasPermission('system:inspections-log:create')")
public CommonResult<Long> createInspectionsLog(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) {
return success(inspectionsLogService.createInspectionsLog(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新检查结果日志")
@PreAuthorize("@ss.hasPermission('system:inspections-log:update')")
public CommonResult<Boolean> updateInspectionsLog(@Valid @RequestBody InspectionsLogSaveReqVO updateReqVO) {
inspectionsLogService.updateInspectionsLog(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除检查结果日志")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('system:inspections-log:delete')")
public CommonResult<Boolean> deleteInspectionsLog(@RequestParam("id") Long id) {
inspectionsLogService.deleteInspectionsLog(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得检查结果日志")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:inspections-log:query')")
public CommonResult<InspectionsLogRespVO> getInspectionsLog(@RequestParam("id") Long id) {
InspectionsLogDO inspectionsLog = inspectionsLogService.getInspectionsLog(id);
return success(BeanUtils.toBean(inspectionsLog, InspectionsLogRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得检查结果日志分页")
@PreAuthorize("@ss.hasPermission('system:inspections-log:query')")
public CommonResult<PageResult<InspectionsLogRespVO>> getInspectionsLogPage(@Valid InspectionsLogPageReqVO pageReqVO) {
PageResult<InspectionsLogDO> pageResult = inspectionsLogService.getInspectionsLogPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, InspectionsLogRespVO.class));
}
@GetMapping("/list")
@Operation(summary = "pc端获得检查状态列表")
@PreAuthorize("@ss.hasPermission('system:inspections-log:query')")
public CommonResult<List<InspectionsLogRespVO>> getInspectionsLogList(@Valid InspectionsLogPageReqVO pageReqVO) {
List<InspectionsLogDO> list = inspectionsLogService.list(pageReqVO);
return success(BeanUtils.toBean(list, InspectionsLogRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出检查结果日志 Excel")
@PreAuthorize("@ss.hasPermission('system:inspections-log:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportInspectionsLogExcel(@Valid InspectionsLogPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<InspectionsLogDO> list = inspectionsLogService.getInspectionsLogPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "检查结果日志.xls", "数据", InspectionsLogRespVO.class,
BeanUtils.toBean(list, InspectionsLogRespVO.class));
}
}

40
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogPageReqVO.java

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 检查结果日志分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class InspectionsLogPageReqVO extends PageParam {
@Schema(description = "检查记录id", example = "18375")
private Long inspectionsId;
@Schema(description = "检查状态1.签到2.通过.3整改", example = "2")
private Integer status;
@Schema(description = "检查人员签到位置信息,格式:经纬度")
private String gpsLocation;
@Schema(description = "反馈信息")
private String feedBack;
@Schema(description = "协同人员姓名", example = "张三")
private String cooperateWithName;
@Schema(description = "执法人员姓名", example = "李四")
private String inspectName;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

50
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java

@ -0,0 +1,50 @@
package cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 检查结果日志 Response VO")
@Data
@ExcelIgnoreUnannotated
public class InspectionsLogRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2308")
@ExcelProperty("主键")
private Long id;
@Schema(description = "检查记录id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18375")
@ExcelProperty("检查记录id")
private Long inspectionsId;
@Schema(description = "检查状态1.签到2.通过.3整改", example = "2")
@ExcelProperty(value = "检查状态1.签到2.通过.3整改", converter = DictConvert.class)
@DictFormat("Inspections_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private Integer status;
@Schema(description = "检查人员签到位置信息,格式:经纬度")
@ExcelProperty("检查人员签到位置信息,格式:经纬度")
private String gpsLocation;
@Schema(description = "反馈信息")
@ExcelProperty("反馈信息")
private String feedBack;
@Schema(description = "协同人员姓名", example = "张三")
@ExcelProperty("协同人员姓名")
private String cooperateWithName;
@Schema(description = "执法人员姓名", example = "李四")
@ExcelProperty("执法人员姓名")
private String inspectName;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

35
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogSaveReqVO.java

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.validation.constraints.NotNull;
import java.util.*;
@Schema(description = "管理后台 - 检查结果日志新增/修改 Request VO")
@Data
public class InspectionsLogSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2308")
private Long id;
@Schema(description = "检查记录id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18375")
@NotNull(message = "检查记录id不能为空")
private Long inspectionsId;
@Schema(description = "检查状态1.签到2.通过.3整改", example = "2")
private Integer status;
@Schema(description = "检查人员签到位置信息,格式:经纬度")
private String gpsLocation;
@Schema(description = "反馈信息")
private String feedBack;
@Schema(description = "协同人员姓名", example = "张三")
private String cooperateWithName;
@Schema(description = "执法人员姓名", example = "李四")
private String inspectName;
}

22
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/TagLibraryController.java

@ -71,10 +71,30 @@ public class TagLibraryController {
}
@GetMapping("/page")
@Operation(summary = "获得企业标签分页")
@Operation(summary = "获得标签分页")
@PreAuthorize("@ss.hasPermission('system:tag-library:query')")
public CommonResult<List<TagLibraryRespVO>> getTagLibraryPage(TagLibraryPageReqVO pageReqVO) {
List<TagLibraryDO> pageResult = tagLibraryService.getTagLibraryPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, TagLibraryRespVO.class));
}
@GetMapping("/list")
@Operation(summary = "获得标签分页")
@PreAuthorize("@ss.hasPermission('system:tag-library:query')")
public CommonResult<List<TagLibraryRespVO>> getTagLibraryList(String[] codeList) {
List<TagLibraryDO> pageResult = tagLibraryService.list(codeList);
return success(BeanUtils.toBean(pageResult, TagLibraryRespVO.class));
}
@GetMapping("/childrenList")
@Operation(summary = "获得标签分页")
@PreAuthorize("@ss.hasPermission('system:tag-library:query')")
public CommonResult<List<TagLibraryRespVO>> childrenList(Long id) {
List<TagLibraryDO> pageResult = tagLibraryService.childrenList(id);
return success(BeanUtils.toBean(pageResult, TagLibraryRespVO.class));
}
}

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryPageReqVO.java

@ -27,6 +27,10 @@ public class TagLibraryPageReqVO extends PageParam {
@Schema(description = "1、企业标签2、执法标签", example = "2")
private Integer tagType;
//助记
@Schema(description = "英文助记", example = "2")
private String tagCode;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;

5
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibraryRespVO.java

@ -37,6 +37,11 @@ public class TagLibraryRespVO {
@ExcelProperty("排序")
private Integer sort;
//助记
@Schema(description = "英文助记", example = "2")
@ExcelProperty("英文助记")
private String tagCode;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;

5
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taglibrary/vo/TagLibrarySaveReqVO.java

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
@ -27,6 +28,10 @@ public class TagLibrarySaveReqVO {
@Schema(description = "排序")
private Integer sort;
//助记
@Schema(description = "英文助记", example = "2")
private String tagCode;
@Schema(description = "1、企业标签2、执法标签", example = "2")
private Integer tagType;

53
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/task/AppTaskController.java

@ -0,0 +1,53 @@
package cn.iocoder.yudao.module.system.controller.app.task;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo.TaskInfoPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo.TaskInfoRespVO;
import cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo.TaskInfoSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.dept.DeptService;
import cn.iocoder.yudao.module.system.service.taskinfo.TaskInfoService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。")
@RestController
@RequestMapping("/system/app/task-info")
@Validated
public class AppTaskController {
@Resource
private TaskInfoService taskInfoService;
@Resource
private AdminUserService adminUserService;
@Resource
private DeptService deptService;
@GetMapping("/page")
@Operation(summary = "获得任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。分页")
@PreAuthorize("@ss.hasPermission('system:task-info:query')")
public CommonResult<PageResult<TaskInfoRespVO>> getTaskInfoPage(@Valid TaskInfoPageReqVO pageReqVO) {
PageResult<TaskInfoDO> pageResult = taskInfoService.getTaskInfoPage(pageReqVO);
AdminUserDO user = adminUserService.getUser(SecurityFrameworkUtils.getLoginUserId());
DeptDO dep= deptService.getDept( user.getDeptId());
pageResult.getList().forEach(item->{
item.setPublishDep(dep.getName());
item.setCreateName(adminUserService.getUser(Long.valueOf(item.getCreator())).getRealName());
});
return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class));
}
}

5
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java

@ -80,11 +80,6 @@ public class EnterpriseDO extends BaseDO {
*/
private String gpsLocation;
/**
* 管理部门
*/
private Long deptId;
@TableField(exist = false)
private Integer audit;

27
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
@ -35,5 +36,29 @@ public class EnterpriseInspectionsDO extends BaseDO {
* 企业ID
*/
private Long enterpriseId;
//任务名称
@TableField(exist = false)
private String taskName;
//企业名称
@TableField(exist = false)
private String enterpriseName;
//进度状态
@TableField(exist = false)
private Integer inspectionStatus;
//标签集合
@TableField(exist = false)
private List<String> tagList;
//执法部门
@TableField(exist = false)
private String department;
//执法任务
@TableField(exist = false)
private String inspectName;
//协同人员
@TableField(exist = false)
private String cooperateWithName;
//执法时间
@TableField(exist = false)
private LocalDateTime execTime;
}
}

58
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java

@ -0,0 +1,58 @@
package cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog;
import com.sun.xml.bind.v2.TODO;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 检查结果日志 DO
*
* @author 芋道源码
*/
@TableName("inspections_log")
@KeySequence("inspections_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InspectionsLogDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 检查记录id
*/
private Long inspectionsId;
/**
* 检查状态1.签到2.通过.3整改
*
* 枚举 {@link TODO Inspections_status 对应的类}
*/
private Integer status;
/**
* 检查人员签到位置信息格式经纬度
*/
private String gpsLocation;
/**
* 反馈信息
*/
private String feedBack;
/**
* 协同人员姓名
*/
private String cooperateWithName;
/**
* 执法人员姓名
*/
private String inspectName;
}

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taglibrary/TagLibraryDO.java

@ -45,6 +45,8 @@ public class TagLibraryDO extends BaseDO {
private Integer tagType;
//排序
private Integer sort;
//助记
private String tagCode;
@TableField(exist = false)
private List<TagLibraryDO> children = new ArrayList<>(); // 子标签列表

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java

@ -31,10 +31,9 @@ public interface EnterpriseMapper extends BaseMapperX<EnterpriseDO> {
.eqIfPresent(EnterpriseDO::getIntroduction, reqVO.getIntroduction())
.betweenIfPresent(EnterpriseDO::getEstablishmentDate, reqVO.getEstablishmentDate())
.eqIfPresent(EnterpriseDO::getGpsLocation, reqVO.getGpsLocation())
.eqIfPresent(EnterpriseDO::getCreator, reqVO.getCreate())
.betweenIfPresent(EnterpriseDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(EnterpriseDO::getUpdater, reqVO.getUpdater())
.eqIfPresent(EnterpriseDO::getDeptId, reqVO.getDeptId())
.or(w->w.eq(EnterpriseDO::getCreator, reqVO.getCreate()))
.orderByDesc(EnterpriseDO::getId));
}

12
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.system.dal.mysql.enterpriseinspections;
import java.util.*;
import java.util.stream.Collectors;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
@ -25,4 +26,13 @@ public interface EnterpriseInspectionsMapper extends BaseMapperX<EnterpriseInspe
.orderByDesc(EnterpriseInspectionsDO::getId));
}
}
default PageResult<EnterpriseInspectionsDO> selectPageGroup(EnterpriseInspectionsPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<EnterpriseInspectionsDO>()
.eqIfPresent(EnterpriseInspectionsDO::getTaskId, reqVO.getTaskId())
.eqIfPresent(EnterpriseInspectionsDO::getEnterpriseId, reqVO.getEnterpriseId())
.betweenIfPresent(EnterpriseInspectionsDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(EnterpriseInspectionsDO::getId).groupBy(EnterpriseInspectionsDO::getTaskId)
);
}
}

32
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/inspectionslog/InspectionsLogMapper.java

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.system.dal.mysql.inspectionslog;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.*;
/**
* 检查结果日志 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface InspectionsLogMapper extends BaseMapperX<InspectionsLogDO> {
default PageResult<InspectionsLogDO> selectPage(InspectionsLogPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<InspectionsLogDO>()
.eqIfPresent(InspectionsLogDO::getInspectionsId, reqVO.getInspectionsId())
.eqIfPresent(InspectionsLogDO::getStatus, reqVO.getStatus())
.eqIfPresent(InspectionsLogDO::getGpsLocation, reqVO.getGpsLocation())
.eqIfPresent(InspectionsLogDO::getFeedBack, reqVO.getFeedBack())
.likeIfPresent(InspectionsLogDO::getCooperateWithName, reqVO.getCooperateWithName())
.likeIfPresent(InspectionsLogDO::getInspectName, reqVO.getInspectName())
.betweenIfPresent(InspectionsLogDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(InspectionsLogDO::getId));
}
}

59
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java

@ -1,19 +1,30 @@
package cn.iocoder.yudao.module.system.service.enterprise;
import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseauditlog.EnterpriseAuditLogDO;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprisetag.EnterpriseTagDO;
import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.dal.mysql.enterpriseauditlog.EnterpriseAuditLogMapper;
import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMapper;
import cn.iocoder.yudao.module.system.dal.mysql.fileInfo.FileInfoMapper;
import cn.iocoder.yudao.module.system.dal.mysql.permission.RoleMapper;
import cn.iocoder.yudao.module.system.dal.mysql.permission.UserRoleMapper;
import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.tomcat.jni.FileInfo;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -47,6 +58,10 @@ public class EnterpriseServiceImpl implements EnterpriseService {
private AdminUserService adminUserService;
@Resource
private EnterpriseAuditLogMapper enterpriseAuditLogMapper;
@Resource
private EnterpriseTagMapper enterpriseTagMapper;
@Resource
private UserRoleMapper userRoleMapper;
@Override
@Transactional
@ -136,13 +151,51 @@ public class EnterpriseServiceImpl implements EnterpriseService {
@Override
public PageResult<EnterpriseDO> getEnterprisePage(EnterprisePageReqVO pageReqVO) {
return enterpriseMapper.selectPage(pageReqVO);
final PageResult<EnterpriseDO> enterpriseDOPageResult = enterpriseMapper.selectPage(pageReqVO);
return enterpriseDOPageResult;
}
@Override
public PageResult<EnterpriseDO> getEnterpriseByUserId(EnterprisePageReqVO pageReqVO) {
pageReqVO.setCreate(getLoginUserId().toString());
return enterpriseMapper.selectPage(pageReqVO);
//根据不同身份查询企业
//专管员查询 user_id
//队长 查询部门 所有的 user_id in
QueryWrapper<UserRoleDO> roleDOQueryWrapper = new QueryWrapper<>();
roleDOQueryWrapper.eq("user_id", getLoginUserId());
final List<UserRoleDO> userRoleDOS = userRoleMapper.selectList(roleDOQueryWrapper);
final List<Long> collect = userRoleDOS.stream().map(item -> item.getRoleId()).collect(Collectors.toList());
//判断 collect 里面是否包含 roleId = 11
if (collect.contains(11L)) {
// //队长
// pageReqVO.setUserId(null);
// pageReqVO.setDeptId(null);
} else if (collect.contains(155L)) {
//专管员
pageReqVO.setUserId(getLoginUserId());
}
// pageReqVO.setCreate(getLoginUserId().toString());
final PageResult<EnterpriseDO> enterpriseDOPageResult = enterpriseMapper.selectPage(pageReqVO);
if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) {
LambdaQueryWrapper<EnterpriseTagDO> wrapper = new LambdaQueryWrapper<>();
wrapper.in(EnterpriseTagDO::getTagId, pageReqVO.getTagList());
List<EnterpriseTagDO> enterpriseTagDOList = enterpriseTagMapper.selectList(wrapper);
//根据enterpriseTagDOList 筛选
List<EnterpriseDO> enterpriseDOList = new ArrayList<>();
for (EnterpriseDO enterpriseDO : enterpriseDOPageResult.getList()) {
for (EnterpriseTagDO enterpriseTagDO : enterpriseTagDOList) {
if (enterpriseTagDO.getEnterpriseId().equals(enterpriseDO.getId())) {
enterpriseDOList.add(enterpriseDO);
break;
}
}
}
enterpriseDOPageResult.setList(enterpriseDOList);
enterpriseDOPageResult.setTotal(Long.valueOf(enterpriseDOList.size()));
}
return enterpriseDOPageResult;
}
}

94
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java

@ -1,5 +1,21 @@
package cn.iocoder.yudao.module.system.service.enterpriseinspections;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO;
import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO;
import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO;
import cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO;
import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.dal.mysql.enterprise.EnterpriseMapper;
import cn.iocoder.yudao.module.system.dal.mysql.inspectionslog.InspectionsLogMapper;
import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper;
import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper;
import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper;
import cn.iocoder.yudao.module.system.service.dept.DeptService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
@ -25,10 +41,25 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
*/
@Service
@Validated
@Slf4j
public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsService {
@Resource
private EnterpriseInspectionsMapper enterpriseInspectionsMapper;
@Resource
private TaskInfoMapper taskInfoMapper;
@Resource
private InspectionsLogMapper inspectionsLogMapper;
@Resource
private EnterpriseMapper enterpriseMapper;
@Resource
private TaskTagMapper taskTagMapper;
@Resource
private TagLibraryMapper tagLibraryMapper;
@Resource
private AdminUserService adminUserService;
@Resource
private DeptService deptService;
@Override
public Long createEnterpriseInspections(EnterpriseInspectionsSaveReqVO createReqVO) {
@ -69,7 +100,68 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe
@Override
public PageResult<EnterpriseInspectionsDO> getEnterpriseInspectionsPage(EnterpriseInspectionsPageReqVO pageReqVO) {
return enterpriseInspectionsMapper.selectPage(pageReqVO);
final PageResult<EnterpriseInspectionsDO> enterpriseInspectionsDOPageResult = enterpriseInspectionsMapper.selectPage(pageReqVO);
if (enterpriseInspectionsDOPageResult.getList().size() > 0 ) {
enterpriseInspectionsDOPageResult.getList().forEach(item->{
//查询任务相关
final TaskInfoDO taskInfoDO = taskInfoMapper.selectById(item.getTaskId());
if (taskInfoDO == null) {
throw exception(TASK_INFO_NOT_EXISTS);
}
item.setTaskName(taskInfoDO.getTitle());
//查询任务标签
QueryWrapper<TaskTagDO> wrapper = new QueryWrapper<>();
wrapper.eq("task_id", taskInfoDO.getId());
final List<TaskTagDO> taskTagDOS = taskTagMapper.selectList(wrapper);
List<String> tagList = new ArrayList<>();
if (!taskTagDOS.isEmpty() && taskTagDOS.size() > 0) {
taskTagDOS.forEach(taskTagItem->{
final TagLibraryDO tagLibraryDO = tagLibraryMapper.selectById(taskTagItem.getTagId());
if (tagLibraryDO != null) {
tagList.add(tagLibraryDO.getTagName());
}
});
}
item.setTagList(tagList);
//查询企业
final EnterpriseDO enterpriseDO = enterpriseMapper.selectById(item.getEnterpriseId());
if (enterpriseDO == null) {
throw exception(ENTERPRISE_NOT_EXISTS);
}
item.setEnterpriseName(enterpriseDO.getEnterprisesName());
//查询检查记录
QueryWrapper<InspectionsLogDO> inspectionsLogWrapper = new QueryWrapper<>();
inspectionsLogWrapper.eq("inspections_id", item.getId());
inspectionsLogWrapper.orderByDesc("create_time");
final List<InspectionsLogDO> inspectionsLogDOS = inspectionsLogMapper.selectList(inspectionsLogWrapper);
if (!inspectionsLogDOS.isEmpty() && inspectionsLogDOS.size() > 0) {
item.setInspectionStatus(inspectionsLogDOS.get(0).getStatus());
item.setInspectName(inspectionsLogDOS.get(0).getInspectName());
item.setCooperateWithName(inspectionsLogDOS.get(0).getCooperateWithName());
item.setExecTime(inspectionsLogDOS.get(0).getCreateTime());
//根据执法人员id 查询其所属部门
final Long userId = Long.valueOf(inspectionsLogDOS.get(0).getCreator());
final AdminUserDO user = adminUserService.getUser(userId);
if (user == null) {
throw exception(USER_NOT_EXISTS);
}
final DeptDO dept = deptService.getDept(user.getDeptId());
item.setDepartment(dept.getName());
}
});
}
log.info("enterpriseInspectionsDOPageResult:{}", enterpriseInspectionsDOPageResult);
return enterpriseInspectionsDOPageResult;
}
}

58
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java

@ -0,0 +1,58 @@
package cn.iocoder.yudao.module.system.service.inspectionslog;
import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import javax.validation.Valid;
/**
* 检查结果日志 Service 接口
*
* @author 芋道源码
*/
public interface InspectionsLogService {
/**
* 创建检查结果日志
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createInspectionsLog(@Valid InspectionsLogSaveReqVO createReqVO);
/**
* 更新检查结果日志
*
* @param updateReqVO 更新信息
*/
void updateInspectionsLog(@Valid InspectionsLogSaveReqVO updateReqVO);
/**
* 删除检查结果日志
*
* @param id 编号
*/
void deleteInspectionsLog(Long id);
/**
* 获得检查结果日志
*
* @param id 编号
* @return 检查结果日志
*/
InspectionsLogDO getInspectionsLog(Long id);
/**
* 获得检查结果日志分页
*
* @param pageReqVO 分页查询
* @return 检查结果日志分页
*/
PageResult<InspectionsLogDO> getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO);
List<InspectionsLogDO> list(InspectionsLogPageReqVO pageReqVO);
}

83
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogServiceImpl.java

@ -0,0 +1,83 @@
package cn.iocoder.yudao.module.system.service.inspectionslog;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.dal.mysql.inspectionslog.InspectionsLogMapper;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/**
* 检查结果日志 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class InspectionsLogServiceImpl implements InspectionsLogService {
@Resource
private InspectionsLogMapper inspectionsLogMapper;
@Override
public Long createInspectionsLog(InspectionsLogSaveReqVO createReqVO) {
// 插入
InspectionsLogDO inspectionsLog = BeanUtils.toBean(createReqVO, InspectionsLogDO.class);
inspectionsLogMapper.insert(inspectionsLog);
// 返回
return inspectionsLog.getId();
}
@Override
public void updateInspectionsLog(InspectionsLogSaveReqVO updateReqVO) {
// 校验存在
validateInspectionsLogExists(updateReqVO.getId());
// 更新
InspectionsLogDO updateObj = BeanUtils.toBean(updateReqVO, InspectionsLogDO.class);
inspectionsLogMapper.updateById(updateObj);
}
@Override
public void deleteInspectionsLog(Long id) {
// 校验存在
validateInspectionsLogExists(id);
// 删除
inspectionsLogMapper.deleteById(id);
}
private void validateInspectionsLogExists(Long id) {
if (inspectionsLogMapper.selectById(id) == null) {
throw exception(INSPECTIONS_LOG_NOT_EXISTS);
}
}
@Override
public InspectionsLogDO getInspectionsLog(Long id) {
return inspectionsLogMapper.selectById(id);
}
@Override
public PageResult<InspectionsLogDO> getInspectionsLogPage(InspectionsLogPageReqVO pageReqVO) {
return inspectionsLogMapper.selectPage(pageReqVO);
}
@Override
public List<InspectionsLogDO> list(InspectionsLogPageReqVO pageReqVO) {
QueryWrapper<InspectionsLogDO> wrapper = new QueryWrapper<>();
wrapper.eq("inspections_id", pageReqVO.getInspectionsId());
return inspectionsLogMapper.selectList(wrapper);
}
}

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java

@ -53,4 +53,7 @@ public interface TagLibraryService {
*/
List<TagLibraryDO> getTagLibraryPage(TagLibraryPageReqVO pageReqVO);
List<TagLibraryDO> list(String[] codeList);
List<TagLibraryDO> childrenList(Long id);
}

31
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.system.service.taglibrary;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo.*;
@ -73,6 +75,35 @@ public class TagLibraryServiceImpl implements TagLibraryService {
return buildTree(list, 0);
}
@Override
public List<TagLibraryDO> list(String[] codeList) {
List<TagLibraryDO> tagList = new ArrayList<>();
if (codeList.length > 0) {
for (String item : codeList) {
QueryWrapper<TagLibraryDO> wrapper = new QueryWrapper<>();
wrapper.eq("tag_code", item);
TagLibraryDO tagLibraryDO = tagLibraryMapper.selectOne(wrapper);
if (tagLibraryDO != null) {
QueryWrapper<TagLibraryDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("parent_id", tagLibraryDO.getId());
List<TagLibraryDO> children = tagLibraryMapper.selectList(queryWrapper);
if (children.size() > 0) {
tagLibraryDO.setChildren(children);
}
tagList.add(tagLibraryDO);
}
}
}
return tagList;
}
@Override
public List<TagLibraryDO> childrenList(Long id) {
QueryWrapper<TagLibraryDO> wrapper = new QueryWrapper<>();
wrapper.eq("parent_id", id);
return tagLibraryMapper.selectList(wrapper);
}
// 递归构建树
private List<TagLibraryDO> buildTree(List<TagLibraryDO> tags, Integer parentId) {
List<TagLibraryDO> tree = new ArrayList<>();

23
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java

@ -1,12 +1,16 @@
package cn.iocoder.yudao.module.system.service.taskinfo;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.module.infra.api.job.JobApi;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO;
import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.EnterpriseInspectionsDO;
import cn.iocoder.yudao.module.system.dal.dataobject.inspectionslog.InspectionsLogDO;
import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO;
import cn.iocoder.yudao.module.system.dal.mysql.enterprise.EnterpriseMapper;
import cn.iocoder.yudao.module.system.dal.mysql.enterpriseinspections.EnterpriseInspectionsMapper;
import cn.iocoder.yudao.module.system.dal.mysql.inspectionslog.InspectionsLogMapper;
import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
@ -25,6 +29,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/**
@ -46,6 +51,8 @@ public class TaskInfoServiceImpl implements TaskInfoService {
private EnterpriseMapper enterpriseMapper;
@Resource
private EnterpriseInspectionsMapper enterpriseInspectionsMapper;
@Resource
private InspectionsLogMapper inspectionsLogMapper;
@Override
@Transactional
@ -140,6 +147,22 @@ public class TaskInfoServiceImpl implements TaskInfoService {
@Override
public PageResult<TaskInfoDO> getTaskInfoPage(TaskInfoPageReqVO pageReqVO) {
// final Long loginUserId = getLoginUserId();
//根据分配表反查任务表
LambdaQueryWrapper<EnterpriseInspectionsDO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EnterpriseInspectionsDO::getCreator, getLoginUserId());
List<EnterpriseInspectionsDO> list = enterpriseInspectionsMapper.selectList(wrapper);
if (!list.isEmpty() && list.size() > 0) {
final List<Map<String, String>> data = new ArrayList<>();
list.forEach(item->{
// Map<String, String> map = new HashMap<>();
// map.put("id", item.getTaskId().toString());
// map.put("name", item.get)
// taskIds.add(item.getTaskId());
});
}
return taskInfoMapper.selectPage(pageReqVO);
}

Loading…
Cancel
Save