Browse Source

修改执行记录接口 删除单次/周期任务新增编辑时的关于name的参数的判断

pull/357/head
suqin 11 months ago
parent
commit
82e27123f0
7 changed files with 121 additions and 82 deletions
  1. +26
    -32
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Inspection.java
  2. +0
    -10
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/cycle/AddInspectionCycleRequest.java
  3. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspection/QueryInspectionPageListRequest.java
  4. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/cycle/add/AddInspectionCycleCheckParamService.java
  5. +6
    -5
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/cycle/update/EditInspectionCycleCheckParamService.java
  6. +14
    -16
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java
  7. +73
    -17
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml

+ 26
- 32
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Inspection.java View File

package com.tuoheng.admin.entity; package com.tuoheng.admin.entity;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.core.common.BaseEntity; import com.tuoheng.common.core.common.BaseEntity;
private String name; private String name;


/** /**
* 巡检任务类型 1:临时巡检 2:应急任务
* 巡检任务类型 1:临时巡检;2:应急巡检
*/ */
private Integer type; private Integer type;


/**
* 公路ID
*/
private String roadId;

/**
* 公路名称
*/
private String roadName;

/**
* 路段ID
*/
private String sectionId;

/**
* 路段名称
*/
private String sectionName;

/** /**
* 巡检方式类型 1 无人机 2机场巡逻 3飞手值飞 * 巡检方式类型 1 无人机 2机场巡逻 3飞手值飞
*/ */
private Integer droneId; private Integer droneId;


/** /**
* 巡检机场名称
* 公路ID
*/ */
private String airportName;
private String roadId;


/**
* 路段ID
*/
private String sectionId;
/** /**
* 巡检线路id * 巡检线路id
*/ */
private Integer inspectionLine; private Integer inspectionLine;


/** /**
* 巡检线路名称
* 航线长度
*/ */
private String inspectionLineName;
private Double airportLineLength;


/** /**
* 飞行设备 * 飞行设备
*/ */
private String equipmentMountName; private String equipmentMountName;




/** /**
* 5G云盒ID * 5G云盒ID
*/ */
private String flyHeight; private String flyHeight;


/** /**
* 飞行总时长(秒
* 飞行总里程(米
*/ */
private String flytime;
private String mileage;


/** /**
* 飞行总里程(米
* 飞行总时长(秒
*/ */
private String mileage;
private String flytime;


/** /**
* srt文件名称 * srt文件名称
private String patrolLocation; private String patrolLocation;


/** /**
* 应急任务关联数据任务ID
* 算法实例
*/
private String dspServiceInstId;

/**
* 应急任务数据关联任务ID
*/ */
private String emergencyDataInspectionId; private String emergencyDataInspectionId;


/**
* 创建人名称
*/
@TableField(exist = false)
private String createUserName;

} }

+ 0
- 10
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/cycle/AddInspectionCycleRequest.java View File

*/ */
private Integer airportId; private Integer airportId;


/**
* 巡检机场名称
*/
private Integer airportName;

/** /**
* 航线id * 航线id
*/ */
private Integer airportLineId; private Integer airportLineId;


/**
* 航线名称
*/
private Integer inspectionLineName;

/** /**
* 航线长度 * 航线长度
*/ */

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspection/QueryInspectionPageListRequest.java View File

/** /**
* 任务状态 * 任务状态
*/ */
private Integer status;
private List<Integer> statusList;


/** /**
* 巡检方式类型: 1 无人机 2机场巡逻 3 飞手值飞 * 巡检方式类型: 1 无人机 2机场巡逻 3 飞手值飞

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/cycle/add/AddInspectionCycleCheckParamService.java View File

} }


if(null == request.getAirportLineId()){ if(null == request.getAirportLineId()){
return JsonResult.error("航线id为空");
return JsonResult.error("巡检航线id为空");
} }


if ((ObjectUtil.isNotNull(request.getCycleStartTime()) && ObjectUtil.isNull(request.getCycleEndTime())) if ((ObjectUtil.isNotNull(request.getCycleStartTime()) && ObjectUtil.isNull(request.getCycleEndTime()))

+ 6
- 5
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/cycle/update/EditInspectionCycleCheckParamService.java View File

return JsonResult.error("巡检公路id为空"); return JsonResult.error("巡检公路id为空");
} }


if(null == request.getSectionId()) {
return JsonResult.error("巡检路段id为空");
}

if(StringUtils.isEmpty(request.getName())){ if(StringUtils.isEmpty(request.getName())){
return JsonResult.error("任务名称为空"); return JsonResult.error("任务名称为空");
} }


if(null == request.getSectionId()){
return JsonResult.error("巡检路段id为空");
}

if(null == request.getAirportId()){ if(null == request.getAirportId()){
return JsonResult.error("巡检机场id为空"); return JsonResult.error("巡检机场id为空");
} }


if(null == request.getAirportLineId()){ if(null == request.getAirportLineId()){
return JsonResult.error("航线id为空");
return JsonResult.error("巡检航线id为空");
} }



/** /**
* 周期性计划需要判断是否在循环开始时间和结束时间内 * 周期性计划需要判断是否在循环开始时间和结束时间内
*/ */

+ 14
- 16
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java View File

import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
} }


public JsonResult getPageList(QueryInspectionPageListRequest request) { public JsonResult getPageList(QueryInspectionPageListRequest request) {
// log.info("进入查询巡检任务分页列表业务");
log.info("进入查询巡检任务分页列表业务");
User user = CurrentUserUtil.getUserInfo(); User user = CurrentUserUtil.getUserInfo();
String userId = user.getId();
String tenantId = user.getTenantId(); String tenantId = user.getTenantId();
request.setTenantId(tenantId);

// 不查应急任务
request.setType(1);


JsonResult result = this.check(tenantId, request); JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) { if (0 != result.getCode()) {
return result; return result;
} }


Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>()
.eq(Dept::getTenantId, tenantId)
.eq(Dept::getId, user.getDeptId())
.eq(Dept::getMark, 1));

IPage<Inspection> pageData = null;
if(StringUtils.isEmpty(request.getDeptId())){
List<String> deptIdList = new ArrayList<>();
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) { if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
pageData = this.getAllList(request);
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) { } else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) {
pageData = this.getListByDept(request, user);
deptIdList = deptMapper.selectAllChildListById(user.getDeptId());
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) { } else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
pageData = this.getListByDept(request, user);
deptIdList.add(user.getDeptId());
}
request.setDeptIdList(deptIdList);
} }


request.setTenantId(tenantId);

IPage<Inspection> page = new Page<>(request.getPage(), request.getLimit());
IPage<Inspection> pageData = inspectionMapper.selectPageList(page, request);

if (null == pageData || pageData.getTotal() == 0) { if (null == pageData || pageData.getTotal() == 0) {
log.info("获取任务分页列表为空"); log.info("获取任务分页列表为空");
return JsonResult.success(pageData); return JsonResult.success(pageData);
} }


// 构造返回结果对象 // 构造返回结果对象
List<InspectionVo> inspectionVoList = this.buildIspectionVoList(user, dept, pageData.getRecords());
List<InspectionVo> inspectionVoList = this.buildIspectionVoList(user, null, pageData.getRecords());


// 重写返回结果对象 // 重写返回结果对象
IPage<InspectionVo> inspectionVoPageData = new Page<>(); IPage<InspectionVo> inspectionVoPageData = new Page<>();

+ 73
- 17
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml View File

<result property="emergencyDataInspectionId" column="emergency_data_inspection_id" /> <result property="emergencyDataInspectionId" column="emergency_data_inspection_id" />
<result property="mark" column="mark" /> <result property="mark" column="mark" />
</resultMap> </resultMap>

<resultMap id="ForeignResult" type="com.tuoheng.admin.entity.Inspection" extends="InspectionResult">
<result property="createUserName" column="create_user_name" />
</resultMap>
<!--
<sql id="Base_Column_list"> <sql id="Base_Column_list">
id, tenant_id, dept_id, code, name, type, road_id, road_name, section_id, section_name, inspection_type, id, tenant_id, dept_id, code, name, type, road_id, road_name, section_id, section_name, inspection_type,
inspectionCycleI, airport_task_id, airport_id, drone_id, airport_name, inspection_line, inspection_line_name,
inspectionCycleId, airport_task_id, airport_id, drone_id, airport_name, inspection_line, inspection_line_name,
equipment_id, equipment_name, equipment_mount_id, equipment_mount_name, cloud_box_id, cloud_box_name, box_sn, equipment_id, equipment_name, equipment_mount_id, equipment_mount_name, cloud_box_id, cloud_box_name, box_sn,
flight_hand, flight_hand_name, inspection_time, execution_start_time, execution_end_time, is_live, is_taken, is_tilt, flight_hand, flight_hand_name, inspection_time, execution_start_time, execution_end_time, is_live, is_taken, is_tilt,
video_url, ai_video_url, report_url, srt_url, status, analyse_status, progressbar, note, weather, video_url, ai_video_url, report_url, srt_url, status, analyse_status, progressbar, note, weather,
fly_height, flytime, mileage, srt_name, heartbeat_time, execution_status, fly_height, flytime, mileage, srt_name, heartbeat_time, execution_status,
start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location, start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location,
create_user, create_time, update_user, update_time, mark create_user, create_time, update_user, update_time, mark
</sql>-->

<sql id="Base_Column_list">
t.id, t.tenant_id, t.dept_id, t.code, t.name, t.type, t.inspection_type, t.inspection_cycle_id, t.airport_task_id,
t.airport_id, t.airport_name, t.drone_id, t.inspection_line, t.inspection_line_name, t.airport_line_length, t.equipment_id, t.equipment_name, t.equipment_mount_id,
t.equipment_mount_name, t.cloud_box_id, t.cloud_box_name, t.box_sn, t.flight_hand, t.flight_hand_name, t.inspection_time,
t.execution_start_time, t.execution_end_time, t.is_live, t.is_taken, t.is_tilt, t.video_url, t.ai_video_url, t.report_url, t.srt_url,
t.status, t.analyse_status, t.progressbar, t.note, t.weather, t.fly_height, t.mileage, t.flytime, t.srt_name, t.heartbeat_time, t.execution_status,
t.start_longitude, t.start_latitude, t.end_longitude, t.end_latitude, t.mobile, t.patrol_location, t.dsp_service_inst_id, t.emergency_data_inspection_id,
t.create_user, t.create_time, t.update_user, t.update_time, t.mark
</sql> </sql>


<sql id="selectInspectionVo"> <sql id="selectInspectionVo">
and tenant_id = #{tenantId} and tenant_id = #{tenantId}
</select> </select>


<select id="selectPageList" parameterType="com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest" resultMap="InspectionResult">
<include refid="selectInspectionVo"/>
<select id="selectPageList" parameterType="com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest" resultMap="ForeignResult">
select <include refid="Base_Column_list"/> ,u.realname as create_user_name
from th_inspection t
left join th_user u on u.id = t.create_user
<where> <where>
<if test="1 == 1"> and mark = 1 </if>
<if test="request.type != null and request.type != 0"> and type = #{request.type} </if>
<if test="request.code != null and request.code != ''"> and code like concat('%', #{request.code}, '%') </if>
<if test="request.tenantId != null and request.tenantId != ''"> and tenant_id = #{request.tenantId} </if>
<if test="request.airportId != null and request.airportId != 0"> and airport_id = #{request.airportId} </if>
<if test="request.inspectionLine != null and request.inspectionLine != 0"> and inspection_line = #{request.inspectionLine} </if>
<if test="request.type != null and request.type != 0"> and type = #{request.type} </if>
<if test="request.status != null and request.status != 0"> and status = #{request.status} </if>
<if test="request.inspectionType != null and request.inspectionType != 0"> and inspection_type = #{request.inspectionType} </if>
<if test="request.deptId != null and request.deptId != ''"> and dept_id = #{request.deptId} </if>
<if test="1 == 1"> and t.mark = 1 </if>
<if test="request.code != null and request.code != ''"> and t.code like concat('%', #{request.code}, '%') </if>
<if test="request.name != null and request.name != ''"> and t.name like concat('%', #{request.name}, '%') </if>
<if test="request.tenantId != null and request.tenantId != ''"> and t.tenant_id = #{request.tenantId} </if>
<if test="request.airportId != null and request.airportId != 0"> and t.airport_id = #{request.airportId} </if>
<if test="request.inspectionLine != null and request.inspectionLine != 0"> and t.inspection_line = #{request.inspectionLine} </if>
<if test="request.type != null and (request.type == 0 or request.type == 1)"> and t.type = #{request.type} </if>
<if test="request.inspectionType != null and request.inspectionType != 0"> and t.inspection_type = #{request.inspectionType} </if>
<if test="request.statusList != null and request.statusList.size() > 0">
and t.status in
<foreach item="status" collection="request.statusList" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="request.deptIdList != null and request.deptIdList.size() > 0"> <if test="request.deptIdList != null and request.deptIdList.size() > 0">
and dept_id in
and t.dept_id in
<foreach item="deptId" collection="request.deptIdList" open="(" separator="," close=")"> <foreach item="deptId" collection="request.deptIdList" open="(" separator="," close=")">
#{deptId} #{deptId}
</foreach> </foreach>
</if> </if>
-- 部门筛选
<if test="request.deptId != null and request.deptId !=''">
and t.dept_id = #{request.deptId}
</if>
<if test="request.inspectionTimeBegin != null and request.inspectionTimeBegin != ''">
and t.inspection_time &gt;= #{request.inspectionTimeBegin}
</if>
<if test="request.inspectionTimeEnd != null and request.inspectionTimeEnd != ''">
and t.inspection_time &lt;= #{request.inspectionTimeEnd}
</if>
<if test="request.executionTimeBegin != null and request.executionTimeBegin != ''">
and t.execution_start_time &gt;= #{request.executionTimeBegin}
</if>
<if test="request.executionTimeEnd != null and request.executionTimeEnd != ''">
and t.execution_start_time &lt;= #{request.executionTimeEnd}
</if>
<if test="request.inspectionCycleId != null and request.inspectionCycleId != ''">
and t.type = 0 and t.inspection_cycle_id = #{request.inspectionCycleId}
</if>
<choose>
<!-- 单次任务程序:只展示待执行(5)的单次任务 -->
<when test="request.singleTask != null and request.singleTask == 1">
and t.type = 1 and t.status = 5
</when>
<!-- 执行任务程序:只展示准备中(6)、飞行中(10)、飞行完成(15)、飞行失败(7)、已取消(16)的单次任务、周期任务子任务 -->
<otherwise>
and t.type in(0,1) and t.status in (6,10,15,7,16)
</otherwise>
</choose>
</where> </where>
order by create_time desc
<choose>
<!-- 单次任务程序:按创建时间倒序排 -->
<when test="request.singleTask != null and request.singleTask == 1">
order by t.create_time desc
</when>
<!-- 执行任务程序:按实际巡检时间倒序排,null为后 -->
<otherwise>
order by t.execution_start_time desc
</otherwise>
</choose>
</select> </select>

<!-- 根据云盒ID查询执行中的巡检任务--> <!-- 根据云盒ID查询执行中的巡检任务-->
<select id="getListByBox" resultType="com.tuoheng.admin.entity.Inspection"> <select id="getListByBox" resultType="com.tuoheng.admin.entity.Inspection">
<include refid="selectInspectionVo"/> <include refid="selectInspectionVo"/>

Loading…
Cancel
Save