|
@@ -1,210 +0,0 @@
|
|
|
-package com.zksy.web.controller.gasbasic;
|
|
|
|
|
-
|
|
|
|
|
-import com.zksy.base.domain.WorkOrder;
|
|
|
|
|
-import com.zksy.base.service.BusinessWorkOrderService;
|
|
|
|
|
-import com.zksy.common.core.domain.AjaxResult;
|
|
|
|
|
-import com.zksy.common.utils.DateUtils;
|
|
|
|
|
-import com.zksy.ops.dto.WorkOrderDelayApplyDTO;
|
|
|
|
|
-import com.zksy.ops.dto.WorkOrderDispatchDTO;
|
|
|
|
|
-import com.zksy.ops.dto.WorkOrderOperateDTO;
|
|
|
|
|
-import com.zksy.ops.dto.WorkOrderPageDTO;
|
|
|
|
|
-import com.zksy.ops.dto.WorkOrderVerifyDTO;
|
|
|
|
|
-import io.swagger.annotations.Api;
|
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
-
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
-
|
|
|
|
|
-/**
|
|
|
|
|
- * 业务工单管理 Controller(历史兼容层)
|
|
|
|
|
- *
|
|
|
|
|
- * <p>保留历史 URL,供排水/供水/井盖等旧页面调用;内部统一委托 {@link BusinessWorkOrderService},
|
|
|
|
|
- * 与新工单流程(/api/ops/pworkOrder)共用同一套状态机,避免出现两套状态定义。</p>
|
|
|
|
|
- *
|
|
|
|
|
- * @author zksy
|
|
|
|
|
- */
|
|
|
|
|
-@Slf4j
|
|
|
|
|
-@RestController
|
|
|
|
|
-@RequestMapping("/api/work-order")
|
|
|
|
|
-@Api(tags = "业务工单管理(历史兼容)")
|
|
|
|
|
-public class BusinessWorkOrderController {
|
|
|
|
|
-
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private BusinessWorkOrderService businessWorkOrderService;
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 历史接口:查询工单列表
|
|
|
|
|
- *
|
|
|
|
|
- * <p>orderType 与 equipmentType 已废弃,不再参与过滤</p>
|
|
|
|
|
- */
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:query')")
|
|
|
|
|
- @GetMapping("/list")
|
|
|
|
|
- @ApiOperation("查询工单列表(orderType/equipmentType 已废弃)")
|
|
|
|
|
- public AjaxResult list(@RequestParam(required = false) Integer orderType,
|
|
|
|
|
- @RequestParam(required = false) Integer orderLevel,
|
|
|
|
|
- @RequestParam(required = false) String orderStatus,
|
|
|
|
|
- @RequestParam(required = false) String deviceCode,
|
|
|
|
|
- @RequestParam(required = false) String keyword,
|
|
|
|
|
- @RequestParam(required = false) String equipmentType,
|
|
|
|
|
- @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
|
|
- @RequestParam(defaultValue = "10") Integer pageSize) {
|
|
|
|
|
- WorkOrderPageDTO dto = new WorkOrderPageDTO();
|
|
|
|
|
- dto.setOrderLevel(orderLevel);
|
|
|
|
|
- dto.setOrderStatus(orderStatus);
|
|
|
|
|
- dto.setDeviceCode(deviceCode);
|
|
|
|
|
- dto.setKeyword(keyword);
|
|
|
|
|
- dto.setPageNum(pageNum == null ? 1L : pageNum.longValue());
|
|
|
|
|
- dto.setPageSize(pageSize == null ? 10L : pageSize.longValue());
|
|
|
|
|
- return AjaxResult.success(businessWorkOrderService.findByPage(dto));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:add')")
|
|
|
|
|
- @PostMapping("/add")
|
|
|
|
|
- @ApiOperation("手动新增故障工单")
|
|
|
|
|
- public AjaxResult add(@RequestBody WorkOrder workOrder) {
|
|
|
|
|
- return AjaxResult.success("工单创建成功", businessWorkOrderService.addWorkOrder(workOrder));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:query')")
|
|
|
|
|
- @GetMapping("/{orderId}")
|
|
|
|
|
- @ApiOperation("查询工单详情(含操作日志)")
|
|
|
|
|
- public AjaxResult detail(@PathVariable Long orderId) {
|
|
|
|
|
- return AjaxResult.success(businessWorkOrderService.getDetailById(orderId));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:dispatch')")
|
|
|
|
|
- @PostMapping("/dispatch")
|
|
|
|
|
- @ApiOperation("派单(兼容 handlerIds 多人入参,仅取第一位作为责任人)")
|
|
|
|
|
- public AjaxResult dispatch(@RequestBody Map<String, Object> body) {
|
|
|
|
|
- WorkOrderDispatchDTO dto = new WorkOrderDispatchDTO();
|
|
|
|
|
- dto.setOrderId(toLong(body.get("orderId")));
|
|
|
|
|
- dto.setHandlerId(toLong(body.get("handlerId")));
|
|
|
|
|
- dto.setRemarks(toStringValue(body.get("remarks")));
|
|
|
|
|
- if (dto.getHandlerId() == null && body.get("handlerIds") instanceof java.util.List) {
|
|
|
|
|
- java.util.List<?> ids = (java.util.List<?>) body.get("handlerIds");
|
|
|
|
|
- if (ids.isEmpty()) {
|
|
|
|
|
- return AjaxResult.error("责任人不能为空");
|
|
|
|
|
- }
|
|
|
|
|
- dto.setHandlerId(toLong(ids.get(0)));
|
|
|
|
|
- }
|
|
|
|
|
- return businessWorkOrderService.dispatch(dto)
|
|
|
|
|
- ? AjaxResult.success("派单成功") : AjaxResult.error("派单失败");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:accept')")
|
|
|
|
|
- @PutMapping("/verify")
|
|
|
|
|
- @ApiOperation("核查接单(历史:核查)")
|
|
|
|
|
- public AjaxResult verify(@RequestBody WorkOrderOperateDTO dto) {
|
|
|
|
|
- return businessWorkOrderService.accept(dto)
|
|
|
|
|
- ? AjaxResult.success("核查完成") : AjaxResult.error("核查失败");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:accept')")
|
|
|
|
|
- @PutMapping("/accept")
|
|
|
|
|
- @ApiOperation("接单(历史接口)")
|
|
|
|
|
- public AjaxResult accept(@RequestBody WorkOrderOperateDTO dto) {
|
|
|
|
|
- return businessWorkOrderService.accept(dto)
|
|
|
|
|
- ? AjaxResult.success("接单成功") : AjaxResult.error("接单失败");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:process')")
|
|
|
|
|
- @PutMapping("/process")
|
|
|
|
|
- @ApiOperation("工单处置")
|
|
|
|
|
- public AjaxResult process(@RequestBody WorkOrderOperateDTO dto) {
|
|
|
|
|
- return businessWorkOrderService.process(dto)
|
|
|
|
|
- ? AjaxResult.success("处置成功") : AjaxResult.error("处置失败");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:process')")
|
|
|
|
|
- @PutMapping("/start")
|
|
|
|
|
- @ApiOperation("开始处理(历史接口,等价处置)")
|
|
|
|
|
- public AjaxResult start(@RequestBody WorkOrderOperateDTO dto) {
|
|
|
|
|
- return businessWorkOrderService.process(dto)
|
|
|
|
|
- ? AjaxResult.success("处理成功") : AjaxResult.error("处理失败");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:submitVerify')")
|
|
|
|
|
- @PutMapping("/complete")
|
|
|
|
|
- @ApiOperation("提交验收(历史:完成)")
|
|
|
|
|
- public AjaxResult complete(@RequestBody WorkOrderOperateDTO dto) {
|
|
|
|
|
- return businessWorkOrderService.submitVerify(dto)
|
|
|
|
|
- ? AjaxResult.success("提交验收成功") : AjaxResult.error("提交验收失败");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:verify')")
|
|
|
|
|
- @PutMapping("/close")
|
|
|
|
|
- @ApiOperation("验收通过/结案")
|
|
|
|
|
- public AjaxResult close(@RequestBody WorkOrderOperateDTO dto) {
|
|
|
|
|
- WorkOrderVerifyDTO verifyDTO = new WorkOrderVerifyDTO();
|
|
|
|
|
- verifyDTO.setOrderId(dto.getOrderId());
|
|
|
|
|
- verifyDTO.setPassed(Boolean.TRUE);
|
|
|
|
|
- verifyDTO.setContent(dto.getContent());
|
|
|
|
|
- verifyDTO.setAttachUrl(dto.getAttachUrl());
|
|
|
|
|
- return businessWorkOrderService.verify(verifyDTO)
|
|
|
|
|
- ? AjaxResult.success("验收通过") : AjaxResult.error("验收失败");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:cancel')")
|
|
|
|
|
- @PutMapping("/reject")
|
|
|
|
|
- @ApiOperation("驳回工单(历史接口,等价取消)")
|
|
|
|
|
- public AjaxResult reject(@RequestBody WorkOrderOperateDTO dto) {
|
|
|
|
|
- return businessWorkOrderService.cancel(dto)
|
|
|
|
|
- ? AjaxResult.success("驳回成功") : AjaxResult.error("驳回失败");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:delay')")
|
|
|
|
|
- @PutMapping("/delay")
|
|
|
|
|
- @ApiOperation("申请延期")
|
|
|
|
|
- public AjaxResult delay(@RequestBody WorkOrderDelayApplyDTO dto) {
|
|
|
|
|
- return businessWorkOrderService.applyDelay(dto)
|
|
|
|
|
- ? AjaxResult.success("延期申请已提交") : AjaxResult.error("延期申请失败");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:cancel')")
|
|
|
|
|
- @DeleteMapping("/{orderId}")
|
|
|
|
|
- @ApiOperation("取消工单")
|
|
|
|
|
- public AjaxResult cancel(@PathVariable Long orderId, @RequestBody(required = false) WorkOrderOperateDTO dto) {
|
|
|
|
|
- WorkOrderOperateDTO cancelDTO = dto == null ? new WorkOrderOperateDTO() : dto;
|
|
|
|
|
- cancelDTO.setOrderId(orderId);
|
|
|
|
|
- return businessWorkOrderService.cancel(cancelDTO)
|
|
|
|
|
- ? AjaxResult.success("取消工单成功") : AjaxResult.error("取消工单失败");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PreAuthorize("@ss.hasPermi('ops:pworkOrder:add')")
|
|
|
|
|
- @PostMapping("/createFromHazard")
|
|
|
|
|
- @ApiOperation("从隐患创建工单")
|
|
|
|
|
- public AjaxResult createFromHazard(@RequestBody Map<String, Object> body) {
|
|
|
|
|
- String planFinishTimeStr = toStringValue(body.get("planFinishTime"));
|
|
|
|
|
- Date planFinishTime = StringUtils.isNotEmpty(planFinishTimeStr) ? DateUtils.parseDate(planFinishTimeStr) : null;
|
|
|
|
|
- Long orderId = businessWorkOrderService.createWorkOrderFromHazard(
|
|
|
|
|
- toStringValue(body.get("hazardId")),
|
|
|
|
|
- toStringValue(body.get("hazardNo")),
|
|
|
|
|
- toStringValue(body.get("hazardDesc")),
|
|
|
|
|
- toStringValue(body.get("equipmentId")),
|
|
|
|
|
- toStringValue(body.get("hazardLevel")),
|
|
|
|
|
- toStringValue(body.get("hazardImages")),
|
|
|
|
|
- planFinishTime);
|
|
|
|
|
- return AjaxResult.success("工单创建成功", orderId);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private Long toLong(Object value) {
|
|
|
|
|
- return value == null ? null : Long.valueOf(value.toString());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private String toStringValue(Object value) {
|
|
|
|
|
- return value == null ? null : String.valueOf(value);
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|