@@ -76,4 +76,9 @@ public class TauvInspectQuestion extends Entity { | |||
* 备注 | |||
*/ | |||
private String note; | |||
/** | |||
* 来源:1客户后台 2APP客户端 | |||
*/ | |||
private Integer source; | |||
} |
@@ -4,14 +4,11 @@ package com.taauav.api.controller; | |||
import com.taauav.api.dto.InspectEndDto; | |||
import com.taauav.api.dto.InspectPauseDto; | |||
import com.taauav.api.dto.InspectStartDto; | |||
import com.taauav.api.query.InspectListQuery; | |||
import com.taauav.api.service.IInspectAppService; | |||
import com.taauav.common.bean.Response; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* <p> | |||
@@ -61,4 +58,14 @@ public class InspectAppController extends ApiBaseController { | |||
return inspectAppService.inspectPause(inspectEndDto); | |||
} | |||
/** | |||
* 获取巡检记录列表 | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/getInspectList") | |||
public Response getInspectList(@RequestBody InspectListQuery inspectListQuery) { | |||
return inspectAppService.getInspectList(inspectListQuery); | |||
} | |||
} |
@@ -1,7 +1,13 @@ | |||
package com.taauav.api.mapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.taauav.admin.entity.TauvInspectApp; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.taauav.api.query.InspectListQuery; | |||
import com.taauav.api.vo.InspectListVo; | |||
import org.springframework.web.bind.annotation.RequestParam; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
@@ -13,4 +19,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
*/ | |||
public interface InspectAppMapper extends BaseMapper<TauvInspectApp> { | |||
/** | |||
* 获取巡检任务列表 | |||
* | |||
* @param page 分页 | |||
* @param param 参数 | |||
* @return | |||
*/ | |||
IPage<InspectListVo> getInspectList(IPage<InspectListVo> page, @RequestParam("param") InspectListQuery param); | |||
} |
@@ -2,4 +2,13 @@ | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.api.mapper.InspectAppMapper"> | |||
<!-- 获取巡检任务记录列表 --> | |||
<select id="getInspectList" 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.mark=1 AND d.mark=1 AND u.mark=1 | |||
</select> | |||
</mapper> |
@@ -13,7 +13,7 @@ | |||
<!-- 获取问题详情 --> | |||
<select id="getQuestionInfo" resultType="com.taauav.api.vo.InspectQuestionListVo"> | |||
SELECT q.id,q.question_no, q.`status`,q.handler_image,q.create_time,q.assign_time,q.handler_time,f.src as 'question_src',f.gaode_address as 'question_address',q.question_id,o.content as 'question_content',i.driver_name,i.driver_area,c.`name` as 'city_name',i.execution_time,i.driver_id FROM tauv_inspect_question AS q | |||
SELECT q.id,q.question_no, q.`status`,q.handler_image,q.create_time,q.assign_time,q.handler_time,f.src as 'question_src',f.gaode_address as 'question_address',q.question_id,o.content as 'question_content',i.driver_name,i.driver_area,c.`name` as 'city_name',i.execution_time,i.driver_id,i.driver_video FROM tauv_inspect_question AS q | |||
INNER JOIN tauv_inspect_driver AS i ON q.inspect_driver_id=i.id | |||
INNER JOIN tauv_question_options AS o ON q.question_id=o.id | |||
INNER JOIN sys_city AS c ON c.id=i.driver_area |
@@ -0,0 +1,11 @@ | |||
package com.taauav.api.query; | |||
import com.taauav.common.core.mps.BaseQuery; | |||
import lombok.Data; | |||
/** | |||
* 巡检记录列表Query | |||
*/ | |||
@Data | |||
public class InspectListQuery extends BaseQuery { | |||
} |
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.taauav.api.dto.InspectEndDto; | |||
import com.taauav.api.dto.InspectPauseDto; | |||
import com.taauav.api.dto.InspectStartDto; | |||
import com.taauav.api.query.InspectListQuery; | |||
import com.taauav.common.bean.Response; | |||
/** | |||
@@ -41,4 +42,12 @@ public interface IInspectAppService extends IService<TauvInspectApp> { | |||
*/ | |||
Response inspectPause(InspectPauseDto inspectPauseDto); | |||
/** | |||
* 获取巡检记录列表 | |||
* | |||
* @param inspectListQuery 查询条件 | |||
* @return | |||
*/ | |||
Response getInspectList(InspectListQuery inspectListQuery); | |||
} |
@@ -1,25 +1,38 @@ | |||
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.mapper.TauvDriverMapper; | |||
import com.taauav.admin.mapper.TauvInspectDriverMapper; | |||
import com.taauav.admin.service.ISysCityService; | |||
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.InspectQuestionMapper; | |||
import com.taauav.api.query.InspectListQuery; | |||
import com.taauav.api.service.IInspectAppService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.taauav.api.vo.InspectListVo; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.util.DateUtil; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.common.util.ShiroUtils; | |||
import com.taauav.common.util.StringUtils; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.math.BigDecimal; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
@@ -39,6 +52,10 @@ public class InspectAppServiceImpl extends ServiceImpl<InspectAppMapper, TauvIns | |||
@Autowired | |||
private TauvInspectDriverMapper inspectDriverMapper; | |||
@Autowired | |||
private ISysCityService cityService; | |||
@Autowired | |||
private InspectQuestionMapper inspectQuestionMapper; | |||
@Autowired | |||
private Response response; | |||
/** | |||
@@ -119,7 +136,7 @@ public class InspectAppServiceImpl extends ServiceImpl<InspectAppMapper, TauvIns | |||
if (res == 0) { | |||
return response.failure("巡检河湖任务创建失败"); | |||
} | |||
return response.success("巡检任务创建成功"); | |||
return response.success("巡检任务创建成功", entity); | |||
} | |||
/** | |||
@@ -139,6 +156,7 @@ public class InspectAppServiceImpl extends ServiceImpl<InspectAppMapper, TauvIns | |||
return response.failure("巡检任务不存在"); | |||
} | |||
inspectApp.setStatus(3); | |||
inspectApp.setEndTime(DateUtil.now()); | |||
int result = inspectAppMapper.updateById(inspectApp); | |||
if (result == 0) { | |||
return response.failure("巡检任务状态更新失败"); | |||
@@ -169,4 +187,50 @@ public class InspectAppServiceImpl extends ServiceImpl<InspectAppMapper, TauvIns | |||
} | |||
return response.success("巡检暂停成功"); | |||
} | |||
/** | |||
* 获取巡检记录列表 | |||
* | |||
* @param inspectListQuery 查询条件 | |||
* @return | |||
*/ | |||
@Override | |||
public Response getInspectList(InspectListQuery inspectListQuery) { | |||
// 分页 | |||
IPage<InspectListVo> page = new Page<>(inspectListQuery.getPage(), inspectListQuery.getPageSize()); | |||
IPage<InspectListVo> data = inspectAppMapper.getInspectList(page, inspectListQuery); | |||
List<InspectListVo> inspectList = data.getRecords(); | |||
List<InspectListVo> inspectListVoList = new ArrayList<>(); | |||
if (!inspectList.isEmpty()) { | |||
inspectList.forEach(item -> { | |||
// 属性拷贝 | |||
InspectListVo inspectListVo = new InspectListVo(); | |||
BeanUtils.copyProperties(item, inspectListVo); | |||
// 获取区划信息 | |||
if (item.getDriverArea() != null) { | |||
String cityName = cityService.getCityName(item.getDriverArea()); | |||
inspectListVo.setDriverAreaName(cityName); | |||
} | |||
// 获取问题数 | |||
QueryWrapper<TauvInspectQuestion> queryWrapper = new QueryWrapper<>(); | |||
queryWrapper.eq("inspect_driver_id", item.getInspectDriverId()); | |||
queryWrapper.eq("source", 2); | |||
queryWrapper.eq("mark", 1); | |||
Integer questionNum = inspectQuestionMapper.selectCount(queryWrapper); | |||
inspectListVo.setQuestonNum(questionNum); | |||
inspectListVoList.add(inspectListVo); | |||
}); | |||
} | |||
// 返回结果 | |||
Map<String, Object> result = new HashMap<>(); | |||
result.put("total", data.getTotal()); | |||
result.put("size", data.getSize()); | |||
result.put("current", data.getCurrent()); | |||
result.put("pages", data.getPages()); | |||
result.put("records", inspectListVoList); | |||
return response.success(result); | |||
} | |||
} |
@@ -206,6 +206,7 @@ public class InspectQuestionServiceImpl extends ServiceImpl<InspectQuestionMappe | |||
inspectQuestion.setNote(inspectQuestionDto.getQuestionNote()); | |||
inspectQuestion.setCreateUser(ShiroUtils.getAdminId()); | |||
inspectQuestion.setCreateTime(DateUtil.now()); | |||
inspectQuestion.setSource(2); | |||
Integer result2 = inspectQuestionMapper.insert(inspectQuestion); | |||
if (result2 == 0) { | |||
return response.failure("上报失败"); |
@@ -0,0 +1,85 @@ | |||
package com.taauav.api.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.math.BigInteger; | |||
import java.util.Date; | |||
/** | |||
* 巡检任务Vo | |||
*/ | |||
@Data | |||
public class InspectListVo { | |||
/** | |||
* 巡检任务ID | |||
*/ | |||
private Integer inspectId; | |||
/** | |||
* 巡检河流ID | |||
*/ | |||
private Integer inspectDriverId; | |||
/** | |||
* 巡检任务单号 | |||
*/ | |||
private String inspectNo; | |||
/** | |||
* 河道ID | |||
*/ | |||
private Integer driverId; | |||
/** | |||
* 河道名称 | |||
*/ | |||
private String driverName; | |||
/** | |||
* 区划ID | |||
*/ | |||
private BigInteger driverArea; | |||
/** | |||
* 区划名称 | |||
*/ | |||
private String driverAreaName; | |||
/** | |||
* 开始时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date beginTime; | |||
/** | |||
* 结束时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date endTime; | |||
/** | |||
* 巡查人 | |||
*/ | |||
private String realname; | |||
/** | |||
* 耗时(单位:分钟) | |||
*/ | |||
private String timeUse; | |||
/** | |||
* 问题数 | |||
*/ | |||
private Integer questonNum; | |||
/** | |||
* 巡检距离(单位:KM) | |||
*/ | |||
private String inspectLength; | |||
} |
@@ -65,6 +65,11 @@ public class InspectQuestionListVo { | |||
*/ | |||
private Integer driverId; | |||
/** | |||
* 巡检视频地址 | |||
*/ | |||
private String driverVideo; | |||
/** | |||
* 问题原图 | |||
*/ |