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

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

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