Procházet zdrojové kódy

新增巡检记录详情接口

master
鲲鹏 před 4 roky
rodič
revize
5808086116
14 změnil soubory, kde provedl 290 přidání a 5 odebrání
  1. +11
    -0
      src/main/java/com/taauav/api/controller/InspectAppController.java
  2. +21
    -0
      src/main/java/com/taauav/api/controller/InspectAppPointController.java
  3. +7
    -0
      src/main/java/com/taauav/api/mapper/InspectAppMapper.java
  4. +9
    -0
      src/main/java/com/taauav/api/mapper/InspectAppMapper.xml
  5. +16
    -0
      src/main/java/com/taauav/api/mapper/InspectAppPointMapper.java
  6. +5
    -0
      src/main/java/com/taauav/api/mapper/InspectAppPointMapper.xml
  7. +12
    -0
      src/main/java/com/taauav/api/mapper/InspectLogsMapper.java
  8. +7
    -0
      src/main/java/com/taauav/api/mapper/InspectLogsMapper.xml
  9. +26
    -0
      src/main/java/com/taauav/api/service/IInspectAppPointService.java
  10. +8
    -0
      src/main/java/com/taauav/api/service/IInspectAppService.java
  11. +41
    -0
      src/main/java/com/taauav/api/service/impl/InspectAppPointServiceImpl.java
  12. +63
    -4
      src/main/java/com/taauav/api/service/impl/InspectAppServiceImpl.java
  13. +23
    -1
      src/main/java/com/taauav/api/vo/InspectListVo.java
  14. +41
    -0
      src/main/java/com/taauav/api/vo/InspectLogsListVo.java

+ 11
- 0
src/main/java/com/taauav/api/controller/InspectAppController.java Zobrazit soubor

return inspectAppService.getInspectList(inspectListQuery); return inspectAppService.getInspectList(inspectListQuery);
} }


/**
* 获取巡检记录详情
*
* @param id 巡检记录ID
* @return
*/
@GetMapping("/getInspectInfo/{id}")
public Response getInspectInfo(@PathVariable("id") Integer id) {
return inspectAppService.getInspectInfo(id);
}

} }

+ 21
- 0
src/main/java/com/taauav/api/controller/InspectAppPointController.java Zobrazit soubor

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 {

}

+ 7
- 0
src/main/java/com/taauav/api/mapper/InspectAppMapper.java Zobrazit soubor

*/ */
IPage<InspectListVo> getInspectList(IPage<InspectListVo> page, @RequestParam("param") InspectListQuery param); IPage<InspectListVo> getInspectList(IPage<InspectListVo> page, @RequestParam("param") InspectListQuery param);


/**
* 获取巡检记录详情
*
* @param inspectId 巡检任务ID
* @return
*/
InspectListVo getInspectInfo(@RequestParam("inspectId") Integer inspectId);
} }

+ 9
- 0
src/main/java/com/taauav/api/mapper/InspectAppMapper.xml Zobrazit soubor

WHERE a.mark=1 AND d.mark=1 AND u.mark=1 WHERE a.mark=1 AND d.mark=1 AND u.mark=1
</select> </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> </mapper>

+ 16
- 0
src/main/java/com/taauav/api/mapper/InspectAppPointMapper.java Zobrazit soubor

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> {

}

+ 5
- 0
src/main/java/com/taauav/api/mapper/InspectAppPointMapper.xml Zobrazit soubor

<?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>

+ 12
- 0
src/main/java/com/taauav/api/mapper/InspectLogsMapper.java Zobrazit soubor



import com.taauav.api.entity.TauvInspectLogs; import com.taauav.api.entity.TauvInspectLogs;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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> * <p>
*/ */
public interface InspectLogsMapper extends BaseMapper<TauvInspectLogs> { public interface InspectLogsMapper extends BaseMapper<TauvInspectLogs> {


/**
* 获取巡检日志列表
*
* @param inspectDriverId 巡检任务ID
* @return
*/
List<InspectLogsListVo> getInspectLogsList(@RequestParam("inspectDriverId") Integer inspectDriverId);

} }

+ 7
- 0
src/main/java/com/taauav/api/mapper/InspectLogsMapper.xml Zobrazit soubor

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!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"> <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> </mapper>

+ 26
- 0
src/main/java/com/taauav/api/service/IInspectAppPointService.java Zobrazit soubor

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);

}

+ 8
- 0
src/main/java/com/taauav/api/service/IInspectAppService.java Zobrazit soubor

*/ */
Response getInspectList(InspectListQuery inspectListQuery); Response getInspectList(InspectListQuery inspectListQuery);


/**
* 获取巡检记录详情
*
* @param id 巡检记录ID
* @return
*/
Response getInspectInfo(Integer id);

} }

+ 41
- 0
src/main/java/com/taauav/api/service/impl/InspectAppPointServiceImpl.java Zobrazit soubor

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;
}
}

+ 63
- 4
src/main/java/com/taauav/api/service/impl/InspectAppServiceImpl.java Zobrazit soubor

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.TauvDriverMapper;
import com.taauav.admin.mapper.TauvInspectDriverMapper; import com.taauav.admin.mapper.TauvInspectDriverMapper;
import com.taauav.admin.service.ISysCityService; import com.taauav.admin.service.ISysCityService;
import com.taauav.api.dto.InspectPauseDto; import com.taauav.api.dto.InspectPauseDto;
import com.taauav.api.dto.InspectStartDto; import com.taauav.api.dto.InspectStartDto;
import com.taauav.api.mapper.InspectAppMapper; import com.taauav.api.mapper.InspectAppMapper;
import com.taauav.api.mapper.InspectLogsMapper;
import com.taauav.api.mapper.InspectQuestionMapper; import com.taauav.api.mapper.InspectQuestionMapper;
import com.taauav.api.query.InspectListQuery; import com.taauav.api.query.InspectListQuery;
import com.taauav.api.service.IInspectAppPointService;
import com.taauav.api.service.IInspectAppService; import com.taauav.api.service.IInspectAppService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.taauav.api.vo.InspectListVo; import com.taauav.api.vo.InspectListVo;
import com.taauav.api.vo.InspectLogsListVo;
import com.taauav.common.bean.Response; import com.taauav.common.bean.Response;
import com.taauav.common.util.DateUtil; import com.taauav.common.util.DateUtil;
import com.taauav.common.util.FunctionUtils; import com.taauav.common.util.FunctionUtils;
@Autowired @Autowired
private InspectQuestionMapper inspectQuestionMapper; private InspectQuestionMapper inspectQuestionMapper;
@Autowired @Autowired
private IInspectAppPointService inspectAppPointService;
@Autowired
private InspectLogsMapper inspectLogsMapper;
@Autowired
private Response response; private Response response;


/** /**
result.put("records", inspectListVoList); result.put("records", inspectListVoList);
return response.success(result); 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;
}
} }

+ 23
- 1
src/main/java/com/taauav/api/vo/InspectListVo.java Zobrazit soubor

package com.taauav.api.vo; package com.taauav.api.vo;


import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.taauav.admin.entity.TauvInspectAppPoint;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;


import java.math.BigInteger; import java.math.BigInteger;
import java.util.Date; import java.util.Date;
import java.util.List;


/** /**
* 巡检任务Vo * 巡检任务Vo
private String timeUse; private String timeUse;


/** /**
* 问题数
* 问题
*/ */
private Integer questonNum; private Integer questonNum;


/**
* 待处理问题数
*/
private Integer questonWaitNum;

/**
* 已处理问题数
*/
private Integer questonFinishedNum;

/** /**
* 巡检距离(单位:KM) * 巡检距离(单位:KM)
*/ */
private String inspectLength; private String inspectLength;


/**
* 巡检任务坐标列表
*/
private List<TauvInspectAppPoint> inspectAppPointList;

/**
* 巡检日志列表
*/
private List<InspectLogsListVo> inspectLogsListVoList;

} }

+ 41
- 0
src/main/java/com/taauav/api/vo/InspectLogsListVo.java Zobrazit soubor

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;

}

Načítá se…
Zrušit
Uložit