Parcourir la source

Merge branch 'develop' into release

release
wanghaoran il y a 8 mois
Parent
révision
6b92b3c516
56 fichiers modifiés avec 2033 ajouts et 379 suppressions
  1. +10
    -0
      tuoheng-common/tuoheng-common-core/src/main/java/com/tuoheng/common/core/utils/DateUtils.java
  2. +29
    -0
      tuoheng-service/tuoheng-admin/sql/sql_change_v1.3.7.sql
  3. +32
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/constant/DroneControlConstant.java
  4. +72
    -20
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AccidentController.java
  5. +3
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/AccidentConverMapper.java
  6. +9
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/dto/AirportDetailDto.java
  7. +16
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Accident.java
  8. +51
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/AccidentInspection.java
  9. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/accident/AccidentEnum.java
  10. +27
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/accident/AccidentReportTypeEnum.java
  11. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/accident/AccidentStatusEnum.java
  12. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/accident/AccidentTaskEnum.java
  13. +13
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/AccidentInspectionMapper.java
  14. +21
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/AccidentMapper.java
  15. +43
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/AddAccidentRequest.java
  16. +56
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/DroneControlRequest.java
  17. +0
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryAccidentCardListRequest.java
  18. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryAccidentPageListRequest.java
  19. +32
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryAccidentRealtimeInfoListRequest.java
  20. +33
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryHistoryPageListRequest.java
  21. +35
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QuestionTypeStatisticsVo.java
  22. +1
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentNoticeService.java
  23. +78
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentServiceImpl.java
  24. +1
    -5
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentTipsService.java
  25. +56
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/IAccidentService.java
  26. +1
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/TimeAxisService.java
  27. +125
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/add/AddAccidentService.java
  28. +33
    -30
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/ignore/AccidentIgnoreService.java
  29. +112
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentAirportDispatchListService.java
  30. +16
    -28
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentCardListService.java
  31. +0
    -225
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentCardPageListService.java
  32. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentDetailsService.java
  33. +193
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentHistoryListService.java
  34. +89
    -7
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentPageListService.java
  35. +190
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentRealtimeInfoListService.java
  36. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/reoprt/ReportAccidentService.java
  37. +1
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/reoprt/ReportNoAccidentService.java
  38. +129
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/statistics/StatisticsByMonthService.java
  39. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/verify/AccidentVerifyCompletedService.java
  40. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/verify/AccidentVerifyService.java
  41. +1
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accidentread/AccidentReadServiceImpl.java
  42. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java
  43. +131
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/AirportDroneControlService.java
  44. +36
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/DroneContinueService.java
  45. +37
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/DroneExecuteService.java
  46. +32
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/DroneGuideFlightService.java
  47. +30
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/DronePauseService.java
  48. +30
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/DroneReturnHomeService.java
  49. +50
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/DroneUndoService.java
  50. +4
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java
  51. +44
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentInspectionVo.java
  52. +44
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentStatisticsVo.java
  53. +13
    -13
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentVo.java
  54. +6
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/AccidentInspectionMapper.xml
  55. +52
    -5
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/AccidentMapper.xml
  56. +7
    -7
      tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/service/DspCallbackServiceTest.java

+ 10
- 0
tuoheng-common/tuoheng-common-core/src/main/java/com/tuoheng/common/core/utils/DateUtils.java Voir le fichier

@@ -435,4 +435,14 @@ public final class DateUtils extends org.apache.commons.lang3.time.DateUtils {
return DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS, closest);
}

public static Integer getYear() {
LocalDate localDate = LocalDate.now();
return localDate.getYear();
}

public static Integer getMonth() {
LocalDate localDate = LocalDate.now();
return localDate.getMonthValue();
}

}

+ 29
- 0
tuoheng-service/tuoheng-admin/sql/sql_change_v1.3.7.sql Voir le fichier

@@ -0,0 +1,29 @@
-- 2024-01-19 11:20
-- v1.3.7

use tuoheng_freeway;


-- 事件表
alter table tuoheng_freeway.th_accident add name varchar(20) default '' not null comment '事件名称' after dept_id;
alter table tuoheng_freeway.th_accident add report_type tinyint(1) default 1 not null comment '上报类型:1:自动上报(默认);2:手动上报' after dept_id;
alter table tuoheng_freeway.th_accident add image varchar(255) default '' not null comment '图片' after question_name;

-- 应急事件与应急任务关联表
create table th_accident_inspection
(
id varchar(36) not null comment 'ID'
primary key,
tenant_id varchar(36) default '' not null comment '租户ID',
accident_id varchar(36) default '' not null comment '事故ID',
inspection_id varchar(36) default '' not null comment '巡检任务ID',
name varchar(255) default '' null comment '记录名称',
drone_forward_type tinyint(1) default 1 not null comment '无人机前往类型:1:原无人机直接前往;2:新无人机前往;3:手动添加的应急事故,无人机前往;',
remark varchar(255) null comment '备注',
create_user varchar(36) default '' null comment '添加人',
create_time timestamp default CURRENT_TIMESTAMP null comment '创建时间',
update_user varchar(36) default '' null comment '更新人',
update_time timestamp default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间',
mark tinyint unsigned default '1' not null comment '有效标识'
)
comment '应急事件与应急任务关联表';

+ 32
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/constant/DroneControlConstant.java Voir le fichier

@@ -0,0 +1,32 @@
package com.tuoheng.admin.constant;

/**
* 无人机操控指令
*
* @author wanjing
* @team tuoheng
* @date 2023-06-25
*/
public interface DroneControlConstant {

/**
* 悬停
*/
String PAUSE = "01";

/**
* 终止降落
*/
String TERMINATE_LANDING = "02";

/**
* 返航
*/
String RETURN_HOME = "03";

/**
* 继续飞行
*/
String RECOVERY = "04";

}

+ 72
- 20
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AccidentController.java Voir le fichier

@@ -7,6 +7,8 @@ import com.tuoheng.common.core.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
* 事故前端控制器
*
@@ -21,12 +23,59 @@ public class AccidentController {
private IAccidentService accidentService;

/**
* 查询事故卡片分页列表
* 查询事件实时信息列表
*/
@GetMapping("/realtime/info/list")
public JsonResult getRealtimeInfoList(QueryAccidentRealtimeInfoListRequest request) {
// log.info("进入查询事件实时信息接口");
return accidentService.getRealtimeInfoList(request);
}

/**
* 查询历史事件列表
*/
@GetMapping("/history/page/list")
public JsonResult getHistoryPageList(QueryHistoryPageListRequest request) {
// log.info("进入查询历史事件列表接口");
return accidentService.getHistoryPageList(request);
}

/**
* 事件机场调度列表
*/
@GetMapping("/airport/dispatch/{id}")
public JsonResult getAirportDispatchList(@PathVariable("id") String id) {
// log.info("进入查询事件事件调度列表接口");
return accidentService.getAirportDispatchList(id);
}

/**
* 忽略
*
* @return
*/
@PostMapping("/ignore/{idList}")
public JsonResult ignore(@PathVariable("idList") List<String> idList){
return accidentService.ignore(idList);
}

/**
* 事件核实完成
* @param request
* @return
*/
@PostMapping("/verify/completed")
public JsonResult verifyCompleted(AccidentVerifyCompletedRequest request) {
return accidentService.verifyCompleted(request);
}

/**
* 查询事件分页列表
*/
@GetMapping("/card/page/list")
public JsonResult getAccidentCardPageList(QueryAccidentCardPageListRequest request) {
@GetMapping("/page/list")
public JsonResult getAccidentPageList(QueryAccidentPageListRequest request) {
// log.info("进入查询事故分页列表接口");
return accidentService.getAccidentCardPageList(request);
return accidentService.getAccidentPageList(request);
}

/**
@@ -104,16 +153,6 @@ public class AccidentController {
return accidentService.verify(request);
}

/**
* 事故核实完成
* @param request
* @return
*/
@PostMapping("/verify/completed")
public JsonResult verifyCompleted(AccidentVerifyCompletedRequest request) {
return accidentService.verifyCompleted(request);
}

/**
* 事故上报
*/
@@ -131,12 +170,25 @@ public class AccidentController {
}

/**
* 预警忽略
*
* @return
* 新增应急事件
*/
@PostMapping("/ignore/{id}")
public JsonResult ignore(@PathVariable("id") String id){
return accidentService.ignore(id);
@PostMapping("/add")
public JsonResult add(@RequestBody AddAccidentRequest request) {
return accidentService.insert(request);
}

/**
* 统计月份数据
*/
@GetMapping("/statistics/month")
public JsonResult statisticsByMonth() {
return accidentService.statisticsByMonth();
}

@PostMapping(value = "/droneControl")
public JsonResult droneControl(@RequestBody DroneControlRequest request) {
// log.info("进入操作无人机接口, request={}", request);
return accidentService.droneControl(request);
}

}

+ 3
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/AccidentConverMapper.java Voir le fichier

@@ -2,6 +2,7 @@ package com.tuoheng.admin.conver;

import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.request.accident.AddAccidentRequest;
import com.tuoheng.admin.vo.accident.AccidentVo;
import com.tuoheng.admin.vo.dept.DeptInfoVo;
import com.tuoheng.admin.vo.dept.DeptTreeVo;
@@ -23,4 +24,6 @@ public interface AccidentConverMapper {
*/
List<AccidentVo> accidentListToAccidentVoList(List<Accident> accidentList);

Accident addAccidentRequestToAccident(AddAccidentRequest request);

}

+ 9
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/dto/AirportDetailDto.java Voir le fichier

@@ -66,5 +66,14 @@ public class AirportDetailDto {
*/
private String battery;

/**
* 舱内湿度
*/
private String tahHum;

/**
* 舱内温度
*/
private String tahTmp;

}

+ 16
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Accident.java Voir le fichier

@@ -22,6 +22,11 @@ public class Accident extends BaseEntity {

private static final long serialVersionUID = 1L;

/**
* 事件名称
*/
private String name;

/**
* 租户id
*/
@@ -32,6 +37,11 @@ public class Accident extends BaseEntity {
*/
private String deptId;

/**
* 上报类型:1:自动上报(默认);2:手动上报
*/
private Integer reportType;

/**
* 巡检任务id
*/
@@ -82,6 +92,11 @@ public class Accident extends BaseEntity {
*/
private String questionName;

/**
* 图片
*/
private String image;

/**
* 是否有事故:0:无;1:有
*/
@@ -123,7 +138,7 @@ public class Accident extends BaseEntity {
private Integer uavReturn;

/**
* 事故状态:1未处理 2处理中 3已忽略 4已处理
* 事故状态:1未处理 2处理中 3已忽略 4已处理 5已完成
*/
private Integer status;


+ 51
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/AccidentInspection.java Voir le fichier

@@ -0,0 +1,51 @@
package com.tuoheng.admin.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 2023/3/2
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_accident_inspection")
public class AccidentInspection extends BaseEntity {

private static final long serialVersionUID = 1L;

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

/**
* 事故ID
*/
private String accidentId;

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

/**
* 无人机前往类型:1:原无人机直接前往;2:新无人机前往;3:手动添加的应急事故,无人机前往;
*/
private Integer droneForwardType;

/**
* 记录名称
*/
private String name;

/**
* 备注
*/
private String remark;

}

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/AccidentEnum.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/accident/AccidentEnum.java Voir le fichier

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

/**
* @Author ChengWang

+ 27
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/accident/AccidentReportTypeEnum.java Voir le fichier

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

import lombok.Getter;

/**
* 事件上报类型
*
* @author wanjing
* @team tuoheng
* @date 2024-01-19
*/
public enum AccidentReportTypeEnum {

AUTO(1,"自动上报"),
MANUAL(2,"手动上报"),;

AccidentReportTypeEnum(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/AccidentStatusEnum.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/accident/AccidentStatusEnum.java Voir le fichier

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

import lombok.Getter;


tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/AccidentTaskEnum.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/accident/AccidentTaskEnum.java Voir le fichier

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

import lombok.Getter;


+ 13
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/AccidentInspectionMapper.java Voir le fichier

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

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.admin.entity.AccidentInspection;

/**
* @Author ChengWang
* @Date 2023/3/2
*/
public interface AccidentInspectionMapper extends BaseMapper<AccidentInspection> {


}

+ 21
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/AccidentMapper.java Voir le fichier

@@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.request.accident.QueryAccidentCardListRequest;
import com.tuoheng.admin.request.accident.QueryAccidentCardPageListRequest;
import com.tuoheng.admin.request.accident.QueryAccidentRealtimeInfoListRequest;
import com.tuoheng.admin.request.accident.QueryAccidentPageListRequest;
import com.tuoheng.admin.request.accident.QueryHistoryPageListRequest;
import org.apache.ibatis.annotations.Param;

import java.util.List;
@@ -22,7 +24,24 @@ public interface AccidentMapper extends BaseMapper<Accident> {
* @param request 事故查询实体
* @return 事故集合
*/
Page<Accident> selectPageList(@Param("page") IPage page, @Param("request") QueryAccidentCardPageListRequest request);
Page<Accident> selectPageList(@Param("page") IPage page, @Param("request") QueryAccidentPageListRequest request);

/**
* 查询实时事件信息列表
*
* @param request 事故查询实体
* @return 事故集合
*/
List<Accident> getRealtimeInfoList(@Param("request") QueryAccidentRealtimeInfoListRequest request);

/**
* 查询历史事件分页列表
*
* @param request 事故查询实体
* @return 事故集合
*/
Page<Accident> getHistoryPageList(@Param("page") IPage page, @Param("request") QueryHistoryPageListRequest request);


/**
* 查询事故分页列表

+ 43
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/AddAccidentRequest.java Voir le fichier

@@ -0,0 +1,43 @@
package com.tuoheng.admin.request.accident;

import lombok.Data;

/**
*
* @author wanjing
* @team tuoheng
* @date 2024-01-19
*/
@Data
public class AddAccidentRequest {

/**
* 经度
*/
private String name;

/**
* 经度
*/
private String longitude;

/**
* 纬度
*/
private String latitude;

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

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

/**
* 图片
*/
private String image;
}

+ 56
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/DroneControlRequest.java Voir le fichier

@@ -0,0 +1,56 @@
package com.tuoheng.admin.request.accident;

import lombok.Data;

/**
* 事故上报请求实体
*
* @author wanjing
* @team tuoheng
* @date 2023-03-15
*/
@Data
public class DroneControlRequest {

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

/**
* 操作类型:1:悬停;2:指点飞行;3:继续任务;4:立即返航;5:取消任务
*/
private Integer type;

/**
* 机场任务ID
*/
private Integer airportTaskId;

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

/**
* 高度
*/
private Integer zalt;

/**
* 纬度
*/
private String latitude;

/**
* 经度
*/
private String longitude;

/**
* 租户code
*/
private String tenantCode;


}

+ 0
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryAccidentCardListRequest.java Voir le fichier


tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryAccidentCardPageListRequest.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryAccidentPageListRequest.java Voir le fichier

@@ -16,7 +16,7 @@ import java.util.List;
* @date 2022-11-17
*/
@Data
public class QueryAccidentCardPageListRequest extends BaseQuery {
public class QueryAccidentPageListRequest extends BaseQuery {

/**
* 公路名称

+ 32
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryAccidentRealtimeInfoListRequest.java Voir le fichier

@@ -0,0 +1,32 @@
package com.tuoheng.admin.request.accident;

import lombok.Data;

import java.util.List;

/**
* 查询事故卡片请求实体
*
* @author wanjing
* @team tuoheng
* @date 2023-03-20
*/
@Data
public class QueryAccidentRealtimeInfoListRequest {

/**
* 任务状态
*/
private List<Integer> statusList;

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

/**
* 部门Id list
*/
private List<String> deptIdList;

}

+ 33
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryHistoryPageListRequest.java Voir le fichier

@@ -0,0 +1,33 @@
package com.tuoheng.admin.request.accident;

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

import java.util.List;

/**
* 查询事故卡片请求实体
*
* @author wanjing
* @team tuoheng
* @date 2023-03-20
*/
@Data
public class QueryHistoryPageListRequest extends BaseQuery {

/**
* 任务状态
*/
private List<Integer> statusList;

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

/**
* 部门Id list
*/
private List<String> deptIdList;

}

+ 35
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QuestionTypeStatisticsVo.java Voir le fichier

@@ -0,0 +1,35 @@
package com.tuoheng.admin.request.accident;

import lombok.Data;

/**
* 事件月份统计 返回实体类
*
* @author wanjing
* @team tuoheng
* @date 2024-01-19
*/
@Data
public class QuestionTypeStatisticsVo {

/**
* 问题Id
*/
private String questionId;

/**
* 问题编码
*/
private String questionCode;

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

/**
* 问题数量
*/
private Integer count;

}

+ 1
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentNoticeService.java Voir le fichier

@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.AccidentRead;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.AccidentStatusEnum;
import com.tuoheng.admin.enums.accident.AccidentStatusEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.FlagEnum;
import com.tuoheng.admin.enums.MarkEnum;
@@ -14,9 +14,7 @@ import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.AccidentReadMapper;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.exception.ServiceException;
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;

+ 78
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentServiceImpl.java Voir le fichier

@@ -4,18 +4,23 @@ import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.query.AccidentQuery;
import com.tuoheng.admin.request.accident.*;
import com.tuoheng.admin.service.accident.add.AddAccidentService;
import com.tuoheng.admin.service.accident.ignore.AccidentIgnoreService;
import com.tuoheng.admin.service.accident.query.*;
import com.tuoheng.admin.service.accident.reoprt.ReportAccidentService;
import com.tuoheng.admin.service.accident.reoprt.ReportNoAccidentService;
import com.tuoheng.admin.service.accident.statistics.StatisticsByMonthService;
import com.tuoheng.admin.service.accident.verify.AccidentVerifyCompletedService;
import com.tuoheng.admin.service.accident.verify.AccidentVerifyService;
import com.tuoheng.admin.service.third.airport.control.AirportDroneControlService;
import com.tuoheng.common.core.common.BaseServiceImpl;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @Author ChengWang
* @Date 2023/3/2
@@ -25,7 +30,16 @@ import org.springframework.stereotype.Service;
public class AccidentServiceImpl extends BaseServiceImpl<AccidentMapper, Accident> implements IAccidentService {

@Autowired
private QueryAccidentCardPageListService queryAccidentCardPageListService;
private AddAccidentService addAccidentService;

@Autowired
private QueryAccidentRealtimeInfoListService queryAccidentRealtimeInfoListService;

@Autowired
private QueryAccidentHistoryListService queryAccidentHistoryListService;

@Autowired
private QueryAccidentAirportDispatchListService queryAccidentAirportDispatchListService;

@Autowired
private QueryAccidentCardListService queryAccidentCardListService;
@@ -63,9 +77,31 @@ public class AccidentServiceImpl extends BaseServiceImpl<AccidentMapper, Acciden
@Autowired
private AccidentIgnoreService accidentIgnoreService;

@Autowired
private StatisticsByMonthService statisticsByMonthService;

@Autowired
private AirportDroneControlService airportDroneControlService;

@Override
public JsonResult getAccidentCardPageList(QueryAccidentCardPageListRequest request) {
return queryAccidentCardPageListService.getPageList(request);
public JsonResult getRealtimeInfoList(QueryAccidentRealtimeInfoListRequest request) {
return queryAccidentRealtimeInfoListService.getList(request);
}

@Override
public JsonResult getHistoryPageList(QueryHistoryPageListRequest request) {
return queryAccidentHistoryListService.getPageList(request);
}

/**
* 查询机场调度列表
*
* @param id 事件Id
* @return 事件集合
*/
@Override
public JsonResult getAirportDispatchList(String id) {
return queryAccidentAirportDispatchListService.getList(id);
}

@Override
@@ -73,6 +109,22 @@ public class AccidentServiceImpl extends BaseServiceImpl<AccidentMapper, Acciden
return queryAccidentCardListService.getList(request);
}

/**
* 新增应急事件
*
* @param request 应急事件对象
* @return 结果
*/
@Override
public JsonResult insert(AddAccidentRequest request) {
return addAccidentService.add(request);
}

@Override
public JsonResult getAccidentPageList(QueryAccidentPageListRequest request) {
return queryAccidentPageListService.getPageList(request);
}

@Override
public JsonResult getAccidentInfo(String id) {
return queryAccidentByIdService.getInfoById(id);
@@ -150,11 +202,31 @@ public class AccidentServiceImpl extends BaseServiceImpl<AccidentMapper, Acciden
/**
* 忽略
*
* @param id
* @param idList
* @return
*/
@Override
public JsonResult ignore(String id) {
return accidentIgnoreService.ignore(id);
public JsonResult ignore(List<String> idList) {
return accidentIgnoreService.ignore(idList);
}

/**
* 统计月份数据
*
* @return 结果
*/
@Override
public JsonResult statisticsByMonth() {
return statisticsByMonthService.statistics();
}

/**
* 操作无人机
*
* @return 结果
*/
@Override
public JsonResult droneControl(DroneControlRequest request) {
return airportDroneControlService.exec(request);
}
}

+ 1
- 5
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentTipsService.java Voir le fichier

@@ -1,14 +1,10 @@
package com.tuoheng.admin.service.accident;

import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.Section;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.AccidentEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.accident.AccidentEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.SectionMapper;

+ 56
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/IAccidentService.java Voir le fichier

@@ -6,6 +6,8 @@ import com.tuoheng.admin.request.accident.*;
import com.tuoheng.common.core.common.IBaseService;
import com.tuoheng.common.core.utils.JsonResult;

import java.util.List;

/**
* @Author ChengWang
* @Date 2022/11/17
@@ -13,12 +15,28 @@ import com.tuoheng.common.core.utils.JsonResult;
public interface IAccidentService extends IBaseService<Accident> {

/**
* 查询事故列表(分页)
* 查询实时事件信息列表
*
* @param request 事故分页列表查询实体
* @return 巡检任务集合
* @param request 事列表查询实体
* @return 事件集合
*/
JsonResult getAccidentCardPageList(QueryAccidentCardPageListRequest request);
JsonResult getRealtimeInfoList(QueryAccidentRealtimeInfoListRequest request);

/**
* 查询历史事件分页列表
*
* @param request 事件列表查询实体
* @return 事件集合
*/
JsonResult getHistoryPageList(QueryHistoryPageListRequest request);

/**
* 查询机场调度列表
*
* @param id 事件Id
* @return 事件集合
*/
JsonResult getAirportDispatchList(String id);

/**
* 查询事故列表
@@ -28,6 +46,22 @@ public interface IAccidentService extends IBaseService<Accident> {
*/
JsonResult getAccidentCardList(QueryAccidentCardListRequest request);

/**
* 新增应急事件
*
* @param request 应急事件对象
* @return 结果
*/
JsonResult insert(AddAccidentRequest request);

/**
* 查询事故列表(分页)
*
* @param request 事故分页列表查询实体
* @return 巡检任务集合
*/
JsonResult getAccidentPageList(QueryAccidentPageListRequest request);

/**
* 查询事故信息
*
@@ -110,9 +144,25 @@ public interface IAccidentService extends IBaseService<Accident> {
/**
* 忽略
*
* @param id
* @param idList
* @return
*/
JsonResult ignore(String id);
JsonResult ignore(List<String> idList);

/**
* 统计月份数据
*
* @return 结果
*/
JsonResult statisticsByMonth();


/**
* 操作无人机
*
* @return 结果
*/
JsonResult droneControl(DroneControlRequest request);


}

+ 1
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/TimeAxisService.java Voir le fichier

@@ -1,12 +1,11 @@
package com.tuoheng.admin.service.accident;

import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.AccidentRead;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.AccidentEnum;
import com.tuoheng.admin.enums.accident.AccidentEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.AccidentReadMapper;
import com.tuoheng.admin.mapper.UserMapper;

+ 125
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/add/AddAccidentService.java Voir le fichier

@@ -0,0 +1,125 @@
package com.tuoheng.admin.service.accident.add;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.conver.AccidentConverMapper;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.RoadInformation;
import com.tuoheng.admin.entity.Section;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.accident.AccidentStatusEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.accident.AccidentReportTypeEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.RoadInformationMapper;
import com.tuoheng.admin.mapper.SectionMapper;
import com.tuoheng.admin.request.accident.AddAccidentRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.utils.GaodeUtil;
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.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* 添加应急事故业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2024-01-19
*/
@Slf4j
@Service
public class AddAccidentService {

@Autowired
private AccidentMapper accidentMapper;

@Autowired
private RoadInformationMapper roadInformationMapper;

@Autowired
private SectionMapper sectionMapper;

public JsonResult add(AddAccidentRequest request) {
// log.info("进入添加应急事件业务, id={}", id);
User user = CurrentUserUtil.getUserInfo();
String userId = user.getId();
JsonResult result = this.check(request);
if (0 != result.getCode()) {
log.info("添加应急事件:校验失败:{}", result.getMsg());
return result;
}
Accident accident = this.buildAccident(user, request);
accident.setTenantId(user.getTenantId());
accident.setDeptId(user.getDeptId());
Integer count = accidentMapper.insert(accident);
if (count <= 0) {
log.info("事故忽略,修改预警信息失败");
}

return JsonResult.success();
}

/**
* 检查参数
*
* @param request
* @return
*/
private JsonResult check(AddAccidentRequest request) {
if (StringUtils.isEmpty(request.getName())) {
throw new ServiceException("应急事件名称为空");
}
if (StringUtils.isEmpty(request.getLatitude()) || StringUtils.isNull(request.getLongitude())) {
throw new ServiceException("应急事件位置为空");
}
if (StringUtils.isEmpty(request.getRoadId())) {
throw new ServiceException("应急事件公路为空");
}
if (StringUtils.isEmpty(request.getSectionId())) {
throw new ServiceException("应急事件路段为空");
}
if (StringUtils.isEmpty(request.getImage())) {
throw new ServiceException("应急事件图片为空");
}
return JsonResult.success();
}

/**
* 修改预警记录信息
*
* @param user
* @param request
*/
private Accident buildAccident(User user, AddAccidentRequest request) {
Accident accident = AccidentConverMapper.INSTANCE.addAccidentRequestToAccident(request);
accident.setReportType(AccidentReportTypeEnum.MANUAL.getCode());
accident.setStatus(AccidentStatusEnum.UNTREATED.getCode());
accident.setCreateUser(user.getId());
accident.setCreateTime(DateUtils.now());
accident.setIgnoreTime(DateUtils.now());
RoadInformation roadInformation = roadInformationMapper.selectOne(Wrappers.<RoadInformation>lambdaQuery()
.eq(RoadInformation::getTenantId, user.getTenantId())
.eq(RoadInformation::getId, request.getRoadId())
.eq(RoadInformation::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isEmpty(roadInformation)) {
throw new ServiceException("公路信息不存在");

}
accident.setRoadCode(roadInformation.getCode());
Section section = sectionMapper.selectOne(Wrappers.<Section>lambdaQuery()
.eq(Section::getTenantId, user.getTenantId())
.eq(Section::getId, request.getSectionId())
.eq(Section::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isEmpty(section)) {
throw new ServiceException("路段信息不存在");
}
accident.setSectionName(section.getSectionRange());
return accident;
}
}

+ 33
- 30
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/ignore/AccidentIgnoreService.java Voir le fichier

@@ -1,22 +1,22 @@
package com.tuoheng.admin.service.accident.ignore;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.AccidentStatusEnum;
import com.tuoheng.admin.enums.accident.AccidentStatusEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.request.accident.ReportAccidentRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
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.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 忽略事故业务层处理
*
@@ -31,19 +31,19 @@ public class AccidentIgnoreService {
@Autowired
private AccidentMapper accidentMapper;

public JsonResult ignore(String id) {
// log.info("进入忽略事故业务");
public JsonResult ignore(List<String> idList) {
// log.info("进入忽略事故业务, idList={}", idList);
User user = CurrentUserUtil.getUserInfo();
String userId = user.getId();
String tenantId = user.getTenantId();
JsonResult result = this.check(tenantId, id);
JsonResult result = this.check(tenantId, idList);
if (0 != result.getCode()) {
log.info("忽略事故业务:校验失败:{}", result.getMsg());
return result;
}
Accident accident = (Accident) result.getData();
List<Accident> accidentList = (List<Accident>) result.getData();

this.updateAccident(userId, accident);
this.updateAccident(userId, accidentList);

return JsonResult.success();
}
@@ -52,24 +52,27 @@ public class AccidentIgnoreService {
* 检查参数
*
* @param tenantId
* @param id
* @param idList
* @return
*/
private JsonResult check(String tenantId, String id) {
if (StringUtils.isEmpty(id)) {
throw new ServiceException("事故ID为空");
private JsonResult check(String tenantId, List<String> idList) {
if (CollectionUtil.isEmpty(idList)) {
throw new ServiceException("应急事件idList为空");
}
Accident accident = accidentMapper.selectOne(new LambdaQueryWrapper<Accident>()
List<Accident> accidentList = accidentMapper.selectList(new LambdaQueryWrapper<Accident>()
.eq(Accident::getTenantId, tenantId)
.eq(Accident::getId, id)
.in(Accident::getId, idList)
.eq(Accident::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(accident)) {
throw new ServiceException("事故不存在");
if (CollectionUtil.isEmpty(accidentList)) {
throw new ServiceException("应急事件不存在");
}
if (AccidentStatusEnum.UNTREATED.getCode() != accident.getStatus()) {
throw new ServiceException("未处理的事故才能忽略");
for (Accident accident : accidentList) {
if (AccidentStatusEnum.UNTREATED.getCode() != accident.getStatus()) {
log.info("未处理的应急事件才能忽略, accidentId={}", accident.getId());
throw new ServiceException("未处理的应急事件才能忽略");
}
}
return JsonResult.success(accident);
return JsonResult.success(accidentList);
}

/**
@@ -78,16 +81,16 @@ public class AccidentIgnoreService {
* @param userId
* @param userId
*/
private void updateAccident(String userId, Accident accident) {
Accident accidentUpdate = new Accident();
accidentUpdate.setId(accident.getId());
accidentUpdate.setStatus(AccidentStatusEnum.IGNORED.getCode());
accidentUpdate.setUpdateUser(userId);
accidentUpdate.setUpdateTime(DateUtils.now());
accidentUpdate.setIgnoreTime(DateUtils.now());
Integer count = accidentMapper.updateById(accidentUpdate);
if (count <= 0) {
log.info("事故忽略,修改预警信息失败");
private void updateAccident(String userId, List<Accident> accidentList) {
for (Accident accident : accidentList) {
accident.setStatus(AccidentStatusEnum.IGNORED.getCode());
accident.setUpdateUser(userId);
accident.setUpdateTime(DateUtils.now());
accident.setIgnoreTime(DateUtils.now());
Integer count = accidentMapper.updateById(accident);
if (count <= 0) {
log.info("事故忽略,修改预警信息失败, accidentId={}", accident.getId());
}
}
}
}

+ 112
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentAirportDispatchListService.java Voir le fichier

@@ -0,0 +1,112 @@
package com.tuoheng.admin.service.accident.query;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.AccidentInspection;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.AccidentInspectionMapper;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.accident.AccidentInspectionVo;
import com.tuoheng.common.core.exception.ServiceException;
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.List;
import java.util.stream.Collectors;

/**
* 查询事件实时信息列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2023-03-03
*/
@Slf4j
@Service
public class QueryAccidentAirportDispatchListService {

@Autowired
private AccidentInspectionMapper accidentInspectionMapper;

@Autowired
private AccidentMapper accidentMapper;

@Autowired
private InspectionMapper inspectionMapper;

public JsonResult getList(String id) {
// log.info("进入查询事件机场调度列表业务");
User user = CurrentUserUtil.getUserInfo();
String tenantId = user.getTenantId();

JsonResult result = this.check(tenantId, id);
if (0 != result.getCode()) {
log.info("进入查询事件机场调度列表业务:校验失败:{}", result.getMsg());
return result;
}

List<AccidentInspection> accidentInspectionList = accidentInspectionMapper.selectList(new LambdaQueryWrapper<AccidentInspection>()
.eq(AccidentInspection::getAccidentId, id)
.eq(AccidentInspection::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isEmpty(accidentInspectionList)) {
log.info("该应急事件没有对应的应急任务,accidentId={}", id);
return JsonResult.success();
}

// 构造返回结果对象
List<AccidentInspectionVo> accidentInspectionVoList = this.buildAccidentInspectionVoList(accidentInspectionList);

return JsonResult.success(accidentInspectionVoList);
}

/**
* 检查参数
*
* @param tenantId
* @param id
* @return
*/
private JsonResult check(String tenantId, String id) {
if (StringUtils.isEmpty(id)) {
throw new ServiceException("应急事件ID为空");
}
return JsonResult.success();
}

/**
* @param accidentInspectionList
* @return
*/
private List<AccidentInspectionVo> buildAccidentInspectionVoList(List<AccidentInspection> accidentInspectionList) {
if (CollectionUtil.isEmpty(accidentInspectionList)) {
return null;
}
List<String> inspectionIdList = accidentInspectionList.stream().map(o -> o.getInspectionId()).collect(Collectors.toList());
List<Inspection> inspectionList = inspectionMapper.selectList(Wrappers.<Inspection>lambdaQuery()
.eq(Inspection::getMark, MarkEnum.VALID.getCode())
.in(Inspection::getId, inspectionIdList));
List<AccidentInspectionVo> accidentInspectionVoList = new ArrayList<>();
AccidentInspectionVo accidentInspectionVo;
for (Inspection inspection : inspectionList) {
accidentInspectionVo = new AccidentInspectionVo();
accidentInspectionVo.setInspectionId(inspection.getId());
accidentInspectionVo.setInspectionCode(inspection.getCode());
accidentInspectionVo.setInspectionName(inspection.getName());
accidentInspectionVo.setStatus(inspection.getStatus());
accidentInspectionVo.setCreateTime(inspection.getCreateTime());
accidentInspectionVoList.add(accidentInspectionVo);
}
return accidentInspectionVoList;
}

}

+ 16
- 28
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentCardListService.java Voir le fichier

@@ -8,12 +8,14 @@ import com.tuoheng.admin.conver.AccidentConverMapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.accident.AccidentReportTypeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.accident.QueryAccidentCardListRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.accident.AccidentVo;
import com.tuoheng.common.core.config.common.CommonConfig;
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;
@@ -107,12 +109,10 @@ public class QueryAccidentCardListService {
*/
private List<AccidentVo> buildAccidentVoList(List<Accident> accidentList) {
Map<String, String> deptNameMap = this.getDeptMap(accidentList);
Map<String, User> userMap = this.getUserMap(deptNameMap);
Map<String, InspectionFile> inspectionFileMap = this.getInspectionFileMap(accidentList);
Map<String, Inspection> inspectionMap = this.getInspectionMap(accidentList);
List<AccidentVo> accidentVoList = AccidentConverMapper.INSTANCE.accidentListToAccidentVoList(accidentList);
String deptName;
User user;
InspectionFile inspectionFile;
Inspection inspection;
for (AccidentVo accidentVo : accidentVoList) {
@@ -120,20 +120,20 @@ public class QueryAccidentCardListService {
deptName = deptNameMap.get(accidentVo.getDeptId());
accidentVo.setDeptName(deptName);
}
if (ObjectUtil.isNotNull(userMap)) {
user = userMap.get(accidentVo.getDeptId());
if (ObjectUtil.isNotNull(user)) {
accidentVo.setDepartmentHead(user.getRealname());
accidentVo.setDepartmentHeadTelephone(user.getMobile());
if (AccidentReportTypeEnum.MANUAL.getCode() == accidentVo.getReportType()) {
if (StringUtils.isNotEmpty(accidentVo.getImage())) {
accidentVo.setImage(CommonConfig.imageURL + accidentVo.getImage());
}
}
if (ObjectUtil.isNotNull(inspectionFileMap)) {
inspectionFile = inspectionFileMap.get(accidentVo.getInspectionFileId());
if (ObjectUtil.isNotNull(inspectionFile)) {
accidentVo.setFileName(inspectionFile.getFileName());
accidentVo.setFileImage(CommonConfig.imageURL + inspectionFile.getFileImage());
accidentVo.setFileOriginal(CommonConfig.imageURL + inspectionFile.getFileOriginal());
accidentVo.setFileThumbnail(CommonConfig.imageURL + inspectionFile.getFileThumbnail());
} else if (AccidentReportTypeEnum.AUTO.getCode() == accidentVo.getReportType()) {
if (ObjectUtil.isNotNull(inspectionFileMap)) {
inspectionFile = inspectionFileMap.get(accidentVo.getInspectionFileId());
if (ObjectUtil.isNotNull(inspectionFile)) {
accidentVo.setFileName(inspectionFile.getFileName());
accidentVo.setFileImage(CommonConfig.imageURL + inspectionFile.getFileImage());
accidentVo.setFileOriginal(CommonConfig.imageURL + inspectionFile.getFileOriginal());
accidentVo.setFileThumbnail(CommonConfig.imageURL + inspectionFile.getFileThumbnail());
accidentVo.setImage(CommonConfig.imageURL + accidentVo.getFileImage());
}
}
}
if(ObjectUtil.isNotNull(inspectionMap)){
@@ -176,18 +176,6 @@ public class QueryAccidentCardListService {
return deptNameMap;
}

private Map<String, User> getUserMap(Map<String, String> deptMap) {
if (ObjectUtil.isNull(deptMap)) {
return null;
}
List<String> deptIdList = deptMap.keySet().stream().collect(Collectors.toList());
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.in(User::getDeptId, deptIdList)
.eq(User::getRoleId, DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode()));
Map<String, User> userMap = userList.stream().collect(HashMap::new, (m, v) -> m.put(v.getDeptId(), v), HashMap::putAll);
return userMap;
}

private Map<String, InspectionFile> getInspectionFileMap(List<Accident> accidentList) {
if (CollectionUtil.isEmpty(accidentList)) {
return null;
@@ -198,4 +186,4 @@ public class QueryAccidentCardListService {
Map<String, InspectionFile> inspectionFileMap = inspectionFileList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v), HashMap::putAll);
return inspectionFileMap;
}
}
}

+ 0
- 225
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentCardPageListService.java Voir le fichier

@@ -1,225 +0,0 @@
package com.tuoheng.admin.service.accident.query;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.conver.AccidentConverMapper;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.FlagEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.query.AccidentQuery;
import com.tuoheng.admin.request.accident.QueryAccidentCardPageListRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.accident.AccidentVo;
import com.tuoheng.admin.vo.accident.QueryAccidentPageVO;
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.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
* 查询事故卡片分页列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2023-03-03
*/
@Slf4j
@Service
public class QueryAccidentCardPageListService {

@Autowired
private DeptMapper deptMapper;

@Autowired
private UserMapper userMapper;

@Autowired
private AccidentMapper accidentMapper;

public JsonResult getPageList(QueryAccidentCardPageListRequest request) {
// log.info("进入查询事件分页列表业务");
String tenantId = CurrentUserUtil.getTenantId();
request.setTenantId(tenantId);
JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {
log.info("进入查询事故卡片分页列表业务:校验失败:{}", result.getMsg());
return result;
}

// 设置分页参数
IPage<Accident> page = new Page<>(request.getPage(), request.getLimit());
IPage<Accident> pageData = accidentMapper.selectPageList(page, request);

// 构造返回结果对象
List<AccidentVo> accidentVoList = this.buildAccidentVoList(pageData.getRecords());

// 重写返回结果对象
IPage<AccidentVo> accidentVoPageData = new Page<>();
accidentVoPageData.setPages(pageData.getPages());
accidentVoPageData.setCurrent(pageData.getCurrent());
accidentVoPageData.setSize(pageData.getSize());
accidentVoPageData.setTotal(pageData.getTotal());
accidentVoPageData.setRecords(accidentVoList);
return JsonResult.success(accidentVoPageData);
}

/**
* 检查参数
*
* @param tenantId
* @param request
* @return
*/
private JsonResult check(String tenantId, QueryAccidentCardPageListRequest request) {
return JsonResult.success();
}

/**
* @param accidentList
* @return
*/
private List<AccidentVo> buildAccidentVoList(List<Accident> accidentList) {
Map<String, String> deptNameMap = this.getDeptMap(accidentList);
Map<String, User> userMap = this.getUserMap(deptNameMap);
List<AccidentVo> accidentVoList = AccidentConverMapper.INSTANCE.accidentListToAccidentVoList(accidentList);
String deptName;
User user;
for (AccidentVo accidentVo : accidentVoList) {
if (ObjectUtil.isNotNull(deptNameMap)) {
deptName = deptNameMap.get(accidentVo.getDeptId());
accidentVo.setDeptName(deptName);
}
if (ObjectUtil.isNotNull(userMap)) {
user = userMap.get(accidentVo.getDeptId());
if (ObjectUtil.isNotNull(user)) {
accidentVo.setDepartmentHead(user.getRealname());
accidentVo.setDepartmentHeadTelephone(user.getMobile());
}
}
}
return accidentVoList;
}

/**
* 设置列表中每一个的部门名称
* 查询到的列表中的部门Id,作为部门id列表,查询所有的部门,该结果数据量不会太大,放到map中
*
* @param accidentList
* @return
*/
private Map<String, String> getDeptMap(List<Accident> accidentList) {
List<String> deptIdList = accidentList.stream().map(o -> o.getDeptId()).collect(Collectors.toList());
List<Dept> deptList = deptMapper.selectListByIdList(deptIdList);
Map<String, String> deptNameMap = deptList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v.getName()), HashMap::putAll);
return deptNameMap;
}

private Map<String, User> getUserMap(Map<String, String> deptMap) {
if (ObjectUtil.isNull(deptMap)) {
return null;
}
List<String> deptIdList = deptMap.keySet().stream().collect(Collectors.toList());
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.in(User::getDeptId, deptIdList)
.eq(User::getRoleId, DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode()));
Map<String, User> userMap = userList.stream().collect(HashMap::new, (m, v) -> m.put(v.getDeptId(), v), HashMap::putAll);
return userMap;
}

public JsonResult index(AccidentQuery query) {
//校验
if (query.getLimit() == null && query.getPage() == null) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}

//当前租户下
User user = CurrentUserUtil.getUserInfo();
String tenantId = user.getTenantId();
List<String> deptIdList = this.getDeptIdList(user, query.getDeptId());
query.setDeptIdList(deptIdList);
query.setTenantId(tenantId);
IPage<Accident> page = new Page<>(query.getPage(), query.getLimit());
IPage<QueryAccidentPageVO> pageData = new Page<>(query.getPage(), query.getLimit());
//搜索时间
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.setAccidentStartTime(startTime);
query.setAccidentEndTime(endTime);
//获取分页数据
IPage<Accident> accidentPageData = accidentMapper.selectPage(page, Wrappers.<Accident>lambdaQuery()
.eq(null != query.getCode(), Accident::getRoadCode, query.getCode())
.in(CollectionUtils.isNotEmpty(deptIdList), Accident::getDeptId, deptIdList)
.between(null != query.getAccidentStartTime() && null != query.getAccidentEndTime(),
Accident::getCreateTime, query.getAccidentStartTime(), query.getAccidentEndTime())
.eq(Accident::getFlag, FlagEnum.INSPECTION_ACCIDENT.getCode())
.eq(Accident::getMark, MarkEnum.VALID.getCode())
.orderByDesc(Accident::getCreateTime));
//属性复制
List<QueryAccidentPageVO> result = accidentPageData.getRecords().stream().map(x -> {
QueryAccidentPageVO vo = new QueryAccidentPageVO();
BeanUtils.copyProperties(x, vo);
//公路代号
if (StringUtils.isNotEmpty(x.getRoadCode())) {
vo.setCode(x.getRoadCode());
}
//监管部门
if (StringUtils.isNotEmpty(x.getDeptId())) {
//根据当前部门id查询对应的部门名称
Dept dept = deptMapper.selectById(x.getDeptId());
vo.setName(dept.getName() != null ? dept.getName() : "");
}

return vo;
}).collect(Collectors.toList());
pageData.setPages(accidentPageData.getPages());
pageData.setRecords(result);
pageData.setTotal(accidentPageData.getTotal());
pageData.setCurrent(accidentPageData.getCurrent());

return JsonResult.success(pageData);
}

/**
* 根据用户自己的数据权限,查询对应部门的数据
*
* @param user
* @return
*/
private List<String> getDeptIdList(User user, String deptId) {
List<String> deptIdList = new ArrayList<>();
if (StringUtils.isNotEmpty(deptId)) {
deptIdList.add(deptId);
return deptIdList;
}
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
return null;
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) {
deptIdList = deptMapper.selectAllChildListById(user.getDeptId());
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
deptIdList.add(user.getDeptId());
}
return deptIdList;
}
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentDetailsService.java Voir le fichier

@@ -3,7 +3,7 @@ package com.tuoheng.admin.service.accident.query;

import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.AccidentEnum;
import com.tuoheng.admin.enums.accident.AccidentEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.vo.accident.AccidentDetailsVo;
import com.tuoheng.common.core.config.common.CommonConfig;

+ 193
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentHistoryListService.java Voir le fichier

@@ -0,0 +1,193 @@
package com.tuoheng.admin.service.accident.query;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
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.admin.conver.AccidentConverMapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.accident.QueryHistoryPageListRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.accident.AccidentVo;
import com.tuoheng.admin.vo.inspection.InspectionVo;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.JsonResult;
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;
import java.util.stream.Collectors;

/**
* 查询历史事件列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2023-03-03
*/
@Slf4j
@Service
public class QueryAccidentHistoryListService {

@Autowired
private DeptMapper deptMapper;

@Autowired
private UserMapper userMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private AccidentMapper accidentMapper;

@Autowired
private InspectionMapper inspectionMapper;

public JsonResult getPageList(QueryHistoryPageListRequest request) {
// log.info("进入查询历史事件分页列表业务");
User user = CurrentUserUtil.getUserInfo();
String tenantId = user.getTenantId();

JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {
log.info("进入查询历史事件分页列表业务:校验失败:{}", result.getMsg());
return result;
}

List<String> deptIdList = this.getDeptIdList(user);
request.setDeptIdList(deptIdList);
request.setTenantId(tenantId);

IPage<Accident> page = new Page<>(request.getPage(), request.getLimit());
IPage<Accident> pageData = accidentMapper.getHistoryPageList(page, request);
if (null == pageData || pageData.getTotal() == 0) {
log.info("查询历史事件分页列表为空");
return JsonResult.success(pageData);
}
List<AccidentVo> accidentVoList = this.buildAccidentVoList(pageData.getRecords());
IPage<AccidentVo> voPageData = new Page<>();
voPageData.setPages(pageData.getPages());
voPageData.setCurrent(pageData.getCurrent());
voPageData.setSize(pageData.getSize());
voPageData.setTotal(pageData.getTotal());
voPageData.setRecords(accidentVoList);
return JsonResult.success(voPageData);
}

/**
* 检查参数
*
* @param tenantId
* @param request
* @return
*/
private JsonResult check(String tenantId, QueryHistoryPageListRequest request) {
return JsonResult.success();
}

/**
* 根据用户自己的数据权限,查询对应部门的数据
*
* @param user
* @return
*/
private List<String> getDeptIdList(User user) {
List<String> deptIdList = new ArrayList<>();
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
return null;
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) {
deptIdList = deptMapper.selectAllChildListById(user.getDeptId());
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
deptIdList.add(user.getDeptId());
}
return deptIdList;
}

/**
* @param accidentList
* @return
*/
private List<AccidentVo> buildAccidentVoList(List<Accident> accidentList) {
Map<String, String> deptNameMap = this.getDeptMap(accidentList);
Map<String, InspectionFile> inspectionFileMap = this.getInspectionFileMap(accidentList);
Map<String, Inspection> inspectionMap = this.getInspectionMap(accidentList);
List<AccidentVo> accidentVoList = AccidentConverMapper.INSTANCE.accidentListToAccidentVoList(accidentList);
String deptName;
User user;
InspectionFile inspectionFile;
Inspection inspection;
for (AccidentVo accidentVo : accidentVoList) {
if (ObjectUtil.isNotNull(deptNameMap)) {
deptName = deptNameMap.get(accidentVo.getDeptId());
accidentVo.setDeptName(deptName);
}
if (ObjectUtil.isNotNull(inspectionFileMap)) {
inspectionFile = inspectionFileMap.get(accidentVo.getInspectionFileId());
if (ObjectUtil.isNotNull(inspectionFile)) {
accidentVo.setFileName(inspectionFile.getFileName());
accidentVo.setFileImage(CommonConfig.imageURL + inspectionFile.getFileImage());
accidentVo.setFileOriginal(CommonConfig.imageURL + inspectionFile.getFileOriginal());
accidentVo.setFileThumbnail(CommonConfig.imageURL + inspectionFile.getFileThumbnail());
}
}
if(ObjectUtil.isNotNull(inspectionMap)){
inspection = inspectionMap.get(accidentVo.getInspectionId());
if(ObjectUtil.isNotNull(inspection)){
accidentVo.setInspectionStatus(inspection.getStatus());
}
}
}
return accidentVoList;
}

private Map<String, Inspection> getInspectionMap(List<Accident> accidentList) {
if (CollectionUtil.isEmpty(accidentList)) {
return null;
}
List<String> inspectionIdList = accidentList.stream().map(o -> o.getInspectionId()).collect(Collectors.toList());
List<Inspection> inspectionList = inspectionMapper.selectList(Wrappers.<Inspection>lambdaQuery()
.eq(Inspection::getMark, MarkEnum.VALID.getCode())
.in(Inspection::getId, inspectionIdList));
Map<String, Inspection> inspectionMap = inspectionList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v), HashMap::putAll);

return inspectionMap;
}

/**
* 设置列表中每一个的部门名称
* 查询到的列表中的部门Id,作为部门id列表,查询所有的部门,该结果数据量不会太大,放到map中
*
* @param accidentList
* @return
*/
private Map<String, String> getDeptMap(List<Accident> accidentList) {
if (CollectionUtil.isEmpty(accidentList)) {
return null;
}
List<String> deptIdList = accidentList.stream().map(o -> o.getDeptId()).collect(Collectors.toList());
List<Dept> deptList = deptMapper.selectListByIdList(deptIdList);
Map<String, String> deptNameMap = deptList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v.getName()), HashMap::putAll);
return deptNameMap;
}

private Map<String, InspectionFile> getInspectionFileMap(List<Accident> accidentList) {
if (CollectionUtil.isEmpty(accidentList)) {
return null;
}
List<String> inspectionFileIdList = accidentList.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList());
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>()
.in(InspectionFile::getId, inspectionFileIdList));
Map<String, InspectionFile> inspectionFileMap = inspectionFileList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v), HashMap::putAll);
return inspectionFileMap;
}
}

+ 89
- 7
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentPageListService.java Voir le fichier

@@ -1,9 +1,12 @@
package com.tuoheng.admin.service.accident.query;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.conver.AccidentConverMapper;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.User;
@@ -14,7 +17,9 @@ import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.query.AccidentQuery;
import com.tuoheng.admin.request.accident.QueryAccidentPageListRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.accident.AccidentVo;
import com.tuoheng.admin.vo.accident.QueryAccidentPageVO;
import com.tuoheng.common.core.enums.ServiceExceptionEnum;
import com.tuoheng.common.core.exception.ServiceException;
@@ -26,9 +31,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
@@ -51,19 +54,99 @@ public class QueryAccidentPageListService {
@Autowired
private AccidentMapper accidentMapper;

public JsonResult getPageList(QueryAccidentPageListRequest request) {
// log.info("进入查询事件分页列表业务");
String tenantId = CurrentUserUtil.getTenantId();
request.setTenantId(tenantId);
JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {
log.info("进入查询事件分页列表业务:校验失败:{}", result.getMsg());
return result;
}

// 设置分页参数
IPage<Accident> page = new Page<>(request.getPage(), request.getLimit());
IPage<Accident> pageData = accidentMapper.selectPageList(page, request);

// 构造返回结果对象
List<AccidentVo> accidentVoList = this.buildAccidentVoList(pageData.getRecords());

// 重写返回结果对象
IPage<AccidentVo> accidentVoPageData = new Page<>();
accidentVoPageData.setPages(pageData.getPages());
accidentVoPageData.setCurrent(pageData.getCurrent());
accidentVoPageData.setSize(pageData.getSize());
accidentVoPageData.setTotal(pageData.getTotal());
accidentVoPageData.setRecords(accidentVoList);
return JsonResult.success(accidentVoPageData);
}

/**
* 检查参数
*
* @param tenantId
* @param request
* @return
*/
private JsonResult check(String tenantId, QueryAccidentPageListRequest request) {
return JsonResult.success();
}

/**
* @param accidentList
* @return
*/
private List<AccidentVo> buildAccidentVoList(List<Accident> accidentList) {
Map<String, String> deptNameMap = this.getDeptMap(accidentList);
List<AccidentVo> accidentVoList = AccidentConverMapper.INSTANCE.accidentListToAccidentVoList(accidentList);
String deptName;
for (AccidentVo accidentVo : accidentVoList) {
if (ObjectUtil.isNotNull(deptNameMap)) {
deptName = deptNameMap.get(accidentVo.getDeptId());
accidentVo.setDeptName(deptName);
}
}
return accidentVoList;
}

/**
* 设置列表中每一个的部门名称
* 查询到的列表中的部门Id,作为部门id列表,查询所有的部门,该结果数据量不会太大,放到map中
*
* @param accidentList
* @return
*/
private Map<String, String> getDeptMap(List<Accident> accidentList) {
List<String> deptIdList = accidentList.stream().map(o -> o.getDeptId()).collect(Collectors.toList());
List<Dept> deptList = deptMapper.selectListByIdList(deptIdList);
Map<String, String> deptNameMap = deptList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v.getName()), HashMap::putAll);
return deptNameMap;
}

private Map<String, User> getUserMap(Map<String, String> deptMap) {
if (ObjectUtil.isNull(deptMap)) {
return null;
}
List<String> deptIdList = deptMap.keySet().stream().collect(Collectors.toList());
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.in(User::getDeptId, deptIdList)
.eq(User::getRoleId, DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode()));
Map<String, User> userMap = userList.stream().collect(HashMap::new, (m, v) -> m.put(v.getDeptId(), v), HashMap::putAll);
return userMap;
}

public JsonResult index(AccidentQuery query) {
//校验
if (query.getLimit() == null && query.getPage() == null) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}

//当前租户下
User user = CurrentUserUtil.getUserInfo();
String tenantId = user.getTenantId();

List<String> deptIdList = this.getDeptIdList(user, query.getDeptId());
query.setDeptIdList(deptIdList);
query.setTenantId(tenantId);

IPage<Accident> page = new Page<>(query.getPage(), query.getLimit());
IPage<QueryAccidentPageVO> pageData = new Page<>(query.getPage(), query.getLimit());
//搜索时间
@@ -77,9 +160,8 @@ public class QueryAccidentPageListService {
query.setAccidentEndTime(endTime);
//获取分页数据
IPage<Accident> accidentPageData = accidentMapper.selectPage(page, Wrappers.<Accident>lambdaQuery()
.eq(Accident::getTenantId, tenantId)
.in(CollectionUtils.isNotEmpty(deptIdList), Accident::getDeptId, deptIdList)
.eq(null != query.getCode(), Accident::getRoadCode, query.getCode())
.in(CollectionUtils.isNotEmpty(deptIdList), Accident::getDeptId, deptIdList)
.between(null != query.getAccidentStartTime() && null != query.getAccidentEndTime(),
Accident::getCreateTime, query.getAccidentStartTime(), query.getAccidentEndTime())
.eq(Accident::getFlag, FlagEnum.INSPECTION_ACCIDENT.getCode())

+ 190
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentRealtimeInfoListService.java Voir le fichier

@@ -0,0 +1,190 @@
package com.tuoheng.admin.service.accident.query;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.conver.AccidentConverMapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.accident.AccidentReportTypeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.accident.QueryAccidentRealtimeInfoListRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.accident.AccidentVo;
import com.tuoheng.common.core.config.common.CommonConfig;
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;
import java.util.stream.Collectors;

/**
* 查询事件实时信息列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2023-03-03
*/
@Slf4j
@Service
public class QueryAccidentRealtimeInfoListService {

@Autowired
private DeptMapper deptMapper;

@Autowired
private UserMapper userMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private AccidentMapper accidentMapper;

@Autowired
private InspectionMapper inspectionMapper;

public JsonResult getList(QueryAccidentRealtimeInfoListRequest request) {
// log.info("进入事件实时信息列表业务");
User user = CurrentUserUtil.getUserInfo();
String tenantId = user.getTenantId();

JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {
log.info("进入查询事故卡片列表业务:校验失败:{}", result.getMsg());
return result;
}

List<String> deptIdList = this.getDeptIdList(user);
request.setDeptIdList(deptIdList);
request.setTenantId(tenantId);
List<Accident> accidentList = accidentMapper.getRealtimeInfoList(request);

// 构造返回结果对象
List<AccidentVo> accidentVoList = this.buildAccidentVoList(accidentList);

return JsonResult.success(accidentVoList);
}

/**
* 检查参数
*
* @param tenantId
* @param request
* @return
*/
private JsonResult check(String tenantId, QueryAccidentRealtimeInfoListRequest request) {
return JsonResult.success();
}

/**
* 根据用户自己的数据权限,查询对应部门的数据
*
* @param user
* @return
*/
private List<String> getDeptIdList(User user) {
List<String> deptIdList = new ArrayList<>();
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
return null;
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) {
deptIdList = deptMapper.selectAllChildListById(user.getDeptId());
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
deptIdList.add(user.getDeptId());
}
return deptIdList;
}

/**
* @param accidentList
* @return
*/
private List<AccidentVo> buildAccidentVoList(List<Accident> accidentList) {
Map<String, String> deptNameMap = this.getDeptMap(accidentList);
Map<String, InspectionFile> inspectionFileMap = this.getInspectionFileMap(accidentList);
Map<String, Inspection> inspectionMap = this.getInspectionMap(accidentList);
List<AccidentVo> accidentVoList = AccidentConverMapper.INSTANCE.accidentListToAccidentVoList(accidentList);
String deptName;
User user;
InspectionFile inspectionFile;
Inspection inspection;
for (AccidentVo accidentVo : accidentVoList) {
if (ObjectUtil.isNotNull(deptNameMap)) {
deptName = deptNameMap.get(accidentVo.getDeptId());
accidentVo.setDeptName(deptName);
}
if (AccidentReportTypeEnum.MANUAL.getCode() == accidentVo.getReportType()) {
if (StringUtils.isNotEmpty(accidentVo.getImage())) {
accidentVo.setImage(CommonConfig.imageURL + accidentVo.getImage());
}
} else if (AccidentReportTypeEnum.AUTO.getCode() == accidentVo.getReportType()) {
if (ObjectUtil.isNotNull(inspectionFileMap)) {
inspectionFile = inspectionFileMap.get(accidentVo.getInspectionFileId());
if (ObjectUtil.isNotNull(inspectionFile)) {
accidentVo.setFileName(inspectionFile.getFileName());
accidentVo.setFileImage(CommonConfig.imageURL + inspectionFile.getFileImage());
accidentVo.setFileOriginal(CommonConfig.imageURL + inspectionFile.getFileOriginal());
accidentVo.setFileThumbnail(CommonConfig.imageURL + inspectionFile.getFileThumbnail());
accidentVo.setImage(CommonConfig.imageURL + accidentVo.getFileImage());
}
}
}
if(ObjectUtil.isNotNull(inspectionMap)){
inspection = inspectionMap.get(accidentVo.getInspectionId());
if(ObjectUtil.isNotNull(inspection)){
accidentVo.setInspectionStatus(inspection.getStatus());
}
}
}
return accidentVoList;
}

private Map<String, Inspection> getInspectionMap(List<Accident> accidentList) {
if (CollectionUtil.isEmpty(accidentList)) {
return null;
}
List<String> inspectionIdList = accidentList.stream().map(o -> o.getInspectionId()).collect(Collectors.toList());
List<Inspection> inspectionList = inspectionMapper.selectList(Wrappers.<Inspection>lambdaQuery()
.eq(Inspection::getMark, MarkEnum.VALID.getCode())
.in(Inspection::getId, inspectionIdList));
Map<String, Inspection> inspectionMap = inspectionList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v), HashMap::putAll);

return inspectionMap;
}

/**
* 设置列表中每一个的部门名称
* 查询到的列表中的部门Id,作为部门id列表,查询所有的部门,该结果数据量不会太大,放到map中
*
* @param accidentList
* @return
*/
private Map<String, String> getDeptMap(List<Accident> accidentList) {
if (CollectionUtil.isEmpty(accidentList)) {
return null;
}
List<String> deptIdList = accidentList.stream().map(o -> o.getDeptId()).collect(Collectors.toList());
List<Dept> deptList = deptMapper.selectListByIdList(deptIdList);
Map<String, String> deptNameMap = deptList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v.getName()), HashMap::putAll);
return deptNameMap;
}

private Map<String, InspectionFile> getInspectionFileMap(List<Accident> accidentList) {
if (CollectionUtil.isEmpty(accidentList)) {
return null;
}
List<String> inspectionFileIdList = accidentList.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList());
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>()
.in(InspectionFile::getId, inspectionFileIdList));
Map<String, InspectionFile> inspectionFileMap = inspectionFileList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v), HashMap::putAll);
return inspectionFileMap;
}
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/reoprt/ReportAccidentService.java Voir le fichier

@@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.AccidentStatusEnum;
import com.tuoheng.admin.enums.accident.AccidentStatusEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.request.accident.ReportAccidentRequest;

+ 1
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/reoprt/ReportNoAccidentService.java Voir le fichier

@@ -5,14 +5,12 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.AccidentStatusEnum;
import com.tuoheng.admin.enums.accident.AccidentStatusEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.InspectionFileMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.request.accident.ReportAccidentRequest;
import com.tuoheng.admin.request.accident.ReportNoAccidentRequest;
import com.tuoheng.admin.service.third.airport.DroneControlService;
import com.tuoheng.admin.utils.CurrentUserUtil;

+ 129
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/statistics/StatisticsByMonthService.java Voir le fichier

@@ -0,0 +1,129 @@
package com.tuoheng.admin.service.accident.statistics;

import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.accident.AccidentReportTypeEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.QuestionTypeMapper;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.accident.AccidentStatisticsVo;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.List;

/**
* 查询事故卡片分页列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2024-01-20
*/
@Slf4j
@Service
public class StatisticsByMonthService {

@Autowired
private DeptMapper deptMapper;

@Autowired
private AccidentMapper accidentMapper;

public JsonResult statistics() {
User user = CurrentUserUtil.getUserInfo();
String tenantId = user.getTenantId();
List<String> deptIdList = this.getDeptIdList(user, user.getDeptId());
List<AccidentStatisticsVo> accidentStatisticsVoList = this.getSixMonth(DateUtils.getYear(), DateUtils.getMonth());
for (AccidentStatisticsVo accidentStatisticsVo : accidentStatisticsVoList) {
Integer count = accidentMapper.selectCount(Wrappers.<Accident>lambdaQuery()
.eq(Accident::getTenantId, tenantId)
.in(CollectionUtils.isNotEmpty(deptIdList), Accident::getDeptId, deptIdList)
.between(Accident::getCreateTime, accidentStatisticsVo.getBeginTime(), accidentStatisticsVo.getEndTime())
.eq(Accident::getMark, MarkEnum.VALID.getCode())
.orderByDesc(Accident::getCreateTime));
accidentStatisticsVo.setCount(count);
}
return JsonResult.success(accidentStatisticsVoList);
}

/**
* 根据用户自己的数据权限,查询对应部门的数据
*
* @param user
* @return
*/
private List<String> getDeptIdList(User user, String deptId) {
List<String> deptIdList = new ArrayList<>();
if (StringUtils.isNotEmpty(deptId)) {
deptIdList.add(deptId);
return deptIdList;
}
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
return null;
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) {
deptIdList = deptMapper.selectAllChildListById(user.getDeptId());
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
deptIdList.add(user.getDeptId());
}
return deptIdList;
}

/**
* 获取某一月份的前六个月
*/
public List<AccidentStatisticsVo> getSixMonth(Integer year, Integer month) {
//返回值
List<AccidentStatisticsVo> accidentStatisticsVoList = new ArrayList<>();
AccidentStatisticsVo accidentStatisticsVo;
Integer yearTmp;
Integer monthTmp;
for (int i = 4; i >= 0; i--) {
yearTmp = year;
monthTmp = month - 1;
accidentStatisticsVo = new AccidentStatisticsVo();
if (monthTmp > 6) {
monthTmp = monthTmp - i;
} else {
if (monthTmp - i <= 0) {
yearTmp = yearTmp - 1;
monthTmp = monthTmp - i + 12;
} else {
yearTmp = yearTmp - 1;
monthTmp = monthTmp - i;
}
}
LocalDate localDate = LocalDate.of(yearTmp, monthTmp, 1);
LocalDate firstDayOfMonth = localDate.with(TemporalAdjusters.firstDayOfMonth());
LocalDate lastDayOfMonth = localDate.with(TemporalAdjusters.lastDayOfMonth());
accidentStatisticsVo.setYear(yearTmp);
accidentStatisticsVo.setMonth(monthTmp);
accidentStatisticsVo.setBeginTime(firstDayOfMonth + " 00:00:00");
accidentStatisticsVo.setEndTime(lastDayOfMonth + " 23:59:59");
accidentStatisticsVoList.add(accidentStatisticsVo);
}

LocalDate localDate2 = LocalDate.of(year, month, 1);
LocalDate firstDayOfMonth = localDate2.with(TemporalAdjusters.firstDayOfMonth());
LocalDate lastDayOfMonth = localDate2.with(TemporalAdjusters.lastDayOfMonth());
AccidentStatisticsVo currentMonthAccidentStatisticsVo = new AccidentStatisticsVo();
currentMonthAccidentStatisticsVo.setYear(year);
currentMonthAccidentStatisticsVo.setMonth(month + 1);
currentMonthAccidentStatisticsVo.setBeginTime(firstDayOfMonth + " 00:00:00");
currentMonthAccidentStatisticsVo.setEndTime(lastDayOfMonth + " 23:59:59");
accidentStatisticsVoList.add(currentMonthAccidentStatisticsVo);
return accidentStatisticsVoList;
}
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/verify/AccidentVerifyCompletedService.java Voir le fichier

@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.AccidentStatusEnum;
import com.tuoheng.admin.enums.accident.AccidentStatusEnum;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.AccidentMapper;

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/verify/AccidentVerifyService.java Voir le fichier

@@ -10,7 +10,7 @@ import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.AccidentStatusEnum;
import com.tuoheng.admin.enums.accident.AccidentStatusEnum;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.InspectionTypeEnum;
import com.tuoheng.admin.enums.MarkEnum;

+ 1
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accidentread/AccidentReadServiceImpl.java Voir le fichier

@@ -3,12 +3,9 @@ package com.tuoheng.admin.service.accidentread;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.AccidentRead;
import com.tuoheng.admin.enums.AccidentEnum;
import com.tuoheng.admin.enums.accident.AccidentEnum;
import com.tuoheng.admin.mapper.AccidentReadMapper;
import com.tuoheng.admin.service.accident.IAccidentService;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.common.BaseServiceImpl;
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.StringUtils;
@@ -16,8 +13,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @Author ChengWang
* @Date 2023/3/2

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java Voir le fichier

@@ -7,7 +7,7 @@ import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.AccidentEnum;
import com.tuoheng.admin.enums.accident.AccidentEnum;
import com.tuoheng.admin.enums.TaskStatusEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.mapper.TenantMapper;

+ 131
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/AirportDroneControlService.java Voir le fichier

@@ -0,0 +1,131 @@
package com.tuoheng.admin.service.third.airport.control;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.request.accident.DroneControlRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
* 机场平台回调业务平台
*
* @author wanjing
* @team tuoheng
* @date 2023-06-25
*/
@Slf4j
@Service
public class AirportDroneControlService {

@Autowired
private TenantMapper tenantMapper;

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private DroneContinueService droneContinueService;

@Autowired
private DroneGuideFlightService droneGuideFlightService;

@Autowired
private DronePauseService dronePauseService;

@Autowired
private DroneReturnHomeService droneReturnHomeService;

@Autowired
private DroneUndoService droneUndoService;

@Autowired
@Qualifier("restTemplate")
private RestTemplate restTemplate;

/**
* @return
*/
public JsonResult exec(DroneControlRequest request) {
//查询当前对应的任务
Inspection inspection = inspectionMapper.selectOne(Wrappers.<Inspection>lambdaQuery()
.eq(Inspection::getId, request.getInspectionId())
.eq(Inspection::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isEmpty(inspection)) {
throw new ServiceException("操控无人机,该任务不存在");
}

Tenant tenant = tenantMapper.selectById(CurrentUserUtil.getTenantId());
if (ObjectUtil.isEmpty(tenant)) {
throw new ServiceException("操控无人机,该租户不存在");
}
request.setAirportId(inspection.getAirportId());
request.setAirportTaskId(request.getAirportTaskId());
request.setTenantCode(tenant.getCode());

// 1:悬停;2:指点飞行;3:继续任务;4:立即返航;5:取消任务
JSONObject jsonObject = null;
if (1 == request.getType()) {
// 悬停
jsonObject = dronePauseService.getJSONObject(request);
} else if (2 == request.getType()) {
// 指点飞行
jsonObject = droneGuideFlightService.getJSONObject(request);
} else if (3 == request.getType()) {
// 继续任务
jsonObject = droneContinueService.getJSONObject(request);
} else if (4 == request.getType()) {
// 立即返航
jsonObject = droneReturnHomeService.getJSONObject(request);
} else if (5 == request.getType()) {
// 取消任务
jsonObject = droneUndoService.getJSONObject(request);
} else {
throw new ServiceException("操控无人机,错误的操作指令");
}
JsonResult jsonResult = this.call(jsonObject);
return jsonResult;
}

/**
* @return
*/
private JsonResult call(JSONObject jsonObject) {
String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_DRONE_CONTROL;
log.info("调用机场平台,操作无人机,url:{}", url);
log.info("调用机场平台,操作无人机,jsonObject:{}", jsonObject);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity httpEntity = new HttpEntity(jsonObject, headers);
ResponseEntity<JsonResult> response;
try {
response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, JsonResult.class);
} catch (Exception e) {
log.error("调用机场平台,操作无人机,接口异常, url:{}", url);
log.error("调用机场平台,操作无人机,接口异常, httpEntity:{}", httpEntity);
throw new ServiceException("调用机场平台,接口异常");
}
JsonResult jsonResult = response.getBody();
if (0 != jsonResult.getCode()) {
log.info("调用机场平台,操作无人机,机场返回失败,jsonResult:{}", jsonResult.getMsg());
return JsonResult.error(-1, "调用机场平台,操作无人机,机场返回失败");
}
log.info("调用机场平台,操作无人机结束");
return JsonResult.success();
}

}

+ 36
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/DroneContinueService.java Voir le fichier

@@ -0,0 +1,36 @@
package com.tuoheng.admin.service.third.airport.control;

import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.request.accident.DroneControlRequest;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Slf4j
@Service
public class DroneContinueService {

/**
* 用机场平台,原无人机继续巡检
*
* @param request
* @return
*/
public JSONObject getJSONObject(DroneControlRequest request) {
log.info("继续巡检, inspectionId={}", request.getInspectionId());
JSONObject jsonObject = new JSONObject();
jsonObject.put("zhilin", "04");
jsonObject.put("airportId", request.getAirportId());
jsonObject.put("taskId", request.getAirportTaskId());
jsonObject.put("msg", "继续巡检");
return jsonObject;
}
}

+ 37
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/DroneExecuteService.java Voir le fichier

@@ -0,0 +1,37 @@
package com.tuoheng.admin.service.third.airport.control;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.request.accident.DroneControlRequest;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class DroneExecuteService {

/**
* 执行任务
*
* @param request
* @return
*/
public JSONObject getJSONObject(DroneControlRequest request) {
String url = "";
JSONObject jsonObject = new JSONObject();
jsonObject.put("requestId", request.getAirportTaskId());
jsonObject.put("airportId", request.getAirportId());
jsonObject.put("code", SystemConstant.PLATFORM_CODE);
jsonObject.put("tenantCode", request.getTenantCode());
jsonObject.put("wayUrl", url);
return jsonObject;
}

}

+ 32
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/DroneGuideFlightService.java Voir le fichier

@@ -0,0 +1,32 @@
package com.tuoheng.admin.service.third.airport.control;

import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.constant.DroneControlConstant;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.request.accident.DroneControlRequest;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class DroneGuideFlightService {

/**
* 指点飞行
*
* @param request
* @return
*/
public JSONObject getJSONObject(DroneControlRequest request) {
log.info("指点飞行, inspectionId={}", request.getInspectionId());
JSONObject jsonObject = new JSONObject();
jsonObject.put("taskId", request.getAirportTaskId());
jsonObject.put("airportId", request.getAirportId());
jsonObject.put("zalt", request.getZalt());
jsonObject.put("zlon", request.getLongitude());
jsonObject.put("zlat", request.getLatitude());
return jsonObject;
}
}

+ 30
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/DronePauseService.java Voir le fichier

@@ -0,0 +1,30 @@
package com.tuoheng.admin.service.third.airport.control;

import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.constant.DroneControlConstant;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.request.accident.DroneControlRequest;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class DronePauseService {

/**
* 航线暂停
*
* @param request
* @return
*/
public JSONObject getJSONObject(DroneControlRequest request) {
log.info("航线暂停, inspectionId={}", request.getInspectionId());
JSONObject jsonObject = new JSONObject();
jsonObject.put("zhilin", DroneControlConstant.PAUSE);
jsonObject.put("airportId", request.getAirportTaskId());
jsonObject.put("msg", "航线暂停");
return jsonObject;
}
}

+ 30
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/DroneReturnHomeService.java Voir le fichier

@@ -0,0 +1,30 @@
package com.tuoheng.admin.service.third.airport.control;

import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.constant.DroneControlConstant;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.request.accident.DroneControlRequest;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class DroneReturnHomeService {

/**
* 一键返航
*
* @param request
* @return
*/
public JSONObject getJSONObject(DroneControlRequest request) {
log.info("一键返航, inspectionId={}", request.getInspectionId());
JSONObject jsonObject = new JSONObject();
jsonObject.put("zhilin", DroneControlConstant.RETURN_HOME);
jsonObject.put("airportId", request.getAirportId());
jsonObject.put("msg", "一键返航");
return jsonObject;
}
}

+ 50
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/control/DroneUndoService.java Voir le fichier

@@ -0,0 +1,50 @@
package com.tuoheng.admin.service.third.airport.control;

import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.request.accident.DroneControlRequest;
import com.tuoheng.admin.service.third.airport.AirportService;
import com.tuoheng.admin.service.third.airport.GetAirLineListService;
import com.tuoheng.admin.service.third.airport.GetAirportListByAirportIds;
import com.tuoheng.admin.vo.AirportInfoVo;
import com.tuoheng.admin.vo.AirportLineVo;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class DroneUndoService {

@Autowired
private GetAirportListByAirportIds getAirportListByAirportIds;

/**
* 取消任务
*
* @param request
* @return
*/
public JSONObject getJSONObject(DroneControlRequest request) {
log.info("取消任务, inspectionId={}", request.getInspectionId());
List<AirportInfoVo> airportInfoVoList = getAirportListByAirportIds.getAirportInfo(String.valueOf(request.getAirportId()));
if (CollectionUtil.isEmpty(airportInfoVoList)) {
log.error("操控无人机,该机场不存在, ");
throw new ServiceException("操控无人机,该机场不存在");
}
AirportInfoVo airportInfoVo = airportInfoVoList.get(9);
JSONObject jsonObject = new JSONObject();
jsonObject.put("code", SystemConstant.PLATFORM_CODE);
jsonObject.put("tenantCode", request.getTenantCode());
jsonObject.put("airportCode", airportInfoVo.getCode());
jsonObject.put("taskId", request.getAirportTaskId());
return jsonObject;
}

}

+ 4
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java Voir le fichier

@@ -10,6 +10,8 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.*;
import com.tuoheng.admin.enums.accident.AccidentReportTypeEnum;
import com.tuoheng.admin.enums.accident.AccidentStatusEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.third.DspCallbackRequest;
import com.tuoheng.admin.request.third.QuestionFile;
@@ -19,7 +21,6 @@ import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.*;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -335,6 +336,7 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
}
Accident accident = new Accident();
//问题类型为应急类型时添加数据
accident.setReportType(AccidentReportTypeEnum.AUTO.getCode());
accident.setTenantId(inspectionFile.getTenantId());
accident.setInspectionId(inspectionFile.getInspectionId());
accident.setInspectionFileId(inspectionFile.getId());
@@ -369,6 +371,7 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
if (ObjectUtils.isNotEmpty(roadInformation)) {
accident.setRoadCode(roadInformation.getCode());
}
accident.setName(inspectionFile.getQuestionName());
accident.setQuestionId(inspectionFile.getQuestionId());
accident.setQuestionCode(inspectionFile.getQuestionCode());
accident.setQuestionName(inspectionFile.getQuestionName());

+ 44
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentInspectionVo.java Voir le fichier

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

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

import java.util.Date;
import java.util.List;

/**
* @Author xiaoying
* @Date 2023/4/13 17:10
*/
@Data
public class AccidentInspectionVo {

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

/**
* 任务ID
*/
private String inspectionCode;

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

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

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

}

+ 44
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentStatisticsVo.java Voir le fichier

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

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

import java.util.Date;

/**
* 事件月份统计 返回实体类
*
* @author wanjing
* @team tuoheng
* @date 2024-01-19
*/
@Data
public class AccidentStatisticsVo {

/**
* 年
*/
private Integer year;

/**
* 月份
*/
private Integer month;

/**
* 事件数
*/
private Integer count;

/**
* 开始时间
*/
private String beginTime;

/**
* 结束时间
*/
private String endTime;

}

+ 13
- 13
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentVo.java Voir le fichier

@@ -1,18 +1,13 @@
package com.tuoheng.admin.vo.accident;

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

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

/**
* 事件对象
*
* @team tuoheng
* @author wanjing
* @team tuoheng
* @date 2023-03-03
*/
@Data
@@ -20,6 +15,11 @@ public class AccidentVo extends BaseEntity {

private static final long serialVersionUID = 1L;

/**
* 事件名称
*/
private String name;

/**
* 部门id
*/
@@ -31,14 +31,9 @@ public class AccidentVo extends BaseEntity {
private String deptName;

/**
* 部门负责人
* 上报类型:1:自动上报(默认);2:手动上报
*/
private String departmentHead;

/**
* 部门负责人联系方式
*/
private String departmentHeadTelephone;
private Integer reportType;

/**
* 巡检任务id
@@ -90,6 +85,11 @@ public class AccidentVo extends BaseEntity {
*/
private String questionName;

/**
* 图片
*/
private String image;

/**
* 经度
*/

+ 6
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/AccidentInspectionMapper.xml Voir le fichier

@@ -0,0 +1,6 @@
<?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.AccidentInspectionMapper">


</mapper>

+ 52
- 5
tuoheng-service/tuoheng-admin/src/main/resources/mapper/AccidentMapper.xml Voir le fichier

@@ -6,6 +6,8 @@
<result property="id" column="id" />
<result property="tenantId" column="tenant_id" />
<result property="deptId" column="dept_id" />
<result property="name" column="name" />
<result property="reportType" column="report_type" />
<result property="inspectionId" column="inspection_id" />
<result property="inspectionFileId" column="inspection_file_id" />
<result property="accidentInspectionId" column="accident_inspection_id" />
@@ -16,6 +18,7 @@
<result property="questionId" column="question_id" />
<result property="questionCode" column="question_code" />
<result property="questionName" column="question_name" />
<result property="image" column="image" />
<result property="isCasualties" column="is_casualties" />
<result property="isDrivingSafety" column="is_driving_safety" />
<result property="isFire" column="is_fire" />
@@ -40,21 +43,20 @@
<result property="mark" column="mark" />
</resultMap>


<sql id="Base_Column_List">
id, tenant_id, dept_id, inspection_id, inspection_file_id, accident_inspection_id, road_id, road_code, section_id, section_name, question_id, question_code, question_name,
id, tenant_id, dept_id, name, report_type, inspection_id, inspection_file_id, accident_inspection_id, road_id, road_code, section_id, section_name, question_id, question_code, question_name, image,
is_casualties, is_driving_safety, is_fire, record, longitude, latitude, uav_return, status, create_user, create_time, update_user, update_time,
check_user, check_time, check_result, verification_time, report_time, no_accident_time, ignore_time, end_time, flag, mark
</sql>

<sql id="selectThAccidentVo">
select id, tenant_id, dept_id, inspection_id, inspection_file_id, accident_inspection_id, road_id, road_code, section_id, section_name, question_id, question_code, question_name,
select id, tenant_id, dept_id, name, report_type, inspection_id, inspection_file_id, accident_inspection_id, road_id, road_code, section_id, section_name, question_id, question_code, question_name, image,
is_casualties, is_driving_safety, is_fire, record, longitude, latitude, uav_return, status, create_user, create_time, update_user, update_time,
check_user, check_time, check_result, verification_time, report_time, no_accident_time, ignore_time, end_time, flag, mark
from th_accident
</sql>

<select id="selectPageList" parameterType="com.tuoheng.admin.request.accident.QueryAccidentCardPageListRequest" resultMap="AccidentResult">
<select id="selectPageList" parameterType="com.tuoheng.admin.request.accident.QueryAccidentPageListRequest" resultMap="AccidentResult">
select <include refid="Base_Column_List"/>
from th_accident
<where>
@@ -83,7 +85,30 @@
order by create_time desc
</select>

<select id="selectAccidentCardList" parameterType="com.tuoheng.admin.request.accident.QueryAccidentCardListRequest" resultMap="AccidentResult">
<select id="getRealtimeInfoList" parameterType="com.tuoheng.admin.request.accident.QueryAccidentRealtimeInfoListRequest" resultMap="AccidentResult">
select <include refid="Base_Column_List"/>
from th_accident
<where>
<if test="1 == 1"> and mark = 1 </if>
<if test="1 == 1"> and flag = 0 </if>
<if test="request.tenantId != null and request.tenantId != ''"> and tenant_id = #{request.tenantId} </if>
<if test="request.statusList != null and request.statusList.size() > 0">
and status in
<foreach item="status" collection="request.statusList" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="request.deptIdList != null and request.deptIdList.size() > 0">
and dept_id in
<foreach item="deptId" collection="request.deptIdList" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
</where>
order by create_time desc
</select>

<select id="getHistoryPageList" parameterType="com.tuoheng.admin.request.accident.QueryHistoryPageListRequest" resultMap="AccidentResult">
select <include refid="Base_Column_List"/>
from th_accident
<where>
@@ -106,4 +131,26 @@
order by create_time desc
</select>

<select id="selectAccidentCardList" parameterType="com.tuoheng.admin.request.accident.QueryAccidentCardListRequest" resultMap="AccidentResult">
select <include refid="Base_Column_List"/>
from th_accident
<where>
<if test="1 == 1"> and mark = 1 </if>
<if test="1 == 1"> and flag = 0 </if>
<if test="request.tenantId != null and request.tenantId != ''"> and tenant_id = #{request.tenantId} </if>
<if test="request.statusList != null and request.statusList.size() > 0">
and status in
<foreach item="status" collection="request.statusList" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="request.deptIdList != null and request.deptIdList.size() > 0">
and dept_id in
<foreach item="deptId" collection="request.deptIdList" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
</where>
order by create_time desc
</select>
</mapper>

+ 7
- 7
tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/service/DspCallbackServiceTest.java Voir le fichier

@@ -38,18 +38,18 @@ public class DspCallbackServiceTest {

@Test
public void testGetOneById() {
String requestId = "369567d311de473886c40a5c85305493";
String requestId = "c4da0ec5d77b46d6992f9f9462fb1bc3";
DspCallbackRequest dspCallbackRequest = new DspCallbackRequest();
dspCallbackRequest.setAnalyseStatus(2);
dspCallbackRequest.setAnalyseStatus(10);
dspCallbackRequest.setType(1);

List<QuestionFile> questionFiles = new ArrayList<>();
QuestionFile questionFile = new QuestionFile();
questionFile.setFileCode("PVR2024010815484594512");
questionFile.setFileName("2024-01-08-15-48-45_frame-52-332_type_20240108154845591880-1-003-1_AI.jpg");
questionFile.setFileOriginalUrl("https://image.t-aaron.com/369567d311de473886c40a5c85305493/2024-01-08-15-48-45_frame-52-332_type_20240108154845581518-1-0-0_OR.jpg");
questionFile.setFileMarkerUrl("https://image.t-aaron.com/369567d311de473886c40a5c85305493/2024-01-08-15-48-45_frame-52-332_type_20240108154845591880-1-003-1_AI.jpg");
questionFile.setAnalyseTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, "2024-01-08 15:48:45"));
questionFile.setFileCode("PBS2024011110351459454");
questionFile.setFileName("2024-01-11-10-35-14_frame-2926-3206_type_20240111103514148029-1-003-1_AI.jpg");
questionFile.setFileOriginalUrl("https://image.t-aaron.com/c4da0ec5d77b46d6992f9f9462fb1bc3/2024-01-11-10-35-14_frame-2926-3206_type_20240111103514141070-1-0-0_OR.jpg");
questionFile.setFileMarkerUrl("https://image.t-aaron.com/c4da0ec5d77b46d6992f9f9462fb1bc3/2024-01-11-10-35-14_frame-2926-3206_type_20240111103514148029-1-003-1_AI.jpg");
questionFile.setAnalyseTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, "2024-01-11 10:35:14"));
questionFile.setQuestionName("车辆");
questionFile.setQuestionCode("003008");
questionFiles.add(questionFile);

Chargement…
Annuler
Enregistrer