Commit 62156d68 authored by 王晓倩's avatar 王晓倩

巡检计划新增,修改,下发,作废

parent b64d106b
...@@ -59,6 +59,23 @@ public class TDeviceInfoController extends BaseController ...@@ -59,6 +59,23 @@ public class TDeviceInfoController extends BaseController
return AjaxResult.success(tDeviceInfoService.buildDeviceTreeSelect(param)); return AjaxResult.success(tDeviceInfoService.buildDeviceTreeSelect(param));
} }
/**
* 获取设备树
*/
@GetMapping("/deviceNodeTree")
public AjaxResult deviceNodeTree() throws Exception
{
List<Map<Object, Object>> list = null;
try {
list = tDeviceInfoService.buildDeviceTree();
} catch (Exception e) {
e.printStackTrace();
throw new Exception("获取设备列表失败");
}
return AjaxResult.success(list);
}
/** /**
* 导出设备信息列表 * 导出设备信息列表
*/ */
......
...@@ -3,6 +3,7 @@ package com.zehong.web.controller.deviceInspection; ...@@ -3,6 +3,7 @@ package com.zehong.web.controller.deviceInspection;
import java.util.List; import java.util.List;
import com.zehong.system.domain.form.InspectionPlanForm; import com.zehong.system.domain.form.InspectionPlanForm;
import com.zehong.system.domain.vo.InspectionPlanVo;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
......
...@@ -28,14 +28,17 @@ public class TInspectionPlan extends BaseEntity ...@@ -28,14 +28,17 @@ public class TInspectionPlan extends BaseEntity
@Excel(name = "工单id") @Excel(name = "工单id")
private String orderId; private String orderId;
/** 设备id */
private String deviceIds;
/** 开始时间 */ /** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime; private Date startTime;
/** 结束时间 */ /** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime; private Date endTime;
/** 地址 */ /** 地址 */
...@@ -84,7 +87,15 @@ public class TInspectionPlan extends BaseEntity ...@@ -84,7 +87,15 @@ public class TInspectionPlan extends BaseEntity
return orderId; return orderId;
} }
public void setStartTime(Date startTime) public String getDeviceIds() {
return deviceIds;
}
public void setDeviceIds(String deviceIds) {
this.deviceIds = deviceIds;
}
public void setStartTime(Date startTime)
{ {
this.startTime = startTime; this.startTime = startTime;
} }
......
package com.zehong.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zehong.common.core.domain.BaseEntity;
import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TPipe;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 巡检计划对象 t_inspection_plan
*
* @author zehong
* @date 2021-07-21
*/
public class InspectionPlanVo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 巡检计划id */
private Integer planId;
/** 巡检计划名称 */
private String planName;
/** 设备id */
private String deviceIds;
/** 设备树列表 */
private Map<Object, List> deviceList;
/** 工单id */
private String orderId;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endTime;
/** 地址 */
private String address;
/** 计划状态(0未下发,1已下发,2进行中,3已完成) */
private String planStatus;
/** 是否作废(0正常,1作废) */
private String isDel;
/** 计划描述 */
private String remarks;
public void setPlanId(Integer planId)
{
this.planId = planId;
}
public Integer getPlanId()
{
return planId;
}
public void setPlanName(String planName)
{
this.planName = planName;
}
public String getPlanName()
{
return planName;
}
public String getDeviceIds() {
return deviceIds;
}
public void setDeviceIds(String deviceIds) {
this.deviceIds = deviceIds;
}
public Map<Object, List> getDeviceList() {
return deviceList;
}
public void setDeviceList(Map<Object, List> deviceList) {
this.deviceList = deviceList;
}
public void setOrderId(String orderId)
{
this.orderId = orderId;
}
public String getOrderId()
{
return orderId;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public void setPlanStatus(String planStatus)
{
this.planStatus = planStatus;
}
public String getPlanStatus()
{
return planStatus;
}
public String getIsDel() {
return isDel;
}
public void setIsDel(String isDel) {
this.isDel = isDel;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
}
...@@ -3,10 +3,7 @@ package com.zehong.system.service; ...@@ -3,10 +3,7 @@ package com.zehong.system.service;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.zehong.common.core.domain.TreeSelect;
import com.zehong.common.core.domain.entity.SysDept;
import com.zehong.system.domain.TDeviceInfo; import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TPipe;
/** /**
* 设备信息Service接口 * 设备信息Service接口
...@@ -40,6 +37,14 @@ public interface ITDeviceInfoService ...@@ -40,6 +37,14 @@ public interface ITDeviceInfoService
*/ */
public List<Map<Object, Object>> buildDeviceTreeSelect(Map<Object, List> param); public List<Map<Object, Object>> buildDeviceTreeSelect(Map<Object, List> param);
/**
* 设备树
*
* @param
* @return 树结构列表
*/
public List<Map<Object, Object>> buildDeviceTree() throws Exception;
/** /**
* 统计各设备类型的设备总数 * 统计各设备类型的设备总数
* @return * @return
......
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import com.zehong.common.core.domain.TreeSelect;
import com.zehong.common.core.domain.entity.SysDept;
import com.zehong.system.domain.TPipe; import com.zehong.system.domain.TPipe;
import com.zehong.system.mapper.TPipeMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDeviceInfoMapper; import com.zehong.system.mapper.TDeviceInfoMapper;
import com.zehong.system.domain.TDeviceInfo; import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.service.ITDeviceInfoService; import com.zehong.system.service.ITDeviceInfoService;
import org.springframework.web.bind.annotation.RequestParam;
/** /**
* 设备信息Service业务层处理 * 设备信息Service业务层处理
...@@ -24,6 +21,8 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService ...@@ -24,6 +21,8 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
{ {
@Autowired @Autowired
private TDeviceInfoMapper tDeviceInfoMapper; private TDeviceInfoMapper tDeviceInfoMapper;
@Autowired
private TPipeMapper tPipeMapper;
/** /**
* 查询设备信息 * 查询设备信息
...@@ -83,6 +82,94 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService ...@@ -83,6 +82,94 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
return list; return list;
} }
/**
* 设备树
*
* @param
* @return 树结构列表
*/
@Override
public List<Map<Object, Object>> buildDeviceTree() throws Exception
{
List<TPipe> pipeList = tPipeMapper.selectTPipeList(new TPipe());
List<TDeviceInfo> deviceList = tDeviceInfoMapper.selectTDeviceInfoList(new TDeviceInfo());
List<Map<Object, Object>> treeNodeList = new ArrayList<>();
if(pipeList.size() != 0){
List<Map<Object, Object>> childNodeList = new ArrayList<>();
for(TPipe pipe : pipeList){
Map<Object, Object> map = new HashMap<>();
map.put("id", pipe.getPipeId());
map.put("level", 2);
map.put("name", pipe.getPipeName());
childNodeList.add(map);
}
Map<Object, Object> treeNode = new HashMap<>();
treeNode.put("id", 0);
treeNode.put("level", 1);
treeNode.put("name", "管道");
treeNode.put("childList", childNodeList);
treeNodeList.add(treeNode);
}
if(deviceList.size() != 0) {
List<Map<Object, Object>> childNodeList1 = new ArrayList<>();
List<Map<Object, Object>> childNodeList2 = new ArrayList<>();
List<Map<Object, Object>> childNodeList3 = new ArrayList<>();
List<Map<Object, Object>> childNodeList4 = new ArrayList<>();
for (TDeviceInfo device : deviceList) {
Map<Object, Object> childNode = new HashMap<>();
childNode.put("id", device.getDeviceId());
childNode.put("level", 2);
childNode.put("name", device.getDeviceName());
if("1".equals(device.getDeviceType())) {
childNodeList1.add(childNode);
} else if ("2".equals(device.getDeviceType())) {
childNodeList2.add(childNode);
} else if ("3".equals(device.getDeviceType())) {
childNodeList3.add(childNode);
} else if ("4".equals(device.getDeviceType())){
childNodeList4.add(childNode);
}
}
Map<Object, Object> treeNode1 = new HashMap<>();
treeNode1.put("id", 1);
treeNode1.put("level", 1);
treeNode1.put("name", "调压阀");
treeNode1.put("childList", childNodeList1);
Map<Object, Object> treeNode2 = new HashMap<>();
treeNode2.put("id", 2);
treeNode2.put("level", 1);
treeNode2.put("name", "阀门井");
treeNode2.put("childList", childNodeList2);
Map<Object, Object> treeNode3 = new HashMap<>();
treeNode3.put("id", 3);
treeNode3.put("level", 1);
treeNode3.put("name", "流量计");
treeNode3.put("childList", childNodeList3);
Map<Object, Object> treeNode4 = new HashMap<>();
treeNode4.put("id", 4);
treeNode4.put("level", 1);
treeNode4.put("name", "压力表");
treeNode4.put("childList", childNodeList4);
treeNodeList.add(treeNode1);
treeNodeList.add(treeNode2);
treeNodeList.add(treeNode3);
treeNodeList.add(treeNode4);
}
return treeNodeList;
}
/** /**
* 统计各设备类型的设备总数 * 统计各设备类型的设备总数
* @return * @return
......
...@@ -3,6 +3,7 @@ package com.zehong.system.service.impl; ...@@ -3,6 +3,7 @@ package com.zehong.system.service.impl;
import java.util.List; import java.util.List;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.form.InspectionPlanForm; import com.zehong.system.domain.form.InspectionPlanForm;
import com.zehong.system.domain.vo.InspectionPlanVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TInspectionPlanMapper; import com.zehong.system.mapper.TInspectionPlanMapper;
......
...@@ -7,6 +7,7 @@ import com.zehong.common.core.domain.entity.SysUser; ...@@ -7,6 +7,7 @@ import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.*; import com.zehong.system.domain.*;
import com.zehong.system.domain.form.TWorkOrderForm; import com.zehong.system.domain.form.TWorkOrderForm;
import com.zehong.system.domain.vo.InspectionPlanVo;
import com.zehong.system.domain.vo.OrderFeedbackVo; import com.zehong.system.domain.vo.OrderFeedbackVo;
import com.zehong.system.domain.vo.WorkOrderVo; import com.zehong.system.domain.vo.WorkOrderVo;
import com.zehong.system.mapper.*; import com.zehong.system.mapper.*;
...@@ -289,9 +290,8 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -289,9 +290,8 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
plan.setUpdateTime(DateUtils.getNowDate()); plan.setUpdateTime(DateUtils.getNowDate());
tInspectionPlanMapper.updateTInspectionPlan(plan); tInspectionPlanMapper.updateTInspectionPlan(plan);
} else if ("0".equals(tWorkOrder.getOrderStatus())){
tWorkOrder.setUpdateTime(DateUtils.getNowDate());
} }
tWorkOrder.setUpdateTime(DateUtils.getNowDate());
return tWorkOrderMapper.updateTWorkOrder(tWorkOrder); return tWorkOrderMapper.updateTWorkOrder(tWorkOrder);
} }
......
...@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="planId" column="plan_id" /> <result property="planId" column="plan_id" />
<result property="planName" column="plan_name" /> <result property="planName" column="plan_name" />
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id" />
<result property="deviceIds" column="device_ids" />
<result property="startTime" column="start_time" /> <result property="startTime" column="start_time" />
<result property="endTime" column="end_time" /> <result property="endTime" column="end_time" />
<result property="address" column="address" /> <result property="address" column="address" />
...@@ -19,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -19,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectTInspectionPlanVo"> <sql id="selectTInspectionPlanVo">
select plan_id, plan_name, order_id, start_time, end_time, address, plan_status, is_del, update_time, create_time, remarks from t_inspection_plan select plan_id, plan_name, order_id, device_ids, start_time, end_time, address, plan_status, is_del, update_time, create_time, remarks from t_inspection_plan
</sql> </sql>
<select id="selectTInspectionPlanList" parameterType="InspectionPlanForm" resultMap="TInspectionPlanResult"> <select id="selectTInspectionPlanList" parameterType="InspectionPlanForm" resultMap="TInspectionPlanResult">
...@@ -47,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -47,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planName != null">plan_name,</if> <if test="planName != null">plan_name,</if>
<if test="orderId != null">order_id,</if> <if test="orderId != null">order_id,</if>
<if test="deviceIds != null">device_ids,</if>
<if test="startTime != null">start_time,</if> <if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if> <if test="endTime != null">end_time,</if>
<if test="address != null">address,</if> <if test="address != null">address,</if>
...@@ -59,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -59,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planName != null">#{planName},</if> <if test="planName != null">#{planName},</if>
<if test="orderId != null">#{orderId},</if> <if test="orderId != null">#{orderId},</if>
<if test="deviceIds != null">#{deviceIds},</if>
<if test="startTime != null">#{startTime},</if> <if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if> <if test="endTime != null">#{endTime},</if>
<if test="address != null">#{address},</if> <if test="address != null">#{address},</if>
...@@ -75,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -75,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="planName != null">plan_name = #{planName},</if> <if test="planName != null">plan_name = #{planName},</if>
<if test="orderId != null">order_id = #{orderId},</if> <if test="orderId != null">order_id = #{orderId},</if>
<if test="deviceIds != null">device_ids = #{deviceIds},</if>
<if test="startTime != null">start_time = #{startTime},</if> <if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if> <if test="endTime != null">end_time = #{endTime},</if>
<if test="address != null">address = #{address},</if> <if test="address != null">address = #{address},</if>
......
...@@ -78,3 +78,11 @@ export function deviceTree(data) { ...@@ -78,3 +78,11 @@ export function deviceTree(data) {
}) })
} }
// 设备树
export function deviceNodeTree() {
return request({
url: '/device/deviceInfo/deviceNodeTree',
method: 'get'
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment