#工单模块+lombok
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.maibu.thermal.model;
|
package com.maibu.thermal.model;
|
||||||
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
package com.maibu.dto;
|
package com.maibu.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
public class IoTDACommandDTO {
|
public class IoTDACommandDTO {
|
||||||
private String commandName;
|
private String commandName;
|
||||||
private Object param;
|
private Object param;
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,133 @@
|
|||||||
|
package com.maibu.controller;
|
||||||
|
|
||||||
|
import com.maibu.annotation.Log;
|
||||||
|
import com.maibu.core.business.IOTWorkOrder;
|
||||||
|
import com.maibu.core.business.dto.WorkOrderDispatchDTO;
|
||||||
|
import com.maibu.core.business.dto.WorkOrderQueryDTO;
|
||||||
|
import com.maibu.core.controller.BaseController;
|
||||||
|
import com.maibu.core.domain.AjaxResult;
|
||||||
|
import com.maibu.core.page.TableDataInfo;
|
||||||
|
import com.maibu.enums.BusinessType;
|
||||||
|
import com.maibu.service.IWorkOrderService;
|
||||||
|
import com.maibu.utils.poi.ExcelUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Api("工单任务接口")
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
@RequestMapping("/iot/ioTworkOrder")
|
||||||
|
public class IOTWorkOrderController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IWorkOrderService workOrderService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:workOrder:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperation("工单分页列表")
|
||||||
|
public TableDataInfo list(WorkOrderQueryDTO queryDTO) {
|
||||||
|
return workOrderService.selectWorkOrderPage(queryDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:workOrder:query')")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
@ApiOperation("获取工单详情")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long id) {
|
||||||
|
return AjaxResult.success(workOrderService.selectWorkOrderById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:workOrder:add')")
|
||||||
|
@Log(title = "工单管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
@ApiOperation("新增工单")
|
||||||
|
public AjaxResult add(@RequestBody IOTWorkOrder workOrder) {
|
||||||
|
return toAjax(workOrderService.insertWorkOrder(workOrder));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:workOrder:edit')")
|
||||||
|
@Log(title = "工单管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
@ApiOperation("修改工单")
|
||||||
|
public AjaxResult edit(@RequestBody IOTWorkOrder workOrder) {
|
||||||
|
return toAjax(workOrderService.updateWorkOrder(workOrder));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:workOrder:dispatch')")
|
||||||
|
@Log(title = "工单派发", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/dispatch")
|
||||||
|
@ApiOperation("派发工单")
|
||||||
|
public AjaxResult dispatch(@RequestBody WorkOrderDispatchDTO dispatchDTO) {
|
||||||
|
return toAjax(workOrderService.dispatchWorkOrder(dispatchDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:workOrder:start')")
|
||||||
|
@Log(title = "工单开始", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/start/{id}")
|
||||||
|
@ApiOperation("开始执行工单")
|
||||||
|
public AjaxResult start(@PathVariable Long id) {
|
||||||
|
return toAjax(workOrderService.startWorkOrder(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:workOrder:complete')")
|
||||||
|
@Log(title = "工单完成", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/complete")
|
||||||
|
@ApiOperation("完成工单")
|
||||||
|
public AjaxResult complete(@RequestBody IOTWorkOrder workOrder) {
|
||||||
|
return toAjax(workOrderService.completeWorkOrder(workOrder));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:workOrder:suspend')")
|
||||||
|
@Log(title = "工单挂起", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/suspend/{id}")
|
||||||
|
@ApiOperation("挂起工单")
|
||||||
|
public AjaxResult suspend(@PathVariable Long id) {
|
||||||
|
return toAjax(workOrderService.suspendWorkOrder(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:workOrder:remove')")
|
||||||
|
@Log(title = "工单管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
@ApiOperation("删除工单")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
|
return toAjax(workOrderService.deleteWorkOrderByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:workOrder:statistics')")
|
||||||
|
@GetMapping("/statistics")
|
||||||
|
@ApiOperation("工单统计")
|
||||||
|
public AjaxResult statistics() {
|
||||||
|
Map<String, Object> statistics = workOrderService.getWorkOrderStatistics();
|
||||||
|
return AjaxResult.success(statistics);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:workOrder:export')")
|
||||||
|
@Log(title = "工单管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ApiOperation("导出工单")
|
||||||
|
public void export(HttpServletResponse response, WorkOrderQueryDTO queryDTO) {
|
||||||
|
try {
|
||||||
|
List<IOTWorkOrder> list = workOrderService.selectWorkOrderList(queryDTO);
|
||||||
|
ExcelUtil<IOTWorkOrder> util = new ExcelUtil<>(IOTWorkOrder.class);
|
||||||
|
util.exportExcel(response, list, "工单数据");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("导出工单失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:workOrder:add')")
|
||||||
|
@Log(title = "从告警生成工单", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/generateFromAlarm/{alarmId}")
|
||||||
|
@ApiOperation("从告警生成工单")
|
||||||
|
public AjaxResult generateFromAlarm(@PathVariable Long alarmId) {
|
||||||
|
IOTWorkOrder workOrder = workOrderService.generateWorkOrderFromAlarm(alarmId);
|
||||||
|
return AjaxResult.success(workOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
2
pom.xml
2
pom.xml
@@ -33,7 +33,7 @@
|
|||||||
<jwt.version>0.9.1</jwt.version>
|
<jwt.version>0.9.1</jwt.version>
|
||||||
<justAuth.version>1.16.5</justAuth.version>
|
<justAuth.version>1.16.5</justAuth.version>
|
||||||
<forest.version>1.5.36</forest.version>
|
<forest.version>1.5.36</forest.version>
|
||||||
<lombok.version>1.18.22</lombok.version>
|
<lombok.version>1.18.24</lombok.version>
|
||||||
<!-- <rocketmq.version>2.2.1</rocketmq.version>-->
|
<!-- <rocketmq.version>2.2.1</rocketmq.version>-->
|
||||||
<hutool.version>5.8.20</hutool.version>
|
<hutool.version>5.8.20</hutool.version>
|
||||||
<!-- <mapstruct.version>1.5.5.Final</mapstruct.version>-->
|
<!-- <mapstruct.version>1.5.5.Final</mapstruct.version>-->
|
||||||
|
|||||||
Reference in New Issue
Block a user