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

工单基础信息

parent 59db1e79
...@@ -5,15 +5,13 @@ import java.util.List; ...@@ -5,15 +5,13 @@ import java.util.List;
import com.zehong.common.core.domain.entity.SysUser; import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.ExceptionUtil; import com.zehong.system.domain.*;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.vo.WorkOrderVo; import com.zehong.system.domain.vo.WorkOrderVo;
import com.zehong.system.mapper.SysUserMapper; 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;
import com.zehong.system.mapper.TWorkOrderMapper;
import com.zehong.system.domain.TWorkOrder;
import com.zehong.system.service.ITWorkOrderService; import com.zehong.system.service.ITWorkOrderService;
/** /**
...@@ -29,17 +27,21 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -29,17 +27,21 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
private TWorkOrderMapper tWorkOrderMapper; private TWorkOrderMapper tWorkOrderMapper;
@Autowired @Autowired
private SysUserMapper sysUserMapper; private SysUserMapper sysUserMapper;
@Autowired
private TInspectionDataMapper tInspectionDataMapper;
@Autowired
private TInspectionPlanMapper tInspectionPlanMapper;
@Autowired
private THiddenTroubleMapper tHiddenTroubleMapper;
@Autowired
private TDeviceAlarmMapper tDeviceAlarmMapper;
@Autowired
private TPipeMapper tPipeMapper;
@Autowired
private TDeviceInfoMapper tDeviceInfoMapper;
/** @Autowired
* 获取工单基础信息id private ITInspectionPlanService tInspectionPlanService;
*
* @return 工单基础信息id
*/
@Override
public String getWorkOrderId()
{
return tWorkOrderMapper.getWorkOrderId();
}
/** /**
* 查询工单基础信息 * 查询工单基础信息
...@@ -68,14 +70,48 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -68,14 +70,48 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
// 获取源数据(1巡检信息,2隐患信息,3报警信息) // 获取源数据(1巡检信息,2隐患信息,3报警信息)
String orderType = tWorkOrder.getOrderType(); String orderType = tWorkOrder.getOrderType();
int resourceId = tWorkOrder.getResourceId();
if("1".equals(orderType)){ if("1".equals(orderType)){
} else if("2".equals(orderType)) { TInspectionPlan plan = tInspectionPlanMapper.selectTInspectionPlanById(resourceId);
workOrderVo.setDeviceIds(plan.getDeviceCodes());
TInspectionData data = new TInspectionData();
data.setPlanId(resourceId);
List<TInspectionData> totalList = tInspectionDataMapper.selectTInspectionDataList(data);
workOrderVo.setDeviceNum(totalList.size());
int finish = tInspectionDataMapper.selectFinishTInspectionData(resourceId);
workOrderVo.setFinishNum(finish);
} else if("2".equals(orderType)){
THiddenTrouble trouble = tHiddenTroubleMapper.selectTHiddenTroubleById(resourceId);
workOrderVo.setDeviceIds((trouble.getDeviceCode() != null ? trouble.getDeviceCode() : null).toString());
workOrderVo.setLongitude(trouble.getLongitude() != null ? trouble.getLongitude() : null);
workOrderVo.setLatitude(trouble.getLatitude() != null ? trouble.getLatitude() : null);
workOrderVo.setCoordinates(trouble.getCoordinates() != null ? trouble.getCoordinates() : null);
workOrderVo.setDeviceType(trouble.getDeviceType());
} else { } else {
TDeviceAlarm alarm = tDeviceAlarmMapper.selectTDeviceAlarmById(resourceId);
String deviceCode = alarm.getDeviceCode();
workOrderVo.setDeviceIds(String.valueOf(deviceCode));
String isPipe = alarm.getIsPipe();
if("0".equals(isPipe)){
TPipe pipe = tPipeMapper.selectTPipeByCode(deviceCode);
workOrderVo.setCoordinates(pipe.getCoordinates());
workOrderVo.setDeviceType("0");
} else {
TDeviceInfo device = tDeviceInfoMapper.selectTDeviceInfoByCode(deviceCode);
workOrderVo.setLongitude(device.getLongitude());
workOrderVo.setLatitude(device.getLatitude());
workOrderVo.setDeviceType(device.getDeviceType());
} }
}
return workOrderVo; return workOrderVo;
} }
...@@ -124,9 +160,17 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -124,9 +160,17 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
public int insertTWorkOrder(TWorkOrder tWorkOrder) public int insertTWorkOrder(TWorkOrder tWorkOrder)
{ {
String orderId = tWorkOrderMapper.getWorkOrderId(); String orderId = tWorkOrderMapper.getWorkOrderId();
tWorkOrder.setOrderId(orderId); tWorkOrder.setOrderId(orderId);
tWorkOrder.setOrderStatus("0");
tWorkOrder.setCreateTime(DateUtils.getNowDate()); tWorkOrder.setCreateTime(DateUtils.getNowDate());
int planId = tWorkOrder.getResourceId();
// 修改巡检计划状态为已下发
TInspectionPlan plan = new TInspectionPlan();
plan.setPlanId(planId);
plan.setPlanStatus("1");
tInspectionPlanService.updateTInspectionPlan(plan);
return tWorkOrderMapper.insertTWorkOrder(tWorkOrder); return tWorkOrderMapper.insertTWorkOrder(tWorkOrder);
} }
...@@ -139,6 +183,27 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService ...@@ -139,6 +183,27 @@ public class TWorkOrderServiceImpl implements ITWorkOrderService
@Override @Override
public int updateTWorkOrder(TWorkOrder tWorkOrder) public int updateTWorkOrder(TWorkOrder tWorkOrder)
{ {
if("1".equals(tWorkOrder.getOrderStatus())){
TWorkOrder order = tWorkOrderMapper.selectTWorkOrderById(tWorkOrder.getOrderId());
int planId = order.getResourceId();
// 修改巡检计划状态为进行中
TInspectionPlan plan = new TInspectionPlan();
plan.setPlanId(planId);
plan.setPlanStatus("2");
tInspectionPlanService.updateTInspectionPlan(plan);
} else if ("4".equals(tWorkOrder.getOrderStatus())){
TWorkOrder order = tWorkOrderMapper.selectTWorkOrderById(tWorkOrder.getOrderId());
int planId = order.getResourceId();
// 修改巡检计划状态为已完成
TInspectionPlan plan = new TInspectionPlan();
plan.setPlanId(planId);
plan.setPlanStatus("3");
tInspectionPlanService.updateTInspectionPlan(plan);
}
return tWorkOrderMapper.updateTWorkOrder(tWorkOrder); return tWorkOrderMapper.updateTWorkOrder(tWorkOrder);
} }
......
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