Browse Source

义乌公路 初始化项目

master
PoffyZhang 7 months ago
parent
commit
0bb6a820f0
100 changed files with 5534 additions and 25 deletions
  1. +9
    -25
      .gitignore
  2. +34
    -0
      ningda-generator/pom.xml
  3. +66
    -0
      ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeConfig.java
  4. +309
    -0
      ningda-yw-api/pom.xml
  5. +32
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/App.java
  6. +72
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/common/DangerLevelEnum.java
  7. +77
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/AnalysisEvalDataViewController.java
  8. +61
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/IndustryStandardsController.java
  9. +114
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/InsuranceRiskEvalController.java
  10. +73
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/SecurityAnalysisEvalController.java
  11. +50
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/WarnAnalysisController.java
  12. +54
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/IndustryStandards.java
  13. +62
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityManageGrade.java
  14. +77
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityManageResultEval.java
  15. +80
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityRiskEval.java
  16. +74
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecuritySystemBuildingEval.java
  17. +77
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleAccidentEval.java
  18. +77
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleOverSpeedEval.java
  19. +69
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleServiceLife.java
  20. +77
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleViolationEval.java
  21. +80
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisCar.java
  22. +71
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisCompany.java
  23. +79
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisDriver.java
  24. +22
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/CompanyWarnStatisticsDto.java
  25. +64
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/OutDangerImportDto.java
  26. +70
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleAccidentImportDto.java
  27. +70
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleOverSpeedImportDto.java
  28. +71
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleViolationImportDto.java
  29. +40
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/DangerLevel.java
  30. +43
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/IndustryStandardsType.java
  31. +31
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/InsuranceDangerLevel.java
  32. +36
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/IndustryStandardsListReq.java
  33. +34
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/IndustryStandardsSaveReq.java
  34. +27
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityManageGradeListReq.java
  35. +55
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityRiskEvalListReq.java
  36. +78
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityRiskEvalSaveReq.java
  37. +70
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecuritySystemBuildingEvalSaveReq.java
  38. +41
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleAccidentEvalModReq.java
  39. +41
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleOverSpeedEvalModReq.java
  40. +42
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleServiceLifeListReq.java
  41. +41
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleViolationEvalModReq.java
  42. +42
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/WarnAnalysisListReq.java
  43. +39
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/CompanyWarnStatisticsVo.java
  44. +32
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/IndustryStandardsListVo.java
  45. +40
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityManageGradeVo.java
  46. +66
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityManageResultEvalListVo.java
  47. +53
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityRiskEvalListVo.java
  48. +47
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecuritySystemBuildingEvalListVo.java
  49. +55
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleAccidentEvalListVo.java
  50. +55
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleOverSpeedEvalListVo.java
  51. +60
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleServiceLifeListVo.java
  52. +59
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleViolationEvalListVo.java
  53. +58
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByCarVo.java
  54. +54
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByCompanyVo.java
  55. +59
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByDriverVo.java
  56. +190
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/AnalysisEvalDataViewManage.java
  57. +132
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/IndustryStandardsManage.java
  58. +568
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/InsuranceRiskEvalManage.java
  59. +245
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/SecurityAnalysisEvalManage.java
  60. +149
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/WarnAnalysisManage.java
  61. +18
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/IndustryStandardsMapper.java
  62. +9
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/IndustryStandardsMapper.xml
  63. +7
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/NdInsureOutDangerVOMapper.java
  64. +7
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/NdInsureOutDangerVOMapper.xml
  65. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageGradeMapper.java
  66. +5
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageGradeMapper.xml
  67. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageResultEvalMapper.java
  68. +5
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageResultEvalMapper.xml
  69. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityRiskEvalMapper.java
  70. +5
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityRiskEvalMapper.xml
  71. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecuritySystemBuildingEvalMapper.java
  72. +5
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecuritySystemBuildingEvalMapper.xml
  73. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleAccidentEvalMapper.java
  74. +5
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleAccidentEvalMapper.xml
  75. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleOverSpeedEvalMapper.java
  76. +5
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleOverSpeedEvalMapper.xml
  77. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleServiceLifeMapper.java
  78. +5
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleServiceLifeMapper.xml
  79. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleViolationEvalMapper.java
  80. +5
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleViolationEvalMapper.xml
  81. +28
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCarMapper.java
  82. +162
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCarMapper.xml
  83. +23
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCompanyMapper.java
  84. +95
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCompanyMapper.xml
  85. +23
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisDriverMapper.java
  86. +87
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisDriverMapper.xml
  87. +19
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IIndustryStandardsService.java
  88. +7
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/INdInsureOutDangerVOService.java
  89. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityManageGradeService.java
  90. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityManageResultEvalService.java
  91. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityRiskEvalService.java
  92. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecuritySystemBuildingEvalService.java
  93. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleAccidentEvalService.java
  94. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleOverSpeedEvalService.java
  95. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleServiceLifeService.java
  96. +16
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleViolationEvalService.java
  97. +25
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisCarService.java
  98. +23
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisCompanyService.java
  99. +22
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisDriverService.java
  100. +30
    -0
      ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/IndustryStandardsServiceImpl.java

+ 9
- 25
.gitignore View File

@@ -1,25 +1,9 @@
# ---> Java
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### IDEA ###
*.iml
*/target/*
*/*.iml
/.gradle/
*.pid
/LOG_PATH_IS_UNDEFINED/
logs
/.idea/

+ 34
- 0
ningda-generator/pom.xml View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.ningdatech</groupId>
<artifactId>ningda-yw-road</artifactId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ningda-generator</artifactId>

<dependencies>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>${mybatis.plus.version}</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
<!--Mysql数据库驱动-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
</project>

+ 66
- 0
ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeConfig.java View File

@@ -0,0 +1,66 @@
package com.ningdatech.generator.config;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.util.Collections;

/**
* @description: 自动生成code代码
* @author: liushuai
* @date: 2022/3/25 14:20
*/
public class GeneratorCodeConfig {

private static final String PATH_LXX = "/Users/LiuXinXin/IdeaProjects/car-manage/ningda-car-api/src/main/java";
private static final String PATH_YYD = "/Users/wendy/coding/java/car-manage/ningda-car-api/src/main/java";
private static final String PATH_LS = "/Users/qinxianyun/Documents/qin/ningdatech/secret-file-manage/ningda-api/src/main/java";
private static final String PATH_ZPF = "D:\\ningda\\car-manage\\ningda-car-api\\src\\main\\java";
private static final String PATH_CMM = "D:\\work\\shuiniche\\car-manage\\ningda-car-api\\src\\main\\java";

private static final String URL = "jdbc:mysql://47.98.125.47:3306/nd_cement_truck_dev?" +
"useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&" +
"useSSL=false&serverTimezone=Asia/Shanghai";
private static final String USER_NAME = "root";
private static final String PASSWORD = "NingdaKeji123!";

private static void generate(String author, String packageName, String path, String... tableNames) {
FastAutoGenerator.create(URL, USER_NAME, PASSWORD)
.globalConfig(builder -> {
// 设置作者
builder.author(author)
// 开启 swagger 模式
.enableSwagger()
// 覆盖已生成文件
.fileOverride()
// 指定输出目录
.outputDir(path);
})
.packageConfig(builder -> {
// 设置父包名
builder.parent("com.ningdatech")
// 设置父包模块名
.moduleName("carapi." + packageName)
// 设置mapperXml生成路径
.pathInfo(Collections.singletonMap(OutputFile.xml,
//设置自己的生成路径
path + "/com/ningdatech/carapi/" + packageName + "/mapper"));
})
.strategyConfig(builder -> {
builder.addTablePrefix("nd");
// 设置需要生成的表名
builder.addInclude(tableNames);
})
// 使用Freemarker引擎模板,默认的是Velocity引擎模板
.templateEngine(new FreemarkerTemplateEngine())
.execute();
}

public static void main(String[] args) {
//generate("PoffyZhang", "car.monitor",PATH_ZPF, "nd_vehicle_security_monitor");
//generate("WendyYang", "irs",PATH_YYD, "nd_drivers_license");
generate("CMM", "test",PATH_CMM, "nd_vehicle_equipment_no");
}

}

+ 309
- 0
ningda-yw-api/pom.xml View File

@@ -0,0 +1,309 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ningdatech</groupId>
<artifactId>ningda-yw-road</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>ningda-yw-api</artifactId>
<version>1.0.0</version>

<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jxls</groupId>
<artifactId>jxls-jexcel</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>com.ningdatech</groupId>
<artifactId>nd-openapi-signature-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!--实现springboot的热加载-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
<scope>true</scope>
</dependency>
<dependency>
<groupId>com.ningdatech</groupId>
<artifactId>nd-basic</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.ningdatech</groupId>
<artifactId>nd-swagger2-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- MYSQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>io.krakens</groupId>
<artifactId>java-grok</artifactId>
<version>0.1.9</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<!-- 实现对 Spring Session 使用 Redis 作为数据源的自动化配置 -->
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.ningdatech</groupId>
<artifactId>nd-cache-starter</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- mybatis plus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
</dependency>
<dependency>
<groupId>com.ningdatech</groupId>
<artifactId>nd-log-starter</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.ningdatech</groupId>
<artifactId>nd-file-starter</artifactId>
<version>1.0.0</version>
</dependency>

<!-- rabbit mq -->
<!--mqtt依赖包-->
<!--mqtt依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mqtt</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- 集成Redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<artifactId>nd-sms-send-starter</artifactId>
<groupId>com.ningdatech</groupId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>

<!-- 导出文件为word docx格式 -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.core</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.document</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.template</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.document.docx</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.template.freemarker</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<!--导入导出-->
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
</dependency>

</dependencies>
<!-- 打包 -->
<!--配置环境的profile-->
<profiles>
<profile>
<id>dev</id>
<properties>
<!--使用${environment}获取值-->
<environment>dev</environment>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<environment>test</environment>
</properties>
</profile>
<profile>
<id>pre</id>
<properties>
<environment>pre</environment>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<environment>prod</environment>
</properties>
</profile>
</profiles>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>

<resource>
<directory>src/main/resources</directory>
<targetPath>BOOT-INF/classes/</targetPath>
</resource>
</resources>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.12.RELEASE</version>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 跳过单元测试 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</project>

+ 32
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/App.java View File

@@ -0,0 +1,32 @@
package com.ningdatech.carapi;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.ningdatech.basic.config.DefaultAsyncTaskConfig;

/**
* @author liuxinxin
*/
@EnableAsync
@SpringBootApplication
@MapperScan(App.MAPPER_PACKAGES)
@EnableScheduling
@Import(DefaultAsyncTaskConfig.class)
@EnableTransactionManagement
@EnableAspectJAutoProxy(exposeProxy = true)
public class App {

protected static final String MAPPER_PACKAGES = "com.ningdatech.carapi.**.mapper";

public static void main(String[] args) {
System.setProperty("druid.mysql.usePingMethod", "false");
SpringApplication.run(App.class, args);
}
}

+ 72
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/common/DangerLevelEnum.java View File

@@ -0,0 +1,72 @@
package com.ningdatech.carapi.analysis.common;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
* @return
* @author CMM
* @since 2022/12/20 14:10
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "VehicleDangerLevelEnum", description = "车辆风险等级-枚举")
public enum DangerLevelEnum {
/**
* 风险等级
*/
LOW_RISK(1, "红色预警"),

INTERMEDIATE_RISK(2, "橙色预警"),

SECONDARY_RISK(3,"黄色预警"),

SENIOR_RISK(4,"蓝色预警");



private Integer code;
private String desc;

public String getDesc() {
return desc;
}

public void setDesc(String desc) {
this.desc = desc;
}

public static String getDescByCode(Integer code) {
if(Objects.isNull(code)){
return StringUtils.EMPTY;
}
for (DangerLevelEnum t : DangerLevelEnum.values()) {
if (code.equals(t.getCode())) {
return t.desc;
}
}
return StringUtils.EMPTY;
}

public static Integer getCodeByDesc(String desc) {
if(StringUtils.isBlank(desc)){
return null;
}
for (DangerLevelEnum t : DangerLevelEnum.values()) {
if (desc.equals(t.getDesc())) {
return t.code;
}
}
return null;
}

public boolean eq(String val) {
return this.name().equals(val);
}
}

+ 77
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/AnalysisEvalDataViewController.java View File

@@ -0,0 +1,77 @@
package com.ningdatech.carapi.analysis.controller;

import com.ningdatech.carapi.analysis.entity.enumeration.DangerLevel;
import com.ningdatech.carapi.analysis.entity.vo.CompanyWarnStatisticsVo;
import com.ningdatech.carapi.analysis.manage.AnalysisEvalDataViewManage;
import com.ningdatech.carapi.common.model.DataChartVo;
import com.ningdatech.carapi.common.model.MapDataVO;
import com.ningdatech.carapi.common.util.CodeUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
* <p>
* AnalysisEvalDataViewController
* </p>
*
* @author WendyYang
* @since 15:24 2022/10/25
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "分析评估-数据大屏")
@RequestMapping("/api/v1/analysis-eval/data-view")
public class AnalysisEvalDataViewController {

private final AnalysisEvalDataViewManage analysisEvalDataViewManage;

@GetMapping("/insuranceOrgStatistics/{regionId}")
@ApiOperation("保险机构车辆占比")
public List<DataChartVo> insuranceOrgStatistics(@PathVariable Long regionId) {
regionId = CodeUtil.convertRegionCodeToId(regionId);
return analysisEvalDataViewManage.insuranceOrgStatistics(regionId);
}

@GetMapping("/companyWarnStatistics/{regionId}")
@ApiOperation("企业综合预警分析")
public List<CompanyWarnStatisticsVo> companyWarnStatistics(@PathVariable Long regionId) {
regionId = CodeUtil.convertRegionCodeToId(regionId);
return analysisEvalDataViewManage.companyWarnStatistics(regionId);
}

@GetMapping("/companyWarnStatisticsByLevel")
@ApiOperation("企业红色预警")
public List<DataChartVo> companyWarnStatisticsByLevel(@RequestParam("regionId") Long regionId,
@RequestParam(value = "dangerLevel", required = false) Integer dangerLevel) {
regionId = CodeUtil.convertRegionCodeToId(regionId);
// 默认查询最低等级预警即蓝色预警
if (dangerLevel == null) {
dangerLevel = DangerLevel.BLUE.getCode();
}
return analysisEvalDataViewManage.companyWarnStatisticsByLevel(regionId, dangerLevel);
}

@GetMapping("/carWarnStatistics/{regionId}")
@ApiOperation("车辆综合预警分析")
public List<MapDataVO> carWarnStatistics(@PathVariable Long regionId) {
regionId = CodeUtil.convertRegionCodeToId(regionId);
return analysisEvalDataViewManage.carWarnStatistics(regionId);
}

@GetMapping("/carWarnStatisticsByLevel")
@ApiOperation("车辆红色预警")
public List<DataChartVo> carWarnStatisticsByLevel(@RequestParam("regionId") Long regionId,
@RequestParam(value = "dangerLevel", required = false) Integer dangerLevel) {
regionId = CodeUtil.convertRegionCodeToId(regionId);
// 默认查询红色预警
if (dangerLevel == null) {
dangerLevel = DangerLevel.RED.getCode();
}
return analysisEvalDataViewManage.carWarnStatisticsByLevel(regionId, dangerLevel);
}

}

+ 61
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/IndustryStandardsController.java View File

@@ -0,0 +1,61 @@
package com.ningdatech.carapi.analysis.controller;


import com.ningdatech.basic.model.PageVo;
import com.ningdatech.carapi.analysis.entity.req.IndustryStandardsListReq;
import com.ningdatech.carapi.analysis.entity.req.IndustryStandardsSaveReq;
import com.ningdatech.carapi.analysis.entity.vo.IndustryStandardsListVo;
import com.ningdatech.carapi.analysis.manage.IndustryStandardsManage;
import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.carapi.user.util.LoginUserUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* <p>
* 前端控制器
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Api(tags = "分析评估-行业规范")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/analysis-eval/industry-standards")
public class IndustryStandardsController {

private final IndustryStandardsManage industryStandardsManage;

@GetMapping("/list")
@ApiOperation("行业规范列表")
public PageVo<IndustryStandardsListVo> industryStandardsList(@Valid IndustryStandardsListReq req) {
return industryStandardsManage.list(req);
}

@PostMapping("/save")
@ApiOperation("新增行业规范")
public void save(@Valid @RequestBody IndustryStandardsSaveReq req) {
industryStandardsManage.save(req);
}

@ApiOperation("增加下载次数")
@GetMapping("/incrementDownCount/{id}")
public void incrementDownCount(@PathVariable Long id) {
industryStandardsManage.incrementDownCount(id);
}

@ApiOperation("删除行业标准文件")
@DeleteMapping("/delete-standards")
public void deleteStandardFile(@RequestParam Long id) {
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail();
Long roleId = userInfoDetails.getRoleId();
industryStandardsManage.deleteStandardFile(id,roleId);
}
}

+ 114
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/InsuranceRiskEvalController.java View File

@@ -0,0 +1,114 @@
package com.ningdatech.carapi.analysis.controller;


import com.ningdatech.basic.model.PageVo;
import com.ningdatech.carapi.analysis.entity.req.VehicleAccidentEvalModReq;
import com.ningdatech.carapi.analysis.entity.req.VehicleOverSpeedEvalModReq;
import com.ningdatech.carapi.analysis.entity.req.VehicleServiceLifeListReq;
import com.ningdatech.carapi.analysis.entity.req.VehicleViolationEvalModReq;
import com.ningdatech.carapi.analysis.entity.vo.VehicleAccidentEvalListVo;
import com.ningdatech.carapi.analysis.entity.vo.VehicleOverSpeedEvalListVo;
import com.ningdatech.carapi.analysis.entity.vo.VehicleServiceLifeListVo;
import com.ningdatech.carapi.analysis.entity.vo.VehicleViolationEvalListVo;
import com.ningdatech.carapi.analysis.manage.InsuranceRiskEvalManage;
import com.ningdatech.carapi.sys.entity.enumeration.ImportTemplateEnum;
import com.ningdatech.log.annotation.WebLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;

/**
* <p>
* 分析评估-保险风险评估 前端控制器
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Validated
@RestController
@RequiredArgsConstructor
@Api(tags = "分析评估-保险风险评估")
@RequestMapping("/api/v1/insurance-risk-eval")
public class InsuranceRiskEvalController {

private final InsuranceRiskEvalManage insuranceRiskEvalManage;

@ApiOperation("车辆使用年限列表")
@GetMapping("/vehicleServiceLifeList")
public PageVo<VehicleServiceLifeListVo> vehicleServiceLifeList(@Valid VehicleServiceLifeListReq req) {
return insuranceRiskEvalManage.vehicleServiceLifeList(req);
}

@ApiOperation("车辆违章情况列表")
@GetMapping("/vehicleViolationList")
public PageVo<VehicleViolationEvalListVo> vehicleViolationList(@Valid VehicleServiceLifeListReq req) {
return insuranceRiskEvalManage.vehicleViolationEvalList(req);
}

@ApiOperation("车辆出险情况列表")
@GetMapping("/vehicleAccidentList")
public PageVo<VehicleAccidentEvalListVo> vehicleAccidentList(@Valid VehicleServiceLifeListReq req) {
return insuranceRiskEvalManage.vehicleAccidentList(req);
}

@ApiOperation("车辆超速情况列表")
@GetMapping("/vehicleOverSPeedList")
public PageVo<VehicleOverSpeedEvalListVo> vehicleOverSpeedList(@Valid VehicleServiceLifeListReq req) {
return insuranceRiskEvalManage.vehicleOverSpeedList(req);
}

@ApiOperation("车辆违章情况修改")
@PutMapping("/modVehicleViolation")
@WebLog(value = "车辆违章情况修改", modular = "分析评估-保险风险评估")
public void modVehicleViolation(@Valid @RequestBody VehicleViolationEvalModReq req) {
insuranceRiskEvalManage.vehicleViolationEvalMod(req);
}

@ApiOperation("车辆出险情况修改")
@PutMapping("/modVehicleAccident")
@WebLog(value = "车辆出险情况修改", modular = "分析评估-保险风险评估")
public void modVehicleAccident(@Valid @RequestBody VehicleAccidentEvalModReq req) {
insuranceRiskEvalManage.vehicleAccidentEvalMod(req);
}

@ApiOperation("车辆超速情况修改")
@PutMapping("/modVehicleOverSpeed")
@WebLog(value = "车辆超速情况修改", modular = "分析评估-保险风险评估")
public void modVehicleOverSpeed(@Valid @RequestBody VehicleOverSpeedEvalModReq req) {
insuranceRiskEvalManage.vehicleOverSpeedEvalMod(req);
}

@ApiOperation("车辆违章情况删除")
@DeleteMapping("/delVehicleViolation/{id}")
@WebLog(value = "车辆违章情况删除", modular = "分析评估-保险风险评估")
public void delVehicleViolation(@PathVariable Integer id) {
insuranceRiskEvalManage.vehicleViolationEvalDel(id);
}

@ApiOperation("车辆超速情况删除")
@DeleteMapping("/delVehicleOverSpeed/{id}")
@WebLog(value = "车辆超速情况删除", modular = "分析评估-保险风险评估")
public void delVehicleOverSpeed(@PathVariable Integer id) {
insuranceRiskEvalManage.vehicleOverSpeedEvalDel(id);
}

@ApiOperation("车辆出险情况删除")
@DeleteMapping("/delVehicleAccident/{id}")
@WebLog(value = "车辆出险情况删除", modular = "分析评估-保险风险评估")
public void delVehicleAccident(@PathVariable Integer id) {
insuranceRiskEvalManage.vehicleAccidentEvalDel(id);
}

@ApiOperation("模版数据导入")
@PostMapping("/importTemplateData")
@WebLog(value = "模版数据导入", modular = "分析评估-保险风险评估")
public void importTemplateData(@RequestParam("template") ImportTemplateEnum template, MultipartFile file) {
insuranceRiskEvalManage.importTemplateData(template, file);
}
}

+ 73
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/SecurityAnalysisEvalController.java View File

@@ -0,0 +1,73 @@
package com.ningdatech.carapi.analysis.controller;


import com.ningdatech.basic.model.IdVo;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.carapi.analysis.entity.req.SecurityManageGradeListReq;
import com.ningdatech.carapi.analysis.entity.req.SecurityRiskEvalListReq;
import com.ningdatech.carapi.analysis.entity.req.SecurityRiskEvalSaveReq;
import com.ningdatech.carapi.analysis.entity.req.SecuritySystemBuildingEvalSaveReq;
import com.ningdatech.carapi.analysis.entity.vo.SecurityManageGradeVo;
import com.ningdatech.carapi.analysis.entity.vo.SecurityManageResultEvalListVo;
import com.ningdatech.carapi.analysis.entity.vo.SecurityRiskEvalListVo;
import com.ningdatech.carapi.analysis.entity.vo.SecuritySystemBuildingEvalListVo;
import com.ningdatech.carapi.analysis.manage.SecurityAnalysisEvalManage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* <p>
* 安全管理综合评级 前端控制器
* </p>
*
* @author WendyYang
* @since 2022-10-13
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "分析评估-安全分析评估")
@RequestMapping("/api/v1/security/analysis-eval")
public class SecurityAnalysisEvalController {

private final SecurityAnalysisEvalManage securityAnalysisEvalManage;

@GetMapping("/smg/list")
@ApiOperation("安全管理综合评级列表")
public PageVo<SecurityManageGradeVo> listSecurityManageGrade(SecurityManageGradeListReq req) {
return securityAnalysisEvalManage.list(req);
}

@GetMapping("/sre/list")
@ApiOperation("安全责任体系分析评估列表")
public PageVo<SecurityRiskEvalListVo> listSecurityRiskEval(SecurityRiskEvalListReq req) {
return securityAnalysisEvalManage.list(req);
}

@PostMapping("/sre/save")
@ApiOperation("新增安全责任体系分析评估")
public IdVo<Integer> save(@Valid @RequestBody SecurityRiskEvalSaveReq req) {
return securityAnalysisEvalManage.save(req);
}

@GetMapping("/ibe/list")
@ApiOperation("安全制度建设分析评估列表")
public PageVo<SecuritySystemBuildingEvalListVo> listInstitutionBuildingEval(SecurityRiskEvalListReq req) {
return securityAnalysisEvalManage.listSystemBuildingEval(req);
}

@PostMapping("/ibe/save")
@ApiOperation("保存安全制度建设分析评估")
public IdVo<Integer> save(@Valid @RequestBody SecuritySystemBuildingEvalSaveReq req) {
return securityAnalysisEvalManage.save(req);
}

@GetMapping("/smre/list")
@ApiOperation("安全管理结果分析评估列表")
public PageVo<SecurityManageResultEvalListVo> listSecurityManageResultEval(SecurityRiskEvalListReq req) {
return securityAnalysisEvalManage.listSecurityManageResultEval(req);
}
}

+ 50
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/WarnAnalysisController.java View File

@@ -0,0 +1,50 @@
package com.ningdatech.carapi.analysis.controller;


import com.ningdatech.basic.model.PageVo;
import com.ningdatech.carapi.analysis.entity.req.WarnAnalysisListReq;
import com.ningdatech.carapi.analysis.entity.vo.WarnAnalysisByCarVo;
import com.ningdatech.carapi.analysis.entity.vo.WarnAnalysisByCompanyVo;
import com.ningdatech.carapi.analysis.entity.vo.WarnAnalysisByDriverVo;
import com.ningdatech.carapi.analysis.manage.WarnAnalysisManage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* <p>
* 综合预警分析 前端控制器
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "分析评估-预警分析")
@RequestMapping("/api/v1/warn-analysis")
public class WarnAnalysisController {

private final WarnAnalysisManage warnAnalysisManage;

@ApiOperation("车辆综合预警分析列表")
@GetMapping("/listCarWarnAnalysis")
public PageVo<WarnAnalysisByCarVo> listWarnAnalysisCar(WarnAnalysisListReq req) {
return warnAnalysisManage.listCarWarnAnalysis(req);
}

@ApiOperation("企业综合预警分析列表")
@GetMapping("/listCompanyWarnAnalysis")
public PageVo<WarnAnalysisByCompanyVo> listWarnAnalysisCompany(WarnAnalysisListReq req) {
return warnAnalysisManage.listCompanyWarnAnalysis(req);
}

@ApiOperation("驾驶员综合预警分析列表")
@GetMapping("/listDriverWarnAnalysis")
public PageVo<WarnAnalysisByDriverVo> listDriverWarnAnalysis(WarnAnalysisListReq req) {
return warnAnalysisManage.listDriverWarnAnalysis(req);
}
}

+ 54
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/IndustryStandards.java View File

@@ -0,0 +1,54 @@
package com.ningdatech.carapi.analysis.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 行业标准
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Data
@TableName("nd_industry_standards")
@ApiModel(value = "IndustryStandards对象", description = "")
public class IndustryStandards implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("ID")
@TableId(value = "id", type = IdType.AUTO)
private Long id;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("创建人")
private Long createBy;

private String name;

@ApiModelProperty("标准类型")
private Integer type;

@ApiModelProperty("文件ID")
private Long fileId;

@ApiModelProperty("下载次数")
private Integer downCount;

@ApiModelProperty("区域ID")
private Long regionId;

@ApiModelProperty("企业ID")
private Long companyId;
}

+ 62
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityManageGrade.java View File

@@ -0,0 +1,62 @@
package com.ningdatech.carapi.analysis.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 安全管理综合评级
* </p>
*
* @author WendyYang
* @since 2022-10-13
*/
@Data
@TableName("nd_security_manage_grade")
@ApiModel(value = "SecurityManageGrade对象", description = "安全管理综合评级")
public class SecurityManageGrade implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;

@ApiModelProperty("年度")
private Integer year;

@ApiModelProperty("地区ID")
private Long regionId;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("安全评级")
private String securityLevel;

@ApiModelProperty("综合得分")
private Integer score;

@ApiModelProperty("创建人ID")
private Long createBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改人ID")
private Long updateBy;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

}

+ 77
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityManageResultEval.java View File

@@ -0,0 +1,77 @@
package com.ningdatech.carapi.analysis.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 安全制度建设分析评估
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
@Data
@TableName("nd_security_manage_result_eval")
@ApiModel(value = "SecurityManageResultEval对象", description = "安全制度建设分析评估")
public class SecurityManageResultEval implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;

@ApiModelProperty("年度")
private Integer year;

@ApiModelProperty("地区ID")
private Long regionId;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("综合得分")
private Integer totalScore;

@ApiModelProperty("出现次数")
private Integer dangerCount;

@ApiModelProperty("出险扣分")
private Integer dangerScore;

@ApiModelProperty("死亡人数")
private Integer deadCount;

@ApiModelProperty("死亡人数扣分")
private Integer deadScore;

@ApiModelProperty("受伤人数")
private Integer injuredCount;

@ApiModelProperty("受伤人数扣分")
private Integer injuredScore;

@ApiModelProperty("创建人ID")
private Long createBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改人ID")
private Long updateBy;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

}

+ 80
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityRiskEval.java View File

@@ -0,0 +1,80 @@
package com.ningdatech.carapi.analysis.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 安全责任体系分析评估
* </p>
*
* @author LiuXinXin
* @since 2022-10-14
*/
@Data
@TableName("nd_security_risk_eval")
@ApiModel(value = "SecurityRiskEval对象", description = "安全责任体系分析评估")
public class SecurityRiskEval implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Integer id;

@ApiModelProperty("年度")
private Integer year;

@ApiModelProperty("地区ID")
private Long regionId;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("综合得分")
private Integer totalScore;

@ApiModelProperty("安全承诺得分")
private Integer promiseScore;

@ApiModelProperty("安全责任得分")
private Integer riskScore;

@ApiModelProperty("创建人ID")
private Long createBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改人ID")
private Long updateBy;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("检查地址")
private String checkAddress;

@ApiModelProperty("检查人")
private String checkUser;

@ApiModelProperty("检查部门")
private String checkDept;

@ApiModelProperty("检查内容")
private String checkContent;

@ApiModelProperty("备注")
private String remark;

}

+ 74
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecuritySystemBuildingEval.java View File

@@ -0,0 +1,74 @@
package com.ningdatech.carapi.analysis.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 安全制度建设分析评估
* </p>
*
* @author LiuXinXin
* @since 2022-10-14
*/
@Data
@TableName("nd_security_system_building_eval")
@ApiModel(value = "SecuritySystemBuildingEval对象", description = "安全制度建设分析评估")
public class SecuritySystemBuildingEval implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;

@ApiModelProperty("年度")
private Integer year;

@ApiModelProperty("地区ID")
private Long regionId;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("综合得分")
private Integer totalScore;

@ApiModelProperty("创建人ID")
private Long createBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改人ID")
private Long updateBy;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("检查地址")
private String checkAddress;

@ApiModelProperty("检查人")
private String checkUser;

@ApiModelProperty("检查部门")
private String checkDept;

@ApiModelProperty("检查内容")
private String checkContent;

@ApiModelProperty("备注")
private String remark;

}

+ 77
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleAccidentEval.java View File

@@ -0,0 +1,77 @@
package com.ningdatech.carapi.analysis.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 车辆事故情况评估
* </p>
*
* @author WendyYang
* @since 2022-10-17
*/
@Data
@TableName("nd_vehicle_accident_eval")
@ApiModel(value = "VehicleAccidentEval对象", description = "车辆事故情况评估")
public class VehicleAccidentEval implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;

@ApiModelProperty("地区ID")
private Long regionId;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("创建人ID")
private Long createBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改人ID")
private Long updateBy;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("车辆ID")
private Long carId;

@ApiModelProperty("车牌号")
private String carNo;

@ApiModelProperty("车辆风险等级")
private Integer dangerLevel;

@ApiModelProperty("车架号")
private String carFrameNo;

@ApiModelProperty("行驶里程")
private Integer mileage;

@ApiModelProperty("累计事故次数")
private Integer accidentCount;

@ApiModelProperty("万公里事故次数")
private Integer avgAccidentCount;

@ApiModelProperty("备注")
private String remark;

}

+ 77
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleOverSpeedEval.java View File

@@ -0,0 +1,77 @@
package com.ningdatech.carapi.analysis.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 车辆超速情况评估
* </p>
*
* @author WendyYang
* @since 2022-10-17
*/
@Data
@TableName("nd_vehicle_over_speed_eval")
@ApiModel(value = "VehicleOverSpeedEval对象", description = "车辆超速情况评估")
public class VehicleOverSpeedEval implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;

@ApiModelProperty("地区ID")
private Long regionId;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("创建人ID")
private Long createBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改人ID")
private Long updateBy;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("车辆ID")
private Long carId;

@ApiModelProperty("车牌号")
private String carNo;

@ApiModelProperty("车辆风险等级")
private Integer dangerLevel;

@ApiModelProperty("车架号")
private String carFrameNo;

@ApiModelProperty("行驶里程")
private Integer mileage;

@ApiModelProperty("累计超速次数")
private Integer overSpeedCount;

@ApiModelProperty("万公里超速次数")
private Integer avgOverSpeedCount;

@ApiModelProperty("备注")
private String remark;

}

+ 69
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleServiceLife.java View File

@@ -0,0 +1,69 @@
package com.ningdatech.carapi.analysis.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
* <p>
* 车辆使用年限
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Data
@TableName("nd_vehicle_service_life")
@ApiModel(value = "VehicleServiceLife对象", description = "车辆使用年限")
public class VehicleServiceLife implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;

@ApiModelProperty("地区ID")
private Long regionId;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("创建人ID")
private Long createBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改人ID")
private Long updateBy;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("车辆风险等级")
private Integer dangerLevel;

@ApiModelProperty("车辆ID")
private Long carId;

@ApiModelProperty("车牌号")
private String carNo;

@ApiModelProperty("车架号")
private String carFrameNo;

@ApiModelProperty("购置时间")
private LocalDate buyTime;

}

+ 77
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleViolationEval.java View File

@@ -0,0 +1,77 @@
package com.ningdatech.carapi.analysis.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 车辆违章情况评估
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Data
@TableName("nd_vehicle_violation_eval")
@ApiModel(value = "VehicleViolationEval对象", description = "车辆违章情况评估")
public class VehicleViolationEval implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;

@ApiModelProperty("地区ID")
private Long regionId;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("创建人ID")
private Long createBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改人ID")
private Long updateBy;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("车辆ID")
private Long carId;

@ApiModelProperty("车牌号")
private String carNo;

@ApiModelProperty("车辆风险等级")
private Integer dangerLevel;

@ApiModelProperty("车架号")
private String carFrameNo;

@ApiModelProperty("行驶里程")
private Integer mileage;

@ApiModelProperty("累计违章次数")
private Integer violationCount;

@ApiModelProperty("万公里违章次数")
private Integer avgViolationCount;

@ApiModelProperty("备注")
private String remark;

}

+ 80
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisCar.java View File

@@ -0,0 +1,80 @@
package com.ningdatech.carapi.analysis.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 车辆综合预警分析
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
@Data
@TableName("nd_warn_analysis_car")
@ApiModel(value = "WarnAnalysisCar对象", description = "车辆综合预警分析")
public class WarnAnalysisCar implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;

@ApiModelProperty("地区ID")
private Long regionId;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("创建人ID")
private Long createBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改人ID")
private Long updateBy;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("受伤人数")
private Integer injuredCount;

@ApiModelProperty("死亡人数")
private Integer deadCount;

@ApiModelProperty("出现次数")
private Integer dangerCount;

@ApiModelProperty("车辆风险分值")
private Integer dangerScore;

@ApiModelProperty("车辆ID")
private Long carId;

@ApiModelProperty("车牌号")
private String carNo;

@ApiModelProperty("风险等级")
private Integer dangerLevel;

@ApiModelProperty("超速次数")
private Integer overSpeedCount;

@ApiModelProperty("违章次数")
private Integer violationCount;

}

+ 71
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisCompany.java View File

@@ -0,0 +1,71 @@
package com.ningdatech.carapi.analysis.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 企业综合预警分析
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
@Data
@TableName("nd_warn_analysis_company")
@ApiModel(value = "WarnAnalysisCompany对象", description = "企业综合预警分析")
public class WarnAnalysisCompany implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;

@ApiModelProperty("地区ID")
private Long regionId;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("综合得分")
private Integer totalScore;

@ApiModelProperty("违章次数")
private Integer violationCount;

@ApiModelProperty("出现次数")
private Integer dangerCount;

@ApiModelProperty("受伤人数")
private Integer injuredCount;

@ApiModelProperty("死亡人数")
private Integer deadCount;

@ApiModelProperty("风险等级")
private Integer dangerLevel;

@ApiModelProperty("创建人ID")
private Long createBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改人ID")
private Long updateBy;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

}

+ 79
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisDriver.java View File

@@ -0,0 +1,79 @@
package com.ningdatech.carapi.analysis.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* <p>
* 驾驶员综合预警分析
* </p>
*
* @author WendyYang
* @since 2022-11-01
*/
@Data
@TableName("nd_warn_analysis_driver")
@ApiModel(value = "WarnAnalysisDriver对象", description = "驾驶员综合预警分析")
public class WarnAnalysisDriver implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;

@ApiModelProperty("地区ID")
private Long regionId;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("创建人ID")
private Long createBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改人ID")
private Long updateBy;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("受伤人数")
private Integer injuredCount;

@ApiModelProperty("死亡人数")
private Integer deadCount;

@ApiModelProperty("出险次数")
private Integer dangerCount;

@ApiModelProperty("驾驶员风险分值")
private Integer dangerScore;

@ApiModelProperty("司机ID")
private Long driverId;

@ApiModelProperty("驾驶员姓名")
private String driverName;

@ApiModelProperty("风险等级")
private Integer dangerLevel;

@ApiModelProperty("超速次数")
private Integer overSpeedCount;

@ApiModelProperty("违章次数")
private Integer violationCount;

}

+ 22
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/CompanyWarnStatisticsDto.java View File

@@ -0,0 +1,22 @@
package com.ningdatech.carapi.analysis.entity.dto;

import lombok.Data;

/**
* <p>
* CompanyWarnStatisticsDto
* </p>
*
* @author WendyYang
* @since 16:18 2022/10/25
*/
@Data
public class CompanyWarnStatisticsDto {

private Integer count;

private Long regionId;

private Integer dangerLevel;

}

+ 64
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/OutDangerImportDto.java View File

@@ -0,0 +1,64 @@
package com.ningdatech.carapi.analysis.entity.dto;

import java.math.BigDecimal;

import lombok.Data;

/**
* @author CMM
* @description
* @since 2022/11/16 17:01
*/
@Data
public class OutDangerImportDto {
/**
* 序号
*/
private Integer id;

/**
* 所属区域
*/
private String regionName;

/**
* 车牌号
*/
private String carNo;

/**
* 保险公司
*/
private String insureCompany;

/**
* 企业名称
*/
private String companyName;


/**
* 事故地点
*/
private String accidentAddress;

/**
* 事故时间
*/
private String accidentTime;

/**
* 受伤人数
*/
private Integer injuries;

/**
* 死亡人数
*/
private Integer deathToll;

/**
* 理赔金额
*/
private BigDecimal compensateAmount;
}

+ 70
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleAccidentImportDto.java View File

@@ -0,0 +1,70 @@
package com.ningdatech.carapi.analysis.entity.dto;

import lombok.Data;

/**
* <p>
* VehicleAccidentImportDto
* </p>
*
* @author WendyYang
* @since 11:17 2022/10/17
*/
@Data
public class VehicleAccidentImportDto {

/**
* 序号
*/
private Integer id;

/**
* 城市
*/
private String city;

/**
* 区(县)
*/
private String zone;

/**
* 企业名称
*/
private String companyName;

/**
* 车牌号
*/
private String carNo;

/**
* 车架号
*/
private String chassisNumber;

/**
* 行驶里程
*/
private Integer mileage;

/**
* 累计出险次数
*/
private Integer accidentCount;

/**
* 万公里出险次数
*/
private Integer avgAccidentCount;

/**
* 风险评估
*/
private String riskEvaluation;

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

+ 70
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleOverSpeedImportDto.java View File

@@ -0,0 +1,70 @@
package com.ningdatech.carapi.analysis.entity.dto;

import lombok.Data;

/**
* <p>
* VehicleOverSpeedDto
* </p>
*
* @author WendyYang
* @since 11:17 2022/10/17
*/
@Data
public class VehicleOverSpeedImportDto {

/**
* 序号
*/
private Integer id;

/**
* 城市
*/
private String city;

/**
* 区(县)
*/
private String zone;

/**
* 企业名称
*/
private String companyName;

/**
* 车牌号
*/
private String carNo;

/**
* 车架号
*/
private String chassisNumber;

/**
* 行驶里程
*/
private Integer mileage;

/**
* 累计出险次数
*/
private Integer overSpeedCount;

/**
* 万公里出险次数
*/
private Integer avgOverSpeedCount;

/**
* 风险评估
*/
private String riskEvaluation;

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

+ 71
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleViolationImportDto.java View File

@@ -0,0 +1,71 @@
package com.ningdatech.carapi.analysis.entity.dto;

import lombok.Data;

/**
* <p>
* VehicleViolationImportDto
* </p>
*
* @author WendyYang
* @since 11:17 2022/10/17
*/
@Data
public class VehicleViolationImportDto {

/**
* 序号
*/
private Integer id;

/**
* 城市
*/
private String city;

/**
* 区(县)
*/
private String zone;

/**
* 企业名称
*/
private String companyName;

/**
* 车牌号
*/
private String carNo;

/**
* 车架号
*/
private String chassisNumber;

/**
* 行驶里程
*/
private Integer mileage;

/**
* 累计违章次数
*/
private Integer violationCount;

/**
* 万公里违章次数
*/
private Integer avgViolationCount;

/**
* 风险评估
*/
private String riskEvaluation;

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

}

+ 40
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/DangerLevel.java View File

@@ -0,0 +1,40 @@
package com.ningdatech.carapi.analysis.entity.enumeration;

import lombok.Getter;

import java.util.Arrays;

/**
* <p>
* DangerLevel
* </p>
*
* @author WendyYang
* @since 17:18 2022/10/25
*/
@Getter
public enum DangerLevel {
/**
* 预警
*/
RED(1, "红色预警"),
ORANGE(2, "橙色预警"),
YELLOW(3, "黄色预警"),
BLUE(4, "蓝色预警");

private final Integer code;
private final String name;

DangerLevel(Integer code, String name) {
this.code = code;
this.name = name;
}

public static DangerLevel getByCode(Integer code) {
return Arrays.stream(values())
.filter(w -> w.getCode().equals(code))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("预警级别编码无效"));
}

}

+ 43
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/IndustryStandardsType.java View File

@@ -0,0 +1,43 @@
package com.ningdatech.carapi.analysis.entity.enumeration;

import lombok.Getter;

/**
* <p>
* IndustryStandardsType
* </p>
*
* @author WendyYang
* @since 10:08 2022/10/15
*/
@Getter
public enum IndustryStandardsType {

/**
* 车属企业安全管理规范
*/
SAFETY_MANAGEMENT_SPECIFICATION(1),
/**
* 车辆安全设备规范
*/
SAFETY_EQUIPMENT_SPECIFICATION(2),
/**
* 车辆驾驶安全标准
*/
DRIVING_SAFETY_STANDARDS(3),
/**
* 安全生产管理人员标准
*/
STANDARDS_FOR_SAFETY_PRODUCTION_MANAGEMENT_PERSONNEL(4),
/**
* 驾驶员教育考核标准
*/
EVALUATION_CRITERIA_FOR_DRIVER_EDUCATION(5);

private final Integer code;

IndustryStandardsType(Integer code) {
this.code = code;
}

}

+ 31
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/InsuranceDangerLevel.java View File

@@ -0,0 +1,31 @@
package com.ningdatech.carapi.analysis.entity.enumeration;

import lombok.Getter;

/**
* <p>
* 保险风险评估-风险等级枚举
* </p>
*
* @author WendyYang
* @since 10:59 2022/11/2
*/
@Getter
public enum InsuranceDangerLevel {
/**
* 风险等级
*/
HIGH(1, "高级风险"),
HIGH_2ND(2, "次高及风险"),
MID(3, "中级风险"),
LOW(4, "低级风险");

private final Integer code;
private final String value;

InsuranceDangerLevel(Integer code, String value) {
this.code = code;
this.value = value;
}

}

+ 36
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/IndustryStandardsListReq.java View File

@@ -0,0 +1,36 @@
package com.ningdatech.carapi.analysis.entity.req;

import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

/**
* <p>
* IndustryStandardsListReq
* </p>
*
* @author WendyYang
* @since 10:25 2022/10/15
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class IndustryStandardsListReq extends PagePo {

@NotNull(message = "行业标准类型不能为空")
@ApiModelProperty("行业规范类型:1 车属企业安全管理规范、2 车辆安全设备规范、3 车辆驾驶安全标准、4 安全生产管理人员标准、5 驾驶员教育考核标准")
private Integer type;

@ApiModelProperty("文件名称")
private String fileName;

@ApiModelProperty("开始时间")
private LocalDateTime startTime;

@ApiModelProperty("结束时间")
private LocalDateTime endTime;

}

+ 34
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/IndustryStandardsSaveReq.java View File

@@ -0,0 +1,34 @@
package com.ningdatech.carapi.analysis.entity.req;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
* <p>
* 行业标准新增实体
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Data
@ApiModel(value = "行业标准新增实体")
public class IndustryStandardsSaveReq {

@ApiModelProperty("行业标准说明")
@NotBlank(message = "行业标准说明不能为空")
private String name;

@ApiModelProperty("标准类型")
@NotNull(message = "标准类型不能为空")
private Integer type;

@ApiModelProperty("文件ID")
@NotNull(message = "文件ID不能为空")
private Long fileId;

}

+ 27
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityManageGradeListReq.java View File

@@ -0,0 +1,27 @@
package com.ningdatech.carapi.analysis.entity.req;

import com.ningdatech.basic.model.PagePo;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
* <p>
* SecurityManagementGradeListReq
* </p>
*
* @author WendyYang
* @since 14:56 2022/10/13
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SecurityManageGradeListReq extends PagePo {

private Long regionId;

private Integer year;

private String securityLevel;

private String companyName;

}

+ 55
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityRiskEvalListReq.java View File

@@ -0,0 +1,55 @@
package com.ningdatech.carapi.analysis.entity.req;

import cn.hutool.core.util.StrUtil;
import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;

/**
* <p>
* SecurityRiskEvaluationListReq
* </p>
*
* @author WendyYang
* @since 09:27 2022/10/14
*/
@ApiModel("安全责任体系分析评估列表参数类")
@Data
@EqualsAndHashCode(callSuper = true)
public class SecurityRiskEvalListReq extends PagePo {

private Long regionId;

private Integer year;

@ApiModelProperty("总分值:格式为-XX,XX-XX,XX-")
private String scoreRange;

private String companyName;

private transient Pair<Integer, Integer> scoreRanges;

public void setScoreRange(String scoreRange) {
this.scoreRange = scoreRange;
this.setScoreRanges();
}

private void setScoreRanges() {
if (StringUtils.isNotBlank(this.scoreRange)) {
String[] scoreArray = StrUtil.strip(scoreRange, "-").split("-");
int indexOf = scoreRange.indexOf("-");
if (indexOf == scoreRange.length() - 1) {
scoreRanges = Pair.of(Integer.valueOf(scoreArray[0]), null);
} else if (indexOf == 0) {
scoreRanges = Pair.of(null, Integer.valueOf(scoreArray[0]));
} else {
scoreRanges = Pair.of(Integer.valueOf(scoreArray[0]), Integer.valueOf(scoreArray[1]));
}
}
}

}

+ 78
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityRiskEvalSaveReq.java View File

@@ -0,0 +1,78 @@
package com.ningdatech.carapi.analysis.entity.req;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

/**
* <p>
* 安全责任体系分析评估
* </p>
*
* @author LiuXinXin
* @since 2022-10-14
*/
@Data
@ApiModel("安全责任体系分析评估新增参数类")
public class SecurityRiskEvalSaveReq {

@ApiModelProperty("年度")
@NotNull(message = "考核年度不能为空")
private Integer year;

@ApiModelProperty("地区ID")
private Long regionId;

@ApiModelProperty("企业编码")
@NotNull(message = "企业编码不能为空")
private Long companyId;

@ApiModelProperty("企业名称")
@NotBlank(message = "企业名称不能为空")
private String companyName;

@ApiModelProperty("综合得分")
@NotNull(message = "综合得分不能为空")
private Integer totalScore;

@ApiModelProperty("安全承诺得分")
@NotNull(message = "安全承诺得分不能为空")
private Integer promiseScore;

@ApiModelProperty("安全责任得分")
@NotNull(message = "安全责任得分不能为空")
private Integer riskScore;

@ApiModelProperty("创建人ID")
private Long createBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改人ID")
private Long updateBy;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("检查地址")
private String checkAddress;

@ApiModelProperty("检查人")
private String checkUser;

@ApiModelProperty("检查部门")
private String checkDept;

@ApiModelProperty("检查内容")
@NotBlank(message = "检查内容不能为空")
private String checkContent;

@ApiModelProperty("备注")
private String remark;

}

+ 70
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecuritySystemBuildingEvalSaveReq.java View File

@@ -0,0 +1,70 @@
package com.ningdatech.carapi.analysis.entity.req;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

/**
* <p>
* 安全制度建设分析评估新增参数类
* </p>
*
* @author LiuXinXin
* @since 2022-10-14
*/
@Data
@ApiModel("安全制度建设分析评估新增参数类")
public class SecuritySystemBuildingEvalSaveReq {

@ApiModelProperty("年度")
@NotNull(message = "考核年度不能为空")
private Integer year;

@ApiModelProperty("地区ID")
private Long regionId;

@ApiModelProperty("企业编码")
@NotNull(message = "企业编码不能为空")
private Long companyId;

@ApiModelProperty("企业名称")
@NotBlank(message = "企业名称不能为空")
private String companyName;

@ApiModelProperty("综合得分")
@NotNull(message = "综合得分不能为空")
private Integer totalScore;

@ApiModelProperty("创建人ID")
private Long createBy;

@ApiModelProperty("创建时间")
private LocalDateTime createOn;

@ApiModelProperty("修改人ID")
private Long updateBy;

@ApiModelProperty("修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("检查地址")
private String checkAddress;

@ApiModelProperty("检查人")
private String checkUser;

@ApiModelProperty("检查部门")
private String checkDept;

@ApiModelProperty("检查内容")
@NotBlank(message = "检查内容不能为空")
private String checkContent;

@ApiModelProperty("备注")
private String remark;

}

+ 41
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleAccidentEvalModReq.java View File

@@ -0,0 +1,41 @@
package com.ningdatech.carapi.analysis.entity.req;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
* <p>
* 车辆出险情况修改参数
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Data
@ApiModel("车辆出险情况修改参数")
public class VehicleAccidentEvalModReq {

@ApiModelProperty("主键")
@NotNull(message = "id不能为空")
private Integer id;

@ApiModelProperty("车牌号")
@NotBlank(message = "车牌号不能为空")
private String carNo;

@ApiModelProperty("累计违章次数")
@NotNull(message = "累计违章次数不能为空")
private Integer accidentCount;

@ApiModelProperty("万公里出险次数")
@NotNull(message = "万公里出险次数不能为空")
private Integer avgAccidentCount;

@ApiModelProperty("备注")
private String remark;

}

+ 41
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleOverSpeedEvalModReq.java View File

@@ -0,0 +1,41 @@
package com.ningdatech.carapi.analysis.entity.req;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
* <p>
* 车辆超速情况修改参数
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Data
@ApiModel("车辆超速情况修改参数")
public class VehicleOverSpeedEvalModReq {

@ApiModelProperty("主键")
@NotNull(message = "id不能为空")
private Integer id;

@ApiModelProperty("车牌号")
@NotBlank(message = "车牌号不能为空")
private String carNo;

@ApiModelProperty("累计超速次数")
@NotNull(message = "累计超速次数不能为空")
private Integer overSpeedCount;

@ApiModelProperty("万公里超速次数")
@NotNull(message = "万公里超速次数不能为空")
private Integer avgOverSpeedCount;

@ApiModelProperty("备注")
private String remark;

}

+ 42
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleServiceLifeListReq.java View File

@@ -0,0 +1,42 @@
package com.ningdatech.carapi.analysis.entity.req;

import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDate;

/**
* <p>
* VehicleServiceLifeListReq
* </p>
*
* @author WendyYang
* @since 14:24 2022/10/15
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("车辆使用年限列表查询参数")
public class VehicleServiceLifeListReq extends PagePo {

@ApiModelProperty("车辆购置时间(开始)")
private LocalDate buyTimeStart;

@ApiModelProperty("车辆购置时间(结束)")
private LocalDate buyTimeEnd;

@ApiModelProperty("地域ID")
private Long regionId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("风险等级")
private Integer dangerLevel;

@ApiModelProperty("车牌号")
private String carNo;

}

+ 41
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleViolationEvalModReq.java View File

@@ -0,0 +1,41 @@
package com.ningdatech.carapi.analysis.entity.req;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
* <p>
* 车辆违章情况修改参数
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Data
@ApiModel("车辆违章情况修改参数")
public class VehicleViolationEvalModReq {

@ApiModelProperty("主键")
@NotNull(message = "id不能为空")
private Integer id;

@ApiModelProperty("车牌号")
@NotBlank(message = "车牌号不能为空")
private String carNo;

@ApiModelProperty("累计违章次数")
@NotNull(message = "累计违章次数不能为空")
private Integer violationCount;

@ApiModelProperty("万公里违章次数")
@NotNull(message = "万公里违章次数不能为空")
private Integer avgViolationCount;

@ApiModelProperty("备注")
private String remark;

}

+ 42
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/WarnAnalysisListReq.java View File

@@ -0,0 +1,42 @@
package com.ningdatech.carapi.analysis.entity.req;

import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
* <p>
* WarnAnalysisListReq
* </p>
*
* @author WendyYang
* @since 16:42 2022/10/14
*/
@Data
@ApiModel("预警分析列表查询参数")
@EqualsAndHashCode(callSuper = true)
public class WarnAnalysisListReq extends PagePo {

@ApiModelProperty("地域ID")
private Long regionId;
private List<Long> regionIds;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("风险等级")
private Integer dangerLevel;

@ApiModelProperty("车牌号")
private String carNo;

@ApiModelProperty("驾驶员姓名")
private String driverName;

private String dataScopeSql;

}

+ 39
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/CompanyWarnStatisticsVo.java View File

@@ -0,0 +1,39 @@
package com.ningdatech.carapi.analysis.entity.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.Tolerate;

/**
* <p>
* CompanyWarnStatisticsVo
* </p>
*
* @author WendyYang
* @since 17:04 2022/10/25
*/
@Data
@Builder
public class CompanyWarnStatisticsVo {

@Tolerate
public CompanyWarnStatisticsVo() {
}

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("企业地址")
private String companyAddress;

@ApiModelProperty("经度")
private String longitude;

@ApiModelProperty("纬度")
private String latitude;

@ApiModelProperty("风险等级")
private Integer dangerLevel;

}

+ 32
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/IndustryStandardsListVo.java View File

@@ -0,0 +1,32 @@
package com.ningdatech.carapi.analysis.entity.vo;

import lombok.Data;

import java.time.LocalDateTime;

/**
* <p>
* IndustryStandardsListVo
* </p>
*
* @author WendyYang
* @since 10:19 2022/10/15
*/
@Data
public class IndustryStandardsListVo {

private String name;

private LocalDateTime createOn;

private Integer downCount;

private Long fileId;

private Long id;
private Long regionId;
private String regionName;
private Long companyId;
private String companyName;

}

+ 40
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityManageGradeVo.java View File

@@ -0,0 +1,40 @@
package com.ningdatech.carapi.analysis.entity.vo;

import com.ningdatech.carapi.sys.entity.dto.RegionDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
* <p>
* 安全管理综合评级列表视图类
* </p>
*
* @author WendyYang
* @since 14:41 2022/10/13
*/
@Data
@ApiModel("安全管理综合评级列表视图类")
public class SecurityManageGradeVo {

@ApiModelProperty("所属地区")
private List<RegionDTO> regions;

@ApiModelProperty("年度")
private Integer year;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("安全评级")
private String securityLevel;

@ApiModelProperty("综合得分")
private Integer score;

}

+ 66
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityManageResultEvalListVo.java View File

@@ -0,0 +1,66 @@
package com.ningdatech.carapi.analysis.entity.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ningdatech.carapi.sys.entity.dto.RegionDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
* <p>
* 安全制度建设分析评估
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
@Data
@TableName("nd_security_manage_result_eval")
@ApiModel(value = "SecurityManageResultEval对象", description = "安全制度建设分析评估")
public class SecurityManageResultEvalListVo implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;

@ApiModelProperty("年度")
private Integer year;

@ApiModelProperty("地区")
private List<RegionDTO> regions;

@ApiModelProperty("企业ID")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("综合得分")
private Integer totalScore;

@ApiModelProperty("出险次数")
private Integer dangerCount;

@ApiModelProperty("出险扣分")
private Integer dangerScore;

@ApiModelProperty("死亡人数")
private Integer deadCount;

@ApiModelProperty("死亡扣分")
private Integer deadScore;

@ApiModelProperty("受伤人数")
private Integer injuredCount;

@ApiModelProperty("受伤扣分")
private Integer injuredScore;

}

+ 53
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityRiskEvalListVo.java View File

@@ -0,0 +1,53 @@
package com.ningdatech.carapi.analysis.entity.vo;

import com.ningdatech.carapi.sys.entity.dto.RegionDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.Tolerate;

import java.util.List;

/**
* <p>
* SecurityRiskEvaluationListVo
* </p>
*
* @author WendyYang
* @since 10:17 2022/10/14
*/
@Data
@Builder
@ApiModel("安全责任分析评估列表视图类")
public class SecurityRiskEvalListVo {

@Tolerate
public SecurityRiskEvalListVo() {
}

@ApiModelProperty("所属地区")
private List<RegionDTO> regions;

@ApiModelProperty("年度")
private Integer year;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("总分值")
private Integer totalScore;

@ApiModelProperty("安全责任得分")
private Integer riskScore;

@ApiModelProperty("安全承诺得分")
private Integer promiseScore;

@ApiModelProperty("检查内容")
private String checkContent;

}

+ 47
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecuritySystemBuildingEvalListVo.java View File

@@ -0,0 +1,47 @@
package com.ningdatech.carapi.analysis.entity.vo;

import com.ningdatech.carapi.sys.entity.dto.RegionDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.Tolerate;

import java.util.List;

/**
* <p>
* 安全制度建设分析评估列表视图类
* </p>
*
* @author WendyYang
* @since 10:17 2022/10/14
*/
@Data
@Builder
@ApiModel("安全制度建设分析评估列表视图类")
public class SecuritySystemBuildingEvalListVo {

@Tolerate
public SecuritySystemBuildingEvalListVo() {
}

@ApiModelProperty("所属地区")
private List<RegionDTO> regions;

@ApiModelProperty("年度")
private Integer year;

@ApiModelProperty("企业编码")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("总分值")
private Integer totalScore;

@ApiModelProperty("检查内容")
private String checkContent;

}

+ 55
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleAccidentEvalListVo.java View File

@@ -0,0 +1,55 @@
package com.ningdatech.carapi.analysis.entity.vo;

import com.ningdatech.carapi.sys.entity.dto.RegionDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
* <p>
* 车辆出险情况评估列表视图类
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Data
@ApiModel("车辆出险情况评估列表视图类")
public class VehicleAccidentEvalListVo {

@ApiModelProperty("主键")
private Integer id;

@ApiModelProperty("企业id")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("车牌号")
private String carNo;

@ApiModelProperty("车辆风险等级")
private Integer dangerLevel;

@ApiModelProperty("车辆风险等级名称")
private String dangerLevelName;

@ApiModelProperty("车架号")
private String carFrameNo;

@ApiModelProperty("行驶里程")
private Integer mileage;

@ApiModelProperty("累计出险次数")
private Integer accidentCount;

@ApiModelProperty("地域")
private List<RegionDTO> regions;

@ApiModelProperty("万公里出险次数")
private Integer avgAccidentCount;

}

+ 55
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleOverSpeedEvalListVo.java View File

@@ -0,0 +1,55 @@
package com.ningdatech.carapi.analysis.entity.vo;

import com.ningdatech.carapi.sys.entity.dto.RegionDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
* <p>
* 车辆超速情况评估列表视图类
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Data
@ApiModel("车辆超速情况评估列表视图类")
public class VehicleOverSpeedEvalListVo {

@ApiModelProperty("主键")
private Integer id;

@ApiModelProperty("企业id")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("车牌号")
private String carNo;

@ApiModelProperty("车辆风险等级")
private Integer dangerLevel;

@ApiModelProperty("车辆风险等级名称")
private String dangerLevelName;

@ApiModelProperty("车架号")
private String carFrameNo;

@ApiModelProperty("行驶里程")
private Integer mileage;

@ApiModelProperty("累计超速次数")
private Integer overSpeedCount;

@ApiModelProperty("地域")
private List<RegionDTO> regions;

@ApiModelProperty("万公里超速次数")
private Integer avgOverSpeedCount;

}

+ 60
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleServiceLifeListVo.java View File

@@ -0,0 +1,60 @@
package com.ningdatech.carapi.analysis.entity.vo;

import com.ningdatech.carapi.sys.entity.dto.RegionDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.Tolerate;

import java.time.LocalDate;
import java.util.List;

/**
* <p>
* 车辆使用年限列表视图类
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Data
@Builder
@ApiModel("车辆使用年限列表视图类")
public class VehicleServiceLifeListVo {

@Tolerate
public VehicleServiceLifeListVo() {
}

@ApiModelProperty("主键")
private Integer id;

@ApiModelProperty("地域信息")
private List<RegionDTO> regions;

@ApiModelProperty("企业")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("车辆风险等级")
private Integer dangerLevel;

@ApiModelProperty("车牌号")
private String carNo;

@ApiModelProperty("车架号")
private String carFrameNo;

@ApiModelProperty("购置时间")
private LocalDate buyTime;

@ApiModelProperty("车辆使用时间")
private Integer usedTime;

@ApiModelProperty("车辆使用年限占比(报废年限)")
private Integer usedTimePercent;

}

+ 59
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleViolationEvalListVo.java View File

@@ -0,0 +1,59 @@
package com.ningdatech.carapi.analysis.entity.vo;

import com.ningdatech.carapi.sys.entity.dto.RegionDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
* <p>
* 车辆违章情况评估列表视图类
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Data
@ApiModel("车辆违章情况评估列表视图类")
public class VehicleViolationEvalListVo {

@ApiModelProperty("主键")
private Integer id;

@ApiModelProperty("企业id")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("车牌号")
private String carNo;

@ApiModelProperty("车辆风险等级")
private Integer dangerLevel;

@ApiModelProperty("车辆风险等级名称")
private String dangerLevelName;

@ApiModelProperty("车架号")
private String carFrameNo;

@ApiModelProperty("行驶里程")
private Integer mileage;

@ApiModelProperty("累计违章次数")
private Integer violationCount;

@ApiModelProperty("地域")
private List<RegionDTO> regions;

@ApiModelProperty("万公里违章次数")
private Integer avgViolationCount;

@ApiModelProperty("备注")
private String remark;


}

+ 58
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByCarVo.java View File

@@ -0,0 +1,58 @@
package com.ningdatech.carapi.analysis.entity.vo;

import com.ningdatech.carapi.sys.entity.dto.RegionDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
* <p>
* 车辆综合预警分析
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
@Data
@ApiModel(value = "车辆综合预警分析列表视图类", description = "")
public class WarnAnalysisByCarVo {

@ApiModelProperty("主键")
private Integer id;

@ApiModelProperty("地区ID")
private List<RegionDTO> regions;

@ApiModelProperty("企业Id")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("受伤人数")
private Integer injuredCount;

@ApiModelProperty("死亡人数")
private Integer deadCount;

@ApiModelProperty("出险次数")
private Integer dangerCount;

@ApiModelProperty("车辆风险分值")
private Integer dangerScore;

@ApiModelProperty("车牌号")
private String carNo;

@ApiModelProperty("风险等级")
private Integer dangerLevel;

@ApiModelProperty("超速次数")
private Integer overSpeedCount;

@ApiModelProperty("违章次数")
private Integer violationCount;

}

+ 54
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByCompanyVo.java View File

@@ -0,0 +1,54 @@
package com.ningdatech.carapi.analysis.entity.vo;

import com.ningdatech.carapi.sys.entity.dto.RegionDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
* <p>
* 企业综合预警分析列表视图类
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
@Data
@ApiModel("企业综合预警分析列表视图类")
public class WarnAnalysisByCompanyVo {

@ApiModelProperty("主键")
private Integer id;

private List<RegionDTO> regions;

@ApiModelProperty("企业id")
private String companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("综合得分")
private Integer totalScore;

@ApiModelProperty("违章次数")
private Integer violationCount;

@ApiModelProperty("出险次数")
private Integer dangerCount;

@ApiModelProperty("受伤人数")
private Integer injuredCount;

@ApiModelProperty("死亡人数")
private Integer deadCount;

@ApiModelProperty("风险等级")
private Integer dangerLevel;

@ApiModelProperty("车辆数")
private Integer carCount;

}

+ 59
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByDriverVo.java View File

@@ -0,0 +1,59 @@
package com.ningdatech.carapi.analysis.entity.vo;

import com.ningdatech.carapi.sys.entity.dto.RegionDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
* <p>
* 驾驶员综合预警分析列表视图类
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
@Data
@ApiModel("驾驶员综合预警分析列表视图类")
public class WarnAnalysisByDriverVo {


@ApiModelProperty("主键")
private Integer id;

@ApiModelProperty("地区ID")
private List<RegionDTO> regions;

@ApiModelProperty("企业id")
private Long companyId;

@ApiModelProperty("企业名称")
private String companyName;

@ApiModelProperty("受伤人数")
private Integer injuredCount;

@ApiModelProperty("死亡人数")
private Integer deadCount;

@ApiModelProperty("出险次数")
private Integer dangerCount;

@ApiModelProperty("车辆风险分值")
private Integer dangerScore;

@ApiModelProperty("驾驶员姓名")
private String driverName;

@ApiModelProperty("风险等级")
private Integer dangerLevel;

@ApiModelProperty("超速次数")
private Integer overSpeedCount;

@ApiModelProperty("违章次数")
private Integer violationCount;

}

+ 190
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/AnalysisEvalDataViewManage.java View File

@@ -0,0 +1,190 @@
package com.ningdatech.carapi.analysis.manage;

import cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.carapi.analysis.entity.WarnAnalysisCar;
import com.ningdatech.carapi.analysis.entity.WarnAnalysisCompany;
import com.ningdatech.carapi.analysis.entity.vo.CompanyWarnStatisticsVo;
import com.ningdatech.carapi.analysis.service.IWarnAnalysisCarService;
import com.ningdatech.carapi.analysis.service.IWarnAnalysisCompanyService;
import com.ningdatech.carapi.common.model.DataChartVo;
import com.ningdatech.carapi.common.model.MapDataVO;
import com.ningdatech.carapi.safe.entity.NdInsureInfo;
import com.ningdatech.carapi.safe.service.INdInsureInfoService;
import com.ningdatech.carapi.sys.entity.dto.CompanyDTO;
import com.ningdatech.carapi.sys.entity.dto.RegionDTO;
import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper;
import com.ningdatech.carapi.sys.helper.RegionsCacheHelper;
import com.ningdatech.carapi.sys.service.CompanyService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;

/**
* <p>
* DataViewController
* </p>
*
* @author WendyYang
* @since 15:34 2022/10/25
*/
@Component
@AllArgsConstructor
public class AnalysisEvalDataViewManage {

private final INdInsureInfoService insureInfoService;
private final IWarnAnalysisCompanyService companyWarnAnalysisService;
private final IWarnAnalysisCarService carWarnAnalysisService;

private final RegionsCacheHelper regionsCacheHelper;
private final CompaniesCacheHelper companiesCacheHelper;
private final CompanyService companyService;

public List<DataChartVo> insuranceOrgStatistics(Long regionId) {
List<Long> childIds = regionsCacheHelper.listChildRegionId(regionId);
QueryWrapper<NdInsureInfo> query = Wrappers.query();
query.select("count(distinct car_plate) as `count`, insure_company as groupKey");
query.in("region_id", childIds);
query.groupBy("insure_company");
List<Map<String, Object>> maps = insureInfoService.listMaps(query);
if (maps.isEmpty()) {
return Collections.emptyList();
}
int total = CollUtils.sum(maps, w -> Long.valueOf(w.get("count").toString()).intValue());
return maps.stream().map(w -> {
DataChartVo vo = new DataChartVo();
vo.setLabel(w.get("groupKey").toString());
vo.setValue(Long.valueOf(w.get("count").toString()).intValue());
String percent = BigDecimal.valueOf(vo.getValue() * 100)
.divide(BigDecimal.valueOf(total), 2, RoundingMode.HALF_UP)
.stripTrailingZeros().toPlainString();
vo.setPercent(percent);
return vo;
}).collect(Collectors.toList());
}

public List<CompanyWarnStatisticsVo> companyWarnStatistics(Long regionId) {
List<Long> regionIds = regionsCacheHelper.listChildRegionId(regionId);
QueryWrapper<WarnAnalysisCompany> query = Wrappers.query();
query.select("company_id companyId, danger_level dangerLevel");
query.in("region_id", regionIds);
List<Map<String, Object>> analysisCompanies = companyWarnAnalysisService.listMaps(query);
if (analysisCompanies.size() == 0) {
return Collections.emptyList();
}
List<CompanyWarnStatisticsVo> result = new ArrayList<>();
analysisCompanies.forEach(w -> {
CompanyDTO company = companiesCacheHelper.getById(MapUtil.getLong(w, "companyId"));
if (Objects.isNull(company)) {
return;
}
CompanyWarnStatisticsVo vo = CompanyWarnStatisticsVo.builder()
.companyAddress(company.getAddress())
.companyName(company.getName())
.dangerLevel(MapUtil.getInt(w, "dangerLevel"))
.longitude(company.getLongitude())
.latitude(company.getLatitude())
.build();
result.add(vo);
});
return result;
}

public List<MapDataVO> carWarnStatistics(Long regionId) {
List<Long> regionIds = regionsCacheHelper.listChildRegionId(regionId);
QueryWrapper<WarnAnalysisCar> query = Wrappers.query();
query.select("count(1) `count`, region_id regionId");
query.in("region_id", regionIds);
query.groupBy("region_id");
List<Map<String, Object>> carAnalysis = carWarnAnalysisService.listMaps(query);
if (carAnalysis.size() == 0) {
return Collections.emptyList();
}
Map<RegionDTO, List<Long>> childrenMap = regionsCacheHelper.getChildrenMap(regionId, true);
List<MapDataVO> result = new ArrayList<>();
childrenMap.forEach((k, v) -> {
MapDataVO mapData = MapDataVO.builder()
.regionName(k.getRegionName())
.regionCode(k.getRegionCode())
.regionId(k.getId())
.value(0)
.build();
carAnalysis.removeIf(w -> {
Long currRegionId = MapUtil.getLong(w, "regionId");
if (v.contains(currRegionId)) {
mapData.setValue(MapUtil.getInt(w, "count") + mapData.getValue());
return true;
}
return false;
});
result.add(mapData);
});
return result;
}

private <T> QueryWrapper<T> buildCountQueryGroupByRegion(List<Long> regionIds, Integer dangerLevel) {
QueryWrapper<T> query = Wrappers.query();
query.select("count(1) as `count`, region_id as regionId");
query.in("region_id", regionIds);
query.eq("danger_level", dangerLevel);
query.groupBy("region_id");
return query;
}

public List<DataChartVo> companyWarnStatisticsByLevel(Long regionId, Integer dangerLevel) {
List<DataChartVo> result = new ArrayList<>();
List<Long> regionIds = regionsCacheHelper.listChildRegionId(regionId);
QueryWrapper<WarnAnalysisCompany> query = buildCountQueryGroupByRegion(regionIds, dangerLevel);
List<Map<String, Object>> analysisCompanies = companyWarnAnalysisService.listMaps(query);
Map<RegionDTO, List<Long>> childrenMap = regionsCacheHelper.getChildrenMap(regionId, true);
// 如果是区县一级的,只返回区县一级的名字和数量
if (childrenMap.size() == 0) {
RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId);
String regionName = regionDto.getRegionName();
DataChartVo vo = new DataChartVo(regionName, 0);
analysisCompanies.forEach(w -> {
vo.setValue(vo.getValue() + MapUtil.getInt(w, "count"));
});
result.add(vo);
return result;
} else {
childrenMap.forEach((k, v) -> {
DataChartVo vo = new DataChartVo(k.getRegionName(), 0);
analysisCompanies.forEach(w -> {
Long currRegionId = MapUtil.getLong(w, "regionId");
if (v.contains(currRegionId)) {
vo.setValue(vo.getValue() + MapUtil.getInt(w, "count"));
}
});
result.add(vo);
});
return result;
}
}

public List<DataChartVo> carWarnStatisticsByLevel(Long regionId, Integer dangerLevel) {
List<DataChartVo> result = new ArrayList<>();
List<Long> regionIds = regionsCacheHelper.listChildRegionId(regionId);
QueryWrapper<WarnAnalysisCar> query = buildCountQueryGroupByRegion(regionIds, dangerLevel);
List<Map<String, Object>> analysisCompanies = carWarnAnalysisService.listMaps(query);
Map<RegionDTO, List<Long>> childrenMap = regionsCacheHelper.getChildrenMap(regionId, true);
childrenMap.forEach((k, v) -> {
DataChartVo vo = new DataChartVo(k.getRegionName(), 0);
analysisCompanies.forEach(w -> {
Long currRegionId = MapUtil.getLong(w, "regionId");
if (v.contains(currRegionId)) {
vo.setValue(vo.getValue() + MapUtil.getInt(w, "count"));
}
});
result.add(vo);
});
return result;
}

}

+ 132
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/IndustryStandardsManage.java View File

@@ -0,0 +1,132 @@
package com.ningdatech.carapi.analysis.manage;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

import org.springframework.aop.framework.AopContext;
import org.springframework.stereotype.Component;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.carapi.analysis.entity.IndustryStandards;
import com.ningdatech.carapi.analysis.entity.req.IndustryStandardsListReq;
import com.ningdatech.carapi.analysis.entity.req.IndustryStandardsSaveReq;
import com.ningdatech.carapi.analysis.entity.vo.IndustryStandardsListVo;
import com.ningdatech.carapi.analysis.service.IIndustryStandardsService;
import com.ningdatech.carapi.common.constant.UserRoleTypeEnum;
import com.ningdatech.carapi.common.contants.DefValConstants;
import com.ningdatech.carapi.common.util.CodeUtil;
import com.ningdatech.carapi.datascope.aop.LambdaDataScope;
import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum;
import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.carapi.user.util.LoginUserUtil;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;

/**
* <p>
* IndustryStandardsManage
* </p>
*
* @author WendyYang
* @since 10:24 2022/10/15
*/
@Component
@RequiredArgsConstructor
public class IndustryStandardsManage {

private final IIndustryStandardsService industryStandardsService;

public PageVo<IndustryStandardsListVo> list(IndustryStandardsListReq req) {
Integer pageNumber = req.getPageNumber();
Integer pageSize = req.getPageSize();

UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail();
Long roleId = userInfoDetails.getRoleId();

LambdaQueryWrapper<IndustryStandards> query = Wrappers.lambdaQuery(IndustryStandards.class);
IndustryStandardsManage context = (IndustryStandardsManage) AopContext.currentProxy();
context.buildQuery(query,req);

List<IndustryStandards> standardsList = industryStandardsService.list(query);
// 省级部门上传的文件(上传企业所属区域为省级),按照文件类型,下级账号也要能看到
if (!UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId)) {
List<IndustryStandards> standards = industryStandardsService.list(Wrappers.lambdaQuery(IndustryStandards.class)
.eq(IndustryStandards::getRegionId, DefValConstants.ZJREGION_ID)
.eq(IndustryStandards::getType,req.getType()));
standardsList.addAll(standards);
}

if (CollUtil.isEmpty(standardsList)){
return PageVo.empty();
}

List<IndustryStandards> records = standardsList.stream()
.skip((long) (pageNumber - 1) * pageSize)
.limit(pageSize)
.collect(Collectors.toList());

//Page<IndustryStandards> page = industryStandardsService.page(req.page(), query);

List<IndustryStandardsListVo> data = CollUtils.convert(records, w -> {
IndustryStandardsListVo vo = BeanUtil.copyProperties(w, IndustryStandardsListVo.class);
CodeUtil.searchCompanyNameAndRegionName(vo);
return vo;
});
return PageVo.of(data, standardsList.size());
}
@LambdaDataScope
public void buildQuery(LambdaQueryWrapper<IndustryStandards> query,IndustryStandardsListReq req) {
query.orderByDesc(IndustryStandards::getId).eq(IndustryStandards::getType, req.getType())
.like(StrUtil.isNotBlank(req.getFileName()), IndustryStandards::getName, req.getFileName())
.ge(req.getStartTime() != null, IndustryStandards::getCreateOn, req.getStartTime())
.le(req.getEndTime() != null, IndustryStandards::getCreateOn, req.getEndTime());
}

public void save(IndustryStandardsSaveReq req) {
IndustryStandards industryStandards = BeanUtil.copyProperties(req, IndustryStandards.class);
industryStandards.setCreateBy(LoginUserUtil.getUserId());
industryStandards.setCreateOn(LocalDateTime.now());
industryStandards.setRegionId(LoginUserUtil.loginUserDetail().getRegionId());
industryStandards.setCompanyId(LoginUserUtil.loginUserDetail().getCompanyId());
industryStandardsService.save(industryStandards);
}

public void incrementDownCount(Long id) {
industryStandardsService.incrementDownCount(id);
}

public void deleteStandardFile(Long id, Long roleId) {

LambdaQueryWrapper<IndustryStandards> wrapper = Wrappers.lambdaQuery(IndustryStandards.class);
IndustryStandardsManage context = (IndustryStandardsManage) AopContext.currentProxy();
context.buildStandardFileQuery(wrapper, id);
IndustryStandards standards = industryStandardsService.getOne(wrapper);
if (Objects.isNull(standards)){
throw new BizException("文件无法删除!");
}
// IndustryStandards standards = industryStandardsService.getById(id);
// 如果文件是省级部门上传的文件,只有省级管理员角色可以删除
Long regionId = standards.getRegionId();
if (Objects.nonNull(regionId) &&
DefValConstants.ZJREGION_ID.equals(regionId)){
// 判断登录用户角色是否为省管理员
if (!UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId)){
throw new BizException("您没有权限删除该文件!");
}
}
industryStandardsService.deleteById(id);
}
@LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL)
public void buildStandardFileQuery(LambdaQueryWrapper<IndustryStandards> wrapper, Long id) {
wrapper.eq(IndustryStandards::getId,id);
}
}

+ 568
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/InsuranceRiskEvalManage.java View File

@@ -0,0 +1,568 @@
package com.ningdatech.carapi.analysis.manage;

import java.io.IOException;
import java.io.InputStream;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;

import org.apache.commons.collections4.CollectionUtils;
import org.springframework.aop.framework.AopContext;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.carapi.analysis.common.DangerLevelEnum;
import com.ningdatech.carapi.analysis.entity.VehicleAccidentEval;
import com.ningdatech.carapi.analysis.entity.VehicleOverSpeedEval;
import com.ningdatech.carapi.analysis.entity.VehicleServiceLife;
import com.ningdatech.carapi.analysis.entity.VehicleViolationEval;
import com.ningdatech.carapi.analysis.entity.dto.OutDangerImportDto;
import com.ningdatech.carapi.analysis.entity.dto.VehicleAccidentImportDto;
import com.ningdatech.carapi.analysis.entity.dto.VehicleOverSpeedImportDto;
import com.ningdatech.carapi.analysis.entity.dto.VehicleViolationImportDto;
import com.ningdatech.carapi.analysis.entity.req.VehicleAccidentEvalModReq;
import com.ningdatech.carapi.analysis.entity.req.VehicleOverSpeedEvalModReq;
import com.ningdatech.carapi.analysis.entity.req.VehicleServiceLifeListReq;
import com.ningdatech.carapi.analysis.entity.req.VehicleViolationEvalModReq;
import com.ningdatech.carapi.analysis.entity.vo.VehicleAccidentEvalListVo;
import com.ningdatech.carapi.analysis.entity.vo.VehicleOverSpeedEvalListVo;
import com.ningdatech.carapi.analysis.entity.vo.VehicleServiceLifeListVo;
import com.ningdatech.carapi.analysis.entity.vo.VehicleViolationEvalListVo;
import com.ningdatech.carapi.analysis.service.IVehicleAccidentEvalService;
import com.ningdatech.carapi.analysis.service.IVehicleOverSpeedEvalService;
import com.ningdatech.carapi.analysis.service.IVehicleServiceLifeService;
import com.ningdatech.carapi.analysis.service.IVehicleViolationEvalService;
import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo;
import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService;
import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper;
import com.ningdatech.carapi.common.util.CodeUtil;
import com.ningdatech.carapi.datascope.aop.LambdaDataScope;
import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum;
import com.ningdatech.carapi.safe.entity.NdInsureInfo;
import com.ningdatech.carapi.safe.entity.NdInsureOutDanger;
import com.ningdatech.carapi.safe.service.INdInsureInfoService;
import com.ningdatech.carapi.safe.service.INdInsureOutDangerService;
import com.ningdatech.carapi.safe.service.IVehicleAccidentReportService;
import com.ningdatech.carapi.scheduler.enums.DataTypeEnum;
import com.ningdatech.carapi.sys.entity.Company;
import com.ningdatech.carapi.sys.entity.constant.ImportTemplateConstant;
import com.ningdatech.carapi.sys.entity.enumeration.ImportTemplateEnum;
import com.ningdatech.carapi.sys.helper.RegionsCacheHelper;
import com.ningdatech.carapi.sys.service.CompanyService;
import com.ningdatech.carapi.user.util.LoginUserUtil;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
* <p>
* InsuranceRiskEvalManage
* </p>
*
* @author WendyYang
* @since 14:31 2022/10/15
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class InsuranceRiskEvalManage {

private final IVehicleServiceLifeService vehicleServiceLifeService;
private final IVehicleViolationEvalService vehicleViolationEvalService;
private final IVehicleOverSpeedEvalService vehicleOverSpeedEvalService;
private final IVehicleAccidentEvalService vehicleAccidentEvalService;
private final INdInsureOutDangerService ndInsureOutDangerService;
private final RegionsCacheHelper regionsCacheHelper;
private final IVehicleBaseInfoService vehicleBaseInfoService;
private final CompanyService companyService;
private final INdInsureInfoService insureInfoService;

private final ApplicationContext applicationContext;

private final IVehicleAccidentReportService vehicleAccidentReportService;

/**
* 车辆使用年限列表
*/
public PageVo<VehicleServiceLifeListVo> vehicleServiceLifeList(VehicleServiceLifeListReq req) {
LambdaQueryWrapper<VehicleServiceLife> query = Wrappers.lambdaQuery(VehicleServiceLife.class);
InsuranceRiskEvalManage context = (InsuranceRiskEvalManage) AopContext.currentProxy();
context.buildVehicleServiceLife(query,req);
Page<VehicleServiceLife> page = vehicleServiceLifeService.page(req.page(), query);
List<VehicleServiceLifeListVo> res = page.getRecords().stream().map(w -> {
VehicleServiceLifeListVo vo = BeanUtil.copyProperties(w,VehicleServiceLifeListVo.class);
vo.setRegions(regionsCacheHelper.listParents(w.getRegionId()));
int usedTime = Optional.ofNullable(w.getBuyTime())
.flatMap(time -> Optional.ofNullable((int) ChronoUnit.YEARS.between(time, LocalDate.now())))
.orElse(0);
vo.setUsedTime(usedTime);
// TODO 车辆使用年限百分比
vo.setUsedTimePercent(0);
CodeUtil.searchCompanyName(vo);
return vo;
}).collect(Collectors.toList());
return PageVo.of(res, page.getTotal());
}
@LambdaDataScope
@BuildChildrenRegionWrapper
public void buildVehicleServiceLife(LambdaQueryWrapper<VehicleServiceLife> query,VehicleServiceLifeListReq req) {
query.ge(req.getBuyTimeStart() != null, VehicleServiceLife::getBuyTime, req.getBuyTimeStart())
.le(req.getBuyTimeEnd() != null, VehicleServiceLife::getBuyTime, req.getBuyTimeEnd())
.like(StrUtil.isNotBlank(req.getCompanyName()), VehicleServiceLife::getCompanyName, req.getCompanyName())
.like(StrUtil.isNotBlank(req.getCarNo()), VehicleServiceLife::getCarNo, req.getCarNo())
.eq(Objects.nonNull(req.getDangerLevel()), VehicleServiceLife::getDangerLevel, req.getDangerLevel());
}

/**
* 车辆违章情况列表
*
*/
public PageVo<VehicleViolationEvalListVo> vehicleViolationEvalList(VehicleServiceLifeListReq req) {
LambdaQueryWrapper<VehicleViolationEval> query = Wrappers.lambdaQuery(VehicleViolationEval.class);
InsuranceRiskEvalManage context = (InsuranceRiskEvalManage) AopContext.currentProxy();
context.buildVehicleViolationEvalQuery(query,req);
buildVehicleViolationEvalQuery(query,req);
Page<VehicleViolationEval> page = vehicleViolationEvalService.page(req.page(), query);
List<VehicleViolationEvalListVo> res = page.getRecords().stream().map(w -> {
VehicleViolationEvalListVo vo = BeanUtil.copyProperties(w,VehicleViolationEvalListVo.class);
vo.setRegions(regionsCacheHelper.listParents(w.getRegionId()));
vo.setDangerLevelName(DangerLevelEnum.getDescByCode(w.getDangerLevel()));
CodeUtil.searchCompanyName(vo);
return vo;
}).collect(Collectors.toList());
return PageVo.of(res, page.getTotal());
}
@LambdaDataScope
@BuildChildrenRegionWrapper
public void buildVehicleViolationEvalQuery(LambdaQueryWrapper<VehicleViolationEval> query,VehicleServiceLifeListReq req) {
query.like(StrUtil.isNotBlank(req.getCompanyName()),VehicleViolationEval::getCompanyName, req.getCompanyName())
.like(StrUtil.isNotBlank(req.getCarNo()),VehicleViolationEval::getCarNo, req.getCarNo())
.eq(Objects.nonNull(req.getDangerLevel()),VehicleViolationEval::getDangerLevel, req.getDangerLevel());
}

/**
* 车辆出险情况列表
*/
public PageVo<VehicleAccidentEvalListVo> vehicleAccidentList(VehicleServiceLifeListReq req) {
LambdaQueryWrapper<VehicleAccidentEval> query = Wrappers.lambdaQuery(VehicleAccidentEval.class);
InsuranceRiskEvalManage context = (InsuranceRiskEvalManage) AopContext.currentProxy();
context.buildVehicleAccident(query,req);
Page<VehicleAccidentEval> page = vehicleAccidentEvalService.page(req.page(), query);
List<VehicleAccidentEvalListVo> res = page.getRecords().stream().map(w -> {
VehicleAccidentEvalListVo vo = BeanUtil.copyProperties(w,VehicleAccidentEvalListVo.class);
vo.setRegions(regionsCacheHelper.listParents(w.getRegionId()));
vo.setDangerLevelName(DangerLevelEnum.getDescByCode(w.getDangerLevel()));
CodeUtil.searchCompanyName(vo);
return vo;
}).collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}

@LambdaDataScope
@BuildChildrenRegionWrapper
public void buildVehicleAccident(LambdaQueryWrapper<VehicleAccidentEval> query,VehicleServiceLifeListReq req) {
query.like(StrUtil.isNotBlank(req.getCompanyName()), VehicleAccidentEval::getCompanyName, req.getCompanyName())
.like(StrUtil.isNotBlank(req.getCarNo()), VehicleAccidentEval::getCarNo, req.getCarNo())
.eq(Objects.nonNull(req.getDangerLevel()), VehicleAccidentEval::getDangerLevel, req.getDangerLevel());
}

/**
* 车辆超速情况列表
*/
public PageVo<VehicleOverSpeedEvalListVo> vehicleOverSpeedList(VehicleServiceLifeListReq req) {
LambdaQueryWrapper<VehicleOverSpeedEval> query = Wrappers.lambdaQuery(VehicleOverSpeedEval.class);
InsuranceRiskEvalManage context = (InsuranceRiskEvalManage) AopContext.currentProxy();
context.buildVehicleOverSpeed(query,req);
Page<VehicleOverSpeedEval> page = vehicleOverSpeedEvalService.page(req.page(), query);
List<VehicleOverSpeedEvalListVo> res = page.getRecords().stream().map(w -> {
VehicleOverSpeedEvalListVo vo = BeanUtil.copyProperties(w,VehicleOverSpeedEvalListVo.class);
vo.setRegions(regionsCacheHelper.listParents(w.getRegionId()));
vo.setDangerLevelName(DangerLevelEnum.getDescByCode(w.getDangerLevel()));
CodeUtil.searchCompanyName(vo);
return vo;
}).collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}
@LambdaDataScope
@BuildChildrenRegionWrapper
public void buildVehicleOverSpeed(LambdaQueryWrapper<VehicleOverSpeedEval> query,VehicleServiceLifeListReq req) {
query.like(StrUtil.isNotBlank(req.getCompanyName()), VehicleOverSpeedEval::getCompanyName, req.getCompanyName())
.like(StrUtil.isNotBlank(req.getCarNo()), VehicleOverSpeedEval::getCarNo, req.getCarNo())
.eq(Objects.nonNull(req.getDangerLevel()), VehicleOverSpeedEval::getDangerLevel, req.getDangerLevel());
}

public void vehicleViolationEvalMod(VehicleViolationEvalModReq req) {
VehicleViolationEval violationEval = BeanUtil.copyProperties(req, VehicleViolationEval.class);
violationEval.setRemark(StrUtil.nullToEmpty(violationEval.getRemark()));
violationEval.setUpdateBy(LoginUserUtil.getUserId());
violationEval.setUpdateOn(LocalDateTime.now());
boolean update = vehicleViolationEvalService.updateById(violationEval);
Assert.isTrue(update, "记录不存在");
}

public void vehicleAccidentEvalMod(VehicleAccidentEvalModReq req) {
VehicleAccidentEval accidentEval = BeanUtil.copyProperties(req, VehicleAccidentEval.class);
accidentEval.setRemark(StrUtil.nullToEmpty(accidentEval.getRemark()));
accidentEval.setUpdateBy(LoginUserUtil.getUserId());
accidentEval.setUpdateOn(LocalDateTime.now());
boolean update = vehicleAccidentEvalService.updateById(accidentEval);
Assert.isTrue(update, "记录不存在");
}

public void vehicleOverSpeedEvalMod(VehicleOverSpeedEvalModReq req) {
VehicleOverSpeedEval overSpeedEval = BeanUtil.copyProperties(req, VehicleOverSpeedEval.class);
overSpeedEval.setRemark(StrUtil.nullToEmpty(overSpeedEval.getRemark()));
overSpeedEval.setUpdateBy(LoginUserUtil.getUserId());
overSpeedEval.setUpdateOn(LocalDateTime.now());
boolean update = vehicleOverSpeedEvalService.updateById(overSpeedEval);
Assert.isTrue(update, "记录不存在");
}

public void vehicleViolationEvalDel(Integer id) {
LambdaQueryWrapper<VehicleViolationEval> wrapper = Wrappers.lambdaQuery(VehicleViolationEval.class);
InsuranceRiskEvalManage context = (InsuranceRiskEvalManage) AopContext.currentProxy();
context.buildQuery(wrapper, id);
VehicleViolationEval violationEval = vehicleViolationEvalService.getOne(wrapper);
if (Objects.isNull(violationEval)){
throw new BizException("文件无法删除!");
}
vehicleViolationEvalService.removeById(id);
}

@LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL)
public void buildQuery(LambdaQueryWrapper<VehicleViolationEval> wrapper, Integer id) {
wrapper.eq(VehicleViolationEval::getId,id);
}

public void vehicleAccidentEvalDel(Integer id) {
LambdaQueryWrapper<VehicleAccidentEval> wrapper = Wrappers.lambdaQuery(VehicleAccidentEval.class);
InsuranceRiskEvalManage context = (InsuranceRiskEvalManage) AopContext.currentProxy();
context.buildAccidentEvalQuery(wrapper, id);
VehicleAccidentEval accidentEval = vehicleAccidentEvalService.getOne(wrapper);
if (Objects.isNull(accidentEval)){
throw new BizException("文件无法删除!");
}
vehicleAccidentEvalService.removeById(id);
}

@LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL)
public void buildAccidentEvalQuery(LambdaQueryWrapper<VehicleAccidentEval> wrapper, Integer id) {
wrapper.eq(VehicleAccidentEval::getId,id);
}

public void vehicleOverSpeedEvalDel(Integer id) {
LambdaQueryWrapper<VehicleOverSpeedEval> wrapper = Wrappers.lambdaQuery(VehicleOverSpeedEval.class);
InsuranceRiskEvalManage context = (InsuranceRiskEvalManage) AopContext.currentProxy();
context.buildStandardFileQuery(wrapper, id);
VehicleOverSpeedEval overSpeedEval = vehicleOverSpeedEvalService.getOne(wrapper);
if (Objects.isNull(overSpeedEval)){
throw new BizException("文件无法删除!");
}
vehicleOverSpeedEvalService.removeById(id);
}
@LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL)
public void buildStandardFileQuery(LambdaQueryWrapper<VehicleOverSpeedEval> wrapper, Integer id) {
wrapper.eq(VehicleOverSpeedEval::getId,id);
}

private void importVehicleViolationData(List<VehicleViolationImportDto> importDataList) {
if (CollectionUtils.isEmpty(importDataList)) {
return;
}
List<VehicleViolationEval> violationEvalList = new ArrayList<>();
List<String> carNos = CollUtils.fieldList(importDataList, VehicleViolationImportDto::getCarNo);
Assert.isTrue(carNos.size() == importDataList.size(), "车牌号不可重复");
Map<String, NdVehicleBaseInfo> carInfoMap = vehicleBaseInfoService.listByCarNo(carNos);
Assert.isTrue(carNos.size() == carInfoMap.size(), "请确保所有车牌号存在");
List<Long> companyIds = CollUtils.fieldList(carInfoMap.values(), NdVehicleBaseInfo::getCompanyId);
Map<Long, Company> companyMap = companyService.listCompanyByIds(companyIds);
Long userId = LoginUserUtil.getUserId();
LocalDateTime now = LocalDateTime.now();
importDataList.forEach(w -> {
VehicleViolationEval eval = new VehicleViolationEval();
eval.setCreateBy(userId);
eval.setCreateOn(now);
eval.setUpdateBy(userId);
eval.setUpdateOn(now);
eval.setViolationCount(w.getViolationCount());
eval.setRemark(w.getRemark());
eval.setAvgViolationCount(w.getAvgViolationCount());
eval.setCarNo(w.getCarNo());
eval.setMileage(w.getMileage());
NdVehicleBaseInfo carInfo = carInfoMap.get(w.getCarNo());
eval.setCarId(carInfo.getId());
eval.setCompanyId(carInfo.getCompanyId());
Company company = companyMap.get(eval.getCompanyId());
eval.setCompanyName(company.getName());
eval.setRegionId(company.getRegionId());
eval.setCarFrameNo(w.getChassisNumber());
eval.setDangerLevel(DangerLevelEnum.getCodeByDesc(w.getRiskEvaluation()));
violationEvalList.add(eval);
});
LambdaQueryWrapper<VehicleViolationEval> delQuery = Wrappers.lambdaQuery(VehicleViolationEval.class)
.in(VehicleViolationEval::getCarNo, carNos);
vehicleViolationEvalService.remove(delQuery);
vehicleViolationEvalService.saveBatch(violationEvalList);
}

private void importVehicleOverSpeedData(List<VehicleOverSpeedImportDto> importDataList) {
if (CollectionUtils.isEmpty(importDataList)) {
return;
}
List<String> carNos = CollUtils.fieldList(importDataList, VehicleOverSpeedImportDto::getCarNo);
Assert.isTrue(carNos.size() == importDataList.size(), "车牌号不可重复");
Map<String, NdVehicleBaseInfo> carInfoMap = vehicleBaseInfoService.listByCarNo(carNos);
Assert.isTrue(carNos.size() == carInfoMap.size(), "请确保所有车牌号存在");
List<Long> companyIds = CollUtils.fieldList(carInfoMap.values(), NdVehicleBaseInfo::getCompanyId);
Map<Long, Company> companyMap = companyService.listCompanyByIds(companyIds);
List<VehicleOverSpeedEval> violationEvalList = new ArrayList<>();
Long userId = LoginUserUtil.getUserId();
LocalDateTime now = LocalDateTime.now();
importDataList.forEach(w -> {
VehicleOverSpeedEval eval = new VehicleOverSpeedEval();
eval.setCreateBy(userId);
eval.setCreateOn(now);
eval.setUpdateBy(userId);
eval.setUpdateOn(now);
eval.setOverSpeedCount(w.getOverSpeedCount());
eval.setRemark(w.getRemark());
eval.setAvgOverSpeedCount(w.getAvgOverSpeedCount());
eval.setCarNo(w.getCarNo());
eval.setMileage(w.getMileage());
NdVehicleBaseInfo carInfo = carInfoMap.get(w.getCarNo());
eval.setCarId(carInfo.getId());
eval.setCompanyId(carInfo.getCompanyId());
Company company = companyMap.get(eval.getCompanyId());
eval.setCompanyName(company.getName());
eval.setRegionId(company.getRegionId());
eval.setCarFrameNo(w.getChassisNumber());
eval.setDangerLevel(DangerLevelEnum.getCodeByDesc(w.getRiskEvaluation()));
violationEvalList.add(eval);
});
LambdaQueryWrapper<VehicleOverSpeedEval> delQuery = Wrappers.lambdaQuery(VehicleOverSpeedEval.class)
.in(VehicleOverSpeedEval::getCarNo, carNos);
vehicleOverSpeedEvalService.remove(delQuery);
vehicleOverSpeedEvalService.saveBatch(violationEvalList);
}

private void importVehicleAccidentData(List<VehicleAccidentImportDto> importDataList) {
if (CollectionUtils.isEmpty(importDataList)) {
return;
}
List<String> carNos = CollUtils.fieldList(importDataList, VehicleAccidentImportDto::getCarNo);
Assert.isTrue(carNos.size() == importDataList.size(), "车牌号不可重复");
Map<String, NdVehicleBaseInfo> carInfoMap = vehicleBaseInfoService.listByCarNo(carNos);
Assert.isTrue(carNos.size() == carInfoMap.size(), "请确保所有车牌号存在");
List<Long> companyIds = CollUtils.fieldList(carInfoMap.values(), NdVehicleBaseInfo::getCompanyId);
Map<Long, Company> companyMap = companyService.listCompanyByIds(companyIds);
List<VehicleAccidentEval> violationEvalList = new ArrayList<>();
Long userId = LoginUserUtil.getUserId();
LocalDateTime now = LocalDateTime.now();
importDataList.forEach(w -> {
VehicleAccidentEval eval = new VehicleAccidentEval();
eval.setCreateBy(userId);
eval.setCreateOn(now);
eval.setUpdateBy(userId);
eval.setUpdateOn(now);
eval.setAccidentCount(w.getAccidentCount());
eval.setRemark(w.getRemark());
eval.setAvgAccidentCount(w.getAvgAccidentCount());
eval.setCarNo(w.getCarNo());
eval.setMileage(w.getMileage());
NdVehicleBaseInfo carInfo = carInfoMap.get(w.getCarNo());
eval.setCarId(carInfo.getId());
eval.setCompanyId(carInfo.getCompanyId());
Company company = companyMap.get(eval.getCompanyId());
eval.setCompanyName(company.getName());
eval.setRegionId(company.getRegionId());
eval.setCarFrameNo(w.getChassisNumber());
eval.setDangerLevel(DangerLevelEnum.getCodeByDesc(w.getRiskEvaluation()));
violationEvalList.add(eval);
});
LambdaQueryWrapper<VehicleAccidentEval> delQuery = Wrappers.lambdaQuery(VehicleAccidentEval.class)
.in(VehicleAccidentEval::getCarNo, carNos);
vehicleAccidentEvalService.remove(delQuery);
vehicleAccidentEvalService.saveBatch(violationEvalList);
}

private void importOutDangerData(List<OutDangerImportDto> importDataList) {
if (CollectionUtils.isEmpty(importDataList)) {
return;
}
List<String> carNos = CollUtils.fieldList(importDataList, OutDangerImportDto::getCarNo);
// Assert.isTrue(carNos.size() == importDataList.size(), "车牌号不可重复");
Map<String, NdVehicleBaseInfo> carInfoMap = vehicleBaseInfoService.listByCarNo(carNos);
Assert.isTrue(carNos.size() == carInfoMap.size(), "请确保所有车牌号存在");
List<Long> companyIds = CollUtils.fieldList(carInfoMap.values(), NdVehicleBaseInfo::getCompanyId);
Map<Long, Company> companyMap = companyService.listCompanyByIds(companyIds);
Map<Long, NdInsureInfo> insureCompanyInfoMap = insureInfoService.listInsureCompanyByCompanyIds(companyIds);

List<NdInsureOutDanger> ndInsureOutDangers = new ArrayList<>();
Long userId = LoginUserUtil.getUserId();
LocalDateTime now = LocalDateTime.now();
importDataList.forEach(w -> {
NdInsureOutDanger eval = new NdInsureOutDanger();
eval.setCreateBy(userId);
eval.setCreateOn(now);
eval.setUpdateBy(userId);
eval.setUpdateOn(now);

NdVehicleBaseInfo carInfo = carInfoMap.get(w.getCarNo());
Company company = companyMap.get(carInfo.getCompanyId());

DateTime parse = DateUtil.parse(w.getAccidentTime());
Instant instant = parse.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
LocalDateTime accidentTime = instant.atZone(zoneId).toLocalDateTime();

eval.setAccidentTime(accidentTime);
eval.setAccidentAddress(w.getAccidentAddress());
eval.setCompanyId(company.getId());
eval.setCompanyName(company.getName());
eval.setRegionId(company.getRegionId());
eval.setRegionName(company.getName());
eval.setCarPlate(w.getCarNo());
if (insureCompanyInfoMap.size() == 0){
eval.setInsureCompany(null);
}else {
NdInsureInfo ndInsureInfo = insureCompanyInfoMap.get(carInfo.getCompanyId());
eval.setInsureCompany(ndInsureInfo.getInsureCompany());
}
eval.setInjuries(w.getInjuries());
eval.setDeathToll(w.getDeathToll());
eval.setCompensateAmount(w.getCompensateAmount());

ndInsureOutDangers.add(eval);
});

// 筛选出不在出险信息表中的数据,进行导入
List<NdInsureOutDanger> insureOutDangers = ndInsureOutDangers.stream().filter(w -> {
NdInsureOutDanger ndInsureOutDanger = ndInsureOutDangerService.getOne(Wrappers.lambdaQuery(NdInsureOutDanger.class)
.eq(NdInsureOutDanger::getCarPlate, w.getCarPlate())
.eq(NdInsureOutDanger::getInsureCompany,w.getInsureCompany())
.eq(NdInsureOutDanger::getCompanyName,w.getCompanyName())
.eq(NdInsureOutDanger::getAccidentAddress,w.getAccidentAddress())
.eq(NdInsureOutDanger::getAccidentTime,w.getAccidentTime())
.eq(NdInsureOutDanger::getInjuries,w.getInjuries())
.eq(NdInsureOutDanger::getDeathToll,w.getDeathToll())
.eq(NdInsureOutDanger::getCompensateAmount,w.getCompensateAmount()));
if (Objects.isNull(ndInsureOutDanger)){
return true;
}
return false;
}).collect(Collectors.toList());

if (CollUtil.isEmpty(insureOutDangers)){
throw new BizException("导入数据均已存在,无需重复导入!");
}

LambdaQueryWrapper<NdInsureOutDanger> delQuery = Wrappers.lambdaQuery(NdInsureOutDanger.class)
.in(NdInsureOutDanger::getCarPlate, carNos);
ndInsureOutDangerService.remove(delQuery);
ndInsureOutDangerService.saveBatch(insureOutDangers);
}

@Transactional(rollbackFor = Exception.class)
public void importTemplateData(ImportTemplateEnum template, MultipartFile file) {
String contentType = file.getContentType();
if (!contentType.equals(ExcelUtil.XLS_CONTENT_TYPE) &&
!contentType.equals(ExcelUtil.XLSX_CONTENT_TYPE)
) {
throw BizException.wrap("导入失败,不支持的文件类型,请按照提供的模板导入文件!");
}
try (InputStream inputStream = file.getInputStream();
ExcelReader reader = ExcelUtil.getReader(inputStream)) {
Map<String, String> alias;
List<String> title = ImportTemplateConstant.getTemplateTitle(template);
switch (template) {
case VEHICLE_VIOLATION:
alias = new HashMap<>(title.size());
alias.put(title.get(0), "id");
alias.put(title.get(1), "city");
alias.put(title.get(2), "zone");
alias.put(title.get(3), "companyName");
alias.put(title.get(4), "carNo");
alias.put(title.get(5), "chassisNumber");
alias.put(title.get(6), "mileage");
alias.put(title.get(7), "violationCount");
alias.put(title.get(8), "avgViolationCount");
alias.put(title.get(9), "riskEvaluation");
alias.put(title.get(10), "remark");
reader.setHeaderAlias(alias);
importVehicleViolationData(reader.readAll(VehicleViolationImportDto.class));
break;
case VEHICLE_ACCIDENT:
alias = new HashMap<>(title.size());
alias.put(title.get(0), "id");
alias.put(title.get(1), "city");
alias.put(title.get(2), "zone");
alias.put(title.get(3), "companyName");
alias.put(title.get(4), "carNo");
alias.put(title.get(5), "chassisNumber");
alias.put(title.get(6), "mileage");
alias.put(title.get(7), "accidentCount");
alias.put(title.get(8), "avgAccidentCount");
alias.put(title.get(9), "riskEvaluation");
alias.put(title.get(10), "remark");
reader.setHeaderAlias(alias);
importVehicleAccidentData(reader.readAll(VehicleAccidentImportDto.class));
break;
case VEHICLE_OVER_SPEED:
alias = new HashMap<>(title.size());
alias.put(title.get(0), "id");
alias.put(title.get(1), "city");
alias.put(title.get(2), "zone");
alias.put(title.get(3), "companyName");
alias.put(title.get(4), "carNo");
alias.put(title.get(5), "chassisNumber");
alias.put(title.get(6), "mileage");
alias.put(title.get(7), "overSpeedCount");
alias.put(title.get(8), "avgOverSpeedCount");
alias.put(title.get(9), "riskEvaluation");
alias.put(title.get(10), "remark");
reader.setHeaderAlias(alias);
importVehicleOverSpeedData(reader.readAll(VehicleOverSpeedImportDto.class));
break;
case INSURE_OUT_DANGER:
alias = new HashMap<>(title.size());
alias.put(title.get(0), "id");
alias.put(title.get(1), "regionName");
alias.put(title.get(2), "carNo");
alias.put(title.get(3), "insureCompany");
alias.put(title.get(4), "companyName");
alias.put(title.get(5), "accidentAddress");
alias.put(title.get(6), "accidentTime");
alias.put(title.get(7), "injuries");
alias.put(title.get(8), "deathToll");
alias.put(title.get(9), "compensateAmount");
reader.setHeaderAlias(alias);
importOutDangerData(reader.readAll(OutDangerImportDto.class));
break;
default:
throw new BizException("不支持的数据导入类型");
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

+ 245
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/SecurityAnalysisEvalManage.java View File

@@ -0,0 +1,245 @@
package com.ningdatech.carapi.analysis.manage;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.model.IdVo;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.carapi.analysis.entity.SecurityManageGrade;
import com.ningdatech.carapi.analysis.entity.SecurityManageResultEval;
import com.ningdatech.carapi.analysis.entity.SecurityRiskEval;
import com.ningdatech.carapi.analysis.entity.SecuritySystemBuildingEval;
import com.ningdatech.carapi.analysis.entity.req.SecurityManageGradeListReq;
import com.ningdatech.carapi.analysis.entity.req.SecurityRiskEvalListReq;
import com.ningdatech.carapi.analysis.entity.req.SecurityRiskEvalSaveReq;
import com.ningdatech.carapi.analysis.entity.req.SecuritySystemBuildingEvalSaveReq;
import com.ningdatech.carapi.analysis.entity.vo.SecurityManageGradeVo;
import com.ningdatech.carapi.analysis.entity.vo.SecurityManageResultEvalListVo;
import com.ningdatech.carapi.analysis.entity.vo.SecurityRiskEvalListVo;
import com.ningdatech.carapi.analysis.entity.vo.SecuritySystemBuildingEvalListVo;
import com.ningdatech.carapi.analysis.service.ISecurityManageGradeService;
import com.ningdatech.carapi.analysis.service.ISecurityManageResultEvalService;
import com.ningdatech.carapi.analysis.service.ISecurityRiskEvalService;
import com.ningdatech.carapi.analysis.service.ISecuritySystemBuildingEvalService;
import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper;
import com.ningdatech.carapi.common.util.CodeUtil;
import com.ningdatech.carapi.datascope.aop.LambdaDataScope;
import com.ningdatech.carapi.sys.entity.dto.CompanyDTO;
import com.ningdatech.carapi.sys.entity.dto.RegionDTO;
import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper;
import com.ningdatech.carapi.sys.helper.RegionsCacheHelper;
import com.ningdatech.carapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.aop.framework.AopContext;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;

/**
* <p>
* SecurityAnalysisEvalManage
* </p>
*
* @author WendyYang
* @since 14:47 2022/10/13
*/
@Component
@RequiredArgsConstructor
public class SecurityAnalysisEvalManage {

private final RegionsCacheHelper regionsCacheHelper;
private final CompaniesCacheHelper companiesCacheHelper;
private final ISecurityManageGradeService securityManagementGradeService;
private final ISecurityRiskEvalService securityRiskEvaluationService;
private final ISecuritySystemBuildingEvalService systemBuildingEvalService;
private final ISecurityManageResultEvalService securityManageResultEvalService;

/**
* 安全管理综合评级列表
**/
public PageVo<SecurityManageGradeVo> list(SecurityManageGradeListReq req) {
LambdaQueryWrapper<SecurityManageGrade> query = Wrappers.lambdaQuery(SecurityManageGrade.class);
SecurityAnalysisEvalManage context = (SecurityAnalysisEvalManage) AopContext.currentProxy();
context.buildSecurityManageGradeQuery(query,req);
Page<SecurityManageGrade> page = securityManagementGradeService.page(req.page(), query);
if (0L == page.getTotal()) {
return PageVo.empty();
}
List<SecurityManageGradeVo> res = page.getRecords().stream().map(w -> {
SecurityManageGradeVo gradeVo = BeanUtil.copyProperties(w, SecurityManageGradeVo.class);
List<RegionDTO> regions = regionsCacheHelper.listParents(w.getRegionId());
gradeVo.setRegions(regions);
CodeUtil.searchCompanyName(gradeVo);
return gradeVo;
}).collect(Collectors.toList());
return PageVo.of(res, page.getTotal());
}
@LambdaDataScope
@BuildChildrenRegionWrapper
public void buildSecurityManageGradeQuery(LambdaQueryWrapper<SecurityManageGrade> query,SecurityManageGradeListReq req) {
if (StringUtils.isNotBlank(req.getCompanyName())) {
query.like(SecurityManageGrade::getCompanyName, req.getCompanyName());
}
if (StringUtils.isNotBlank(req.getSecurityLevel())) {
query.eq(SecurityManageGrade::getSecurityLevel, req.getSecurityLevel());
}
if (req.getYear() != null) {
query.eq(SecurityManageGrade::getYear, req.getYear());
}
query.orderByDesc(SecurityManageGrade::getId);
}

/**
* 安全责任体系分析评估列表
*/
public PageVo<SecurityRiskEvalListVo> list(SecurityRiskEvalListReq req) {
LambdaQueryWrapper<SecurityRiskEval> query = Wrappers.lambdaQuery(SecurityRiskEval.class);
SecurityAnalysisEvalManage context = (SecurityAnalysisEvalManage) AopContext.currentProxy();
context.buildSecurityRiskEvalQuery(query, req);
Page<SecurityRiskEval> page = securityRiskEvaluationService.page(req.page(), query);
if (0L == page.getTotal()) {
return PageVo.empty();
}
List<SecurityRiskEvalListVo> res = page.getRecords().stream().map(w -> {
SecurityRiskEvalListVo gradeVo = BeanUtil.copyProperties(w, SecurityRiskEvalListVo.class);
List<RegionDTO> regions = regionsCacheHelper.listParents(w.getRegionId());
gradeVo.setRegions(regions);
CodeUtil.searchCompanyName(gradeVo);
return gradeVo;
}).collect(Collectors.toList());
return PageVo.of(res, page.getTotal());
}
@LambdaDataScope
@BuildChildrenRegionWrapper
public void buildSecurityRiskEvalQuery(LambdaQueryWrapper<SecurityRiskEval> query, SecurityRiskEvalListReq req) {
if (StringUtils.isNotBlank(req.getCompanyName())) {
query.like(SecurityRiskEval::getCompanyName, req.getCompanyName());
}
if (req.getScoreRanges() != null) {
Pair<Integer, Integer> ranges = req.getScoreRanges();
query.ge(ranges.getLeft() != null, SecurityRiskEval::getTotalScore, ranges.getLeft());
query.le(ranges.getRight() != null, SecurityRiskEval::getTotalScore, ranges.getRight());
}
if (req.getYear() != null) {
query.eq(SecurityRiskEval::getYear, req.getYear());
}
query.orderByDesc(SecurityRiskEval::getId);
}

/**
* 安全制度建设分析评估列表
*/
public PageVo<SecuritySystemBuildingEvalListVo> listSystemBuildingEval(SecurityRiskEvalListReq req) {
LambdaQueryWrapper<SecuritySystemBuildingEval> query = Wrappers.lambdaQuery(SecuritySystemBuildingEval.class);
SecurityAnalysisEvalManage context = (SecurityAnalysisEvalManage) AopContext.currentProxy();
context.buildSystemBuildingEvalQuery(query, req);
Page<SecuritySystemBuildingEval> page = systemBuildingEvalService.page(req.page(), query);
if (0L == page.getTotal()) {
return PageVo.empty();
}
List<SecuritySystemBuildingEvalListVo> res = page.getRecords().stream().map(w -> {
SecuritySystemBuildingEvalListVo gradeVo = BeanUtil.copyProperties(w, SecuritySystemBuildingEvalListVo.class);
List<RegionDTO> regions = regionsCacheHelper.listParents(w.getRegionId());
gradeVo.setRegions(regions);
CodeUtil.searchCompanyName(gradeVo);
return gradeVo;
}).collect(Collectors.toList());
return PageVo.of(res, page.getTotal());
}
@LambdaDataScope
@BuildChildrenRegionWrapper
public void buildSystemBuildingEvalQuery(LambdaQueryWrapper<SecuritySystemBuildingEval> query, SecurityRiskEvalListReq req) {
if (StringUtils.isNotBlank(req.getCompanyName())) {
query.like(SecuritySystemBuildingEval::getCompanyName, req.getCompanyName());
}
if (req.getScoreRanges() != null) {
Pair<Integer, Integer> ranges = req.getScoreRanges();
query.ge(ranges.getLeft() != null, SecuritySystemBuildingEval::getTotalScore, ranges.getLeft());
query.le(ranges.getRight() != null, SecuritySystemBuildingEval::getTotalScore, ranges.getRight());
}
if (req.getYear() != null) {
query.eq(SecuritySystemBuildingEval::getYear, req.getYear());
}
query.orderByDesc(SecuritySystemBuildingEval::getId);
}

/**
* 新增安全责任体系评估
*/

public IdVo<Integer> save(SecurityRiskEvalSaveReq req) {
Assert.isTrue(0L == securityRiskEvaluationService.count(Wrappers.lambdaQuery(SecurityRiskEval.class)
.eq(SecurityRiskEval::getYear, req.getYear())
.eq(SecurityRiskEval::getCompanyId, req.getCompanyId())), "已存在该年度安全责任体系评估");
CompanyDTO company = companiesCacheHelper.getById(req.getCompanyId());
SecurityRiskEval insert = BeanUtil.copyProperties(req, SecurityRiskEval.class);
insert.setCreateBy(LoginUserUtil.getUserId());
insert.setCreateOn(LocalDateTime.now());
insert.setRegionId(company.getRegionId());
insert.setUpdateBy(insert.getCreateBy());
insert.setUpdateOn(insert.getCreateOn());
securityRiskEvaluationService.save(insert);
return IdVo.of(insert.getId());
}

/**
* 新增安全制度建设分析评估
*/
public IdVo<Integer> save(SecuritySystemBuildingEvalSaveReq req) {
Assert.isTrue(0L == systemBuildingEvalService.count(Wrappers.lambdaQuery(SecuritySystemBuildingEval.class)
.eq(SecuritySystemBuildingEval::getYear, req.getYear())
.eq(SecuritySystemBuildingEval::getCompanyId, req.getCompanyId())), "已存在该年度安全制度建设评估");
CompanyDTO company = companiesCacheHelper.getById(req.getCompanyId());
SecuritySystemBuildingEval insert = BeanUtil.copyProperties(req, SecuritySystemBuildingEval.class);
insert.setCreateBy(LoginUserUtil.getUserId());
insert.setCreateOn(LocalDateTime.now());
insert.setRegionId(company.getRegionId());
insert.setUpdateBy(insert.getCreateBy());
insert.setUpdateOn(insert.getCreateOn());
systemBuildingEvalService.save(insert);
return IdVo.of(insert.getId());
}
/**
* 安全管理结果分析评估列表
*/
public PageVo<SecurityManageResultEvalListVo> listSecurityManageResultEval(SecurityRiskEvalListReq req) {
LambdaQueryWrapper<SecurityManageResultEval> query = Wrappers.lambdaQuery(SecurityManageResultEval.class);
SecurityAnalysisEvalManage context = (SecurityAnalysisEvalManage) AopContext.currentProxy();
context.buildSecurityManageResultEvalQuery(query, req);
Page<SecurityManageResultEval> page = securityManageResultEvalService.page(req.page(), query);
if (0L == page.getTotal()) {
return PageVo.empty();
}
List<SecurityManageResultEvalListVo> res = page.getRecords().stream().map(w -> {
SecurityManageResultEvalListVo gradeVo = BeanUtil.copyProperties(w, SecurityManageResultEvalListVo.class);
List<RegionDTO> regions = regionsCacheHelper.listParents(w.getRegionId());
gradeVo.setRegions(regions);
CodeUtil.searchCompanyName(gradeVo);
return gradeVo;
}).collect(Collectors.toList());
return PageVo.of(res, page.getTotal());
}
@LambdaDataScope
@BuildChildrenRegionWrapper
public void buildSecurityManageResultEvalQuery(LambdaQueryWrapper<SecurityManageResultEval> query, SecurityRiskEvalListReq req) {
if (StringUtils.isNotBlank(req.getCompanyName())) {
query.like(SecurityManageResultEval::getCompanyName, req.getCompanyName());
}
if (req.getScoreRanges() != null) {
Pair<Integer, Integer> ranges = req.getScoreRanges();
query.ge(ranges.getLeft() != null, SecurityManageResultEval::getTotalScore, ranges.getLeft());
query.le(ranges.getRight() != null, SecurityManageResultEval::getTotalScore, ranges.getRight());
}
if (req.getYear() != null) {
query.eq(SecurityManageResultEval::getYear, req.getYear());
}
query.orderByDesc(SecurityManageResultEval::getId);
}

}

+ 149
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/WarnAnalysisManage.java View File

@@ -0,0 +1,149 @@
package com.ningdatech.carapi.analysis.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.carapi.analysis.entity.WarnAnalysisCar;
import com.ningdatech.carapi.analysis.entity.WarnAnalysisCompany;
import com.ningdatech.carapi.analysis.entity.WarnAnalysisDriver;
import com.ningdatech.carapi.analysis.entity.req.WarnAnalysisListReq;
import com.ningdatech.carapi.analysis.entity.vo.WarnAnalysisByCarVo;
import com.ningdatech.carapi.analysis.entity.vo.WarnAnalysisByCompanyVo;
import com.ningdatech.carapi.analysis.entity.vo.WarnAnalysisByDriverVo;
import com.ningdatech.carapi.analysis.mapper.WarnAnalysisCarMapper;
import com.ningdatech.carapi.analysis.service.IWarnAnalysisCarService;
import com.ningdatech.carapi.analysis.service.IWarnAnalysisCompanyService;
import com.ningdatech.carapi.analysis.service.IWarnAnalysisDriverService;
import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper;
import com.ningdatech.carapi.common.util.CodeUtil;
import com.ningdatech.carapi.datascope.aop.LambdaDataScope;
import com.ningdatech.carapi.sys.helper.RegionsCacheHelper;
import lombok.RequiredArgsConstructor;
import org.springframework.aop.framework.AopContext;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* <p>
* WarnAnalysisManage
* </p>
*
* @author WendyYang
* @since 16:34 2022/10/14
*/
@Component
@RequiredArgsConstructor
public class WarnAnalysisManage {

private final IWarnAnalysisCarService warnAnalysisCarService;
private final IWarnAnalysisCompanyService warnAnalysisCompanyService;
private final RegionsCacheHelper regionsCacheHelper;
private final IWarnAnalysisDriverService warnAnalysisDriverService;

private final WarnAnalysisCarMapper warnAnalysisCarMapper;

/**
* 车辆综合预警分析列表
*/
public PageVo<WarnAnalysisByCarVo> listCarWarnAnalysis(WarnAnalysisListReq req) {
LambdaQueryWrapper<WarnAnalysisCar> query = Wrappers.lambdaQuery(WarnAnalysisCar.class);
WarnAnalysisManage context = (WarnAnalysisManage) AopContext.currentProxy();
context.buildCarWarnAnalysisQuery(query, req);
Page<WarnAnalysisCar> page = warnAnalysisCarService.page(req.page(), query);
if (0L == page.getTotal()) {
return PageVo.empty();
}
List<WarnAnalysisByCarVo> res = page.getRecords().stream().map(w -> {
WarnAnalysisByCarVo vo = BeanUtil.copyProperties(w, WarnAnalysisByCarVo.class);
if (Objects.nonNull(w.getRegionId())) {
vo.setRegions(regionsCacheHelper.listParents(w.getRegionId()));
}
CodeUtil.searchCompanyName(vo);
return vo;
}).collect(Collectors.toList());
return PageVo.of(res, page.getTotal());
}

@LambdaDataScope
@BuildChildrenRegionWrapper
public void buildCarWarnAnalysisQuery(LambdaQueryWrapper<WarnAnalysisCar> query, WarnAnalysisListReq req) {
query.like(StrUtil.isNotBlank(req.getCarNo()), WarnAnalysisCar::getCarNo, req.getCarNo())
.like(StrUtil.isNotBlank(req.getCompanyName()), WarnAnalysisCar::getCompanyName, req.getCompanyName())
.eq(Objects.nonNull(req.getDangerLevel()), WarnAnalysisCar::getDangerLevel, req.getDangerLevel())
.orderByDesc(WarnAnalysisCar::getDangerScore)
.orderByDesc(WarnAnalysisCar::getUpdateOn);
}

/**
* 企业综合预警分析列表
*/
public PageVo<WarnAnalysisByCompanyVo> listCompanyWarnAnalysis(WarnAnalysisListReq req) {
String companyName = req.getCompanyName();
Integer carCount = warnAnalysisCarMapper.selectVehiclesNum(companyName);
LambdaQueryWrapper<WarnAnalysisCompany> query = Wrappers.lambdaQuery(WarnAnalysisCompany.class);
WarnAnalysisManage context = (WarnAnalysisManage) AopContext.currentProxy();
context.buildCompanyWarnAnalysisQuery(query, req);
Page<WarnAnalysisCompany> page = warnAnalysisCompanyService.page(req.page(), query);
if (0L == page.getTotal()) {
return PageVo.empty();
}
List<WarnAnalysisByCompanyVo> res = page.getRecords().stream().map(w -> {
WarnAnalysisByCompanyVo vo = BeanUtil.copyProperties(w, WarnAnalysisByCompanyVo.class);
if (Objects.nonNull(w.getRegionId())) {
vo.setRegions(regionsCacheHelper.listParents(w.getRegionId()));
}
vo.setCarCount(carCount);
CodeUtil.searchCompanyName(vo);
return vo;
}).collect(Collectors.toList());
return PageVo.of(res, page.getTotal());
}

@LambdaDataScope
@BuildChildrenRegionWrapper
public void buildCompanyWarnAnalysisQuery(LambdaQueryWrapper<WarnAnalysisCompany> query, WarnAnalysisListReq req) {
query.like(StrUtil.isNotBlank(req.getCompanyName()), WarnAnalysisCompany::getCompanyName, req.getCompanyName())
.eq(Objects.nonNull(req.getDangerLevel()), WarnAnalysisCompany::getDangerLevel, req.getDangerLevel())
.orderByDesc(WarnAnalysisCompany::getTotalScore)
.orderByDesc(WarnAnalysisCompany::getUpdateOn);
}

/**
* 驾驶员综合预警分析列表
*/
public PageVo<WarnAnalysisByDriverVo> listDriverWarnAnalysis(WarnAnalysisListReq req) {
LambdaQueryWrapper<WarnAnalysisDriver> query = Wrappers.lambdaQuery(WarnAnalysisDriver.class);
WarnAnalysisManage context = (WarnAnalysisManage) AopContext.currentProxy();
context.buildDriverWarnAnalysisQuery(query, req);
Page<WarnAnalysisDriver> page = warnAnalysisDriverService.page(req.page(), query);
if (0L == page.getTotal()) {
return PageVo.empty();
}
List<WarnAnalysisByDriverVo> res = page.getRecords().stream().map(w -> {
WarnAnalysisByDriverVo vo = BeanUtil.copyProperties(w, WarnAnalysisByDriverVo.class);
if (Objects.nonNull(w.getRegionId())) {
vo.setRegions(regionsCacheHelper.listParents(w.getRegionId()));
}
CodeUtil.searchCompanyName(vo);
return vo;
}).collect(Collectors.toList());
return PageVo.of(res, page.getTotal());
}

@LambdaDataScope
@BuildChildrenRegionWrapper
public void buildDriverWarnAnalysisQuery(LambdaQueryWrapper<WarnAnalysisDriver> query, WarnAnalysisListReq req) {
query.eq(StrUtil.isNotBlank(req.getDriverName()), WarnAnalysisDriver::getDriverName, req.getDriverName())
.like(StrUtil.isNotBlank(req.getCompanyName()), WarnAnalysisDriver::getCompanyName, req.getCompanyName())
.eq(Objects.nonNull(req.getDangerLevel()), WarnAnalysisDriver::getDangerLevel, req.getDangerLevel())
.orderByDesc(WarnAnalysisDriver::getDangerScore)
.orderByDesc(WarnAnalysisDriver::getUpdateOn);
}

}

+ 18
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/IndustryStandardsMapper.java View File

@@ -0,0 +1,18 @@
package com.ningdatech.carapi.analysis.mapper;

import com.ningdatech.carapi.analysis.entity.IndustryStandards;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* Mapper 接口
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
public interface IndustryStandardsMapper extends BaseMapper<IndustryStandards> {

int incrementDownCount(Long id);

}

+ 9
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/IndustryStandardsMapper.xml View File

@@ -0,0 +1,9 @@
<?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.ningdatech.carapi.analysis.mapper.IndustryStandardsMapper">

<update id="incrementDownCount">
update nd_industry_standards set down_count = down_count + 1 where id = #{id}
</update>

</mapper>

+ 7
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/NdInsureOutDangerVOMapper.java View File

@@ -0,0 +1,7 @@
package com.ningdatech.carapi.analysis.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.carapi.safe.model.vo.NdInsureOutDangerVO;

public interface NdInsureOutDangerVOMapper extends BaseMapper<NdInsureOutDangerVO> {
}

+ 7
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/NdInsureOutDangerVOMapper.xml View File

@@ -0,0 +1,7 @@
<?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.ningdatech.carapi.analysis.mapper.NdInsureOutDangerVOMapper">

</mapper>

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageGradeMapper.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.mapper;

import com.ningdatech.carapi.analysis.entity.SecurityManageGrade;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* 安全管理综合评级 Mapper 接口
* </p>
*
* @author LiuXinXin
* @since 2022-10-13
*/
public interface SecurityManageGradeMapper extends BaseMapper<SecurityManageGrade> {

}

+ 5
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageGradeMapper.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.carapi.analysis.mapper.SecurityManageGradeMapper">

</mapper>

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageResultEvalMapper.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.mapper;

import com.ningdatech.carapi.analysis.entity.SecurityManageResultEval;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* 安全制度建设分析评估 Mapper 接口
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
public interface SecurityManageResultEvalMapper extends BaseMapper<SecurityManageResultEval> {

}

+ 5
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageResultEvalMapper.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.carapi.analysis.mapper.SecurityManageResultEvalMapper">

</mapper>

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityRiskEvalMapper.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.mapper;

import com.ningdatech.carapi.analysis.entity.SecurityRiskEval;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* 安全责任体系分析评估 Mapper 接口
* </p>
*
* @author LiuXinXin
* @since 2022-10-14
*/
public interface SecurityRiskEvalMapper extends BaseMapper<SecurityRiskEval> {

}

+ 5
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityRiskEvalMapper.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.carapi.analysis.mapper.SecurityRiskEvalMapper">

</mapper>

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecuritySystemBuildingEvalMapper.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.carapi.analysis.entity.SecuritySystemBuildingEval;

/**
* <p>
* 安全责任体系分析评估 Mapper 接口
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
public interface SecuritySystemBuildingEvalMapper extends BaseMapper<SecuritySystemBuildingEval> {

}

+ 5
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecuritySystemBuildingEvalMapper.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.carapi.analysis.mapper.SecuritySystemBuildingEvalMapper">

</mapper>

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleAccidentEvalMapper.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.mapper;

import com.ningdatech.carapi.analysis.entity.VehicleAccidentEval;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* 车辆事故情况评估 Mapper 接口
* </p>
*
* @author WendyYang
* @since 2022-10-17
*/
public interface VehicleAccidentEvalMapper extends BaseMapper<VehicleAccidentEval> {

}

+ 5
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleAccidentEvalMapper.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.carapi.analysis.mapper.VehicleAccidentEvalMapper">

</mapper>

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleOverSpeedEvalMapper.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.mapper;

import com.ningdatech.carapi.analysis.entity.VehicleOverSpeedEval;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* 车辆超速情况评估 Mapper 接口
* </p>
*
* @author WendyYang
* @since 2022-10-17
*/
public interface VehicleOverSpeedEvalMapper extends BaseMapper<VehicleOverSpeedEval> {

}

+ 5
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleOverSpeedEvalMapper.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.carapi.analysis.mapper.VehicleOverSpeedEvalMapper">

</mapper>

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleServiceLifeMapper.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.mapper;

import com.ningdatech.carapi.analysis.entity.VehicleServiceLife;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* 车辆使用年限 Mapper 接口
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
public interface VehicleServiceLifeMapper extends BaseMapper<VehicleServiceLife> {

}

+ 5
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleServiceLifeMapper.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.carapi.analysis.mapper.VehicleServiceLifeMapper">

</mapper>

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleViolationEvalMapper.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.mapper;

import com.ningdatech.carapi.analysis.entity.VehicleViolationEval;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* <p>
* 车辆违章情况评估 Mapper 接口
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
public interface VehicleViolationEvalMapper extends BaseMapper<VehicleViolationEval> {

}

+ 5
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleViolationEvalMapper.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.carapi.analysis.mapper.VehicleViolationEvalMapper">

</mapper>

+ 28
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCarMapper.java View File

@@ -0,0 +1,28 @@
package com.ningdatech.carapi.analysis.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.carapi.analysis.entity.WarnAnalysisCar;
import com.ningdatech.carapi.analysis.entity.req.WarnAnalysisListReq;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* <p>
* 车辆综合预警分析 Mapper 接口
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
public interface WarnAnalysisCarMapper extends BaseMapper<WarnAnalysisCar> {

Integer selectVehiclesNum(@Param("companyName") String companyName);

Page<WarnAnalysisCar> pageCarAnalysis(Page<WarnAnalysisCar> page, @Param("param") WarnAnalysisListReq req);

List<WarnAnalysisCar> listCarAnalysis(@Param("param") WarnAnalysisListReq req);

Integer saveBatchXml(@Param("singleList") List<WarnAnalysisCar> singleList);
}

+ 162
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCarMapper.xml View File

@@ -0,0 +1,162 @@
<?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.ningdatech.carapi.analysis.mapper.WarnAnalysisCarMapper">

<select id="selectVehiclesNum" resultType="java.lang.Integer">
select sum(vehicle_num) as carCount from nd_company_info where `name` = #{companyName}
</select>

<select id="pageCarAnalysis" resultType="com.ningdatech.carapi.analysis.entity.WarnAnalysisCar">
select
car_id,car_no,
region_id,company_id,company_name,injured_count,
dead_count,danger_count,over_speed_count,violation_count,
danger_score,danger_level
from(select
car_id,car_no,
region_id,company_id,company_name,injured_count,
dead_count,danger_count,over_speed_count,violation_count,
(injured_count * 20 + dead_count * 100) danger_score,
(case when injured_count * 20 + dead_count * 100 &gt;= 100 then 1
when injured_count * 20 + dead_count * 100 &gt;= 80 then 2
when injured_count * 20 + dead_count * 100 &gt;= 60 then 3
else 4 end) danger_level
from (SELECT
b.id car_id,
b.car_plate car_no,
b.region_id,
b.company_id,
c.name company_name,
sum(ifnull(o.injuries,0)) injured_count,
sum(ifnull(o.death_toll,0)) dead_count,
ifnull(count(o.id),0) danger_count,
ifnull(count(oi.id),0) over_speed_count,
ifnull(count(vi.id),0) violation_count
FROM nd_vehicle_base_info b
left join nd_company_info c on b.company_id = c.id
left join nd_region r on b.region_id = r.id
left join (select id,car_plate,injuries,death_toll from nd_insure_out_danger where deleted = 0) o on b.car_plate = o.car_plate
left join nd_vehicle_overspeed_info oi on b.car_plate = oi.car_plate
left join nd_vehicle_violation vi on b.car_plate = vi.car_plate
where b.deleted = 0 and b.audit_state = 2
<if test="param.regionIds != null and param.regionIds.size > 0">
and b.region_id in
<foreach collection="param.regionIds" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
<if test="param.companyName != null and param.companyName != ''">
and c.name like concat('%',#{param.companyName},'%')
</if>
<if test="param.carNo != null and param.carNo != ''">
and b.car_plate like concat('%',#{param.carNo},'%')
</if>
${param.dataScopeSql}
group by b.id,b.car_plate,b.region_id,b.company_id,c.name
) a ) aa
where 1 = 1
<if test="param.dangerLevel != null and param.dangerLevel != ''">
and aa.danger_level = #{param.dangerLevel}
</if>
</select>

<select id="listCarAnalysis" resultType="com.ningdatech.carapi.analysis.entity.WarnAnalysisCar">
select
car_id,car_no,
region_id,company_id,company_name,injured_count,
dead_count,danger_count,over_speed_count,violation_count,
danger_score,danger_level
from(select
car_id,car_no,
region_id,company_id,company_name,injured_count,
dead_count,danger_count,over_speed_count,violation_count,
(danger_count / car_num * 40 + injured_count / car_num * 400) danger_score,
(case when dead_count > 0 then 1
when danger_count / car_num * 40 + injured_count / car_num * 400 &gt;= 60 then 2
when danger_count / car_num * 40 + injured_count / car_num * 400 &gt;= 40
and danger_count / car_num * 40 + injured_count / car_num * 400 &lt;= 60 then 3
when danger_count / car_num * 40 + injured_count / car_num * 400 &gt;= 20
and danger_count / car_num * 40 + injured_count / car_num * 400 &lt;= 40 then 4 end) danger_level
from (SELECT
count(DISTINCT b.id) car_num,
b.id car_id,
b.car_plate car_no,
b.region_id,
b.company_id,
c.name company_name,
ifnull(o.injured_count,0) injured_count,
ifnull(o.dead_count,0) dead_count,
ifnull(count(DISTINCT o.id),0) danger_count,
ifnull(count(DISTINCT oi.id),0) over_speed_count,
ifnull(count(DISTINCT vi.id),0) violation_count
FROM nd_vehicle_base_info b
left join nd_company_info c on b.company_id = c.id
left join nd_region r on b.region_id = r.id
right join
(select id,car_plate,injuries,death_toll,
sum(ifnull(injuries,0)) injured_count,
sum(ifnull(death_toll,0)) dead_count
from nd_insure_out_danger
where deleted = 0
-- 统计近6个月的出险数据
and accident_time
BETWEEN DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 5 MONTH),'%Y-%m-01 00:00:00')
AND LAST_DAY(NOW()) GROUP BY accident_time,car_plate ) o on b.car_plate = o.car_plate
left join nd_vehicle_overspeed_info oi on b.car_plate = oi.car_plate
left join nd_vehicle_violation vi on b.car_plate = vi.car_plate
where b.deleted = 0 and b.audit_state = 2
<if test="param.regionIds != null and param.regionIds.size > 0">
and b.region_id in
<foreach collection="param.regionIds" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
<if test="param.companyName != null and param.companyName != ''">
and c.name like concat('%',#{param.companyName},'%')
</if>
<if test="param.carNo != null and param.carNo != ''">
and b.car_plate like concat('%',#{param.carNo},'%')
</if>
${param.dataScopeSql}
group by b.id,b.car_plate,b.region_id,b.company_id,c.name
) a ) aa
where 1 = 1
<if test="param.dangerLevel != null and param.dangerLevel != ''">
and aa.danger_level = #{param.dangerLevel}
</if>
</select>

<insert id="saveBatchXml" parameterType="java.util.List">
INSERT INTO nd_warn_analysis_car
(region_id,
company_id,
company_name,
injured_count,
dead_count,
danger_count,
danger_score,
car_id,
car_no,
danger_level,
over_speed_count,
violation_count
)
values
<foreach collection="singleList" item="item" separator="," index="index">
(
#{item.regionId},
#{item.companyId},
#{item.companyName},
#{item.injuredCount},
#{item.deadCount},
#{item.dangerCount},
#{item.dangerScore},
#{item.carId},
#{item.carNo},
#{item.dangerLevel},
#{item.overSpeedCount},
#{item.violationCount}
)
</foreach>
</insert>
</mapper>

+ 23
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCompanyMapper.java View File

@@ -0,0 +1,23 @@
package com.ningdatech.carapi.analysis.mapper;

import com.ningdatech.carapi.analysis.entity.WarnAnalysisCompany;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.carapi.analysis.entity.req.WarnAnalysisListReq;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* <p>
* 企业综合预警分析 Mapper 接口
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
public interface WarnAnalysisCompanyMapper extends BaseMapper<WarnAnalysisCompany> {

List<WarnAnalysisCompany> listCompanyAnalysis(@Param("param") WarnAnalysisListReq req);

Integer saveBatchXml(@Param("singleList") List<WarnAnalysisCompany> singleList);
}

+ 95
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCompanyMapper.xml View File

@@ -0,0 +1,95 @@
<?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.ningdatech.carapi.analysis.mapper.WarnAnalysisCompanyMapper">

<select id="listCompanyAnalysis" resultType="com.ningdatech.carapi.analysis.entity.WarnAnalysisCompany">
select
region_id,company_id,company_name,injured_count,
dead_count,danger_count,over_speed_count,violation_count,
total_score,danger_level
from(select
region_id,company_id,company_name,injured_count,
dead_count,danger_count,over_speed_count,violation_count,
(danger_count / car_num * 40 + injured_count / car_num * 400) total_score,
(case when dead_count > 0 then 1
when danger_count / car_num * 40 + injured_count / car_num * 400 &gt;= 60 then 2
when danger_count / car_num * 40 + injured_count / car_num * 400 &gt;= 40
and danger_count / car_num * 40 + injured_count / car_num * 400 &lt;= 60 then 3
when danger_count / car_num * 40 + injured_count / car_num * 400 &gt;= 20
and danger_count / car_num * 40 + injured_count / car_num * 400 &lt;= 40 then 4 end) danger_level
from (SELECT
count(DISTINCT b.id) car_num,
b.region_id,
b.company_id,
c.name company_name,
ifnull(o.injured_count,0) injured_count,
ifnull(o.dead_count,0) dead_count,
ifnull(count(DISTINCT o.id),0) danger_count,
ifnull(count(DISTINCT oi.id),0) over_speed_count,
ifnull(count(DISTINCT vi.id),0) violation_count
FROM nd_vehicle_base_info b
left join nd_company_info c on b.company_id = c.id
left join nd_region r on b.region_id = r.id
right join
-- 统计近6个月的出险数据
(select id,car_plate,injuries,death_toll,
sum(ifnull(injuries,0)) injured_count,
sum(ifnull(death_toll,0)) dead_count
from nd_insure_out_danger
where deleted = 0
and accident_time
BETWEEN DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 5 MONTH),'%Y-%m-01 00:00:00')
AND LAST_DAY(NOW()) GROUP BY accident_time,car_plate ) o on b.car_plate = o.car_plate
left join nd_vehicle_overspeed_info oi on b.car_plate = oi.car_plate
left join nd_vehicle_violation vi on b.car_plate = vi.car_plate
where b.deleted = 0 and b.audit_state = 2
<if test="param.regionIds != null and param.regionIds.size > 0">
and b.region_id in
<foreach collection="param.regionIds" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
<if test="param.companyName != null and param.companyName != ''">
and c.name like concat('%',#{param.companyName},'%')
</if>
<if test="param.carNo != null and param.carNo != ''">
and b.car_plate like concat('%',#{param.carNo},'%')
</if>
${param.dataScopeSql}
group by b.region_id,b.company_id,c.name
) a
GROUP BY region_id,company_id,company_name) aa
where company_name is not null
<if test="param.dangerLevel != null and param.dangerLevel != ''">
and aa.danger_level = #{param.dangerLevel}
</if>
</select>

<insert id="saveBatchXml" parameterType="java.util.List">
INSERT INTO nd_warn_analysis_company
(region_id,
company_id,
company_name,
injured_count,
dead_count,
danger_count,
total_score,
danger_level,
violation_count
)
values
<foreach collection="singleList" item="item" separator="," index="index">
(
#{item.regionId},
#{item.companyId},
#{item.companyName},
#{item.injuredCount},
#{item.deadCount},
#{item.dangerCount},
#{item.totalScore},
#{item.dangerLevel},
#{item.violationCount}
)
</foreach>
</insert>
</mapper>

+ 23
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisDriverMapper.java View File

@@ -0,0 +1,23 @@
package com.ningdatech.carapi.analysis.mapper;

import com.ningdatech.carapi.analysis.entity.WarnAnalysisDriver;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.carapi.analysis.entity.req.WarnAnalysisListReq;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* <p>
* 驾驶员综合预警分析 Mapper 接口
* </p>
*
* @author WendyYang
* @since 2022-11-01
*/
public interface WarnAnalysisDriverMapper extends BaseMapper<WarnAnalysisDriver> {

List<WarnAnalysisDriver> listDriverAnalysis(@Param("param") WarnAnalysisListReq req);

Integer saveBatchXml(@Param("singleList") List<WarnAnalysisDriver> singleList);
}

+ 87
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisDriverMapper.xml View File

@@ -0,0 +1,87 @@
<?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.ningdatech.carapi.analysis.mapper.WarnAnalysisDriverMapper">
<select id="listDriverAnalysis" resultType="com.ningdatech.carapi.analysis.entity.WarnAnalysisDriver">
select
driver_id,driver_name,
region_id,company_id,company_name,injured_count,
dead_count,danger_count,over_speed_count,violation_count,
danger_score,danger_level
from(select
driver_id,driver_name,
region_id,company_id,company_name,injured_count,
dead_count,danger_count,over_speed_count,violation_count,
(danger_count / car_num * 40 + injured_count / car_num * 400) danger_score,
(case when dead_count > 0 then 1
when danger_count / car_num * 40 + injured_count / car_num * 400 &gt;= 60 then 2
when danger_count / car_num * 40 + injured_count / car_num * 400 &gt;= 40
and danger_count / car_num * 40 + injured_count / car_num * 400 &lt;= 60 then 3
when danger_count / car_num * 40 + injured_count / car_num * 400 &gt;= 20
and danger_count / car_num * 40 + injured_count / car_num * 400 &lt;= 40 then 4 end) danger_level
from (SELECT
count(DISTINCT b.id) car_num,
d.id driver_id,d.driver_name,c.region_id,
d.company_id,c.name company_name,
ifnull(o.injured_count,0) injured_count,
ifnull(o.dead_count,0) dead_count,
ifnull(count(DISTINCT o.id),0) danger_count,
ifnull(count(DISTINCT oi.id),0) over_speed_count,
ifnull(count(DISTINCT vi.id),0) violation_count
FROM nd_vehicle_base_info b
left join nd_vehicle_get_on g on b.car_plate = g.car_plate
right join nd_driver_info d on g.driver_id = d.id
left join nd_company_info c on d.company_id = c.id
left join nd_region r on c.region_id = r.id
right join
(select id,car_plate,injuries,death_toll,
sum(ifnull(injuries,0)) injured_count,
sum(ifnull(death_toll,0)) dead_count
from nd_insure_out_danger
where deleted = 0
-- 统计近6个月的出险数据
and accident_time
BETWEEN DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 5 MONTH),'%Y-%m-01 00:00:00')
AND LAST_DAY(NOW()) GROUP BY accident_time,car_plate ) o on b.car_plate = o.car_plate
left join nd_vehicle_overspeed_info oi on b.car_plate = oi.car_plate
left join nd_vehicle_violation vi on b.car_plate = vi.car_plate
where b.deleted = 0 and b.audit_state = 2 and d.driver_name is not null and c.region_id is not null
${param.dataScopeSql}
group by d.id,d.driver_name,c.region_id,d.company_id,c.name
) a ) aa
where 1 = 1
</select>

<insert id="saveBatchXml" parameterType="java.util.List">
INSERT INTO nd_warn_analysis_driver
(region_id,
driver_id,
driver_name,
company_id,
company_name,
injured_count,
dead_count,
danger_count,
danger_score,
danger_level,
over_speed_count,
violation_count
)
values
<foreach collection="singleList" item="item" separator="," index="index">
(
#{item.regionId},
#{item.driverId},
#{item.driverName},
#{item.companyId},
#{item.companyName},
#{item.injuredCount},
#{item.deadCount},
#{item.dangerCount},
#{item.dangerScore},
#{item.dangerLevel},
#{item.overSpeedCount},
#{item.violationCount}
)
</foreach>
</insert>
</mapper>

+ 19
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IIndustryStandardsService.java View File

@@ -0,0 +1,19 @@
package com.ningdatech.carapi.analysis.service;

import com.ningdatech.carapi.analysis.entity.IndustryStandards;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* <p>
* 服务类
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
public interface IIndustryStandardsService extends IService<IndustryStandards> {

boolean incrementDownCount(Long id);

void deleteById(Long id);
}

+ 7
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/INdInsureOutDangerVOService.java View File

@@ -0,0 +1,7 @@
package com.ningdatech.carapi.analysis.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.carapi.safe.model.vo.NdInsureOutDangerVO;

public interface INdInsureOutDangerVOService extends IService<NdInsureOutDangerVO> {
}

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityManageGradeService.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.service;

import com.ningdatech.carapi.analysis.entity.SecurityManageGrade;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* <p>
* 安全管理综合评级 服务类
* </p>
*
* @author LiuXinXin
* @since 2022-10-13
*/
public interface ISecurityManageGradeService extends IService<SecurityManageGrade> {

}

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityManageResultEvalService.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.service;

import com.ningdatech.carapi.analysis.entity.SecurityManageResultEval;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* <p>
* 安全制度建设分析评估 服务类
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
public interface ISecurityManageResultEvalService extends IService<SecurityManageResultEval> {

}

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityRiskEvalService.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.carapi.analysis.entity.SecurityRiskEval;

/**
* <p>
* 安全责任体系分析评估 服务类
* </p>
*
* @author LiuXinXin
* @since 2022-10-14
*/
public interface ISecurityRiskEvalService extends IService<SecurityRiskEval> {

}

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecuritySystemBuildingEvalService.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.service;

import com.ningdatech.carapi.analysis.entity.SecuritySystemBuildingEval;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* <p>
* 安全责任体系分析评估 服务类
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
public interface ISecuritySystemBuildingEvalService extends IService<SecuritySystemBuildingEval> {

}

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleAccidentEvalService.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.service;

import com.ningdatech.carapi.analysis.entity.VehicleAccidentEval;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* <p>
* 车辆事故情况评估 服务类
* </p>
*
* @author WendyYang
* @since 2022-10-17
*/
public interface IVehicleAccidentEvalService extends IService<VehicleAccidentEval> {

}

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleOverSpeedEvalService.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.service;

import com.ningdatech.carapi.analysis.entity.VehicleOverSpeedEval;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* <p>
* 车辆超速情况评估 服务类
* </p>
*
* @author WendyYang
* @since 2022-10-17
*/
public interface IVehicleOverSpeedEvalService extends IService<VehicleOverSpeedEval> {

}

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleServiceLifeService.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.service;

import com.ningdatech.carapi.analysis.entity.VehicleServiceLife;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* <p>
* 车辆使用年限 服务类
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
public interface IVehicleServiceLifeService extends IService<VehicleServiceLife> {

}

+ 16
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleViolationEvalService.java View File

@@ -0,0 +1,16 @@
package com.ningdatech.carapi.analysis.service;

import com.ningdatech.carapi.analysis.entity.VehicleViolationEval;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* <p>
* 车辆违章情况评估 服务类
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
public interface IVehicleViolationEvalService extends IService<VehicleViolationEval> {

}

+ 25
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisCarService.java View File

@@ -0,0 +1,25 @@
package com.ningdatech.carapi.analysis.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.carapi.analysis.entity.WarnAnalysisCar;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.carapi.analysis.entity.req.WarnAnalysisListReq;

import java.util.List;

/**
* <p>
* 车辆综合预警分析 服务类
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
public interface IWarnAnalysisCarService extends IService<WarnAnalysisCar> {

Page<WarnAnalysisCar> pageCarAnalysis(Page<WarnAnalysisCar> page, WarnAnalysisListReq req);

List<WarnAnalysisCar> listCarAnalysis(WarnAnalysisListReq req);

Integer saveBatchXml(List<WarnAnalysisCar> singleList);
}

+ 23
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisCompanyService.java View File

@@ -0,0 +1,23 @@
package com.ningdatech.carapi.analysis.service;

import com.ningdatech.carapi.analysis.entity.WarnAnalysisCar;
import com.ningdatech.carapi.analysis.entity.WarnAnalysisCompany;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.carapi.analysis.entity.req.WarnAnalysisListReq;

import java.util.List;

/**
* <p>
* 企业综合预警分析 服务类
* </p>
*
* @author WendyYang
* @since 2022-10-14
*/
public interface IWarnAnalysisCompanyService extends IService<WarnAnalysisCompany> {

List<WarnAnalysisCompany> listCompanyAnalysis(WarnAnalysisListReq req);

Integer saveBatchXml(List<WarnAnalysisCompany> singleList);
}

+ 22
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisDriverService.java View File

@@ -0,0 +1,22 @@
package com.ningdatech.carapi.analysis.service;

import com.ningdatech.carapi.analysis.entity.WarnAnalysisDriver;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.carapi.analysis.entity.req.WarnAnalysisListReq;

import java.util.List;

/**
* <p>
* 驾驶员综合预警分析 服务类
* </p>
*
* @author WendyYang
* @since 2022-11-01
*/
public interface IWarnAnalysisDriverService extends IService<WarnAnalysisDriver> {

List<WarnAnalysisDriver> listDriverAnalysis(WarnAnalysisListReq warnAnalysisListReq);

Integer saveBatchXml(List<WarnAnalysisDriver> singleList);
}

+ 30
- 0
ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/IndustryStandardsServiceImpl.java View File

@@ -0,0 +1,30 @@
package com.ningdatech.carapi.analysis.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.carapi.analysis.entity.IndustryStandards;
import com.ningdatech.carapi.analysis.mapper.IndustryStandardsMapper;
import com.ningdatech.carapi.analysis.service.IIndustryStandardsService;
import org.springframework.stereotype.Service;

/**
* <p>
* 服务实现类
* </p>
*
* @author WendyYang
* @since 2022-10-15
*/
@Service
public class IndustryStandardsServiceImpl extends ServiceImpl<IndustryStandardsMapper, IndustryStandards> implements IIndustryStandardsService {

@Override
public boolean incrementDownCount(Long id) {
return baseMapper.incrementDownCount(id) > 0;
}

@Override
public void deleteById(Long id) {
baseMapper.deleteById(id);
}

}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save