瀏覽代碼

小程序任务列表接口编写

tags/v1.0.0^2
chengwang 1 年之前
父節點
當前提交
bb92f3bb53
共有 55 個檔案被更改,包括 1900 行新增8 行删除
  1. +0
    -8
      tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/dao/taskMapper.java
  2. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/THMiniprogramApplication.java
  3. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/config/AliyuncsVodConfig.java
  4. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/config/CommonsConfig.java
  5. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/config/DruidConfig.java
  6. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/config/MybatisPlusConfig.java
  7. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/config/ThreadPoolConfig.java
  8. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/constant/CommonConstant.java
  9. +26
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/constant/OidcUrlConstant.java
  10. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/AliyunOssController.java
  11. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/AliyuncsVodController.java
  12. +31
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/DeptController.java
  13. +43
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/InspectionController.java
  14. +21
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/InspectionFileController.java
  15. +47
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/UserController.java
  16. +13
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/dao/DeptMapper.java
  17. +17
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/dao/InspectionFileMapper.java
  18. +19
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/dao/InspectionMapper.java
  19. +12
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/dao/UserMapper.java
  20. +73
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/Dept.java
  21. +275
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/Inspection.java
  22. +146
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/InspectionFile.java
  23. +60
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/InspectionFileHandle.java
  24. +38
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/InspectionHistory.java
  25. +42
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/QuestionType.java
  26. +226
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/User.java
  27. +21
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/dto/ResetPwdDto.java
  28. +102
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/query/InspectionQuery.java
  29. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/query/OidcUpdatePassRequest.java
  30. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/AliyunVodUploadStatusEnum.java
  31. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/AppHttpCodeEnum.java
  32. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/MarkStatusEnum.java
  33. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/ServiceExceptionEnum.java
  34. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/exception/ExceptionConstantEnum.java
  35. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IAliyunOssService.java
  36. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IAliyuncsVodService.java
  37. +11
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IDeptService.java
  38. +8
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IInspectionFileService.java
  39. +12
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IInspectionService.java
  40. +16
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IUserService.java
  41. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/AliyunOssServiceImpl.java
  42. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/AliyuncsVodServiceImpl.java
  43. +80
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/DeptServiceImpl.java
  44. +109
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/IUserServiceImpl.java
  45. +14
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionFileServiceImpl.java
  46. +163
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionServiceImpl.java
  47. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/utils/CommonUtils.java
  48. +0
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/utils/RedisSyncLock.java
  49. +22
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/utils/ShiroUtils.java
  50. +46
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/vo/DeptTreeVo.java
  51. +80
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/vo/InspectionInfoVo.java
  52. +10
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/DeptMapper.xml
  53. +10
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/InspectionFileMapper.xml
  54. +97
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/InspectionMapper.xml
  55. +10
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/UserMapper.xml

+ 0
- 8
tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/dao/taskMapper.java 查看文件

@@ -1,8 +0,0 @@
package com.tuoheng.miniprogram.dao;

/**
* @Author ChengWang
* @Date 2022/11/21
*/
public interface taskMapper {
}

tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/THMiniprogramApplication.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/THMiniprogramApplication.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/config/AliyuncsVodConfig.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/config/AliyuncsVodConfig.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/config/CommonsConfig.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/config/CommonsConfig.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/config/DruidConfig.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/config/DruidConfig.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/config/MybatisPlusConfig.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/config/MybatisPlusConfig.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/config/ThreadPoolConfig.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/config/ThreadPoolConfig.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/constant/CommonConstant.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/constant/CommonConstant.java 查看文件


+ 26
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/constant/OidcUrlConstant.java 查看文件

@@ -0,0 +1,26 @@
package com.tuoheng.miniprogram.constant;

/**
* oidc认证平台常量url
* @Author xiaoying
* @Date 2022/10/18 10:52
*/
public class OidcUrlConstant {

/**
* 判断username是否已存在
*/
public static String USER_JUDGE = "/oidc/admin/user/judge/create/{username}";
/**
* 创建用户
*/
public static String USER_CREATE = "/oidc/admin/user/create";
/**
* 修改用户密码
*/
public static String USER_UPDATEPASS = "/oidc/admin/user/updatePass";
/**
* 修改用户角色
*/
public static String USER_UPDATEROLE = "/oidc/admin/user/updateRole";
}

tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/controller/AliyunOssController.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/AliyunOssController.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/controller/AliyuncsVodController.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/AliyuncsVodController.java 查看文件


+ 31
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/DeptController.java 查看文件

@@ -0,0 +1,31 @@
package com.tuoheng.miniprogram.controller;

import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.miniprogram.service.IDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @Author ChengWang
* @Date 2022/11/21
*/
@RestController
@RequestMapping("/dept")
public class DeptController {

@Autowired
private IDeptService iDeptService;

/**
* 获取部门列表(树形)
* @return
*/
@GetMapping("/treeList")
public JsonResult treeList(){
return iDeptService.treeList();
}


}

+ 43
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/InspectionController.java 查看文件

@@ -0,0 +1,43 @@
package com.tuoheng.miniprogram.controller;

import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.miniprogram.entity.query.InspectionQuery;
import com.tuoheng.miniprogram.service.IInspectionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* 巡检任务管理 前端控制器
*
* @Author ChengWang
* @Date 2022/11/21
*/
@Slf4j
@RestController
@RequestMapping("/inspection")
public class InspectionController {


@Autowired
private IInspectionService iInspectionService;

/**
* 任务列表
* @param query
* @return
*/
@GetMapping("/index")
public JsonResult index(InspectionQuery query){
return iInspectionService.index(query);
}







}

+ 21
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/InspectionFileController.java 查看文件

@@ -0,0 +1,21 @@
package com.tuoheng.miniprogram.controller;

import com.tuoheng.miniprogram.service.IInspectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @Author ChengWang
* @Date 2022/11/23
*/
@RestController
@RequestMapping("/inspectionFile")
public class InspectionFileController {

@Autowired
private IInspectionService iInspectionService;



}

+ 47
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/UserController.java 查看文件

@@ -0,0 +1,47 @@
package com.tuoheng.miniprogram.controller;

import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.miniprogram.entity.dto.ResetPwdDto;
import com.tuoheng.miniprogram.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;




/**
* @Author ChengWang
* @Date 2022/11/21
*/
@RestController
@RequestMapping("/user")
public class UserController {

@Autowired
private IUserService iUserService;

/**
* 获取用户信息
* @return
*/
@GetMapping("/userInfo")
public JsonResult userInfo(){
return iUserService.getUserInfo();
}

/**
* 修改密码
* @param dto
* @return
*/
@PutMapping("/restPassword")
public JsonResult restPwd(@RequestBody ResetPwdDto dto){
return iUserService.resetPwd(dto);
}






}

+ 13
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/dao/DeptMapper.java 查看文件

@@ -0,0 +1,13 @@
package com.tuoheng.miniprogram.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.miniprogram.entity.Dept;

/**
* @Author ChengWang
* @Date 2022/11/21
*/
public interface DeptMapper extends BaseMapper<Dept> {

}

+ 17
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/dao/InspectionFileMapper.java 查看文件

@@ -0,0 +1,17 @@
package com.tuoheng.miniprogram.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.miniprogram.entity.InspectionFile;

/**
* @Author ChengWang
* @Date 2022/11/23
*/
public interface InspectionFileMapper extends BaseMapper<InspectionFile> {






}

+ 19
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/dao/InspectionMapper.java 查看文件

@@ -0,0 +1,19 @@
package com.tuoheng.miniprogram.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tuoheng.miniprogram.entity.Inspection;
import com.tuoheng.miniprogram.entity.query.InspectionQuery;
import com.tuoheng.miniprogram.vo.InspectionInfoVo;
import org.apache.ibatis.annotations.Param;

/**
* @Author ChengWang
* @Date 2022/11/21
*/
public interface InspectionMapper extends BaseMapper<Inspection> {


IPage<InspectionInfoVo> queryPage(@Param("page") IPage<Inspection> page,@Param("request") InspectionQuery query);
}

+ 12
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/dao/UserMapper.java 查看文件

@@ -0,0 +1,12 @@
package com.tuoheng.miniprogram.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.miniprogram.entity.User;

/**
* @Author ChengWang
* @Date 2022/11/21
*/
public interface UserMapper extends BaseMapper<User> {
}

+ 73
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/Dept.java 查看文件

@@ -0,0 +1,73 @@
package com.tuoheng.miniprogram.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.List;

/**
* 部门对象
*
* @author wanjing
* @team tuoheng
* @date 2022-11-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_dept")
public class Dept extends BaseEntity {

private static final long serialVersionUID = 1L;

/**
* 租户ID
*/
private String tenantId;

/**
* 部门名称
*/
private String name;

/**
* 部门编码
*/
private String code;

/**
* 部门全称
*/
private String fullname;

/**
* 类型:1公司 2子公司 3部门 4小组
*/
private Integer type;

/**
* 上级ID
*/
private String pid;

/**
* 排序
*/
private Integer sort;

/**
* 备注说明
*/
private String note;

/**
* 子部门 子集
*/
@TableField(exist = false)
List<Dept> itemList;

}

+ 275
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/Inspection.java 查看文件

@@ -0,0 +1,275 @@
package com.tuoheng.miniprogram.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
* 巡检任务表实体类
*
* @Author ChengWang
* @Date 2022/11/21
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_inspection")
public class Inspection extends BaseEntity {
private static final long serialVersionUID = 1L;

/**
* 租户id
*/
private String tenantId;

/**
* 部门id
*/
private String deptId;

/**
* 巡检任务编号
*/
private String code;

/**
* 巡检任务名称
*/
private String name;

/**
* 巡检任务类型 1临时巡检
*/
private Integer type;

/**
* 公路id
*/
private String roadId;

/**
* 公路名称
*/
private String roadName;

/**
* 路段id
*/
private String sectionId;

/**
* 路段名称
*/
private String sectionName;

/**
* 巡检方式类型 1 无人机 2机场
*/
private Integer inspectionType;

/**
* 巡检机场id
*/
private Integer airportId;

/**
* 巡检机场名称
*/
private String airportName;

/**
* 巡检线路id
*/
private Integer inspectionLine;

/**
* 巡检线路名称
*/
private String inspectionLineName;

/**
* 飞行设备
*/
private String equipmentId;

/**
* 飞行设备名称
*/
private String equipmentName;

/**
* 挂载设备(多选逗号","分隔)
*/
private String equipmentMountId;

/**
* 挂载设备名称(多选逗号","分隔)
*/
private String equipmentMountName;

/**
* 5G云盒ID
*/
private String cloudBoxId;

/**
* 云盒名称
*/
private String cloudBoxName;

/**
* 云盒SN号
*/
private String boxSn;

/**
* 飞手(多选逗号","分隔)
*/
private String flightHand;

/**
* 飞手姓名(多选逗号","分隔)
*/
private String flightHandName;

/**
* 计划巡检日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date inspectionTime;

/**
* 执行开始时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date executionStartTime;

/**
* 执行结束时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date executionEndTime;

/**
* 是否实时,1:实时 2:离线 默认:null
*/
private Integer isLive;

/**
* 是否正摄:1是 2否
*/
private Integer isTaken;

/**
* 是否倾斜摄影:1是 2否
*/
private Integer isTilt;

/**
* 原视频地址
*/
private String videoUrl;

/**
* AI识别后视频地址
*/
private String aiVideoUrl;

/**
* 报告地址
*/
private String reportUrl;

/**
* SRT文件地址
*/
private String srtUrl;

/**
* 任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成
*/
private Integer status;

/**
* 算法处理状态:0默认 1待上传 2待分析 3分析中 4成功 5超时 6失败
*/
private Integer analyseStatus;

/**
* ai任务分析进度
*/
private BigDecimal progressbar;

/**
* 备注
*/
private String note;

/**
* 巡检时天气情况
*/
private String weather;

/**
* 飞行高度
*/
private String flyHeight;

/**
* srt文件名称
*/
private String srtName;

/**
* ai心跳更新时间
*/
private Long heartbeatTime;

/**
* 定时任务的执行状态。1:未执行,2:已执行
*/
private Integer executionStatus;

/**
* 起点经度
*/
private String startLongitude;

/**
* 起点纬度
*/
private String startLatitude;

/**
* 终点经度
*/
private String endLongitude;

/**
* 终点纬度
*/
private String endLatitude;

/**
* 联系方式
*/
private String mobile;

/**
* 巡逻地点
*/
private String patrolLocation;



}

+ 146
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/InspectionFile.java 查看文件

@@ -0,0 +1,146 @@
package com.tuoheng.miniprogram.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
* 问题表实体类
*
* @Author ChengWang
* @Date 2022/11/22
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_inspection_file")
public class InspectionFile extends BaseEntity {
private static final long serialVersionUID = 1L;

/**
* 租户id
*/
private String tenantId;

/**
* 图片编号
*/
private String fileCode;

/**
* 巡检任务ID
*/
private String inspectionId;

/**
* 附件类型:1图片 2视频
*/
private Integer fileType;

/**
* 文件名称
*/
private String fileName;

/**
* 缩略图
*/
private String fileThumbnail;

/**
* 原图
*/
private String fileOriginal;

/**
* 标记图
*/
private String fileImage;

/**
* 文件大小
*/
private BigDecimal fileSize;

/**
* 纬度(原始图片纬度)
*/
private String latitude;

/**
* 经度(原始图片经度)
*/
private String longitude;

/**
* 位置信息
*/
private String location;

/**
* 高德地图经度
*/
private String gaodeLongitude;

/**
* 高德地图纬度
*/
private String gaodeLatitude;

/**
* 高德地图地址
*/
private String gaodeAddress;

/**
* 问题类型二级分类ID
*/
private String questionId;

/**
* 图片来源:1AI 2后台 3视频
*/
private Integer source;

/**
* 问题名称
*/
private String questionName;

/**
* 巡检内容
*/
private String content;

/**
* 详细描述
*/
private String questionDesc;

/**
* 状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理
*/
private Integer status;

/**
* 审核人
*/
private String checkUser;

/**
* 审核时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date checkTime;



}

+ 60
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/InspectionFileHandle.java 查看文件

@@ -0,0 +1,60 @@
package com.tuoheng.miniprogram.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
* 巡检问题处理结果表实体类
*
* @Author ChengWang
* @Date 2022/11/22
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_inspection_file_handle")
public class InspectionFileHandle extends BaseEntity {
private static final long serialVersionUID = 1L;

/**
* 租户id
*/
private String tenantId;

/**
* 巡检问题文件ID
*/
private String inspectionFileId;

/**
* 处理人
*/
private String handlerUser;

/**
* 处理后图片(多个图片逗号“,”分隔)
*/
private String handlerImage;

/**
* 处理结果
*/
private String handlerResult;

/**
* 处理完成时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date handlerTime;



}

+ 38
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/InspectionHistory.java 查看文件

@@ -0,0 +1,38 @@
package com.tuoheng.miniprogram.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
* 巡检任务历史表
*
* @Author ChengWang
* @Date 2022/11/22
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_inspection_file_handle")
public class InspectionHistory extends BaseEntity {
private static final long serialVersionUID = 1L;

/**
* 租户id
*/
private String tenantId;

/**
* 巡检任务ID
*/
private String inspectionId;

/**
* 历史名称
*/
private String historyName;


}

+ 42
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/QuestionType.java 查看文件

@@ -0,0 +1,42 @@
package com.tuoheng.miniprogram.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
* 问题类型表
*
* @Author ChengWang
* @Date 2022/11/22
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_inspection_file_handle")
public class QuestionType extends BaseEntity {
private static final long serialVersionUID = 1L;

/**
*编号
*/
private String code;

/**
* 类型名称: 1坑槽,2积水,3裂缝
*/
private Integer name;

/**
* 巡检内容
*/
private String content;

/**
* 排序
*/
private Integer sort;

}

+ 226
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/User.java 查看文件

@@ -0,0 +1,226 @@
package com.tuoheng.miniprogram.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
* <p>
* 后台用户管理表
* </p>
*
* @author 拓恒
* @since 2020-10-30
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("th_oauth_user")
public class User implements Serializable {

private static final long serialVersionUID = 1L;

/**
* 用户ID
*/
@TableId(value = "id", type = IdType.UUID)
private String id;

/**
* 租户ID
*/
private String tenantId;

/**
* 用户编号
*/
private String code;

/**
* 真实姓名
*/
private String realname;

/**
* 昵称
*/
private String nickname;

/**
* 性别:1男 2女 3保密
*/
private Integer gender;

/**
* 头像
*/
private String avatar;

/**
* 手机号码
*/
private String mobile;

/**
* 邮箱地址
*/
private String email;

/**
* 出生日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date birthday;

/**
* 部门ID
*/
private String deptId;

/**
* 省份编码
*/
private String provinceCode;

/**
* 城市编码
*/
private String cityCode;

/**
* 区县编码
*/
private String districtCode;
/**
* 街道编码
*/
private String streetCode;
/**
* 详细地址
*/
private String address;

/**
* 所属城市
*/
private String cityName;

/**
* 登录用户名
*/
private String username;

/**
* 登录密码
*/
private String password;

/**
* 用户类型:1管理员
*/
private Integer type;

/**
* 驾照类型:1飞行执照 2飞行许可证
*/
private Integer driverType;

/**
* 驾照编号
*/
private String driverCode;

/**
* 盐加密
*/
private String salt;

/**
* 个人简介
*/
private String intro;

/**
* 状态:1正常 2禁用
*/
private Integer status;

/**
* 备注
*/
private String note;

/**
* 显示顺序
*/
private Integer sort;

/**
* 登录次数
*/
private Integer loginNum;

/**
* 最近登录IP
*/
private String loginIp;

/**
* 最近登录时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date loginTime;

/**
* 添加人
*/
private String createUser;

/**
* 创建时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;

/**
* 更新人
*/
private String updateUser;

/**
* 更新时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;

/**
* 有效标识
*/
private Integer mark;

/**
* 角色ID
*/
@TableField(exist = false)
private String[] roleIds;

/**
* 城市集合
*/
@TableField(exist = false)
private String[] city;

}

+ 21
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/dto/ResetPwdDto.java 查看文件

@@ -0,0 +1,21 @@
package com.tuoheng.miniprogram.entity.dto;

import lombok.Data;

/**
* @Author ChengWang
* @Date 2022/10/17
*/
@Data
public class ResetPwdDto {

/**
* 原密码
*/
private String newPassword;

/**
* 旧密码
*/
private String oldPassword;
}

+ 102
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/query/InspectionQuery.java 查看文件

@@ -0,0 +1,102 @@
package com.tuoheng.miniprogram.entity.query;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.core.common.BaseQuery;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
* @Author ChengWang
* @Date 2022/11/21
*/
@Data
public class InspectionQuery extends BaseQuery {

/**
* 租户id
*/
private String tenantId;

/**
* 部门id
*/
private String deptId;

/**
* 公路id
*/
private String roadId;

/**
* 路段id
*/
private String sectionId;

/**
* 任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成
*/
private String status;

/**
*巡检方式类型 1 无人机 2机场
*/
private Integer inspectionType;

/**
*巡检线路id
*/
private Integer inspectionLine;

/**
* 巡检线路名称
*/
private String inspectionLineName;

/**
* 巡检任务类型 1 临时巡检
*/
private Integer type;

/**
*起始日期(传入)
*/
private String startTime;

/**
* 结束日期(传入)
*/
private String endTime;

/**
* 起始日期,日期类型
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startTimeDate;

/**
* 结束日期,日期类型
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endTimeDate;

/**
* 执行开始时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date executionStartTime;

/**
*执行结束时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date executionEndTime;


}

tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/entity/query/OidcUpdatePassRequest.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/query/OidcUpdatePassRequest.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/enums/AliyunVodUploadStatusEnum.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/AliyunVodUploadStatusEnum.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/enums/AppHttpCodeEnum.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/AppHttpCodeEnum.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/enums/MarkStatusEnum.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/MarkStatusEnum.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/enums/ServiceExceptionEnum.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/ServiceExceptionEnum.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/exception/ExceptionConstantEnum.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/exception/ExceptionConstantEnum.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/service/IAliyunOssService.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IAliyunOssService.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/service/IAliyuncsVodService.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IAliyuncsVodService.java 查看文件


+ 11
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IDeptService.java 查看文件

@@ -0,0 +1,11 @@
package com.tuoheng.miniprogram.service;

import com.tuoheng.common.core.utils.JsonResult;

/**
* @Author ChengWang
* @Date 2022/11/21
*/
public interface IDeptService {
JsonResult treeList();
}

+ 8
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IInspectionFileService.java 查看文件

@@ -0,0 +1,8 @@
package com.tuoheng.miniprogram.service;

/**
* @Author ChengWang
* @Date 2022/11/23
*/
public interface IInspectionFileService {
}

+ 12
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IInspectionService.java 查看文件

@@ -0,0 +1,12 @@
package com.tuoheng.miniprogram.service;

import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.miniprogram.entity.query.InspectionQuery;

/**
* @Author ChengWang
* @Date 2022/11/21
*/
public interface IInspectionService {
JsonResult index(InspectionQuery query);
}

+ 16
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IUserService.java 查看文件

@@ -0,0 +1,16 @@
package com.tuoheng.miniprogram.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.miniprogram.entity.User;
import com.tuoheng.miniprogram.entity.dto.*;

/**
* @Author ChengWang
* @Date 2022/11/21
*/
public interface IUserService extends IService<User> {
JsonResult getUserInfo();

JsonResult resetPwd(ResetPwdDto dto);
}

tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/service/impl/AliyunOssServiceImpl.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/AliyunOssServiceImpl.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/service/impl/AliyuncsVodServiceImpl.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/AliyuncsVodServiceImpl.java 查看文件


+ 80
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/DeptServiceImpl.java 查看文件

@@ -0,0 +1,80 @@
package com.tuoheng.miniprogram.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.miniprogram.dao.DeptMapper;
import com.tuoheng.miniprogram.entity.Dept;
import com.tuoheng.miniprogram.service.IDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;
import java.util.stream.Collectors;

/**
* @Author ChengWang
* @Date 2022/11/21
*/
@Service
public class DeptServiceImpl implements IDeptService {

@Autowired
private DeptMapper deptMapper;

/**
* 获取部门列表(树形)
* @return
*/
@Override
public JsonResult treeList() {
List<Dept> deptTreeVoList = new ArrayList<>();
List<Dept> list = deptMapper.selectList(new LambdaQueryWrapper<Dept>()
.eq(Dept::getMark, 1));
Map<String, Dept> deptVoMap = new HashMap<>();
for (Dept dept : list) {
deptVoMap.put(dept.getId(),dept);
}
for (Dept dept : list) {
Dept child = dept;
if("0".equals(child.getPid())){
deptTreeVoList.add(dept);
}else {
Dept parent = deptVoMap.get(child.getPid());
parent.getItemList().add(child);
}
}
return JsonResult.success(deptTreeVoList);
// 获取所有一级节点
//预设id值为2
// List<Dept> result = list.stream().
// filter(dept -> dept.getPid().equals("2"))
// .peek(dept -> dept.setItemList(getChildren(dept, list))).sorted(Comparator.comparingInt(dept -> (dept.getSort() == null ? 0 : dept.getSort())))
// .collect(Collectors.toList());
// List<String> list1 = new ArrayList<>();
// for (Dept dept : result) {
// List<Dept> itemList = dept.getItemList();
// if(itemList!=null)
// list1.add(dept.getId());
// List<Dept> list1 = new ArrayList<>();
// result.stream().map(item->{
// TreeUtil.getByParent(list1,item.getPid());
// }).collect(Collectors.toList());

// return JsonResult.success(result);
}

/**
* 递归获取部门的子集
*
* @author zhu_zishuang
* @date 3/13/21
*/
private List<Dept> getChildren(Dept rootDept, List<Dept> list) {
return list.stream().filter(dept ->
dept.getPid().equals(rootDept.getId())
).peek(dept -> {
// 设置子集
dept.setItemList(getChildren(dept, list));
}).sorted(Comparator.comparingInt(dept -> (dept.getSort() == null ? 0 : dept.getSort()))).collect(Collectors.toList());
}
}

+ 109
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/IUserServiceImpl.java 查看文件

@@ -0,0 +1,109 @@
package com.tuoheng.miniprogram.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.CommonUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.SecurityUserUtils;
import com.tuoheng.common.core.utils.StringUtils;
import com.tuoheng.miniprogram.config.CommonsConfig;
import com.tuoheng.miniprogram.constant.OidcUrlConstant;
import com.tuoheng.miniprogram.dao.UserMapper;
import com.tuoheng.miniprogram.entity.dto.ResetPwdDto;
import com.tuoheng.miniprogram.entity.User;
import com.tuoheng.miniprogram.entity.query.OidcUpdatePassRequest;
import com.tuoheng.miniprogram.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
* @Author ChengWang
* @Date 2022/11/21
*/
@Service
@Slf4j
public class IUserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

@Autowired
private UserMapper userMapper;

@Autowired
private RestTemplate restTemplate;

@Override
public JsonResult getUserInfo() {
//获取登录用户名称
String username = SecurityUserUtils.username();
User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(null != username, User::getUsername, username));
if(ObjectUtil.isNull(user)){
return JsonResult.error("登录用户为空");
}
if(2== user.getStatus()){
return JsonResult.error("用户状态禁用");
}
if(StringUtils.isNotEmpty(user.getAvatar())){
user.setAvatar(CommonConfig.imageURL+user.getAvatar());
}


return JsonResult.success(user);
}

@Override
public JsonResult resetPwd(ResetPwdDto dto) {
//获取登录用户信息
String username = SecurityUserUtils.username();
//查询登录用户
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(StringUtils.isNotEmpty(username), User::getUsername, username)
.eq(User::getMark, 1)
.eq(User::getStatus, 1));
if(ObjectUtil.isNull(user)){
return JsonResult.error("用户不存在");
}
//密码校验
if (!user.getPassword().equals(CommonUtils.password(dto.getOldPassword()))) {
return JsonResult.error("旧密码不正确");
}
//设置新密码
user.setPassword(CommonUtils.password(dto.getNewPassword()));
int count = userMapper.updateById(user);
if (count == 0) {
return JsonResult.error(null, "密码修改失败");
}
//设置第三方请求实体
OidcUpdatePassRequest oidcUpdatePassRequest = new OidcUpdatePassRequest();
oidcUpdatePassRequest.setUsername(username);
oidcUpdatePassRequest.setPassword(dto.getNewPassword());
//设置请求头
//设置请求头
org.springframework.http.HttpHeaders resultRequestHeader = new HttpHeaders();
resultRequestHeader.add("Authorization", "Bearer " + SecurityUserUtils.token());
HttpEntity httpEntity = new HttpEntity(oidcUpdatePassRequest, resultRequestHeader);
//设置地址,飞手小程序 经过网关
String url = CommonsConfig.oidcUrl + OidcUrlConstant.USER_UPDATEPASS;
ResponseEntity<JsonResult> response;
try {
response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, JsonResult.class);
} catch (Exception e) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "oidc修改用户密码失败");
}
if (null == response || !response.hasBody()) {
log.error("oidc修改用户密码响应失败");
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "oidc修改用户密码失败");
}
if (response.getBody().getCode() != JsonResult.SUCCESS) {
log.error("oidc修改用户密码失败" + response.getBody());
return JsonResult.error(response.getBody().getMsg());
}
return JsonResult.success(null, "用户密码修改成功");
}
}

+ 14
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionFileServiceImpl.java 查看文件

@@ -0,0 +1,14 @@
package com.tuoheng.miniprogram.service.impl;

import com.tuoheng.miniprogram.service.IInspectionFileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
* @Author ChengWang
* @Date 2022/11/23
*/
@Service
@Slf4j
public class InspectionFileServiceImpl implements IInspectionFileService {
}

+ 163
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionServiceImpl.java 查看文件

@@ -0,0 +1,163 @@
package com.tuoheng.miniprogram.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.common.core.enums.ServiceExceptionEnum;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.SecurityUserUtils;
import com.tuoheng.common.core.utils.StringUtils;
import com.tuoheng.miniprogram.dao.DeptMapper;
import com.tuoheng.miniprogram.dao.InspectionFileMapper;
import com.tuoheng.miniprogram.dao.InspectionMapper;
import com.tuoheng.miniprogram.dao.UserMapper;
import com.tuoheng.miniprogram.entity.Dept;
import com.tuoheng.miniprogram.entity.Inspection;
import com.tuoheng.miniprogram.entity.InspectionFile;
import com.tuoheng.miniprogram.entity.User;
import com.tuoheng.miniprogram.entity.query.InspectionQuery;
import com.tuoheng.miniprogram.service.IInspectionService;
import com.tuoheng.miniprogram.utils.ShiroUtils;
import com.tuoheng.miniprogram.vo.InspectionInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
* @Author ChengWang
* @Date 2022/11/21
*/
@Service
@Slf4j
public class InspectionServiceImpl implements IInspectionService {

@Autowired
private UserMapper userMapper;

@Autowired
private DeptMapper deptMapper;

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

/**
* 任务列表(分页)
* @param query
* @return
*/
@Override
public JsonResult index(InspectionQuery query) {
if(null==query.getLimit() && null == query.getPage()){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
//获取登录人信息,登录人用户名
// String username = SecurityUserUtils.username();
//获取租户id
String tenantId = ShiroUtils.getTenantId();
String username = "wangwang";
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(StringUtils.isNotEmpty(username), User::getUsername, username)
.eq(User::getStatus, 1).eq(User::getMark, 1));
//查询部门及下级部门列表
List<Dept> list = deptMapper.selectList(Wrappers.<Dept>lambdaQuery()
.eq(Dept::getMark, 1));
//预设id为2
//query.setDeptId("1");
// 获取所有下级部门列表
// List<Dept> result = list.stream().
// filter(dept -> dept.getPid().equals(query.getDeptId()))
// .peek(dept -> dept.setItemList(getChildren(dept, list))).sorted(Comparator.comparingInt(dept -> (dept.getSort() == null ? 0 : dept.getSort())))
// .collect(Collectors.toList());
//获取分页数据
IPage<Inspection> page = new Page<>(query.getPage(),query.getLimit());
//获取当前部门对应的巡检任务
List<Inspection> inspectionList = inspectionMapper.selectList(Wrappers.<Inspection>lambdaQuery()
.eq(StringUtils.isNotEmpty(query.getDeptId()), Inspection::getDeptId, query.getDeptId())
.eq(Inspection::getMark, 1)
.eq(Inspection::getTenantId,0));

Date startTime = null;
Date endTime = null;
if(StringUtils.isNotEmpty(query.getStartTime()) && StringUtils.isNotEmpty(query.getEndTime())){
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getStartTime()+" 00:00:00");
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getEndTime()+" 23:59:59");
}
query.setStartTimeDate(startTime);
query.setEndTimeDate(endTime);


IPage<InspectionInfoVo> pageData = inspectionMapper.queryPage(page,query);
pageData.getRecords().stream().forEach(x->{
int problemsFoundNum = 0;
int problemsVerifiedNum = 0;
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery()
.eq(StringUtils.isNotEmpty(x.getId()), InspectionFile::getInspectionId, x.getId())
.eq(InspectionFile::getTenantId, 0));
for (InspectionFile inspectionFile : inspectionFileList) {
if (5 == inspectionFile.getStatus()) {
problemsFoundNum += 1;
}
if (15 == inspectionFile.getStatus()) {
problemsVerifiedNum += 1;
}
}
x.setProblemsFoundNum(problemsFoundNum);
x.setProblemsVerifiedNum(problemsVerifiedNum);
});
//查询每个任务对应的总问题数和已确认的问题数
// List<InspectionInfoVo> inspectionInfoVoList = pageData.getRecords().stream().map(item -> {
// //InspectionInfoVo vo = new InspectionInfoVo();
// // BeanUtils.copyProperties(item, vo);
// int problemsFoundNum = 0;
// int problemsVerifiedNum = 0;
// List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery()
// .eq(StringUtils.isNotEmpty(item.getId()), InspectionFile::getInspectionId, item.getId())
// .eq(InspectionFile::getTenantId, 0));
// for (InspectionFile inspectionFile : inspectionFileList) {
// if (5 == inspectionFile.getStatus()) {
// problemsFoundNum += 1;
// }
// if (15 == inspectionFile.getStatus()) {
// problemsVerifiedNum += 1;
// }
// }
// vo.setProblemsFoundNum(problemsFoundNum);
// vo.setProblemsVerifiedNum(problemsVerifiedNum);
// return vo;
//
// }).collect(Collectors.toList());
// pageData.setRecords(inspectionInfoVoList);

return JsonResult.success(pageData);
}


/**
* 递归获取部门的子集
*
* @author zhu_zishuang
* @date 3/13/21
*/
private List<Dept> getChildren(Dept rootDept, List<Dept> list) {
return list.stream().filter(dept ->
dept.getPid().equals(rootDept.getId())
).peek(dept -> {
// 设置子集
dept.setItemList(getChildren(dept, list));
}).sorted(Comparator.comparingInt(dept -> (dept.getSort() == null ? 0 : dept.getSort()))).collect(Collectors.toList());
}
}

tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/utils/CommonUtils.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/utils/CommonUtils.java 查看文件


tuoheng-service/tuoheng-miniprogram/src/main/java/com.tuoheng.miniprogram/utils/RedisSyncLock.java → tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/utils/RedisSyncLock.java 查看文件


+ 22
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/utils/ShiroUtils.java 查看文件

@@ -0,0 +1,22 @@
package com.tuoheng.miniprogram.utils;

/**
* Shiro工具类
*/
public class ShiroUtils {

/**
* 私有构造器
**/
private ShiroUtils() {
}

/**
* 租户ID
*
* @return
*/
public static String getTenantId() {
return "0";
}
}

+ 46
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/vo/DeptTreeVo.java 查看文件

@@ -0,0 +1,46 @@
package com.tuoheng.miniprogram.vo;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
* 返回部门树形列表视图Vo
*
* @author wanjing
* @team tuoheng
* @date 2022-11-19
*/
@Data
public class DeptTreeVo {

private static final long serialVersionUID = 1L;

/**
* 主键ID
*/
private String id;

/**
* 租户ID
*/
private String tenantId;

/**
* 部门名称
*/
private String name;

/**
* 上级ID
*/
private String pid;

/**
* 子部门
*/
private List<DeptTreeVo> children = new ArrayList<>();


}

+ 80
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/vo/InspectionInfoVo.java 查看文件

@@ -0,0 +1,80 @@
package com.tuoheng.miniprogram.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
* @Author ChengWang
* @Date 2022/11/22
*/
@Data
public class InspectionInfoVo {

/**
* 任务id
*/
private String id;

/**
* 巡检任务编号
*/
private String code;

/**
* 巡检任务名称
*/
private String name;

/**
* 巡检任务类型
*/
private Integer type;

/**
*任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成
*/
private Integer status;

/**
* 巡检方式类型 1 无人机 2机场
*/
private Integer inspectionType;

/**
* 巡检路线id
*/
private Integer inspectionLine;

/**
* 巡逻线路名称
*/
private String inspectionLineName;

/**
* 创建人
*/
private String createUser;

/**
* 任务执行时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy/MM/dd HH:mm", timezone = "GMT+8")
private Date executionStartTime;

/**
* 发现问题数量(status状态为5待确认)
*/
private Integer problemsFoundNum;

/**
* 已核实问题数量(status状态为10已忽略和15已确认)
*/
private Integer problemsVerifiedNum;



}

+ 10
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/DeptMapper.xml 查看文件

@@ -0,0 +1,10 @@
<?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.tuoheng.miniprogram.dao.DeptMapper">




</mapper>

+ 10
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/InspectionFileMapper.xml 查看文件

@@ -0,0 +1,10 @@
<?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.tuoheng.miniprogram.dao.InspectionFileMapper">




</mapper>

+ 97
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/InspectionMapper.xml 查看文件

@@ -0,0 +1,97 @@
<?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.tuoheng.miniprogram.dao.InspectionMapper">
<resultMap type="com.tuoheng.miniprogram.entity.Inspection" id="InspectionResult">
<result property="id" column="id" />
<result property="tenantId" column="tenant_id" />
<result property="deptId" column="dept_id" />
<result property="code" column="code" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="roadId" column="road_id" />
<result property="roadName" column="road_name" />
<result property="sectionId" column="section_id" />
<result property="sectionName" column="section_name" />
<result property="inspectionType" column="inspection_type" />
<result property="airportId" column="airport_id" />
<result property="airportName" column="airport_name" />
<result property="inspectionLine" column="inspection_line" />
<result property="inspectionLineName" column="inspection_line_name" />
<result property="equipmentId" column="equipment_id" />
<result property="equipmentName" column="equipment_name" />
<result property="equipmentMountId" column="equipment_mount_id" />
<result property="equipmentMountName" column="equipment_mount_name" />
<result property="cloudBoxId" column="cloud_box_id" />
<result property="cloudBoxName" column="cloud_box_name" />
<result property="boxSn" column="box_sn" />
<result property="flightHand" column="flight_hand" />
<result property="flightHandName" column="flight_hand_name" />
<result property="inspectionTime" column="inspection_time" />
<result property="executionStartTime" column="execution_start_time" />
<result property="executionEndTime" column="execution_end_time" />
<result property="isLive" column="is_live" />
<result property="isTaken" column="is_taken" />
<result property="isTilt" column="is_tilt" />
<result property="videoUrl" column="video_url" />
<result property="aiVideoUrl" column="ai_video_url" />
<result property="reportUrl" column="report_url" />
<result property="srtUrl" column="srt_url" />
<result property="status" column="status" />
<result property="analyseStatus" column="analyse_status" />
<result property="progressbar" column="progressbar" />
<result property="note" column="note" />
<result property="weather" column="weather" />
<result property="flyHeight" column="fly_height" />
<result property="srtName" column="srt_name" />
<result property="heartbeatTime" column="heartbeat_time" />
<result property="executionStatus" column="execution_status" />
<result property="startLongitude" column="start_longitude" />
<result property="startLatitude" column="start_latitude" />
<result property="endLongitude" column="end_longitude" />
<result property="endLatitude" column="end_latitude" />
<result property="mobile" column="mobile" />
<result property="patrolLocation" column="patrol_location" />
<result property="createUser" column="create_user" />
<result property="createTime" column="create_time" />
<result property="updateUser" column="update_user" />
<result property="updateTime" column="update_time" />
<result property="mark" column="mark" />
</resultMap>


<select id="queryPage" resultType="com.tuoheng.miniprogram.vo.InspectionInfoVo">
select
ti.id,
ti.code,
ti.name,
ti.type,
ti.status,
ti.inspection_type as inspectionType,
ti.inspection_line as inspectionLine,
ti.inspection_line_name as inspectionLineName,
ti.create_user as createUser,
ti.execution_start_time as executionStartTime
from
th_inspection ti
where ti.mark=1 and ti.dept_id = #{request.deptId} and ti.tenant_id = #{request.tenantId}
<if test="request.status !=null">
and ti.status = #{request.status}
</if>
<if test="request.inspectionType !=null">
and ti.inspection_type = #{request.inspectionType}
</if>
<if test="request.inspectionLine !=null">
and ti.inspection_line = #{request.inspectionLine}
</if>
<if test="request.type !=null">
and ti.type = #{request.type}
</if>
<if test="request.startTimeDate !=null and request.endTimeDate !=null">
and ti.execution_start_time BETWEEN #{request.startTimeDate} AND #{request.endTimeDate}
</if>
ORDER BY
ti.create_time DESC
</select>
</mapper>

+ 10
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/UserMapper.xml 查看文件

@@ -0,0 +1,10 @@
<?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.tuoheng.miniprogram.dao.UserMapper">




</mapper>

Loading…
取消
儲存