Browse Source

fix: 巡检任务页面添加巡检时长信息

zhongwei
liwen 10 months ago
parent
commit
c7823e6ee6
  1. 18
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml
  2. 5
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java
  3. 3
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskVo.java

18
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml

@ -180,9 +180,10 @@
order by t.UPDATE_TIME desc order by t.UPDATE_TIME desc
</select> </select>
<select id="getAllPageList" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo"> <select id="getAllPageList" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo">
SELECT t.*,u.USER_ID as userIds,u.USER_NAME from HZ_ST_EX_TASK t SELECT t.*,u.USER_ID as userIds,u.USER_NAME as userNames
LEFT JOIN HZ_ST_EX_TASK_USER u on t.ID=u.TASK_ID from
and u.IS_DELETED=0 HZ_ST_EX_TASK t
LEFT JOIN HZ_ST_EX_TASK_USER u on t.ID=u.TASK_ID and u.IS_DELETED=0
where t.IS_DELETED=0 where t.IS_DELETED=0
<if test="task.userId != null "> <if test="task.userId != null ">
and u.USER_ID=#{task.userId} and u.USER_ID=#{task.userId}
@ -191,12 +192,15 @@
order by t.UPDATE_TIME desc order by t.UPDATE_TIME desc
</select> </select>
<select id="getAllExportList" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo"> <select id="getAllExportList" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo">
SELECT t.*,b.USER_ID as userIds,(SELECT group_concat(u .user_name) FROM HZ_ST_EX_TASK_USER u WHERE t.ID=u.TASK_ID SELECT
t.*, b.USER_ID as userIds,
(SELECT group_concat(u.user_name) FROM HZ_ST_EX_TASK_USER u WHERE t.ID=u.TASK_ID
<if test="task.userId != null "> <if test="task.userId != null ">
and u.USER_ID=#{task.userId} and u.USER_ID=#{task.userId}
</if>) AS userNames from HZ_ST_EX_TASK t </if>) AS userNames
LEFT JOIN HZ_ST_EX_TASK_USER b on t.ID=b.TASK_ID from
and b.IS_DELETED=0 HZ_ST_EX_TASK t
LEFT JOIN HZ_ST_EX_TASK_USER b on t.ID=b.TASK_ID and b.IS_DELETED=0
where t.IS_DELETED=0 where t.IS_DELETED=0
<if test="task.userId != null "> <if test="task.userId != null ">
and u.USER_ID=#{task.userId} and u.USER_ID=#{task.userId}

5
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java

@ -538,6 +538,11 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
taskVo.setRobot(robotService.getDetailByUserId(taskVo.getUserId())); taskVo.setRobot(robotService.getDetailByUserId(taskVo.getUserId()));
} }
} }
// 巡检时长计算
if (ObjectUtil.isNotEmpty(taskVo.getStartTime()) && ObjectUtil.isNotEmpty(taskVo.getEndTime())) {
long inspectTime = DateUtil.between(taskVo.getStartTime(), taskVo.getEndTime()).toMinutes();
taskVo.setInspectTime(Optional.of(inspectTime).orElse(0L));
}
return taskVo; return taskVo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
pages.setRecords(list); pages.setRecords(list);

3
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/vo/TaskVo.java

@ -29,4 +29,7 @@ public class TaskVo extends TaskEntity {
@ApiModelProperty("执行名称,按逗号分隔") @ApiModelProperty("执行名称,按逗号分隔")
private String userNames; private String userNames;
@ApiModelProperty("巡检时长/分钟")
private Long inspectTime;
} }

Loading…
Cancel
Save