|
@@ -1,5 +1,11 @@
|
|
|
package cn.iocoder.yudao.module.pms.controller.admin.inspect.order;
|
|
|
|
|
|
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.inspect.order.vo.IotInspectOrderPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.inspect.order.vo.IotInspectOrderRespVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.inspect.order.vo.IotInspectOrderSaveReqVO;
|
|
@@ -10,34 +16,28 @@ import cn.iocoder.yudao.module.pms.dal.mysql.inspect.IotInspectOrderDetailMapper
|
|
|
import cn.iocoder.yudao.module.pms.service.IotDeviceService;
|
|
|
import cn.iocoder.yudao.module.pms.service.inspect.IotInspectOrderDetailService;
|
|
|
import cn.iocoder.yudao.module.pms.service.inspect.IotInspectOrderService;
|
|
|
+import cn.iocoder.yudao.module.pms.service.inspect.IotInspectRouteService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import lombok.Data;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-import javax.annotation.Resource;
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
-import io.swagger.v3.oas.annotations.Parameter;
|
|
|
-import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import javax.validation.constraints.*;
|
|
|
-import javax.validation.*;
|
|
|
-import javax.servlet.http.*;
|
|
|
-import java.util.*;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.Valid;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
|
-import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
-
|
|
|
-import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
-import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
-
|
|
|
|
|
|
@Tag(name = "管理后台 - 巡检工单")
|
|
|
@RestController
|
|
@@ -53,6 +53,8 @@ public class IotInspectOrderController {
|
|
|
private IotInspectOrderDetailMapper iotInspectOrderDetailMapper;
|
|
|
@Autowired
|
|
|
private IotDeviceService iotDeviceService;
|
|
|
+ @Autowired
|
|
|
+ private IotInspectRouteService iotInspectRouteService;
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建巡检工单")
|
|
@@ -85,19 +87,20 @@ public class IotInspectOrderController {
|
|
|
public CommonResult<IotInspectOrderRespVO> getIotInspectOrder(@RequestParam("id") Long id) {
|
|
|
IotInspectOrderDO iotInspectOrder = iotInspectOrderService.getIotInspectOrder(id);
|
|
|
IotInspectOrderRespVO bean = BeanUtils.toBean(iotInspectOrder, IotInspectOrderRespVO.class);
|
|
|
-// List<IotInspectOrderDetailDO> orderId = iotInspectOrderDetailMapper.selectList("order_id", iotInspectOrder.getId());
|
|
|
-// Map<Long, List<IotInspectOrderDetailDO>> collect = orderId.stream().collect(Collectors.groupingBy(IotInspectOrderDetailDO::getDeviceId));
|
|
|
-// List<OrderDetail> orderDetails = new ArrayList<>();
|
|
|
-// collect.forEach((k, v) -> {
|
|
|
-// IotDeviceDO iotDevice = iotDeviceService.getIotDevice(k);
|
|
|
-// OrderDetail orderDetail = new OrderDetail();
|
|
|
-// orderDetail.setDeviceId(k);
|
|
|
-// orderDetail.setDeviceName(iotDevice.getDeviceName());
|
|
|
-// orderDetail.setOrderDetails(v);
|
|
|
-// orderDetails.add(orderDetail);
|
|
|
-// });
|
|
|
-//
|
|
|
-// bean.setDetails(orderDetails);
|
|
|
+ List<IotInspectOrderDetailDO> orderId = iotInspectOrderDetailMapper.selectList("order_id", iotInspectOrder.getId());
|
|
|
+ Map<Long, List<IotInspectOrderDetailDO>> collect = orderId.stream().collect(Collectors.groupingBy(IotInspectOrderDetailDO::getDeviceId));
|
|
|
+ List<OrderDetail> orderDetails = new ArrayList<>();
|
|
|
+ collect.forEach((k, v) -> {
|
|
|
+ IotDeviceDO iotDevice = iotDeviceService.getIotDevice(k);
|
|
|
+ OrderDetail orderDetail = new OrderDetail();
|
|
|
+ orderDetail.setDeviceId(k);
|
|
|
+ orderDetail.setDeviceName(iotDevice.getDeviceName());
|
|
|
+ orderDetail.setDeviceCode(iotDevice.getDeviceCode());
|
|
|
+ orderDetail.setOrderDetails(v);
|
|
|
+ orderDetails.add(orderDetail);
|
|
|
+ });
|
|
|
+
|
|
|
+ bean.setDetails(orderDetails);
|
|
|
return success(bean);
|
|
|
}
|
|
|
|
|
@@ -124,6 +127,7 @@ public class IotInspectOrderController {
|
|
|
public static class OrderDetail {
|
|
|
private Long deviceId;
|
|
|
private String deviceName;
|
|
|
+ private String deviceCode;
|
|
|
private List<IotInspectOrderDetailDO> orderDetails;
|
|
|
}
|
|
|
|