Commit 8969241f7ad287cf7c9910513cf918f6dad392b0
1 parent
3f806786
抢险任务提交
Showing
19 changed files
with
1256 additions
and
0 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/EmergencyTaskController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask; | ||
| 2 | + | ||
| 3 | +import org.springframework.web.bind.annotation.*; | ||
| 4 | +import jakarta.annotation.Resource; | ||
| 5 | +import org.springframework.validation.annotation.Validated; | ||
| 6 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 8 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 9 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 10 | + | ||
| 11 | +import jakarta.validation.constraints.*; | ||
| 12 | +import jakarta.validation.*; | ||
| 13 | +import jakarta.servlet.http.*; | ||
| 14 | +import java.util.*; | ||
| 15 | +import java.io.IOException; | ||
| 16 | + | ||
| 17 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | ||
| 18 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 19 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | ||
| 20 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 21 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | ||
| 22 | + | ||
| 23 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | ||
| 24 | + | ||
| 25 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | ||
| 26 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | ||
| 27 | + | ||
| 28 | +import com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo.*; | ||
| 29 | +import com.zteits.urbanops.module.garden.dal.dataobject.emergencytask.EmergencyTaskDO; | ||
| 30 | +import com.zteits.urbanops.module.garden.service.emergencytask.EmergencyTaskService; | ||
| 31 | + | ||
| 32 | +@Tag(name = "管理后台 - 抢险任务主") | ||
| 33 | +@RestController | ||
| 34 | +@RequestMapping("/garden/emergency-task") | ||
| 35 | +@Validated | ||
| 36 | +public class EmergencyTaskController { | ||
| 37 | + | ||
| 38 | + @Resource | ||
| 39 | + private EmergencyTaskService emergencyTaskService; | ||
| 40 | + | ||
| 41 | + @PostMapping("/create") | ||
| 42 | + @Operation(summary = "创建抢险任务主") | ||
| 43 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:create')") | ||
| 44 | + public CommonResult<Long> createEmergencyTask(@Valid @RequestBody EmergencyTaskSaveReqVO createReqVO) { | ||
| 45 | + return success(emergencyTaskService.createEmergencyTask(createReqVO)); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @PutMapping("/update") | ||
| 49 | + @Operation(summary = "更新抢险任务主") | ||
| 50 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:update')") | ||
| 51 | + public CommonResult<Boolean> updateEmergencyTask(@Valid @RequestBody EmergencyTaskSaveReqVO updateReqVO) { | ||
| 52 | + emergencyTaskService.updateEmergencyTask(updateReqVO); | ||
| 53 | + return success(true); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @PostMapping("/approval") | ||
| 57 | + @Operation(summary = "抢险任务审批") | ||
| 58 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:approval')") | ||
| 59 | + public CommonResult<Integer> approvalEmergencyTask(@Valid @RequestBody EmergencyTaskApprovalReqVO createReqVO) { | ||
| 60 | + return success(emergencyTaskService.approvalEmergencyTask(createReqVO)); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @DeleteMapping("/delete/task_no") | ||
| 64 | + @Operation(summary = "删除抢险任务主") | ||
| 65 | + @Parameter(name = "task_no", description = "编号", required = true) | ||
| 66 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:delete')") | ||
| 67 | + public CommonResult<Boolean> deleteEmergencyTask(@RequestParam("task_no") String taskNo) { | ||
| 68 | + emergencyTaskService.deleteEmergencyTaskByTaskNo(taskNo); | ||
| 69 | + return success(true); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @DeleteMapping("/delete-list") | ||
| 73 | + @Parameter(name = "ids", description = "编号", required = true) | ||
| 74 | + @Operation(summary = "批量删除抢险任务主") | ||
| 75 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:delete')") | ||
| 76 | + public CommonResult<Boolean> deleteEmergencyTaskList(@RequestParam("ids") List<Long> ids) { | ||
| 77 | + emergencyTaskService.deleteEmergencyTaskListByIds(ids); | ||
| 78 | + return success(true); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @GetMapping("/get/task_no") | ||
| 82 | + @Operation(summary = "获得抢险任务主") | ||
| 83 | + @Parameter(name = "task_no", description = "编号", required = true, example = "1024") | ||
| 84 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:query')") | ||
| 85 | + public CommonResult<EmergencyTaskRespVO> getEmergencyTask(@RequestParam("task_no") String taskNo) { | ||
| 86 | + EmergencyTaskRespVO emergencyTask = emergencyTaskService.getEmergencyTaskByTaskNo(taskNo); | ||
| 87 | + return success(emergencyTask); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @GetMapping("/page") | ||
| 91 | + @Operation(summary = "获得抢险任务主分页") | ||
| 92 | + //@PreAuthorize("@ss.hasPermission('garden:emergency-task:query')") | ||
| 93 | + public CommonResult<PageResult<EmergencyTaskRespVO>> getEmergencyTaskPage(@Valid EmergencyTaskPageReqVO pageReqVO) { | ||
| 94 | + PageResult<EmergencyTaskRespVO> pageResult = emergencyTaskService.getEmergencyTaskPage(pageReqVO); | ||
| 95 | + return success(pageResult); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + @GetMapping("/export-excel") | ||
| 99 | + @Operation(summary = "导出抢险任务主 Excel") | ||
| 100 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:export')") | ||
| 101 | + @ApiAccessLog(operateType = EXPORT) | ||
| 102 | + public void exportEmergencyTaskExcel(@Valid EmergencyTaskPageReqVO pageReqVO, | ||
| 103 | + HttpServletResponse response) throws IOException { | ||
| 104 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 105 | + List<EmergencyTaskRespVO> list = emergencyTaskService.getEmergencyTaskPage(pageReqVO).getList(); | ||
| 106 | + // 导出 Excel | ||
| 107 | + ExcelUtils.write(response, "抢险任务主.xls", "数据", EmergencyTaskRespVO.class, list); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | +} | ||
| 0 | \ No newline at end of file | 111 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyMachineryPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.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 EmergencyMachineryPageReqVO extends PageParam { | ||
| 15 | + | ||
| 16 | + @Schema(description = "关联任务主表ID", example = "24066") | ||
| 17 | + private Long taskId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "机械名称(如:三轮车)", example = "21485") | ||
| 20 | + private Integer machineryNameId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "机械数量", example = "28764") | ||
| 23 | + private Integer machineryCount; | ||
| 24 | + | ||
| 25 | + @Schema(description = "创建者", example = "李四") | ||
| 26 | + private String creatorName; | ||
| 27 | + | ||
| 28 | + @Schema(description = "创建时间") | ||
| 29 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 30 | + private LocalDateTime[] createTime; | ||
| 31 | + | ||
| 32 | + @Schema(description = "更新者", example = "张三") | ||
| 33 | + private String updaterName; | ||
| 34 | + | ||
| 35 | +} | ||
| 0 | \ No newline at end of file | 36 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyMachineryRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.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 EmergencyMachineryRespVO { | ||
| 14 | + | ||
| 15 | + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1541") | ||
| 16 | + @ExcelProperty("主键ID") | ||
| 17 | + private Long id; | ||
| 18 | + | ||
| 19 | + @Schema(description = "关联任务主表ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24066") | ||
| 20 | + @ExcelProperty("关联任务主表ID") | ||
| 21 | + private Long taskId; | ||
| 22 | + | ||
| 23 | + @Schema(description = "机械名称(如:三轮车)", requiredMode = Schema.RequiredMode.REQUIRED, example = "21485") | ||
| 24 | + @ExcelProperty("机械名称(如:三轮车)") | ||
| 25 | + private Integer machineryNameId; | ||
| 26 | + | ||
| 27 | + @Schema(description = "机械数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "28764") | ||
| 28 | + @ExcelProperty("机械数量") | ||
| 29 | + private Integer machineryCount; | ||
| 30 | + | ||
| 31 | + @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | ||
| 32 | + @ExcelProperty("创建者") | ||
| 33 | + private String creatorName; | ||
| 34 | + | ||
| 35 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 36 | + @ExcelProperty("创建时间") | ||
| 37 | + private LocalDateTime createTime; | ||
| 38 | + | ||
| 39 | + @Schema(description = "更新者", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | ||
| 40 | + @ExcelProperty("更新者") | ||
| 41 | + private String updaterName; | ||
| 42 | + | ||
| 43 | +} | ||
| 0 | \ No newline at end of file | 44 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyMachinerySaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.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 EmergencyMachinerySaveReqVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "机械名称(如:三轮车)", requiredMode = Schema.RequiredMode.REQUIRED, example = "21485") | ||
| 13 | + @NotNull(message = "机械名称(如:三轮车)不能为空") | ||
| 14 | + private Integer machineryNameId; | ||
| 15 | + | ||
| 16 | + @Schema(description = "机械数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "28764") | ||
| 17 | + @NotNull(message = "机械数量不能为空") | ||
| 18 | + private Integer machineryCount; | ||
| 19 | + | ||
| 20 | +} | ||
| 0 | \ No newline at end of file | 21 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyTaskApprovalReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.*; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +@Schema(description = "管理后台 - 抢险任务主新增/修改 Request VO") | ||
| 8 | +@Data | ||
| 9 | +public class EmergencyTaskApprovalReqVO { | ||
| 10 | + | ||
| 11 | + @Schema(description = "任务编号(唯一标识,如生成规则:TASK+时间戳)", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 12 | + @NotEmpty(message = "任务编号(唯一标识,如生成规则:TASK+时间戳)不能为空") | ||
| 13 | + private String taskNo; | ||
| 14 | + | ||
| 15 | + | ||
| 16 | + @Schema(description = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 17 | + @NotNull(message = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结 不能为空") | ||
| 18 | + @Min(value = 1, message = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结不能小于 1") | ||
| 19 | + @Max(value = 5, message = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结不能大于 5") | ||
| 20 | + private Integer busiStatus; | ||
| 21 | + | ||
| 22 | + @Schema(description = "审批备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "审批备注") | ||
| 23 | + @Max(value = 64, message = "审批备注长度不能超过 64 个字符") | ||
| 24 | + private String approvalRemarks; | ||
| 25 | + | ||
| 26 | +} | ||
| 0 | \ No newline at end of file | 27 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyTaskPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.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; | ||
| 13 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 14 | + | ||
| 15 | +@Schema(description = "管理后台 - 抢险任务主分页 Request VO") | ||
| 16 | +@Data | ||
| 17 | +public class EmergencyTaskPageReqVO extends PageParam { | ||
| 18 | + | ||
| 19 | + @Schema(description = "任务编号(唯一标识,如生成规则:TASK+时间戳)") | ||
| 20 | + private String taskNo; | ||
| 21 | + | ||
| 22 | + @Schema(description = "险情类型(如:树木倒伏)", example = "5209") | ||
| 23 | + private Integer emergencyTypeId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "险情危害(如:无)", example = "16325") | ||
| 26 | + private Integer emergencyHarmId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "树木权属(如:专业权属)", example = "19498") | ||
| 29 | + private Integer treeOwnershipId; | ||
| 30 | + | ||
| 31 | + @Schema(description = "险情地点") | ||
| 32 | + private String emergencyLocation; | ||
| 33 | + | ||
| 34 | + @Schema(description = "抢险开始时间") | ||
| 35 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) | ||
| 36 | + private LocalDate startTime; | ||
| 37 | + | ||
| 38 | + @Schema(description = "抢险结束时间") | ||
| 39 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) | ||
| 40 | + private LocalDate endTime; | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + @Schema(description = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结", example = "1") | ||
| 44 | + private Integer busiStatus; | ||
| 45 | + | ||
| 46 | + @Schema(description = "归属(一级部门id)", example = "6353") | ||
| 47 | + private Long companyId; | ||
| 48 | + | ||
| 49 | +} | ||
| 0 | \ No newline at end of file | 50 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyTaskRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 4 | +import com.zteits.urbanops.framework.mybatis.core.type.StringArrayToListTypeHandler; | ||
| 5 | +import com.zteits.urbanops.framework.mybatis.core.type.StringListTypeHandler; | ||
| 6 | +import com.zteits.urbanops.module.garden.dal.dataobject.emergencytask.EmergencyMachineryDO; | ||
| 7 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 8 | +import lombok.*; | ||
| 9 | +import java.util.*; | ||
| 10 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | +import cn.idev.excel.annotation.*; | ||
| 13 | + | ||
| 14 | +@Schema(description = "管理后台 - 抢险任务主 Response VO") | ||
| 15 | +@Data | ||
| 16 | +@ExcelIgnoreUnannotated | ||
| 17 | +public class EmergencyTaskRespVO { | ||
| 18 | + | ||
| 19 | + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10092") | ||
| 20 | + @ExcelProperty("主键ID") | ||
| 21 | + private Long id; | ||
| 22 | + | ||
| 23 | + @Schema(description = "任务编号(唯一标识,如生成规则:TASK+时间戳)", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 24 | + @ExcelProperty("任务编号(唯一标识,如生成规则:TASK+时间戳)") | ||
| 25 | + private String taskNo; | ||
| 26 | + | ||
| 27 | + @Schema(description = "发现险情时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 28 | + @ExcelProperty("发现险情时间") | ||
| 29 | + private LocalDateTime discoveryTime; | ||
| 30 | + | ||
| 31 | + @Schema(description = "险情类型(如:树木倒伏)", requiredMode = Schema.RequiredMode.REQUIRED, example = "5209") | ||
| 32 | + @ExcelProperty("险情类型:1:树木倒伏 2:树木折枝") | ||
| 33 | + private Integer emergencyTypeId; | ||
| 34 | + | ||
| 35 | + @Schema(description = "险情危害(如:无)", requiredMode = Schema.RequiredMode.REQUIRED, example = "16325") | ||
| 36 | + @ExcelProperty("险情危害(如:无)") | ||
| 37 | + private Integer emergencyHarmId; | ||
| 38 | + | ||
| 39 | + @Schema(description = "树木权属(如:专业权属)", requiredMode = Schema.RequiredMode.REQUIRED, example = "19498") | ||
| 40 | + @ExcelProperty("树木权属 1:砸车 2:砸房 3:砸人 4:无") | ||
| 41 | + private Integer treeOwnershipId; | ||
| 42 | + | ||
| 43 | + @Schema(description = "险情地点", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 44 | + @ExcelProperty("险情地点") | ||
| 45 | + private String emergencyLocation; | ||
| 46 | + | ||
| 47 | + @Schema(description = "上报人", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 48 | + @ExcelProperty("上报人") | ||
| 49 | + private String reporter; | ||
| 50 | + | ||
| 51 | + @Schema(description = "联系电话", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 52 | + @ExcelProperty("联系电话") | ||
| 53 | + private String contactPhone; | ||
| 54 | + | ||
| 55 | + @Schema(description = "抢险开始时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 56 | + @ExcelProperty("抢险开始时间") | ||
| 57 | + private LocalDateTime rescueStartTime; | ||
| 58 | + | ||
| 59 | + @Schema(description = "抢险中照片", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 60 | + @ExcelProperty("抢险中照片") | ||
| 61 | + @TableField(typeHandler = StringArrayToListTypeHandler.class) | ||
| 62 | + private List<String> emergencyImg; | ||
| 63 | + | ||
| 64 | + @Schema(description = "树种(如:国槐)") | ||
| 65 | + @ExcelProperty("树种(如:国槐)") | ||
| 66 | + private String treeSpecies; | ||
| 67 | + | ||
| 68 | + @Schema(description = "树木规格(如:胸径20厘米)") | ||
| 69 | + @ExcelProperty("树木规格(如:胸径20厘米)") | ||
| 70 | + private String treeSpec; | ||
| 71 | + | ||
| 72 | + @Schema(description = "抢险完成时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 73 | + @ExcelProperty("抢险完成时间") | ||
| 74 | + private LocalDateTime rescueCompleteTime; | ||
| 75 | + | ||
| 76 | + @Schema(description = "出动人员数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "3371") | ||
| 77 | + @ExcelProperty("出动人员数量") | ||
| 78 | + private Integer personnelCount; | ||
| 79 | + | ||
| 80 | + @Schema(description = "抢险结束照片", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 81 | + @ExcelProperty("抢险结束照片") | ||
| 82 | + @TableField(typeHandler = StringArrayToListTypeHandler.class) | ||
| 83 | + private List<String> emergencyEndImg; | ||
| 84 | + | ||
| 85 | + @Schema(description = "备注") | ||
| 86 | + @ExcelProperty("备注") | ||
| 87 | + private String remarks; | ||
| 88 | + | ||
| 89 | + @Schema(description = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 90 | + @ExcelProperty("案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结") | ||
| 91 | + private Integer busiStatus; | ||
| 92 | + | ||
| 93 | + @Schema(description = "工作流审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 94 | + @ExcelProperty("工作流审批状态") | ||
| 95 | + private Integer status; | ||
| 96 | + | ||
| 97 | + @Schema(description = "流程实例的编号", example = "30197") | ||
| 98 | + @ExcelProperty("流程实例的编号") | ||
| 99 | + private String processInstanceId; | ||
| 100 | + | ||
| 101 | + @Schema(description = "审批人ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20789") | ||
| 102 | + @ExcelProperty("审批人ID") | ||
| 103 | + private String approvalUserId; | ||
| 104 | + | ||
| 105 | + @Schema(description = "审批人", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | ||
| 106 | + @ExcelProperty("审批人") | ||
| 107 | + private String approvalUserName; | ||
| 108 | + | ||
| 109 | + @Schema(description = "审批备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "审批备注") | ||
| 110 | + @ExcelProperty("审批备注") | ||
| 111 | + private String approvalRemarks; | ||
| 112 | + | ||
| 113 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "6353") | ||
| 114 | + @ExcelProperty("归属(一级部门id)") | ||
| 115 | + private Long companyId; | ||
| 116 | + | ||
| 117 | + @Schema(description = "部门ID(道路负责部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "27559") | ||
| 118 | + @ExcelProperty("部门ID(道路负责部门id)") | ||
| 119 | + private Long deptId; | ||
| 120 | + | ||
| 121 | + @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | ||
| 122 | + @ExcelProperty("创建者") | ||
| 123 | + private String creatorName; | ||
| 124 | + | ||
| 125 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 126 | + @ExcelProperty("创建时间") | ||
| 127 | + private LocalDateTime createTime; | ||
| 128 | + | ||
| 129 | + @Schema(description = "更新者", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | ||
| 130 | + @ExcelProperty("更新者") | ||
| 131 | + private String updaterName; | ||
| 132 | + | ||
| 133 | + private List<EmergencyMachineryDO> emergencyMachineryList; | ||
| 134 | + | ||
| 135 | +} | ||
| 0 | \ No newline at end of file | 136 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyTaskSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | +import jakarta.validation.constraints.*; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - 抢险任务主新增/修改 Request VO") | ||
| 11 | +@Data | ||
| 12 | +public class EmergencyTaskSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "发现险情时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 15 | + @NotNull(message = "发现险情时间不能为空") | ||
| 16 | + private LocalDateTime discoveryTime; | ||
| 17 | + | ||
| 18 | + @Schema(description = "险情类型(如:树木倒伏)", requiredMode = Schema.RequiredMode.REQUIRED, example = "5209") | ||
| 19 | + @NotNull(message = "险情类型(如:树木倒伏)不能为空") | ||
| 20 | + private Integer emergencyTypeId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "险情危害(如:无)", requiredMode = Schema.RequiredMode.REQUIRED, example = "16325") | ||
| 23 | + @NotNull(message = "险情危害(如:无)不能为空") | ||
| 24 | + private Integer emergencyHarmId; | ||
| 25 | + | ||
| 26 | + @Schema(description = "树木权属(如:专业权属)", requiredMode = Schema.RequiredMode.REQUIRED, example = "19498") | ||
| 27 | + @NotNull(message = "树木权属(如:专业权属)不能为空") | ||
| 28 | + private Integer treeOwnershipId; | ||
| 29 | + | ||
| 30 | + @Schema(description = "险情地点", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 31 | + @NotEmpty(message = "险情地点不能为空") | ||
| 32 | + private String emergencyLocation; | ||
| 33 | + | ||
| 34 | + @Schema(description = "上报人", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 35 | + @NotEmpty(message = "上报人不能为空") | ||
| 36 | + private String reporter; | ||
| 37 | + | ||
| 38 | + @Schema(description = "联系电话", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 39 | + @NotEmpty(message = "联系电话不能为空") | ||
| 40 | + @Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话格式不正确,应为 11 位手机号") | ||
| 41 | + private String contactPhone; | ||
| 42 | + | ||
| 43 | + @Schema(description = "抢险开始时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 44 | + @NotNull(message = "抢险开始时间不能为空") | ||
| 45 | + private LocalDateTime rescueStartTime; | ||
| 46 | + | ||
| 47 | + @Schema(description = "抢险中照片", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 48 | + @NotNull(message = "抢险中照片不能为空") | ||
| 49 | + @Size(min = 1, message = "抢险中照片最少1张") | ||
| 50 | + private List<String> emergencyImg; | ||
| 51 | + | ||
| 52 | + @Schema(description = "树种(如:国槐)") | ||
| 53 | + private String treeSpecies; | ||
| 54 | + | ||
| 55 | + @Schema(description = "树木规格(如:胸径20厘米)") | ||
| 56 | + private String treeSpec; | ||
| 57 | + | ||
| 58 | + @Schema(description = "抢险完成时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 59 | + @NotNull(message = "抢险完成时间不能为空") | ||
| 60 | + private LocalDateTime rescueCompleteTime; | ||
| 61 | + | ||
| 62 | + @Schema(description = "出动人员数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "3371") | ||
| 63 | + @NotNull(message = "出动人员数量不能为空") | ||
| 64 | + private Integer personnelCount; | ||
| 65 | + | ||
| 66 | + @Schema(description = "抢险结束照片", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 67 | + private List<String> emergencyEndImg; | ||
| 68 | + | ||
| 69 | + @Schema(description = "备注") | ||
| 70 | + private String remarks; | ||
| 71 | + | ||
| 72 | + @Schema(description = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 73 | + @NotNull(message = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结不能为空") | ||
| 74 | + private Integer busiStatus; | ||
| 75 | + | ||
| 76 | + @Schema(description = "工作流审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 77 | + @NotNull(message = "工作流审批状态不能为空") | ||
| 78 | + private Integer status; | ||
| 79 | + | ||
| 80 | + @Schema(description = "流程实例的编号", example = "30197") | ||
| 81 | + private String processInstanceId; | ||
| 82 | + | ||
| 83 | + @Schema(description = "审批人ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20789") | ||
| 84 | + @NotEmpty(message = "审批人ID不能为空") | ||
| 85 | + private String approvalUserId; | ||
| 86 | + | ||
| 87 | + @Schema(description = "审批人", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | ||
| 88 | + @NotEmpty(message = "审批人不能为空") | ||
| 89 | + private String approvalUserName; | ||
| 90 | + | ||
| 91 | + @Schema(description = "使用机械", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | ||
| 92 | + private List<EmergencyMachinerySaveReqVO> emergencyMachineryList; | ||
| 93 | + | ||
| 94 | +} | ||
| 0 | \ No newline at end of file | 95 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/emergencytask/EmergencyMachineryDO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.dataobject.emergencytask; | ||
| 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_emergency_machinery") | ||
| 16 | +@KeySequence("garden_emergency_machinery_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 EmergencyMachineryDO extends BaseDO { | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 主键ID | ||
| 27 | + */ | ||
| 28 | + @TableId | ||
| 29 | + private Long id; | ||
| 30 | + /** | ||
| 31 | + * 任务编号(唯一标识,如生成规则:TASK+时间戳) | ||
| 32 | + */ | ||
| 33 | + private String taskNo; | ||
| 34 | + /** | ||
| 35 | + * 机械名称(如:三轮车) | ||
| 36 | + */ | ||
| 37 | + private Integer machineryNameId; | ||
| 38 | + /** | ||
| 39 | + * 机械数量 | ||
| 40 | + */ | ||
| 41 | + private Integer machineryCount; | ||
| 42 | + /** | ||
| 43 | + * 创建者 | ||
| 44 | + */ | ||
| 45 | + private String creatorName; | ||
| 46 | + /** | ||
| 47 | + * 更新者 | ||
| 48 | + */ | ||
| 49 | + private String updaterName; | ||
| 50 | + | ||
| 51 | + | ||
| 52 | +} | ||
| 0 | \ No newline at end of file | 53 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/emergencytask/EmergencyTaskDO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.dataobject.emergencytask; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.framework.mybatis.core.type.StringArrayToListTypeHandler; | ||
| 4 | +import com.zteits.urbanops.framework.mybatis.core.type.StringListTypeHandler; | ||
| 5 | +import lombok.*; | ||
| 6 | +import java.util.*; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 13 | +import com.zteits.urbanops.framework.mybatis.core.dataobject.BaseDO; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * 抢险任务主 DO | ||
| 17 | + * | ||
| 18 | + * @author 超级管理员 | ||
| 19 | + */ | ||
| 20 | +@TableName(value="garden_emergency_task", autoResultMap = true) | ||
| 21 | +@KeySequence("garden_emergency_task_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 22 | +@Data | ||
| 23 | +@EqualsAndHashCode(callSuper = true) | ||
| 24 | +@ToString(callSuper = true) | ||
| 25 | +@Builder | ||
| 26 | +@NoArgsConstructor | ||
| 27 | +@AllArgsConstructor | ||
| 28 | +public class EmergencyTaskDO extends BaseDO { | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 主键ID | ||
| 32 | + */ | ||
| 33 | + @TableId | ||
| 34 | + private Long id; | ||
| 35 | + /** | ||
| 36 | + * 任务编号(唯一标识,如生成规则:TASK+时间戳) | ||
| 37 | + */ | ||
| 38 | + private String taskNo; | ||
| 39 | + /** | ||
| 40 | + * 发现险情时间 | ||
| 41 | + */ | ||
| 42 | + private LocalDateTime discoveryTime; | ||
| 43 | + /** | ||
| 44 | + * 险情类型(如:树木倒伏) | ||
| 45 | + */ | ||
| 46 | + private Integer emergencyTypeId; | ||
| 47 | + /** | ||
| 48 | + * 险情危害(如:无) | ||
| 49 | + */ | ||
| 50 | + private Integer emergencyHarmId; | ||
| 51 | + /** | ||
| 52 | + * 树木权属(如:专业权属) | ||
| 53 | + */ | ||
| 54 | + private Integer treeOwnershipId; | ||
| 55 | + /** | ||
| 56 | + * 险情地点 | ||
| 57 | + */ | ||
| 58 | + private String emergencyLocation; | ||
| 59 | + /** | ||
| 60 | + * 上报人 | ||
| 61 | + */ | ||
| 62 | + private String reporter; | ||
| 63 | + /** | ||
| 64 | + * 联系电话 | ||
| 65 | + */ | ||
| 66 | + private String contactPhone; | ||
| 67 | + /** | ||
| 68 | + * 抢险开始时间 | ||
| 69 | + */ | ||
| 70 | + private LocalDateTime rescueStartTime; | ||
| 71 | + /** | ||
| 72 | + * 抢险中照片 | ||
| 73 | + */ | ||
| 74 | + @TableField(typeHandler = StringArrayToListTypeHandler.class) | ||
| 75 | + private List<String> emergencyImg; | ||
| 76 | + /** | ||
| 77 | + * 树种(如:国槐) | ||
| 78 | + */ | ||
| 79 | + private String treeSpecies; | ||
| 80 | + /** | ||
| 81 | + * 树木规格(如:胸径20厘米) | ||
| 82 | + */ | ||
| 83 | + private String treeSpec; | ||
| 84 | + /** | ||
| 85 | + * 抢险完成时间 | ||
| 86 | + */ | ||
| 87 | + private LocalDateTime rescueCompleteTime; | ||
| 88 | + /** | ||
| 89 | + * 出动人员数量 | ||
| 90 | + */ | ||
| 91 | + private Integer personnelCount; | ||
| 92 | + /** | ||
| 93 | + * 抢险结束照片 | ||
| 94 | + */ | ||
| 95 | + @TableField(typeHandler = StringArrayToListTypeHandler.class) | ||
| 96 | + private List<String> emergencyEndImg; | ||
| 97 | + /** | ||
| 98 | + * 备注 | ||
| 99 | + */ | ||
| 100 | + private String remarks; | ||
| 101 | + /** | ||
| 102 | + * 案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结 | ||
| 103 | + */ | ||
| 104 | + private Integer busiStatus; | ||
| 105 | + /** | ||
| 106 | + * 工作流审批状态 | ||
| 107 | + */ | ||
| 108 | + private Integer status; | ||
| 109 | + /** | ||
| 110 | + * 流程实例的编号 | ||
| 111 | + */ | ||
| 112 | + private String processInstanceId; | ||
| 113 | + /** | ||
| 114 | + * 审批人ID | ||
| 115 | + */ | ||
| 116 | + private String approvalUserId; | ||
| 117 | + /** | ||
| 118 | + * 审批人 | ||
| 119 | + */ | ||
| 120 | + private String approvalUserName; | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * 审批备注 | ||
| 124 | + */ | ||
| 125 | + private String approvalRemarks; | ||
| 126 | + /** | ||
| 127 | + * 归属(一级部门id) | ||
| 128 | + */ | ||
| 129 | + private Long companyId; | ||
| 130 | + /** | ||
| 131 | + * 部门ID(道路负责部门id) | ||
| 132 | + */ | ||
| 133 | + private Long deptId; | ||
| 134 | + /** | ||
| 135 | + * 创建者 | ||
| 136 | + */ | ||
| 137 | + private String creatorName; | ||
| 138 | + /** | ||
| 139 | + * 更新者 | ||
| 140 | + */ | ||
| 141 | + private String updaterName; | ||
| 142 | + | ||
| 143 | + | ||
| 144 | +} | ||
| 0 | \ No newline at end of file | 145 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/emergencytask/EmergencyMachineryMapper.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.mysql.emergencytask; | ||
| 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.emergencytask.EmergencyMachineryDO; | ||
| 9 | +import org.apache.ibatis.annotations.Mapper; | ||
| 10 | +import com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo.*; | ||
| 11 | +import org.apache.ibatis.annotations.Param; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 抢险机械子 Mapper | ||
| 15 | + * | ||
| 16 | + * @author 超级管理员 | ||
| 17 | + */ | ||
| 18 | +@Mapper | ||
| 19 | +public interface EmergencyMachineryMapper extends BaseMapperX<EmergencyMachineryDO> { | ||
| 20 | + | ||
| 21 | + default PageResult<EmergencyMachineryDO> selectPage(EmergencyMachineryPageReqVO reqVO) { | ||
| 22 | + return selectPage(reqVO, new LambdaQueryWrapperX<EmergencyMachineryDO>() | ||
| 23 | + .eqIfPresent(EmergencyMachineryDO::getMachineryNameId, reqVO.getMachineryNameId()) | ||
| 24 | + .eqIfPresent(EmergencyMachineryDO::getMachineryCount, reqVO.getMachineryCount()) | ||
| 25 | + .likeIfPresent(EmergencyMachineryDO::getCreatorName, reqVO.getCreatorName()) | ||
| 26 | + .betweenIfPresent(EmergencyMachineryDO::getCreateTime, reqVO.getCreateTime()) | ||
| 27 | + .likeIfPresent(EmergencyMachineryDO::getUpdaterName, reqVO.getUpdaterName()) | ||
| 28 | + .orderByDesc(EmergencyMachineryDO::getId)); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + int deleteByTaskNo(@Param("taskNo") String taskNo); | ||
| 32 | + | ||
| 33 | +} | ||
| 0 | \ No newline at end of file | 34 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/emergencytask/EmergencyTaskMapper.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.mysql.emergencytask; | ||
| 2 | + | ||
| 3 | +import java.time.LocalDate; | ||
| 4 | +import java.time.LocalDateTime; | ||
| 5 | +import java.time.LocalTime; | ||
| 6 | +import java.util.*; | ||
| 7 | + | ||
| 8 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 9 | +import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 10 | +import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; | ||
| 11 | +import com.zteits.urbanops.module.garden.dal.dataobject.emergencytask.EmergencyTaskDO; | ||
| 12 | +import org.apache.ibatis.annotations.Mapper; | ||
| 13 | +import com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo.*; | ||
| 14 | +import org.apache.ibatis.annotations.Param; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * 抢险任务主 Mapper | ||
| 18 | + * | ||
| 19 | + * @author 超级管理员 | ||
| 20 | + */ | ||
| 21 | +@Mapper | ||
| 22 | +public interface EmergencyTaskMapper extends BaseMapperX<EmergencyTaskDO> { | ||
| 23 | + | ||
| 24 | + default PageResult<EmergencyTaskDO> selectPage(EmergencyTaskPageReqVO reqVO) { | ||
| 25 | + LocalDateTime startDateTime = null; | ||
| 26 | + LocalDateTime endDateTime = null; | ||
| 27 | + if (reqVO.getStartTime() != null) { | ||
| 28 | + startDateTime = reqVO.getStartTime().atStartOfDay(); | ||
| 29 | + } | ||
| 30 | + // 处理结束时间 (转为当天 23:59:59...) | ||
| 31 | + if (reqVO.getEndTime() != null) { | ||
| 32 | + endDateTime = reqVO.getEndTime().atTime(LocalTime.MAX); | ||
| 33 | + } | ||
| 34 | + return selectPage(reqVO, new LambdaQueryWrapperX<EmergencyTaskDO>() | ||
| 35 | + .eqIfPresent(EmergencyTaskDO::getTaskNo, reqVO.getTaskNo()) | ||
| 36 | + .eqIfPresent(EmergencyTaskDO::getEmergencyTypeId, reqVO.getEmergencyTypeId()) | ||
| 37 | + .eqIfPresent(EmergencyTaskDO::getEmergencyHarmId, reqVO.getEmergencyHarmId()) | ||
| 38 | + .eqIfPresent(EmergencyTaskDO::getTreeOwnershipId, reqVO.getTreeOwnershipId()) | ||
| 39 | + .likeIfPresent(EmergencyTaskDO::getEmergencyLocation, reqVO.getEmergencyLocation()) | ||
| 40 | + .eqIfPresent(EmergencyTaskDO::getBusiStatus, reqVO.getBusiStatus()) | ||
| 41 | + .eqIfPresent(EmergencyTaskDO::getCompanyId, reqVO.getCompanyId()) | ||
| 42 | + .betweenIfPresent(EmergencyTaskDO::getDiscoveryTime, startDateTime, endDateTime) | ||
| 43 | + .orderByDesc(EmergencyTaskDO::getId)); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + int deleteByTaskNo(@Param("taskNo") String taskNo); | ||
| 47 | + | ||
| 48 | +} | ||
| 0 | \ No newline at end of file | 49 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/ErrorCodeConstants.java
| @@ -138,5 +138,7 @@ public interface ErrorCodeConstants { | @@ -138,5 +138,7 @@ public interface ErrorCodeConstants { | ||
| 138 | ErrorCode ROAD_MANAGER_NOT_EXISTS = new ErrorCode(1-100-006-001, "道路管理不存在"); | 138 | ErrorCode ROAD_MANAGER_NOT_EXISTS = new ErrorCode(1-100-006-001, "道路管理不存在"); |
| 139 | 139 | ||
| 140 | 140 | ||
| 141 | + // ========== 抢险任务主 TODO 补充编号 ========== | ||
| 142 | + ErrorCode EMERGENCY_TASK_NOT_EXISTS = new ErrorCode(1-100-006-002, "抢险任务主不存在"); | ||
| 141 | 143 | ||
| 142 | } | 144 | } |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/emergencytask/EmergencyMachineryService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.emergencytask; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | +import jakarta.validation.*; | ||
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo.*; | ||
| 6 | +import com.zteits.urbanops.module.garden.dal.dataobject.emergencytask.EmergencyMachineryDO; | ||
| 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 EmergencyMachineryService { | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 创建抢险机械子 | ||
| 19 | + * | ||
| 20 | + * @param createReqVO 创建信息 | ||
| 21 | + * @return 编号 | ||
| 22 | + */ | ||
| 23 | + Long createEmergencyMachinery(@Valid EmergencyMachinerySaveReqVO createReqVO); | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 更新抢险机械子 | ||
| 27 | + * | ||
| 28 | + * @param updateReqVO 更新信息 | ||
| 29 | + */ | ||
| 30 | + void updateEmergencyMachinery(@Valid EmergencyMachinerySaveReqVO updateReqVO); | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 删除抢险机械子 | ||
| 34 | + * | ||
| 35 | + * @param id 编号 | ||
| 36 | + */ | ||
| 37 | + void deleteEmergencyMachinery(Long id); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 批量删除抢险机械子 | ||
| 41 | + * | ||
| 42 | + * @param ids 编号 | ||
| 43 | + */ | ||
| 44 | + void deleteEmergencyMachineryListByIds(List<Long> ids); | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 获得抢险机械子 | ||
| 48 | + * | ||
| 49 | + * @param id 编号 | ||
| 50 | + * @return 抢险机械子 | ||
| 51 | + */ | ||
| 52 | + EmergencyMachineryDO getEmergencyMachinery(Long id); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 获得抢险机械子分页 | ||
| 56 | + * | ||
| 57 | + * @param pageReqVO 分页查询 | ||
| 58 | + * @return 抢险机械子分页 | ||
| 59 | + */ | ||
| 60 | + PageResult<EmergencyMachineryDO> getEmergencyMachineryPage(EmergencyMachineryPageReqVO pageReqVO); | ||
| 61 | + | ||
| 62 | +} | ||
| 0 | \ No newline at end of file | 63 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/emergencytask/EmergencyMachineryServiceImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.emergencytask; | ||
| 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.emergencytask.vo.*; | ||
| 11 | +import com.zteits.urbanops.module.garden.dal.dataobject.emergencytask.EmergencyMachineryDO; | ||
| 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.emergencytask.EmergencyMachineryMapper; | ||
| 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 EmergencyMachineryServiceImpl implements EmergencyMachineryService { | ||
| 31 | + | ||
| 32 | + @Resource | ||
| 33 | + private EmergencyMachineryMapper emergencyMachineryMapper; | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public Long createEmergencyMachinery(EmergencyMachinerySaveReqVO createReqVO) { | ||
| 37 | + // 插入 | ||
| 38 | + EmergencyMachineryDO emergencyMachinery = BeanUtils.toBean(createReqVO, EmergencyMachineryDO.class); | ||
| 39 | + emergencyMachineryMapper.insert(emergencyMachinery); | ||
| 40 | + | ||
| 41 | + // 返回 | ||
| 42 | + return emergencyMachinery.getId(); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @Override | ||
| 46 | + public void updateEmergencyMachinery(EmergencyMachinerySaveReqVO updateReqVO) { | ||
| 47 | + // 校验存在 | ||
| 48 | + // validateEmergencyMachineryExists(updateReqVO.getId()); | ||
| 49 | + // 更新 | ||
| 50 | + EmergencyMachineryDO updateObj = BeanUtils.toBean(updateReqVO, EmergencyMachineryDO.class); | ||
| 51 | + emergencyMachineryMapper.updateById(updateObj); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @Override | ||
| 55 | + public void deleteEmergencyMachinery(Long id) { | ||
| 56 | + // 校验存在 | ||
| 57 | + validateEmergencyMachineryExists(id); | ||
| 58 | + // 删除 | ||
| 59 | + emergencyMachineryMapper.deleteById(id); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Override | ||
| 63 | + public void deleteEmergencyMachineryListByIds(List<Long> ids) { | ||
| 64 | + // 删除 | ||
| 65 | + emergencyMachineryMapper.deleteByIds(ids); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + | ||
| 69 | + private void validateEmergencyMachineryExists(Long id) { | ||
| 70 | + if (emergencyMachineryMapper.selectById(id) == null) { | ||
| 71 | + //throw exception(EMERGENCY_MACHINERY_NOT_EXISTS); | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + @Override | ||
| 76 | + public EmergencyMachineryDO getEmergencyMachinery(Long id) { | ||
| 77 | + return emergencyMachineryMapper.selectById(id); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @Override | ||
| 81 | + public PageResult<EmergencyMachineryDO> getEmergencyMachineryPage(EmergencyMachineryPageReqVO pageReqVO) { | ||
| 82 | + return emergencyMachineryMapper.selectPage(pageReqVO); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | +} | ||
| 0 | \ No newline at end of file | 86 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/emergencytask/EmergencyTaskService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.emergencytask; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | +import jakarta.validation.*; | ||
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo.*; | ||
| 6 | +import com.zteits.urbanops.module.garden.dal.dataobject.emergencytask.EmergencyTaskDO; | ||
| 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 EmergencyTaskService { | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 创建抢险任务主 | ||
| 19 | + * | ||
| 20 | + * @param createReqVO 创建信息 | ||
| 21 | + * @return 编号 | ||
| 22 | + */ | ||
| 23 | + Long createEmergencyTask(@Valid EmergencyTaskSaveReqVO createReqVO); | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 集团审批 | ||
| 27 | + * @param createReqVO | ||
| 28 | + * @return | ||
| 29 | + */ | ||
| 30 | + int approvalEmergencyTask(EmergencyTaskApprovalReqVO createReqVO); | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 更新抢险任务主 | ||
| 34 | + * | ||
| 35 | + * @param updateReqVO 更新信息 | ||
| 36 | + */ | ||
| 37 | + void updateEmergencyTask(@Valid EmergencyTaskSaveReqVO updateReqVO); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 删除抢险任务主 | ||
| 41 | + * | ||
| 42 | + * @param id 编号 | ||
| 43 | + */ | ||
| 44 | + void deleteEmergencyTask(Long id); | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 删除抢险任务主 | ||
| 48 | + * | ||
| 49 | + * @param taskNO 编号 | ||
| 50 | + */ | ||
| 51 | + void deleteEmergencyTaskByTaskNo(String taskNO); | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 批量删除抢险任务主 | ||
| 55 | + * | ||
| 56 | + * @param ids 编号 | ||
| 57 | + */ | ||
| 58 | + void deleteEmergencyTaskListByIds(List<Long> ids); | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 获得抢险任务主 | ||
| 62 | + * | ||
| 63 | + * @param id 编号 | ||
| 64 | + * @return 抢险任务主 | ||
| 65 | + */ | ||
| 66 | + EmergencyTaskDO getEmergencyTask(Long id); | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * 获得抢险任务主 | ||
| 70 | + * | ||
| 71 | + * @param taskNo 编号 | ||
| 72 | + * @return 抢险任务主 | ||
| 73 | + */ | ||
| 74 | + EmergencyTaskRespVO getEmergencyTaskByTaskNo(String taskNo); | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * 获得抢险任务主分页 | ||
| 78 | + * | ||
| 79 | + * @param pageReqVO 分页查询 | ||
| 80 | + * @return 抢险任务主分页 | ||
| 81 | + */ | ||
| 82 | + PageResult<EmergencyTaskRespVO> getEmergencyTaskPage(EmergencyTaskPageReqVO pageReqVO); | ||
| 83 | + | ||
| 84 | +} | ||
| 0 | \ No newline at end of file | 85 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/emergencytask/EmergencyTaskServiceImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.emergencytask; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.hutool.core.collection.CollectionUtil; | ||
| 5 | +import cn.hutool.core.util.RandomUtil; | ||
| 6 | +import com.alibaba.fastjson.JSON; | ||
| 7 | +import com.alibaba.fastjson.JSONObject; | ||
| 8 | +import com.baomidou.mybatisplus.core.conditions.Wrapper; | ||
| 9 | +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | ||
| 10 | +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; | ||
| 11 | +import com.zteits.urbanops.module.garden.dal.dataobject.emergencytask.EmergencyMachineryDO; | ||
| 12 | +import com.zteits.urbanops.module.garden.dal.mysql.emergencytask.EmergencyMachineryMapper; | ||
| 13 | +import jodd.util.StringUtil; | ||
| 14 | +import org.springframework.stereotype.Service; | ||
| 15 | +import jakarta.annotation.Resource; | ||
| 16 | +import org.springframework.util.StringUtils; | ||
| 17 | +import org.springframework.validation.annotation.Validated; | ||
| 18 | +import org.springframework.transaction.annotation.Transactional; | ||
| 19 | + | ||
| 20 | +import java.util.*; | ||
| 21 | +import com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo.*; | ||
| 22 | +import com.zteits.urbanops.module.garden.dal.dataobject.emergencytask.EmergencyTaskDO; | ||
| 23 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 24 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | ||
| 25 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 26 | + | ||
| 27 | +import com.zteits.urbanops.module.garden.dal.mysql.emergencytask.EmergencyTaskMapper; | ||
| 28 | + | ||
| 29 | +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 30 | +import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.convertList; | ||
| 31 | +import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.diffList; | ||
| 32 | +import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.*; | ||
| 33 | + | ||
| 34 | +/** | ||
| 35 | + * 抢险任务主 Service 实现类 | ||
| 36 | + * | ||
| 37 | + * @author 超级管理员 | ||
| 38 | + */ | ||
| 39 | +@Service | ||
| 40 | +@Validated | ||
| 41 | +public class EmergencyTaskServiceImpl implements EmergencyTaskService { | ||
| 42 | + | ||
| 43 | + @Resource | ||
| 44 | + private EmergencyTaskMapper emergencyTaskMapper; | ||
| 45 | + | ||
| 46 | + @Resource | ||
| 47 | + private EmergencyMachineryMapper emergencyMachineryMapper; | ||
| 48 | + | ||
| 49 | + @Transactional(rollbackFor = Exception.class) | ||
| 50 | + @Override | ||
| 51 | + public Long createEmergencyTask(EmergencyTaskSaveReqVO createReqVO) { | ||
| 52 | + String userId = SecurityFrameworkUtils.getLoginUserId() + ""; | ||
| 53 | + String userName = SecurityFrameworkUtils.getLoginUserNickname(); | ||
| 54 | + String taskNo = "T" + System.currentTimeMillis() + RandomUtil.randomInt(1000, 9999); | ||
| 55 | + Long companyId = SecurityFrameworkUtils.getCompanyId(); | ||
| 56 | + Long deptId = SecurityFrameworkUtils.getDeptId(); | ||
| 57 | + // 插入 | ||
| 58 | + EmergencyTaskDO emergencyTask = new EmergencyTaskDO(); | ||
| 59 | + emergencyTask.setTaskNo(taskNo); | ||
| 60 | + emergencyTask.setDiscoveryTime(createReqVO.getDiscoveryTime()); | ||
| 61 | + emergencyTask.setEmergencyTypeId(createReqVO.getEmergencyTypeId()); | ||
| 62 | + emergencyTask.setEmergencyHarmId(createReqVO.getEmergencyHarmId()); | ||
| 63 | + emergencyTask.setTreeOwnershipId(createReqVO.getTreeOwnershipId()); | ||
| 64 | + emergencyTask.setEmergencyLocation(createReqVO.getEmergencyLocation()); | ||
| 65 | + emergencyTask.setReporter(createReqVO.getReporter()); | ||
| 66 | + emergencyTask.setContactPhone(createReqVO.getContactPhone()); | ||
| 67 | + emergencyTask.setRescueStartTime(createReqVO.getRescueStartTime()); | ||
| 68 | + emergencyTask.setEmergencyImg(createReqVO.getEmergencyImg()); | ||
| 69 | + emergencyTask.setTreeSpec(createReqVO.getTreeSpec()); | ||
| 70 | + emergencyTask.setTreeSpecies(createReqVO.getTreeSpecies()); | ||
| 71 | + emergencyTask.setRescueCompleteTime(createReqVO.getRescueCompleteTime()); | ||
| 72 | + emergencyTask.setPersonnelCount(createReqVO.getPersonnelCount()); | ||
| 73 | + emergencyTask.setEmergencyEndImg(createReqVO.getEmergencyEndImg()); | ||
| 74 | + emergencyTask.setRemarks(createReqVO.getRemarks()); | ||
| 75 | + emergencyTask.setBusiStatus(createReqVO.getBusiStatus()); | ||
| 76 | + emergencyTask.setStatus(createReqVO.getStatus()); | ||
| 77 | + emergencyTask.setCompanyId(companyId); | ||
| 78 | + emergencyTask.setDeptId(deptId); | ||
| 79 | + emergencyTask.setCreator(userId); | ||
| 80 | + emergencyTask.setCreatorName(userName); | ||
| 81 | + emergencyTask.setUpdater(userId); | ||
| 82 | + emergencyTask.setUpdaterName(userName); | ||
| 83 | + emergencyTask.setApprovalRemarks(""); | ||
| 84 | + emergencyTaskMapper.insert(emergencyTask); | ||
| 85 | + | ||
| 86 | + List<EmergencyMachineryDO> list = new ArrayList<>(); | ||
| 87 | + createReqVO.getEmergencyMachineryList().forEach(emergencyMachinery -> { | ||
| 88 | + EmergencyMachineryDO emergencyMachineryDO = new EmergencyMachineryDO(); | ||
| 89 | + emergencyMachineryDO.setTaskNo(taskNo); | ||
| 90 | + emergencyMachineryDO.setMachineryNameId(emergencyMachinery.getMachineryNameId()); | ||
| 91 | + emergencyMachineryDO.setMachineryCount(emergencyMachinery.getMachineryCount()); | ||
| 92 | + emergencyMachineryDO.setCreator(userId); | ||
| 93 | + emergencyMachineryDO.setCreatorName(userName); | ||
| 94 | + emergencyMachineryDO.setUpdater(userId); | ||
| 95 | + emergencyMachineryDO.setUpdaterName(userName); | ||
| 96 | + list.add(emergencyMachineryDO); | ||
| 97 | + }); | ||
| 98 | + | ||
| 99 | + if(CollUtil.isNotEmpty(list)){ | ||
| 100 | + emergencyMachineryMapper.insertBatch(list); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + | ||
| 104 | + // 返回 | ||
| 105 | + return emergencyTask.getId(); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + @Override | ||
| 109 | + public int approvalEmergencyTask(EmergencyTaskApprovalReqVO createReqVO) { | ||
| 110 | + String userId = SecurityFrameworkUtils.getLoginUserId() + ""; | ||
| 111 | + String userName = SecurityFrameworkUtils.getLoginUserNickname(); | ||
| 112 | + UpdateWrapper<EmergencyTaskDO> sqlWrapper = new UpdateWrapper<>(); | ||
| 113 | + sqlWrapper.lambda().set(EmergencyTaskDO::getApprovalRemarks, createReqVO.getApprovalRemarks()) | ||
| 114 | + .set(EmergencyTaskDO::getApprovalUserId, userId) | ||
| 115 | + .set(EmergencyTaskDO::getApprovalUserName, userName) | ||
| 116 | + .set(EmergencyTaskDO::getBusiStatus, createReqVO.getBusiStatus()) | ||
| 117 | + .set(EmergencyTaskDO::getUpdateTime, new Date()) | ||
| 118 | + .eq(EmergencyTaskDO::getTaskNo, createReqVO.getTaskNo()); | ||
| 119 | + return emergencyTaskMapper.update(sqlWrapper); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + @Override | ||
| 123 | + public void updateEmergencyTask(EmergencyTaskSaveReqVO updateReqVO) { | ||
| 124 | + // 校验存在 | ||
| 125 | + //validateEmergencyTaskExists(updateReqVO.getId()); | ||
| 126 | + // 更新 | ||
| 127 | + EmergencyTaskDO updateObj = BeanUtils.toBean(updateReqVO, EmergencyTaskDO.class); | ||
| 128 | + emergencyTaskMapper.updateById(updateObj); | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + @Override | ||
| 132 | + public void deleteEmergencyTask(Long id) { | ||
| 133 | + // 校验存在 | ||
| 134 | + validateEmergencyTaskExists(id); | ||
| 135 | + // 删除 | ||
| 136 | + emergencyTaskMapper.deleteById(id); | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + @Transactional(rollbackFor = Exception.class) | ||
| 140 | + @Override | ||
| 141 | + public void deleteEmergencyTaskByTaskNo(String taskNO) { | ||
| 142 | + emergencyTaskMapper.deleteByTaskNo(taskNO); | ||
| 143 | + emergencyMachineryMapper.deleteByTaskNo(taskNO); | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + @Override | ||
| 147 | + public void deleteEmergencyTaskListByIds(List<Long> ids) { | ||
| 148 | + // 删除 | ||
| 149 | + emergencyTaskMapper.deleteByIds(ids); | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + | ||
| 153 | + private void validateEmergencyTaskExists(Long id) { | ||
| 154 | + if (emergencyTaskMapper.selectById(id) == null) { | ||
| 155 | + throw exception(EMERGENCY_TASK_NOT_EXISTS); | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + @Override | ||
| 160 | + public EmergencyTaskDO getEmergencyTask(Long id) { | ||
| 161 | + return emergencyTaskMapper.selectById(id); | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + @Override | ||
| 165 | + public EmergencyTaskRespVO getEmergencyTaskByTaskNo(String taskNo) { | ||
| 166 | + EmergencyTaskRespVO emergencyTaskRespVO = new EmergencyTaskRespVO(); | ||
| 167 | + EmergencyTaskDO emergencyTaskDO = emergencyTaskMapper.selectOne(EmergencyTaskDO::getTaskNo, taskNo); | ||
| 168 | + if(null != emergencyTaskDO){ | ||
| 169 | + BeanUtils.copyProperties(emergencyTaskDO, emergencyTaskRespVO); | ||
| 170 | + } | ||
| 171 | + List<EmergencyMachineryDO> detailList = emergencyMachineryMapper.selectList(EmergencyMachineryDO::getTaskNo, emergencyTaskRespVO.getTaskNo()); | ||
| 172 | + if(!CollectionUtil.isEmpty(detailList)){ | ||
| 173 | + emergencyTaskRespVO.setEmergencyMachineryList(detailList); | ||
| 174 | + } | ||
| 175 | + return emergencyTaskRespVO; | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + @Override | ||
| 179 | + public PageResult<EmergencyTaskRespVO> getEmergencyTaskPage(EmergencyTaskPageReqVO pageReqVO) { | ||
| 180 | + Long companyId = SecurityFrameworkUtils.getCompanyId(); | ||
| 181 | + //超级管理员全返回 | ||
| 182 | + if(companyId != null && !companyId.equals(100L)){ | ||
| 183 | + pageReqVO.setCompanyId(companyId); | ||
| 184 | + } | ||
| 185 | + PageResult<EmergencyTaskDO> page = emergencyTaskMapper.selectPage(pageReqVO); | ||
| 186 | + | ||
| 187 | + List<EmergencyTaskDO> list = page.getList(); | ||
| 188 | + List<EmergencyTaskRespVO> listTwo = BeanUtils.toBean(list, EmergencyTaskRespVO.class); | ||
| 189 | + | ||
| 190 | + listTwo.forEach(emergencyTaskRespVO -> { | ||
| 191 | + List<EmergencyMachineryDO> detailList = emergencyMachineryMapper.selectList(EmergencyMachineryDO::getTaskNo, emergencyTaskRespVO.getTaskNo()); | ||
| 192 | + if(!CollectionUtil.isEmpty(detailList)){ | ||
| 193 | + emergencyTaskRespVO.setEmergencyMachineryList(detailList); | ||
| 194 | + } | ||
| 195 | + }); | ||
| 196 | + | ||
| 197 | + // 转换返回 | ||
| 198 | + return new PageResult<>(listTwo, page.getTotal()); | ||
| 199 | + | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + | ||
| 203 | +} | ||
| 0 | \ No newline at end of file | 204 | \ No newline at end of file |
urbanops-module-garden/src/main/resources/mapper/emergencytask/EmergencyMachineryMapper.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.emergencytask.EmergencyMachineryMapper"> | ||
| 4 | + | ||
| 5 | + <!-- | ||
| 6 | + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | ||
| 7 | + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | ||
| 8 | + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | ||
| 9 | + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | ||
| 10 | + --> | ||
| 11 | + <delete id="deleteByTaskNo"> | ||
| 12 | + DELETE FROM garden_emergency_machinery WHERE task_no = #{taskNo} | ||
| 13 | + </delete> | ||
| 14 | + | ||
| 15 | +</mapper> | ||
| 0 | \ No newline at end of file | 16 | \ No newline at end of file |
urbanops-module-garden/src/main/resources/mapper/emergencytask/EmergencyTaskMapper.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.emergencytask.EmergencyTaskMapper"> | ||
| 4 | + | ||
| 5 | + <!-- | ||
| 6 | + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | ||
| 7 | + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | ||
| 8 | + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | ||
| 9 | + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | ||
| 10 | + --> | ||
| 11 | + | ||
| 12 | + <delete id="deleteByTaskNo"> | ||
| 13 | + DELETE FROM garden_emergency_task WHERE task_no = #{taskNo} | ||
| 14 | + </delete> | ||
| 15 | + | ||
| 16 | +</mapper> | ||
| 0 | \ No newline at end of file | 17 | \ No newline at end of file |