Commit a3024198 authored by 王晓倩's avatar 王晓倩

工单详情添加报警设备信息

parent 7c019c38
...@@ -8,7 +8,6 @@ import com.zehong.common.utils.DateUtils; ...@@ -8,7 +8,6 @@ import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.*; import com.zehong.system.domain.*;
import com.zehong.system.domain.vo.WorkOrderVo; import com.zehong.system.domain.vo.WorkOrderVo;
import com.zehong.system.mapper.*; import com.zehong.system.mapper.*;
import com.zehong.system.service.ITInspectionPlanService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -42,9 +41,6 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -42,9 +41,6 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
@Autowired @Autowired
private TDeviceInfoMapper tDeviceInfoMapper; private TDeviceInfoMapper tDeviceInfoMapper;
@Autowired
private ITInspectionPlanService tInspectionPlanService;
/** /**
* 查询工单基础信息 * 查询工单基础信息
* *
...@@ -73,6 +69,9 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -73,6 +69,9 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
// 获取源数据(1巡检信息,2隐患信息,3报警信息) // 获取源数据(1巡检信息,2隐患信息,3报警信息)
String orderType = tWorkOrder.getOrderType(); String orderType = tWorkOrder.getOrderType();
int resourceId = tWorkOrder.getResourceId(); int resourceId = tWorkOrder.getResourceId();
List<TDeviceInfo> deviceInfoList = new ArrayList<>();
if("1".equals(orderType)){ if("1".equals(orderType)){
TInspectionPlan plan = tInspectionPlanMapper.selectTInspectionPlanById(resourceId); TInspectionPlan plan = tInspectionPlanMapper.selectTInspectionPlanById(resourceId);
...@@ -84,21 +83,18 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -84,21 +83,18 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
List<TInspectionData> totalList = tInspectionDataMapper.selectTInspectionDataList(data); List<TInspectionData> totalList = tInspectionDataMapper.selectTInspectionDataList(data);
workOrderVo.setDeviceNum(totalList.size()); workOrderVo.setDeviceNum(totalList.size());
List<TDeviceInfo> deviceInfoList = new ArrayList<>();
TDeviceInfo deviceInfo = null; TDeviceInfo deviceInfo = null;
for(TInspectionData temp : totalList){ for(TInspectionData temp : totalList){
deviceInfo = tDeviceInfoMapper.selectTDeviceInfoByCode(temp.getDeviceCode()); deviceInfo = tDeviceInfoMapper.selectTDeviceInfoByCode(temp.getDeviceCode());
if(deviceInfo != null){ if(deviceInfo != null){
deviceInfoList.add(deviceInfo); deviceInfoList.add(deviceInfo);
} }
} }
workOrderVo.setDeviceInfoList(deviceInfoList);
int finish = tInspectionDataMapper.selectFinishTInspectionData(resourceId); int finish = tInspectionDataMapper.selectFinishTInspectionData(resourceId);
workOrderVo.setFinishNum(finish); workOrderVo.setFinishNum(finish);
} else if("2".equals(orderType)){ } else if("2".equals(orderType)) {
THiddenTrouble trouble = tHiddenTroubleMapper.selectTHiddenTroubleById(resourceId); THiddenTrouble trouble = tHiddenTroubleMapper.selectTHiddenTroubleById(resourceId);
workOrderVo.setDeviceCodes((trouble.getDeviceCode() != null ? trouble.getDeviceCode() : null).toString()); workOrderVo.setDeviceCodes((trouble.getDeviceCode() != null ? trouble.getDeviceCode() : null).toString());
...@@ -108,7 +104,13 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -108,7 +104,13 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
workOrderVo.setDeviceType(trouble.getDeviceType()); workOrderVo.setDeviceType(trouble.getDeviceType());
workOrderVo.setAddress(trouble.getAddress()); workOrderVo.setAddress(trouble.getAddress());
} else { String deviceCode = trouble.getDeviceCode();
TDeviceInfo device = tDeviceInfoMapper.selectTDeviceInfoByCode(deviceCode);
if(device != null){
deviceInfoList.add(device);
}
} else if("3".equals(orderType)) {
TDeviceAlarm alarm = tDeviceAlarmMapper.selectTDeviceAlarmById(resourceId); TDeviceAlarm alarm = tDeviceAlarmMapper.selectTDeviceAlarmById(resourceId);
String deviceCode = alarm.getDeviceCode(); String deviceCode = alarm.getDeviceCode();
...@@ -122,12 +124,16 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -122,12 +124,16 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
workOrderVo.setAddress(pipe.getPipeAddr()); workOrderVo.setAddress(pipe.getPipeAddr());
} else { } else {
TDeviceInfo device = tDeviceInfoMapper.selectTDeviceInfoByCode(deviceCode); TDeviceInfo device = tDeviceInfoMapper.selectTDeviceInfoByCode(deviceCode);
workOrderVo.setLongitude(device.getLongitude()); if(device != null){
workOrderVo.setLatitude(device.getLatitude()); workOrderVo.setLongitude(device.getLongitude());
workOrderVo.setDeviceType(device.getDeviceType()); workOrderVo.setLatitude(device.getLatitude());
workOrderVo.setAddress(device.getDeviceAddr()); workOrderVo.setDeviceType(device.getDeviceType());
workOrderVo.setAddress(device.getDeviceAddr());
deviceInfoList.add(device);
}
} }
} }
workOrderVo.setDeviceInfoList(deviceInfoList);
List<TOrderFeedback> feedbackList = tOrderFeedbackMapper.selectTOrderFeedbackByOrderId(tWorkOrder.getOrderId()); List<TOrderFeedback> feedbackList = tOrderFeedbackMapper.selectTOrderFeedbackByOrderId(tWorkOrder.getOrderId());
if(feedbackList.size() != 0){ if(feedbackList.size() != 0){
...@@ -185,16 +191,34 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -185,16 +191,34 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
public int insertTWorkOrder(TWorkOrder tWorkOrder) throws Exception public int insertTWorkOrder(TWorkOrder tWorkOrder) throws Exception
{ {
String orderId = tWorkOrderMapper.getWorkOrderId(); String orderId = tWorkOrderMapper.getWorkOrderId();
int resourceId = tWorkOrder.getResourceId();
tWorkOrder.setOrderId(orderId); tWorkOrder.setOrderId(orderId);
tWorkOrder.setOrderStatus("0"); tWorkOrder.setOrderStatus("0");
tWorkOrder.setAllotTime(DateUtils.getNowDate()); tWorkOrder.setAllotTime(DateUtils.getNowDate());
int planId = tWorkOrder.getResourceId(); if("1".equals(tWorkOrder.getOrderType())){
// 修改巡检计划状态为已下发 // 修改巡检计划状态为已下发
TInspectionPlan plan = new TInspectionPlan(); TInspectionPlan plan = new TInspectionPlan();
plan.setPlanId(planId); plan.setPlanId(resourceId);
plan.setPlanStatus("1"); plan.setOrderId(orderId);
tInspectionPlanService.updateTInspectionPlan(plan); plan.setPlanStatus("1");
plan.setUpdateTime(DateUtils.getNowDate());
tInspectionPlanMapper.updateTInspectionPlan(plan);
} else if ("2".equals(tWorkOrder.getOrderType())) {
THiddenTrouble trouble = new THiddenTrouble();
trouble.setTroubleId(resourceId);
trouble.setOrderId(orderId);
trouble.setUpdateTime(DateUtils.getNowDate());
tHiddenTroubleMapper.updateTHiddenTrouble(trouble);
} else if ("3".equals(tWorkOrder.getOrderType())) {
TDeviceAlarm alarm = new TDeviceAlarm();
alarm.setAlarmId(resourceId);
alarm.setOrderId(orderId);
alarm.setUpdateTime(DateUtils.getNowDate());
tDeviceAlarmMapper.updateTDeviceAlarm(alarm);
}
return tWorkOrderMapper.insertTWorkOrder(tWorkOrder); return tWorkOrderMapper.insertTWorkOrder(tWorkOrder);
} }
...@@ -216,7 +240,8 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -216,7 +240,8 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
TInspectionPlan plan = new TInspectionPlan(); TInspectionPlan plan = new TInspectionPlan();
plan.setPlanId(planId); plan.setPlanId(planId);
plan.setPlanStatus("2"); plan.setPlanStatus("2");
tInspectionPlanService.updateTInspectionPlan(plan); plan.setUpdateTime(DateUtils.getNowDate());
tInspectionPlanMapper.updateTInspectionPlan(plan);
} else if ("4".equals(tWorkOrder.getOrderStatus())){ } else if ("4".equals(tWorkOrder.getOrderStatus())){
...@@ -226,7 +251,8 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -226,7 +251,8 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
TInspectionPlan plan = new TInspectionPlan(); TInspectionPlan plan = new TInspectionPlan();
plan.setPlanId(planId); plan.setPlanId(planId);
plan.setPlanStatus("3"); plan.setPlanStatus("3");
tInspectionPlanService.updateTInspectionPlan(plan); plan.setUpdateTime(DateUtils.getNowDate());
tInspectionPlanMapper.updateTInspectionPlan(plan);
} }
tWorkOrder.setUpdateTime(DateUtils.getNowDate()); tWorkOrder.setUpdateTime(DateUtils.getNowDate());
......
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