Commit 5ce8f322 authored by 王晓倩's avatar 王晓倩

解决新增巡检计划同时生成的巡检记录planId是null的问题

parent 9748d2c7
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TInspectionData;
import org.apache.ibatis.annotations.Param;
/**
* 巡检记录Mapper接口
......@@ -22,10 +24,11 @@ public interface TInspectionDataMapper
/**
* 查询巡检记录
*
* @param deviceId 设备id
* @param planId
* @param deviceId
* @return 巡检记录
*/
public TInspectionData selectTInspectionDataByDeviceId(int deviceId);
public TInspectionData selectTInspectionDataByDeviceId(@Param("planId")int planId, @Param("deviceId")int deviceId);
/**
* 查询巡检记录
......
......@@ -140,6 +140,11 @@ public class TInspectionPlanServiceImpl implements ITInspectionPlanService
@Override
public int insertTInspectionPlan(TInspectionPlan tInspectionPlan) throws Exception
{
tInspectionPlan.setPlanStatus("0");
tInspectionPlan.setCreateTime(DateUtils.getNowDate());
tInspectionPlanMapper.insertTInspectionPlan(tInspectionPlan);
int planId = tInspectionPlan.getPlanId();
String deviceIds = tInspectionPlan.getDeviceIds();
String[] stringArr = deviceIds.split("],");
String deviceType = null;
......@@ -158,7 +163,7 @@ public class TInspectionPlanServiceImpl implements ITInspectionPlanService
} else {
Integer deviceId = Integer.valueOf(m.replaceAll("").trim());
TInspectionData data = new TInspectionData();
data.setPlanId(tInspectionPlan.getPlanId());
data.setPlanId(planId);
data.setDeviceId(deviceId);
data.setDeviceType(deviceType);
data.setCreateTime(DateUtils.getNowDate());
......@@ -167,9 +172,7 @@ public class TInspectionPlanServiceImpl implements ITInspectionPlanService
}
}
}
tInspectionPlan.setPlanStatus("0");
tInspectionPlan.setCreateTime(DateUtils.getNowDate());
return tInspectionPlanMapper.insertTInspectionPlan(tInspectionPlan);
return 1;
}
/**
......
package com.zehong.system.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.*;
......@@ -25,6 +27,8 @@ public class TOrderFeedbackServiceImpl implements ITOrderFeedbackService
@Autowired
private TInspectionDataMapper tInspectionDataMapper;
@Autowired
private TInspectionPlanMapper tInspectionPlanMapper;
@Autowired
private THiddenTroubleMapper tHiddenTroubleMapper;
@Autowired
private TDeviceAlarmMapper tDeviceAlarmMapper;
......@@ -79,8 +83,11 @@ public class TOrderFeedbackServiceImpl implements ITOrderFeedbackService
String orderType = order.getOrderType();
if("1".equals(orderType)){
TInspectionPlan tInspectionPlan = tInspectionPlanMapper.selectTInspectionPlanById(order.getResourceId());
Integer planId = tInspectionPlan.getPlanId();
Integer deviceId = tOrderFeedback.getDeviceId();
TInspectionData data = tInspectionDataMapper.selectTInspectionDataByDeviceId(deviceId);
TInspectionData data = tInspectionDataMapper.selectTInspectionDataByDeviceId(planId, deviceId);
data.setDealStatus(dealStatus);
data.setIsHiddenDanger(isHiddenDanger);
data.setUpdateTime(DateUtils.getNowDate());
......
......@@ -43,9 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where data_id = #{dataId}
</select>
<select id="selectTInspectionDataByDeviceId" parameterType="int" resultMap="TInspectionDataResult">
<select id="selectTInspectionDataByDeviceId" parameterType="map" resultMap="TInspectionDataResult">
<include refid="selectTInspectionDataVo"/>
where device_id = #{deviceId}
where device_id = #{deviceId} and plan_id = #{planId}
</select>
<insert id="insertTInspectionData" parameterType="TInspectionData">
......
......@@ -168,10 +168,10 @@
</el-switch>
</el-form-item>
<el-form-item label="处理结果" prop="dealStatus" v-if="isHiddenDanger == true">
<el-radio-group v-model="form.dealStatus">
<el-radio :label="2">已处理完成</el-radio>
<el-radio :label="3">未处理完成</el-radio>
<el-radio :label="1">不需处理</el-radio>
<el-radio-group v-model="dealStatus">
<el-radio label="2">已处理完成</el-radio>
<el-radio label="3">未处理完成</el-radio>
<el-radio label="1">不需处理</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="反馈信息" prop="contents">
......@@ -200,6 +200,7 @@
data() {
return {
isHiddenDanger: false,
dealStatus: '2',
// 遮罩层
loading: true,
// 导出遮罩层
......@@ -311,6 +312,8 @@
dealStatus: null,
contents: null
};
this.isHiddenDanger = false;
this.dealStatus = '2';
this.resetForm("form");
},
/** 搜索按钮操作 */
......@@ -348,7 +351,6 @@
},
/** 反馈按钮操作 */
handleFeedback(row) {
this.open = true;
const orderId = row.orderId || this.ids
getBasicsInfo(orderId).then(response => {
this.form = response.data;
......@@ -372,6 +374,7 @@
} else {
this.form.isHiddenDanger = "1";
}
this.form.dealStatus = this.dealStatus;
this.$refs["form"].validate(valid => {
if (valid) {
if(this.form.orderStatus == '1' || this.form.orderStatus == '2'){
......
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