Procházet zdrojové kódy

新增巡检相关接口

master
鲲鹏 před 4 roky
rodič
revize
1d30896e18
13 změnil soubory, kde provedl 359 přidání a 16 odebrání
  1. +8
    -0
      log.path_IS_UNDEFINED/info/log-info-2020-08-18.0.log
  2. +2
    -8
      log.path_IS_UNDEFINED/log_info.log
  3. +4
    -0
      src/main/java/com/taauav/admin/entity/TauvInspectApp.java
  4. +40
    -0
      src/main/java/com/taauav/api/controller/InspectAppController.java
  5. +25
    -2
      src/main/java/com/taauav/api/controller/InspectQuestionController.java
  6. +26
    -0
      src/main/java/com/taauav/api/dto/InspectAppDto.java
  7. +1
    -1
      src/main/java/com/taauav/api/dto/InspectQuestionReportDto.java
  8. +16
    -0
      src/main/java/com/taauav/api/mapper/InspectAppMapper.java
  9. +5
    -0
      src/main/java/com/taauav/api/mapper/InspectAppMapper.xml
  10. +26
    -0
      src/main/java/com/taauav/api/service/IInspectAppService.java
  11. +19
    -2
      src/main/java/com/taauav/api/service/IInspectQuestionService.java
  12. +122
    -0
      src/main/java/com/taauav/api/service/impl/InspectAppServiceImpl.java
  13. +65
    -3
      src/main/java/com/taauav/api/service/impl/InspectQuestionServiceImpl.java

+ 8
- 0
log.path_IS_UNDEFINED/info/log-info-2020-08-18.0.log Zobrazit soubor

@@ -0,0 +1,8 @@
2020-08-18 09:46:33.957 [SessionValidationThread-1] INFO o.a.s.s.m.AbstractValidatingSessionManager - [validateSessions,275] - Validating all active sessions...
2020-08-18 09:46:34.000 [SessionValidationThread-1] INFO o.a.s.s.m.AbstractValidatingSessionManager - [validateSessions,308] - Finished session validation. No sessions were stopped.
2020-08-18 10:46:33.960 [SessionValidationThread-1] INFO o.a.s.s.m.AbstractValidatingSessionManager - [validateSessions,275] - Validating all active sessions...
2020-08-18 10:46:34.098 [SessionValidationThread-1] INFO o.a.s.s.m.AbstractValidatingSessionManager - [validateSessions,308] - Finished session validation. No sessions were stopped.
2020-08-18 10:50:37.500 [SpringContextShutdownHook] INFO o.s.s.c.ThreadPoolTaskScheduler - [shutdown,208] - Shutting down ExecutorService 'taskScheduler'
2020-08-18 10:50:37.809 [SpringContextShutdownHook] INFO c.a.d.p.DruidDataSource - [close,1825] - {dataSource-1} closed
2020-08-18 15:05:11.530 [SpringContextShutdownHook] INFO o.s.s.c.ThreadPoolTaskScheduler - [shutdown,208] - Shutting down ExecutorService 'taskScheduler'
2020-08-18 15:05:11.785 [SpringContextShutdownHook] INFO c.a.d.p.DruidDataSource - [close,1825] - {dataSource-1} closed

+ 2
- 8
log.path_IS_UNDEFINED/log_info.log Zobrazit soubor

@@ -1,8 +1,2 @@
2020-08-18 09:46:33.957 [SessionValidationThread-1] INFO o.a.s.s.m.AbstractValidatingSessionManager - [validateSessions,275] - Validating all active sessions...
2020-08-18 09:46:34.000 [SessionValidationThread-1] INFO o.a.s.s.m.AbstractValidatingSessionManager - [validateSessions,308] - Finished session validation. No sessions were stopped.
2020-08-18 10:46:33.960 [SessionValidationThread-1] INFO o.a.s.s.m.AbstractValidatingSessionManager - [validateSessions,275] - Validating all active sessions...
2020-08-18 10:46:34.098 [SessionValidationThread-1] INFO o.a.s.s.m.AbstractValidatingSessionManager - [validateSessions,308] - Finished session validation. No sessions were stopped.
2020-08-18 10:50:37.500 [SpringContextShutdownHook] INFO o.s.s.c.ThreadPoolTaskScheduler - [shutdown,208] - Shutting down ExecutorService 'taskScheduler'
2020-08-18 10:50:37.809 [SpringContextShutdownHook] INFO c.a.d.p.DruidDataSource - [close,1825] - {dataSource-1} closed
2020-08-18 15:05:11.530 [SpringContextShutdownHook] INFO o.s.s.c.ThreadPoolTaskScheduler - [shutdown,208] - Shutting down ExecutorService 'taskScheduler'
2020-08-18 15:05:11.785 [SpringContextShutdownHook] INFO c.a.d.p.DruidDataSource - [close,1825] - {dataSource-1} closed
2020-08-19 10:38:11.464 [SpringContextShutdownHook] INFO o.s.s.c.ThreadPoolTaskScheduler - [shutdown,208] - Shutting down ExecutorService 'taskScheduler'
2020-08-19 10:38:11.598 [SpringContextShutdownHook] INFO c.a.d.p.DruidDataSource - [close,1825] - {dataSource-1} closed

+ 4
- 0
src/main/java/com/taauav/admin/entity/TauvInspectApp.java Zobrazit soubor

@@ -24,6 +24,10 @@ public class TauvInspectApp extends Entity {

private static final long serialVersionUID = 1L;

/**
* 巡检任务单号
*/
private String inspectNo;
/** 巡查河道编号 */
private Integer driverId;
/** 巡查开始时间 */

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

@@ -0,0 +1,40 @@
package com.taauav.api.controller;


import com.taauav.api.dto.InspectAppDto;
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;

/**
* <p>
* 巡河表 前端控制器
* </p>
*
* @author zongjl
* @since 2020-08-19
*/
@RestController
@RequestMapping("/user/inspectapp")
public class InspectAppController extends ApiBaseController {

@Autowired
private IInspectAppService inspectAppService;

/**
* 巡检河流
*
* @param inspectAppDto 参数
* @return
*/
@PostMapping("/inspectStart")
public Response inspectStart(@RequestBody InspectAppDto inspectAppDto) {
return inspectAppService.inspectStart(inspectAppDto);
}

}

+ 25
- 2
src/main/java/com/taauav/api/controller/InspectQuestionController.java Zobrazit soubor

@@ -1,10 +1,11 @@
package com.taauav.api.controller;


import com.taauav.api.dto.InspectQuestionDto;
import com.taauav.api.dto.InspectQuestionReportDto;
import com.taauav.api.query.InspectQuestionQuery;
import com.taauav.api.service.IInspectQuestionService;
import com.taauav.common.bean.Response;
import com.taauav.front.dto.inspectquestion.InspectQuestionDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@@ -58,7 +59,7 @@ public class InspectQuestionController extends ApiBaseController {
* @return
*/
@PostMapping("/createQuestion")
public Response createQuestion(@RequestBody InspectQuestionDto inspectQuestionDto) throws IOException {
public Response createQuestion(@RequestBody InspectQuestionReportDto inspectQuestionDto) throws IOException {
return inspectQuestionService.createQuestion(inspectQuestionDto);
}

@@ -82,4 +83,26 @@ public class InspectQuestionController extends ApiBaseController {
return inspectQuestionService.getQuestionStatistics();
}

/**
* 巡检问题标题完成
*
* @param id 问题ID
* @return
*/
@GetMapping("/finished/{id}")
public Response finished(@PathVariable("id") Integer id) {
return inspectQuestionService.finished(id);
}

/**
* 指派工单
*
* @param inspectQuestionDto 参数
* @return
*/
@PostMapping("/assign")
public Response assign(@RequestBody InspectQuestionDto inspectQuestionDto) {
return inspectQuestionService.assign(inspectQuestionDto);
}

}

+ 26
- 0
src/main/java/com/taauav/api/dto/InspectAppDto.java Zobrazit soubor

@@ -0,0 +1,26 @@
package com.taauav.api.dto;

import lombok.Data;

/**
* APP巡检
*/
@Data
public class InspectAppDto {

/**
* 巡查河道编号
*/
private Integer driverId;

/**
* 巡检设备:1-安装 2-IOS
*/
private Integer from;

/**
* app版本
*/
private String appVersion;

}

src/main/java/com/taauav/api/dto/InspectQuestionDto.java → src/main/java/com/taauav/api/dto/InspectQuestionReportDto.java Zobrazit soubor

@@ -6,7 +6,7 @@ import lombok.Data;
* 巡检问题上报
*/
@Data
public class InspectQuestionDto {
public class InspectQuestionReportDto {

/**
* 巡检河道ID

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

@@ -0,0 +1,16 @@
package com.taauav.api.mapper;

import com.taauav.admin.entity.TauvInspectApp;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* 巡河表 Mapper 接口
* </p>
*
* @author zongjl
* @since 2020-08-19
*/
public interface InspectAppMapper extends BaseMapper<TauvInspectApp> {

}

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

@@ -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.InspectAppMapper">

</mapper>

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

@@ -0,0 +1,26 @@
package com.taauav.api.service;

import com.taauav.admin.entity.TauvInspectApp;
import com.baomidou.mybatisplus.extension.service.IService;
import com.taauav.api.dto.InspectAppDto;
import com.taauav.common.bean.Response;

/**
* <p>
* 巡河表 服务类
* </p>
*
* @author zongjl
* @since 2020-08-19
*/
public interface IInspectAppService extends IService<TauvInspectApp> {

/**
* 巡检河流
*
* @param inspectAppDto 参数
* @return
*/
Response inspectStart(InspectAppDto inspectAppDto);

}

+ 19
- 2
src/main/java/com/taauav/api/service/IInspectQuestionService.java Zobrazit soubor

@@ -2,10 +2,11 @@ package com.taauav.api.service;

import com.taauav.admin.entity.TauvInspectQuestion;
import com.baomidou.mybatisplus.extension.service.IService;
import com.taauav.api.dto.InspectQuestionDto;
import com.taauav.api.dto.InspectQuestionReportDto;
import com.taauav.api.query.InspectQuestionQuery;
import com.taauav.api.vo.InspectQuestionListVo;
import com.taauav.common.bean.Response;
import com.taauav.front.dto.inspectquestion.InspectQuestionDto;

import java.io.IOException;
import java.text.ParseException;
@@ -43,7 +44,7 @@ public interface IInspectQuestionService extends IService<TauvInspectQuestion> {
* @param inspectQuestionDto 参数
* @return
*/
Response createQuestion(InspectQuestionDto inspectQuestionDto) throws IOException;
Response createQuestion(InspectQuestionReportDto inspectQuestionDto) throws IOException;

/**
* 获取问题类型列表
@@ -59,4 +60,20 @@ public interface IInspectQuestionService extends IService<TauvInspectQuestion> {
*/
Response getQuestionStatistics() throws ParseException;

/**
* 标记完成
*
* @param id 问题ID
* @return
*/
Response finished(Integer id);

/**
* 巡检问题指派处理
*
* @param inspectQuestionDto 参数
* @return
*/
Response assign(InspectQuestionDto inspectQuestionDto);

}

+ 122
- 0
src/main/java/com/taauav/api/service/impl/InspectAppServiceImpl.java Zobrazit soubor

@@ -0,0 +1,122 @@
package com.taauav.api.service.impl;

import com.taauav.admin.entity.TauvDriver;
import com.taauav.admin.entity.TauvInspectApp;
import com.taauav.admin.entity.TauvInspectDriver;
import com.taauav.admin.mapper.TauvDriverMapper;
import com.taauav.admin.mapper.TauvInspectDriverMapper;
import com.taauav.api.dto.InspectAppDto;
import com.taauav.api.mapper.InspectAppMapper;
import com.taauav.api.service.IInspectAppService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
* <p>
* 巡河表 服务实现类
* </p>
*
* @author zongjl
* @since 2020-08-19
*/
@Service
public class InspectAppServiceImpl extends ServiceImpl<InspectAppMapper, TauvInspectApp> implements IInspectAppService {

@Autowired
private TauvDriverMapper driverMapper;
@Autowired
private InspectAppMapper inspectAppMapper;
@Autowired
private TauvInspectDriverMapper inspectDriverMapper;
@Autowired
private Response response;

/**
* 巡检河流
*
* @param inspectAppDto 参数
* @return
*/
@Override
public Response inspectStart(InspectAppDto inspectAppDto) {
// 河道ID
if (inspectAppDto.getDriverId() == null || inspectAppDto.getDriverId() <= 0) {
return response.failure("河道ID不能为空");
}
// 设备来源
if (inspectAppDto.getFrom() == null || inspectAppDto.getFrom() <= 0) {
return response.failure("设备来源不能为空");
}
// APP版本号
if (StringUtils.isEmpty(inspectAppDto.getAppVersion())) {
return response.failure("APP版本号不能为空");
}

// 获取河湖信息
TauvDriver driver = driverMapper.selectById(inspectAppDto.getDriverId());
if (driver == null) {
return response.failure("河流信息不存在");
}

// 创建巡检任务
TauvInspectApp entity = new TauvInspectApp();
entity.setDriverId(inspectAppDto.getDriverId());
entity.setBeginTime(DateUtil.now());
entity.setStatus(1);
entity.setLength(Double.valueOf(driver.getLength()));
entity.setFrom(inspectAppDto.getFrom());
entity.setAppVersion(inspectAppDto.getAppVersion());
entity.setCreateUser(ShiroUtils.getAdminId());
entity.setCreateTime(DateUtil.now());
int result = inspectAppMapper.insert(entity);
if (result == 0) {
return response.failure("巡检任务创建失败");
}

// 生成巡检任务单号
String code = "XH" + FunctionUtils.formatTime(FunctionUtils.getCurrentTime(), "yyyyMM");
Integer id = entity.getId();
String idStr = String.format("%04d", id);
entity.setId(id);
entity.setInspectNo(code + idStr);
int result2 = inspectAppMapper.updateById(entity);
if (result2 == 0) {
return response.failure("巡检单号更新失败");
}

// 创建巡检河流任务
TauvInspectDriver inspectDriver = new TauvInspectDriver();
inspectDriver.setInspectId(entity.getId());
inspectDriver.setSource(2);
inspectDriver.setDriverName(driver.getName());
inspectDriver.setDriverArea(driver.getDriverArea());
BigDecimal bigDecimal = new BigDecimal(driver.getLength());
inspectDriver.setDriverLength(bigDecimal);
inspectDriver.setDriverStart(driver.getStartPoint());
inspectDriver.setDriverEnd(driver.getEndPoint());
inspectDriver.setInspectNo(entity.getInspectNo());
inspectDriver.setNum(10);
inspectDriver.setDriverId(inspectAppDto.getDriverId());
inspectDriver.setDriverImage(driver.getImgPath());
inspectDriver.setDriverFile(driver.getFilePath());
inspectDriver.setDriverFilename(driver.getFileName());
inspectDriver.setDriverNote(driver.getNote());
inspectDriver.setExecutionTime(DateUtil.now());
inspectDriver.setStatus(3);
inspectDriver.setCreateUser(ShiroUtils.getAdminId());
inspectDriver.setCreateTime(DateUtil.now());
int res = inspectDriverMapper.insert(inspectDriver);
if (res == 0) {
return response.failure("巡检河湖任务创建失败");
}
return response.success("巡检任务创建成功");
}
}

+ 65
- 3
src/main/java/com/taauav/api/service/impl/InspectQuestionServiceImpl.java Zobrazit soubor

@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.taauav.admin.entity.*;
import com.taauav.admin.mapper.*;
import com.taauav.api.dto.InspectQuestionDto;
import com.taauav.api.dto.InspectQuestionReportDto;
import com.taauav.api.query.InspectQuestionQuery;
import com.taauav.api.mapper.InspectQuestionMapper;
import com.taauav.api.service.IInspectQuestionService;
@@ -13,13 +13,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.taauav.api.vo.InspectQuestionListVo;
import com.taauav.api.vo.InspectQuestionStatisticsListVo;
import com.taauav.common.bean.Response;
import com.taauav.common.util.*;
import com.taauav.common.util.DateUtil;
import com.taauav.common.util.FileUtil;
import com.taauav.common.util.ImageUtil;
import com.taauav.common.util.ShiroUtils;
import com.taauav.front.dto.inspectquestion.InspectQuestionDto;
import com.taauav.front.entity.UserAdmin;
import com.taauav.front.mapper.UserAdminMapper;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.io.File;
import java.io.FileInputStream;
@@ -109,7 +114,7 @@ public class InspectQuestionServiceImpl extends ServiceImpl<InspectQuestionMappe
* @return
*/
@Override
public Response createQuestion(InspectQuestionDto inspectQuestionDto) throws IOException {
public Response createQuestion(InspectQuestionReportDto inspectQuestionDto) throws IOException {
// 巡检河流ID
if (inspectQuestionDto.getInspectDriverId() == null || inspectQuestionDto.getInspectDriverId() <= 0) {
return response.failure("巡检河流ID不能为空");
@@ -369,4 +374,61 @@ public class InspectQuestionServiceImpl extends ServiceImpl<InspectQuestionMappe

return Integer.parseInt(String.valueOf(between / 60));
}

/**
* 标记完成
*
* @param id 问题ID
* @return
*/
@Override
public Response finished(Integer id) {
TauvInspectQuestion entity = inspectQuestionMapper.selectById(id);
if (entity == null) {
return response.failure("巡检问题信息不存在");
}
entity.setStatus(3);
entity.setHandlerUser(ShiroUtils.getAdminId());
entity.setHandlerTime(DateUtil.now());
Integer result = inspectQuestionMapper.updateById(entity);
if (result == 0) {
return response.failure("标题完成操作失败");
}
return response.success("标记完成");
}

/**
* 巡检问题指派
*
* @param inspectQuestionDto 参数
* @return
*/
@Override
public Response assign(InspectQuestionDto inspectQuestionDto) {
if (StringUtils.isEmpty(inspectQuestionDto.getId())) {
return response.failure("巡检问题ID不能为空");
}
if (StringUtils.isEmpty(inspectQuestionDto.getAssignUser())) {
return response.failure("责任人不能为空");
}
TauvInspectQuestion inspectQuestion = inspectQuestionMapper.selectById(inspectQuestionDto.getId());
if (inspectQuestion == null) {
return response.failure("巡检问题信息不存在");
}
if (inspectQuestion.getStatus() == 3) {
return response.failure("巡检问题已处理完成,无法指派");
}
TauvInspectQuestion entity = new TauvInspectQuestion();
entity.setId(Integer.valueOf(inspectQuestionDto.getId()));
entity.setAssignUser(inspectQuestionDto.getAssignUser());
entity.setAssignContact(inspectQuestionDto.getAssignContact());
entity.setAssignNote(inspectQuestionDto.getAssignNote());
entity.setAssignTime(DateUtil.now());
entity.setStatus(2);
Integer result = inspectQuestionMapper.updateById(entity);
if (result == 0) {
return response.failure("问题指派失败");
}
return response.success("问题指派成功");
}
}

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