Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterpriseinspections/EnterpriseInspectionsMapper.java
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsService.java
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java
master
zy 2 months ago
parent
commit
0d2b4c73ec
  1. 5
      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. 26
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/EnterpriseInspectionsController.java
  4. 36
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/EnterpriseInspectionsRespVO.java
  5. 13
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterpriseinspections/vo/PassOnSaveVO.java
  6. 126
      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. 53
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/inspectionslog/vo/InspectionsLogRespVO.java
  9. 44
      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. 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java
  15. 20
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/DeptUserReqVO.java
  16. 53
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/task/AppTaskController.java
  17. 37
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterpriseinspections/EnterpriseInspectionsDO.java
  18. 64
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/inspectionslog/InspectionsLogDO.java
  19. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taglibrary/TagLibraryDO.java
  20. 32
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/inspectionslog/InspectionsLogMapper.java
  21. 59
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java
  22. 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java
  23. 26
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java
  24. 60
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/inspectionslog/InspectionsLogService.java
  25. 179
      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. 7
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java
  29. 31
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java
  30. 4
      yudao-server/src/main/resources/application-local.yaml

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

@ -186,4 +186,9 @@ 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, "执法日志不存在");
ErrorCode INSPECTIONS_SUCCESS = new ErrorCode(1-003-001-007, "已经完成执法, 不能进行其他操作");
ErrorCode ENTERPRISE_INSPECTIONS_STATUS_ERROR = new ErrorCode(1-003-002-000, "此状态下,不能转发执法任务");
}

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;
@ -188,7 +189,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<>();
@ -210,14 +210,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')")

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

@ -45,6 +45,14 @@ public class EnterpriseInspectionsController {
return success(enterpriseInspectionsService.createEnterpriseInspections(createReqVO));
}
@PostMapping("/passOn")
@Operation(summary = "执法记录转交")
@PreAuthorize("@ss.hasPermission('system:enterprise-inspections:create')")
public CommonResult<String> passOn(@Valid @RequestBody PassOnSaveVO passOnSaveVO) {
enterpriseInspectionsService.passOn(passOnSaveVO);
return success("添加成功");
}
@PutMapping("/update")
@Operation(summary = "更新企业检查记录表,用于记录与企业相关的环保检查信息。")
@PreAuthorize("@ss.hasPermission('system:enterprise-inspections:update')")
@ -79,6 +87,24 @@ public class EnterpriseInspectionsController {
return success(BeanUtils.toBean(pageResult, EnterpriseInspectionsRespVO.class));
}
//listByUserIdAndTaskName
@GetMapping("/getListByUserIdAndTaskName")
@Operation(summary = "PC端获得企业检查记录表,用于记录与企业相关的环保检查信息。分页")
@PreAuthorize("@ss.hasPermission('system:enterprise-inspections:query')")
public CommonResult<List<EnterpriseInspectionsRespVO>> getListByUserIdAndTaskName(@RequestParam("userId") Long userId,
@RequestParam("taskName") String taskName) {
List<EnterpriseInspectionsDO> pageResult = enterpriseInspectionsService.getListByUserIdAndTaskName(userId, taskName);
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;
}
}

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

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo;
import lombok.Data;
import java.util.List;
@Data
public class PassOnSaveVO {
//转交的执法记录id 转交是否需要审核
private List<Long> inspectionsId;
//转给的专管员id
private Long userId;
}

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

@ -0,0 +1,126 @@
package cn.iocoder.yudao.module.system.controller.admin.inspectionslog;
import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService;
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;
@Resource
private FileInfoService fileInfoService;
@PostMapping("/create")
@Operation(summary = "创建检查结果日志")
@PreAuthorize("@ss.hasPermission('system:inspections-log:create')")
public CommonResult<Long> createInspectionsLog(@Valid @RequestBody InspectionsLogSaveReqVO createReqVO) {
return success(inspectionsLogService.createInspectionsLog(createReqVO));
}
@PutMapping("/cooperateWithSignIn")
@Operation(summary = "协同人员打开")
@PreAuthorize("@ss.hasPermission('system:inspections-log:update')")
public CommonResult<Boolean> cooperateWithSignIn(Long inspectionsLogId) {
inspectionsLogService.cooperateWithSignIn(inspectionsLogId);
return success(true);
}
@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);
if (list != null && list.size() > 0) {
list.forEach(item->{
//图片相关
final List<Map<String, String>> fileList = fileInfoService.getFileList("644", "2", item.getId().toString());
item.setFileList(fileList);
});
}
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;
}

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

@ -0,0 +1,53 @@
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;
@Schema(description = "相关文件")
private List<Map<String, String>> fileList;
}

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

@ -0,0 +1,44 @@
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;
//协同人员的id 还是要加上 会有同名的情况
@Schema(description = "协同人员id", example = "1")
private String cooperateWithIds;
//协同人员的id 还是要加上 会有同名的情况
@Schema(description = "执法人ID", example = "1")
private Long inspectId;
//协同人员是否可以看到任务记录
}

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;

6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java

@ -132,6 +132,12 @@ public class UserController {
return success(UserConvert.INSTANCE.convertSimpleList(list, deptMap));
}
@GetMapping({"/simple-zg-list"})
@Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项")
public CommonResult<List<DeptUserReqVO>> getSimpleUserZGList() {
return success(userService.getSimpleUserZGList());
}
@GetMapping("/get")
@Operation(summary = "获得用户详情")
@Parameter(name = "id", description = "编号", required = true, example = "1024")

20
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/DeptUserReqVO.java

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.system.controller.admin.user.vo.user;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class DeptUserReqVO {
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
private String realName;
@Schema(description = "部门ID", example = "我是一个用户")
private Long deptId;
@Schema(description = "部门名称", example = "IT 部")
private String deptName;
}

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

37
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;
@ -36,4 +37,38 @@ public class EnterpriseInspectionsDO extends BaseDO {
*/
private Long enterpriseId;
}
/**
* 专管员id 如果只能在企业内修改专管员这个userid 用来记录 如果想修改企业的专管员需要在任务里面
* 任务里面重新选择企业
*/
private Long userId;
//状态 1.任务未启动 2. 任务已启动 3.已转交,未执行不展示 4.已转交,整改中,留痕
private Integer status;
//任务名称
@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;
}

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

@ -0,0 +1,64 @@
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;
//协同人员的id 还是要加上 会有同名的情况
private String cooperateWithIds;
//协同人员是否可以看到任务记录
//相关文件
@TableField(exist = false)
private List<Map<String, String>> fileList;
}

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<>(); // 子标签列表

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,7 +151,8 @@ 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;
}
@ -148,8 +164,45 @@ public class EnterpriseServiceImpl implements EnterpriseService {
@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;
}
}

1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoService.java

@ -53,4 +53,5 @@ public interface FileInfoService {
*/
PageResult<FileInfoDO> getFileInfoPage(FileInfoPageReqVO pageReqVO);
List<Map<String,String>> getFileList(String dictType, String dictData, String unitId);
}

26
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/fileInfo/FileInfoServiceImpl.java

@ -1,10 +1,14 @@
package cn.iocoder.yudao.module.system.service.fileInfo;
import cn.iocoder.yudao.module.infra.api.file.FileApi;
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;
import java.util.*;
import java.util.stream.Collectors;
import cn.iocoder.yudao.module.system.controller.admin.fileInfo.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -30,6 +34,9 @@ public class FileInfoServiceImpl implements FileInfoService {
@Resource
private FileInfoMapper fileInfoMapper;
@Resource
private FileApi fileApi;
@Override
public Long createFileInfo(FileInfoSaveReqVO createReqVO) {
// 插入
@ -72,4 +79,23 @@ public class FileInfoServiceImpl implements FileInfoService {
return fileInfoMapper.selectPage(pageReqVO);
}
@Override
public List<Map<String, String>> getFileList(String dictType, String dictData, String unitId) {
List<Map<String, String>> mapList = new ArrayList<>();
LambdaQueryWrapper<FileInfoDO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FileInfoDO::getDictType, dictType);
wrapper.eq(FileInfoDO::getDictData, dictData);
wrapper.eq(FileInfoDO::getUnitId, unitId);
final List<Long> collect = fileInfoMapper.selectList(wrapper).stream().map(res -> res.getInfraFileId()).collect(Collectors.toList());
if (!collect.isEmpty()) {
final List<Map<String,String>> list = fileApi.listFile(collect);
mapList.addAll(list);
}
return mapList;
}
}

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

@ -0,0 +1,60 @@
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);
void cooperateWithSignIn(Long inspectionsLogId);
}

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

@ -0,0 +1,179 @@
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.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.taskinfo.TaskInfoMapper;
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.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.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/**
* 检查结果日志 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class InspectionsLogServiceImpl implements InspectionsLogService {
@Resource
private InspectionsLogMapper inspectionsLogMapper;
@Resource
private AdminUserService adminUserService;
@Resource
private EnterpriseInspectionsMapper enterpriseInspectionsMapper;
@Resource
private TaskInfoMapper taskInfoMapper;
@Override
public Long createInspectionsLog(InspectionsLogSaveReqVO createReqVO) {
//当前用户id
Long loginUserId = getLoginUserId();
AdminUserDO user = adminUserService.getUser(loginUserId);
//根据查询出的列表判断执行到哪一步
LambdaQueryWrapper<InspectionsLogDO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(InspectionsLogDO::getInspectionsId, createReqVO.getInspectionsId());
wrapper.orderByDesc(InspectionsLogDO::getCreateTime);
List<InspectionsLogDO> list = inspectionsLogMapper.selectList(wrapper);
if (list == null || list.size() == 0) {
//签到
createReqVO.setStatus(1);
createReqVO.setInspectId(loginUserId);
createReqVO.setInspectName(user.getRealName());
}
if (list != null && createReqVO.getStatus() != null && createReqVO.getStatus() == 1) {
//请不要重复签到
throw exception(INSPECTIONS_SUCCESS);
}
if (list != null && list.get(0).getStatus() == 2) {
throw exception(INSPECTIONS_SUCCESS);
}
// 插入
InspectionsLogDO inspectionsLog = BeanUtils.toBean(createReqVO, InspectionsLogDO.class);
inspectionsLogMapper.insert(inspectionsLog);
//整改需要重新创建子任务
if (list != null && createReqVO.getStatus() != null && createReqVO.getStatus() == 3) {
//查询父任务,和执法记录
EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectById(createReqVO.getInspectionsId());
if (enterpriseInspectionsDO == null) {
throw exception(ENTERPRISE_INSPECTIONS_NOT_EXISTS);
}
//添加子任务
TaskInfoDO taskInfo = new TaskInfoDO();
taskInfo.setTitle(enterpriseInspectionsDO.getEnterpriseId() + "-" + "整改任务");
taskInfo.setTaskType(1); //整改默认是普通专项任务类型
taskInfo.setParentId(enterpriseInspectionsDO.getTaskId());
taskInfo.setParentType(21); //父子任务类型
taskInfoMapper.insert(taskInfo);
//添加执法记录
EnterpriseInspectionsDO enterpriseInspectionsDO1 = new EnterpriseInspectionsDO();
enterpriseInspectionsDO1.setUserId(getLoginUserId());
enterpriseInspectionsDO1.setEnterpriseId(enterpriseInspectionsDO.getEnterpriseId());
enterpriseInspectionsDO1.setTaskId(taskInfo.getId());
enterpriseInspectionsDO1.setStatus(2); //整改任务默认是启动的状态
enterpriseInspectionsMapper.insert(enterpriseInspectionsDO1);
}
// 返回
return inspectionsLog.getId();
}
@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);
}
/**
* 协作人员签到
* @param inspectionsLogId
*/
@Override
public void cooperateWithSignIn(Long inspectionsLogId) {
// 校验存在
InspectionsLogDO inspectionsLogDO = inspectionsLogMapper.selectById(inspectionsLogId);
if (inspectionsLogDO == null) {
throw exception(INSPECTIONS_LOG_NOT_EXISTS);
}
//查询真实名称并插入
AdminUserDO user = adminUserService.getUser(getLoginUserId());
if (user == null) {
throw exception(USER_NOT_EXISTS);
}
// 更新
if (inspectionsLogDO.getCooperateWithIds() == null ) {
inspectionsLogDO.setCooperateWithIds(getLoginUserId().toString());
inspectionsLogDO.setCooperateWithName(user.getRealName());
} else {
inspectionsLogDO.setCooperateWithIds(inspectionsLogDO.getCooperateWithIds() + "," + getLoginUserId());
inspectionsLogDO.setCooperateWithName(inspectionsLogDO.getCooperateWithName() + "," + user.getRealName());
}
inspectionsLogMapper.updateById(inspectionsLogDO);
}
}

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

7
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java

@ -7,10 +7,7 @@ import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthRegisterReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportExcelVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportRespVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*;
import cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo.UserAuditLogSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import com.xingyuv.jushauth.model.AuthUser;
@ -229,4 +226,6 @@ public interface AdminUserService {
AdminUserDO autoRegisterUser(AuthUser authUser, int userType);
void userAudit(UserAuditLogSaveReqVO auditLogSaveReqVO);
List<DeptUserReqVO> getSimpleUserZGList();
}

31
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java

@ -17,10 +17,7 @@ import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthRegisterReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportExcelVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportRespVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*;
import cn.iocoder.yudao.module.system.controller.admin.userAuditlog.vo.UserAuditLogSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.UserPostDO;
@ -36,6 +33,7 @@ import cn.iocoder.yudao.module.system.service.dept.PostService;
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
import cn.iocoder.yudao.module.system.service.userAuditlog.UserAuditLogService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.annotations.VisibleForTesting;
import com.mzt.logapi.context.LogRecordContext;
import com.mzt.logapi.service.impl.DiffParseFunction;
@ -52,6 +50,7 @@ import javax.validation.ConstraintViolationException;
import java.io.InputStream;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
@ -93,6 +92,8 @@ public class AdminUserServiceImpl implements AdminUserService {
private ConfigApi configApi;
@Resource
private UserAuditLogMapper userAuditLogMapper;
@Resource
private AdminUserMapper adminUserMapper;
@Override
@Transactional(rollbackFor = Exception.class)
@ -579,6 +580,28 @@ public class AdminUserServiceImpl implements AdminUserService {
}
@Override
public List<DeptUserReqVO> getSimpleUserZGList() {
List<DeptUserReqVO> list = new ArrayList<>();
LambdaQueryWrapper<AdminUserDO> wrapper = new LambdaQueryWrapper<>();
wrapper.isNotNull(AdminUserDO::getRealName);
wrapper.eq(AdminUserDO::getStatus, CommonStatusEnum.ENABLE.getStatus());
wrapper.isNotNull(AdminUserDO::getDeptId);
final List<AdminUserDO> adminUserDOS = userMapper.selectList(wrapper);
adminUserDOS.forEach(item->{
DeptUserReqVO deptUserReqVO = new DeptUserReqVO();
deptUserReqVO.setId(item.getId());
deptUserReqVO.setRealName(item.getRealName());
final DeptDO dept = deptService.getDept(item.getDeptId());
deptUserReqVO.setDeptName(dept.getName());
list.add(deptUserReqVO);
});
return list;
}
public void bindSocialUser(Long userId, AuthUser authUser) {
// SocialUserDO socialUser = new SocialUserDO();
// socialUser.setUserId(userId);

4
yudao-server/src/main/resources/application-local.yaml

@ -185,8 +185,8 @@ wx:
mp: # 公众号配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档
# app-id: wx041349c6f39b268b # 测试号(牛希尧提供的)
# secret: 5abee519483bc9f8cb37ce280e814bd0
app-id: wx5b23ba7a5589ecbb # 测试号(自己的)
secret: 2a7b3b20c537e52e74afd395eb85f61f
app-id: wx6d80755768234f3b # 测试号(自己的)
secret: c8180f2ab1b8454d403c7aa336782e21
# app-id: wxa69ab825b163be19 # 测试号(Kongdy 提供的)
# secret: bd4f9fab889591b62aeac0d7b8d8b4a0
# 存储配置,解决 AccessToken 的跨节点的共享

Loading…
Cancel
Save