@@ -68,4 +68,15 @@ public class InspectAppController extends ApiBaseController { | |||
return inspectAppService.getInspectList(inspectListQuery); | |||
} | |||
/** | |||
* 获取巡检记录详情 | |||
* | |||
* @param id 巡检记录ID | |||
* @return | |||
*/ | |||
@GetMapping("/getInspectInfo/{id}") | |||
public Response getInspectInfo(@PathVariable("id") Integer id) { | |||
return inspectAppService.getInspectInfo(id); | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
package com.taauav.api.controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import com.taauav.api.controller.ApiBaseController; | |||
/** | |||
* <p> | |||
* 巡河坐标 前端控制器 | |||
* </p> | |||
* | |||
* @author zongjl | |||
* @since 2020-08-20 | |||
*/ | |||
@RestController | |||
@RequestMapping("/user/inspectapppoint") | |||
public class InspectAppPointController extends ApiBaseController { | |||
} |
@@ -28,4 +28,11 @@ public interface InspectAppMapper extends BaseMapper<TauvInspectApp> { | |||
*/ | |||
IPage<InspectListVo> getInspectList(IPage<InspectListVo> page, @RequestParam("param") InspectListQuery param); | |||
/** | |||
* 获取巡检记录详情 | |||
* | |||
* @param inspectId 巡检任务ID | |||
* @return | |||
*/ | |||
InspectListVo getInspectInfo(@RequestParam("inspectId") Integer inspectId); | |||
} |
@@ -11,4 +11,13 @@ | |||
WHERE a.mark=1 AND d.mark=1 AND u.mark=1 | |||
</select> | |||
<!-- 获取巡检记录详情 --> | |||
<select id="getInspectInfo" parameterType="java.lang.Integer" resultType="com.taauav.api.vo.InspectListVo"> | |||
SELECT a.id as 'inspectId',i.id as 'inspectDriverId',a.inspect_no as 'inspectNo',a.driver_id AS 'driverId',d.`name` AS 'driverName',d.driver_area AS 'driverArea',a.begin_time AS 'beginTime',a.end_time AS 'endTime',u.realname,(SELECT TIMESTAMPDIFF( MINUTE,a.begin_time,NOW())) AS 'timeUse' FROM tauv_inspect_app AS a | |||
INNER JOIN tauv_inspect_driver AS i ON i.inspect_id=a.id | |||
INNER JOIN tauv_driver AS d ON a.driver_id=d.id | |||
INNER JOIN user_admin AS u ON a.create_user=u.id | |||
WHERE a.id=#{inspectId} AND a.mark=1 AND d.mark=1 AND u.mark=1 | |||
</select> | |||
</mapper> |
@@ -0,0 +1,16 @@ | |||
package com.taauav.api.mapper; | |||
import com.taauav.admin.entity.TauvInspectAppPoint; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* 巡河坐标 Mapper 接口 | |||
* </p> | |||
* | |||
* @author zongjl | |||
* @since 2020-08-20 | |||
*/ | |||
public interface InspectAppPointMapper extends BaseMapper<TauvInspectAppPoint> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.api.mapper.InspectAppPointMapper"> | |||
</mapper> |
@@ -2,6 +2,10 @@ package com.taauav.api.mapper; | |||
import com.taauav.api.entity.TauvInspectLogs; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.taauav.api.vo.InspectLogsListVo; | |||
import org.springframework.web.bind.annotation.RequestParam; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
@@ -13,4 +17,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
*/ | |||
public interface InspectLogsMapper extends BaseMapper<TauvInspectLogs> { | |||
/** | |||
* 获取巡检日志列表 | |||
* | |||
* @param inspectDriverId 巡检任务ID | |||
* @return | |||
*/ | |||
List<InspectLogsListVo> getInspectLogsList(@RequestParam("inspectDriverId") Integer inspectDriverId); | |||
} |
@@ -2,4 +2,11 @@ | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.api.mapper.InspectLogsMapper"> | |||
<!-- 获取巡检日志列表 --> | |||
<select id="getInspectLogsList" parameterType="java.lang.Integer" resultType="com.taauav.api.vo.InspectLogsListVo"> | |||
SELECT l.id,l.inspect_driver_id,l.question_id, o.content AS 'question_content',l.inspect_result,l.inspect_image FROM tauv_inspect_logs AS l | |||
INNER JOIN tauv_question_options AS o ON o.id=l.question_id | |||
WHERE l.inspect_driver_id=#{inspectDriverId} AND l.mark=1 AND o.mark=1; | |||
</select> | |||
</mapper> |
@@ -0,0 +1,26 @@ | |||
package com.taauav.api.service; | |||
import com.taauav.admin.entity.TauvInspectAppPoint; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* 巡河坐标 服务类 | |||
* </p> | |||
* | |||
* @author zongjl | |||
* @since 2020-08-20 | |||
*/ | |||
public interface IInspectAppPointService extends IService<TauvInspectAppPoint> { | |||
/** | |||
* 获取巡任务坐标列表 | |||
* | |||
* @param inspectId 巡检任务ID | |||
* @return | |||
*/ | |||
List<TauvInspectAppPoint> getInspectAppPointList(Integer inspectId); | |||
} |
@@ -50,4 +50,12 @@ public interface IInspectAppService extends IService<TauvInspectApp> { | |||
*/ | |||
Response getInspectList(InspectListQuery inspectListQuery); | |||
/** | |||
* 获取巡检记录详情 | |||
* | |||
* @param id 巡检记录ID | |||
* @return | |||
*/ | |||
Response getInspectInfo(Integer id); | |||
} |
@@ -0,0 +1,41 @@ | |||
package com.taauav.api.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.taauav.admin.entity.TauvInspectAppPoint; | |||
import com.taauav.api.mapper.InspectAppPointMapper; | |||
import com.taauav.api.service.IInspectAppPointService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* 巡河坐标 服务实现类 | |||
* </p> | |||
* | |||
* @author zongjl | |||
* @since 2020-08-20 | |||
*/ | |||
@Service | |||
public class InspectAppPointServiceImpl extends ServiceImpl<InspectAppPointMapper, TauvInspectAppPoint> implements IInspectAppPointService { | |||
@Autowired | |||
private InspectAppPointMapper inspectAppPointMapper; | |||
/** | |||
* 获取巡检坐标列表 | |||
* | |||
* @param inspectId 巡检任务ID | |||
* @return | |||
*/ | |||
@Override | |||
public List<TauvInspectAppPoint> getInspectAppPointList(Integer inspectId) { | |||
QueryWrapper<TauvInspectAppPoint> queryWrapper = new QueryWrapper<>(); | |||
queryWrapper.eq("inspect_app_id", inspectId); | |||
queryWrapper.eq("mark", 1); | |||
List<TauvInspectAppPoint> inspectAppPointList = inspectAppPointMapper.selectList(queryWrapper); | |||
return inspectAppPointList; | |||
} | |||
} |
@@ -3,10 +3,7 @@ package com.taauav.api.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.taauav.admin.entity.TauvDriver; | |||
import com.taauav.admin.entity.TauvInspectApp; | |||
import com.taauav.admin.entity.TauvInspectDriver; | |||
import com.taauav.admin.entity.TauvInspectQuestion; | |||
import com.taauav.admin.entity.*; | |||
import com.taauav.admin.mapper.TauvDriverMapper; | |||
import com.taauav.admin.mapper.TauvInspectDriverMapper; | |||
import com.taauav.admin.service.ISysCityService; | |||
@@ -14,11 +11,14 @@ import com.taauav.api.dto.InspectEndDto; | |||
import com.taauav.api.dto.InspectPauseDto; | |||
import com.taauav.api.dto.InspectStartDto; | |||
import com.taauav.api.mapper.InspectAppMapper; | |||
import com.taauav.api.mapper.InspectLogsMapper; | |||
import com.taauav.api.mapper.InspectQuestionMapper; | |||
import com.taauav.api.query.InspectListQuery; | |||
import com.taauav.api.service.IInspectAppPointService; | |||
import com.taauav.api.service.IInspectAppService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.taauav.api.vo.InspectListVo; | |||
import com.taauav.api.vo.InspectLogsListVo; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.util.DateUtil; | |||
import com.taauav.common.util.FunctionUtils; | |||
@@ -56,6 +56,10 @@ public class InspectAppServiceImpl extends ServiceImpl<InspectAppMapper, TauvIns | |||
@Autowired | |||
private InspectQuestionMapper inspectQuestionMapper; | |||
@Autowired | |||
private IInspectAppPointService inspectAppPointService; | |||
@Autowired | |||
private InspectLogsMapper inspectLogsMapper; | |||
@Autowired | |||
private Response response; | |||
/** | |||
@@ -233,4 +237,59 @@ public class InspectAppServiceImpl extends ServiceImpl<InspectAppMapper, TauvIns | |||
result.put("records", inspectListVoList); | |||
return response.success(result); | |||
} | |||
/** | |||
* 获取巡检记录详情 | |||
* | |||
* @param id 巡检记录ID | |||
* @return | |||
*/ | |||
@Override | |||
public Response getInspectInfo(Integer id) { | |||
InspectListVo inspectListVo = inspectAppMapper.getInspectInfo(id); | |||
if (inspectListVo == null) { | |||
return response.failure("巡检任务信息不存在"); | |||
} | |||
// 获取问题数 | |||
QueryWrapper<TauvInspectQuestion> queryWrapper = new QueryWrapper<>(); | |||
queryWrapper.eq("inspect_driver_id", inspectListVo.getInspectDriverId()); | |||
queryWrapper.eq("source", 2); | |||
queryWrapper.eq("mark", 1); | |||
Integer questionNum = inspectQuestionMapper.selectCount(queryWrapper); | |||
inspectListVo.setQuestonNum(questionNum); | |||
// 获取未处理问题数 | |||
Integer questionWaitNum = getQuestionNum(inspectListVo.getInspectDriverId(), 1); | |||
// 获取已完成问题数 | |||
Integer questionFinishedNum = getQuestionNum(inspectListVo.getInspectDriverId(), 3); | |||
inspectListVo.setQuestonWaitNum(questionWaitNum); | |||
inspectListVo.setQuestonFinishedNum(questionFinishedNum); | |||
// 获取巡查轨迹数据信息 | |||
List<TauvInspectAppPoint> inspectAppPointList = inspectAppPointService.getInspectAppPointList(inspectListVo.getInspectId()); | |||
inspectListVo.setInspectAppPointList(inspectAppPointList); | |||
// 获取巡检日志列表 | |||
List<InspectLogsListVo> inspectLogsListVoList = inspectLogsMapper.getInspectLogsList(inspectListVo.getInspectDriverId()); | |||
inspectListVo.setInspectLogsListVoList(inspectLogsListVoList); | |||
return response.success(inspectListVo); | |||
} | |||
/** | |||
* 获取巡检问题数 | |||
* | |||
* @param inspectDriverId 巡检任务ID | |||
* @param status 状态 | |||
* @return | |||
*/ | |||
private Integer getQuestionNum(Integer inspectDriverId, Integer status) { | |||
QueryWrapper<TauvInspectQuestion> queryWrapper = new QueryWrapper<>(); | |||
queryWrapper.eq("inspect_driver_id", inspectDriverId); | |||
queryWrapper.eq("source", 2); | |||
queryWrapper.eq("status", status); | |||
queryWrapper.eq("mark", 1); | |||
Integer questionNum = inspectQuestionMapper.selectCount(queryWrapper); | |||
return questionNum; | |||
} | |||
} |
@@ -1,11 +1,13 @@ | |||
package com.taauav.api.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.taauav.admin.entity.TauvInspectAppPoint; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.math.BigInteger; | |||
import java.util.Date; | |||
import java.util.List; | |||
/** | |||
* 巡检任务Vo | |||
@@ -73,13 +75,33 @@ public class InspectListVo { | |||
private String timeUse; | |||
/** | |||
* 问题数 | |||
* 问题总数 | |||
*/ | |||
private Integer questonNum; | |||
/** | |||
* 待处理问题数 | |||
*/ | |||
private Integer questonWaitNum; | |||
/** | |||
* 已处理问题数 | |||
*/ | |||
private Integer questonFinishedNum; | |||
/** | |||
* 巡检距离(单位:KM) | |||
*/ | |||
private String inspectLength; | |||
/** | |||
* 巡检任务坐标列表 | |||
*/ | |||
private List<TauvInspectAppPoint> inspectAppPointList; | |||
/** | |||
* 巡检日志列表 | |||
*/ | |||
private List<InspectLogsListVo> inspectLogsListVoList; | |||
} |
@@ -0,0 +1,41 @@ | |||
package com.taauav.api.vo; | |||
import lombok.Data; | |||
/** | |||
* 巡检日志列表Vo | |||
*/ | |||
@Data | |||
public class InspectLogsListVo { | |||
/** | |||
* 巡检日志ID | |||
*/ | |||
private Integer id; | |||
/** | |||
* 巡检任务ID | |||
*/ | |||
private Integer inspectDriverId; | |||
/** | |||
* 问题选项ID | |||
*/ | |||
private Integer questionId; | |||
/** | |||
* 问题选项内容 | |||
*/ | |||
private String questionContent; | |||
/** | |||
* 巡检结果 | |||
*/ | |||
private String inspectResult; | |||
/** | |||
* 巡检图片 | |||
*/ | |||
private String inspectImage; | |||
} |