Commit 6b57476ed30fa7067241ce7fdacaf22205a38383
1 parent
ad3f9cd4
巡查计划-创建提交
Showing
19 changed files
with
1029 additions
and
8 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/InspectionPlanDetailController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.inspectionplan; | |
| 2 | + | |
| 3 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanDetailPageReqVO; | |
| 4 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanDetailRespVO; | |
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanDetailSaveReqVO; | |
| 6 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDetailDO; | |
| 7 | +import com.zteits.urbanops.module.garden.service.inspectionplan.InspectionPlanDetailService; | |
| 8 | +import org.springframework.web.bind.annotation.*; | |
| 9 | +import jakarta.annotation.Resource; | |
| 10 | +import org.springframework.validation.annotation.Validated; | |
| 11 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 12 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 13 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 14 | +import io.swagger.v3.oas.annotations.Operation; | |
| 15 | + | |
| 16 | +import jakarta.validation.constraints.*; | |
| 17 | +import jakarta.validation.*; | |
| 18 | +import jakarta.servlet.http.*; | |
| 19 | +import java.util.*; | |
| 20 | +import java.io.IOException; | |
| 21 | + | |
| 22 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 23 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 24 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 25 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 26 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 27 | + | |
| 28 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 29 | + | |
| 30 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 31 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | |
| 32 | + | |
| 33 | + | |
| 34 | +@Tag(name = "管理后台 - 巡检计划") | |
| 35 | +@RestController | |
| 36 | +@RequestMapping("/garden/inspection-plan-detail") | |
| 37 | +@Validated | |
| 38 | +public class InspectionPlanDetailController { | |
| 39 | + | |
| 40 | + @Resource | |
| 41 | + private InspectionPlanDetailService inspectionPlanDetailService; | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + @PutMapping("/update") | |
| 46 | + @Operation(summary = "更新巡检计划") | |
| 47 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan-detail:update')") | |
| 48 | + public CommonResult<Boolean> updateInspectionPlanDetail(@Valid @RequestBody InspectionPlanDetailSaveReqVO updateReqVO) { | |
| 49 | + inspectionPlanDetailService.updateInspectionPlanDetail(updateReqVO); | |
| 50 | + return success(true); | |
| 51 | + } | |
| 52 | + | |
| 53 | + @DeleteMapping("/delete") | |
| 54 | + @Operation(summary = "删除巡检计划") | |
| 55 | + @Parameter(name = "id", description = "编号", required = true) | |
| 56 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan-detail:delete')") | |
| 57 | + public CommonResult<Boolean> deleteInspectionPlanDetail(@RequestParam("id") Long id) { | |
| 58 | + inspectionPlanDetailService.deleteInspectionPlanDetail(id); | |
| 59 | + return success(true); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @DeleteMapping("/delete-list") | |
| 63 | + @Parameter(name = "ids", description = "编号", required = true) | |
| 64 | + @Operation(summary = "批量删除巡检计划") | |
| 65 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan-detail:delete')") | |
| 66 | + public CommonResult<Boolean> deleteInspectionPlanDetailList(@RequestParam("ids") List<Long> ids) { | |
| 67 | + inspectionPlanDetailService.deleteInspectionPlanDetailListByIds(ids); | |
| 68 | + return success(true); | |
| 69 | + } | |
| 70 | + | |
| 71 | + @GetMapping("/get") | |
| 72 | + @Operation(summary = "获得巡检计划") | |
| 73 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 74 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan-detail:query')") | |
| 75 | + public CommonResult<InspectionPlanDetailRespVO> getInspectionPlanDetail(@RequestParam("id") Long id) { | |
| 76 | + InspectionPlanDetailDO inspectionPlanDetail = inspectionPlanDetailService.getInspectionPlanDetail(id); | |
| 77 | + return success(BeanUtils.toBean(inspectionPlanDetail, InspectionPlanDetailRespVO.class)); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @GetMapping("/page") | |
| 81 | + @Operation(summary = "获得巡检计划分页") | |
| 82 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan-detail:query')") | |
| 83 | + public CommonResult<PageResult<InspectionPlanDetailRespVO>> getInspectionPlanDetailPage(@Valid InspectionPlanDetailPageReqVO pageReqVO) { | |
| 84 | + PageResult<InspectionPlanDetailDO> pageResult = inspectionPlanDetailService.getInspectionPlanDetailPage(pageReqVO); | |
| 85 | + return success(BeanUtils.toBean(pageResult, InspectionPlanDetailRespVO.class)); | |
| 86 | + } | |
| 87 | + | |
| 88 | + @GetMapping("/export-excel") | |
| 89 | + @Operation(summary = "导出巡检计划 Excel") | |
| 90 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan-detail:export')") | |
| 91 | + @ApiAccessLog(operateType = EXPORT) | |
| 92 | + public void exportInspectionPlanDetailExcel(@Valid InspectionPlanDetailPageReqVO pageReqVO, | |
| 93 | + HttpServletResponse response) throws IOException { | |
| 94 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 95 | + List<InspectionPlanDetailDO> list = inspectionPlanDetailService.getInspectionPlanDetailPage(pageReqVO).getList(); | |
| 96 | + // 导出 Excel | |
| 97 | + ExcelUtils.write(response, "巡检计划.xls", "数据", InspectionPlanDetailRespVO.class, | |
| 98 | + BeanUtils.toBean(list, InspectionPlanDetailRespVO.class)); | |
| 99 | + } | |
| 100 | + | |
| 101 | +} | |
| 0 | 102 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/InspectionPlanRoleController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.inspectionplan; | |
| 2 | + | |
| 3 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanRolePageReqVO; | |
| 4 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanRoleRespVO; | |
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanRoleSaveReqVO; | |
| 6 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanRoleDO; | |
| 7 | +import com.zteits.urbanops.module.garden.service.inspectionplan.InspectionPlanRoleService; | |
| 8 | +import org.springframework.web.bind.annotation.*; | |
| 9 | +import jakarta.annotation.Resource; | |
| 10 | +import org.springframework.validation.annotation.Validated; | |
| 11 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 12 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 13 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 14 | +import io.swagger.v3.oas.annotations.Operation; | |
| 15 | + | |
| 16 | +import jakarta.validation.constraints.*; | |
| 17 | +import jakarta.validation.*; | |
| 18 | +import jakarta.servlet.http.*; | |
| 19 | +import java.util.*; | |
| 20 | +import java.io.IOException; | |
| 21 | + | |
| 22 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 23 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 24 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 25 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 26 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 27 | + | |
| 28 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 29 | + | |
| 30 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 31 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | |
| 32 | + | |
| 33 | + | |
| 34 | +@Tag(name = "管理后台 - 巡检计划角色") | |
| 35 | +@RestController | |
| 36 | +@RequestMapping("/garden/inspection-plan-role") | |
| 37 | +@Validated | |
| 38 | +public class InspectionPlanRoleController { | |
| 39 | + | |
| 40 | + @Resource | |
| 41 | + private InspectionPlanRoleService inspectionPlanRoleService; | |
| 42 | + | |
| 43 | + @PostMapping("/create") | |
| 44 | + @Operation(summary = "创建巡检计划角色") | |
| 45 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan-role:create')") | |
| 46 | + public CommonResult<Long> createInspectionPlanRole(@Valid @RequestBody InspectionPlanRoleSaveReqVO createReqVO) { | |
| 47 | + return success(inspectionPlanRoleService.createInspectionPlanRole(createReqVO)); | |
| 48 | + } | |
| 49 | + | |
| 50 | + @PutMapping("/update") | |
| 51 | + @Operation(summary = "更新巡检计划角色") | |
| 52 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan-role:update')") | |
| 53 | + public CommonResult<Boolean> updateInspectionPlanRole(@Valid @RequestBody InspectionPlanRoleSaveReqVO updateReqVO) { | |
| 54 | + inspectionPlanRoleService.updateInspectionPlanRole(updateReqVO); | |
| 55 | + return success(true); | |
| 56 | + } | |
| 57 | + | |
| 58 | + @DeleteMapping("/delete") | |
| 59 | + @Operation(summary = "删除巡检计划角色") | |
| 60 | + @Parameter(name = "id", description = "编号", required = true) | |
| 61 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan-role:delete')") | |
| 62 | + public CommonResult<Boolean> deleteInspectionPlanRole(@RequestParam("id") Long id) { | |
| 63 | + inspectionPlanRoleService.deleteInspectionPlanRole(id); | |
| 64 | + return success(true); | |
| 65 | + } | |
| 66 | + | |
| 67 | + @DeleteMapping("/delete-list") | |
| 68 | + @Parameter(name = "ids", description = "编号", required = true) | |
| 69 | + @Operation(summary = "批量删除巡检计划角色") | |
| 70 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan-role:delete')") | |
| 71 | + public CommonResult<Boolean> deleteInspectionPlanRoleList(@RequestParam("ids") List<Long> ids) { | |
| 72 | + inspectionPlanRoleService.deleteInspectionPlanRoleListByIds(ids); | |
| 73 | + return success(true); | |
| 74 | + } | |
| 75 | + | |
| 76 | + @GetMapping("/get") | |
| 77 | + @Operation(summary = "获得巡检计划角色") | |
| 78 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 79 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan-role:query')") | |
| 80 | + public CommonResult<InspectionPlanRoleRespVO> getInspectionPlanRole(@RequestParam("id") Long id) { | |
| 81 | + InspectionPlanRoleDO inspectionPlanRole = inspectionPlanRoleService.getInspectionPlanRole(id); | |
| 82 | + return success(BeanUtils.toBean(inspectionPlanRole, InspectionPlanRoleRespVO.class)); | |
| 83 | + } | |
| 84 | + | |
| 85 | + @GetMapping("/page") | |
| 86 | + @Operation(summary = "获得巡检计划角色分页") | |
| 87 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan-role:query')") | |
| 88 | + public CommonResult<PageResult<InspectionPlanRoleRespVO>> getInspectionPlanRolePage(@Valid InspectionPlanRolePageReqVO pageReqVO) { | |
| 89 | + PageResult<InspectionPlanRoleDO> pageResult = inspectionPlanRoleService.getInspectionPlanRolePage(pageReqVO); | |
| 90 | + return success(BeanUtils.toBean(pageResult, InspectionPlanRoleRespVO.class)); | |
| 91 | + } | |
| 92 | + | |
| 93 | + @GetMapping("/export-excel") | |
| 94 | + @Operation(summary = "导出巡检计划角色 Excel") | |
| 95 | + @PreAuthorize("@ss.hasPermission('garden:inspection-plan-role:export')") | |
| 96 | + @ApiAccessLog(operateType = EXPORT) | |
| 97 | + public void exportInspectionPlanRoleExcel(@Valid InspectionPlanRolePageReqVO pageReqVO, | |
| 98 | + HttpServletResponse response) throws IOException { | |
| 99 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 100 | + List<InspectionPlanRoleDO> list = inspectionPlanRoleService.getInspectionPlanRolePage(pageReqVO).getList(); | |
| 101 | + // 导出 Excel | |
| 102 | + ExcelUtils.write(response, "巡检计划角色.xls", "数据", InspectionPlanRoleRespVO.class, | |
| 103 | + BeanUtils.toBean(list, InspectionPlanRoleRespVO.class)); | |
| 104 | + } | |
| 105 | + | |
| 106 | +} | |
| 0 | 107 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanDetailPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | + | |
| 5 | +import java.time.LocalDate; | |
| 6 | +import java.util.*; | |
| 7 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 8 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 9 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 10 | +import java.time.LocalDateTime; | |
| 11 | + | |
| 12 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 13 | + | |
| 14 | +@Schema(description = "管理后台 - 巡检计划分页 Request VO") | |
| 15 | +@Data | |
| 16 | +public class InspectionPlanDetailPageReqVO extends PageParam { | |
| 17 | + | |
| 18 | + @Schema(description = "批次号") | |
| 19 | + private String batchNo; | |
| 20 | + | |
| 21 | + @Schema(description = "计划编码") | |
| 22 | + private String planNo; | |
| 23 | + | |
| 24 | + @Schema(description = "业务线: yl-园林;wy-物业:sz-市政") | |
| 25 | + private String busiLine; | |
| 26 | + | |
| 27 | + @Schema(description = "归属(一级部门id)", example = "1951") | |
| 28 | + private Long companyId; | |
| 29 | + | |
| 30 | + @Schema(description = "部门ID(道路负责部门id)", example = "16561") | |
| 31 | + private Long deptId; | |
| 32 | + | |
| 33 | + @Schema(description = "道路ID", example = "32704") | |
| 34 | + private Long roadId; | |
| 35 | + | |
| 36 | + @Schema(description = "排序号:第n次计划") | |
| 37 | + private Integer sortNum; | |
| 38 | + | |
| 39 | + @Schema(description = "执行开始时间") | |
| 40 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 41 | + private LocalDate[] beginTime; | |
| 42 | + | |
| 43 | + @Schema(description = "执行时间") | |
| 44 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 45 | + private LocalDate[] endTime; | |
| 46 | + | |
| 47 | + @Schema(description = "完成状态 1:未完成;2:进行中;3:已完成") | |
| 48 | + private Integer finishState; | |
| 49 | + | |
| 50 | + @Schema(description = "创建时间") | |
| 51 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 52 | + private LocalDateTime[] createTime; | |
| 53 | + | |
| 54 | +} | |
| 0 | 55 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanDetailRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | + | |
| 6 | +import java.time.LocalDate; | |
| 7 | +import java.util.*; | |
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | +import cn.idev.excel.annotation.*; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - 巡检计划 Response VO") | |
| 13 | +@Data | |
| 14 | +@ExcelIgnoreUnannotated | |
| 15 | +public class InspectionPlanDetailRespVO { | |
| 16 | + | |
| 17 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16197") | |
| 18 | + @ExcelProperty("ID") | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | + @Schema(description = "批次号", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 22 | + @ExcelProperty("批次号") | |
| 23 | + private String batchNo; | |
| 24 | + | |
| 25 | + @Schema(description = "计划编码", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 26 | + @ExcelProperty("计划编码") | |
| 27 | + private String planNo; | |
| 28 | + | |
| 29 | + @Schema(description = "业务线: yl-园林;wy-物业:sz-市政", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 30 | + @ExcelProperty("业务线: yl-园林;wy-物业:sz-市政") | |
| 31 | + private String busiLine; | |
| 32 | + | |
| 33 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1951") | |
| 34 | + @ExcelProperty("归属(一级部门id)") | |
| 35 | + private Long companyId; | |
| 36 | + | |
| 37 | + @Schema(description = "部门ID(道路负责部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "16561") | |
| 38 | + @ExcelProperty("部门ID(道路负责部门id)") | |
| 39 | + private Long deptId; | |
| 40 | + | |
| 41 | + @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32704") | |
| 42 | + @ExcelProperty("道路ID") | |
| 43 | + private Long roadId; | |
| 44 | + | |
| 45 | + @Schema(description = "排序号:第n次计划", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 46 | + @ExcelProperty("排序号:第n次计划") | |
| 47 | + private Integer sortNum; | |
| 48 | + | |
| 49 | + @Schema(description = "执行开始时间") | |
| 50 | + @ExcelProperty("执行开始时间") | |
| 51 | + private LocalDate beginTime; | |
| 52 | + | |
| 53 | + @Schema(description = "执行时间") | |
| 54 | + @ExcelProperty("执行时间") | |
| 55 | + private LocalDate endTime; | |
| 56 | + | |
| 57 | + @Schema(description = "完成状态 1:未完成;2:进行中;3:已完成", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 58 | + @ExcelProperty("完成状态 1:未完成;2:进行中;3:已完成") | |
| 59 | + private Integer finishState; | |
| 60 | + | |
| 61 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 62 | + @ExcelProperty("创建时间") | |
| 63 | + private LocalDateTime createTime; | |
| 64 | + | |
| 65 | +} | |
| 0 | 66 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanDetailSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | + | |
| 6 | +import java.time.LocalDate; | |
| 7 | +import java.util.*; | |
| 8 | +import jakarta.validation.constraints.*; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 巡检计划新增/修改 Request VO") | |
| 11 | +@Data | |
| 12 | +public class InspectionPlanDetailSaveReqVO { | |
| 13 | + | |
| 14 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16197") | |
| 15 | + private Long id; | |
| 16 | + | |
| 17 | + @Schema(description = "批次号", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 18 | + @NotEmpty(message = "批次号不能为空") | |
| 19 | + private String batchNo; | |
| 20 | + | |
| 21 | + @Schema(description = "计划编码", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 22 | + @NotEmpty(message = "计划编码不能为空") | |
| 23 | + private String planNo; | |
| 24 | + | |
| 25 | + @Schema(description = "业务线: yl-园林;wy-物业:sz-市政", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 26 | + @NotEmpty(message = "业务线: yl-园林;wy-物业:sz-市政不能为空") | |
| 27 | + private String busiLine; | |
| 28 | + | |
| 29 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1951") | |
| 30 | + @NotNull(message = "归属(一级部门id)不能为空") | |
| 31 | + private Long companyId; | |
| 32 | + | |
| 33 | + @Schema(description = "部门ID(道路负责部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "16561") | |
| 34 | + @NotNull(message = "部门ID(道路负责部门id)不能为空") | |
| 35 | + private Long deptId; | |
| 36 | + | |
| 37 | + @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32704") | |
| 38 | + @NotNull(message = "道路ID不能为空") | |
| 39 | + private Long roadId; | |
| 40 | + | |
| 41 | + @Schema(description = "排序号:第n次计划", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 42 | + @NotNull(message = "排序号:第n次计划不能为空") | |
| 43 | + private Integer sortNum; | |
| 44 | + | |
| 45 | + @Schema(description = "执行开始时间") | |
| 46 | + private LocalDate beginTime; | |
| 47 | + | |
| 48 | + @Schema(description = "执行时间") | |
| 49 | + private LocalDate endTime; | |
| 50 | + | |
| 51 | + @Schema(description = "完成状态 1:未完成;2:进行中;3:已完成", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 52 | + @NotNull(message = "完成状态 1:未完成;2:进行中;3:已完成不能为空") | |
| 53 | + private Integer finishState; | |
| 54 | + | |
| 55 | +} | |
| 0 | 56 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanRolePageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - 巡检计划角色分页 Request VO") | |
| 13 | +@Data | |
| 14 | +public class InspectionPlanRolePageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "批次号") | |
| 17 | + private String batchNo; | |
| 18 | + | |
| 19 | + @Schema(description = "归属(一级部门id)", example = "12346") | |
| 20 | + private Long companyId; | |
| 21 | + | |
| 22 | + @Schema(description = "部门ID(道路负责部门id)", example = "22415") | |
| 23 | + private Long deptId; | |
| 24 | + | |
| 25 | + @Schema(description = "角色ID", example = "21343") | |
| 26 | + private Long roleId; | |
| 27 | + | |
| 28 | + @Schema(description = "创建时间") | |
| 29 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 30 | + private LocalDateTime[] createTime; | |
| 31 | + | |
| 32 | +} | |
| 0 | 33 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanRoleRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | +import cn.idev.excel.annotation.*; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 巡检计划角色 Response VO") | |
| 11 | +@Data | |
| 12 | +@ExcelIgnoreUnannotated | |
| 13 | +public class InspectionPlanRoleRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4778") | |
| 16 | + @ExcelProperty("ID") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "批次号", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 20 | + @ExcelProperty("批次号") | |
| 21 | + private String batchNo; | |
| 22 | + | |
| 23 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "12346") | |
| 24 | + @ExcelProperty("归属(一级部门id)") | |
| 25 | + private Long companyId; | |
| 26 | + | |
| 27 | + @Schema(description = "部门ID(道路负责部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "22415") | |
| 28 | + @ExcelProperty("部门ID(道路负责部门id)") | |
| 29 | + private Long deptId; | |
| 30 | + | |
| 31 | + @Schema(description = "角色ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21343") | |
| 32 | + @ExcelProperty("角色ID") | |
| 33 | + private Long roleId; | |
| 34 | + | |
| 35 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 36 | + @ExcelProperty("创建时间") | |
| 37 | + private LocalDateTime createTime; | |
| 38 | + | |
| 39 | +} | |
| 0 | 40 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanRoleSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import jakarta.validation.constraints.*; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - 巡检计划角色新增/修改 Request VO") | |
| 9 | +@Data | |
| 10 | +public class InspectionPlanRoleSaveReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "4778") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "批次号", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 16 | + @NotEmpty(message = "批次号不能为空") | |
| 17 | + private String batchNo; | |
| 18 | + | |
| 19 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "12346") | |
| 20 | + @NotNull(message = "归属(一级部门id)不能为空") | |
| 21 | + private Long companyId; | |
| 22 | + | |
| 23 | + @Schema(description = "部门ID(道路负责部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "22415") | |
| 24 | + @NotNull(message = "部门ID(道路负责部门id)不能为空") | |
| 25 | + private Long deptId; | |
| 26 | + | |
| 27 | + @Schema(description = "角色ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21343") | |
| 28 | + @NotNull(message = "角色ID不能为空") | |
| 29 | + private Long roleId; | |
| 30 | + | |
| 31 | +} | |
| 0 | 32 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanSaveReqVO.java
| ... | ... | @@ -64,6 +64,6 @@ public class InspectionPlanSaveReqVO { |
| 64 | 64 | @NotNull(message = "角色Ids不能为空") |
| 65 | 65 | @Schema(description = "角色Ids", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1,2]") |
| 66 | 66 | @Size(min = 1) |
| 67 | - private Set<Integer> roleIds; | |
| 67 | + private Set<Long> roleIds; | |
| 68 | 68 | |
| 69 | 69 | } |
| 70 | 70 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/inspectionplan/InspectionPlanDetailDO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | + | |
| 5 | +import java.time.LocalDate; | |
| 6 | +import java.util.*; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | +import com.baomidou.mybatisplus.annotation.*; | |
| 10 | +import com.zteits.urbanops.framework.mybatis.core.dataobject.BaseDO; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 巡检计划 DO | |
| 14 | + * | |
| 15 | + * @author 超级管理员 | |
| 16 | + */ | |
| 17 | +@TableName("garden_inspection_plan_detail") | |
| 18 | +@KeySequence("garden_inspection_plan_detail_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 19 | +@Data | |
| 20 | +@EqualsAndHashCode(callSuper = true) | |
| 21 | +@ToString(callSuper = true) | |
| 22 | +@Builder | |
| 23 | +@NoArgsConstructor | |
| 24 | +@AllArgsConstructor | |
| 25 | +public class InspectionPlanDetailDO extends BaseDO { | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * ID | |
| 29 | + */ | |
| 30 | + @TableId | |
| 31 | + private Long id; | |
| 32 | + /** | |
| 33 | + * 批次号 | |
| 34 | + */ | |
| 35 | + private String batchNo; | |
| 36 | + /** | |
| 37 | + * 计划编码 | |
| 38 | + */ | |
| 39 | + private String planNo; | |
| 40 | + /** | |
| 41 | + * 业务线: yl-园林;wy-物业:sz-市政 | |
| 42 | + */ | |
| 43 | + private String busiLine; | |
| 44 | + /** | |
| 45 | + * 归属(一级部门id) | |
| 46 | + */ | |
| 47 | + private Long companyId; | |
| 48 | + /** | |
| 49 | + * 部门ID(道路负责部门id) | |
| 50 | + */ | |
| 51 | + private Long deptId; | |
| 52 | + /** | |
| 53 | + * 道路ID | |
| 54 | + */ | |
| 55 | + private Long roadId; | |
| 56 | + /** | |
| 57 | + * 排序号:第n次计划 | |
| 58 | + */ | |
| 59 | + private Integer sortNum; | |
| 60 | + /** | |
| 61 | + * 执行开始时间 | |
| 62 | + */ | |
| 63 | + private LocalDate beginTime; | |
| 64 | + /** | |
| 65 | + * 执行时间 | |
| 66 | + */ | |
| 67 | + private LocalDate endTime; | |
| 68 | + /** | |
| 69 | + * 完成状态 1:未完成;2:进行中;3:已完成 | |
| 70 | + */ | |
| 71 | + private Integer finishState; | |
| 72 | + | |
| 73 | + | |
| 74 | +} | |
| 0 | 75 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/inspectionplan/InspectionPlanRoleDO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import java.time.LocalDateTime; | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | +import com.baomidou.mybatisplus.annotation.*; | |
| 8 | +import com.zteits.urbanops.framework.mybatis.core.dataobject.BaseDO; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 巡检计划角色 DO | |
| 12 | + * | |
| 13 | + * @author 超级管理员 | |
| 14 | + */ | |
| 15 | +@TableName("garden_inspection_plan_role") | |
| 16 | +@KeySequence("garden_inspection_plan_role_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 17 | +@Data | |
| 18 | +@EqualsAndHashCode(callSuper = true) | |
| 19 | +@ToString(callSuper = true) | |
| 20 | +@Builder | |
| 21 | +@NoArgsConstructor | |
| 22 | +@AllArgsConstructor | |
| 23 | +public class InspectionPlanRoleDO extends BaseDO { | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * ID | |
| 27 | + */ | |
| 28 | + @TableId | |
| 29 | + private Long id; | |
| 30 | + /** | |
| 31 | + * 批次号 | |
| 32 | + */ | |
| 33 | + private String batchNo; | |
| 34 | + /** | |
| 35 | + * 归属(一级部门id) | |
| 36 | + */ | |
| 37 | + private Long companyId; | |
| 38 | + /** | |
| 39 | + * 部门ID(道路负责部门id) | |
| 40 | + */ | |
| 41 | + private Long deptId; | |
| 42 | + /** | |
| 43 | + * 角色ID | |
| 44 | + */ | |
| 45 | + private Long roleId; | |
| 46 | + | |
| 47 | + | |
| 48 | +} | |
| 0 | 49 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/inspectionplan/InspectionPlanDetailMapper.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.mysql.inspectionplan; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | + | |
| 5 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 6 | +import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | +import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDetailDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 巡检计划 Mapper | |
| 14 | + * | |
| 15 | + * @author 超级管理员 | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface InspectionPlanDetailMapper extends BaseMapperX<InspectionPlanDetailDO> { | |
| 19 | + | |
| 20 | + default PageResult<InspectionPlanDetailDO> selectPage(InspectionPlanDetailPageReqVO reqVO) { | |
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<InspectionPlanDetailDO>() | |
| 22 | + .eqIfPresent(InspectionPlanDetailDO::getBatchNo, reqVO.getBatchNo()) | |
| 23 | + .eqIfPresent(InspectionPlanDetailDO::getPlanNo, reqVO.getPlanNo()) | |
| 24 | + .eqIfPresent(InspectionPlanDetailDO::getBusiLine, reqVO.getBusiLine()) | |
| 25 | + .eqIfPresent(InspectionPlanDetailDO::getCompanyId, reqVO.getCompanyId()) | |
| 26 | + .eqIfPresent(InspectionPlanDetailDO::getDeptId, reqVO.getDeptId()) | |
| 27 | + .eqIfPresent(InspectionPlanDetailDO::getRoadId, reqVO.getRoadId()) | |
| 28 | + .eqIfPresent(InspectionPlanDetailDO::getSortNum, reqVO.getSortNum()) | |
| 29 | + .betweenIfPresent(InspectionPlanDetailDO::getBeginTime, reqVO.getBeginTime()) | |
| 30 | + .betweenIfPresent(InspectionPlanDetailDO::getEndTime, reqVO.getEndTime()) | |
| 31 | + .eqIfPresent(InspectionPlanDetailDO::getFinishState, reqVO.getFinishState()) | |
| 32 | + .betweenIfPresent(InspectionPlanDetailDO::getCreateTime, reqVO.getCreateTime()) | |
| 33 | + .orderByDesc(InspectionPlanDetailDO::getId)); | |
| 34 | + } | |
| 35 | + | |
| 36 | +} | |
| 0 | 37 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/inspectionplan/InspectionPlanRoleMapper.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.mysql.inspectionplan; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | + | |
| 5 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 6 | +import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | +import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanRolePageReqVO; | |
| 9 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanRoleDO; | |
| 10 | +import org.apache.ibatis.annotations.Mapper; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 巡检计划角色 Mapper | |
| 14 | + * | |
| 15 | + * @author 超级管理员 | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface InspectionPlanRoleMapper extends BaseMapperX<InspectionPlanRoleDO> { | |
| 19 | + | |
| 20 | + default PageResult<InspectionPlanRoleDO> selectPage(InspectionPlanRolePageReqVO reqVO) { | |
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<InspectionPlanRoleDO>() | |
| 22 | + .eqIfPresent(InspectionPlanRoleDO::getBatchNo, reqVO.getBatchNo()) | |
| 23 | + .eqIfPresent(InspectionPlanRoleDO::getCompanyId, reqVO.getCompanyId()) | |
| 24 | + .eqIfPresent(InspectionPlanRoleDO::getDeptId, reqVO.getDeptId()) | |
| 25 | + .eqIfPresent(InspectionPlanRoleDO::getRoleId, reqVO.getRoleId()) | |
| 26 | + .betweenIfPresent(InspectionPlanRoleDO::getCreateTime, reqVO.getCreateTime()) | |
| 27 | + .orderByDesc(InspectionPlanRoleDO::getId)); | |
| 28 | + } | |
| 29 | + | |
| 30 | +} | |
| 0 | 31 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanDetailService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.inspectionplan; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | +import jakarta.validation.*; | |
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; | |
| 6 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDetailDO; | |
| 7 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 8 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 巡检计划 Service 接口 | |
| 12 | + * | |
| 13 | + * @author 超级管理员 | |
| 14 | + */ | |
| 15 | +public interface InspectionPlanDetailService { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 创建巡检计划 | |
| 19 | + * | |
| 20 | + * @param createReqVO 创建信息 | |
| 21 | + * @return 编号 | |
| 22 | + */ | |
| 23 | + Long createInspectionPlanDetail(@Valid InspectionPlanDetailSaveReqVO createReqVO); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 更新巡检计划 | |
| 27 | + * | |
| 28 | + * @param updateReqVO 更新信息 | |
| 29 | + */ | |
| 30 | + void updateInspectionPlanDetail(@Valid InspectionPlanDetailSaveReqVO updateReqVO); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 删除巡检计划 | |
| 34 | + * | |
| 35 | + * @param id 编号 | |
| 36 | + */ | |
| 37 | + void deleteInspectionPlanDetail(Long id); | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 批量删除巡检计划 | |
| 41 | + * | |
| 42 | + * @param ids 编号 | |
| 43 | + */ | |
| 44 | + void deleteInspectionPlanDetailListByIds(List<Long> ids); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 获得巡检计划 | |
| 48 | + * | |
| 49 | + * @param id 编号 | |
| 50 | + * @return 巡检计划 | |
| 51 | + */ | |
| 52 | + InspectionPlanDetailDO getInspectionPlanDetail(Long id); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 获得巡检计划分页 | |
| 56 | + * | |
| 57 | + * @param pageReqVO 分页查询 | |
| 58 | + * @return 巡检计划分页 | |
| 59 | + */ | |
| 60 | + PageResult<InspectionPlanDetailDO> getInspectionPlanDetailPage(InspectionPlanDetailPageReqVO pageReqVO); | |
| 61 | + | |
| 62 | +} | |
| 0 | 63 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanDetailServiceImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.inspectionplan; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import org.springframework.stereotype.Service; | |
| 5 | +import jakarta.annotation.Resource; | |
| 6 | +import org.springframework.validation.annotation.Validated; | |
| 7 | +import org.springframework.transaction.annotation.Transactional; | |
| 8 | + | |
| 9 | +import java.util.*; | |
| 10 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; | |
| 11 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDetailDO; | |
| 12 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 13 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 14 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 15 | + | |
| 16 | +import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanDetailMapper; | |
| 17 | + | |
| 18 | +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 19 | +import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.convertList; | |
| 20 | +import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.diffList; | |
| 21 | +import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.*; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * 巡检计划 Service 实现类 | |
| 25 | + * | |
| 26 | + * @author 超级管理员 | |
| 27 | + */ | |
| 28 | +@Service | |
| 29 | +@Validated | |
| 30 | +public class InspectionPlanDetailServiceImpl implements InspectionPlanDetailService { | |
| 31 | + | |
| 32 | + @Resource | |
| 33 | + private InspectionPlanDetailMapper inspectionPlanDetailMapper; | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public Long createInspectionPlanDetail(InspectionPlanDetailSaveReqVO createReqVO) { | |
| 37 | + // 插入 | |
| 38 | + InspectionPlanDetailDO inspectionPlanDetail = BeanUtils.toBean(createReqVO, InspectionPlanDetailDO.class); | |
| 39 | + inspectionPlanDetailMapper.insert(inspectionPlanDetail); | |
| 40 | + | |
| 41 | + // 返回 | |
| 42 | + return inspectionPlanDetail.getId(); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public void updateInspectionPlanDetail(InspectionPlanDetailSaveReqVO updateReqVO) { | |
| 47 | + // 校验存在 | |
| 48 | + validateInspectionPlanDetailExists(updateReqVO.getId()); | |
| 49 | + // 更新 | |
| 50 | + InspectionPlanDetailDO updateObj = BeanUtils.toBean(updateReqVO, InspectionPlanDetailDO.class); | |
| 51 | + inspectionPlanDetailMapper.updateById(updateObj); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @Override | |
| 55 | + public void deleteInspectionPlanDetail(Long id) { | |
| 56 | + // 校验存在 | |
| 57 | + validateInspectionPlanDetailExists(id); | |
| 58 | + // 删除 | |
| 59 | + inspectionPlanDetailMapper.deleteById(id); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @Override | |
| 63 | + public void deleteInspectionPlanDetailListByIds(List<Long> ids) { | |
| 64 | + // 删除 | |
| 65 | + inspectionPlanDetailMapper.deleteByIds(ids); | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 69 | + private void validateInspectionPlanDetailExists(Long id) { | |
| 70 | + if (inspectionPlanDetailMapper.selectById(id) == null) { | |
| 71 | + //throw exception(INSPECTION_PLAN_DETAIL_NOT_EXISTS); | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | + @Override | |
| 76 | + public InspectionPlanDetailDO getInspectionPlanDetail(Long id) { | |
| 77 | + return inspectionPlanDetailMapper.selectById(id); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @Override | |
| 81 | + public PageResult<InspectionPlanDetailDO> getInspectionPlanDetailPage(InspectionPlanDetailPageReqVO pageReqVO) { | |
| 82 | + return inspectionPlanDetailMapper.selectPage(pageReqVO); | |
| 83 | + } | |
| 84 | + | |
| 85 | +} | |
| 0 | 86 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanRoleService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.inspectionplan; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | + | |
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanRolePageReqVO; | |
| 6 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanRoleSaveReqVO; | |
| 7 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanRoleDO; | |
| 8 | +import jakarta.validation.*; | |
| 9 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 巡检计划角色 Service 接口 | |
| 13 | + * | |
| 14 | + * @author 超级管理员 | |
| 15 | + */ | |
| 16 | +public interface InspectionPlanRoleService { | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 创建巡检计划角色 | |
| 20 | + * | |
| 21 | + * @param createReqVO 创建信息 | |
| 22 | + * @return 编号 | |
| 23 | + */ | |
| 24 | + Long createInspectionPlanRole(@Valid InspectionPlanRoleSaveReqVO createReqVO); | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 更新巡检计划角色 | |
| 28 | + * | |
| 29 | + * @param updateReqVO 更新信息 | |
| 30 | + */ | |
| 31 | + void updateInspectionPlanRole(@Valid InspectionPlanRoleSaveReqVO updateReqVO); | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 删除巡检计划角色 | |
| 35 | + * | |
| 36 | + * @param id 编号 | |
| 37 | + */ | |
| 38 | + void deleteInspectionPlanRole(Long id); | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 批量删除巡检计划角色 | |
| 42 | + * | |
| 43 | + * @param ids 编号 | |
| 44 | + */ | |
| 45 | + void deleteInspectionPlanRoleListByIds(List<Long> ids); | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 获得巡检计划角色 | |
| 49 | + * | |
| 50 | + * @param id 编号 | |
| 51 | + * @return 巡检计划角色 | |
| 52 | + */ | |
| 53 | + InspectionPlanRoleDO getInspectionPlanRole(Long id); | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 获得巡检计划角色分页 | |
| 57 | + * | |
| 58 | + * @param pageReqVO 分页查询 | |
| 59 | + * @return 巡检计划角色分页 | |
| 60 | + */ | |
| 61 | + PageResult<InspectionPlanRoleDO> getInspectionPlanRolePage(InspectionPlanRolePageReqVO pageReqVO); | |
| 62 | + | |
| 63 | +} | |
| 0 | 64 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanRoleServiceImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.inspectionplan; | |
| 2 | + | |
| 3 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanRolePageReqVO; | |
| 4 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanRoleSaveReqVO; | |
| 5 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanRoleDO; | |
| 6 | +import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanRoleMapper; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | +import jakarta.annotation.Resource; | |
| 9 | +import org.springframework.validation.annotation.Validated; | |
| 10 | + | |
| 11 | +import java.util.*; | |
| 12 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 13 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 巡检计划角色 Service 实现类 | |
| 17 | + * | |
| 18 | + * @author 超级管理员 | |
| 19 | + */ | |
| 20 | +@Service | |
| 21 | +@Validated | |
| 22 | +public class InspectionPlanRoleServiceImpl implements InspectionPlanRoleService { | |
| 23 | + | |
| 24 | + @Resource | |
| 25 | + private InspectionPlanRoleMapper inspectionPlanRoleMapper; | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public Long createInspectionPlanRole(InspectionPlanRoleSaveReqVO createReqVO) { | |
| 29 | + // 插入 | |
| 30 | + InspectionPlanRoleDO inspectionPlanRole = BeanUtils.toBean(createReqVO, InspectionPlanRoleDO.class); | |
| 31 | + inspectionPlanRoleMapper.insert(inspectionPlanRole); | |
| 32 | + | |
| 33 | + // 返回 | |
| 34 | + return inspectionPlanRole.getId(); | |
| 35 | + } | |
| 36 | + | |
| 37 | + @Override | |
| 38 | + public void updateInspectionPlanRole(InspectionPlanRoleSaveReqVO updateReqVO) { | |
| 39 | + // 校验存在 | |
| 40 | + validateInspectionPlanRoleExists(updateReqVO.getId()); | |
| 41 | + // 更新 | |
| 42 | + InspectionPlanRoleDO updateObj = BeanUtils.toBean(updateReqVO, InspectionPlanRoleDO.class); | |
| 43 | + inspectionPlanRoleMapper.updateById(updateObj); | |
| 44 | + } | |
| 45 | + | |
| 46 | + @Override | |
| 47 | + public void deleteInspectionPlanRole(Long id) { | |
| 48 | + // 校验存在 | |
| 49 | + validateInspectionPlanRoleExists(id); | |
| 50 | + // 删除 | |
| 51 | + inspectionPlanRoleMapper.deleteById(id); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @Override | |
| 55 | + public void deleteInspectionPlanRoleListByIds(List<Long> ids) { | |
| 56 | + // 删除 | |
| 57 | + inspectionPlanRoleMapper.deleteByIds(ids); | |
| 58 | + } | |
| 59 | + | |
| 60 | + | |
| 61 | + private void validateInspectionPlanRoleExists(Long id) { | |
| 62 | + if (inspectionPlanRoleMapper.selectById(id) == null) { | |
| 63 | + //throw exception(""); | |
| 64 | + } | |
| 65 | + } | |
| 66 | + | |
| 67 | + @Override | |
| 68 | + public InspectionPlanRoleDO getInspectionPlanRole(Long id) { | |
| 69 | + return inspectionPlanRoleMapper.selectById(id); | |
| 70 | + } | |
| 71 | + | |
| 72 | + @Override | |
| 73 | + public PageResult<InspectionPlanRoleDO> getInspectionPlanRolePage(InspectionPlanRolePageReqVO pageReqVO) { | |
| 74 | + return inspectionPlanRoleMapper.selectPage(pageReqVO); | |
| 75 | + } | |
| 76 | + | |
| 77 | +} | |
| 0 | 78 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java
| 1 | 1 | package com.zteits.urbanops.module.garden.service.inspectionplan; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.date.DateUtil; | |
| 4 | +import cn.hutool.core.util.RandomUtil; | |
| 3 | 5 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 4 | 6 | import com.zteits.urbanops.framework.common.util.collection.CollectionUtils; |
| 5 | 7 | import com.zteits.urbanops.framework.dict.core.DictFrameworkUtils; |
| 6 | 8 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| 9 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDetailDO; | |
| 10 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanRoleDO; | |
| 11 | +import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanDetailMapper; | |
| 12 | +import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanRoleMapper; | |
| 7 | 13 | import com.zteits.urbanops.module.garden.enums.FinishStateEnum; |
| 8 | 14 | import com.zteits.urbanops.module.garden.enums.PlanConstants; |
| 9 | 15 | import com.zteits.urbanops.module.garden.util.TimeIntervalCalculatorUtil; |
| ... | ... | @@ -13,7 +19,9 @@ import jakarta.annotation.Resource; |
| 13 | 19 | import org.springframework.transaction.annotation.Transactional; |
| 14 | 20 | import org.springframework.validation.annotation.Validated; |
| 15 | 21 | |
| 22 | +import java.time.LocalDate; | |
| 16 | 23 | import java.time.LocalDateTime; |
| 24 | +import java.time.format.DateTimeFormatter; | |
| 17 | 25 | import java.util.*; |
| 18 | 26 | import java.util.concurrent.atomic.AtomicInteger; |
| 19 | 27 | |
| ... | ... | @@ -40,22 +48,26 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 40 | 48 | @Resource |
| 41 | 49 | private InspectionPlanMapper inspectionPlanMapper; |
| 42 | 50 | |
| 51 | + @Resource | |
| 52 | + private InspectionPlanDetailMapper inspectionPlanDetailMapper; | |
| 53 | + | |
| 54 | + @Resource | |
| 55 | + private InspectionPlanRoleMapper inspectionPlanRoleMapper; | |
| 56 | + | |
| 43 | 57 | @Transactional(rollbackFor = Exception.class) |
| 44 | 58 | @Override |
| 45 | 59 | public CommonResult<Long> createInspectionPlan(InspectionPlanSaveReqVO createReqVO) { |
| 46 | 60 | LocalDateTime now = LocalDateTime.now(); |
| 47 | 61 | String userName = SecurityFrameworkUtils.getLoginUserNickname() + "(" + SecurityFrameworkUtils.getLoginUserId() + ")"; |
| 48 | - | |
| 49 | 62 | Integer rateValue; |
| 50 | - if(createReqVO.getRateValue().contains("/")){ | |
| 63 | + if (createReqVO.getRateValue().contains("/")) { | |
| 51 | 64 | rateValue = Integer.parseInt(createReqVO.getRateValue().split("/")[1]); |
| 52 | - }else{ | |
| 65 | + } else { | |
| 53 | 66 | rateValue = Integer.parseInt(createReqVO.getRateValue()); |
| 54 | 67 | } |
| 55 | - | |
| 56 | 68 | //计算开始和计算时间 在间隔周期下每天的次数 |
| 57 | 69 | List<String> betweenDayList = TimeIntervalCalculatorUtil.calculateIntervals(createReqVO.getBeginTime(), createReqVO.getEndTime(), createReqVO.getCycleId(), rateValue); |
| 58 | - if(CollectionUtils.isAnyEmpty(betweenDayList)){ | |
| 70 | + if (CollectionUtils.isAnyEmpty(betweenDayList)) { | |
| 59 | 71 | log.warn("获取两个时间之间间隔天数错误"); |
| 60 | 72 | return CommonResult.error(INSPECTION_CYCLE_ERROR); |
| 61 | 73 | } |
| ... | ... | @@ -66,7 +78,7 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 66 | 78 | |
| 67 | 79 | //按照道路创建计划 |
| 68 | 80 | createReqVO.getRoadListReqVO().forEach(roadReqVO -> { |
| 69 | - String batchNo = "X" + UUID.randomUUID(); | |
| 81 | + String batchNo = "BN" + DateUtil.format(new Date(), "yyyyMMddHHmmssSSS") + RandomUtil.randomInt(1000); | |
| 70 | 82 | inspectionPlan.setBatchNo(batchNo); |
| 71 | 83 | inspectionPlan.setPlanFinishNum(0); |
| 72 | 84 | inspectionPlan.setFinishState(FinishStateEnum.NOT_FINISHED.getStatus()); |
| ... | ... | @@ -78,17 +90,56 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { |
| 78 | 90 | inspectionPlan.setDeptId(roadReqVO.getDeptId()); |
| 79 | 91 | inspectionPlan.setRoadId(roadReqVO.getRoadId()); |
| 80 | 92 | inspectionPlan.setRoadName(roadReqVO.getRoadName()); |
| 81 | - //计划属性 | |
| 93 | + //计划属性label | |
| 82 | 94 | String planAttrLable = DictFrameworkUtils.parseDictDataLabel(PlanConstants.GARDEN_PLAN_ATTR_REDIS_KEY, createReqVO.getPlanAttr()); |
| 83 | 95 | inspectionPlan.setPlanName(roadReqVO.getRoadName() + planAttrLable + createReqVO.getPlanNameSuffix()); |
| 84 | 96 | /*1.插入巡查计划*/ |
| 85 | 97 | count.addAndGet(inspectionPlanMapper.insert(inspectionPlan)); |
| 98 | + /*2.插入角色*/ | |
| 99 | + createReqVO.getRoleIds().forEach(roleId -> { | |
| 100 | + InspectionPlanRoleDO inspectionPlanRoleDO = new InspectionPlanRoleDO(); | |
| 101 | + inspectionPlanRoleDO.setBatchNo(batchNo); | |
| 102 | + inspectionPlanRoleDO.setCompanyId(createReqVO.getCompanyId()); | |
| 103 | + inspectionPlanRoleDO.setDeptId(roadReqVO.getDeptId()); | |
| 104 | + inspectionPlanRoleDO.setCreateTime(now); | |
| 105 | + inspectionPlanRoleDO.setUpdateTime(now); | |
| 106 | + inspectionPlanRoleDO.setCreator(userName); | |
| 107 | + inspectionPlanRoleDO.setUpdater(userName); | |
| 108 | + inspectionPlanRoleDO.setRoleId(roleId); | |
| 109 | + inspectionPlanRoleMapper.insert(inspectionPlanRoleDO); | |
| 110 | + }); | |
| 111 | + /*3.插入巡查计划明细*/ | |
| 112 | + for (int i = 0; i < betweenDayList.size(); i++) { | |
| 113 | + String[] dateStr = betweenDayList.get(i).split("/"); | |
| 114 | + InspectionPlanDetailDO entity = getInspectionPlanDetailDO(batchNo, createReqVO, roadReqVO, now, userName); | |
| 115 | + entity.setSortNum(i+1); | |
| 116 | + entity.setBeginTime(LocalDate.parse(dateStr[0], DateTimeFormatter.ofPattern("yyyy-MM-dd"))); | |
| 117 | + entity.setEndTime(LocalDate.parse(dateStr[1], DateTimeFormatter.ofPattern("yyyy-MM-dd"))); | |
| 118 | + | |
| 119 | + inspectionPlanDetailMapper.insert(entity); | |
| 120 | + } | |
| 86 | 121 | }); |
| 87 | 122 | |
| 88 | 123 | // 返回 |
| 89 | 124 | return CommonResult.success(count.longValue()); |
| 90 | 125 | } |
| 91 | 126 | |
| 127 | + private InspectionPlanDetailDO getInspectionPlanDetailDO(String batchNo, InspectionPlanSaveReqVO saveReqVO, | |
| 128 | + InspectionPlanRoadReqVO roadReqVO, LocalDateTime now, String userName) { | |
| 129 | + InspectionPlanDetailDO entity = new InspectionPlanDetailDO(); | |
| 130 | + entity.setBatchNo(batchNo); | |
| 131 | + entity.setPlanNo("P" + DateUtil.format(new Date(), "yyyyMMddHHmmssSSS") + RandomUtil.randomInt(1000)); | |
| 132 | + entity.setBusiLine(saveReqVO.getBusiLine()); | |
| 133 | + entity.setCompanyId(saveReqVO.getCompanyId()); | |
| 134 | + entity.setDeptId(roadReqVO.getDeptId()); | |
| 135 | + entity.setRoadId(roadReqVO.getRoadId()); | |
| 136 | + entity.setFinishState(FinishStateEnum.NOT_FINISHED.getStatus()); | |
| 137 | + entity.setCreator(userName); | |
| 138 | + entity.setUpdater(userName); | |
| 139 | + entity.setCreateTime(now); | |
| 140 | + entity.setUpdateTime(now); | |
| 141 | + return entity; | |
| 142 | + } | |
| 92 | 143 | |
| 93 | 144 | @Override |
| 94 | 145 | public void updateInspectionPlan(InspectionPlanUpdateReqVO updateReqVO) { | ... | ... |
urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanDetailMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanDetailMapper"> | |
| 4 | + | |
| 5 | + <!-- | |
| 6 | + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | + --> | |
| 11 | + | |
| 12 | +</mapper> | |
| 0 | 13 | \ No newline at end of file | ... | ... |