Bladeren bron

Merge branch 'develop' of http://192.168.11.14:51037/gitadmin/tuoheng_freeway into feature_v1.0

tags/v1.0.0^2
chengwang 1 jaar geleden
bovenliggende
commit
ab77b39d58
57 gewijzigde bestanden met toevoegingen van 1704 en 370 verwijderingen
  1. +6
    -15
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AirPortController.java
  2. +4
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/DeptController.java
  3. +13
    -7
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionController.java
  4. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/SectionController.java
  5. +18
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/InspectionConverMapper.java
  6. +0
    -34
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/Test.java
  7. +8
    -15
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Inspection.java
  8. +95
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/InspectionFile.java
  9. +49
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/InspectionFileHandle.java
  10. +29
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/InspectionWayEnum.java
  11. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/AriportCodeEnum.java
  12. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/dept/AddDeptCodeEnum.java
  13. +3
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/dept/DeleteDeptCodeEnum.java
  14. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/dept/EditDeptCodeEnum.java
  15. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/dept/QueryDeptChildListCodeEnum.java
  16. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/dept/QueryDeptInfoCodeEnum.java
  17. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/dept/QueryDeptTreeListCodeEnum.java
  18. +57
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/AddInspectionCodeEnum.java
  19. +49
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/DeleteInspectionCodeEnum.java
  20. +58
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/EditInspectionCodeEnum.java
  21. +49
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/QueryInspectionPageListCodeEnum.java
  22. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/road/QueryRoadListByDeptIdCodeEnum.java
  23. +4
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/section/QuerySectionListByDeptIdCodeEnum.java
  24. +50
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/section/QuerySectionListByRoadIdCodeEnum.java
  25. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/DeptMapper.java
  26. +12
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileHandleMapper.java
  27. +12
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java
  28. +13
    -26
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionMapper.java
  29. +109
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspection/AddInspectionRequest.java
  30. +108
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspection/EditInspectionRequest.java
  31. +7
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspection/QueryInspectionPageListRequest.java
  32. +2
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/ISectionService.java
  33. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airport/AirportServiceImpl.java
  34. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/add/AddDeptService.java
  35. +1
    -7
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/delete/DeleteDeptService.java
  36. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryChildListService.java
  37. +94
    -49
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryDeptInfoService.java
  38. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryListTreeService.java
  39. +1
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/update/UpdateDeptService.java
  40. +15
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/SectionServiceImpl.java
  41. +6
    -12
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/IInspectionService.java
  42. +23
    -29
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/InspectionServiceImpl.java
  43. +146
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/add/AddInspectionService.java
  44. +89
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/delete/DeleteInspectionService.java
  45. +43
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java
  46. +134
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/UpdateInspectionService.java
  47. +1
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/road/query/QueryRoadListByDeptIdService.java
  48. +2
    -7
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/query/QuerySectionListByDeptIdService.java
  49. +105
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/query/QuerySectionListByRoadIdService.java
  50. +30
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/utils/ShiroUtils.java
  51. +14
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/DeptInfoVo.java
  52. +85
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/QueryInspectionPageListVo.java
  53. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/DeptMapper.xml
  54. +26
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileHandleMapper.xml
  55. +44
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml
  56. +24
    -129
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml
  57. +42
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/TenantMapper.xml

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AirportController.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AirPortController.java Bestand weergeven

@@ -1,21 +1,11 @@
package com.tuoheng.admin.controller;

import com.alibaba.fastjson.JSON;
import com.tuoheng.admin.request.dept.AddDeptRequest;
import com.tuoheng.admin.request.dept.EditDeptRequest;
import com.tuoheng.admin.request.dept.QueryDeptChildPageListRequest;
import com.tuoheng.admin.service.airport.AirportService;
import com.tuoheng.admin.service.dept.IDeptService;
import com.tuoheng.admin.vo.AirLineVO;
import com.tuoheng.admin.vo.AirPortVO;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
* 机场前端控制器
*
@@ -26,25 +16,26 @@ import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/airport")
public class AirportController {
public class AirPortController {

@Autowired
AirportService airportService;
private AirportService airportService;

/**
* 获取巡检机场
*/
@GetMapping("/airport")
public JsonResult getAirportList() {
@GetMapping("/list")
public JsonResult getList() {
return airportService.getAirportList();
}

/**
* 获取巡检线路
*
* @param droneId 机场列表里面的droneId
* @return
*/
@GetMapping("/airport/line/{droneId}")
@GetMapping("/line/{droneId}")
public JsonResult getAirLineList(@PathVariable("droneId") Integer droneId) {
return airportService.getAirLineList(droneId);
}

+ 4
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/DeptController.java Bestand weergeven

@@ -57,7 +57,7 @@ public class DeptController {
/**
* 新增部门
*/
@PostMapping
@PostMapping("/add")
public JsonResult add(@RequestBody AddDeptRequest addDeptRequest) {
log.info("进入新增部门接口");
return deptService.insert(addDeptRequest);
@@ -66,7 +66,7 @@ public class DeptController {
/**
* 修改部门
*/
@PutMapping
@PutMapping("/edit")
public JsonResult update(@RequestBody Map<String, Object> param) {
log.info("进入修改部门接口");
EditDeptRequest oldEditDeptRequest = JSON.parseObject(JSON.toJSONString(param.get("oldEditDeptRequest")), EditDeptRequest.class);
@@ -77,8 +77,8 @@ public class DeptController {
/**
* 删除部门
*/
@DeleteMapping("/{id}")
public JsonResult delete(@PathVariable String id) {
@DeleteMapping("/delete/{id}")
public JsonResult delete(@PathVariable("id") String id) {
log.info("进入删除部门接口");
return deptService.deleteById(id);
}

+ 13
- 7
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionController.java Bestand weergeven

@@ -1,6 +1,8 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.request.inspection.AddInspectionRequest;
import com.tuoheng.admin.request.inspection.EditInspectionRequest;
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest;
import com.tuoheng.admin.service.inspection.IInspectionService;
import com.tuoheng.common.core.utils.JsonResult;
@@ -37,6 +39,7 @@ public class InspectionController {
*/
@GetMapping(value = "/{id}")
public JsonResult getInfo(QueryInspectionPageListRequest request) {
log.info("进入查询任务详情接口");
return iInspectionService.selectOneById(request);
}

@@ -44,23 +47,26 @@ public class InspectionController {
* 新增巡检任务
*/
@PostMapping
public JsonResult add(@RequestBody Inspection inspection) {
return iInspectionService.insert(inspection);
public JsonResult add(@RequestBody AddInspectionRequest addInspectionRequest) {
log.info("进入添加任务接口");
return iInspectionService.insert(addInspectionRequest);
}

/**
* 修改巡检任务
*/
@PutMapping
public JsonResult edit(@RequestBody Inspection inspection) {
return iInspectionService.update(inspection);
public JsonResult edit(@RequestBody EditInspectionRequest editInspectionRequest) {
log.info("进入修改任务接口");
return iInspectionService.update(editInspectionRequest);
}

/**
* 删除巡检任务
*/
@DeleteMapping("/{ids}")
public JsonResult delete(@PathVariable String[] ids) {
return iInspectionService.deleteByIds(ids);
@DeleteMapping("/{id}")
public JsonResult delete(@PathVariable("id") String id) {
log.info("进入删除任务接口");
return iInspectionService.deleteById(id);
}
}

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/SectionController.java Bestand weergeven

@@ -48,6 +48,16 @@ public class SectionController {
return sectionService.getListByDeptId(deptId);
}

/**
* 根据公路id获取该公路下路段信息列表
* @param roadId
* @return
*/
@GetMapping("/list/by/road/{roadId}")
public JsonResult getListByRoadId(@PathVariable("roadId") String roadId) {
return sectionService.getListByRoadId(roadId);
}

/**
* 根据id获取路段详情
* @param sectionId

+ 18
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/InspectionConverMapper.java Bestand weergeven

@@ -0,0 +1,18 @@
package com.tuoheng.admin.conver;

import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.request.inspection.AddInspectionRequest;
import com.tuoheng.admin.request.inspection.EditInspectionRequest;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

@Mapper
public interface InspectionConverMapper {

InspectionConverMapper INSTANCE = Mappers.getMapper(InspectionConverMapper.class);

Inspection fromAddInspectionRequestToInspection(AddInspectionRequest request);

Inspection fromEditInspectionRequestToInspection(EditInspectionRequest request);

}

+ 0
- 34
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/Test.java Bestand weergeven

@@ -1,34 +0,0 @@
package com.tuoheng.admin.conver;

import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.vo.DeptTreeVo;

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

public class Test {

public static void main(String[] args) {
List<Dept> deptList = new ArrayList<>();

Dept dept1 = new Dept();
dept1.setId("1001");
dept1.setTenantId("1");
dept1.setName("aaa");

Dept dept2 = new Dept();
dept2.setId("2002");
dept2.setTenantId("1");
dept2.setName("bbb");

deptList.add(dept1);
deptList.add(dept2);

List<DeptTreeVo> deptTreeVoList = DeptConverMapper.INSTANCE.deptListToDeptVoList(deptList);

for (DeptTreeVo dv : deptTreeVoList) {
System.out.println(dv);
}
}

}

+ 8
- 15
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Inspection.java Bestand weergeven

@@ -2,9 +2,12 @@ package com.tuoheng.admin.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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;
@@ -18,14 +21,13 @@ import java.util.Date;
* @date 2022-11-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_inspection")
public class Inspection extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
@TableId(value = "id", type = IdType.AUTO)
private String id;
/** 租户ID */
private String tenantId;
@@ -57,13 +59,13 @@ public class Inspection extends BaseEntity {
private Integer inspectionType;
/** 巡检机场id */
private Long airportId;
private Integer airportId;
/** 巡检机场名称 */
private String airportName;
/** 巡检线路id */
private Long inspectionLine;
private Integer inspectionLine;
/** 巡检线路名称 */
private String inspectionLineName;
@@ -176,13 +178,4 @@ public class Inspection extends BaseEntity {
/** 巡逻地点 */
private String patrolLocation;
/** 创建人 */
private String createUser;
/** 更新人 */
private String updateUser;
/** 有效标记 */
private Integer mark;
}

+ 95
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/InspectionFile.java Bestand weergeven

@@ -0,0 +1,95 @@
package com.tuoheng.admin.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 巡检任务问题表
*
* @team tuoheng
* @author wanjing
* @date 2022-11-23
*/
@Data
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;
/** 审核时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date checkTime;
/** 有效标记 */
private Integer mark;
}

+ 49
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/InspectionFileHandle.java Bestand weergeven

@@ -0,0 +1,49 @@
package com.tuoheng.admin.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import java.util.Date;
/**
* 巡检问题处理结果对象
*
* @team tuoheng
* @author wanjing
* @date 2022-11-23
*/
@Data
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;
/** 处理完成时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date handlerTime;
/** 创建人 */
private String createUser;
/** 更新人 */
private String updateUser;
/** 有效标记 */
private Integer mark;
}

+ 29
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/InspectionWayEnum.java Bestand weergeven

@@ -0,0 +1,29 @@
package com.tuoheng.admin.enums;

import lombok.Getter;

/**
* 巡检方式类型
*
* @author wanjing
* @team tuoheng
* @date 2022-11-23
*/
public enum InspectionWayEnum {

DRONE(1,"无人机"),
AIRPORT(2,"机场巡逻"),
MABNNEDFLIGHT(3,"飞手值飞");

InspectionWayEnum(int code, String description){
this.code = code;
this.description = description;
}

@Getter
private int code;

@Getter
private String description;

}

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/AriportCodeEnum.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/AriportCodeEnum.java Bestand weergeven

@@ -1,4 +1,4 @@
package com.tuoheng.admin.enums;
package com.tuoheng.admin.enums.code;

public enum AriportCodeEnum {


tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/dept/AddDeptCodeEnum.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/dept/AddDeptCodeEnum.java Bestand weergeven

@@ -1,4 +1,4 @@
package com.tuoheng.admin.enums.dept;
package com.tuoheng.admin.enums.code.dept;

/**
* 添加部门信息返回码

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/dept/DeleteDeptCodeEnum.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/dept/DeleteDeptCodeEnum.java Bestand weergeven

@@ -1,4 +1,4 @@
package com.tuoheng.admin.enums.dept;
package com.tuoheng.admin.enums.code.dept;

/**
* 删除部门信息返回码
@@ -14,8 +14,8 @@ public enum DeleteDeptCodeEnum {
DELETE_DEPT_IS_FAILED(1200500, "删除部门失败"),
DEPT_ID_IS_NULL(1200501, "部门id为空"),
DEPT_IS_NOT_EXIST(1200502, "部门不存在"),
DEPT_IEXIST_USER(1200503, "该级部下存在用户"),
DEPT_IEXIST_CHILDREN_DEPT(1200504, "该级部下存在子部门");
DEPT_IEXIST_USER(1200503, "该级部已绑定用户"),
DEPT_IEXIST_CHILDREN_DEPT(1200504, "该级部下子部门");

/**
* 错误码

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/dept/EditDeptCodeEnum.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/dept/EditDeptCodeEnum.java Bestand weergeven

@@ -1,4 +1,4 @@
package com.tuoheng.admin.enums.dept;
package com.tuoheng.admin.enums.code.dept;

/**
* 修改部门信息返回码

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/dept/QueryDeptChildListCodeEnum.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/dept/QueryDeptChildListCodeEnum.java Bestand weergeven

@@ -1,4 +1,4 @@
package com.tuoheng.admin.enums.dept;
package com.tuoheng.admin.enums.code.dept;

/**
* 获取子部门列表返回码

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/dept/QueryDeptInfoCodeEnum.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/dept/QueryDeptInfoCodeEnum.java Bestand weergeven

@@ -1,4 +1,4 @@
package com.tuoheng.admin.enums.dept;
package com.tuoheng.admin.enums.code.dept;

/**
* 获取部门信息返回码

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/dept/QueryDeptTreeListCodeEnum.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/dept/QueryDeptTreeListCodeEnum.java Bestand weergeven

@@ -1,4 +1,4 @@
package com.tuoheng.admin.enums.dept;
package com.tuoheng.admin.enums.code.dept;

/**
* 获取部门列表返回码

+ 57
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/AddInspectionCodeEnum.java Bestand weergeven

@@ -0,0 +1,57 @@
package com.tuoheng.admin.enums.code.inspection;

/**
* 添加任务信息返回码
* 模块代码:23(任务管理)
* 接口代码:01 (添加任务)
*
* @author wanjing
* @team tuoheng
* @date 2022-11-24
*/
public enum AddInspectionCodeEnum {

ADD_DEPT_IS_FAILED(1230100, "添加任务失败"),
NAME_IS_NULL(1230101, "任务名为空"),
TYPE_IS_NULL(1230102, "任务类型为空"),
ROAD_IS_NULL(1230103, "任务地点为空"),
SECTION_IS_NULL(1230104, "路段信息为空"),
INSPECTION_TYPE_IS_NULL(1230105, "巡检方式为空"),
AIRPORT_IS_NULL(1230106, "巡检机场为空"),
INSPECTION_LINE_IS_NULL(1230107, "巡检路线为空"),
INSPECTION_TIME_IS_NULL(1230108, "巡检时间为空"),
ROAD_IS_NOT_EXIST(1230109, "公路不存在"),
SECTION_IS_NOT_EXIST(1230110, "路段不存在");

/**
* 错误码
*/
private int code;

/**
* 错误信息
*/
private String msg;

AddInspectionCodeEnum(int code, String msg){
this.code = code;
this.msg = msg;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}

}

+ 49
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/DeleteInspectionCodeEnum.java Bestand weergeven

@@ -0,0 +1,49 @@
package com.tuoheng.admin.enums.code.inspection;

/**
* 删除任务信息返回码
* 模块代码:23(任务管理)
* 接口代码:02 (删除任务)
*
* @author wanjing
* @team tuoheng
* @date 2022-11-24
*/
public enum DeleteInspectionCodeEnum {

DELETE_IS_FAILED(1230200, "删除任务失败"),
ID_IS_NULL(1230201, "任务ID为空"),
INSPECTION_IS_NOT_EXIST(1230202, "任务不存在");

/**
* 错误码
*/
private int code;

/**
* 错误信息
*/
private String msg;

DeleteInspectionCodeEnum(int code, String msg){
this.code = code;
this.msg = msg;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}

}

+ 58
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/EditInspectionCodeEnum.java Bestand weergeven

@@ -0,0 +1,58 @@
package com.tuoheng.admin.enums.code.inspection;

/**
* 修改任务信息返回码
* 模块代码:23(任务管理)
* 接口代码:03 (修改任务)
*
* @author wanjing
* @team tuoheng
* @date 2022-11-24
*/
public enum EditInspectionCodeEnum {

ADD_DEPT_IS_FAILED(1230300, "修改任务失败"),
ID_IS_NULL(1230301, "任务ID为空"),
NAME_IS_NULL(1230302, "任务名为空"),
TYPE_IS_NULL(1230303, "任务类型为空"),
ROAD_IS_NULL(1230304, "任务地点为空"),
SECTION_IS_NULL(1230305, "路段信息为空"),
INSPECTION_TYPE_IS_NULL(1230306, "巡检方式为空"),
AIRPORT_IS_NULL(1230307, "巡检机场为空"),
INSPECTION_LINE_IS_NULL(1230308, "巡检路线为空"),
INSPECTION_TIME_IS_NULL(1230309, "巡检时间为空"),
ROAD_IS_NOT_EXIST(1230310, "公路不存在"),
SECTION_IS_NOT_EXIST(1230311, "路段不存在");

/**
* 错误码
*/
private int code;

/**
* 错误信息
*/
private String msg;

EditInspectionCodeEnum(int code, String msg){
this.code = code;
this.msg = msg;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}

}

+ 49
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/QueryInspectionPageListCodeEnum.java Bestand weergeven

@@ -0,0 +1,49 @@
package com.tuoheng.admin.enums.code.inspection;

/**
* 查询巡检任务分页列表返回码
* 模块代码:23(公路管理)
* 接口代码:04 (根据部门id获取该部门下公路列表)
*
* @author wanjing
* @team tuoheng
* @date 2022-11-24
*/
public enum QueryInspectionPageListCodeEnum {

QUERY_IS_FAILED(1230400, "获取数据失败"),
DEPT_ID_IS_NULL(1230401, "部门id为空"),
DEPT_IS_NOT_EXIST(1230402, "部门不存在");

/**
* 错误码
*/
private int code;

/**
* 错误信息
*/
private String msg;

QueryInspectionPageListCodeEnum(int code, String msg){
this.code = code;
this.msg = msg;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}

}

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/road/QueryRoadListByDeptIdCodeEnum.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/road/QueryRoadListByDeptIdCodeEnum.java Bestand weergeven

@@ -1,4 +1,4 @@
package com.tuoheng.admin.enums.road;
package com.tuoheng.admin.enums.code.road;

/**
* 根据部门id获取该部门下公路列表返回码

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/section/QuerySectionListByDeptIdCodeEnum.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/section/QuerySectionListByDeptIdCodeEnum.java Bestand weergeven

@@ -1,4 +1,4 @@
package com.tuoheng.admin.enums.section;
package com.tuoheng.admin.enums.code.section;

/**
* 根据部门id获取该部门下公路列表返回码
@@ -12,9 +12,9 @@ package com.tuoheng.admin.enums.section;
public enum QuerySectionListByDeptIdCodeEnum {

QUERY_IS_FAILED(1220300, "获取数据失败"),
DEPT_ID_IS_NULL(1220201, "部门id为空"),
DEPT_IS_NOT_EXIST(1220202, "部门不存在"),
SECTION_LIST_IS_NULL(1220203, "路段列表为空");;
DEPT_ID_IS_NULL(1220301, "部门id为空"),
DEPT_IS_NOT_EXIST(1220302, "部门不存在"),
SECTION_LIST_IS_NULL(1220303, "路段列表为空");

/**
* 错误码

+ 50
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/section/QuerySectionListByRoadIdCodeEnum.java Bestand weergeven

@@ -0,0 +1,50 @@
package com.tuoheng.admin.enums.code.section;

/**
* 根据公路id获取该公路下公路列表返回码
* 模块代码:22(路段管理)
* 接口代码:04 (根据公路d获取该公路下公路列表)
*
* @author wanjing
* @team tuoheng
* @date 2022-11-24
*/
public enum QuerySectionListByRoadIdCodeEnum {

QUERY_IS_FAILED(1220400, "获取数据失败"),
ROAD_ID_IS_NULL(1220401, "公路id为空"),
ROAD_IS_NOT_EXIST(1220402, "公路不存在"),
SECTION_LIST_IS_NULL(1220403, "路段列表为空");

/**
* 错误码
*/
private int code;

/**
* 错误信息
*/
private String msg;

QuerySectionListByRoadIdCodeEnum(int code, String msg){
this.code = code;
this.msg = msg;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}

}

+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/DeptMapper.java Bestand weergeven

@@ -33,9 +33,9 @@ public interface DeptMapper extends BaseMapper<Dept> {
/**
* 删除部门
*
* @param dept 部门
* @param id 部门
* @return 结果
*/
int deleteById(Dept dept);
int deleteById(String id);

}

+ 12
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileHandleMapper.java Bestand weergeven

@@ -0,0 +1,12 @@
package com.tuoheng.admin.mapper;

/**
* 巡检问题处理结果Mapper接口
*
* @team tuoheng
* @author wanjing
* @date 2022-11-23
*/
public interface InspectionFileHandleMapper {

}

+ 12
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java Bestand weergeven

@@ -0,0 +1,12 @@
package com.tuoheng.admin.mapper;

/**
* 【请填写功能名称】Mapper接口
*
* @team tuoheng
* @author wanjing
* @date 2022-11-23
*/
public interface InspectionFileMapper {

}

+ 13
- 26
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionMapper.java Bestand weergeven

@@ -1,12 +1,14 @@
package com.tuoheng.admin.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* 巡检任务Mapper接口
*
@@ -14,13 +16,13 @@ import org.apache.ibatis.annotations.Param;
* @author wanjing
* @date 2022-11-16
*/
public interface InspectionMapper {
/**
* 查询巡检任务
*
* @param request 巡检任务查询实体
* @return 巡检任务
*/
public interface InspectionMapper extends BaseMapper<Inspection> {
/**
* 查询巡检任务
*
* @param request 巡检任务查询实体
* @return 巡检任务
*/
Inspection selectOneById(QueryInspectionPageListRequest request);

/**
@@ -29,7 +31,7 @@ public interface InspectionMapper {
* @param request 巡检任务查询实体
* @return 巡检任务集合
*/
Page<Inspection> selectPageList(@Param("page") Page<Inspection> page, @Param("request") QueryInspectionPageListRequest request);
Page<Inspection> selectPageList(@Param("page") IPage page, @Param("request") QueryInspectionPageListRequest request);

/**
* 查询巡检任务列表
@@ -39,17 +41,9 @@ public interface InspectionMapper {
*/
List<Inspection> selectList(QueryInspectionPageListRequest request);

/**
* 新增巡检任务
*
* @param inspection 巡检任务
* @return 结果
*/
int insert(Inspection inspection);

/**
* 修改巡检任务
*
*
* @param inspection 巡检任务
* @return 结果
*/
@@ -63,11 +57,4 @@ public interface InspectionMapper {
*/
int deleteById(String id);

/**
* 批量删除巡检任务
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteByIds(String[] ids);
}

+ 109
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspection/AddInspectionRequest.java Bestand weergeven

@@ -0,0 +1,109 @@
package com.tuoheng.admin.request.inspection;

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

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
* 新增任务请求参数
*
* @author wanjing
* @team tuoheng
* @date 2022-11-24
*/
@Data
public class AddInspectionRequest {

/**
* 用户ID
*/
private String userId;

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

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

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

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

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

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

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

/**
* 巡检任务类型: 1 临时巡检(目前只有该一种类型)
*/
private Integer type;

/**
* 巡检方式类型: 1 无人机 2机场巡逻 3 飞手值飞
*/
private Integer inspectionType;

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

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

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

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

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

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

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

}

+ 108
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspection/EditInspectionRequest.java Bestand weergeven

@@ -0,0 +1,108 @@
package com.tuoheng.admin.request.inspection;

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

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
* 修改任务请求参数
*
* @author wanjing
* @team tuoheng
* @date 2022-11-24
*/
@Data
public class EditInspectionRequest {

/**
* ID
*/
private String id;

/**
* 用户ID
*/
private String userId;

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

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

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

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

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

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

/**
* 巡检任务类型: 1 临时巡检(目前只有该一种类型)
*/
private Integer type;

/**
* 巡检方式类型: 1 无人机 2机场巡逻 3 飞手值飞
*/
private Integer inspectionType;

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

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

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

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

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

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

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

}

+ 7
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspection/QueryInspectionPageListRequest.java Bestand weergeven

@@ -23,6 +23,11 @@ public class QueryInspectionPageListRequest extends BaseQuery {
*/
private Integer tenantId;

/**
* 关键字,匹配任务编号和任务名称
*/
private String key;

/**
* 任务编号
*/
@@ -54,13 +59,13 @@ public class QueryInspectionPageListRequest extends BaseQuery {
private Integer status;

/**
* 巡检方式类型: 1 无人机 2机场
* 巡检方式类型: 1 无人机 2机场巡逻 3 飞手值飞
*/
private Integer inspectionType;

/**
* 部门Id
*/
private Integer deptId;
private String deptId;

}

+ 2
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/ISectionService.java Bestand weergeven

@@ -16,6 +16,8 @@ public interface ISectionService extends IBaseService<Section> {

JsonResult getListByDeptId(String deptId);

JsonResult getListByRoadId(String roadId);

JsonResult editInfo(Section entity);

JsonResult getSectionInfo(String sectionId);

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airport/AirportServiceImpl.java Bestand weergeven

@@ -2,7 +2,7 @@ package com.tuoheng.admin.service.airport;

import cn.hutool.core.util.ObjectUtil;
import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.enums.AriportCodeEnum;
import com.tuoheng.admin.enums.code.AriportCodeEnum;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.admin.vo.AirLineVO;

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/add/AddDeptService.java Bestand weergeven

@@ -2,7 +2,7 @@ package com.tuoheng.admin.service.dept.add;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.dept.AddDeptCodeEnum;
import com.tuoheng.admin.enums.code.dept.AddDeptCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.RoadDeptMapper;
import com.tuoheng.admin.mapper.SectionDeptMapper;

+ 1
- 7
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/delete/DeleteDeptService.java Bestand weergeven

@@ -1,14 +1,12 @@
package com.tuoheng.admin.service.dept.delete;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.dto.RoadSectionDto;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.dept.DeleteDeptCodeEnum;
import com.tuoheng.admin.enums.code.dept.DeleteDeptCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.RoadDeptMapper;
import com.tuoheng.admin.mapper.SectionDeptMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.request.dept.EditDeptRequest;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
@@ -16,13 +14,9 @@ import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* 删除部门业务层处理

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryChildListService.java Bestand weergeven

@@ -6,7 +6,7 @@ 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.admin.entity.Dept;
import com.tuoheng.admin.enums.dept.QueryDeptChildListCodeEnum;
import com.tuoheng.admin.enums.code.dept.QueryDeptChildListCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.request.dept.QueryDeptChildPageListRequest;
import com.tuoheng.admin.utils.ShiroUtils;

+ 94
- 49
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryDeptInfoService.java Bestand weergeven

@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.conver.DeptConverMapper;
import com.tuoheng.admin.dto.RoadSectionDto;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.dept.QueryDeptInfoCodeEnum;
import com.tuoheng.admin.enums.code.dept.QueryDeptInfoCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.admin.vo.DeptInfoVo;
@@ -35,6 +35,9 @@ public class QueryDeptInfoService {
@Autowired
private DeptMapper deptMapper;

@Autowired
private UserMapper userMapper;

@Autowired
private RoadInformationMapper roadInformationMapper;

@@ -47,12 +50,12 @@ public class QueryDeptInfoService {
@Autowired
private SectionDeptMapper sectionDeptMapper;

public JsonResult getDeptInfo(String id) {
log.info("进入获取部门信息业务");
public JsonResult getDeptInfo(String deptId) {
log.info("进入获取部门信息业务, deptId:{}", deptId);
String tenantId = ShiroUtils.getTenantId();

// 校验
JsonResult result = this.check(tenantId, id);
JsonResult result = this.check(tenantId, deptId);
if (0 != result.getCode()) {
log.info("获取部门信息业务:校验失败:{}", result.getMsg());
return result;
@@ -61,31 +64,21 @@ public class QueryDeptInfoService {
// 在校验中,判断部门是否存在时,若部门存在,直接将部门信息返回,减少数据库查询次数
Dept dept = (Dept) result.getData();

// 获取该部门下公路列表
List<RoadInformation> roadInformationList = this.getRoadInformationList(tenantId, id);
if (CollectionUtil.isEmpty(roadInformationList)) {
// 不会出现此场景,在代码层面考虑健壮性,加此判断
// 根据业务需求,添加部门时,必须添加公路和路段信息
// 若公路数据为空,说明肯定也没也路段信息,不用继续往下判断,因此直接返回
log.info("获取部门信息业务:公路信息为空");
return JsonResult.success(dept);
}

// 获取该部门下路段列表
List<Section> sectionList = this.getSectionList(tenantId, id);
if (CollectionUtil.isEmpty(sectionList)) {
// 不会出现此场景,在代码层面考虑健壮性,加此判断
// 若路段信息为空,不用继续往下判断,因此直接返回
log.info("获取部门信息业务:路段信息为空");
return JsonResult.success(dept);
}

// 处理公路与路段的对应关系
List<RoadSectionDto> roadSectionDtoList = this.getRoadSectionDtoList(roadInformationList, sectionList);
List<RoadSectionDto> roadSectionDtoList = this.getRoadSectionDtoList(tenantId, deptId);

// 拼装返回数据实体
Dept parent = this.getParentDept(tenantId, dept.getPid());
Integer userCount = this.getUserCount(tenantId, deptId);
Integer childDeptCount = this.getChildDeptCount(tenantId, deptId);

DeptInfoVo deptInfoVo = DeptConverMapper.INSTANCE.fromDeptToDeptVo(dept);
deptInfoVo.setRoadSectionDtoList(roadSectionDtoList);
deptInfoVo.setUserCount(userCount);
deptInfoVo.setChildDeptCount(childDeptCount);
if (null != parent) {
deptInfoVo.setPname(parent.getName());
}

return JsonResult.success(deptInfoVo);
}
@@ -112,6 +105,83 @@ public class QueryDeptInfoService {
return JsonResult.success(dept);
}

/**
* 获取父部门信息
*/
private Dept getParentDept(String tenantId, String pid) {
Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>()
.eq(Dept::getTenantId, tenantId)
.eq(Dept::getId, pid)
.eq(Dept::getMark, 1));
return dept;
}

/**
* 获取部门下用户数
*/
private Integer getUserCount(String tenantId, String deptId) {
Integer count = userMapper.selectCount(new LambdaQueryWrapper<User>()
.eq(User::getTenantId, tenantId)
.eq(User::getDeptId, deptId)
.eq(User::getMark, 1));
return count;
}

/**
* 获取部门下子部门数
*/
private Integer getChildDeptCount(String tenantId, String deptId) {
Integer count = deptMapper.selectCount(new LambdaQueryWrapper<Dept>()
.eq(Dept::getTenantId, tenantId)
.eq(Dept::getPid, deptId)
.eq(Dept::getMark, 1));
return count;
}

/**
* 拼装数据
* @param tenantId
* @param id
* @return
*/
private List<RoadSectionDto> getRoadSectionDtoList(String tenantId, String id) {
// 获取该部门下公路列表
List<RoadInformation> roadInformationList = this.getRoadInformationList(tenantId, id);
if (CollectionUtil.isEmpty(roadInformationList)) {
// 不会出现此场景,在代码层面考虑健壮性,加此判断
// 根据业务需求,添加部门时,必须添加公路和路段信息
// 若公路数据为空,说明肯定也没也路段信息,不用继续往下判断,因此直接返回
log.info("获取部门信息业务:公路信息为空");
return null;
}

// 获取该部门下路段列表
List<Section> sectionList = this.getSectionList(tenantId, id);
if (CollectionUtil.isEmpty(sectionList)) {
// 不会出现此场景,在代码层面考虑健壮性,加此判断
// 若路段信息为空,不用继续往下判断,因此直接返回
log.info("获取部门信息业务:路段信息为空");
return null;
}

List<RoadSectionDto> roadSectionDtoList = new ArrayList<>();
RoadSectionDto roadSectionDto;
List<Section> sectionListTmp;
for (RoadInformation roadInformation : roadInformationList) {
roadSectionDto = new RoadSectionDto();
sectionListTmp = new ArrayList<>();
for (Section section : sectionList) {
if (section.getRoadId().equals(roadInformation.getId())) {
sectionListTmp.add(section);
}
}
roadSectionDto.setRoad(roadInformation);
roadSectionDto.setSectionList(sectionListTmp);
roadSectionDtoList.add(roadSectionDto);
}
return roadSectionDtoList;
}

/**
* 查询该部门下公路信息列表
* @param tenantId
@@ -153,29 +223,4 @@ public class QueryDeptInfoService {
List<Section> sectionList = sectionMapper.getListByMap(map);
return sectionList;
}

/**
* 拼装数据
* @param roadInformationList
* @param sectionList
* @return
*/
private List<RoadSectionDto> getRoadSectionDtoList(List<RoadInformation> roadInformationList, List<Section> sectionList) {
List<RoadSectionDto> roadSectionDtoList = new ArrayList<>();
RoadSectionDto roadSectionDto;
List<Section> sectionListTmp;
for (RoadInformation roadInformation : roadInformationList) {
roadSectionDto = new RoadSectionDto();
sectionListTmp = new ArrayList<>();
for (Section section : sectionList) {
if (section.getRoadId().equals(roadInformation.getId())) {
sectionListTmp.add(section);
}
}
roadSectionDto.setRoad(roadInformation);
roadSectionDto.setSectionList(sectionListTmp);
roadSectionDtoList.add(roadSectionDto);
}
return roadSectionDtoList;
}
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryListTreeService.java Bestand weergeven

@@ -4,7 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.conver.DeptConverMapper;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.enums.dept.QueryDeptTreeListCodeEnum;
import com.tuoheng.admin.enums.code.dept.QueryDeptTreeListCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.vo.DeptTreeVo;
import com.tuoheng.common.core.utils.JsonResult;

+ 1
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/update/UpdateDeptService.java Bestand weergeven

@@ -3,13 +3,10 @@ package com.tuoheng.admin.service.dept.update;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.dto.RoadSectionDto;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.dept.AddDeptCodeEnum;
import com.tuoheng.admin.enums.dept.DeleteDeptCodeEnum;
import com.tuoheng.admin.enums.dept.EditDeptCodeEnum;
import com.tuoheng.admin.enums.code.dept.EditDeptCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.RoadDeptMapper;
import com.tuoheng.admin.mapper.SectionDeptMapper;
import com.tuoheng.admin.request.dept.AddDeptRequest;
import com.tuoheng.admin.request.dept.EditDeptRequest;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.common.core.utils.DateUtils;

+ 15
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/SectionServiceImpl.java Bestand weergeven

@@ -15,6 +15,7 @@ import com.tuoheng.admin.mapper.SectionMapper;
import com.tuoheng.admin.query.SectionQuery;
import com.tuoheng.admin.service.ISectionService;
import com.tuoheng.admin.service.section.query.QuerySectionListByDeptIdService;
import com.tuoheng.admin.service.section.query.QuerySectionListByRoadIdService;
import com.tuoheng.admin.vo.SectionInfoVo;
import com.tuoheng.common.core.common.BaseServiceImpl;
import com.tuoheng.common.core.enums.ServiceExceptionEnum;
@@ -49,6 +50,9 @@ public class SectionServiceImpl extends BaseServiceImpl<SectionMapper, Section>
@Autowired
private QuerySectionListByDeptIdService querySectionListByDeptIdService;

@Autowired
private QuerySectionListByRoadIdService querySectionListByRoadIdService;

@Override
public JsonResult queryPage(SectionQuery query) {
if(null==query.getLimit() && null == query.getPage()){
@@ -104,7 +108,17 @@ public class SectionServiceImpl extends BaseServiceImpl<SectionMapper, Section>
*/
@Override
public JsonResult getListByDeptId(String deptId) {
return querySectionListByDeptIdService.getRoadList(deptId);
return querySectionListByDeptIdService.getList(deptId);
}

/**
* 根据公路id获取该公路下路段信息列表
* @param roadId
* @return
*/
@Override
public JsonResult getListByRoadId(String roadId) {
return querySectionListByRoadIdService.getList(roadId);
}

@Override

+ 6
- 12
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/IInspectionService.java Bestand weergeven

@@ -1,6 +1,8 @@
package com.tuoheng.admin.service.inspection;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.request.inspection.AddInspectionRequest;
import com.tuoheng.admin.request.inspection.EditInspectionRequest;
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest;
import com.tuoheng.common.core.utils.JsonResult;
@@ -40,26 +42,18 @@ public interface IInspectionService {
/**
* 新增巡检任务
*
* @param Inspection 巡检任务
* @param addInspectionRequest 新增任务请求参数
* @return 结果
*/
JsonResult insert(Inspection Inspection);
JsonResult insert(AddInspectionRequest addInspectionRequest);
/**
* 修改巡检任务
*
* @param Inspection 巡检任务
* @param editInspectionRequest 修改任务请求参数
* @return 结果
*/
JsonResult update(Inspection Inspection);
/**
* 批量删除巡检任务
*
* @param ids 需要删除的巡检任务主键集合
* @return 结果
*/
JsonResult deleteByIds(String[] ids);
JsonResult update(EditInspectionRequest editInspectionRequest);
/**
* 删除巡检任务信息

+ 23
- 29
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/InspectionServiceImpl.java Bestand weergeven

@@ -2,8 +2,13 @@ package com.tuoheng.admin.service.inspection;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.request.inspection.AddInspectionRequest;
import com.tuoheng.admin.request.inspection.EditInspectionRequest;
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest;
import com.tuoheng.admin.service.inspection.add.AddInspectionService;
import com.tuoheng.admin.service.inspection.delete.DeleteInspectionService;
import com.tuoheng.admin.service.inspection.query.QueryInspectionPageListService;
import com.tuoheng.admin.service.inspection.update.UpdateInspectionService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -23,10 +28,19 @@ public class InspectionServiceImpl implements IInspectionService {
private InspectionMapper inspectionMapper;
@Autowired
QueryInspectionPageListService queryInspectionPageListService;
private QueryInspectionPageListService queryInspectionPageListService;
@Autowired
private AddInspectionService addinspectionService;
@Autowired
private UpdateInspectionService updateInspectionService;
@Autowired
private DeleteInspectionService deleteInspectionService;
/**
* 查询巡检任务分页列表
* 查询巡检任务分页分页列表
*
* @param queryInspectionRequest 巡检任务查询实体
* @return
@@ -76,41 +90,23 @@ public class InspectionServiceImpl implements IInspectionService {
/**
* 新增巡检任务
*
* @param inspection 巡检任务
* @param addInspectionRequest 新增任务请求参数
* @return 结果
*/
@Override
public JsonResult insert(Inspection inspection) {
inspectionMapper.insert(inspection);
return JsonResult.success();
public JsonResult insert(AddInspectionRequest addInspectionRequest) {
return addinspectionService.add(addInspectionRequest);
}
/**
* 修改巡检任务
*
* @param inspection 巡检任务
* @return 结果
*/
@Override
public JsonResult update(Inspection inspection) {
inspectionMapper.update(inspection);
return JsonResult.success();
}
/**
* 批量删除巡检任务
*
* @param ids 需要删除的巡检任务主键
* @param editInspectionRequest 修改任务请求参数
* @return 结果
*/
@Override
public JsonResult deleteByIds(String[] ids) {
inspectionMapper.deleteByIds(ids);
return JsonResult.success();
public JsonResult update(EditInspectionRequest editInspectionRequest) {
return updateInspectionService.update(editInspectionRequest);
}
/**
@@ -121,8 +117,6 @@ public class InspectionServiceImpl implements IInspectionService {
*/
@Override
public JsonResult deleteById(String id) {
inspectionMapper.deleteById(id);
return JsonResult.success();
return deleteInspectionService.deleteById(id);
}
}

+ 146
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/add/AddInspectionService.java Bestand weergeven

@@ -0,0 +1,146 @@
package com.tuoheng.admin.service.inspection.add;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.conver.InspectionConverMapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.code.inspection.AddInspectionCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.inspection.AddInspectionRequest;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* 添加任务业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-11-23
*/
@Slf4j
@Service
public class AddInspectionService {

@Autowired
private UserMapper userMapper;

@Autowired
private DeptMapper deptMapper;

@Autowired
private RoadInformationMapper roadInformationMapper;

@Autowired
private SectionMapper sectionMapper;

@Autowired
private InspectionMapper inspectionMapper;

/**
* 添加任务
*
* @return
*/
public JsonResult add(AddInspectionRequest addInspectionRequest) {
log.info("进入添加任务业务接口");
String userId = ShiroUtils.getUserId();
String tenantId = ShiroUtils.getTenantId();
JsonResult result = this.check(tenantId, addInspectionRequest);
if (0 != result.getCode()) {
log.info("添加任务业务接口:校验失败:{}", result.getMsg());
return result;
}

User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getTenantId, tenantId)
.eq(User::getId, userId)
.eq(User::getMark, 1));

Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>()
.eq(Dept::getTenantId, tenantId)
.eq(Dept::getId, user.getDeptId())
.eq(Dept::getMark, 1));

String code = DateUtils.generateCode("XJRW");
addInspectionRequest.setTenantId(tenantId);
addInspectionRequest.setCode(code);
addInspectionRequest.setDeptId(dept.getId());

Inspection inspection = InspectionConverMapper.INSTANCE.fromAddInspectionRequestToInspection(addInspectionRequest);

Integer rowId = inspectionMapper.insert(inspection);
log.info("添加任务, 返回结果: deptId={}", rowId);

if (rowId <= 0) {
log.info("添加任务业务接口:添加任务失败:{}", result.getMsg());
return JsonResult.error(AddInspectionCodeEnum.ADD_DEPT_IS_FAILED.getCode(), AddInspectionCodeEnum.ADD_DEPT_IS_FAILED.getMsg());
}

log.info("添加任务业务接口:添加任务成功:{}", inspection);
return JsonResult.success(inspection);
}

/**
* 检查参数
* @param tenantId
* @param addInspectionRequest
* @return
*/
private JsonResult check(String tenantId, AddInspectionRequest addInspectionRequest) {
if (StringUtils.isEmpty(addInspectionRequest.getName())) {
return JsonResult.error(AddInspectionCodeEnum.NAME_IS_NULL.getCode(), AddInspectionCodeEnum.NAME_IS_NULL.getMsg());
}

if (null == addInspectionRequest.getType()) {
return JsonResult.error(AddInspectionCodeEnum.TYPE_IS_NULL.getCode(), AddInspectionCodeEnum.TYPE_IS_NULL.getMsg());
}

if (null == addInspectionRequest.getRoadId() || StringUtils.isEmpty(addInspectionRequest.getRoadName())) {
return JsonResult.error(AddInspectionCodeEnum.ROAD_IS_NULL.getCode(), AddInspectionCodeEnum.ROAD_IS_NULL.getMsg());
}

if (null == addInspectionRequest.getSectionId() || StringUtils.isEmpty(addInspectionRequest.getSectionName())) {
return JsonResult.error(AddInspectionCodeEnum.SECTION_IS_NULL.getCode(), AddInspectionCodeEnum.SECTION_IS_NULL.getMsg());
}

if (null == addInspectionRequest.getInspectionType()) {
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getMsg());
}

if (null == addInspectionRequest.getAirportId() || StringUtils.isEmpty(addInspectionRequest.getAirportName())) {
return JsonResult.error(AddInspectionCodeEnum.AIRPORT_IS_NULL.getCode(), AddInspectionCodeEnum.AIRPORT_IS_NULL.getMsg());
}

if (null == addInspectionRequest.getInspectionLine() || StringUtils.isEmpty(addInspectionRequest.getInspectionLineName())) {
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getMsg());
}

if (null == addInspectionRequest.getInspectionTime()) {
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getMsg());
}

Integer roadCount = roadInformationMapper.selectCount(Wrappers.<RoadInformation>lambdaQuery()
.eq(RoadInformation::getTenantId, tenantId)
.eq(RoadInformation::getId, addInspectionRequest.getRoadId())
.eq(RoadInformation::getMark, 1));

if (roadCount <= 0) {
return JsonResult.error(AddInspectionCodeEnum.ROAD_IS_NOT_EXIST.getCode(), AddInspectionCodeEnum.ROAD_IS_NOT_EXIST.getMsg());
}

Integer sectionCount = sectionMapper.selectCount(Wrappers.<Section>lambdaQuery()
.eq(Section::getTenantId, tenantId)
.eq(Section::getId, addInspectionRequest.getSectionId())
.eq(Section::getMark, 1));
if (sectionCount <= 0) {
return JsonResult.error(AddInspectionCodeEnum.SECTION_IS_NOT_EXIST.getCode(), AddInspectionCodeEnum.SECTION_IS_NOT_EXIST.getMsg());
}
return JsonResult.success();
}

}

+ 89
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/delete/DeleteInspectionService.java Bestand weergeven

@@ -0,0 +1,89 @@
package com.tuoheng.admin.service.inspection.delete;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.code.dept.DeleteDeptCodeEnum;
import com.tuoheng.admin.enums.code.inspection.DeleteInspectionCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
* 删除任务业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-11-24
*/
@Slf4j
@Service
public class DeleteInspectionService {

@Autowired
private InspectionMapper inspectionMapper;

public JsonResult deleteById(String id) {
log.info("进入删除任务业务接口");
String tenantId = ShiroUtils.getTenantId();
JsonResult result = this.check(tenantId, id);
if (0 != result.getCode()) {
log.info("删除部门任务接口:校验失败:{}", result.getMsg());
return result;
}

// 在校验中,判断部门是否存在时,若部门存在,直接将部门信息返回,减少数据库查询次数
Inspection inspection = (Inspection) result.getData();

// inspection.setUpdateUser(SecurityUtils.getUserId());
inspection.setUpdateTime(DateUtils.now());

Integer rowId = inspectionMapper.deleteById(id);

log.info("删除任务, 返回结果: deptId={}", rowId);

if (rowId <= 0) {
log.info("删除任务业务接口:删除任务失败:{}", result.getMsg());
return JsonResult.error(DeleteInspectionCodeEnum.DELETE_IS_FAILED.getCode(), DeleteInspectionCodeEnum.DELETE_IS_FAILED.getMsg());
}

log.info("删除任务业务接口:删除任务成功:id={}", inspection.getId());
return JsonResult.success("删除部门任务");
}

/**
* 检查参数
* @param tenantId
* @param id
* @return
*/
private JsonResult check(String tenantId, String id) {
// 判断id是否为空
if (StringUtils.isEmpty(id)) {
return JsonResult.error(DeleteInspectionCodeEnum.ID_IS_NULL.getCode(), DeleteInspectionCodeEnum.ID_IS_NULL.getMsg());
}

// 判断任务是否存在
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getTenantId, tenantId)
.eq(Inspection::getId, id)
.eq(Inspection::getMark, 1));
if (null == inspection) {
return JsonResult.error(DeleteInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getCode(), DeleteInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getMsg());
}

return JsonResult.success(inspection);
}



}

+ 43
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java Bestand weergeven

@@ -1,15 +1,25 @@
package com.tuoheng.admin.service.inspection.query;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.enums.InspectionWayEnum;
import com.tuoheng.admin.enums.code.dept.EditDeptCodeEnum;
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 查询巡检任务分页列表业务层处理
*
@@ -21,6 +31,8 @@ import org.springframework.stereotype.Service;
@Service
public class QueryInspectionPageListService {

@Autowired
private DeptMapper deptMapper;
@Autowired
private InspectionMapper inspectionMapper;

@@ -34,8 +46,25 @@ public class QueryInspectionPageListService {
return result;
}

Page<Inspection> page = new Page(queryInspectionRequest.getPage(), queryInspectionRequest.getLimit());
Page<Inspection> pageList = inspectionMapper.selectPageList(page, queryInspectionRequest);
if (InspectionWayEnum.MABNNEDFLIGHT.getCode() == queryInspectionRequest.getInspectionType()) {
queryInspectionRequest.setAirportId(0);
queryInspectionRequest.setInspectionLine(0);
}

// 获取本部门及子孙部门id列表
List<String> deptIdList = deptMapper.selectAllChildListById(queryInspectionRequest.getDeptId());

// 设置分页参数
IPage<Inspection> page = new Page<>(queryInspectionRequest.getPage(), queryInspectionRequest.getLimit());

// 查询结果
IPage<Inspection> pageData = inspectionMapper.selectPageList(page, queryInspectionRequest);



//
// Page<Inspection> page = new Page(queryInspectionRequest.getPage(), queryInspectionRequest.getLimit());
// Page<Inspection> pageList = inspectionMapper.selectPageList2(page, queryInspectionRequest);

// 查询所有有效的子部门数据
// IPage<Inspection> page = new Page<>(queryInspectionRequest.getPage(), queryInspectionRequest.getLimit());
@@ -62,11 +91,19 @@ public class QueryInspectionPageListService {
* @return
*/
private JsonResult check(String tenantId, QueryInspectionPageListRequest queryInspectionRequest) {
// 判断id是否为空
// if (StringUtils.isEmpty(id)) {
// return JsonResult.error(QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getCode(), QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getMsg());
// }
// 判断部门id是否为空
if (StringUtils.isEmpty(queryInspectionRequest.getDeptId())) {
return JsonResult.error(QueryInspectionPageListCodeEnum.DEPT_ID_IS_NULL.getCode(), QueryInspectionPageListCodeEnum.DEPT_ID_IS_NULL.getMsg());
}

// 判断部门是否存在
Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>()
.eq(Dept::getTenantId, tenantId)
.eq(Dept::getId, queryInspectionRequest.getDeptId())
.eq(Dept::getMark, 1));
if (null == dept) {
return JsonResult.error(QueryInspectionPageListCodeEnum.DEPT_IS_NOT_EXIST.getCode(), QueryInspectionPageListCodeEnum.DEPT_IS_NOT_EXIST.getMsg());
}

return JsonResult.success();
}

+ 134
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/UpdateInspectionService.java Bestand weergeven

@@ -0,0 +1,134 @@
package com.tuoheng.admin.service.inspection.update;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.conver.InspectionConverMapper;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.RoadInformation;
import com.tuoheng.admin.entity.Section;
import com.tuoheng.admin.enums.code.dept.AddDeptCodeEnum;
import com.tuoheng.admin.enums.code.inspection.EditInspectionCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.inspection.EditInspectionRequest;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* 修改任务业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-11-24
*/
@Slf4j
@Service
public class UpdateInspectionService {

@Autowired
private DeptMapper deptMapper;

@Autowired
private RoadInformationMapper roadInformationMapper;

@Autowired
private SectionMapper sectionMapper;

@Autowired
private InspectionMapper inspectionMapper;

/**
* 添加任务
*
* @return
*/
public JsonResult update(EditInspectionRequest editInspectionRequest) {
log.info("进入修改任务业务接口");
String tenantId = ShiroUtils.getTenantId();
JsonResult result = this.check(tenantId, editInspectionRequest);
if (0 != result.getCode()) {
log.info("修改任务业务接口:校验失败:{}", result.getMsg());
return result;
}

Inspection inspection = InspectionConverMapper.INSTANCE.fromEditInspectionRequestToInspection(editInspectionRequest);
inspection.setUpdateUser("");
inspection.setUpdateTime(DateUtils.now());

Integer rowId = inspectionMapper.update(inspection);
if (rowId <= 0) {
log.info("修改任务业务接口:修改任务失败:{}", result.getMsg());
return JsonResult.error(AddDeptCodeEnum.ADD_DEPT_IS_FAILED.getCode(), AddDeptCodeEnum.ADD_DEPT_IS_FAILED.getMsg());
}

log.info("修改任务业务接口:修改任务成功:{}", inspection);
return JsonResult.success();
}

/**
* 检查参数
* @param tenantId
* @param editInspectionRequest
* @return
*/
private JsonResult check(String tenantId, EditInspectionRequest editInspectionRequest) {
if (StringUtils.isEmpty(editInspectionRequest.getId())) {
return JsonResult.error(EditInspectionCodeEnum.ID_IS_NULL.getCode(), EditInspectionCodeEnum.ID_IS_NULL.getMsg());
}

if (StringUtils.isEmpty(editInspectionRequest.getName())) {
return JsonResult.error(EditInspectionCodeEnum.NAME_IS_NULL.getCode(), EditInspectionCodeEnum.NAME_IS_NULL.getMsg());
}

if (null == editInspectionRequest.getType()) {
return JsonResult.error(EditInspectionCodeEnum.TYPE_IS_NULL.getCode(), EditInspectionCodeEnum.TYPE_IS_NULL.getMsg());
}

if (null == editInspectionRequest.getRoadId() || StringUtils.isEmpty(editInspectionRequest.getRoadName())) {
return JsonResult.error(EditInspectionCodeEnum.ROAD_IS_NULL.getCode(), EditInspectionCodeEnum.ROAD_IS_NULL.getMsg());
}

if (null == editInspectionRequest.getSectionId() || StringUtils.isEmpty(editInspectionRequest.getSectionName()) ) {
return JsonResult.error(EditInspectionCodeEnum.SECTION_IS_NULL.getCode(), EditInspectionCodeEnum.SECTION_IS_NULL.getMsg());
}

if (null == editInspectionRequest.getInspectionType()) {
return JsonResult.error(EditInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getCode(), EditInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getMsg());
}

if (null == editInspectionRequest.getAirportId() || StringUtils.isEmpty(editInspectionRequest.getAirportName())) {
return JsonResult.error(EditInspectionCodeEnum.AIRPORT_IS_NULL.getCode(), EditInspectionCodeEnum.AIRPORT_IS_NULL.getMsg());
}

if (null == editInspectionRequest.getInspectionLine() || StringUtils.isEmpty(editInspectionRequest.getInspectionLineName())) {
return JsonResult.error(EditInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getCode(), EditInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getMsg());
}

if (null == editInspectionRequest.getInspectionTime()) {
return JsonResult.error(EditInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getCode(), EditInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getMsg());
}

Integer roadCount = roadInformationMapper.selectCount(Wrappers.<RoadInformation>lambdaQuery()
.eq(RoadInformation::getTenantId, tenantId)
.eq(RoadInformation::getId, editInspectionRequest.getRoadId())
.eq(RoadInformation::getMark, 1));

if (roadCount <= 0) {
return JsonResult.error(EditInspectionCodeEnum.ROAD_IS_NOT_EXIST.getCode(), EditInspectionCodeEnum.ROAD_IS_NOT_EXIST.getMsg());
}

Integer sectionCount = sectionMapper.selectCount(Wrappers.<Section>lambdaQuery()
.eq(Section::getTenantId, tenantId)
.eq(Section::getId, editInspectionRequest.getSectionId())
.eq(Section::getMark, 1));
if (sectionCount <= 0) {
return JsonResult.error(EditInspectionCodeEnum.SECTION_IS_NOT_EXIST.getCode(), EditInspectionCodeEnum.SECTION_IS_NOT_EXIST.getMsg());
}
return JsonResult.success();
}


}

+ 1
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/road/query/QueryRoadListByDeptIdService.java Bestand weergeven

@@ -5,8 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.RoadDept;
import com.tuoheng.admin.entity.RoadInformation;
import com.tuoheng.admin.enums.dept.QueryDeptChildListCodeEnum;
import com.tuoheng.admin.enums.road.QueryRoadListByDeptIdCodeEnum;
import com.tuoheng.admin.enums.code.road.QueryRoadListByDeptIdCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.RoadDeptMapper;
import com.tuoheng.admin.mapper.RoadInformationMapper;

+ 2
- 7
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/query/QuerySectionListByDeptIdService.java Bestand weergeven

@@ -2,21 +2,16 @@ package com.tuoheng.admin.service.section.query;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.conver.DeptConverMapper;
import com.tuoheng.admin.dto.RoadSectionDto;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.road.QueryRoadListByDeptIdCodeEnum;
import com.tuoheng.admin.enums.section.QuerySectionListByDeptIdCodeEnum;
import com.tuoheng.admin.enums.code.section.QuerySectionListByDeptIdCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.admin.vo.DeptInfoVo;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -48,7 +43,7 @@ public class QuerySectionListByDeptIdService {
@Autowired
private SectionDeptMapper sectionDeptMapper;

public JsonResult getRoadList(String id) {
public JsonResult getList(String id) {
log.info("进入根据部门Id查询路段列表业务");
String tenantId = ShiroUtils.getTenantId();


+ 105
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/query/QuerySectionListByRoadIdService.java Bestand weergeven

@@ -0,0 +1,105 @@
package com.tuoheng.admin.service.section.query;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.RoadInformation;
import com.tuoheng.admin.entity.Section;
import com.tuoheng.admin.entity.SectionDept;
import com.tuoheng.admin.enums.code.section.QuerySectionListByDeptIdCodeEnum;
import com.tuoheng.admin.enums.code.section.QuerySectionListByRoadIdCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* 根据公路id获取该公路下路段信息列表
*
* @author wanjing
* @team tuoheng
* @date 2022-11-24
*/
@Slf4j
@Service
public class QuerySectionListByRoadIdService {

@Autowired
private RoadInformationMapper roadInformationMapper;

@Autowired
private SectionMapper sectionMapper;

@Autowired
private RoadDeptMapper roadDeptMapper;

@Autowired
private SectionDeptMapper sectionDeptMapper;

public JsonResult getList(String roadId) {
log.info("根据公路id获取该公路下路段信息列表业务");
String tenantId = ShiroUtils.getTenantId();

// 校验
JsonResult result = this.check(tenantId, roadId);
if (0 != result.getCode()) {
log.info("根据公路id获取该公路下路段信息列表业务:校验失败:{}", result.getMsg());
return result;
}

// 获取该公路下路段列表
List<Section> sectionList = this.getSectionList(tenantId, roadId);
if (CollectionUtil.isEmpty(sectionList)) {
log.info("根据公路id获取该公路下路段信息列表业务:路段信息为空");
return JsonResult.error(QuerySectionListByRoadIdCodeEnum.SECTION_LIST_IS_NULL.getCode(), QuerySectionListByRoadIdCodeEnum.SECTION_LIST_IS_NULL.getMsg());
}

return JsonResult.success(sectionList);
}

/**
* 检查参数
*
* @param tenantId
* @param roadId
* @return
*/
private JsonResult check(String tenantId, String roadId) {
if (StringUtils.isEmpty(roadId)) {
return JsonResult.error(QuerySectionListByRoadIdCodeEnum.ROAD_ID_IS_NULL.getCode(), QuerySectionListByRoadIdCodeEnum.ROAD_ID_IS_NULL.getMsg());
}

// 判断部门是否存在
RoadInformation roadInformation = roadInformationMapper.selectOne(new LambdaQueryWrapper<RoadInformation>()
.eq(RoadInformation::getTenantId, tenantId)
.eq(RoadInformation::getId, roadId)
.eq(RoadInformation::getMark, 1));
if (null == roadInformation) {
return JsonResult.error(QuerySectionListByRoadIdCodeEnum.ROAD_IS_NOT_EXIST.getCode(), QuerySectionListByRoadIdCodeEnum.ROAD_IS_NOT_EXIST.getMsg());
}
return JsonResult.success(roadInformation);
}

/**
* 查询该公路下路段信息列表
*
* @param tenantId
* @param roadId
* @return
*/
private List<Section> getSectionList(String tenantId, String roadId) {
List<Section> sectionList = sectionMapper.selectList(new LambdaQueryWrapper<Section>()
.eq(Section::getTenantId, tenantId)
.eq(Section::getRoadId, roadId)
.eq(Section::getMark, 1));
return sectionList;
}
}

+ 30
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/utils/ShiroUtils.java Bestand weergeven

@@ -1,5 +1,11 @@
package com.tuoheng.admin.utils;

import com.tuoheng.admin.entity.User;
import com.tuoheng.common.core.exception.ServiceException;
import org.springframework.http.HttpStatus;

import java.util.Optional;

/**
* Shiro工具类
*/
@@ -11,6 +17,30 @@ public class ShiroUtils {
private ShiroUtils() {
}

/**
* 获取当前用户信息
*
* @return
*/
public static User getUserInfo() {
// return (User) SecurityUtils.getSubject().getPrincipal();

return null;
}

/**
* 获取用户编号
*
* @return
*/
public static String getUserId() {
// User user = getUserInfo();
// return Optional.ofNullable(user.getId()).orElseThrow(() ->
// new ServiceException(HttpStatus.BAD_REQUEST.value(), "未获取到当前用户信息!"));

return "1";
}

/**
* 租户ID
*

+ 14
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/DeptInfoVo.java Bestand weergeven

@@ -37,10 +37,24 @@ public class DeptInfoVo {
*/
private String pid;

/**
* 上级部门名称
*/
private String pname;

/**
* 公路,路段数据
*/
private List<RoadSectionDto> roadSectionDtoList;

/**
* 用户数
*/
private Integer userCount;

/**
* 子部门数
*/
private Integer childDeptCount;

}

+ 85
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/QueryInspectionPageListVo.java Bestand weergeven

@@ -0,0 +1,85 @@
package com.tuoheng.admin.vo;

import com.tuoheng.common.core.common.BaseQuery;
import lombok.Data;

/**
* 查询巡检任务列表视图Vo
*
* @author wanjing
* @team tuoheng
* @date 2022-11-17
*/
@Data
public class QueryInspectionPageListVo {

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

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

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

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

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

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

/**
* 巡检任务类型: 1 临时巡检(目前只有该一种类型)
*/
private Integer type;

/**
* 任务状态
*/
private Integer status;

/**
* 巡检方式类型: 1 无人机 2机场巡逻 3 飞手值飞
*/
private Integer inspectionType;

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

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

/**
* 已确认问题
*/
// List<>

/**
* 发现问题
*/


/**
* 巡检时间
*/

}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/resources/mapper/DeptMapper.xml Bestand weergeven

@@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>

<delete id="deleteById" parameterType="com.tuoheng.admin.entity.Dept">
<delete id="deleteById" parameterType="String">
update th_dept
set mark = 0
where id = #{id}

+ 26
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileHandleMapper.xml Bestand weergeven

@@ -0,0 +1,26 @@
<?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.admin.mapper.InspectionFileHandleMapper">
<resultMap type="com.tuoheng.admin.entity.InspectionFileHandle" id="InspectionFileHandleResult">
<result property="id" column="id" />
<result property="tenantId" column="tenant_id" />
<result property="inspectionFileId" column="inspection_file_id" />
<result property="handlerUser" column="handler_user" />
<result property="handlerImage" column="handler_image" />
<result property="handlerResult" column="handler_result" />
<result property="handlerTime" column="handler_time" />
<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>
<sql id="selectThInspectionFileHandleVo">
select id, tenant_id, inspection_file_id, handler_user, handler_image, handler_result, handler_time, create_user, create_time, update_user, update_time, mark from th_inspection_file_handle
</sql>
</mapper>

+ 44
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml Bestand weergeven

@@ -0,0 +1,44 @@
<?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.admin.mapper.InspectionFileMapper">
<resultMap type="com.tuoheng.admin.entity.InspectionFile" id="InspectionFileResult">
<result property="id" column="id" />
<result property="tenantId" column="tenant_id" />
<result property="fileCode" column="file_code" />
<result property="inspectionId" column="inspection_id" />
<result property="fileType" column="file_type" />
<result property="fileName" column="file_name" />
<result property="fileThumbnail" column="file_thumbnail" />
<result property="fileOriginal" column="file_original" />
<result property="fileImage" column="file_image" />
<result property="fileSize" column="file_size" />
<result property="latitude" column="latitude" />
<result property="longitude" column="longitude" />
<result property="location" column="location" />
<result property="gaodeLongitude" column="gaode_longitude" />
<result property="gaodeLatitude" column="gaode_latitude" />
<result property="gaodeAddress" column="gaode_address" />
<result property="questionId" column="question_id" />
<result property="source" column="source" />
<result property="questionName" column="question_name" />
<result property="content" column="content" />
<result property="questionDesc" column="question_desc" />
<result property="status" column="status" />
<result property="checkUser" column="check_user" />
<result property="checkTime" column="check_time" />
<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>
<sql id="selectThInspectionFileVo">
select id, tenant_id, file_code, inspection_id, file_type, file_name, file_thumbnail, file_original, file_image, file_size, latitude, longitude, location, gaode_longitude, gaode_latitude, gaode_address, question_id, source, question_name, content, question_desc, status, check_user, check_time, create_user, create_time, update_user, update_time, mark from th_inspection_file
</sql>
</mapper>

+ 24
- 129
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml Bestand weergeven

@@ -62,7 +62,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>

<sql id="selectInspectionVo">
select id, tenant_id, dept_id, code, name, type, road_id, road_name, section_id, section_name, inspection_type, airport_id, airport_name, inspection_line, inspection_line_name, equipment_id, equipment_name, equipment_mount_id, equipment_mount_name, cloud_box_id, cloud_box_name, box_sn, flight_hand, flight_hand_name, inspection_time, execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url, status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status, start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location, create_user, create_time, update_user, update_time, mark from th_inspection
select id, tenant_id, dept_id, code, name, type, road_id, road_name, section_id, section_name, inspection_type,
airport_id, airport_name, inspection_line, inspection_line_name, equipment_id, equipment_name, equipment_mount_id,
equipment_mount_name, cloud_box_id, cloud_box_name, box_sn, flight_hand, flight_hand_name, inspection_time,
execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url,
status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status,
start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location,
create_user, create_time, update_user, update_time, mark
from th_inspection
</sql>

<select id="selectOneById" parameterType="com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest" resultMap="InspectionResult">
@@ -76,14 +83,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectInspectionVo"/>
<where>
<if test="1 == 1"> and mark = 1 </if>
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="request.key != null and request.key != ''"> and ((code like concat('%', #{request.code}, '%')) or (name like concat('%', #{request.name}, '%'))) </if>
<if test="request.airportId != null and request.airportId != 0"> and airport_id = #{request.inspectionLine} </if>
<if test="request.inspectionLine != null and request.inspectionLine != 0"> and inspection_line = #{request.inspectionLine} </if>
<if test="request.type != null and request.type != 0"> and type = #{request.type} </if>
<if test="request.status != null and request.status != 0"> and status = #{request.status} </if>
<if test="request.inspectionType != null and request.inspectionType != 0"> and inspection_type = #{request.inspectionType} </if>
<!-- <if test="request.name != null and request.name != ''">-->
<!-- and dept_id in-->
<!-- <foreach item="id" collection="array" open="(" separator="," close=")">-->
<!-- #{id}-->
<!-- </foreach>-->
<!-- </if>-->
</where>
</select>

<select id="selectList" parameterType="com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest" resultMap="InspectionResult">
<include refid="selectInspectionVo"/>
<where>
<where>
<if test="tenantId != null and tenantId != ''"> and tenant_id = #{tenantId}</if>
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if>
<if test="code != null and code != ''"> and code = #{code}</if>
@@ -138,123 +155,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>

<insert id="insert" parameterType="com.tuoheng.admin.entity.Inspection"
keyColumn="id" keyProperty="id" useGeneratedKeys="true">
insert into th_inspection
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="deptId != null and deptId != ''">dept_id,</if>
<if test="code != null">code,</if>
<if test="name != null">name,</if>
<if test="type != null">type,</if>
<if test="roadId != null and roadId != ''">road_id,</if>
<if test="roadName != null">road_name,</if>
<if test="sectionId != null and sectionId != ''">section_id,</if>
<if test="sectionName != null">section_name,</if>
<if test="inspectionType != null">inspection_type,</if>
<if test="airportId != null">airport_id,</if>
<if test="airportName != null">airport_name,</if>
<if test="inspectionLine != null">inspection_line,</if>
<if test="inspectionLineName != null">inspection_line_name,</if>
<if test="equipmentId != null">equipment_id,</if>
<if test="equipmentName != null">equipment_name,</if>
<if test="equipmentMountId != null">equipment_mount_id,</if>
<if test="equipmentMountName != null">equipment_mount_name,</if>
<if test="cloudBoxId != null">cloud_box_id,</if>
<if test="cloudBoxName != null">cloud_box_name,</if>
<if test="boxSn != null">box_sn,</if>
<if test="flightHand != null">flight_hand,</if>
<if test="flightHandName != null">flight_hand_name,</if>
<if test="inspectionTime != null">inspection_time,</if>
<if test="executionStartTime != null">execution_start_time,</if>
<if test="executionEndTime != null">execution_end_time,</if>
<if test="isLive != null">is_live,</if>
<if test="isTaken != null">is_taken,</if>
<if test="isTilt != null">is_tilt,</if>
<if test="videoUrl != null">video_url,</if>
<if test="aiVideoUrl != null">ai_video_url,</if>
<if test="reportUrl != null">report_url,</if>
<if test="srtUrl != null">srt_url,</if>
<if test="status != null">status,</if>
<if test="analyseStatus != null">analyse_status,</if>
<if test="progressbar != null">progressbar,</if>
<if test="note != null">note,</if>
<if test="weather != null">weather,</if>
<if test="flyHeight != null">fly_height,</if>
<if test="srtName != null">srt_name,</if>
<if test="heartbeatTime != null">heartbeat_time,</if>
<if test="executionStatus != null">execution_status,</if>
<if test="startLongitude != null">start_longitude,</if>
<if test="startLatitude != null">start_latitude,</if>
<if test="endLongitude != null">end_longitude,</if>
<if test="endLatitude != null">end_latitude,</if>
<if test="mobile != null">mobile,</if>
<if test="patrolLocation != null">patrol_location,</if>
<if test="createUser != null">create_user,</if>
<if test="createTime != null">create_time,</if>
<if test="updateUser != null">update_user,</if>
<if test="updateTime != null">update_time,</if>
<if test="mark != null">mark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="code != null">#{code},</if>
<if test="name != null">#{name},</if>
<if test="type != null">#{type},</if>
<if test="roadId != null and roadId != ''">#{roadId},</if>
<if test="roadName != null">#{roadName},</if>
<if test="sectionId != null and sectionId != ''">#{sectionId},</if>
<if test="sectionName != null">#{sectionName},</if>
<if test="inspectionType != null">#{inspectionType},</if>
<if test="airportId != null">#{airportId},</if>
<if test="airportName != null">#{airportName},</if>
<if test="inspectionLine != null">#{inspectionLine},</if>
<if test="inspectionLineName != null">#{inspectionLineName},</if>
<if test="equipmentId != null">#{equipmentId},</if>
<if test="equipmentName != null">#{equipmentName},</if>
<if test="equipmentMountId != null">#{equipmentMountId},</if>
<if test="equipmentMountName != null">#{equipmentMountName},</if>
<if test="cloudBoxId != null">#{cloudBoxId},</if>
<if test="cloudBoxName != null">#{cloudBoxName},</if>
<if test="boxSn != null">#{boxSn},</if>
<if test="flightHand != null">#{flightHand},</if>
<if test="flightHandName != null">#{flightHandName},</if>
<if test="inspectionTime != null">#{inspectionTime},</if>
<if test="executionStartTime != null">#{executionStartTime},</if>
<if test="executionEndTime != null">#{executionEndTime},</if>
<if test="isLive != null">#{isLive},</if>
<if test="isTaken != null">#{isTaken},</if>
<if test="isTilt != null">#{isTilt},</if>
<if test="videoUrl != null">#{videoUrl},</if>
<if test="aiVideoUrl != null">#{aiVideoUrl},</if>
<if test="reportUrl != null">#{reportUrl},</if>
<if test="srtUrl != null">#{srtUrl},</if>
<if test="status != null">#{status},</if>
<if test="analyseStatus != null">#{analyseStatus},</if>
<if test="progressbar != null">#{progressbar},</if>
<if test="note != null">#{note},</if>
<if test="weather != null">#{weather},</if>
<if test="flyHeight != null">#{flyHeight},</if>
<if test="srtName != null">#{srtName},</if>
<if test="heartbeatTime != null">#{heartbeatTime},</if>
<if test="executionStatus != null">#{executionStatus},</if>
<if test="startLongitude != null">#{startLongitude},</if>
<if test="startLatitude != null">#{startLatitude},</if>
<if test="endLongitude != null">#{endLongitude},</if>
<if test="endLatitude != null">#{endLatitude},</if>
<if test="mobile != null">#{mobile},</if>
<if test="patrolLocation != null">#{patrolLocation},</if>
<if test="createUser != null">#{createUser},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateUser != null">#{updateUser},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="mark != null">#{mark},</if>
</trim>
</insert>

<update id="update" parameterType="com.tuoheng.admin.entity.Inspection">
update th_inspection
<trim prefix="SET" suffixOverrides=",">
@@ -316,13 +216,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>

<delete id="deleteById" parameterType="String">
delete from th_inspection where id = #{id}
</delete>

<delete id="deleteByIds" parameterType="String">
delete from th_inspection where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
update th_inspection
set mark = 0
where id = #{id}
</delete>
</mapper>

+ 42
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/TenantMapper.xml Bestand weergeven

@@ -0,0 +1,42 @@
<?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.admin.mapper.TenantMapper">
<resultMap type="com.tuoheng.admin.entity.Tenant" id="TenantResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="code" column="code" />
<result property="username" column="username" />
<result property="logo" column="logo" />
<result property="portraitUrl" column="portrait_url" />
<result property="pid" column="pid" />
<result property="type" column="type" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="provinceCode" column="province_code" />
<result property="provinceName" column="province_name" />
<result property="cityCode" column="city_code" />
<result property="cityName" column="city_name" />
<result property="districtCode" column="district_code" />
<result property="districtName" column="district_name" />
<result property="platformName" column="platform_name" />
<result property="airportUrl" column="airport_url" />
<result property="address" column="address" />
<result property="intro" column="intro" />
<result property="status" column="status" />
<result property="note" column="note" />
<result property="sort" column="sort" />
<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>
<sql id="selectThTenantVo">
select id, name, code, username, logo, portrait_url, pid, type, phone, email, province_code, province_name, city_code, city_name, district_code, district_name, platform_name, airport_url, address, intro, status, note, sort, create_user, create_time, update_user, update_time, mark from th_tenant
</sql>
</mapper>

Laden…
Annuleren
Opslaan