手持设备保养和设备巡检修改

master
马雪伟 1 week ago
parent 105e2a0780
commit 9c88db4ef7

@ -109,7 +109,7 @@ public class DmsBillsInspectInstanceController extends BaseController
// 使用 replaceAll 方法将双引号替换为空字符串
String result = dmsBillsInstanceId.replaceAll("\"", "");
DmsPlanInspect dmsPlanInspect = dmsPlanInspectService.selectDmsPlanInspectByPlanInspectId(Long.valueOf(result));
DmsPlanInspect dmsPlanInspect = dmsPlanInspectService.selectDmsPlanInspectByPlanInspectId1(dmsBillsInstanceId);
DmsBillsInspectInstance dmsBillsInspectInstance = new DmsBillsInspectInstance();

@ -1,6 +1,9 @@
package com.hw.dms.mapper;
import java.util.List;
import com.hw.dms.domain.DmsBaseMaintProject;
import com.hw.dms.domain.DmsBaseMaintStation;
import com.hw.dms.domain.DmsBillsMaintDetail;
/**
@ -75,4 +78,9 @@ public interface DmsBillsMaintDetailMapper
*/
public List<DmsBillsMaintDetail> selectDmsBillsMaintDetailJoinList(DmsBillsMaintDetail dmsBillsMaintDetail);
List<DmsBillsMaintDetail> selectDetailList(Long maintInstanceId);
DmsBaseMaintStation selectMainStation(Long stationId);
List<DmsBaseMaintProject> selectPrjectIds(Long stationId);
}

@ -1,8 +1,10 @@
package com.hw.dms.mapper;
import java.util.ArrayList;
import java.util.List;
import com.hw.dms.domain.DmsBillsMaintDetail;
import com.hw.dms.domain.DmsBillsMaintDetailProject;
import com.hw.dms.domain.DmsBillsMaintInstance;
/**
@ -78,4 +80,7 @@ public interface DmsBillsMaintInstanceMapper {
* @return
*/
public DmsBillsMaintInstance selectNewestDmsBillsMaintInstance(DmsBillsMaintInstance dmsBillsMaintInstance);
int batchDmsProject(List<DmsBillsMaintDetailProject> list);
}

@ -80,4 +80,5 @@ public interface DmsInspectInstanceDetailMapper
public DmsInspectInstanceDetail selectDmsInspectInstanceDetailByUI(@Param("inspectInstanceId") Long inspectInstanceId,
@Param("deviceCode") String deviceCode);
Long selectProjectId(String inspectStandard);
}

@ -80,4 +80,5 @@ public interface DmsInspectInstanceDetailProjectMapper
* */
List<DmsInspectInstanceDetailProject> selectDmsInspectInstanceDetailProjectByInspectInstanceId(@Param("inspectInstanceId") Long inspectInstanceId, @Param("lineStep") Long lineStep);
Long selectProjectByStandardId(String inspectStandard);
}

@ -60,5 +60,6 @@ public interface DmsPlanInspectMapper
public int deleteDmsPlanInspectByPlanInspectIds(Long[] planInspectIds);
DmsPlanInspect selectPlanInspectJoinJobByInspectId(Long planInspectId);
DmsPlanInspect selectPlanInspectJoinJobByInspectId1(String planInspectId);
}

@ -19,6 +19,8 @@ public interface DmsPlanMaintDetailMapper
*/
public DmsPlanMaintDetail selectDmsPlanMaintDetailByPlanMaintDetailId(Long planMaintDetailId);
public Long selectStationIdByCode(String maintStationCode);
/**
*
*

@ -20,6 +20,7 @@ public interface IDmsPlanInspectService
* @return
*/
public DmsPlanInspect selectDmsPlanInspectByPlanInspectId(Long planInspectId);
public DmsPlanInspect selectDmsPlanInspectByPlanInspectId1(String planInspectId);
/**
*

@ -128,18 +128,18 @@ public class DmsBillsInspectInstanceServiceImpl implements IDmsBillsInspectInsta
dmsInspectInstanceDetail.setInstanceDetailStatus("1");
dmsInspectInstanceDetail.setInspectStandard(dmsInspectRouteDetail.getInspectStandard());
dmsInspectInstanceDetailMapper.insertDmsInspectInstanceDetail(dmsInspectInstanceDetail);
Long projectId = dmsInspectInstanceDetailMapper.selectProjectId(dmsInspectRouteDetail.getInspectStandard());
DmsInspectProjectDevice queryInspectProjectDevice = new DmsInspectProjectDevice();
queryInspectProjectDevice.setTargetType("2");
queryInspectProjectDevice.setTargetId(deviceId);
List<DmsInspectProjectDevice> dmsInspectProjectDevices = dmsInspectProjectDeviceMapper.selectDmsInspectProjectDeviceList(queryInspectProjectDevice);
for(DmsInspectProjectDevice dmsInspectProjectDevice:dmsInspectProjectDevices){
// for(DmsInspectProjectDevice dmsInspectProjectDevice:dmsInspectProjectDevices){
DmsInspectInstanceDetailProject dmsInspectInstanceDetailProject = new DmsInspectInstanceDetailProject();
dmsInspectInstanceDetailProject.setInstanceDetailId(dmsInspectInstanceDetail.getInstanceDetailId());
dmsInspectInstanceDetailProject.setInspectProjectId(dmsInspectProjectDevice.getInspectProjectId());
dmsInspectInstanceDetailProject.setInspectProjectId(projectId);
dmsInspectInstanceDetailProject.setCreateTime(new Date());
dmsInspectInstanceDetailProjectMapper.insertDmsInspectInstanceDetailProject(dmsInspectInstanceDetailProject);
}
// }
}
@ -245,10 +245,12 @@ public class DmsBillsInspectInstanceServiceImpl implements IDmsBillsInspectInsta
if (dmsInspectInstanceDetail == null) {
throw new ServiceException("无此设备的检查工单");
}
Long deviceId = dmsInspectInstanceDetail.getDeviceId();
DmsInspectInstanceDetailProject queryInspectInstanceDetailProject = new DmsInspectInstanceDetailProject();
queryInspectInstanceDetailProject.setDeviceId(deviceId);
Long projectId = dmsInspectInstanceDetailPrjectMapper.selectProjectByStandardId(dmsInspectInstanceDetail.getInspectStandard());
queryInspectInstanceDetailProject.setInspectProjectId(projectId);
queryInspectInstanceDetailProject.setInstanceDetailId(dmsInspectInstanceDetail.getInstanceDetailId());
List<DmsInspectInstanceDetailProject> dmsInspectInstanceDetailProjects = dmsInspectInstanceDetailPrjectMapper.selectDmsInspectInstanceDetailProjectJoinList(queryInspectInstanceDetailProject);
dmsInspectInstanceDetail.setDmsInspectInstanceDetailProjectList(dmsInspectInstanceDetailProjects);

@ -113,10 +113,28 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS
dmsBillsMaintDetail.setStationId(planMaintDetail.getMaintStationId());
dmsBillsMaintDetail.setMaintStandardId(planMaintDetail.getMaintStandardId());
dmsBillsMaintDetail.setIsFlag(1L);
dmsBillsMaintDetail.setMaintStatus(1L);
billsMaintDetails.add(dmsBillsMaintDetail);
});
dmsBillsMaintInstanceMapper.batchDmsBillsMaintDetail(billsMaintDetails);
ArrayList<DmsBillsMaintDetailProject> list1 = new ArrayList<>();
List<DmsBillsMaintDetail> list = dmsBillsMaintDetailMapper.selectDetailList(maintInstanceId);
for (DmsBillsMaintDetail detail : list) {
List<DmsBaseMaintProject> projects = dmsBillsMaintDetailMapper.selectPrjectIds(detail.getStationId());
for (DmsBaseMaintProject project : projects) {
DmsBillsMaintDetailProject project1 = new DmsBillsMaintDetailProject();
project1.setBillsMaintDetailId(detail.getBillsMaintDetailId());
// DmsBaseMaintStation station = dmsBillsMaintDetailMapper.selectMainStation(detail.getStationId());
project1.setMaintProjectId(project.getMaintProjectId());
project1.setMaintProjectName(project.getMaintProjectName());
project1.setMaintProjectDesc(project.getMaintProjectDesc());
project1.setMaintProjectStatus("2");
list1.add(project1);
}
}
dmsBillsMaintInstanceMapper.batchDmsProject(list1);
}
@Override

@ -53,6 +53,21 @@ public class DmsPlanInspectServiceImpl implements IDmsPlanInspectService
Long days = timeLimit / (24 * 60 * 60l);
Long hours = timeLimit % (24 * 60 * 60l);
// System.out.println(days);
// System.out.println(hours);
dmsPlanInspect.setTimeLimitDays(days);
dmsPlanInspect.setTimeLimitHours(hours / (60 * 60l));
}
return dmsPlanInspect;
}
@Override
public DmsPlanInspect selectDmsPlanInspectByPlanInspectId1(String planInspectId)
{
DmsPlanInspect dmsPlanInspect = dmsPlanInspectMapper.selectPlanInspectJoinJobByInspectId1(planInspectId);
Long timeLimit = dmsPlanInspect.getTimeLimit();
if (timeLimit != null) {
Long days = timeLimit / (24 * 60 * 60l);
Long hours = timeLimit % (24 * 60 * 60l);
// System.out.println(days);
// System.out.println(hours);
dmsPlanInspect.setTimeLimitDays(days);
dmsPlanInspect.setTimeLimitHours(hours / (60 * 60l));

@ -60,6 +60,8 @@ public class DmsPlanMaintDetailServiceImpl implements IDmsPlanMaintDetailService
dmsPlanMaintDetail.setCreateBy(SecurityUtils.getUsername());
dmsPlanMaintDetail.setCreateTime(DateUtils.getNowDate());
dmsPlanMaintDetail.setIsFlag(1l);
Long stationId = dmsPlanMaintDetailMapper.selectStationIdByCode(dmsPlanMaintDetail.getMaintStationCode());
dmsPlanMaintDetail.setMaintStationId(stationId);
return dmsPlanMaintDetailMapper.insertDmsPlanMaintDetail(dmsPlanMaintDetail);
}
@ -74,6 +76,8 @@ public class DmsPlanMaintDetailServiceImpl implements IDmsPlanMaintDetailService
{
dmsPlanMaintDetail.setUpdateBy(SecurityUtils.getUsername());
dmsPlanMaintDetail.setUpdateTime(DateUtils.getNowDate());
Long stationId = dmsPlanMaintDetailMapper.selectStationIdByCode(dmsPlanMaintDetail.getMaintStationCode());
dmsPlanMaintDetail.setMaintStationId(stationId);
return dmsPlanMaintDetailMapper.updateDmsPlanMaintDetail(dmsPlanMaintDetail);
}

@ -148,5 +148,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="maintStatus != null "> and dbmd.maint_status = #{maintStatus}</if>
</where>
</select>
<select id="selectDetailList" resultType="com.hw.dms.domain.DmsBillsMaintDetail"
parameterType="java.lang.Long">
select * from dms_bills_maint_detail where maint_instance_id = #{maintInstanceId}
</select>
<select id="selectMainStation" resultType="com.hw.dms.domain.DmsBaseMaintStation"
parameterType="java.lang.Long">
select * from dms_base_maint_station where maint_station_id = #{stationId}
</select>
<select id="selectPrjectIds" resultType="com.hw.dms.domain.DmsBaseMaintProject">
SELECT x.maint_project_id,a.maint_project_name,a.maint_project_desc FROM dms_base_station_project x left join dms_base_maint_project a on x.maint_project_id = a.maint_project_id
where x.maint_station_id = #{stationId}
</select>
</mapper>

@ -137,6 +137,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
( #{item.billsMaintDetailId}, #{item.maintInstanceId}, #{item.deviceId}, #{item.stationId}, #{item.maintStandardId}, #{item.operationDescription}, #{item.maintStatus}, #{item.isFlag}, #{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
<insert id="batchDmsProject">
insert into dms_bills_maint_detail_project( bills_maint_detail_id, maint_project_id, maint_project_name, maint_project_desc, maint_project_status, remark, create_by, create_time, update_by, update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.billsMaintDetailId}, #{item.maintProjectId}, #{item.maintProjectName}, #{item.maintProjectDesc}, #{item.maintProjectStatus}, #{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
<select id="selectNewestDmsBillsMaintInstance" parameterType="DmsBillsMaintInstance" resultMap="DmsBillsMaintInstanceResult">
select dbmi.maint_instance_id, dbmi.plan_maint_id, dbmi.wf_process_id, dbmi.bills_maint_code, dbmi.plan_begin_time, dbmi.real_begin_time,

@ -138,4 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where diid.inspect_instance_id = #{inspectInstanceId} and dbdl.device_code = #{deviceCode}
limit 1
</select>
<select id="selectProjectId" resultType="java.lang.Long" parameterType="java.lang.String">
SELECT x.inspect_project_id FROM `hwjy-cloud`.dms_base_inspect_standard x where x.inspect_standard_id = #{inspectStandard}
</select>
</mapper>

@ -130,18 +130,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDmsInspectInstanceDetailProjectJoinList" parameterType="DmsInspectInstanceDetailProject" resultMap="DmsInspectInstanceDetailProjectResult">
<include refid="selectDmsInspectInstanceDetailProjectJoinVo"/>
<where>
<if test="deviceId != null "> and exists (select 1 from dms_inspect_project_device dipd where dipd.target_type=2
and dipd.target_id = #{deviceId} and dipd.inspect_project_id = dbip.inspect_project_id)</if>
<if test="instanceDetailId != null "> and instance_detail_id = #{instanceDetailId}</if>
<if test="inspectProjectId != null "> and inspect_project_id = #{inspectProjectId}</if>
<if test="inspectProjectStatus != null and inspectProjectStatus != ''"> and inspect_project_status = #{inspectProjectStatus}</if>
<if test="inspectProjectResult != null "> and inspect_project_result = #{inspectProjectResult}</if>
<if test="projectStepOrder != null "> and project_step_order = #{projectStepOrder}</if>
<if test="defValue != null "> and def_value = #{defValue}</if>
<if test="inspectProjectName != null and inspectProjectName != ''"> and inspect_project_name like concat('%', #{inspectProjectName}, '%')</if>
<if test="inspectProjectProperty != null and inspectProjectProperty != ''"> and inspect_project_property = #{inspectProjectProperty}</if>
<if test="upLimit != null "> and up_limit = #{upLimit}</if>
<if test="lowLimit != null "> and low_limit = #{lowLimit}</if>
dbip.inspect_project_id = #{inspectProjectId} and diidp.instance_detail_id = #{instanceDetailId}
<!-- <if test="deviceId != null "> and exists (select 1 from dms_inspect_project_device dipd where dipd.target_type=2-->
<!-- and dipd.target_id = #{deviceId} and dipd.inspect_project_id = dbip.inspect_project_id)</if>-->
<!-- <if test="instanceDetailId != null "> and instance_detail_id = #{instanceDetailId}</if>-->
<!-- <if test="inspectProjectId != null "> and inspect_project_id = #{inspectProjectId}</if>-->
<!-- <if test="inspectProjectStatus != null and inspectProjectStatus != ''"> and inspect_project_status = #{inspectProjectStatus}</if>-->
<!-- <if test="inspectProjectResult != null "> and inspect_project_result = #{inspectProjectResult}</if>-->
<!-- <if test="projectStepOrder != null "> and project_step_order = #{projectStepOrder}</if>-->
<!-- <if test="defValue != null "> and def_value = #{defValue}</if>-->
<!-- <if test="inspectProjectName != null and inspectProjectName != ''"> and inspect_project_name like concat('%', #{inspectProjectName}, '%')</if>-->
<!-- <if test="inspectProjectProperty != null and inspectProjectProperty != ''"> and inspect_project_property = #{inspectProjectProperty}</if>-->
<!-- <if test="upLimit != null "> and up_limit = #{upLimit}</if>-->
<!-- <if test="lowLimit != null "> and low_limit = #{lowLimit}</if>-->
</where>
</select>
@ -150,5 +151,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where instance_detail_id =(
select instance_detail_id from dms_inspect_instance_detail where inspect_instance_id = #{inspectInstanceId} and line_step = #{lineStep})
</select>
<select id="selectProjectByStandardId" resultType="java.lang.Long" parameterType="java.lang.String">
SELECT x.inspect_project_id FROM `hwjy-cloud`.dms_base_inspect_standard x where x.inspect_standard_id = 6
</select>
</mapper>

@ -135,5 +135,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectPlanInspectJoinJobByInspectId1" resultType="com.hw.dms.domain.DmsPlanInspect"
parameterType="java.lang.String">
select a.plan_inspect_id, a.plan_inspect_code, a.plan_inspect_name, a.inspect_type,
a.inspect_route_id, a.device_amount, a.plan_time, a.cycle_period,a.time_limit,a.job_id,
a.performer, a.is_flag, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,b.cron_expression from dms_plan_inspect a
left join sys_job b on a.job_id = b.job_id
where a.plan_inspect_code = #{planInspectId}
</select>
</mapper>

@ -41,8 +41,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectDmsPlanMaintDetailByPlanMaintDetailId" parameterType="Long" resultMap="DmsPlanMaintDetailResult">
<include refid="selectDmsPlanMaintDetailVo"/>
where plan_maint_detail_id = #{planMaintDetailId}
<!-- <include refid="selectDmsPlanMaintDetailVo"/>-->
select a.plan_maint_detail_id, a.plan_maint_id, a.device_id, a.maint_station_id, a.maint_standard_id, a.operation_description, a.is_flag, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,b.maint_station_code
from dms_plan_maint_detail a left join dms_base_maint_station b on a.maint_station_id = b.maint_station_id
where a.plan_maint_detail_id = #{planMaintDetailId}
</select>
<insert id="insertDmsPlanMaintDetail" parameterType="DmsPlanMaintDetail" useGeneratedKeys="true" keyProperty="planMaintDetailId">
@ -117,7 +119,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select dpmd.plan_maint_detail_id, dpmd.plan_maint_id, dpmd.device_id, dpmd.maint_station_id, dpmd.maint_standard_id,
dpmd.operation_description, dpmd.is_flag, dpmd.remark,
dbmsd.maint_protocol,
dbms.maint_station_name
dbms.maint_station_name,
dbms.maint_station_code
from dms_plan_maint_detail dpmd
left join dms_base_maint_standard dbmsd on dpmd.maint_standard_id=dbmsd.maint_standard_id
left join dms_base_maint_station dbms on dpmd.maint_station_id=dbms.maint_station_id
@ -143,5 +146,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join dms_base_maint_standard d on a.maint_station_id = d.maint_standard_id
where a.plan_maint_id = #{planMaintId}
</select>
<select id="selectStationIdByCode" resultType="java.lang.Long" parameterType="java.lang.String">
SELECT x.maint_station_id FROM `hwjy-cloud`.dms_base_maint_station x where x.maint_station_code = #{maintStationCode}
</select>
</mapper>

Loading…
Cancel
Save