diff --git a/ningda-generator/pom.xml b/ningda-generator/pom.xml new file mode 100644 index 0000000..07a6592 --- /dev/null +++ b/ningda-generator/pom.xml @@ -0,0 +1,34 @@ + + + + com.ningdatech + ningda-yw-road + 1.0.0 + + 4.0.0 + + ningda-generator + + + + com.baomidou + mybatis-plus-boot-starter + + + com.baomidou + mybatis-plus-generator + ${mybatis.plus.version} + + + org.freemarker + freemarker + + + + mysql + mysql-connector-java + + + diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeConfig.java new file mode 100644 index 0000000..258b697 --- /dev/null +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeConfig.java @@ -0,0 +1,65 @@ +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 PATH_CMM = "D:\\work\\yw-road\\nd-yw-road\\ningda-yw-api\\src\\main\\java"; + + private static final String URL = "jdbc:mysql://47.98.125.47:3306/nd-yw-road?serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false"; + private static final String USER_NAME = "root"; + private static final String PASSWORD = "Ndkj@1104"; + + 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_radar_original_data"); + } + +} diff --git a/ningda-yw-api/pom.xml b/ningda-yw-api/pom.xml new file mode 100644 index 0000000..a51600a --- /dev/null +++ b/ningda-yw-api/pom.xml @@ -0,0 +1,325 @@ + + + 4.0.0 + + com.ningdatech + ningda-yw-road + 1.0.0 + + ningda-yw-api + 1.0.0 + + + + com.alibaba + easyexcel + + + org.apache.poi + poi + + + org.apache.poi + poi-ooxml + + + org.apache.poi + poi-ooxml-schemas + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + org.jxls + jxls-jexcel + 1.0.6 + + + com.ningdatech + nd-openapi-signature-starter + + + org.springframework.boot + spring-boot-starter-jdbc + + + + org.springframework.boot + spring-boot-devtools + true + true + + + com.ningdatech + nd-basic + 1.0.0 + + + org.slf4j + slf4j-log4j12 + + + + + + com.ningdatech + nd-swagger2-starter + + + org.slf4j + slf4j-log4j12 + + + + + + mysql + mysql-connector-java + + + org.springframework.boot + spring-boot-starter-validation + + + io.krakens + java-grok + 0.1.9 + + + org.apache.httpcomponents + httpclient + + + + org.springframework.session + spring-session-data-redis + + + com.ningdatech + nd-cache-starter + 1.0.0 + + + org.slf4j + slf4j-log4j12 + + + + + + com.baomidou + mybatis-plus-boot-starter + + + org.apache.poi + poi + 4.1.2 + + + org.apache.poi + poi-ooxml + 4.1.2 + + + org.apache.tomcat.embed + tomcat-embed-core + + + com.ningdatech + nd-log-starter + 1.0.0 + + + com.ningdatech + nd-file-starter + 1.0.0 + + + + + + + org.springframework.boot + spring-boot-starter-integration + + + org.springframework.integration + spring-integration-stream + + + org.springframework.integration + spring-integration-mqtt + + + junit + junit + test + + + + org.springframework.boot + spring-boot-starter-data-redis + + + com.aliyun + aliyun-java-sdk-dysmsapi + 1.1.0 + + + nd-sms-send-starter + com.ningdatech + 1.0.0 + + + javax.persistence + javax.persistence-api + 2.2 + + + + + fr.opensagres.xdocreport + fr.opensagres.xdocreport.core + 2.0.2 + + + fr.opensagres.xdocreport + fr.opensagres.xdocreport.document + 2.0.2 + + + fr.opensagres.xdocreport + fr.opensagres.xdocreport.template + 2.0.2 + + + fr.opensagres.xdocreport + fr.opensagres.xdocreport.document.docx + 2.0.2 + + + fr.opensagres.xdocreport + fr.opensagres.xdocreport.template.freemarker + 2.0.2 + + + org.springframework + spring-test + + + + cn.afterturn + easypoi-base + + + + + + redis.clients + jedis + 3.7.0 + + + + com.fasterxml.jackson.core + jackson-databind + 2.12.3 + + + + + + + + + + dev + + + dev + + + + test + + test + + + + pre + + pre + + + + prod + + prod + + + + + + + + src/main/resources + + **/* + + + + src/main/java + + **/*.xml + + + + src/main/lib + BOOT-INF/lib/ + + **/*.jar + + + + + src/main/resources + BOOT-INF/classes/ + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + 2.1.12.RELEASE + + true + + + + + repackage + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/App.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/App.java new file mode 100644 index 0000000..69dba50 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/App.java @@ -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); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/common/DangerLevelEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/common/DangerLevelEnum.java new file mode 100644 index 0000000..536af96 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/common/DangerLevelEnum.java @@ -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); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/AnalysisEvalDataViewController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/AnalysisEvalDataViewController.java new file mode 100644 index 0000000..4c9c3ee --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/AnalysisEvalDataViewController.java @@ -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; + +/** + *

+ * AnalysisEvalDataViewController + *

+ * + * @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 insuranceOrgStatistics(@PathVariable Long regionId) { + regionId = CodeUtil.convertRegionCodeToId(regionId); + return analysisEvalDataViewManage.insuranceOrgStatistics(regionId); + } + + @GetMapping("/companyWarnStatistics/{regionId}") + @ApiOperation("企业综合预警分析") + public List companyWarnStatistics(@PathVariable Long regionId) { + regionId = CodeUtil.convertRegionCodeToId(regionId); + return analysisEvalDataViewManage.companyWarnStatistics(regionId); + } + + @GetMapping("/companyWarnStatisticsByLevel") + @ApiOperation("企业红色预警") + public List 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 carWarnStatistics(@PathVariable Long regionId) { + regionId = CodeUtil.convertRegionCodeToId(regionId); + return analysisEvalDataViewManage.carWarnStatistics(regionId); + } + + @GetMapping("/carWarnStatisticsByLevel") + @ApiOperation("车辆红色预警") + public List 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); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/IndustryStandardsController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/IndustryStandardsController.java new file mode 100644 index 0000000..f0bf5fd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/IndustryStandardsController.java @@ -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; + +/** + *

+ * 前端控制器 + *

+ * + * @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 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); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/InsuranceRiskEvalController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/InsuranceRiskEvalController.java new file mode 100644 index 0000000..6ec224c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/InsuranceRiskEvalController.java @@ -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; + +/** + *

+ * 分析评估-保险风险评估 前端控制器 + *

+ * + * @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 vehicleServiceLifeList(@Valid VehicleServiceLifeListReq req) { + return insuranceRiskEvalManage.vehicleServiceLifeList(req); + } + + @ApiOperation("车辆违章情况列表") + @GetMapping("/vehicleViolationList") + public PageVo vehicleViolationList(@Valid VehicleServiceLifeListReq req) { + return insuranceRiskEvalManage.vehicleViolationEvalList(req); + } + + @ApiOperation("车辆出险情况列表") + @GetMapping("/vehicleAccidentList") + public PageVo vehicleAccidentList(@Valid VehicleServiceLifeListReq req) { + return insuranceRiskEvalManage.vehicleAccidentList(req); + } + + @ApiOperation("车辆超速情况列表") + @GetMapping("/vehicleOverSPeedList") + public PageVo 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); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/SecurityAnalysisEvalController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/SecurityAnalysisEvalController.java new file mode 100644 index 0000000..5c78771 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/SecurityAnalysisEvalController.java @@ -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; + +/** + *

+ * 安全管理综合评级 前端控制器 + *

+ * + * @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 listSecurityManageGrade(SecurityManageGradeListReq req) { + return securityAnalysisEvalManage.list(req); + } + + @GetMapping("/sre/list") + @ApiOperation("安全责任体系分析评估列表") + public PageVo listSecurityRiskEval(SecurityRiskEvalListReq req) { + return securityAnalysisEvalManage.list(req); + } + + @PostMapping("/sre/save") + @ApiOperation("新增安全责任体系分析评估") + public IdVo save(@Valid @RequestBody SecurityRiskEvalSaveReq req) { + return securityAnalysisEvalManage.save(req); + } + + @GetMapping("/ibe/list") + @ApiOperation("安全制度建设分析评估列表") + public PageVo listInstitutionBuildingEval(SecurityRiskEvalListReq req) { + return securityAnalysisEvalManage.listSystemBuildingEval(req); + } + + @PostMapping("/ibe/save") + @ApiOperation("保存安全制度建设分析评估") + public IdVo save(@Valid @RequestBody SecuritySystemBuildingEvalSaveReq req) { + return securityAnalysisEvalManage.save(req); + } + + @GetMapping("/smre/list") + @ApiOperation("安全管理结果分析评估列表") + public PageVo listSecurityManageResultEval(SecurityRiskEvalListReq req) { + return securityAnalysisEvalManage.listSecurityManageResultEval(req); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/WarnAnalysisController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/WarnAnalysisController.java new file mode 100644 index 0000000..1f52704 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/controller/WarnAnalysisController.java @@ -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; + +/** + *

+ * 综合预警分析 前端控制器 + *

+ * + * @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 listWarnAnalysisCar(WarnAnalysisListReq req) { + return warnAnalysisManage.listCarWarnAnalysis(req); + } + + @ApiOperation("企业综合预警分析列表") + @GetMapping("/listCompanyWarnAnalysis") + public PageVo listWarnAnalysisCompany(WarnAnalysisListReq req) { + return warnAnalysisManage.listCompanyWarnAnalysis(req); + } + + @ApiOperation("驾驶员综合预警分析列表") + @GetMapping("/listDriverWarnAnalysis") + public PageVo listDriverWarnAnalysis(WarnAnalysisListReq req) { + return warnAnalysisManage.listDriverWarnAnalysis(req); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/IndustryStandards.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/IndustryStandards.java new file mode 100644 index 0000000..9c05069 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/IndustryStandards.java @@ -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; + +/** + *

+ * 行业标准 + *

+ * + * @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; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityManageGrade.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityManageGrade.java new file mode 100644 index 0000000..48f9eb1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityManageGrade.java @@ -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; + +/** + *

+ * 安全管理综合评级 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityManageResultEval.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityManageResultEval.java new file mode 100644 index 0000000..79e745c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityManageResultEval.java @@ -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; + +/** + *

+ * 安全制度建设分析评估 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityRiskEval.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityRiskEval.java new file mode 100644 index 0000000..167f8db --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecurityRiskEval.java @@ -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; + +/** + *

+ * 安全责任体系分析评估 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecuritySystemBuildingEval.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecuritySystemBuildingEval.java new file mode 100644 index 0000000..1fd79dd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/SecuritySystemBuildingEval.java @@ -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; + +/** + *

+ * 安全制度建设分析评估 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleAccidentEval.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleAccidentEval.java new file mode 100644 index 0000000..841eae9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleAccidentEval.java @@ -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; + +/** + *

+ * 车辆事故情况评估 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleOverSpeedEval.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleOverSpeedEval.java new file mode 100644 index 0000000..e52dfd6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleOverSpeedEval.java @@ -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; + +/** + *

+ * 车辆超速情况评估 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleServiceLife.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleServiceLife.java new file mode 100644 index 0000000..d8954c2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleServiceLife.java @@ -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; + +/** + *

+ * 车辆使用年限 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleViolationEval.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleViolationEval.java new file mode 100644 index 0000000..e993b1d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/VehicleViolationEval.java @@ -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; + +/** + *

+ * 车辆违章情况评估 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisCar.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisCar.java new file mode 100644 index 0000000..27e5013 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisCar.java @@ -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; + +/** + *

+ * 车辆综合预警分析 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisCompany.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisCompany.java new file mode 100644 index 0000000..8a2de0f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisCompany.java @@ -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; + +/** + *

+ * 企业综合预警分析 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisDriver.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisDriver.java new file mode 100644 index 0000000..615b913 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/WarnAnalysisDriver.java @@ -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; + +/** + *

+ * 驾驶员综合预警分析 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/CompanyWarnStatisticsDto.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/CompanyWarnStatisticsDto.java new file mode 100644 index 0000000..dd737cd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/CompanyWarnStatisticsDto.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.analysis.entity.dto; + +import lombok.Data; + +/** + *

+ * CompanyWarnStatisticsDto + *

+ * + * @author WendyYang + * @since 16:18 2022/10/25 + */ +@Data +public class CompanyWarnStatisticsDto { + + private Integer count; + + private Long regionId; + + private Integer dangerLevel; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/OutDangerImportDto.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/OutDangerImportDto.java new file mode 100644 index 0000000..2c2d9f4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/OutDangerImportDto.java @@ -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; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleAccidentImportDto.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleAccidentImportDto.java new file mode 100644 index 0000000..d82f2a5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleAccidentImportDto.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.analysis.entity.dto; + +import lombok.Data; + +/** + *

+ * VehicleAccidentImportDto + *

+ * + * @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; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleOverSpeedImportDto.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleOverSpeedImportDto.java new file mode 100644 index 0000000..752b234 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleOverSpeedImportDto.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.analysis.entity.dto; + +import lombok.Data; + +/** + *

+ * VehicleOverSpeedDto + *

+ * + * @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; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleViolationImportDto.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleViolationImportDto.java new file mode 100644 index 0000000..4e2e328 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/dto/VehicleViolationImportDto.java @@ -0,0 +1,71 @@ +package com.ningdatech.carapi.analysis.entity.dto; + +import lombok.Data; + +/** + *

+ * VehicleViolationImportDto + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/DangerLevel.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/DangerLevel.java new file mode 100644 index 0000000..359f255 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/DangerLevel.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.analysis.entity.enumeration; + +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * DangerLevel + *

+ * + * @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("预警级别编码无效")); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/IndustryStandardsType.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/IndustryStandardsType.java new file mode 100644 index 0000000..da0598d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/IndustryStandardsType.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.analysis.entity.enumeration; + +import lombok.Getter; + +/** + *

+ * IndustryStandardsType + *

+ * + * @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; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/InsuranceDangerLevel.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/InsuranceDangerLevel.java new file mode 100644 index 0000000..5e233eb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/enumeration/InsuranceDangerLevel.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.analysis.entity.enumeration; + +import lombok.Getter; + +/** + *

+ * 保险风险评估-风险等级枚举 + *

+ * + * @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; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/IndustryStandardsListReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/IndustryStandardsListReq.java new file mode 100644 index 0000000..659c7b7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/IndustryStandardsListReq.java @@ -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; + +/** + *

+ * IndustryStandardsListReq + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/IndustryStandardsSaveReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/IndustryStandardsSaveReq.java new file mode 100644 index 0000000..b8803ef --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/IndustryStandardsSaveReq.java @@ -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; + +/** + *

+ * 行业标准新增实体 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityManageGradeListReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityManageGradeListReq.java new file mode 100644 index 0000000..b5b5d0b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityManageGradeListReq.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.analysis.entity.req; + +import com.ningdatech.basic.model.PagePo; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * SecurityManagementGradeListReq + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityRiskEvalListReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityRiskEvalListReq.java new file mode 100644 index 0000000..4a33ffb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityRiskEvalListReq.java @@ -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; + +/** + *

+ * SecurityRiskEvaluationListReq + *

+ * + * @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 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])); + } + } + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityRiskEvalSaveReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityRiskEvalSaveReq.java new file mode 100644 index 0000000..4716bf3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecurityRiskEvalSaveReq.java @@ -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; + +/** + *

+ * 安全责任体系分析评估 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecuritySystemBuildingEvalSaveReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecuritySystemBuildingEvalSaveReq.java new file mode 100644 index 0000000..09a046c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/SecuritySystemBuildingEvalSaveReq.java @@ -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; + +/** + *

+ * 安全制度建设分析评估新增参数类 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleAccidentEvalModReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleAccidentEvalModReq.java new file mode 100644 index 0000000..a904ed8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleAccidentEvalModReq.java @@ -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; + +/** + *

+ * 车辆出险情况修改参数 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleOverSpeedEvalModReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleOverSpeedEvalModReq.java new file mode 100644 index 0000000..859f1df --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleOverSpeedEvalModReq.java @@ -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; + +/** + *

+ * 车辆超速情况修改参数 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleServiceLifeListReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleServiceLifeListReq.java new file mode 100644 index 0000000..c00d609 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleServiceLifeListReq.java @@ -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; + +/** + *

+ * VehicleServiceLifeListReq + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleViolationEvalModReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleViolationEvalModReq.java new file mode 100644 index 0000000..fb81664 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/VehicleViolationEvalModReq.java @@ -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; + +/** + *

+ * 车辆违章情况修改参数 + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/WarnAnalysisListReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/WarnAnalysisListReq.java new file mode 100644 index 0000000..0f31ffb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/req/WarnAnalysisListReq.java @@ -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; + +/** + *

+ * WarnAnalysisListReq + *

+ * + * @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 regionIds; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("风险等级") + private Integer dangerLevel; + + @ApiModelProperty("车牌号") + private String carNo; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + private String dataScopeSql; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/CompanyWarnStatisticsVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/CompanyWarnStatisticsVo.java new file mode 100644 index 0000000..f3c650b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/CompanyWarnStatisticsVo.java @@ -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; + +/** + *

+ * CompanyWarnStatisticsVo + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/IndustryStandardsListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/IndustryStandardsListVo.java new file mode 100644 index 0000000..7188be9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/IndustryStandardsListVo.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.analysis.entity.vo; + +import lombok.Data; + +import java.time.LocalDateTime; + +/** + *

+ * IndustryStandardsListVo + *

+ * + * @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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityManageGradeVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityManageGradeVo.java new file mode 100644 index 0000000..4df5637 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityManageGradeVo.java @@ -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; + +/** + *

+ * 安全管理综合评级列表视图类 + *

+ * + * @author WendyYang + * @since 14:41 2022/10/13 + */ +@Data +@ApiModel("安全管理综合评级列表视图类") +public class SecurityManageGradeVo { + + @ApiModelProperty("所属地区") + private List regions; + + @ApiModelProperty("年度") + private Integer year; + + @ApiModelProperty("企业编码") + private Long companyId; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("安全评级") + private String securityLevel; + + @ApiModelProperty("综合得分") + private Integer score; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityManageResultEvalListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityManageResultEvalListVo.java new file mode 100644 index 0000000..113479c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityManageResultEvalListVo.java @@ -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; + +/** + *

+ * 安全制度建设分析评估 + *

+ * + * @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 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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityRiskEvalListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityRiskEvalListVo.java new file mode 100644 index 0000000..b69053c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecurityRiskEvalListVo.java @@ -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; + +/** + *

+ * SecurityRiskEvaluationListVo + *

+ * + * @author WendyYang + * @since 10:17 2022/10/14 + */ +@Data +@Builder +@ApiModel("安全责任分析评估列表视图类") +public class SecurityRiskEvalListVo { + + @Tolerate + public SecurityRiskEvalListVo() { + } + + @ApiModelProperty("所属地区") + private List 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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecuritySystemBuildingEvalListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecuritySystemBuildingEvalListVo.java new file mode 100644 index 0000000..b75760c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/SecuritySystemBuildingEvalListVo.java @@ -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; + +/** + *

+ * 安全制度建设分析评估列表视图类 + *

+ * + * @author WendyYang + * @since 10:17 2022/10/14 + */ +@Data +@Builder +@ApiModel("安全制度建设分析评估列表视图类") +public class SecuritySystemBuildingEvalListVo { + + @Tolerate + public SecuritySystemBuildingEvalListVo() { + } + + @ApiModelProperty("所属地区") + private List regions; + + @ApiModelProperty("年度") + private Integer year; + + @ApiModelProperty("企业编码") + private Long companyId; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("总分值") + private Integer totalScore; + + @ApiModelProperty("检查内容") + private String checkContent; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleAccidentEvalListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleAccidentEvalListVo.java new file mode 100644 index 0000000..c5b6e71 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleAccidentEvalListVo.java @@ -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; + +/** + *

+ * 车辆出险情况评估列表视图类 + *

+ * + * @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 regions; + + @ApiModelProperty("万公里出险次数") + private Integer avgAccidentCount; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleOverSpeedEvalListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleOverSpeedEvalListVo.java new file mode 100644 index 0000000..b79a888 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleOverSpeedEvalListVo.java @@ -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; + +/** + *

+ * 车辆超速情况评估列表视图类 + *

+ * + * @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 regions; + + @ApiModelProperty("万公里超速次数") + private Integer avgOverSpeedCount; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleServiceLifeListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleServiceLifeListVo.java new file mode 100644 index 0000000..5e4bb78 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleServiceLifeListVo.java @@ -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; + +/** + *

+ * 车辆使用年限列表视图类 + *

+ * + * @author WendyYang + * @since 2022-10-15 + */ +@Data +@Builder +@ApiModel("车辆使用年限列表视图类") +public class VehicleServiceLifeListVo { + + @Tolerate + public VehicleServiceLifeListVo() { + } + + @ApiModelProperty("主键") + private Integer id; + + @ApiModelProperty("地域信息") + private List 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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleViolationEvalListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleViolationEvalListVo.java new file mode 100644 index 0000000..c641366 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/VehicleViolationEvalListVo.java @@ -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; + +/** + *

+ * 车辆违章情况评估列表视图类 + *

+ * + * @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 regions; + + @ApiModelProperty("万公里违章次数") + private Integer avgViolationCount; + + @ApiModelProperty("备注") + private String remark; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByCarVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByCarVo.java new file mode 100644 index 0000000..a26fc76 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByCarVo.java @@ -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; + +/** + *

+ * 车辆综合预警分析 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +@Data +@ApiModel(value = "车辆综合预警分析列表视图类", description = "") +public class WarnAnalysisByCarVo { + + @ApiModelProperty("主键") + private Integer id; + + @ApiModelProperty("地区ID") + private List 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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByCompanyVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByCompanyVo.java new file mode 100644 index 0000000..067b90d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByCompanyVo.java @@ -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; + +/** + *

+ * 企业综合预警分析列表视图类 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +@Data +@ApiModel("企业综合预警分析列表视图类") +public class WarnAnalysisByCompanyVo { + + @ApiModelProperty("主键") + private Integer id; + + private List 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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByDriverVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByDriverVo.java new file mode 100644 index 0000000..3a80e10 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/entity/vo/WarnAnalysisByDriverVo.java @@ -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; + +/** + *

+ * 驾驶员综合预警分析列表视图类 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +@Data +@ApiModel("驾驶员综合预警分析列表视图类") +public class WarnAnalysisByDriverVo { + + + @ApiModelProperty("主键") + private Integer id; + + @ApiModelProperty("地区ID") + private List 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; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/AnalysisEvalDataViewManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/AnalysisEvalDataViewManage.java new file mode 100644 index 0000000..eabfa5e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/AnalysisEvalDataViewManage.java @@ -0,0 +1,312 @@ +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.google.common.collect.Lists; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.analysis.common.DangerLevelEnum; +import com.ningdatech.carapi.analysis.entity.WarnAnalysisCar; +import com.ningdatech.carapi.analysis.entity.WarnAnalysisCompany; +import com.ningdatech.carapi.analysis.entity.enumeration.DangerLevel; +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.function.ToIntFunction; +import java.util.stream.Collectors; + +/** + *

+ * DataViewController + *

+ * + * @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 insuranceOrgStatistics(Long regionId) { + List childIds = regionsCacheHelper.listChildRegionId(regionId); + QueryWrapper 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> maps = insureInfoService.listMaps(query); + if (maps.isEmpty()) { + return Collections.emptyList(); + } + int total = CollUtils.sum(maps, (ToIntFunction>) 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 companyWarnStatistics(Long regionId) { + List regionIds = regionsCacheHelper.listChildRegionId(regionId); + QueryWrapper query = Wrappers.query(); + query.select("company_id companyId, danger_level dangerLevel"); + query.in("region_id", regionIds); + List> analysisCompanies = companyWarnAnalysisService.listMaps(query); + if (analysisCompanies.size() == 0) { + return Collections.emptyList(); + } + List 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 carWarnStatistics(Long regionId) { + List regionIds = regionsCacheHelper.listChildRegionId(regionId); + QueryWrapper query = Wrappers.query(); + query.select("count(1) `count`, region_id regionId"); + query.in("region_id", regionIds); + query.groupBy("region_id"); + List> carAnalysis = carWarnAnalysisService.listMaps(query); + if (carAnalysis.size() == 0) { + return Collections.emptyList(); + } + Map> childrenMap = regionsCacheHelper.getChildrenMap(regionId, true); + List 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 QueryWrapper buildCountQueryGroupByRegion(List regionIds, Integer dangerLevel) { + QueryWrapper query = Wrappers.query(); + query.select("count(1) as `count`, region_id as regionId"); + query.in("region_id", regionIds); + query.eq(Objects.nonNull(dangerLevel),"danger_level", dangerLevel); + query.groupBy("region_id"); + return query; + } + + public List companyWarnStatisticsByLevel(Long regionId, Integer dangerLevel) { + List result = new ArrayList<>(); + List regionIds = regionsCacheHelper.listChildRegionId(regionId); + //QueryWrapper query = buildCountQueryGroupByRegion(regionIds, dangerLevel); + //List> analysisCompanies = companyWarnAnalysisService.listMaps(query); + + // 获取红色预警的数据 + QueryWrapper queryRed = buildCountQueryGroupByRegion(regionIds, DangerLevel.RED.getCode()); + List> analysisCompaniesRed = companyWarnAnalysisService.listMaps(queryRed); + // 获取橙色预警的数据 + QueryWrapper queryOrange = buildCountQueryGroupByRegion(regionIds, DangerLevel.ORANGE.getCode()); + List> analysisCompaniesOrange = companyWarnAnalysisService.listMaps(queryOrange); + // 获取黄色预警的数据 + QueryWrapper queryYellow = buildCountQueryGroupByRegion(regionIds, DangerLevel.YELLOW.getCode()); + List> analysisCompaniesYellow = companyWarnAnalysisService.listMaps(queryYellow); + // 获取蓝色预警的数据 + QueryWrapper queryBlue = buildCountQueryGroupByRegion(regionIds, DangerLevel.BLUE.getCode()); + List> analysisCompaniesBlue = companyWarnAnalysisService.listMaps(queryBlue); + + Map> childrenMap = regionsCacheHelper.getChildrenMap(regionId, true); + // 如果是区县一级的,只返回区县一级的名字和数量 + if (childrenMap.size() == 0) { + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + String regionName = regionDto.getRegionName(); + DataChartVo voRed = new DataChartVo(regionName, 0); + analysisCompaniesRed.forEach(w -> { + Long currRegionId = MapUtil.getLong(w, "regionId"); + if (regionId.equals(currRegionId)) { + voRed.setValue(voRed.getValue() + MapUtil.getInt(w, "count")); + voRed.setDangerLevel(DangerLevel.RED.getCode()); + } + }); + result.add(voRed); + + DataChartVo voOrange = new DataChartVo(regionName, 0); + analysisCompaniesOrange.forEach(w -> { + Long currRegionId = MapUtil.getLong(w, "regionId"); + if (regionId.equals(currRegionId)) { + voOrange.setValue(voOrange.getValue() + MapUtil.getInt(w, "count")); + voOrange.setDangerLevel(DangerLevel.ORANGE.getCode()); + } + }); + result.add(voOrange); + + DataChartVo voYellow = new DataChartVo(regionName, 0); + analysisCompaniesYellow.forEach(w -> { + Long currRegionId = MapUtil.getLong(w, "regionId"); + if (regionId.equals(currRegionId)) { + voYellow.setValue(voYellow.getValue() + MapUtil.getInt(w, "count")); + voYellow.setDangerLevel(DangerLevel.YELLOW.getCode()); + } + }); + result.add(voYellow); + + DataChartVo voBlue = new DataChartVo(regionName, 0); + analysisCompaniesBlue.forEach(w -> { + Long currRegionId = MapUtil.getLong(w, "regionId"); + if (regionId.equals(currRegionId)) { + voBlue.setValue(voBlue.getValue() + MapUtil.getInt(w, "count")); + voBlue.setDangerLevel(DangerLevel.BLUE.getCode()); + } + }); + result.add(voBlue); + return result; + } else { + childrenMap.forEach((k, v) -> { + DataChartVo voRed = new DataChartVo(k.getRegionName(), 0); + analysisCompaniesRed.forEach(w -> { + Long currRegionId = MapUtil.getLong(w, "regionId"); + if (v.contains(currRegionId)) { + voRed.setValue(voRed.getValue() + MapUtil.getInt(w, "count")); + voRed.setDangerLevel(DangerLevel.RED.getCode()); + } + }); + result.add(voRed); + + DataChartVo voOrange = new DataChartVo(k.getRegionName(), 0); + analysisCompaniesOrange.forEach(w -> { + Long currRegionId = MapUtil.getLong(w, "regionId"); + if (v.contains(currRegionId)) { + voOrange.setValue(voOrange.getValue() + MapUtil.getInt(w, "count")); + voOrange.setDangerLevel(DangerLevel.ORANGE.getCode()); + } + }); + result.add(voOrange); + + DataChartVo voYellow = new DataChartVo(k.getRegionName(), 0); + analysisCompaniesYellow.forEach(w -> { + Long currRegionId = MapUtil.getLong(w, "regionId"); + if (v.contains(currRegionId)) { + voYellow.setValue(voYellow.getValue() + MapUtil.getInt(w, "count")); + voYellow.setDangerLevel(DangerLevel.YELLOW.getCode()); + } + }); + result.add(voYellow); + + DataChartVo voBlue = new DataChartVo(k.getRegionName(), 0); + analysisCompaniesBlue.forEach(w -> { + Long currRegionId = MapUtil.getLong(w, "regionId"); + if (v.contains(currRegionId)) { + voBlue.setValue(voBlue.getValue() + MapUtil.getInt(w, "count")); + voBlue.setDangerLevel(DangerLevel.BLUE.getCode()); + } + }); + result.add(voBlue); + }); + return result; + } + } + + public List carWarnStatisticsByLevel(Long regionId, Integer dangerLevel) { + List result = new ArrayList<>(); + List regionIds = regionsCacheHelper.listChildRegionId(regionId); + List> analysisCompanies = Lists.newArrayList(); + // 获取红色预警的数据 + QueryWrapper queryRed = buildCountQueryGroupByRegion(regionIds, DangerLevel.RED.getCode()); + List> analysisCompaniesRed = carWarnAnalysisService.listMaps(queryRed); + // 获取橙色预警的数据 + QueryWrapper queryOrange = buildCountQueryGroupByRegion(regionIds, DangerLevel.ORANGE.getCode()); + List> analysisCompaniesOrange = carWarnAnalysisService.listMaps(queryOrange); + // 获取黄色预警的数据 + QueryWrapper queryYellow = buildCountQueryGroupByRegion(regionIds, DangerLevel.YELLOW.getCode()); + List> analysisCompaniesYellow = carWarnAnalysisService.listMaps(queryYellow); + // 获取蓝色预警的数据 + QueryWrapper queryBlue = buildCountQueryGroupByRegion(regionIds, DangerLevel.BLUE.getCode()); + List> analysisCompaniesBlue = carWarnAnalysisService.listMaps(queryBlue); + Map> childrenMap = regionsCacheHelper.getChildrenMap(regionId, true); + childrenMap.forEach((k, v) -> { + DataChartVo voRed = new DataChartVo(k.getRegionName(), 0); + analysisCompaniesRed.forEach(w -> { + Long currRegionId = MapUtil.getLong(w, "regionId"); + if (v.contains(currRegionId)) { + voRed.setValue(voRed.getValue() + MapUtil.getInt(w, "count")); + voRed.setDangerLevel(DangerLevel.RED.getCode()); + } + }); + result.add(voRed); + DataChartVo voOrange = new DataChartVo(k.getRegionName(), 0); + analysisCompaniesOrange.forEach(w -> { + Long currRegionId = MapUtil.getLong(w, "regionId"); + if (v.contains(currRegionId)) { + voOrange.setValue(voOrange.getValue() + MapUtil.getInt(w, "count")); + voOrange.setDangerLevel(DangerLevel.ORANGE.getCode()); + } + }); + result.add(voOrange); + DataChartVo voYellow = new DataChartVo(k.getRegionName(), 0); + analysisCompaniesYellow.forEach(w -> { + Long currRegionId = MapUtil.getLong(w, "regionId"); + if (v.contains(currRegionId)) { + voYellow.setValue(voYellow.getValue() + MapUtil.getInt(w, "count")); + voYellow.setDangerLevel(DangerLevel.YELLOW.getCode()); + } + }); + result.add(voYellow); + DataChartVo voBlue = new DataChartVo(k.getRegionName(), 0); + analysisCompaniesBlue.forEach(w -> { + Long currRegionId = MapUtil.getLong(w, "regionId"); + if (v.contains(currRegionId)) { + voBlue.setValue(voBlue.getValue() + MapUtil.getInt(w, "count")); + voBlue.setDangerLevel(DangerLevel.BLUE.getCode()); + } + }); + result.add(voBlue); + }); + return result; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/IndustryStandardsManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/IndustryStandardsManage.java new file mode 100644 index 0000000..5f77ecc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/IndustryStandardsManage.java @@ -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; + +/** + *

+ * IndustryStandardsManage + *

+ * + * @author WendyYang + * @since 10:24 2022/10/15 + */ +@Component +@RequiredArgsConstructor +public class IndustryStandardsManage { + + private final IIndustryStandardsService industryStandardsService; + + public PageVo list(IndustryStandardsListReq req) { + Integer pageNumber = req.getPageNumber(); + Integer pageSize = req.getPageSize(); + + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + + LambdaQueryWrapper query = Wrappers.lambdaQuery(IndustryStandards.class); + IndustryStandardsManage context = (IndustryStandardsManage) AopContext.currentProxy(); + context.buildQuery(query,req); + + List standardsList = industryStandardsService.list(query); + // 省级部门上传的文件(上传企业所属区域为省级),按照文件类型,下级账号也要能看到 + if (!UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId)) { + List 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 records = standardsList.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + + //Page page = industryStandardsService.page(req.page(), query); + + List 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 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 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 wrapper, Long id) { + wrapper.eq(IndustryStandards::getId,id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/InsuranceRiskEvalManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/InsuranceRiskEvalManage.java new file mode 100644 index 0000000..f808977 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/InsuranceRiskEvalManage.java @@ -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; + +/** + *

+ * InsuranceRiskEvalManage + *

+ * + * @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 vehicleServiceLifeList(VehicleServiceLifeListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(VehicleServiceLife.class); + InsuranceRiskEvalManage context = (InsuranceRiskEvalManage) AopContext.currentProxy(); + context.buildVehicleServiceLife(query,req); + Page page = vehicleServiceLifeService.page(req.page(), query); + List 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 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 vehicleViolationEvalList(VehicleServiceLifeListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(VehicleViolationEval.class); + InsuranceRiskEvalManage context = (InsuranceRiskEvalManage) AopContext.currentProxy(); + context.buildVehicleViolationEvalQuery(query,req); + buildVehicleViolationEvalQuery(query,req); + Page page = vehicleViolationEvalService.page(req.page(), query); + List 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 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 vehicleAccidentList(VehicleServiceLifeListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(VehicleAccidentEval.class); + InsuranceRiskEvalManage context = (InsuranceRiskEvalManage) AopContext.currentProxy(); + context.buildVehicleAccident(query,req); + Page page = vehicleAccidentEvalService.page(req.page(), query); + List 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 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 vehicleOverSpeedList(VehicleServiceLifeListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(VehicleOverSpeedEval.class); + InsuranceRiskEvalManage context = (InsuranceRiskEvalManage) AopContext.currentProxy(); + context.buildVehicleOverSpeed(query,req); + Page page = vehicleOverSpeedEvalService.page(req.page(), query); + List 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 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 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 wrapper, Integer id) { + wrapper.eq(VehicleViolationEval::getId,id); + } + + public void vehicleAccidentEvalDel(Integer id) { + LambdaQueryWrapper 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 wrapper, Integer id) { + wrapper.eq(VehicleAccidentEval::getId,id); + } + + public void vehicleOverSpeedEvalDel(Integer id) { + LambdaQueryWrapper 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 wrapper, Integer id) { + wrapper.eq(VehicleOverSpeedEval::getId,id); + } + + private void importVehicleViolationData(List importDataList) { + if (CollectionUtils.isEmpty(importDataList)) { + return; + } + List violationEvalList = new ArrayList<>(); + List carNos = CollUtils.fieldList(importDataList, VehicleViolationImportDto::getCarNo); + Assert.isTrue(carNos.size() == importDataList.size(), "车牌号不可重复"); + Map carInfoMap = vehicleBaseInfoService.listByCarNo(carNos); + Assert.isTrue(carNos.size() == carInfoMap.size(), "请确保所有车牌号存在"); + List companyIds = CollUtils.fieldList(carInfoMap.values(), NdVehicleBaseInfo::getCompanyId); + Map 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 delQuery = Wrappers.lambdaQuery(VehicleViolationEval.class) + .in(VehicleViolationEval::getCarNo, carNos); + vehicleViolationEvalService.remove(delQuery); + vehicleViolationEvalService.saveBatch(violationEvalList); + } + + private void importVehicleOverSpeedData(List importDataList) { + if (CollectionUtils.isEmpty(importDataList)) { + return; + } + List carNos = CollUtils.fieldList(importDataList, VehicleOverSpeedImportDto::getCarNo); + Assert.isTrue(carNos.size() == importDataList.size(), "车牌号不可重复"); + Map carInfoMap = vehicleBaseInfoService.listByCarNo(carNos); + Assert.isTrue(carNos.size() == carInfoMap.size(), "请确保所有车牌号存在"); + List companyIds = CollUtils.fieldList(carInfoMap.values(), NdVehicleBaseInfo::getCompanyId); + Map companyMap = companyService.listCompanyByIds(companyIds); + List 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 delQuery = Wrappers.lambdaQuery(VehicleOverSpeedEval.class) + .in(VehicleOverSpeedEval::getCarNo, carNos); + vehicleOverSpeedEvalService.remove(delQuery); + vehicleOverSpeedEvalService.saveBatch(violationEvalList); + } + + private void importVehicleAccidentData(List importDataList) { + if (CollectionUtils.isEmpty(importDataList)) { + return; + } + List carNos = CollUtils.fieldList(importDataList, VehicleAccidentImportDto::getCarNo); + Assert.isTrue(carNos.size() == importDataList.size(), "车牌号不可重复"); + Map carInfoMap = vehicleBaseInfoService.listByCarNo(carNos); + Assert.isTrue(carNos.size() == carInfoMap.size(), "请确保所有车牌号存在"); + List companyIds = CollUtils.fieldList(carInfoMap.values(), NdVehicleBaseInfo::getCompanyId); + Map companyMap = companyService.listCompanyByIds(companyIds); + List 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 delQuery = Wrappers.lambdaQuery(VehicleAccidentEval.class) + .in(VehicleAccidentEval::getCarNo, carNos); + vehicleAccidentEvalService.remove(delQuery); + vehicleAccidentEvalService.saveBatch(violationEvalList); + } + + private void importOutDangerData(List importDataList) { + if (CollectionUtils.isEmpty(importDataList)) { + return; + } + List carNos = CollUtils.fieldList(importDataList, OutDangerImportDto::getCarNo); + // Assert.isTrue(carNos.size() == importDataList.size(), "车牌号不可重复"); + Map carInfoMap = vehicleBaseInfoService.listByCarNo(carNos); + Assert.isTrue(carNos.size() == carInfoMap.size(), "请确保所有车牌号存在"); + List companyIds = CollUtils.fieldList(carInfoMap.values(), NdVehicleBaseInfo::getCompanyId); + Map companyMap = companyService.listCompanyByIds(companyIds); + Map insureCompanyInfoMap = insureInfoService.listInsureCompanyByCompanyIds(companyIds); + + List 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 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 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 alias; + List 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); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/SecurityAnalysisEvalManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/SecurityAnalysisEvalManage.java new file mode 100644 index 0000000..dac8e43 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/SecurityAnalysisEvalManage.java @@ -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; + +/** + *

+ * SecurityAnalysisEvalManage + *

+ * + * @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 list(SecurityManageGradeListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(SecurityManageGrade.class); + SecurityAnalysisEvalManage context = (SecurityAnalysisEvalManage) AopContext.currentProxy(); + context.buildSecurityManageGradeQuery(query,req); + Page page = securityManagementGradeService.page(req.page(), query); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List res = page.getRecords().stream().map(w -> { + SecurityManageGradeVo gradeVo = BeanUtil.copyProperties(w, SecurityManageGradeVo.class); + List 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 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 list(SecurityRiskEvalListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(SecurityRiskEval.class); + SecurityAnalysisEvalManage context = (SecurityAnalysisEvalManage) AopContext.currentProxy(); + context.buildSecurityRiskEvalQuery(query, req); + Page page = securityRiskEvaluationService.page(req.page(), query); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List res = page.getRecords().stream().map(w -> { + SecurityRiskEvalListVo gradeVo = BeanUtil.copyProperties(w, SecurityRiskEvalListVo.class); + List 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 query, SecurityRiskEvalListReq req) { + if (StringUtils.isNotBlank(req.getCompanyName())) { + query.like(SecurityRiskEval::getCompanyName, req.getCompanyName()); + } + if (req.getScoreRanges() != null) { + Pair 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 listSystemBuildingEval(SecurityRiskEvalListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(SecuritySystemBuildingEval.class); + SecurityAnalysisEvalManage context = (SecurityAnalysisEvalManage) AopContext.currentProxy(); + context.buildSystemBuildingEvalQuery(query, req); + Page page = systemBuildingEvalService.page(req.page(), query); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List res = page.getRecords().stream().map(w -> { + SecuritySystemBuildingEvalListVo gradeVo = BeanUtil.copyProperties(w, SecuritySystemBuildingEvalListVo.class); + List 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 query, SecurityRiskEvalListReq req) { + if (StringUtils.isNotBlank(req.getCompanyName())) { + query.like(SecuritySystemBuildingEval::getCompanyName, req.getCompanyName()); + } + if (req.getScoreRanges() != null) { + Pair 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 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 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 listSecurityManageResultEval(SecurityRiskEvalListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(SecurityManageResultEval.class); + SecurityAnalysisEvalManage context = (SecurityAnalysisEvalManage) AopContext.currentProxy(); + context.buildSecurityManageResultEvalQuery(query, req); + Page page = securityManageResultEvalService.page(req.page(), query); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List res = page.getRecords().stream().map(w -> { + SecurityManageResultEvalListVo gradeVo = BeanUtil.copyProperties(w, SecurityManageResultEvalListVo.class); + List 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 query, SecurityRiskEvalListReq req) { + if (StringUtils.isNotBlank(req.getCompanyName())) { + query.like(SecurityManageResultEval::getCompanyName, req.getCompanyName()); + } + if (req.getScoreRanges() != null) { + Pair 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); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/WarnAnalysisManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/WarnAnalysisManage.java new file mode 100644 index 0000000..4f61238 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/manage/WarnAnalysisManage.java @@ -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; + +/** + *

+ * WarnAnalysisManage + *

+ * + * @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 listCarWarnAnalysis(WarnAnalysisListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(WarnAnalysisCar.class); + WarnAnalysisManage context = (WarnAnalysisManage) AopContext.currentProxy(); + context.buildCarWarnAnalysisQuery(query, req); + Page page = warnAnalysisCarService.page(req.page(), query); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List 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 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 listCompanyWarnAnalysis(WarnAnalysisListReq req) { + String companyName = req.getCompanyName(); + Integer carCount = warnAnalysisCarMapper.selectVehiclesNum(companyName); + LambdaQueryWrapper query = Wrappers.lambdaQuery(WarnAnalysisCompany.class); + WarnAnalysisManage context = (WarnAnalysisManage) AopContext.currentProxy(); + context.buildCompanyWarnAnalysisQuery(query, req); + Page page = warnAnalysisCompanyService.page(req.page(), query); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List 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 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 listDriverWarnAnalysis(WarnAnalysisListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(WarnAnalysisDriver.class); + WarnAnalysisManage context = (WarnAnalysisManage) AopContext.currentProxy(); + context.buildDriverWarnAnalysisQuery(query, req); + Page page = warnAnalysisDriverService.page(req.page(), query); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List 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 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); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/IndustryStandardsMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/IndustryStandardsMapper.java new file mode 100644 index 0000000..9657e90 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/IndustryStandardsMapper.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.analysis.mapper; + +import com.ningdatech.carapi.analysis.entity.IndustryStandards; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-10-15 + */ +public interface IndustryStandardsMapper extends BaseMapper { + + int incrementDownCount(Long id); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/IndustryStandardsMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/IndustryStandardsMapper.xml new file mode 100644 index 0000000..f46e7b1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/IndustryStandardsMapper.xml @@ -0,0 +1,9 @@ + + + + + + update nd_industry_standards set down_count = down_count + 1 where id = #{id} + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/NdInsureOutDangerVOMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/NdInsureOutDangerVOMapper.java new file mode 100644 index 0000000..3ae63ec --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/NdInsureOutDangerVOMapper.java @@ -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 { +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/NdInsureOutDangerVOMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/NdInsureOutDangerVOMapper.xml new file mode 100644 index 0000000..60c8dbe --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/NdInsureOutDangerVOMapper.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageGradeMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageGradeMapper.java new file mode 100644 index 0000000..b512cc6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageGradeMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.mapper; + +import com.ningdatech.carapi.analysis.entity.SecurityManageGrade; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 安全管理综合评级 Mapper 接口 + *

+ * + * @author LiuXinXin + * @since 2022-10-13 + */ +public interface SecurityManageGradeMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageGradeMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageGradeMapper.xml new file mode 100644 index 0000000..ac4d9cf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageGradeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageResultEvalMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageResultEvalMapper.java new file mode 100644 index 0000000..d342383 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageResultEvalMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.mapper; + +import com.ningdatech.carapi.analysis.entity.SecurityManageResultEval; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 安全制度建设分析评估 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +public interface SecurityManageResultEvalMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageResultEvalMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageResultEvalMapper.xml new file mode 100644 index 0000000..3402376 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityManageResultEvalMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityRiskEvalMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityRiskEvalMapper.java new file mode 100644 index 0000000..a314112 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityRiskEvalMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.mapper; + +import com.ningdatech.carapi.analysis.entity.SecurityRiskEval; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 安全责任体系分析评估 Mapper 接口 + *

+ * + * @author LiuXinXin + * @since 2022-10-14 + */ +public interface SecurityRiskEvalMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityRiskEvalMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityRiskEvalMapper.xml new file mode 100644 index 0000000..e1377fa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecurityRiskEvalMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecuritySystemBuildingEvalMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecuritySystemBuildingEvalMapper.java new file mode 100644 index 0000000..f4b7d59 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecuritySystemBuildingEvalMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.analysis.entity.SecuritySystemBuildingEval; + +/** + *

+ * 安全责任体系分析评估 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +public interface SecuritySystemBuildingEvalMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecuritySystemBuildingEvalMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecuritySystemBuildingEvalMapper.xml new file mode 100644 index 0000000..46ee371 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/SecuritySystemBuildingEvalMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleAccidentEvalMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleAccidentEvalMapper.java new file mode 100644 index 0000000..c7b696a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleAccidentEvalMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.mapper; + +import com.ningdatech.carapi.analysis.entity.VehicleAccidentEval; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 车辆事故情况评估 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-10-17 + */ +public interface VehicleAccidentEvalMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleAccidentEvalMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleAccidentEvalMapper.xml new file mode 100644 index 0000000..cfe57cb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleAccidentEvalMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleOverSpeedEvalMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleOverSpeedEvalMapper.java new file mode 100644 index 0000000..0cf0e1f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleOverSpeedEvalMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.mapper; + +import com.ningdatech.carapi.analysis.entity.VehicleOverSpeedEval; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 车辆超速情况评估 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-10-17 + */ +public interface VehicleOverSpeedEvalMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleOverSpeedEvalMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleOverSpeedEvalMapper.xml new file mode 100644 index 0000000..a429d9b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleOverSpeedEvalMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleServiceLifeMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleServiceLifeMapper.java new file mode 100644 index 0000000..11698e3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleServiceLifeMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.mapper; + +import com.ningdatech.carapi.analysis.entity.VehicleServiceLife; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 车辆使用年限 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-10-15 + */ +public interface VehicleServiceLifeMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleServiceLifeMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleServiceLifeMapper.xml new file mode 100644 index 0000000..b02880d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleServiceLifeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleViolationEvalMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleViolationEvalMapper.java new file mode 100644 index 0000000..2720585 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleViolationEvalMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.mapper; + +import com.ningdatech.carapi.analysis.entity.VehicleViolationEval; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 车辆违章情况评估 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-10-15 + */ +public interface VehicleViolationEvalMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleViolationEvalMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleViolationEvalMapper.xml new file mode 100644 index 0000000..679720d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/VehicleViolationEvalMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCarMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCarMapper.java new file mode 100644 index 0000000..25b65f2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCarMapper.java @@ -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; + +/** + *

+ * 车辆综合预警分析 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +public interface WarnAnalysisCarMapper extends BaseMapper { + + Integer selectVehiclesNum(@Param("companyName") String companyName); + + Page pageCarAnalysis(Page page, @Param("param") WarnAnalysisListReq req); + + List listCarAnalysis(@Param("param") WarnAnalysisListReq req); + + Integer saveBatchXml(@Param("singleList") List singleList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCarMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCarMapper.xml new file mode 100644 index 0000000..80aa5ae --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCarMapper.xml @@ -0,0 +1,162 @@ + + + + + + + + + + + + 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 + + ( + #{item.regionId}, + #{item.companyId}, + #{item.companyName}, + #{item.injuredCount}, + #{item.deadCount}, + #{item.dangerCount}, + #{item.dangerScore}, + #{item.carId}, + #{item.carNo}, + #{item.dangerLevel}, + #{item.overSpeedCount}, + #{item.violationCount} + ) + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCompanyMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCompanyMapper.java new file mode 100644 index 0000000..6956984 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCompanyMapper.java @@ -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; + +/** + *

+ * 企业综合预警分析 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +public interface WarnAnalysisCompanyMapper extends BaseMapper { + + List listCompanyAnalysis(@Param("param") WarnAnalysisListReq req); + + Integer saveBatchXml(@Param("singleList") List singleList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCompanyMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCompanyMapper.xml new file mode 100644 index 0000000..004da0f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisCompanyMapper.xml @@ -0,0 +1,95 @@ + + + + + + + + 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 + + ( + #{item.regionId}, + #{item.companyId}, + #{item.companyName}, + #{item.injuredCount}, + #{item.deadCount}, + #{item.dangerCount}, + #{item.totalScore}, + #{item.dangerLevel}, + #{item.violationCount} + ) + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisDriverMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisDriverMapper.java new file mode 100644 index 0000000..22a07aa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisDriverMapper.java @@ -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; + +/** + *

+ * 驾驶员综合预警分析 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-11-01 + */ +public interface WarnAnalysisDriverMapper extends BaseMapper { + + List listDriverAnalysis(@Param("param") WarnAnalysisListReq req); + + Integer saveBatchXml(@Param("singleList") List singleList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisDriverMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisDriverMapper.xml new file mode 100644 index 0000000..ff8923d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/mapper/WarnAnalysisDriverMapper.xml @@ -0,0 +1,87 @@ + + + + + + + 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 + + ( + #{item.regionId}, + #{item.driverId}, + #{item.driverName}, + #{item.companyId}, + #{item.companyName}, + #{item.injuredCount}, + #{item.deadCount}, + #{item.dangerCount}, + #{item.dangerScore}, + #{item.dangerLevel}, + #{item.overSpeedCount}, + #{item.violationCount} + ) + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IIndustryStandardsService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IIndustryStandardsService.java new file mode 100644 index 0000000..54d448d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IIndustryStandardsService.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.analysis.service; + +import com.ningdatech.carapi.analysis.entity.IndustryStandards; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author WendyYang + * @since 2022-10-15 + */ +public interface IIndustryStandardsService extends IService { + + boolean incrementDownCount(Long id); + + void deleteById(Long id); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/INdInsureOutDangerVOService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/INdInsureOutDangerVOService.java new file mode 100644 index 0000000..1fbc4a0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/INdInsureOutDangerVOService.java @@ -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 { +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityManageGradeService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityManageGradeService.java new file mode 100644 index 0000000..f223f50 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityManageGradeService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.service; + +import com.ningdatech.carapi.analysis.entity.SecurityManageGrade; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 安全管理综合评级 服务类 + *

+ * + * @author LiuXinXin + * @since 2022-10-13 + */ +public interface ISecurityManageGradeService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityManageResultEvalService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityManageResultEvalService.java new file mode 100644 index 0000000..4e003eb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityManageResultEvalService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.service; + +import com.ningdatech.carapi.analysis.entity.SecurityManageResultEval; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 安全制度建设分析评估 服务类 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +public interface ISecurityManageResultEvalService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityRiskEvalService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityRiskEvalService.java new file mode 100644 index 0000000..ffabb99 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecurityRiskEvalService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.analysis.entity.SecurityRiskEval; + +/** + *

+ * 安全责任体系分析评估 服务类 + *

+ * + * @author LiuXinXin + * @since 2022-10-14 + */ +public interface ISecurityRiskEvalService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecuritySystemBuildingEvalService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecuritySystemBuildingEvalService.java new file mode 100644 index 0000000..24d4e9d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/ISecuritySystemBuildingEvalService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.service; + +import com.ningdatech.carapi.analysis.entity.SecuritySystemBuildingEval; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 安全责任体系分析评估 服务类 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +public interface ISecuritySystemBuildingEvalService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleAccidentEvalService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleAccidentEvalService.java new file mode 100644 index 0000000..f34757f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleAccidentEvalService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.service; + +import com.ningdatech.carapi.analysis.entity.VehicleAccidentEval; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 车辆事故情况评估 服务类 + *

+ * + * @author WendyYang + * @since 2022-10-17 + */ +public interface IVehicleAccidentEvalService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleOverSpeedEvalService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleOverSpeedEvalService.java new file mode 100644 index 0000000..267aaae --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleOverSpeedEvalService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.service; + +import com.ningdatech.carapi.analysis.entity.VehicleOverSpeedEval; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 车辆超速情况评估 服务类 + *

+ * + * @author WendyYang + * @since 2022-10-17 + */ +public interface IVehicleOverSpeedEvalService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleServiceLifeService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleServiceLifeService.java new file mode 100644 index 0000000..a78d0e8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleServiceLifeService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.service; + +import com.ningdatech.carapi.analysis.entity.VehicleServiceLife; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 车辆使用年限 服务类 + *

+ * + * @author WendyYang + * @since 2022-10-15 + */ +public interface IVehicleServiceLifeService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleViolationEvalService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleViolationEvalService.java new file mode 100644 index 0000000..1529e3f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IVehicleViolationEvalService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.service; + +import com.ningdatech.carapi.analysis.entity.VehicleViolationEval; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 车辆违章情况评估 服务类 + *

+ * + * @author WendyYang + * @since 2022-10-15 + */ +public interface IVehicleViolationEvalService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisCarService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisCarService.java new file mode 100644 index 0000000..de88f03 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisCarService.java @@ -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; + +/** + *

+ * 车辆综合预警分析 服务类 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +public interface IWarnAnalysisCarService extends IService { + + Page pageCarAnalysis(Page page, WarnAnalysisListReq req); + + List listCarAnalysis(WarnAnalysisListReq req); + + Integer saveBatchXml(List singleList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisCompanyService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisCompanyService.java new file mode 100644 index 0000000..4a96dcf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisCompanyService.java @@ -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; + +/** + *

+ * 企业综合预警分析 服务类 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +public interface IWarnAnalysisCompanyService extends IService { + + List listCompanyAnalysis(WarnAnalysisListReq req); + + Integer saveBatchXml(List singleList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisDriverService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisDriverService.java new file mode 100644 index 0000000..ab5c634 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/IWarnAnalysisDriverService.java @@ -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; + +/** + *

+ * 驾驶员综合预警分析 服务类 + *

+ * + * @author WendyYang + * @since 2022-11-01 + */ +public interface IWarnAnalysisDriverService extends IService { + + List listDriverAnalysis(WarnAnalysisListReq warnAnalysisListReq); + + Integer saveBatchXml(List singleList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/IndustryStandardsServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/IndustryStandardsServiceImpl.java new file mode 100644 index 0000000..e541a7d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/IndustryStandardsServiceImpl.java @@ -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; + +/** + *

+ * 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-10-15 + */ +@Service +public class IndustryStandardsServiceImpl extends ServiceImpl implements IIndustryStandardsService { + + @Override + public boolean incrementDownCount(Long id) { + return baseMapper.incrementDownCount(id) > 0; + } + + @Override + public void deleteById(Long id) { + baseMapper.deleteById(id); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/NdInsureOutDangerVOServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/NdInsureOutDangerVOServiceImpl.java new file mode 100644 index 0000000..97fb3d1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/NdInsureOutDangerVOServiceImpl.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.analysis.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.analysis.mapper.NdInsureOutDangerVOMapper; +import com.ningdatech.carapi.analysis.service.INdInsureOutDangerVOService; +import com.ningdatech.carapi.safe.model.vo.NdInsureOutDangerVO; +import org.springframework.stereotype.Service; + +/** + * @author CMM + * @description + * @since 2022/11/16 17:42 + */ +@Service +public class NdInsureOutDangerVOServiceImpl extends ServiceImpl implements INdInsureOutDangerVOService { +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/SecurityManageGradeServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/SecurityManageGradeServiceImpl.java new file mode 100644 index 0000000..b1a6f67 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/SecurityManageGradeServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.analysis.service.impl; + +import com.ningdatech.carapi.analysis.entity.SecurityManageGrade; +import com.ningdatech.carapi.analysis.mapper.SecurityManageGradeMapper; +import com.ningdatech.carapi.analysis.service.ISecurityManageGradeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 安全管理综合评级 服务实现类 + *

+ * + * @author LiuXinXin + * @since 2022-10-13 + */ +@Service +public class SecurityManageGradeServiceImpl extends ServiceImpl implements ISecurityManageGradeService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/SecurityManageResultEvalServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/SecurityManageResultEvalServiceImpl.java new file mode 100644 index 0000000..702e4d1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/SecurityManageResultEvalServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.analysis.service.impl; + +import com.ningdatech.carapi.analysis.entity.SecurityManageResultEval; +import com.ningdatech.carapi.analysis.mapper.SecurityManageResultEvalMapper; +import com.ningdatech.carapi.analysis.service.ISecurityManageResultEvalService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 安全制度建设分析评估 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +@Service +public class SecurityManageResultEvalServiceImpl extends ServiceImpl implements ISecurityManageResultEvalService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/SecurityRiskEvalServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/SecurityRiskEvalServiceImpl.java new file mode 100644 index 0000000..e581480 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/SecurityRiskEvalServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.analysis.service.impl; + +import com.ningdatech.carapi.analysis.entity.SecurityRiskEval; +import com.ningdatech.carapi.analysis.mapper.SecurityRiskEvalMapper; +import com.ningdatech.carapi.analysis.service.ISecurityRiskEvalService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 安全责任体系分析评估 服务实现类 + *

+ * + * @author LiuXinXin + * @since 2022-10-14 + */ +@Service +public class SecurityRiskEvalServiceImpl extends ServiceImpl implements ISecurityRiskEvalService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/SecuritySystemBuildingEvalServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/SecuritySystemBuildingEvalServiceImpl.java new file mode 100644 index 0000000..9b60bc3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/SecuritySystemBuildingEvalServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.analysis.service.impl; + +import com.ningdatech.carapi.analysis.entity.SecuritySystemBuildingEval; +import com.ningdatech.carapi.analysis.mapper.SecuritySystemBuildingEvalMapper; +import com.ningdatech.carapi.analysis.service.ISecuritySystemBuildingEvalService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 安全责任体系分析评估 服务实现类 + *

+ * + * @author LiuXinXin + * @since 2022-10-14 + */ +@Service +public class SecuritySystemBuildingEvalServiceImpl extends ServiceImpl implements ISecuritySystemBuildingEvalService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/VehicleAccidentEvalServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/VehicleAccidentEvalServiceImpl.java new file mode 100644 index 0000000..9e75e5c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/VehicleAccidentEvalServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.analysis.service.impl; + +import com.ningdatech.carapi.analysis.entity.VehicleAccidentEval; +import com.ningdatech.carapi.analysis.mapper.VehicleAccidentEvalMapper; +import com.ningdatech.carapi.analysis.service.IVehicleAccidentEvalService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 车辆事故情况评估 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-10-17 + */ +@Service +public class VehicleAccidentEvalServiceImpl extends ServiceImpl implements IVehicleAccidentEvalService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/VehicleOverSpeedEvalServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/VehicleOverSpeedEvalServiceImpl.java new file mode 100644 index 0000000..3a77710 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/VehicleOverSpeedEvalServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.analysis.service.impl; + +import com.ningdatech.carapi.analysis.entity.VehicleOverSpeedEval; +import com.ningdatech.carapi.analysis.mapper.VehicleOverSpeedEvalMapper; +import com.ningdatech.carapi.analysis.service.IVehicleOverSpeedEvalService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 车辆超速情况评估 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-10-17 + */ +@Service +public class VehicleOverSpeedEvalServiceImpl extends ServiceImpl implements IVehicleOverSpeedEvalService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/VehicleServiceLifeServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/VehicleServiceLifeServiceImpl.java new file mode 100644 index 0000000..b57e341 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/VehicleServiceLifeServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.analysis.service.impl; + +import com.ningdatech.carapi.analysis.entity.VehicleServiceLife; +import com.ningdatech.carapi.analysis.mapper.VehicleServiceLifeMapper; +import com.ningdatech.carapi.analysis.service.IVehicleServiceLifeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 车辆使用年限 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-10-15 + */ +@Service +public class VehicleServiceLifeServiceImpl extends ServiceImpl implements IVehicleServiceLifeService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/VehicleViolationEvalServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/VehicleViolationEvalServiceImpl.java new file mode 100644 index 0000000..815ea44 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/VehicleViolationEvalServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.analysis.service.impl; + +import com.ningdatech.carapi.analysis.entity.VehicleViolationEval; +import com.ningdatech.carapi.analysis.mapper.VehicleViolationEvalMapper; +import com.ningdatech.carapi.analysis.service.IVehicleViolationEvalService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 车辆违章情况评估 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-10-15 + */ +@Service +public class VehicleViolationEvalServiceImpl extends ServiceImpl implements IVehicleViolationEvalService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/WarnAnalysisCarServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/WarnAnalysisCarServiceImpl.java new file mode 100644 index 0000000..9c4d0e6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/WarnAnalysisCarServiceImpl.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.analysis.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.analysis.entity.WarnAnalysisCar; +import com.ningdatech.carapi.analysis.entity.req.WarnAnalysisListReq; +import com.ningdatech.carapi.analysis.mapper.WarnAnalysisCarMapper; +import com.ningdatech.carapi.analysis.service.IWarnAnalysisCarService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 车辆综合预警分析 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +@Service +@RequiredArgsConstructor +public class WarnAnalysisCarServiceImpl extends ServiceImpl implements IWarnAnalysisCarService { + + private final WarnAnalysisCarMapper mapper; + + @Override + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public Page pageCarAnalysis(Page page, WarnAnalysisListReq req) { + return mapper.pageCarAnalysis(page,req); + } + + @Override + public List listCarAnalysis(WarnAnalysisListReq req) { + return mapper.listCarAnalysis(req); + } + + @Override + public Integer saveBatchXml(List singleList) { + return mapper.saveBatchXml(singleList); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/WarnAnalysisCompanyServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/WarnAnalysisCompanyServiceImpl.java new file mode 100644 index 0000000..78e5ec9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/WarnAnalysisCompanyServiceImpl.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.analysis.service.impl; + +import com.ningdatech.carapi.analysis.entity.WarnAnalysisCompany; +import com.ningdatech.carapi.analysis.entity.req.WarnAnalysisListReq; +import com.ningdatech.carapi.analysis.mapper.WarnAnalysisCompanyMapper; +import com.ningdatech.carapi.analysis.service.IWarnAnalysisCompanyService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 企业综合预警分析 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-10-14 + */ +@Service +@RequiredArgsConstructor +public class WarnAnalysisCompanyServiceImpl extends ServiceImpl implements IWarnAnalysisCompanyService { + + private final WarnAnalysisCompanyMapper mapper; + + @Override + public List listCompanyAnalysis(WarnAnalysisListReq req) { + return mapper.listCompanyAnalysis(req); + } + + @Override + public Integer saveBatchXml(List singleList) { + return mapper.saveBatchXml(singleList); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/WarnAnalysisDriverServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/WarnAnalysisDriverServiceImpl.java new file mode 100644 index 0000000..2b6369f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/analysis/service/impl/WarnAnalysisDriverServiceImpl.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.analysis.service.impl; + +import com.ningdatech.carapi.analysis.entity.WarnAnalysisDriver; +import com.ningdatech.carapi.analysis.entity.req.WarnAnalysisListReq; +import com.ningdatech.carapi.analysis.mapper.WarnAnalysisDriverMapper; +import com.ningdatech.carapi.analysis.service.IWarnAnalysisDriverService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 驾驶员综合预警分析 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-11-01 + */ +@Service +@RequiredArgsConstructor +public class WarnAnalysisDriverServiceImpl extends ServiceImpl implements IWarnAnalysisDriverService { + + private final WarnAnalysisDriverMapper mapper; + + @Override + public List listDriverAnalysis(WarnAnalysisListReq req) { + return mapper.listDriverAnalysis(req); + } + + @Override + public Integer saveBatchXml(List singleList) { + return mapper.saveBatchXml(singleList); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/aop/AuditVehicle.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/aop/AuditVehicle.java new file mode 100644 index 0000000..606e2a5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/aop/AuditVehicle.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.archives.aop; + +import java.lang.annotation.*; + +/** + * @Classname Audit + * @Description + * @Date 2022/10/31 15:34 + * @Created by PoffyZhang + */ + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface AuditVehicle { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/aop/AuditVehicleAspect.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/aop/AuditVehicleAspect.java new file mode 100644 index 0000000..9f979d7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/aop/AuditVehicleAspect.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.archives.aop; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.code.ExceptionCode; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.archives.enums.AuditStateEnum; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @program: + * @description: 车辆审核切面 + * @author: PoffyZhang + * @created: 2021/10/29 09:12 + */ +@Aspect +@Component +@Slf4j +@AllArgsConstructor +@Order(10) +public class AuditVehicleAspect { + + private IVehicleBaseInfoService vehicleBaseInfoService; + + @Pointcut("@annotation(com.ningdatech.carapi.archives.aop.AuditVehicle)") + public void auditVehicleAspect() { + + } + + @Before("auditVehicleAspect() && @annotation(auditVehicle)") + public void doBebore(JoinPoint joinPoint, AuditVehicle auditVehicle) throws Throwable { + Object[] values = joinPoint.getArgs(); + String carPlate = (String) values[0]; + + VUtils.isTrueFormat(StringUtils.isBlank(carPlate)) + .throwMessage(ExceptionCode.OPERATION_EX.getCode(), "车牌号未传 {}!",carPlate); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + wrapper.eq(NdVehicleBaseInfo::getCarPlate,carPlate); + //由于 车辆信息 车牌号不唯一 一辆车可能绑定多个企业 + List vehicles = vehicleBaseInfoService.list(wrapper); + + VUtils.isTrueFormat(CollUtil.isEmpty(vehicles)) + .throwMessage(ExceptionCode.OPERATION_EX.getCode(), "系统中没有此车辆 {}!",carPlate); + + //暂时取第一辆 + NdVehicleBaseInfo vehicle = vehicles.get(0); + VUtils.isTrueFormat(!AuditStateEnum.AUDIT_SUCCESS.getCode().equals(vehicle.getAuditState())) + .throwMessage(ExceptionCode.OPERATION_EX.getCode(), "此车辆未审核成功 {}!",carPlate); + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/assembler/QuestionAssembler.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/assembler/QuestionAssembler.java new file mode 100644 index 0000000..804fffa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/assembler/QuestionAssembler.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.archives.assembler; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.carapi.archives.entity.PaperQuestion; +import com.ningdatech.carapi.archives.model.JudgmentalQuestionTextContent; +import com.ningdatech.carapi.archives.model.MultipleChoiceQuestionTextContent; +import com.ningdatech.carapi.archives.model.SingleChoiceQuestionTextContent; +import com.ningdatech.carapi.archives.model.vo.ResQuestionDetailVO; +import com.ningdatech.carapi.driver.constant.QuestionTypeEnum; + +/** + * @author liuxinxin + * @date 2022/10/22 下午3:36 + */ + +public class QuestionAssembler { + + public static ResQuestionDetailVO buildResQuestionDetailVO(PaperQuestion paperQuestion) { + ResQuestionDetailVO resQuestionDetailVO = new ResQuestionDetailVO(); + QuestionTypeEnum questionTypeEnum = QuestionTypeEnum.valueOf(paperQuestion.getQuestionType()); + String questionTextContent = paperQuestion.getQuestionTextContent(); + switch (questionTypeEnum) { + case MULTIPLE_CHOICE: + MultipleChoiceQuestionTextContent multipleChoiceQuestionTextContent + = JSONObject.parseObject(questionTextContent, MultipleChoiceQuestionTextContent.class); + resQuestionDetailVO.setChoiceQuestionCorrectAnswer(multipleChoiceQuestionTextContent.getAnswer()); + resQuestionDetailVO.setOptions(multipleChoiceQuestionTextContent.getOptions()); + break; + case SINGLE_CHOICE: + SingleChoiceQuestionTextContent singleChoiceQuestionTextContent + = JSONObject.parseObject(questionTextContent, SingleChoiceQuestionTextContent.class); + resQuestionDetailVO.setChoiceQuestionCorrectAnswer(CollUtil.toList(singleChoiceQuestionTextContent.getAnswer())); + resQuestionDetailVO.setOptions(singleChoiceQuestionTextContent.getOptions()); + break; + case JUDGMENTAL: + JudgmentalQuestionTextContent judgmentalQuestionTextContent + = JSONObject.parseObject(questionTextContent, JudgmentalQuestionTextContent.class); + resQuestionDetailVO.setJudgmentalQuestionCorrectAnswer(judgmentalQuestionTextContent.getAnswer()); + break; + default: + } + resQuestionDetailVO.setQuestionType(QuestionTypeEnum.valueOf(paperQuestion.getQuestionType())); + resQuestionDetailVO.setStem(paperQuestion.getStem()); + resQuestionDetailVO.setId(paperQuestion.getId()); + return resQuestionDetailVO; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/controller/ArchivesController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/controller/ArchivesController.java new file mode 100644 index 0000000..b186bc6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/controller/ArchivesController.java @@ -0,0 +1,131 @@ +package com.ningdatech.carapi.archives.controller; + +import java.util.List; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.carapi.archives.aop.AuditVehicle; +import com.ningdatech.carapi.archives.manage.ArchivesManage; +import com.ningdatech.carapi.qrcode.model.vo.GetOnVehicleVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentAnalysisVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentDeadVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleViolationVO; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname ArchivesController + * @Description + * @Date 2022/11/1 14:16 + * @Created by PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/archives/vehicle") +@Api(value = "archives", tags = "车辆管理-档案管理") +@RequiredArgsConstructor +public class ArchivesController { + + private final ArchivesManage archivesManage; + + /** + * 查询车辆的运营商档案 + * + * @param carPlate 车牌号 + * @return 查询运营商 + */ + @ApiOperation(value = "运营商信息档案", notes = "运营商信息档案") + @GetMapping("/operator-detail") + @AuditVehicle + public OperatorQueryDTO getOperatorDetails(@Valid @RequestParam String carPlate) { + return archivesManage.getOperatorDetails(carPlate); + } + + /** + * 查询车辆违章记录档案 + * + * @param carPlate,violationType + * @return + */ + @ApiOperation(value = "查询车辆违章记录档案", notes = "查询车辆违章记录档案") + @GetMapping("/violation") + @AuditVehicle + public List getViolation(@Valid @RequestParam String carPlate, @Valid @RequestParam Integer violationType) { + return archivesManage.getViolation(carPlate,violationType); + } + + /** + * 查询车辆事故记录档案 + * @param carPlate,violationType + * @return + */ + @ApiOperation(value = "查询车辆事故记录档案", notes = "查询车辆事故记录档案") + @GetMapping("/accident-vehicle") + @AuditVehicle + public List getAccidentVehicle(@Valid @RequestParam String carPlate) { + return archivesManage.getAccidentVehicle(carPlate); + } + + /** + * 查询车辆死亡事故记录档案 + * + * @param carPlate,violationType + * @return + */ + @ApiOperation(value = "查询车辆死亡事故记录档案", notes = "查询车辆死亡事故记录档案") + @GetMapping("/accident-dead") + @AuditVehicle + public List getAccidentDead(@Valid @RequestParam String carPlate) { + return archivesManage.getAccidentDead(carPlate); + } + + /** + * 查询车辆事故分析记录档案 + * + * @param carPlate,violationType + * @return + */ + @ApiOperation(value = "查询车辆事故分析记录档案", notes = "查询车辆事故分析记录档案") + @GetMapping("/accident-analysis") + @AuditVehicle + public List getAccidentAnalysis(@Valid @RequestParam String carPlate) { + return archivesManage.getAccidentAnalysis(carPlate); + } + + /** + * 查询车辆上车记录 + * + * @param carPlate,violationType + * @return + */ + @ApiOperation(value = "查询车辆上车记录", notes = "查询车辆上车记录") + @GetMapping("/get-on-car-list") + @AuditVehicle + public List getOnCar(@Valid @RequestParam String carPlate) { + return archivesManage.getOnCar(carPlate); + } + + /** + * 查询车辆上车记录 + * + * @param driverId + * @return + */ + @ApiOperation(value = "查询车辆上车记录-驾驶员ID", notes = "查询车辆上车记录") + @GetMapping("/get-driver-on-car-list") + public List getOnCarDriver(@Valid @RequestParam String driverId) { + return archivesManage.getOnCarDriver(driverId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/controller/ExaminationPaperController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/controller/ExaminationPaperController.java new file mode 100644 index 0000000..534f563 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/controller/ExaminationPaperController.java @@ -0,0 +1,75 @@ +package com.ningdatech.carapi.archives.controller; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.archives.manage.ExaminationPaperManage; +import com.ningdatech.carapi.archives.model.po.ReqExamPaperListPO; +import com.ningdatech.carapi.archives.model.po.ReqExamRulePO; +import com.ningdatech.carapi.archives.model.po.ReqSaveExamPaperPO; +import com.ningdatech.carapi.archives.model.po.ReqSaveExamRulePO; +import com.ningdatech.carapi.archives.model.vo.ResExamPaperListVO; +import com.ningdatech.carapi.archives.model.vo.ResExamPaperVO; +import com.ningdatech.carapi.archives.model.vo.ResExamRuleVO; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + * @author liuxinxin + * @date 2022/10/17 下午4:07 + */ +@RequestMapping("/api/v1/exam-paper") +@Validated +@RestController +@Api(tags = "培训试卷") +@RequiredArgsConstructor +public class ExaminationPaperController { + + private final ExaminationPaperManage examinationPaperManage; + + @PostMapping("/save") + @ApiOperation("保存培训试卷") + @WebLog + public void saveExamPaper(@Valid @RequestBody ReqSaveExamPaperPO po) { + examinationPaperManage.saveExamPaper(po); + } + + @PostMapping("/get/{examPaperId}") + @ApiOperation("获取培训试卷") + public ResExamPaperVO getExamPaperId(@Valid @PathVariable Long examPaperId) { + return examinationPaperManage.getExamPaperId(examPaperId); + } + + @PostMapping("/list") + @ApiOperation("培训试卷列表") + public PageVo listExamPaper(@Valid @RequestBody ReqExamPaperListPO request) { + return examinationPaperManage.listExamPaper(request); + } + + @PostMapping("/save/exam-rule") + @ApiOperation("保存试卷规则-全局配置") + @WebLog + public void saveExamRule(@Valid @RequestBody ReqSaveExamRulePO request) { + examinationPaperManage.saveExamRule(request); + } + + @PostMapping("/get/exam-rule") + @ApiOperation("获取试卷规则-全局配置") + public ResExamRuleVO getExamRule(@Valid @RequestBody ReqExamRulePO request) { + return examinationPaperManage.getExamRule(request); + } + + @PostMapping("/delete/{id}") + @ApiOperation("删除试卷") + @WebLog + public void deleteExamPaper(@PathVariable("id") Long id) { + examinationPaperManage.deleteExamPaper(id); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/controller/PaperQuestionController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/controller/PaperQuestionController.java new file mode 100644 index 0000000..cdff65a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/controller/PaperQuestionController.java @@ -0,0 +1,67 @@ +package com.ningdatech.carapi.archives.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.archives.manage.PaperQuestionManage; +import com.ningdatech.carapi.archives.model.po.ReqQuestionListPO; +import com.ningdatech.carapi.archives.model.po.ReqSaveNewQuestionPO; +import com.ningdatech.carapi.archives.model.vo.ResQuestionDetailVO; +import com.ningdatech.carapi.archives.model.vo.ResQuestionListVO; +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 javax.validation.Valid; + +/** + *

+ * 前端控制器 + *

+ * + * @author LiuXinXin + * @since 2022-10-11 + */ +@RequestMapping("/api/v1/paper-question") +@Validated +@RestController +@Api(tags = "培训考题") +@RequiredArgsConstructor +public class PaperQuestionController { + private final PaperQuestionManage paperQuestionManage; + + @PostMapping("/list") + @ApiOperation("培训题库列表查询") + public PageVo questionList(@Valid @RequestBody ReqQuestionListPO po) { + return paperQuestionManage.questionList(po); + } + + @GetMapping("/detail/{questionId}") + @ApiOperation("培训题库详情") + public ResQuestionDetailVO questionDetail(@Valid @PathVariable("questionId") Long questionId) { + return paperQuestionManage.questionDetail(questionId); + } + + @PostMapping("/create") + @ApiOperation("新增试题") + @WebLog + public void createNewQuestion(@Valid @RequestBody ReqSaveNewQuestionPO po) { + paperQuestionManage.createNewQuestion(po); + } + + @PostMapping("/save") + @ApiOperation("保存试题") + @WebLog + public void saveQuestion(@Valid @RequestBody ReqSaveNewQuestionPO request) { + paperQuestionManage.saveQuestion(request); + } + + @PostMapping("/delete/{id}") + @ApiOperation("删除试题") + @WebLog + public void deleteQuestion(@PathVariable("id") Long id) { + paperQuestionManage.deleteQuestion(id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/entity/ExamPaper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/entity/ExamPaper.java new file mode 100644 index 0000000..5dcd220 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/entity/ExamPaper.java @@ -0,0 +1,66 @@ +package com.ningdatech.carapi.archives.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; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-17 + */ +@TableName("nd_exam_paper") +@Data +@ApiModel(value = "ExamPaper对象", description = "") +public class ExamPaper implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + @ApiModelProperty("所属区域标识") + private Long regionId; + + @ApiModelProperty("满分") + private Long fullScore; + + @ApiModelProperty("合格分") + private Long qualifiedScore; + + @ApiModelProperty("试卷名称") + private String examPaperName; + + @ApiModelProperty("试卷规则") + private String examRuleJson; + + @ApiModelProperty("是否随机试卷") + private Integer isRandom; + + @ApiModelProperty("考试开始时间") + private LocalDateTime examStartTime; + + @ApiModelProperty("考试结束时间") + private LocalDateTime examEndTime; + + @ApiModelProperty("随机试卷对应驾驶员用户ID") + private Long driverUserId; + + @ApiModelProperty("随机试卷所在的培训组织ID") + private Long trainingOrganizationId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/entity/ExamPaperQuestion.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/entity/ExamPaperQuestion.java new file mode 100644 index 0000000..b26fb6f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/entity/ExamPaperQuestion.java @@ -0,0 +1,50 @@ +package com.ningdatech.carapi.archives.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-17 + */ +@TableName("nd_exam_paper_question") +@ApiModel(value = "ExamPaperQuestion对象", description = "") +@Data +public class ExamPaperQuestion implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + @ApiModelProperty("考试试卷id") + private Long examPaperId; + + @ApiModelProperty("考试题目id") + private Long paperQuestionId; + + @ApiModelProperty("排序值") + private Long sortValue; + + @ApiModelProperty("题目类型") + private String questionType; + + @ApiModelProperty("是否随机试卷") + private Integer isRandom; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/entity/PaperQuestion.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/entity/PaperQuestion.java new file mode 100644 index 0000000..d45f093 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/entity/PaperQuestion.java @@ -0,0 +1,67 @@ +package com.ningdatech.carapi.archives.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.archives.enums.PaperQuestionStatusEnum; +import com.ningdatech.carapi.driver.constant.QuestionTypeEnum; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author LiuXinXin + * @since 2022-10-11 + */ +@TableName("nd_paper_question") +@Data +public class PaperQuestion implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 题目原题 + */ + private String stem; + + /** + * 题目类型 + * {@link QuestionTypeEnum} + */ + private String questionType; + + /** + * 正确答案 + */ + private String correct; + + /** + * 题目 填空、 题干、解析、答案等信息 + */ + private String questionTextContent; + + /** + * 状态 + * {@link PaperQuestionStatusEnum} + */ + private String questionStatus; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long regionId; + + /** + * 使用次数 + */ + private Long usageCnt; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/ApproveStateEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/ApproveStateEnum.java new file mode 100644 index 0000000..27d925e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/ApproveStateEnum.java @@ -0,0 +1,54 @@ +package com.ningdatech.carapi.archives.enums; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 通过审核 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "ApproveStateEnum", description = "通过审核-枚举") +public enum ApproveStateEnum { + /** + * 待审核 + */ + AUDIT(0, "待审核"), + + /** + * 审核成功 + */ + AUDIT_SUCESS(1, "已审核"); + + /** + * code + */ + private Integer code; + + /** + * 描述 + */ + private String desc; + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public Integer getCode() { + return this.code; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/AuditStateEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/AuditStateEnum.java new file mode 100644 index 0000000..028204c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/AuditStateEnum.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.archives.enums; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 审核状态 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "AuditStateEnum", description = "审核状态-枚举") +public enum AuditStateEnum { + /** + * 待审核 + */ + AUDIT(1, "待审核"), + + /** + * 审核成功 + */ + AUDIT_SUCCESS(2, "审核成功"), + + /** + * 审核失败 + */ + AUDIT_FAIL(3, "审核失败"); + + /** + * code + */ + private Integer code; + + /** + * 描述 + */ + private String desc; + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + @ApiModelProperty(value = "编码", allowableValues = "1,2,3", example = "1") + public Integer getCode() { + return this.code; + } + + public static String getDescByCode(int code) { + for (AuditStateEnum auditStateEnum : AuditStateEnum.values()) { + if (auditStateEnum.getCode() == code) { + return auditStateEnum.getDesc(); + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/CertOperTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/CertOperTypeEnum.java new file mode 100644 index 0000000..0ab21f6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/CertOperTypeEnum.java @@ -0,0 +1,54 @@ +package com.ningdatech.carapi.archives.enums; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 证书操作 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "CertOperTypeEnum", description = "证书操作-枚举") +public enum CertOperTypeEnum { + /** + * 申请 + */ + APPLICATION(1, "申请"), + + /** + * 补换 + */ + REISSUE(2, "补换"); + + /** + * code + */ + private Integer code; + + /** + * 描述 + */ + private String desc; + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public Integer getCode() { + return this.code; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/DriverRelationConstant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/DriverRelationConstant.java new file mode 100644 index 0000000..615b1ba --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/DriverRelationConstant.java @@ -0,0 +1,14 @@ +package com.ningdatech.carapi.archives.enums; + +/** + * @author liuxinxin + * @date 2022/11/4 上午9:23 + */ + +public class DriverRelationConstant { + + /** + * 驾驶员基础分数 100分 + */ + public static final Integer DRIVER_FULL_SCORE = 100; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/ExamPaperQualifiedScoreConstant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/ExamPaperQualifiedScoreConstant.java new file mode 100644 index 0000000..d1cba83 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/ExamPaperQualifiedScoreConstant.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.archives.enums; + +/** + * @author liuxinxin + * @date 2022/10/22 上午11:47 + * 考试试卷合格分常量 + */ + +public class ExamPaperQualifiedScoreConstant { + + /** + * 试卷合格分 60分 + */ + public static final Long EXAM_PAPER_QUALIFIED_SCORE = 60L; + + /** + * 试卷总分 100分 + */ + public static final Long EXAM_PAPER_FULL_SCORE = 100L; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/IsRandomEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/IsRandomEnum.java new file mode 100644 index 0000000..a5d9437 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/IsRandomEnum.java @@ -0,0 +1,65 @@ +package com.ningdatech.carapi.archives.enums; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 审核状态 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "IsRandomEnum", description = "随机试卷-枚举") +public enum IsRandomEnum { + /** + * 非随机试卷 + */ + NOT_RANDOM_PAPER(0, "否"), + + /** + * 随机试卷 + */ + RANDOM_PAPER(1, "是"); + + /** + * code + */ + private Integer code; + + /** + * 描述 + */ + private String desc; + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + @ApiModelProperty("编码") + public Integer getCode() { + return this.code; + } + + public static String getDescByCode(int code) { + for (IsRandomEnum isRandomEnum : IsRandomEnum.values()) { + if (isRandomEnum.getCode() == code) { + return isRandomEnum.getDesc(); + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/PaperQuestionStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/PaperQuestionStatusEnum.java new file mode 100644 index 0000000..776cba0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/enums/PaperQuestionStatusEnum.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.archives.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/17 下午3:22 + * 培训试题枚举 + */ +@AllArgsConstructor +@Getter +public enum PaperQuestionStatusEnum { + + /** + * 使用中 + */ + IN_USE, + + /** + * 已删除 + */ + DELETED +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/manage/ArchivesManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/manage/ArchivesManage.java new file mode 100644 index 0000000..43aea63 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/manage/ArchivesManage.java @@ -0,0 +1,246 @@ +package com.ningdatech.carapi.archives.manage; + +import java.util.Collections; +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.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.constant.MissCertEnum; +import com.ningdatech.carapi.common.constant.ViolationTypeEnum; +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.qrcode.entity.NdVehicleGetOn; +import com.ningdatech.carapi.qrcode.model.vo.GetOnVehicleVO; +import com.ningdatech.carapi.qrcode.service.VehicleGetOnService; +import com.ningdatech.carapi.safe.entity.NdVehicleViolation; +import com.ningdatech.carapi.safe.manage.VehicleAccidentManage; +import com.ningdatech.carapi.safe.model.dto.AccidentPageQuery; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentAnalysisVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentDeadVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleViolationVO; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentAnalysisService; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentDeadService; +import com.ningdatech.carapi.safe.service.INdVehicleViolationService; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.manage.OperatorManage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; + +/** + * @Classname ArchivesManage + * @Description + * @Date 2022/11/1 14:33 + * @Created by PoffyZhang + */ +@Component +@RequiredArgsConstructor +public class ArchivesManage { + + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final INdVehicleViolationService vehicleViolationService; + private final INdVehicleAccidentDeadService vehicleAccidentDeadService; + private final INdVehicleAccidentAnalysisService vehicleAccidentAnalysisService; + + private final VehicleGetOnService vehicleGetOnService; + private final OperatorManage operatorManage; + + private final VehicleAccidentManage vehicleAccidentManage; + + + /** + * 根据车牌号查询运营商 + * @param carPlate + * @return + */ + public OperatorQueryDTO getOperatorDetails(String carPlate) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + wrapper.eq(NdVehicleBaseInfo::getCarPlate,carPlate); + List vehicles = vehicleBaseInfoService.list(wrapper); + if(CollUtil.isEmpty(vehicles)){ + return null; + } + return operatorManage.getDetails(vehicles.get(0).getOperatorId()); + } + + /** + * 违章信息 + * @param carPlate violationType + * @return + */ + public List getViolation(String carPlate, Integer violationType) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleViolation.class); + ArchivesManage context = (ArchivesManage) AopContext.currentProxy(); + context.buildQuery(wrapper, carPlate,violationType); + List list = vehicleViolationService.list(wrapper); + + if(CollUtil.isEmpty(list)){ + return Collections.emptyList(); + } + + return list.stream().map(w -> { + NdVehicleViolationVO vo = BeanUtil.copyProperties(w, NdVehicleViolationVO.class); + if(Objects.nonNull(vo.getViolationType())){ + vo.setViolationTypeName(ViolationTypeEnum.getDescByCode(vo.getViolationType())); + } + if(Objects.nonNull(vo.getMissingCertificateType())){ + vo.setMissingCertificateTypeName(MissCertEnum.getDescByCode(vo.getMissingCertificateType())); + } + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }).collect(Collectors.toList()); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, String carPlate, Integer violationType) { + wrapper.eq(NdVehicleViolation::getCarPlate,carPlate); + wrapper.eq(NdVehicleViolation::getViolationType, violationType); + } + + /** + * 车辆事故 + * @param carPlate + * @return + */ + public List getAccidentVehicle(String carPlate) { + AccidentPageQuery param = new AccidentPageQuery(); + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + param.setCarPlate(carPlate); + PageVo page = vehicleAccidentManage.queryVehicleAccident(param); + if(0L == page.getTotal()){ + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(), w -> { + NdVehicleAccidentVO vo = BeanUtil.copyProperties(w, NdVehicleAccidentVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + public List getAccidentVehicleOpen(String carPlate) { + AccidentPageQuery param = new AccidentPageQuery(); + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + param.setCarPlate(carPlate); + PageVo page = vehicleAccidentManage.queryVehicleAccidentOpen(param); + if(0L == page.getTotal()){ + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(), w -> { + NdVehicleAccidentVO vo = BeanUtil.copyProperties(w, NdVehicleAccidentVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public List getAccidentDead(String carPlate) { + AccidentPageQuery param = new AccidentPageQuery(); + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + param.setCarPlate(carPlate); + PageVo page = vehicleAccidentManage.queryDead(param); + if(0L == page.getTotal()){ + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(), w -> { + NdVehicleAccidentDeadVO vo = BeanUtil.copyProperties(w, NdVehicleAccidentDeadVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + public List getAccidentDeadOpen(String carPlate) { + AccidentPageQuery param = new AccidentPageQuery(); + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + param.setCarPlate(carPlate); + PageVo page = vehicleAccidentManage.queryDeadOpen(param); + if(0L == page.getTotal()){ + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(), w -> { + NdVehicleAccidentDeadVO vo = BeanUtil.copyProperties(w, NdVehicleAccidentDeadVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public List getAccidentAnalysis(String carPlate) { + AccidentPageQuery param = new AccidentPageQuery(); + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + param.setCarPlate(carPlate); + PageVo page = vehicleAccidentManage.queryAccidentAnalysis(param); + if(0L == page.getTotal()){ + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(), w -> { + NdVehicleAccidentAnalysisVO vo = BeanUtil.copyProperties(w, NdVehicleAccidentAnalysisVO.class); + CodeUtil.searchRegionName(vo); + return vo; + }); + } + + public List getAccidentAnalysisOpen(String carPlate) { + AccidentPageQuery param = new AccidentPageQuery(); + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + param.setCarPlate(carPlate); + PageVo page = vehicleAccidentManage.queryAccidentAnalysis(param); + if(0L == page.getTotal()){ + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(), w -> { + NdVehicleAccidentAnalysisVO vo = BeanUtil.copyProperties(w, NdVehicleAccidentAnalysisVO.class); + CodeUtil.searchRegionName(vo); + return vo; + }); + } + + public List getOnCar(String carPlate) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleGetOn.class); + ArchivesManage context = (ArchivesManage) AopContext.currentProxy(); + context.buildGetOnCarQuery(wrapper, carPlate); + List list = vehicleGetOnService.list(wrapper); + if (CollUtil.isEmpty(list)){ + return Collections.emptyList(); + } + return CollUtils.convert(list, w -> { + GetOnVehicleVO vo = BeanUtil.copyProperties(w, GetOnVehicleVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildGetOnCarQuery(LambdaQueryWrapper wrapper, String carPlate) { + wrapper.eq(NdVehicleGetOn::getCarPlate,carPlate); + } + + public List getOnCarDriver(String driverId) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleGetOn.class); + ArchivesManage context = (ArchivesManage) AopContext.currentProxy(); + context.buildGetOnQuery(wrapper, Long.valueOf(driverId)); + List list = vehicleGetOnService.list(wrapper); + if (CollUtil.isEmpty(list)){ + return Collections.emptyList(); + } + return CollUtils.convert(list, w -> { + GetOnVehicleVO vo = BeanUtil.copyProperties(w, GetOnVehicleVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildGetOnQuery(LambdaQueryWrapper wrapper, Long driverId) { + wrapper.eq(NdVehicleGetOn::getDriverId,driverId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/manage/ExaminationPaperManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/manage/ExaminationPaperManage.java new file mode 100644 index 0000000..f989280 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/manage/ExaminationPaperManage.java @@ -0,0 +1,458 @@ +package com.ningdatech.carapi.archives.manage; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +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.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.archives.assembler.QuestionAssembler; +import com.ningdatech.carapi.archives.entity.ExamPaper; +import com.ningdatech.carapi.archives.entity.ExamPaperQuestion; +import com.ningdatech.carapi.archives.entity.PaperQuestion; +import com.ningdatech.carapi.archives.enums.ExamPaperQualifiedScoreConstant; +import com.ningdatech.carapi.archives.enums.IsRandomEnum; +import com.ningdatech.carapi.archives.model.ExamRuleInfo; +import com.ningdatech.carapi.archives.model.po.ReqExamPaperListPO; +import com.ningdatech.carapi.archives.model.po.ReqExamRulePO; +import com.ningdatech.carapi.archives.model.po.ReqSaveExamPaperPO; +import com.ningdatech.carapi.archives.model.po.ReqSaveExamPaperPO.ExamPaperQuestionIdPO; +import com.ningdatech.carapi.archives.model.po.ReqSaveExamRulePO; +import com.ningdatech.carapi.archives.model.vo.ResExamPaperListVO; +import com.ningdatech.carapi.archives.model.vo.ResExamPaperVO; +import com.ningdatech.carapi.archives.model.vo.ResExamRuleVO; +import com.ningdatech.carapi.archives.model.vo.ResQuestionDetailVO; +import com.ningdatech.carapi.archives.service.IExamPaperQuestionService; +import com.ningdatech.carapi.archives.service.IExamPaperService; +import com.ningdatech.carapi.archives.service.IPaperQuestionService; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.common.helper.UserInfoHelper; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.driver.constant.QuestionTypeEnum; +import com.ningdatech.carapi.sys.entity.ExamRule; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.IExamRuleService; +import com.ningdatech.carapi.user.model.vo.UserBasicInfoVO; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollectionUtil; +import lombok.RequiredArgsConstructor; + +/** + * @author liuxinxin + * @date 2022/10/17 下午4:28 + */ +@Component +@RequiredArgsConstructor +public class ExaminationPaperManage { + + private final IPaperQuestionService iPaperQuestionService; + private final IExamPaperService iExamPaperService; + private final IExamPaperQuestionService iExamPaperQuestionService; + private final UserInfoHelper userInfoHelper; + private final IExamRuleService iExamRuleService; + private final RegionsCacheHelper regionsCacheHelper; + + @Transactional(rollbackFor = Exception.class) + public void createExamPaper(ReqSaveExamPaperPO po, ReqExamRulePO examRulePo) { + // 获取全局试卷规则 校验分数 + ResExamRuleVO examRule = getExamRule(examRulePo); + // 获取入参 + Long regionId = userInfoHelper.getUserRegionId(); + + List singleChoiceQuestionList = po.getSingleChoiceQuestionList(); + List multipleChoiceQuestionList = po.getMultipleChoiceQuestionList(); + List judgmentalQuestionList = po.getJudgmentalQuestionList(); + List examPaperQuestionIdList = new ArrayList<>(); + examPaperQuestionIdList.addAll(singleChoiceQuestionList); + examPaperQuestionIdList.addAll(multipleChoiceQuestionList); + examPaperQuestionIdList.addAll(judgmentalQuestionList); + + List questionIdList = examPaperQuestionIdList.stream() + .map(ExamPaperQuestionIdPO::getPaperQuestionId).collect(Collectors.toList()); + + List paperQuestionList = iPaperQuestionService + .list(Wrappers.lambdaQuery(PaperQuestion.class).in(PaperQuestion::getId, questionIdList)); + Map paperQuestionIdTypeMap = paperQuestionList.stream().collect(Collectors.toMap(PaperQuestion::getId, PaperQuestion::getQuestionType)); + + // 保存试卷基本信息 + ExamPaper examPaper = new ExamPaper(); + examPaper.setCreateOn(LocalDateTime.now()); + examPaper.setUpdateOn(LocalDateTime.now()); + examPaper.setExamPaperName(po.getExamPaperName()); + examPaper.setFullScore(ExamPaperQualifiedScoreConstant.EXAM_PAPER_FULL_SCORE); + examPaper.setQualifiedScore(ExamPaperQualifiedScoreConstant.EXAM_PAPER_QUALIFIED_SCORE); + examPaper.setRegionId(regionId); + examPaper.setExamRuleJson(JSONObject.toJSONString(examRule)); + examPaper.setIsRandom(IsRandomEnum.NOT_RANDOM_PAPER.getCode()); + iExamPaperService.save(examPaper); + + // 保存试卷题目关联关系 + List saveRecordList = new ArrayList<>(); + for (ExamPaperQuestionIdPO idPo : examPaperQuestionIdList) { + ExamPaperQuestion examPaperQuestion = new ExamPaperQuestion(); + examPaperQuestion.setExamPaperId(examPaper.getId()); + examPaperQuestion.setPaperQuestionId(idPo.getPaperQuestionId()); + examPaperQuestion.setCreateOn(LocalDateTime.now()); + examPaperQuestion.setUpdateOn(LocalDateTime.now()); + examPaperQuestion.setSortValue(idPo.getSortValue()); + examPaperQuestion.setQuestionType(paperQuestionIdTypeMap.get(idPo.getPaperQuestionId())); + saveRecordList.add(examPaperQuestion); + } + iExamPaperQuestionService.saveBatch(saveRecordList); + + List questionUsageCntUpdateList = examPaperQuestionIdList.stream().map(ExamPaperQuestionIdPO::getPaperQuestionId).collect(Collectors.toList()); + for (Long questionId : questionUsageCntUpdateList) { + questionUsageCntUpdate(questionId); + } + } + + @Transactional(rollbackFor = Exception.class) + public void saveExamPaper(ReqSaveExamPaperPO request) { + // 根据登录用户所在区域,获取全局试卷规则 + UserBasicInfoVO userFullInfo = userInfoHelper.getUserFullInfo(); + Long regionId = userFullInfo.getRegionId(); + ReqExamRulePO examRulePo = new ReqExamRulePO(); + examRulePo.setRegionId(regionId); + ResExamRuleVO examRule = getExamRule(examRulePo); + // 获取入参 + Long id = request.getId(); + List singleChoiceQuestionList = request.getSingleChoiceQuestionList(); + List multipleChoiceQuestionList = request.getMultipleChoiceQuestionList(); + List judgmentalQuestionList = request.getJudgmentalQuestionList(); + List questionUsageCntUpdateList = new ArrayList<>(); + + // 校验分数 + validExamRule(examRule, singleChoiceQuestionList, multipleChoiceQuestionList, judgmentalQuestionList); + + questionUsageCntUpdateList.addAll(singleChoiceQuestionList.stream().map(ExamPaperQuestionIdPO::getPaperQuestionId).collect(Collectors.toList())); + questionUsageCntUpdateList.addAll(multipleChoiceQuestionList.stream().map(ExamPaperQuestionIdPO::getPaperQuestionId).collect(Collectors.toList())); + questionUsageCntUpdateList.addAll(judgmentalQuestionList.stream().map(ExamPaperQuestionIdPO::getPaperQuestionId).collect(Collectors.toList())); + + if (Objects.isNull(id)) { + createExamPaper(request,examRulePo); + } else { + ExamPaper examPaper = iExamPaperService.getById(id); + if (Objects.isNull(examPaper)) { + throw new BizException("试卷不存在"); + } + // 获取入参 + List examPaperQuestionIdList = new ArrayList<>(); + examPaperQuestionIdList.addAll(singleChoiceQuestionList); + examPaperQuestionIdList.addAll(multipleChoiceQuestionList); + examPaperQuestionIdList.addAll(judgmentalQuestionList); + + List questionIdList = examPaperQuestionIdList.stream() + .map(ExamPaperQuestionIdPO::getPaperQuestionId).collect(Collectors.toList()); + + List paperQuestionList = iPaperQuestionService + .list(Wrappers.lambdaQuery(PaperQuestion.class).in(PaperQuestion::getId, questionIdList)); + Map paperQuestionIdTypeMap = paperQuestionList.stream().collect(Collectors.toMap(PaperQuestion::getId, PaperQuestion::getQuestionType)); + + List oldExamPaperQuestionList = iExamPaperQuestionService.list(Wrappers.lambdaQuery(ExamPaperQuestion.class) + .eq(ExamPaperQuestion::getExamPaperId, examPaper.getId())); + + // 保存试卷基本信息 + examPaper.setUpdateOn(LocalDateTime.now()); + examPaper.setExamPaperName(request.getExamPaperName()); + examPaper.setFullScore(ExamPaperQualifiedScoreConstant.EXAM_PAPER_FULL_SCORE); + examPaper.setQualifiedScore(ExamPaperQualifiedScoreConstant.EXAM_PAPER_QUALIFIED_SCORE); + examPaper.setRegionId(regionId); + examPaper.setExamRuleJson(JSONObject.toJSONString(examRule)); + examPaper.setIsRandom(IsRandomEnum.NOT_RANDOM_PAPER.getCode()); + iExamPaperService.updateById(examPaper); + + // 删除旧关系 保存新试卷题目关联关系 + iExamPaperQuestionService.remove(Wrappers.lambdaQuery(ExamPaperQuestion.class) + .eq(ExamPaperQuestion::getExamPaperId, examPaper.getId())); + + List saveRecordList = new ArrayList<>(); + for (ExamPaperQuestionIdPO po : examPaperQuestionIdList) { + ExamPaperQuestion examPaperQuestion = new ExamPaperQuestion(); + examPaperQuestion.setExamPaperId(examPaper.getId()); + examPaperQuestion.setPaperQuestionId(po.getPaperQuestionId()); + examPaperQuestion.setCreateOn(LocalDateTime.now()); + examPaperQuestion.setUpdateOn(LocalDateTime.now()); + examPaperQuestion.setSortValue(po.getSortValue()); + examPaperQuestion.setQuestionType(paperQuestionIdTypeMap.get(po.getPaperQuestionId())); + saveRecordList.add(examPaperQuestion); + } + iExamPaperQuestionService.saveBatch(saveRecordList); + + if (CollectionUtil.isNotEmpty(oldExamPaperQuestionList)) { + questionUsageCntUpdateList.addAll(oldExamPaperQuestionList.stream() + .map(ExamPaperQuestion::getPaperQuestionId).collect(Collectors.toList())); + questionUsageCntUpdateList = questionUsageCntUpdateList.stream().distinct().collect(Collectors.toList()); + for (Long questionId : questionUsageCntUpdateList) { + questionUsageCntUpdate(questionId); + } + } + } + } + + private void validExamRule(ResExamRuleVO examRule, List singleChoiceQuestionList, List multipleChoiceQuestionList, List judgmentalQuestionList) { + ExamRuleInfo judgmentalQuestionRule = examRule.getJudgmentalQuestionRule(); + ExamRuleInfo multipleChoiceQuestionRule = examRule.getMultipleChoiceQuestionRule(); + ExamRuleInfo singleChoiceQuestionRule = examRule.getSingleChoiceQuestionRule(); + int singleChoiceQuestionNum = singleChoiceQuestionList.size(); + int multipleChoiceQuestionNum = multipleChoiceQuestionList.size(); + int judgmentalQuestionNum = judgmentalQuestionList.size(); + if (singleChoiceQuestionNum != singleChoiceQuestionRule.getQuestionCnt() + || multipleChoiceQuestionNum != multipleChoiceQuestionRule.getQuestionCnt() + || judgmentalQuestionNum != judgmentalQuestionRule.getQuestionCnt()) { + throw new BizException("题目数量不正确,请按规定选择!"); + } + } + + /** + * questionId + * + * @param questionId + */ + public void questionUsageCntUpdate(Long questionId) { + PaperQuestion paperQuestion = iPaperQuestionService.getById(questionId); + if (Objects.isNull(paperQuestion)) { + return; + } else { + long usage = iExamPaperQuestionService.count(Wrappers.lambdaQuery(ExamPaperQuestion.class) + .eq(ExamPaperQuestion::getPaperQuestionId, questionId)); + paperQuestion.setUsageCnt(usage); + iPaperQuestionService.updateById(paperQuestion); + } + } + + + public ResExamPaperVO getExamPaperId(Long examPaperId) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ExamPaper.class); + ExaminationPaperManage context = (ExaminationPaperManage) AopContext.currentProxy(); + context.buildQuery(wrapper, examPaperId); + ExamPaper examPaper = iExamPaperService.getOne(wrapper); + if (Objects.isNull(examPaper)) { + throw new BizException("未获取到考试试卷!"); + } + + // 判断是否可以考试 + LocalDateTime now = LocalDateTime.now(); + LocalDateTime examStartTime = examPaper.getExamStartTime(); + LocalDateTime examEndTime = examPaper.getExamEndTime(); + // 设置了考试时间 + if (Objects.nonNull(examStartTime) && Objects.nonNull(examEndTime)) { + String examStartStr = NdDateUtils.format(examStartTime, NdDateUtils.DEFAULT_DATE_FORMAT); + String examEndStr = NdDateUtils.format(examEndTime, NdDateUtils.DEFAULT_DATE_FORMAT); + if (now.compareTo(examStartTime) < 0){ + throw new BizException("当前培训考试未开始,考试时间为:" + examStartStr + StrPool.DASH + examEndStr); + } else if (now.compareTo(examEndTime) > 0) { + throw new BizException("当前培训考试已结束,考试时间为:" + examStartStr + StrPool.DASH + examEndStr); + } + } + + // 获取题目id 列表 + List examPaperQuestionList = iExamPaperQuestionService.list(Wrappers.lambdaQuery(ExamPaperQuestion.class) + .eq(ExamPaperQuestion::getExamPaperId, examPaperId)); + List paperQuestionIdList = examPaperQuestionList.stream().map(ExamPaperQuestion::getPaperQuestionId).collect(Collectors.toList()); + List paperQuestionList = iPaperQuestionService + .list(Wrappers.lambdaQuery(PaperQuestion.class).in(PaperQuestion::getId, paperQuestionIdList)); + + Map> groupByQuestionTypeList = paperQuestionList.stream().map(QuestionAssembler::buildResQuestionDetailVO) + .collect(Collectors.groupingBy(ResQuestionDetailVO::getQuestionType)); + + // 装配返回 + ResExamPaperVO resExamPaperVO = new ResExamPaperVO(); + resExamPaperVO.setExamPaperName(examPaper.getExamPaperName()); + resExamPaperVO.setResExamRuleVO(JSONObject.parseObject(examPaper.getExamRuleJson(), ResExamRuleVO.class)); + resExamPaperVO.setSingleChoiceQuestionList(groupByQuestionTypeList + .get(QuestionTypeEnum.SINGLE_CHOICE)); + resExamPaperVO.setMultipleChoiceQuestionList(groupByQuestionTypeList + .get(QuestionTypeEnum.MULTIPLE_CHOICE)); + resExamPaperVO.setJudgmentalQuestionList(groupByQuestionTypeList + .get(QuestionTypeEnum.JUDGMENTAL)); + return resExamPaperVO; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ONLY_REGION) + public void buildQuery(LambdaQueryWrapper wrapper, Long examPaperId) { + wrapper.eq(ExamPaper::getId,examPaperId); + } + + + @Transactional(rollbackFor = Exception.class) + public void saveExamRule(ReqSaveExamRulePO request) { + // 判断 题目类型 总分是否为100 + ExamRuleInfo jr = request.getJudgmentalQuestionRule(); + ExamRuleInfo mr = request.getMultipleChoiceQuestionRule(); + ExamRuleInfo sr = request.getSingleChoiceQuestionRule(); + if (jr.getPerQuestionScore() * jr.getQuestionCnt() + + mr.getPerQuestionScore() * mr.getQuestionCnt() + + sr.getPerQuestionScore() * sr.getQuestionCnt() != 100) { + throw new BizException("试卷满分不为100分,请重新选择!"); + } + Long regionId = request.getRegionId(); + saveExamRule(sr, QuestionTypeEnum.SINGLE_CHOICE,regionId); + saveExamRule(mr, QuestionTypeEnum.MULTIPLE_CHOICE,regionId); + saveExamRule(jr, QuestionTypeEnum.JUDGMENTAL,regionId); + } + + public void saveExamRule(ExamRuleInfo examRuleInfo, QuestionTypeEnum questionTypeEnum, Long regionId) { + ExamRule examRule = iExamRuleService.getOne(Wrappers.lambdaQuery(ExamRule.class) + .eq(ExamRule::getRegionId,regionId) + .eq(ExamRule::getQuestionType, questionTypeEnum.name())); + if (Objects.isNull(examRule)) { + examRule = new ExamRule(); + examRule.setCreateOn(LocalDateTime.now()); + examRule.setCreateBy(LoginUserUtil.getUserId()); + } + examRule.setQuestionType(questionTypeEnum.name()); + examRule.setQuestionCnt(examRuleInfo.getQuestionCnt()); + examRule.setPerQuestionScore(examRuleInfo.getPerQuestionScore()); + examRule.setUpdateOn(LocalDateTime.now()); + examRule.setUpdateBy(LoginUserUtil.getUserId()); + examRule.setRegionId(regionId); + iExamRuleService.saveOrUpdate(examRule); + } + + public ResExamRuleVO getExamRule(ReqExamRulePO request) { + Long regionId = request.getRegionId(); + // 判断登录用户区域权限是否包含传入的区域 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + List childList = regionsCacheHelper.listChildRegionId(userDetail.getRegionId(), true, true); + // 传入的区域ID不在登录用户权限内,返回空 + if (!childList.contains(regionId)){ + return null; + } + ExamRuleInfo singleChoiceExamRule = getExamRule(QuestionTypeEnum.SINGLE_CHOICE,regionId); + ExamRuleInfo multipleChoiceExamRule = getExamRule(QuestionTypeEnum.MULTIPLE_CHOICE,regionId); + ExamRuleInfo judgmentalExamRule = getExamRule(QuestionTypeEnum.JUDGMENTAL,regionId); + + ResExamRuleVO resExamRuleVO = new ResExamRuleVO(); + resExamRuleVO.setSingleChoiceQuestionRule(singleChoiceExamRule); + resExamRuleVO.setMultipleChoiceQuestionRule(multipleChoiceExamRule); + resExamRuleVO.setJudgmentalQuestionRule(judgmentalExamRule); + return resExamRuleVO; + } + + public ExamRuleInfo getExamRule(QuestionTypeEnum questionTypeEnum,Long regionId) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ExamRule.class); + wrapper.eq(ExamRule::getQuestionType, questionTypeEnum.name()); + wrapper.eq(ExamRule::getRegionId,regionId); + // 获取当前区域的试卷规则 + ExamRule examRule = iExamRuleService.getOne(wrapper); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + Integer regionLevel = regionDto.getRegionLevel(); + + // 如果登录用户所属区域没有设置试卷规则,则获取其上一级行政区域的规则 + // 如果是区县一级 + if (DefValConstants.QU_REGION_LEVEL.equals(regionLevel)) { + // 如果为空,获取市一级的试卷规则 + if (Objects.isNull(examRule)) { + Long parentRegionId = regionDto.getParentId(); + examRule = getRegionExamRule(questionTypeEnum,parentRegionId); + // 如果为空,获取省一级的试卷规则 + if (Objects.isNull(examRule)){ + examRule = getRegionExamRule(questionTypeEnum,DefValConstants.ZJREGION_ID); + } + } + } + // 如果是市一级 + else if (DefValConstants.CITY_REGION_LEVEL.equals(regionLevel)) { + // 如果为空,获取省一级的试卷规则 + if (Objects.isNull(examRule)){ + examRule = getRegionExamRule(questionTypeEnum,DefValConstants.ZJREGION_ID); + } + } + + ExamRuleInfo examRuleInfo = new ExamRuleInfo(); + if (Objects.nonNull(examRule)) { + examRuleInfo.setQuestionType(QuestionTypeEnum.valueOf(examRule.getQuestionType())); + examRuleInfo.setQuestionCnt(examRule.getQuestionCnt()); + examRuleInfo.setPerQuestionScore(examRule.getPerQuestionScore()); + } + return examRuleInfo; + } + + private ExamRule getRegionExamRule(QuestionTypeEnum questionTypeEnum,Long regionId) { + ExamRule examRule; + examRule = iExamRuleService.getOne(Wrappers.lambdaQuery(ExamRule.class) + .eq(ExamRule::getQuestionType, questionTypeEnum.name()) + .eq(ExamRule::getRegionId, regionId)); + return examRule; + } + + public PageVo listExamPaper(ReqExamPaperListPO request) { + Integer pageNumber = request.getPageNumber(); + Integer pageSize = request.getPageSize(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ExamPaper.class); + ExaminationPaperManage context = (ExaminationPaperManage) AopContext.currentProxy(); + context.buildExamPaperQuery(wrapper, request); + Page page = iExamPaperService.page(new Page<>(pageNumber, pageSize), wrapper); + + PageVo pageVo = new PageVo<>(); + long total = page.getTotal(); + pageVo.setTotal(total); + if (0 == total) { + pageVo.setRecords(new ArrayList<>()); + return pageVo; + } + List records = page.getRecords(); + List resVOList = records.stream().map(r -> { + ResExamPaperListVO resVO = new ResExamPaperListVO(); + resVO.setId(r.getId()); + resVO.setCreateTime(r.getCreateOn()); + resVO.setPaperName(r.getExamPaperName()); + if (Objects.nonNull(r.getRegionId())) { + resVO.setRegionId(r.getRegionId()); + resVO.setRegionName(regionsCacheHelper.getDisplayName(r.getRegionId())); + } + return resVO; + }).collect(Collectors.toList()); + pageVo.setRecords(resVOList); + return pageVo; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ONLY_REGION) + public void buildExamPaperQuery(LambdaQueryWrapper wrapper, ReqExamPaperListPO request) { + // 获取入参 + String paperName = request.getPaperName(); + Long regionId = request.getRegionId(); + List regionIdList = new ArrayList<>(); + if (Objects.nonNull(regionId)) { + regionIdList = regionsCacheHelper.listChildRegionId(regionId); + } + wrapper.like(StringUtils.isNotBlank(paperName), ExamPaper::getExamPaperName, paperName) + .eq(ExamPaper::getIsRandom,IsRandomEnum.NOT_RANDOM_PAPER.getCode()) + .in(CollectionUtil.isNotEmpty(regionIdList), ExamPaper::getRegionId, regionIdList) + .orderByDesc(ExamPaper::getCreateOn); + } + + public void deleteExamPaper(Long id) { + iExamPaperService.removeById(id); + List examPaperQuestionList = iExamPaperQuestionService.list(Wrappers.lambdaQuery(ExamPaperQuestion.class) + .eq(ExamPaperQuestion::getExamPaperId, id)); + + if (CollectionUtil.isNotEmpty(examPaperQuestionList)) { + List questionUsageCntUpdateList = examPaperQuestionList.stream() + .map(ExamPaperQuestion::getPaperQuestionId).collect(Collectors.toList()); + for (Long questionId : questionUsageCntUpdateList) { + questionUsageCntUpdate(questionId); + } + iExamPaperQuestionService.remove(Wrappers.lambdaQuery(ExamPaperQuestion.class) + .eq(ExamPaperQuestion::getExamPaperId, id)); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/manage/PaperQuestionManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/manage/PaperQuestionManage.java new file mode 100644 index 0000000..b0c53a5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/manage/PaperQuestionManage.java @@ -0,0 +1,215 @@ +package com.ningdatech.carapi.archives.manage; + +import cn.hutool.core.collection.CollectionUtil; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +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.carapi.archives.assembler.QuestionAssembler; +import com.ningdatech.carapi.archives.entity.PaperQuestion; +import com.ningdatech.carapi.archives.enums.PaperQuestionStatusEnum; +import com.ningdatech.carapi.archives.model.JudgmentalQuestionTextContent; +import com.ningdatech.carapi.archives.model.MultipleChoiceQuestionTextContent; +import com.ningdatech.carapi.archives.model.SingleChoiceQuestionTextContent; +import com.ningdatech.carapi.archives.model.po.ReqQuestionListPO; +import com.ningdatech.carapi.archives.model.po.ReqSaveNewQuestionPO; +import com.ningdatech.carapi.archives.model.vo.ResQuestionDetailVO; +import com.ningdatech.carapi.archives.model.vo.ResQuestionListVO; +import com.ningdatech.carapi.archives.service.IPaperQuestionService; +import com.ningdatech.carapi.common.helper.UserInfoHelper; +import com.ningdatech.carapi.driver.constant.QuestionTypeEnum; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/10/11 下午4:28 + */ +@Component +@RequiredArgsConstructor +public class PaperQuestionManage { + + private final IPaperQuestionService iPaperQuestionService; + private final RegionsCacheHelper regionsCacheHelper; + private final UserInfoHelper userInfoHelper; + + public PageVo questionList(ReqQuestionListPO request) { + Integer pageNumber = request.getPageNumber(); + Integer pageSize = request.getPageSize(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PaperQuestion.class); + buildQuestionQuery(wrapper, request); + Page page = iPaperQuestionService.page(new Page<>(pageNumber, pageSize),wrapper); + List records = page.getRecords(); + long total = page.getTotal(); + + PageVo pageVo = new PageVo<>(); + pageVo.setTotal(total); + if (total == 0) { + return pageVo; + } + List resQuestionListVOList = records.stream().map(r -> { + ResQuestionListVO resQuestionListVO = new ResQuestionListVO(); + resQuestionListVO.setId(r.getId()); + resQuestionListVO.setQuestion(r.getStem()); + resQuestionListVO.setQuestionType(QuestionTypeEnum.valueOf(r.getQuestionType())); + resQuestionListVO.setUsageCnt(r.getUsageCnt()); + resQuestionListVO.setFormulationTime(r.getCreateOn()); + return resQuestionListVO; + }).collect(Collectors.toList()); + pageVo.setRecords(resQuestionListVOList); + return pageVo; + } + + //@LambdaDataScope + private void buildQuestionQuery(LambdaQueryWrapper wrapper, ReqQuestionListPO request) { + // 获取入参信息 + String question = request.getQuestion(); + QuestionTypeEnum questionType = request.getQuestionType(); + Long regionId = request.getRegionId(); + // 入参转换参数 + String questionTypeStr = Objects.isNull(questionType) ? null : questionType.name(); + List regionIdList = new ArrayList<>(); + if (Objects.nonNull(regionId)) { + regionIdList = regionsCacheHelper.listChildRegionId(regionId); + } + wrapper.eq(Objects.nonNull(questionType), PaperQuestion::getQuestionType, questionTypeStr) + .eq(PaperQuestion::getQuestionStatus, PaperQuestionStatusEnum.IN_USE.name()) + .in(CollectionUtil.isNotEmpty(regionIdList), PaperQuestion::getRegionId, regionIdList) + .like(StringUtils.isNotBlank(question), PaperQuestion::getQuestionTextContent, question); + } + + public ResQuestionDetailVO questionDetail(Long questionId) { + PaperQuestion paperQuestion = iPaperQuestionService.getById(questionId); + if (Objects.isNull(paperQuestion)) { + return null; + } + return QuestionAssembler.buildResQuestionDetailVO(paperQuestion); + } + + public void createNewQuestion(ReqSaveNewQuestionPO po) { + QuestionTypeEnum questionType = po.getQuestionType(); + PaperQuestion paperQuestion = new PaperQuestion(); + + String stem = po.getStem(); + String questionTextContent = null; + String correctJsonStr = null; + switch (questionType) { + case JUDGMENTAL: + JudgmentalQuestionTextContent judgmentalQuestionTextContent = new JudgmentalQuestionTextContent(); + judgmentalQuestionTextContent.setStem(stem); + judgmentalQuestionTextContent.setAnswer(po.getJudgmentalQuestionCorrectAnswer()); + questionTextContent = JSONObject.toJSONString(judgmentalQuestionTextContent); + correctJsonStr = JSONObject.toJSONString(po.getJudgmentalQuestionCorrectAnswer()); + break; + case SINGLE_CHOICE: + SingleChoiceQuestionTextContent singleChoiceQuestionTextContent = new SingleChoiceQuestionTextContent(); + singleChoiceQuestionTextContent.setStem(stem); + singleChoiceQuestionTextContent.setOptions(po.getOptions()); + singleChoiceQuestionTextContent.setAnswer(po.getChoiceQuestionCorrectAnswer().get(0)); + questionTextContent = JSONObject.toJSONString(singleChoiceQuestionTextContent); + correctJsonStr = JSONObject.toJSONString(po.getChoiceQuestionCorrectAnswer().get(0)); + + break; + case MULTIPLE_CHOICE: + MultipleChoiceQuestionTextContent multipleChoiceQuestionTextContent = new MultipleChoiceQuestionTextContent(); + multipleChoiceQuestionTextContent.setStem(stem); + multipleChoiceQuestionTextContent.setOptions(po.getOptions()); + multipleChoiceQuestionTextContent.setAnswer(po.getChoiceQuestionCorrectAnswer()); + questionTextContent = JSONObject.toJSONString(multipleChoiceQuestionTextContent); + correctJsonStr = JSONObject.toJSONString(po.getChoiceQuestionCorrectAnswer()); + break; + default: + break; + } + + paperQuestion.setCreateOn(LocalDateTime.now()); + paperQuestion.setUpdateOn(LocalDateTime.now()); + paperQuestion.setStem(stem); + paperQuestion.setCorrect(correctJsonStr); + paperQuestion.setQuestionStatus(PaperQuestionStatusEnum.IN_USE.name()); + paperQuestion.setQuestionTextContent(questionTextContent); + paperQuestion.setQuestionType(questionType.name()); + paperQuestion.setUsageCnt(0L); + paperQuestion.setRegionId(userInfoHelper.getUserRegionId()); + iPaperQuestionService.save(paperQuestion); + } + + public void saveQuestion(ReqSaveNewQuestionPO request) { + Long id = request.getId(); + if (Objects.nonNull(id)) { + PaperQuestion currentPaperQuestion = iPaperQuestionService.getById(id); + if (Objects.isNull(currentPaperQuestion)) { + throw new BizException("试题不存在"); + } + assemblerQuestionSaveRecord(currentPaperQuestion, request); + iPaperQuestionService.updateById(currentPaperQuestion); + + } else { + PaperQuestion paperQuestion = new PaperQuestion(); + assemblerQuestionSaveRecord(paperQuestion, request); + paperQuestion.setCreateOn(LocalDateTime.now()); + paperQuestion.setQuestionStatus(PaperQuestionStatusEnum.IN_USE.name()); + paperQuestion.setUsageCnt(0L); + paperQuestion.setRegionId(userInfoHelper.getUserRegionId()); + iPaperQuestionService.save(paperQuestion); + } + } + + private void assemblerQuestionSaveRecord(PaperQuestion saveRecord, ReqSaveNewQuestionPO request) { + QuestionTypeEnum questionType = request.getQuestionType(); + String stem = request.getStem(); + String questionTextContent = null; + String correctJsonStr = null; + switch (questionType) { + case JUDGMENTAL: + JudgmentalQuestionTextContent judgmentalQuestionTextContent = new JudgmentalQuestionTextContent(); + judgmentalQuestionTextContent.setStem(stem); + judgmentalQuestionTextContent.setAnswer(request.getJudgmentalQuestionCorrectAnswer()); + questionTextContent = JSONObject.toJSONString(judgmentalQuestionTextContent); + correctJsonStr = JSONObject.toJSONString(request.getJudgmentalQuestionCorrectAnswer()); + break; + case SINGLE_CHOICE: + SingleChoiceQuestionTextContent singleChoiceQuestionTextContent = new SingleChoiceQuestionTextContent(); + singleChoiceQuestionTextContent.setStem(stem); + singleChoiceQuestionTextContent.setOptions(request.getOptions()); + singleChoiceQuestionTextContent.setAnswer(request.getChoiceQuestionCorrectAnswer().get(0)); + questionTextContent = JSONObject.toJSONString(singleChoiceQuestionTextContent); + correctJsonStr = JSONObject.toJSONString(request.getChoiceQuestionCorrectAnswer().get(0)); + + break; + case MULTIPLE_CHOICE: + MultipleChoiceQuestionTextContent multipleChoiceQuestionTextContent = new MultipleChoiceQuestionTextContent(); + multipleChoiceQuestionTextContent.setStem(stem); + multipleChoiceQuestionTextContent.setOptions(request.getOptions()); + multipleChoiceQuestionTextContent.setAnswer(request.getChoiceQuestionCorrectAnswer()); + questionTextContent = JSONObject.toJSONString(multipleChoiceQuestionTextContent); + correctJsonStr = JSONObject.toJSONString(request.getChoiceQuestionCorrectAnswer()); + break; + default: + break; + } + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setStem(stem); + saveRecord.setCorrect(correctJsonStr); + saveRecord.setQuestionTextContent(questionTextContent); + saveRecord.setQuestionType(questionType.name()); + } + + public void deleteQuestion(Long id) { + PaperQuestion paperQuestion = iPaperQuestionService.getById(id); + if (paperQuestion.getUsageCnt() > 0) { + throw new BizException("试题已被使用无法删除"); + } + iPaperQuestionService.removeById(id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/ExamPaperMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/ExamPaperMapper.java new file mode 100644 index 0000000..f49cdd0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/ExamPaperMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.archives.mapper; + +import com.ningdatech.carapi.archives.entity.ExamPaper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-17 + */ +public interface ExamPaperMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/ExamPaperMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/ExamPaperMapper.xml new file mode 100644 index 0000000..7fcaeb8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/ExamPaperMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/ExamPaperQuestionMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/ExamPaperQuestionMapper.java new file mode 100644 index 0000000..3efc6f5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/ExamPaperQuestionMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.archives.mapper; + +import com.ningdatech.carapi.archives.entity.ExamPaperQuestion; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-17 + */ +public interface ExamPaperQuestionMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/ExamPaperQuestionMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/ExamPaperQuestionMapper.xml new file mode 100644 index 0000000..516dc51 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/ExamPaperQuestionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/NdPaperQuestionMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/NdPaperQuestionMapper.java new file mode 100644 index 0000000..7bf8300 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/NdPaperQuestionMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.archives.mapper; + +import com.ningdatech.carapi.archives.entity.PaperQuestion; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author LiuXinXin + * @since 2022-10-11 + */ +public interface NdPaperQuestionMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/NdPaperQuestionMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/NdPaperQuestionMapper.xml new file mode 100644 index 0000000..70c431b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/mapper/NdPaperQuestionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/ExamRuleInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/ExamRuleInfo.java new file mode 100644 index 0000000..81f6f24 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/ExamRuleInfo.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.archives.model; + +import com.ningdatech.carapi.driver.constant.QuestionTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/10/22 下午2:33 + */ +@ApiModel("试卷规则") +@Data +public class ExamRuleInfo { + + @ApiModelProperty("每题分数") + private Integer perQuestionScore; + + @ApiModelProperty(value = "题目类型", allowableValues = "SINGLE_CHOICE 单项选择题" + + ",MULTIPLE_CHOICE 多项选择题 ,JUDGMENTAL 判断题") + @NotNull(message = "题目类型 不能为空") + private QuestionTypeEnum questionType; + + @ApiModelProperty("题目需要数量") + private Integer questionCnt; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/JudgmentalQuestionTextContent.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/JudgmentalQuestionTextContent.java new file mode 100644 index 0000000..c49000a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/JudgmentalQuestionTextContent.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.archives.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/17 下午3:00 + */ +@Data +@ApiModel("判断题题目 填空、 题干、解析、答案等信息") +public class JudgmentalQuestionTextContent { + + @ApiModelProperty("题目") + private String stem; + + @ApiModelProperty("答案") + private Boolean answer; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/MultipleChoiceQuestionTextContent.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/MultipleChoiceQuestionTextContent.java new file mode 100644 index 0000000..f8185b6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/MultipleChoiceQuestionTextContent.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.archives.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/17 下午3:00 + */ +@Data +@ApiModel("多选题题目 填空、 题干、解析、答案等信息") +public class MultipleChoiceQuestionTextContent { + + @ApiModelProperty("题目") + private String stem; + + @ApiModelProperty("选项") + private List options; + + @ApiModelProperty("答案") + private List answer; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/ShortAnswerQuestionTextContent.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/ShortAnswerQuestionTextContent.java new file mode 100644 index 0000000..71f8eda --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/ShortAnswerQuestionTextContent.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.archives.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/17 下午2:55 + */ +@Data +@ApiModel("简答题题目 填空、 题干、解析、答案等信息") +public class ShortAnswerQuestionTextContent { + @ApiModelProperty("题目") + private String stem; + + @ApiModelProperty("答案") + private String answer; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/SingleChoiceQuestionTextContent.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/SingleChoiceQuestionTextContent.java new file mode 100644 index 0000000..71246fe --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/SingleChoiceQuestionTextContent.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.archives.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/17 下午3:00 + */ +@Data +@ApiModel("单选题题目 填空、 题干、解析、答案等信息") +public class SingleChoiceQuestionTextContent { + + @ApiModelProperty("题目") + private String stem; + + @ApiModelProperty("选项") + private List options; + + @ApiModelProperty("答案") + private String answer; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqExamPaperListPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqExamPaperListPO.java new file mode 100644 index 0000000..c53fe97 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqExamPaperListPO.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.archives.model.po; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/22 下午5:21 + */ +@Data +@ApiModel("培训试卷列表请求PO") +public class ReqExamPaperListPO extends PagePo { + + @ApiModelProperty("试卷名称") + private String paperName; + + @ApiModelProperty("所属区域id") + private Long regionId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqExamRulePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqExamRulePO.java new file mode 100644 index 0000000..ed61b8f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqExamRulePO.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.archives.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/22 下午2:32 + */ +@Data +@ApiModel("保存试卷规则") +public class ReqExamRulePO { + + @ApiModelProperty("区域ID") + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqQuestionListPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqQuestionListPO.java new file mode 100644 index 0000000..b103b5c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqQuestionListPO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.archives.model.po; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.carapi.driver.constant.QuestionTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/11 下午4:30 + */ +@Data +@ApiModel(description = "培训题库列表查询入参") +public class ReqQuestionListPO extends PagePo { + @ApiModelProperty("题目") + private String question; + + @ApiModelProperty("试题类型") + private QuestionTypeEnum questionType; + + @ApiModelProperty("区域id") + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqSaveExamPaperPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqSaveExamPaperPO.java new file mode 100644 index 0000000..892d2f4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqSaveExamPaperPO.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.archives.model.po; + +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.util.List; + +/** + * @author liuxinxin + * @date 2022/10/17 下午4:31 + */ + +@Data +@ApiModel(description = "新增试卷PO") +public class ReqSaveExamPaperPO { + + private Long id; + + @ApiModelProperty("试卷名称") + @NotBlank + private String examPaperName; + + @ApiModelProperty("单选题列表") + List singleChoiceQuestionList; + + @ApiModelProperty("多项选择题列表") + List multipleChoiceQuestionList; + + @ApiModelProperty("判断题列表") + List judgmentalQuestionList; + + @Data + @ApiModel + public static class ExamPaperQuestionIdPO { + + @ApiModelProperty("题目id") + private Long paperQuestionId; + + @ApiModelProperty("题目排序值 按从小到大排序") + private Long sortValue; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqSaveExamRulePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqSaveExamRulePO.java new file mode 100644 index 0000000..123bbc8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqSaveExamRulePO.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.archives.model.po; + +import com.ningdatech.carapi.archives.model.ExamRuleInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/22 下午2:32 + */ +@Data +@ApiModel("保存试卷规则") +public class ReqSaveExamRulePO { + + @ApiModelProperty("单项选择题 规则") + private ExamRuleInfo singleChoiceQuestionRule; + + @ApiModelProperty("多项选择题 规则") + private ExamRuleInfo multipleChoiceQuestionRule; + + @ApiModelProperty("判断题 规则") + private ExamRuleInfo judgmentalQuestionRule; + + @ApiModelProperty("区域ID") + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqSaveNewQuestionPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqSaveNewQuestionPO.java new file mode 100644 index 0000000..77e4cce --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/po/ReqSaveNewQuestionPO.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.archives.model.po; + +import com.ningdatech.carapi.driver.constant.QuestionTypeEnum; +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.util.List; + +/** + * @author liuxinxin + * @date 2022/10/17 下午2:26 + */ +@Data +@ApiModel("创建新试题PO") +public class ReqSaveNewQuestionPO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty(value = "题目类型", allowableValues = "SINGLE_CHOICE 单项选择题" + + ",MULTIPLE_CHOICE 多项选择题 ,JUDGMENTAL 判断题") + @NotNull(message = "题目类型 不能为空") + private QuestionTypeEnum questionType; + + @ApiModelProperty("题目内容") + @NotBlank(message = "题目内容不能为空") + private String stem; + + @ApiModelProperty("选择题选项") + private List options; + + @ApiModelProperty("选择题正确答案") + private List choiceQuestionCorrectAnswer; + + @ApiModelProperty("判断题正确答案") + private Boolean judgmentalQuestionCorrectAnswer; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResExamPaperListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResExamPaperListVO.java new file mode 100644 index 0000000..87cc8c7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResExamPaperListVO.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.archives.model.vo; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/10/22 下午5:21 + */ +@Data +@ApiModel("培训试卷列表VO") +public class ResExamPaperListVO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("试卷名称") + private String paperName; + + @ApiModelProperty("所属区域id") + private Long regionId; + + @ApiModelProperty("所属区域") + private String regionName; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResExamPaperVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResExamPaperVO.java new file mode 100644 index 0000000..b14574d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResExamPaperVO.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.archives.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/18 上午11:08 + */ +@Data +@ApiOperation("试卷") +public class ResExamPaperVO { + + @ApiModelProperty("试卷规则") + private ResExamRuleVO resExamRuleVO; + + @ApiModelProperty("试卷名称") + @NotBlank + private String examPaperName; + + @ApiModelProperty("单选题列表") + List singleChoiceQuestionList; + + @ApiModelProperty("多项选择题列表") + List multipleChoiceQuestionList; + + @ApiModelProperty("判断题列表") + List judgmentalQuestionList; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResExamRuleVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResExamRuleVO.java new file mode 100644 index 0000000..fc2e8d2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResExamRuleVO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.archives.model.vo; + +import com.ningdatech.carapi.archives.model.ExamRuleInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/22 下午2:50 + */ +@ApiModel("试卷规则") +@Data +public class ResExamRuleVO { + + @ApiModelProperty("单项选择题 规则") + private ExamRuleInfo singleChoiceQuestionRule; + + @ApiModelProperty("多项选择题 规则") + private ExamRuleInfo multipleChoiceQuestionRule; + + @ApiModelProperty("判断题 规则") + private ExamRuleInfo judgmentalQuestionRule; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResQuestionDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResQuestionDetailVO.java new file mode 100644 index 0000000..62cd7b2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResQuestionDetailVO.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.archives.model.vo; + +import com.ningdatech.carapi.driver.constant.QuestionTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/11 下午5:54 + */ +@Data +@ApiModel(description = "培训题详情VO") +public class ResQuestionDetailVO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("题目类型") + private QuestionTypeEnum questionType; + + @ApiModelProperty("题干") + private String stem; + + @ApiModelProperty("选择题选项") + private List options; + + @ApiModelProperty("选择题正确答案") + private List choiceQuestionCorrectAnswer; + + @ApiModelProperty("判断题正确答案") + private Boolean judgmentalQuestionCorrectAnswer; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResQuestionListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResQuestionListVO.java new file mode 100644 index 0000000..6499456 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/model/vo/ResQuestionListVO.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.archives.model.vo; + +import com.ningdatech.carapi.driver.constant.QuestionTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/10/11 下午4:30 + */ +@Data +@ApiModel(description = "培训题库列表VO") +public class ResQuestionListVO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("题目") + private String question; + + @ApiModelProperty("试题类型") + private QuestionTypeEnum questionType; + + @ApiModelProperty("选择次数") + private Long usageCnt; + + @ApiModelProperty("制定时间") + private LocalDateTime formulationTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/IExamPaperQuestionService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/IExamPaperQuestionService.java new file mode 100644 index 0000000..a277b2f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/IExamPaperQuestionService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.archives.service; + +import com.ningdatech.carapi.archives.entity.ExamPaperQuestion; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-17 + */ +public interface IExamPaperQuestionService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/IExamPaperService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/IExamPaperService.java new file mode 100644 index 0000000..8871e90 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/IExamPaperService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.archives.service; + +import com.ningdatech.carapi.archives.entity.ExamPaper; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-17 + */ +public interface IExamPaperService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/IPaperQuestionService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/IPaperQuestionService.java new file mode 100644 index 0000000..037c678 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/IPaperQuestionService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.archives.service; + +import com.ningdatech.carapi.archives.entity.PaperQuestion; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author LiuXinXin + * @since 2022-10-11 + */ +public interface IPaperQuestionService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/impl/ExamPaperQuestionServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/impl/ExamPaperQuestionServiceImpl.java new file mode 100644 index 0000000..e0de2c1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/impl/ExamPaperQuestionServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.archives.service.impl; + +import com.ningdatech.carapi.archives.entity.ExamPaperQuestion; +import com.ningdatech.carapi.archives.mapper.ExamPaperQuestionMapper; +import com.ningdatech.carapi.archives.service.IExamPaperQuestionService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-17 + */ +@Service +public class ExamPaperQuestionServiceImpl extends ServiceImpl implements IExamPaperQuestionService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/impl/ExamPaperServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/impl/ExamPaperServiceImpl.java new file mode 100644 index 0000000..b7580db --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/impl/ExamPaperServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.archives.service.impl; + +import com.ningdatech.carapi.archives.entity.ExamPaper; +import com.ningdatech.carapi.archives.mapper.ExamPaperMapper; +import com.ningdatech.carapi.archives.service.IExamPaperService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-17 + */ +@Service +public class ExamPaperServiceImpl extends ServiceImpl implements IExamPaperService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/impl/NdIPaperQuestionServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/impl/NdIPaperQuestionServiceImpl.java new file mode 100644 index 0000000..34e322a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/archives/service/impl/NdIPaperQuestionServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.archives.service.impl; + +import com.ningdatech.carapi.archives.entity.PaperQuestion; +import com.ningdatech.carapi.archives.mapper.NdPaperQuestionMapper; +import com.ningdatech.carapi.archives.service.IPaperQuestionService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author LiuXinXin + * @since 2022-10-11 + */ +@Service +public class NdIPaperQuestionServiceImpl extends ServiceImpl implements IPaperQuestionService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/contants/DigitalCockpitContant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/contants/DigitalCockpitContant.java new file mode 100644 index 0000000..f8ccf29 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/contants/DigitalCockpitContant.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.datascreen.contants; + +/** + * @Classname DigitalCockpitContant + * @Description + * @Date 2022/11/17 9:10 + * @Created by PoffyZhang + */ +public interface DigitalCockpitContant { + + public static final String FIELD_DAILY_OVERSPEED = "digital-cockpit:daily-overspeed-times"; + + public static final String FIELD_MONTHLY_VIOLATION = "digital-cockpit:monthly-violation-times"; + + public static final String FIELD_YEARLY_OUTDANGER = "digital-cockpit:yearly-outdanger-times"; + + public static final String FIELD_YEARLY_INJURIES = "digital-cockpit:yearly-injuries"; + + public static final String FIELD_YEARLY_DEATHTOLL = "digital-cockpit:yearly-deathToll"; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/controller/DigitalCockpitController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/controller/DigitalCockpitController.java new file mode 100644 index 0000000..75a8653 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/controller/DigitalCockpitController.java @@ -0,0 +1,166 @@ +package com.ningdatech.carapi.car.datascreen.controller; + +import java.util.List; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.carapi.car.datascreen.manage.DigitalCockpitManage; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.vo.StatisticsCenterVO; +import com.ningdatech.carapi.car.position.model.vo.ResRealTimeMonitorVehicleGisListVO; +import com.ningdatech.carapi.common.model.MapDataVO; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * 数字驾驶舱 + *

+ * + * @author PoffyZhang + * @since 2022-10-22 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/digital-cockpit") +@Api(value = "digital-cockpit", tags = "数字驾驶舱") +@RequiredArgsConstructor +public class DigitalCockpitController { + + private final DigitalCockpitManage digitalCockpitManage; + + private static final Integer OUT_DANGER = 1; + private static final Integer INJURIES = 2; + private static final Integer DEATH_TOLL = 3; + + @ApiOperation(value = "大屏中间统计数字", notes = "大屏中间统计数字") + @GetMapping("/statistics-center") + public StatisticsCenterVO statisticsCenter(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.statisticsCenter(param); + } + + @ApiOperation(value = "车辆gps点分布", notes = "车辆gps点分布") + @GetMapping("/gps") + public List getVehicleGps(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.getVehicleGps(param); + } + + @ApiOperation(value = "车辆超速次数", notes = "车辆超速次数") + @GetMapping("/overspeed-group") + public List overspeedGroup(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.overspeedGroup(param); + } + + @ApiOperation(value = "车辆违章次数", notes = "车辆违章次数") + @GetMapping("/violation-group") + public List violationGroup(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.violationGroup(param); + } + + @ApiOperation(value = "车辆出险次数", notes = "车辆出险次数") + @GetMapping("/outDanger-group") + public List outDangerGroup(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.outDangerGroup(param); + } + + @ApiOperation(value = "车辆受伤人数", notes = "车辆受伤人数") + @GetMapping("/injuries-group") + public List injuriesGroup(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.injuriesGroup(param); + } + + @ApiOperation(value = "车辆死亡人数", notes = "车辆死亡人数") + @GetMapping("/death-group") + public List deathGroup(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.deathGroup(param); + } + + @ApiOperation(value = "万车死亡人数", notes = "万车死亡人数") + @GetMapping("/death-group-ten-thousand") + public List deathGroupTenThousand(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.deathGroupTenThousand(param); + } + + @ApiOperation(value = "上线率分析", notes = "上线率分析") + @GetMapping("/online-analysis") + public JSONObject onlineAnalysis(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.onlineAnalysis(param); + } + + @ApiOperation(value = "超速分析", notes = "超速分析") + @GetMapping("/overspeed-analysis") + public JSONObject overspeedAnalysis(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.overspeedAnalysis(param); + } + + @ApiOperation(value = "全省月度超速对比", notes = "全省月度超速对比") + @GetMapping("/monthly-overspeed-analysis") + public JSONObject monthlyOverspeedAnalysis(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.monthlyOverspeedAnalysis(param); + } + + @ApiOperation(value = "全省月度出险对比", notes = "全省月度出险对比") + @GetMapping("/monthly-out-danger-analysis") + public JSONObject monthlyOutDangerAnalysis(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setType(OUT_DANGER); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.getInsureAnalysis(param,OUT_DANGER); + } + + @ApiOperation(value = "全省月度受伤人数对比", notes = "全省月度受伤人数对比") + @GetMapping("/monthly-injuries-analysis") + public JSONObject monthlyInjuriesAnalysis(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setType(INJURIES); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.getInsureAnalysis(param,INJURIES); + } + + @ApiOperation(value = "全省月度死亡人数对比", notes = "全省月度死亡人数对比") + @GetMapping("/monthly-death-analysis") + public JSONObject monthlyDeathAnalysis(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + param.setType(DEATH_TOLL); + param.setOperatorId(LoginUserUtil.getUserId()); + return digitalCockpitManage.getInsureAnalysis(param,DEATH_TOLL); + } + + @ApiOperation(value = "清缓存", notes = "清缓存") + @PostMapping("/remove-cache") + public String removeCache(@RequestParam(required = false) String cacheName) { + return digitalCockpitManage.removeCache(cacheName); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/controller/VehicleManageDataScreenController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/controller/VehicleManageDataScreenController.java new file mode 100644 index 0000000..198e2ab --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/controller/VehicleManageDataScreenController.java @@ -0,0 +1,76 @@ +package com.ningdatech.carapi.car.datascreen.controller; + +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.vo.*; +import com.ningdatech.carapi.car.datascreen.service.VehicleStatisticsService; +import com.ningdatech.carapi.common.util.CodeUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-22 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/vehicle/data-screen") +@Api(value = "vehicle", tags = "车辆管理-大屏") +@RequiredArgsConstructor +public class VehicleManageDataScreenController { + + private final VehicleStatisticsService vehicleStatisticsService; + + @ApiOperation(value = "车辆类型分布", notes = "车辆类型分布") + @GetMapping("/vehicle-types") + public List vehicleTypes(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return vehicleStatisticsService.getVehicleTypesStatistics(param); + } + + @ApiOperation(value = "各区域车辆分布", notes = "各区域车辆分布") + @GetMapping("/region") + public List regionDistribution(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return vehicleStatisticsService.getRegionDistribution(param); + } + + @ApiOperation(value = "保险机构出险分布", notes = "保险机构出险分布") + @GetMapping("/insure") + public List insureDistribution(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return vehicleStatisticsService.getInsureDistribution(param); + } + + @ApiOperation(value = "运营商机构分布", notes = "运营商机构分布") + @GetMapping("/operator") + public List operatorDistribution(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return vehicleStatisticsService.getOperatorDistribution(param); + } + + @ApiOperation(value = "车辆使用年限分布", notes = "车辆使用年限分布") + @GetMapping("/useful-life") + public List usefulLiftDistribution(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return vehicleStatisticsService.getUsefulLiftDistribution(param); + } + + @ApiOperation(value = "新增车辆数走势图", notes = "新增车辆数走势图") + @GetMapping("/year") + public List newVehicleNum(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return vehicleStatisticsService.getNewVehicleNum(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/manage/DigitalCockpitManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/manage/DigitalCockpitManage.java new file mode 100644 index 0000000..fb2d47a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/manage/DigitalCockpitManage.java @@ -0,0 +1,659 @@ +package com.ningdatech.carapi.car.datascreen.manage; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.temporal.TemporalAdjusters; +import java.util.*; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.cache.annotation.Caching; +import org.springframework.stereotype.Component; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.po.OnlineVehicleRegionsPO; +import com.ningdatech.carapi.car.datascreen.model.po.OnlineVehicleTimesPO; +import com.ningdatech.carapi.car.datascreen.model.po.OverspeedStatisticsPO; +import com.ningdatech.carapi.car.datascreen.model.vo.StatisticsCenterVO; +import com.ningdatech.carapi.car.datascreen.service.VehicleStatisticsService; +import com.ningdatech.carapi.car.position.manage.PositionMonitorManage; +import com.ningdatech.carapi.car.position.model.po.ReqRealTimeMonitorPO; +import com.ningdatech.carapi.car.position.model.vo.ResRealTimeMonitorVehicleGisListVO; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.model.KeyValueDTO; +import com.ningdatech.carapi.common.model.MapDataVO; +import com.ningdatech.carapi.common.model.po.MapDataPO; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.safe.entity.NdInsureOutDanger; +import com.ningdatech.carapi.safe.entity.VehicleOverspeedInfo; +import com.ningdatech.carapi.safe.model.po.OutDangerAnalysisPO; +import com.ningdatech.carapi.safe.model.po.OverspeedAnalysisPO; +import com.ningdatech.carapi.safe.service.INdInsureOutDangerService; +import com.ningdatech.carapi.safe.service.INdVehicleViolationService; +import com.ningdatech.carapi.safe.service.IVehicleOverspeedInfoService; +import com.ningdatech.carapi.safe.service.SecurityManageDataScreenService; +import com.ningdatech.carapi.safe.utils.InitDataUtil; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.util.NumberUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname DigitalCockpitManage + * @Description + * @Date 2022/11/17 9:01 + * @Created by PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class DigitalCockpitManage { + + private final CachePlusOps cachePlusOps; + + private final IVehicleOverspeedInfoService vehicleOverspeedInfoService; + + private final INdVehicleViolationService vehicleViolationService; + private final INdInsureOutDangerService insureOutDangerService; + + private final RegionsCacheHelper regionsCacheHelper; + + private final PositionMonitorManage positionMonitorManage; + private final CompanyService companyService; + + private final VehicleStatisticsService vehicleStatisticsService; + + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final SecurityManageDataScreenService securityManageDataScreenService; + + /** + * 大屏中间统计数字 + * + * @param + * @return + */ + @XmlDataScope + @Cacheable(cacheNames = "cockpit:statisticsCenter",key = "#param.regionId+'-'+#param.operatorId") + public StatisticsCenterVO statisticsCenter(DataScreenParam param) { + + List regionIds = null; + if (Objects.nonNull(param.getRegionId())) { + regionIds = regionsCacheHelper.listChildRegionId(param.getRegionId()); + } + + // 日超速总数 + LocalDateTime todayStart = + NdDateUtils.getStartTime(NdDateUtils.format(LocalDateTime.now(), DatePattern.NORM_DATE_PATTERN)); + LocalDateTime todayEnd = + NdDateUtils.getEndTime(NdDateUtils.format(LocalDateTime.now(), DatePattern.NORM_DATE_PATTERN)); + Long dailyOverspeeds = vehicleOverspeedInfoService.countStatistics(regionIds, todayStart, todayEnd); + + // 月违章 + LocalDateTime monthStart = + NdDateUtils.getStartTime(NdDateUtils.format(LocalDateTime.now().minusMonths(1), DatePattern.NORM_MONTH_PATTERN)); + LocalDateTime monthEnd = + NdDateUtils.getEndTime(NdDateUtils.format(LocalDateTime.now().minusMonths(1), DatePattern.NORM_MONTH_PATTERN)); + Long monthlyViolation = vehicleViolationService.countStatistics(regionIds, monthStart, monthEnd); + + LocalDateTime yearStart = getYearStartTime(); + LocalDateTime yearEnd = getYearEndTime(); + // 年出险 受伤 死亡 + List statistics = insureOutDangerService.statistics(regionIds, yearStart, yearEnd); + Long yearlyOutdanger = statistics.stream().count(); + Long yearlyInjuries = statistics.stream().mapToLong(NdInsureOutDanger::getInjuries).sum(); + Long yearlyDeathToll = statistics.stream().mapToLong(NdInsureOutDanger::getDeathToll).sum(); + return StatisticsCenterVO.of(dailyOverspeeds, monthlyViolation, yearlyOutdanger, yearlyInjuries, + yearlyDeathToll); + } + + /** + * 获取GPS列表 根据区域id + * + * @param param + * @return + */ + @XmlDataScope + @Cacheable(cacheNames = "cockpit:getVehicleGps",key = "#param.regionId+'-'+#param.operatorId") + public List getVehicleGps(DataScreenParam param) { + List companyIds = companyService.findCompanyIdsByRegionId(param); + + ReqRealTimeMonitorPO po = new ReqRealTimeMonitorPO(companyIds); + + return positionMonitorManage.realTimeMonitorVehicleGisList(po); + } + + /** + * 超速次数 + * + * @param param + * @return + */ + @XmlDataScope + @Cacheable(cacheNames = "cockpit:overspeedGroup",key = "#param.regionId+'-'+#param.operatorId") + public List overspeedGroup(DataScreenParam param) { + List mapDatas = vehicleStatisticsService.getOverspeedRegions(param); + if (CollUtil.isEmpty(mapDatas)) { + return Collections.emptyList(); + } + List list = mapDatas.stream().map(d -> { + MapDataVO vo = new MapDataVO(); + BeanUtils.copyProperties(d, vo); + return vo; + }).collect(Collectors.toList()); + CodeUtil.complementaryRegion(list, param.getRegionId()); + return list; + } + + /** + * 违章次数 + * + * @param param + * @return + */ + @XmlDataScope + @Cacheable(cacheNames = "cockpit:violationGroup",key = "#param.regionId+'-'+#param.operatorId") + public List violationGroup(DataScreenParam param) { + List mapDatas = vehicleStatisticsService.getViolationRegions(param); + if (CollUtil.isEmpty(mapDatas)) { + return Collections.emptyList(); + } + List list = mapDatas.stream().map(d -> { + MapDataVO vo = new MapDataVO(); + BeanUtils.copyProperties(d, vo); + return vo; + }).collect(Collectors.toList()); + CodeUtil.complementaryRegion(list, param.getRegionId()); + return list; + } + + /** + * 出险次数计算 + * + * @param param + * @return + */ + @XmlDataScope + @Cacheable(cacheNames = "cockpit:outDangerGroup",key = "#param.regionId+'-'+#param.operatorId") + public List outDangerGroup(DataScreenParam param) { + List mapDatas = vehicleStatisticsService.getOutDangerRegions(param); + if (CollUtil.isEmpty(mapDatas)) { + return Collections.emptyList(); + } + List list = mapDatas.stream().map(d -> { + MapDataVO vo = new MapDataVO(); + BeanUtils.copyProperties(d, vo); + return vo; + }).collect(Collectors.toList()); + CodeUtil.complementaryRegion(list, param.getRegionId()); + return list; + } + + /** + * 受伤人数 + * + * @param param + * @return + */ + @XmlDataScope + @Cacheable(cacheNames = "cockpit:injuriesGroup",key = "#param.regionId+'-'+#param.operatorId") + public List injuriesGroup(DataScreenParam param) { + List mapDatas = vehicleStatisticsService.getInjuriesRegion(param); + if (CollUtil.isEmpty(mapDatas)) { + return Collections.emptyList(); + } + List list = mapDatas.stream().map(d -> { + MapDataVO vo = new MapDataVO(); + BeanUtils.copyProperties(d, vo); + return vo; + }).collect(Collectors.toList()); + CodeUtil.complementaryRegion(list, param.getRegionId()); + return list; + } + + /** + * 死亡人数 + * + * @param param + * @return + */ + @XmlDataScope + @Cacheable(cacheNames = "cockpit:deathGroup",key = "#param.regionId+'-'+#param.operatorId") + public List deathGroup(DataScreenParam param) { + List mapDatas = vehicleStatisticsService.getDeathRegion(param); + if (CollUtil.isEmpty(mapDatas)) { + return Collections.emptyList(); + } + List list = mapDatas.stream().map(d -> { + MapDataVO vo = new MapDataVO(); + BeanUtils.copyProperties(d, vo); + return vo; + }).collect(Collectors.toList()); + CodeUtil.complementaryRegion(list, param.getRegionId()); + return list; + } + + /** + * 万车死亡人数 + * + * @param param + * @return + */ + @Cacheable(cacheNames = "cockpit:deathGroupTenThousand",key = "#param.regionId+'-'+#param.operatorId") + public List deathGroupTenThousand(DataScreenParam param) { + List mapDatas = vehicleStatisticsService.getDeathRegion(param); + List> carCntByRegion = vehicleStatisticsService.getVehicleNumsGroupByRegion(param); + Map carCntMap = CollUtils.listToMap(carCntByRegion, KeyValueDTO::getKey, KeyValueDTO::getValue); + if (CollUtil.isEmpty(mapDatas)) { + return Collections.emptyList(); + } + List list = mapDatas.stream().map(d -> { + MapDataVO vo = new MapDataVO(); + BeanUtils.copyProperties(d, vo); + Long carCnt = carCntMap.getOrDefault(d.getRegionId(), 0L); + if (carCnt == 0) { + vo.setPercent("0"); + } else { + BigDecimal percent = NumberUtil.div(vo.getValue(), carCnt).multiply(BigDecimal.valueOf(10000)) + .setScale(0, RoundingMode.UP); + vo.setPercent(percent.stripTrailingZeros().toPlainString()); + } + return vo; + }).collect(Collectors.toList()); + CodeUtil.complementaryRegion(list, param.getRegionId()); + return list; + } + + /** + * 上线率分析 + * + * @param param + * @return + */ + @XmlDataScope + @Cacheable(cacheNames = "cockpit:onlineAnalysis",key = "#param.regionId+'-'+#param.operatorId") + public JSONObject onlineAnalysis(DataScreenParam param) { + JSONObject res = new JSONObject(); + JSONObject timeOnlineData = genericOnlineData(param); + List regionOnlineVehicleNums = vehicleStatisticsService.getVehicleOnlineRegions(param); + CodeUtil.complementaryRegions(regionOnlineVehicleNums, param.getRegionId()); + return convertOnlineJson(regionOnlineVehicleNums, timeOnlineData, res); + } + + /** + * 超速占比分析图 + * + * @param param + * @return + */ + @XmlDataScope + @Cacheable(cacheNames = "cockpit:overspeedAnalysis",key = "#param.regionId+'-'+#param.operatorId") + public JSONObject overspeedAnalysis(DataScreenParam param) { + JSONObject res = new JSONObject(); + // 查询今日 + param.setStartTime(LocalDateTimeUtil.beginOfDay(LocalDateTime.now())); + param.setEndTime(LocalDateTimeUtil.endOfDay(LocalDateTime.now())); + + // List mapDatas = vehicleStatisticsService.getOverspeedRegions(param); + + List mapDatas = Lists.newArrayList(); + + List regionIds = null; + if (Objects.nonNull(param.getRegionId())) { + regionIds = regionsCacheHelper.listChildRegionId(param.getRegionId()); + } + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(VehicleOverspeedInfo.class); + DigitalCockpitManage contex = (DigitalCockpitManage)AopContext.currentProxy(); + contex.dataScopeCount(wrapper, regionIds, param.getStartTime(), param.getEndTime()); + List overspeedInfos = vehicleOverspeedInfoService.list(wrapper); + + // 根据车辆类型,过滤出真实超速的 + Map baseInfoMap = + vehicleBaseInfoService.list().stream().collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + List overspeedInfoList = overspeedInfos.stream().filter(v -> { + NdVehicleBaseInfo baseInfo = baseInfoMap.get(v.getCarPlate()); + if (Objects.nonNull(baseInfo)) { + if (Boolean.TRUE.equals(checkIsOverSpeed(v, baseInfo))) { + return true; + } + } + return false; + }).collect(Collectors.toList()); + + RegionDTO regionDto = regionsCacheHelper.getByRegionId(param.getRegionId()); + List regionIdList = Lists.newArrayList(); + // 传入区域为浙江省,筛选出市级(不包含市本级) + if (regionIds.size() > 1 && regionDto.getParentId().equals(0L)) { + + regionIdList = regionsCacheHelper.listChildOnly(param.getRegionId()).stream().map(RegionDTO::getId) + .collect(Collectors.toList()); + + for (Long id : regionIdList) { + MapDataPO po = new MapDataPO(); + po.setRegionId(id); + RegionDTO dto = regionsCacheHelper.getByRegionId(id); + String regionCode = dto.getRegionCode(); + po.setRegionCode(regionCode); + po.setRegionName(dto.getRegionName()); + List infos = overspeedInfoList.stream().filter(c -> { + Long regionId = c.getRegionId(); + RegionDTO regionDTO = regionsCacheHelper.getByRegionId(regionId); + if (regionDTO.getParentId().equals(id)) { + return true; + } + return false; + }).collect(Collectors.toList()); + po.setValue(infos.size()); + mapDatas.add(po); + } + complementaryRegion(mapDatas, param.getRegionId()); + return convertAnalysisJson(mapDatas, res); + } + // 传入区域为市级 + else if (regionIds.size() > 1 && regionDto.getParentId().equals(116L)) { + regionIdList = regionsCacheHelper.listChildOnly(param.getRegionId()).stream().map(RegionDTO::getId) + .collect(Collectors.toList()); + for (Long id : regionIdList) { + MapDataPO po = new MapDataPO(); + po.setRegionId(id); + RegionDTO dto = regionsCacheHelper.getByRegionId(id); + String regionCode = dto.getRegionCode(); + po.setRegionCode(regionCode); + po.setRegionName(dto.getRegionName()); + List infos = overspeedInfoList.stream().filter(c -> { + Long regionId = c.getRegionId(); + RegionDTO regionDTO = regionsCacheHelper.getByRegionId(regionId); + if (regionDTO.getId().equals(id)) { + return true; + } + return false; + }).collect(Collectors.toList()); + po.setValue(infos.size()); + mapDatas.add(po); + } + complementaryRegion(mapDatas, param.getRegionId()); + return convertAnalysisJson(mapDatas, res); + } + // 传入区域为区县 + else { + MapDataPO po = new MapDataPO(); + po.setRegionId(param.getRegionId()); + RegionDTO dto = regionsCacheHelper.getByRegionId(param.getRegionId()); + String regionCode = dto.getRegionCode(); + po.setRegionCode(regionCode); + po.setRegionName(dto.getRegionName()); + List infos = overspeedInfoList.stream() + .filter(c -> c.getRegionId().equals(param.getRegionId())).collect(Collectors.toList()); + po.setValue(infos.size()); + mapDatas.add(po); + return convertAnalysisJson(mapDatas, res); + } + + } + + @LambdaDataScope + public void dataScopeCount(LambdaQueryWrapper wrapper, List regionIds, + LocalDateTime startTime, LocalDateTime endTime) { + wrapper.in(CollUtil.isNotEmpty(regionIds), VehicleOverspeedInfo::getRegionId, regionIds) + .ge(VehicleOverspeedInfo::getOverspeedDate, startTime).le(VehicleOverspeedInfo::getOverspeedDate, endTime); + } + + private void complementaryRegion(List mapDatas, Long regionId) { + Map dataMap = CollUtils.listToMap(mapDatas, MapDataPO::getRegionId); + List regions = regionsCacheHelper.listChildOnly(regionId, true); + List tmpList = new ArrayList<>(); + regions.forEach(w -> { + MapDataPO odc = dataMap.get(w.getId()); + if (odc == null) { + odc = new MapDataPO(); + odc.setRegionId(w.getId()); + odc.setRegionName(w.getRegionName()); + odc.setRegionName(w.getRegionName()); + odc.setRegionCode(w.getRegionCode()); + odc.setValue(0); + odc.setPercent("0"); + } + tmpList.add(odc); + }); + mapDatas.clear(); + mapDatas.addAll(tmpList); + } + + /** + * 月度 超速 对比 + * + * @param param + * @return + */ + @XmlDataScope + @BuildChildrenRegionEntity + @Cacheable(cacheNames = "cockpit:monthlyOverspeedAnalysis",key = "#param.regionId+'-'+#param.operatorId") + public JSONObject monthlyOverspeedAnalysis(DataScreenParam param) { + List times = securityManageDataScreenService.getOverspeedAnalysis(param); + return convertOverspeed(times); + } + + /** + * 出险相关统计 月份 + * + * @param param + * @param type + * @return + */ + @XmlDataScope + @BuildChildrenRegionEntity + @Cacheable(cacheNames = "cockpit:getInsureAnalysis",key = "#param.regionId+'-'+#param.operatorId+'-'+#param.type") + public JSONObject getInsureAnalysis(DataScreenParam param, Integer type) { + List times = securityManageDataScreenService.getOutDangerAnalysis(param); + return convertInsureAnalysis(times, type); + } + + private JSONObject convertInsureAnalysis(List outDangerTimes, Integer type) { + Map> yearMap = InitDataUtil.initTwoYears(); + for (OutDangerAnalysisPO outDangerTime : outDangerTimes) { + if (yearMap.containsKey(outDangerTime.getYear())) { + Map monthMap = yearMap.get(outDangerTime.getYear()); + if (monthMap.containsKey(outDangerTime.getMonth())) { + switch (type) { + case 1: + monthMap.put(outDangerTime.getMonth(), outDangerTime.getOutDangerTimes()); + break; + case 2: + monthMap.put(outDangerTime.getMonth(), outDangerTime.getInjuries()); + break; + case 3: + monthMap.put(outDangerTime.getMonth(), outDangerTime.getDeathToll()); + break; + default: + monthMap.put(outDangerTime.getMonth(), outDangerTime.getOutDangerTimes()); + } + } + } + } + Map total = countTotal(yearMap); + yearMap.put("total", total); + return JSONObject.parseObject(JSON.toJSONString(yearMap)); + } + + private JSONObject convertOverspeed(List times) { + Map> yearMap = InitDataUtil.initTwoYears(); + for (OverspeedAnalysisPO time : times) { + if (yearMap.containsKey(time.getYear())) { + Map monthMap = yearMap.get(time.getYear()); + if (monthMap.containsKey(time.getMonth())) { + monthMap.put(time.getMonth(), time.getTimes()); + } + } + } + Map total = countTotal(yearMap); + yearMap.put("total", total); + return JSONObject.parseObject(JSON.toJSONString(yearMap)); + } + + private Map countTotal(Map> yearMap) { + Map total = Maps.newHashMap(); + Map currentMap = yearMap.get(String.valueOf(LocalDateTime.now().getYear())); + int currentSum = + currentMap.entrySet().stream().mapToInt(o -> Integer.parseInt(String.valueOf(o.getValue()))).sum(); + total.put(String.valueOf(LocalDateTime.now().getYear()), currentSum); + Map lastMap = yearMap.get(String.valueOf(LocalDateTime.now().minusYears(1).getYear())); + int lastSum = lastMap.entrySet().stream().mapToInt(o -> Integer.parseInt(String.valueOf(o.getValue()))).sum(); + total.put(String.valueOf(LocalDateTime.now().minusYears(1).getYear()), lastSum); + return total; + } + + private JSONObject convertAnalysisJson(List mapDatas, JSONObject res) { + Long total = mapDatas.stream().mapToLong(MapDataPO::getValue).sum(); + for (MapDataPO po : mapDatas) { + po.setPercent(total.compareTo(0L) == 0 ? "0" + : BigDecimal.valueOf(po.getValue() * 100).divide(BigDecimal.valueOf(total), 2, BigDecimal.ROUND_HALF_UP) + + StringUtils.EMPTY); + } + res.put("total", total); + res.put("data", mapDatas); + return res; + } + + /** + * 上线率 + * + * @param data + * @param res + * @return + */ + private JSONObject convertOnlineJson(List data, JSONObject timeOnlineData, JSONObject res) { + JSONObject rate = new JSONObject(); + for (OnlineVehicleRegionsPO po : data) { + rate.put(po.getRegionName(), po.getRate()); + } + res.put("time-data", timeOnlineData); + res.put("rate", rate); + return res; + } + + /** + * 先弄点假数据 + * + * @return + */ + private JSONObject genericOnlineData(DataScreenParam param) { + List onlineVehicleDatas = vehicleStatisticsService.getOnlineRateToday(param); + Long vehicleNums = vehicleStatisticsService.getVehicleNums(param); + JSONObject res = new JSONObject(); + for (OnlineVehicleTimesPO onlineVehicleTimes : onlineVehicleDatas) { + BigDecimal rate = 0L == vehicleNums ? BigDecimal.ZERO + : BigDecimal.valueOf(onlineVehicleTimes.getOnlineNum()).multiply(BigDecimal.valueOf(100)) + .divide(BigDecimal.valueOf(vehicleNums), 2, BigDecimal.ROUND_HALF_UP); + res.put(onlineVehicleTimes.getHour() + ":00", rate); + } + return res; + } + + private JSONObject convertCityJson(List data, JSONObject res) { + for (OverspeedStatisticsPO po : data) { + res.put(po.getRegionName(), po.getTimes()); + } + return res; + } + + private LocalDateTime getYearStartTime() { + LocalDate nowDay = LocalDate.now(); + LocalDate firstDayOfYear = nowDay.with(TemporalAdjusters.firstDayOfYear()); + return LocalDateTime.of(firstDayOfYear, LocalTime.MIN); + } + + private LocalDateTime getYearEndTime() { + LocalDate nowDay = LocalDate.now(); + LocalDate lastDayOfYear = nowDay.with(TemporalAdjusters.lastDayOfYear()); + return LocalDateTime.of(lastDayOfYear, LocalTime.MAX); + } + + private Boolean checkIsOverSpeed(VehicleOverspeedInfo gpsData, NdVehicleBaseInfo baseInfo) { + // 混凝土和移动泵车 是50 + Integer vehicleType = baseInfo.getVehicleType(); + VehicleTypeEnum enumByValue = VehicleTypeEnum.getEnumByValue(vehicleType); + if (VehicleTypeEnum.OTHER.equals(enumByValue)) { + if (gpsData.getMaxSpeed().compareTo(BigDecimal.valueOf(80)) > 0) { + return Boolean.TRUE; + } + } else if (VehicleTypeEnum.KRHP.equals(enumByValue)) { + if (gpsData.getMaxSpeed().compareTo(BigDecimal.valueOf(50)) > 0) { + return Boolean.TRUE; + } + } else if (VehicleTypeEnum.MIXER.equals(enumByValue)) { + if (gpsData.getMaxSpeed().compareTo(BigDecimal.valueOf(50)) > 0) { + return Boolean.TRUE; + } + } else if (VehicleTypeEnum.BULK_CEMENT_TRUCK.equals(enumByValue)) { + if (gpsData.getMaxSpeed().compareTo(BigDecimal.valueOf(80)) > 0) { + return Boolean.TRUE; + } + } else if (VehicleTypeEnum.READY_MIXED_MORTAR_TRUC.equals(enumByValue)) { + return gpsData.getMaxSpeed().compareTo(BigDecimal.valueOf(80)) > 0; + } + return Boolean.FALSE; + } + + /** + * 清缓存 + * @param cacheName + */ + public String removeCache(String cacheName) { + if(StringUtils.isBlank(cacheName)){ + removeCacheAll(); + return "清缓存成功"; + } + if(cachePlusOps.del(cacheName) > 0){ + return "清缓存" + cacheName + "成功"; + } + return "清缓存失败"; + } + + /** + * 请所有 + */ + @Caching(evict ={ + @CacheEvict(cacheNames = "cockpit:statisticsCenter",allEntries = true), + @CacheEvict(cacheNames = "cockpit:getVehicleGps",allEntries = true), + @CacheEvict(cacheNames = "cockpit:overspeedGroup",allEntries = true), + @CacheEvict(cacheNames = "cockpit:violationGroup",allEntries = true), + @CacheEvict(cacheNames = "cockpit:outDangerGroup",allEntries = true), + @CacheEvict(cacheNames = "cockpit:injuriesGroup",allEntries = true), + @CacheEvict(cacheNames = "cockpit:deathGroup",allEntries = true), + @CacheEvict(cacheNames = "cockpit:deathGroupTenThousand",allEntries = true), + @CacheEvict(cacheNames = "cockpit:onlineAnalysis",allEntries = true), + @CacheEvict(cacheNames = "cockpit:overspeedAnalysis",allEntries = true), + @CacheEvict(cacheNames = "cockpit:monthlyOverspeedAnalysis",allEntries = true), + @CacheEvict(cacheNames = "cockpit:getInsureAnalysis",allEntries = true) + }) + public void removeCacheAll() { + log.info("清空驾驶舱所有缓存!"); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/mapper/VehicleStatisticsMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/mapper/VehicleStatisticsMapper.java new file mode 100644 index 0000000..8b86897 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/mapper/VehicleStatisticsMapper.java @@ -0,0 +1,78 @@ +package com.ningdatech.carapi.car.datascreen.mapper; + +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.po.*; +import com.ningdatech.carapi.common.model.KeyValueDTO; +import com.ningdatech.carapi.common.model.po.MapDataPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Classname VehicleStatisticsMapper + * @Description + * @Date 2022/10/22 15:57 + * @Created by PoffyZhang + */ +public interface VehicleStatisticsMapper { + + List getTypesStatistics(@Param("param") DataScreenParam param); + + /** + * 查浙江省 各个市的区域车辆数 + * + * @return + */ + List getZjRegionsStatistics(@Param("param") DataScreenParam param); + + /** + * 保险公司分布 + * + * @param param + * @return + */ + List getInsureDistribution(@Param("param") DataScreenParam param); + + /** + * 运营商分布 + * + * @param param + * @return + */ + List getOperatorDistribution(@Param("param") DataScreenParam param); + + /** + * 年度车辆新增分布 + * + * @param param + * @return + */ + List getNewVehicleDistribution(@Param("param") DataScreenParam param); + + /** + * 根据公司ids 查询车辆总数 + * + * @param param + * @return + */ + Long getVehicleNums(@Param("param") DataScreenParam param); + + List> getVehicleNumsGroupByRegion(@Param("param") DataScreenParam param); + + + List getOverspeedRegions(@Param("param") DataScreenParam param); + + List getViolationRegions(@Param("param") DataScreenParam param); + + List getOutDangerRegions(@Param("param") DataScreenParam param); + + List getInjuriesRegion(@Param("param") DataScreenParam param); + + List getDeathRegion(@Param("param") DataScreenParam param); + + List getOnlineRateToday(@Param("param") DataScreenParam param, @Param("tableName") String tableName); + + List getVehicleOnlineRegions(@Param("param") DataScreenParam param); + + List getVehicleUsefulLife(@Param("param") DataScreenParam param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/mapper/VehicleStatisticsMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/mapper/VehicleStatisticsMapper.xml new file mode 100644 index 0000000..54a0bee --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/mapper/VehicleStatisticsMapper.xml @@ -0,0 +1,542 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/dto/DataScreenParam.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/dto/DataScreenParam.java new file mode 100644 index 0000000..c36c471 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/dto/DataScreenParam.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.car.datascreen.model.dto; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +import com.ningdatech.carapi.sys.contants.RegionContant; + +import lombok.Data; +import lombok.ToString; + +/** + * @Classname DataScreenParam + * @Description + * @Date 2022/11/21 13:50 + * @Created by PoffyZhang + */ +@Data +@ToString +public class DataScreenParam { + + private Long regionId; + private Integer regionLevel; + + private String regionCode; + + private List regionIds; + + private List companyIds; + + private Integer type; + + private String dataScopeSql; + + private LocalDateTime startTime; + private LocalDateTime endTime; + + private Long operatorId; + + public Long getRegionId(){ + if(Objects.isNull(this.regionId)){ + this.regionId = RegionContant.ZJ_REGION_ID; + return this.regionId; + } + return this.regionId; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/InsureDistributionStatisticsPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/InsureDistributionStatisticsPO.java new file mode 100644 index 0000000..3408b46 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/InsureDistributionStatisticsPO.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.datascreen.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/10/22 下午2:10 + */ + +@Data +@ApiModel(description = "保险公司分布-PO") +public class InsureDistributionStatisticsPO { + + @ApiModelProperty("车辆数") + private Long vehicleNum; + + @ApiModelProperty("保险公司名") + private String insureCompany; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/OnlineVehicleRegionsPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/OnlineVehicleRegionsPO.java new file mode 100644 index 0000000..960e28c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/OnlineVehicleRegionsPO.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.car.datascreen.model.po; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @Classname OnlineVehicleTimesPO + * @Description + * @Date 2022/11/17 13:35 + * @Created by PoffyZhang + */ +@Data +public class OnlineVehicleRegionsPO { + + @ApiModelProperty("区域Id") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("区域code") + private String regionCode; + + @ApiModelProperty("总车辆数") + private Integer vehicleNum; + + @ApiModelProperty("在线车辆数") + private Integer onlineNum; + + @ApiModelProperty("比例") + private BigDecimal rate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/OnlineVehicleTimesPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/OnlineVehicleTimesPO.java new file mode 100644 index 0000000..a5c34b2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/OnlineVehicleTimesPO.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.car.datascreen.model.po; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @Classname OnlineVehicleTimesPO + * @Description + * @Date 2022/11/17 13:35 + * @Created by PoffyZhang + */ +@Data +public class OnlineVehicleTimesPO { + + @ApiModelProperty("年份") + private Integer year; + + @ApiModelProperty("月份") + private Integer month; + + @ApiModelProperty("日") + private Integer day; + + @ApiModelProperty("小时") + private Integer hour; + + @ApiModelProperty("总车辆数") + private Integer vehicleNum; + + @ApiModelProperty("在线车辆数") + private Integer onlineNum; + + @ApiModelProperty("比例") + private BigDecimal rate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/OperatorDistributionStatisticsPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/OperatorDistributionStatisticsPO.java new file mode 100644 index 0000000..5895bae --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/OperatorDistributionStatisticsPO.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.datascreen.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/10/22 下午2:10 + */ + +@Data +@ApiModel(description = "运营商分布-PO") +public class OperatorDistributionStatisticsPO { + + @ApiModelProperty("车辆数") + private Long vehicleNum; + + @ApiModelProperty("运营商名") + private String operatorName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/OverspeedStatisticsPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/OverspeedStatisticsPO.java new file mode 100644 index 0000000..040e84d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/OverspeedStatisticsPO.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.datascreen.model.po; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Classname OverspeedStatisticsPO + * @Description + * @Date 2022/11/17 13:35 + * @Created by PoffyZhang + */ +@Data +public class OverspeedStatisticsPO { + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("次数") + private Long times; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/RegionDistributionStatisticsPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/RegionDistributionStatisticsPO.java new file mode 100644 index 0000000..24cd8a9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/RegionDistributionStatisticsPO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.car.datascreen.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/10/22 下午2:10 + */ + +@Data +@ApiModel(description = "区域车辆分布-PO") +public class RegionDistributionStatisticsPO { + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名字") + private String regionName; + + @ApiModelProperty("车辆数") + private Long vehicleNum; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/VehicleStatusTimePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/VehicleStatusTimePO.java new file mode 100644 index 0000000..d3f0f34 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/VehicleStatusTimePO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.car.datascreen.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/10/22 下午2:10 + */ + +@Data +@ApiModel(description = "车辆状态统计时间段-PO") +public class VehicleStatusTimePO { + + @ApiModelProperty("时间范围") + private String timeScope; + + @ApiModelProperty("在线数") + private Long onlineNum; + + @ApiModelProperty("离线数") + private Long offlineNum; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/VehicleTypeStatisticsPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/VehicleTypeStatisticsPO.java new file mode 100644 index 0000000..cda1599 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/VehicleTypeStatisticsPO.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.datascreen.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/10/22 下午2:10 + */ + +@Data +@ApiModel(description = "车辆类型统计-PO") +public class VehicleTypeStatisticsPO { + + @ApiModelProperty("车辆类型ID") + private Integer vehicleTypesId; + + @ApiModelProperty("车辆数") + private Long vehicleNum; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/VehicleUsefulLifeStatisticsPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/VehicleUsefulLifeStatisticsPO.java new file mode 100644 index 0000000..fe6dd8c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/VehicleUsefulLifeStatisticsPO.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.datascreen.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/10/25 下午2:10 + */ + +@Data +@ApiModel(description = "车辆年限分布-PO") +public class VehicleUsefulLifeStatisticsPO { + + @ApiModelProperty("车辆数") + private Long vehicleNum; + + @ApiModelProperty("年限范围") + private String usefulLife; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/YearVehicleStatisticsPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/YearVehicleStatisticsPO.java new file mode 100644 index 0000000..edb5b2e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/po/YearVehicleStatisticsPO.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.datascreen.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/10/25 下午2:10 + */ + +@Data +@ApiModel(description = "年份车辆数分布-PO") +public class YearVehicleStatisticsPO { + + @ApiModelProperty("车辆数") + private Long vehicleNum; + + @ApiModelProperty("年份") + private Integer year; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/InsureDistributionStatisticsVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/InsureDistributionStatisticsVO.java new file mode 100644 index 0000000..04c5149 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/InsureDistributionStatisticsVO.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.car.datascreen.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * @author PoffyZhang + * @date 2022/10/22 下午2:10 + */ + +@Data +@ApiModel(description = "保险公司分布-VO") +@AllArgsConstructor +@NoArgsConstructor +public class InsureDistributionStatisticsVO { + @ApiModelProperty("车辆数") + private Long vehicleNum; + + @ApiModelProperty("保险公司名") + private String insureCompany; + + @ApiModelProperty("占比") + private BigDecimal ratio; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/OperatorDistributionStatisticsVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/OperatorDistributionStatisticsVO.java new file mode 100644 index 0000000..018b959 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/OperatorDistributionStatisticsVO.java @@ -0,0 +1,26 @@ +package com.ningdatech.carapi.car.datascreen.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author PoffyZhang + * @date 2022/10/22 下午2:10 + */ + +@Data +@ApiModel(description = "运营商分布-VO") +public class OperatorDistributionStatisticsVO { + + @ApiModelProperty("车辆数") + private Long vehicleNum; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("占比") + private BigDecimal ratio; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/RegionDistributionStatisticsVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/RegionDistributionStatisticsVO.java new file mode 100644 index 0000000..a0cb6dd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/RegionDistributionStatisticsVO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.car.datascreen.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/10/22 下午2:10 + */ + +@Data +@ApiModel(description = "区域车辆分布-VO") +public class RegionDistributionStatisticsVO { + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名字") + private String regionName; + + @ApiModelProperty("车辆数") + private Long vehicleNum; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/StatisticsCenterVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/StatisticsCenterVO.java new file mode 100644 index 0000000..b06086b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/StatisticsCenterVO.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.car.datascreen.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author PoffyZhang + * @date 2022/11/16 下午2:10 + */ + +@Data +@ApiModel(description = "大屏中间统计数据-VO") +@NoArgsConstructor +@AllArgsConstructor +public class StatisticsCenterVO { + + public static StatisticsCenterVO of(Long dailyOverspeedTimes,Long monthlyViolationTimes,Long yearlyOutDangerTimes, + Long yearlyInjuries,Long yearlyDeathToll){ + return new StatisticsCenterVO(dailyOverspeedTimes,monthlyViolationTimes,yearlyOutDangerTimes,yearlyInjuries,yearlyDeathToll); + } + + @ApiModelProperty("日超速次数") + private Long dailyOverspeedTimes = 0L; + + @ApiModelProperty("月违章次数") + private Long monthlyViolationTimes = 0L; + + @ApiModelProperty("年出险次数") + private Long yearlyOutDangerTimes = 0L; + + @ApiModelProperty("年受伤人数") + private Long yearlyInjuries = 0L; + + @ApiModelProperty("年死亡人数") + private Long yearlyDeathToll = 0L; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/VehicleTypeStatisticsVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/VehicleTypeStatisticsVO.java new file mode 100644 index 0000000..685d194 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/VehicleTypeStatisticsVO.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.car.datascreen.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author PoffyZhang + * @date 2022/10/22 下午2:10 + */ + +@Data +@ApiModel(description = "车辆类型统计-VO") +public class VehicleTypeStatisticsVO { + + @ApiModelProperty("车辆类型ID") + private Integer vehicleTypesId; + + @ApiModelProperty("车辆类型名") + private String vehicleTypesName; + + @ApiModelProperty("车辆数") + private Long vehicleNum; + + @ApiModelProperty("占比") + private BigDecimal ratio; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/VehicleUsefulLifeStatisticsVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/VehicleUsefulLifeStatisticsVO.java new file mode 100644 index 0000000..1b52d34 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/VehicleUsefulLifeStatisticsVO.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.car.datascreen.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author PoffyZhang + * @date 2022/10/25 下午2:10 + */ + +@Data +@ApiModel(description = "车辆年限分布-PO") +@AllArgsConstructor +@NoArgsConstructor +public class VehicleUsefulLifeStatisticsVO { + + @ApiModelProperty("车辆数") + private Long vehicleNum; + + @ApiModelProperty("年限范围") + private String usefulLife; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/YearVehicleStatisticsVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/YearVehicleStatisticsVO.java new file mode 100644 index 0000000..be09659 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/model/vo/YearVehicleStatisticsVO.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.datascreen.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/10/25 下午2:10 + */ + +@Data +@ApiModel(description = "年份车辆数分布-VO") +public class YearVehicleStatisticsVO { + + @ApiModelProperty("车辆数") + private Long vehicleNum; + + @ApiModelProperty("年份") + private Integer year; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/service/VehicleStatisticsService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/service/VehicleStatisticsService.java new file mode 100644 index 0000000..62f7aa2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/service/VehicleStatisticsService.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.car.datascreen.service; + +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.po.OnlineVehicleRegionsPO; +import com.ningdatech.carapi.car.datascreen.model.po.OnlineVehicleTimesPO; +import com.ningdatech.carapi.car.datascreen.model.vo.*; +import com.ningdatech.carapi.common.model.KeyValueDTO; +import com.ningdatech.carapi.common.model.po.MapDataPO; + +import java.util.List; + +public interface VehicleStatisticsService { + + List getVehicleTypesStatistics(DataScreenParam param); + + List getRegionDistribution(DataScreenParam param); + + List getInsureDistribution(DataScreenParam param); + + List getOperatorDistribution(DataScreenParam param); + + List getNewVehicleNum(DataScreenParam param); + + List getUsefulLiftDistribution(DataScreenParam param); + + Long getVehicleNums(DataScreenParam param); + + List> getVehicleNumsGroupByRegion(DataScreenParam param); + + List getOverspeedRegions(DataScreenParam param); + + List getViolationRegions(DataScreenParam param); + + List getOutDangerRegions(DataScreenParam param); + + List getInjuriesRegion(DataScreenParam param); + + List getDeathRegion(DataScreenParam param); + + List getOnlineRateToday(DataScreenParam param); + + List getVehicleOnlineRegions(DataScreenParam param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/service/impl/VehicleStatisticsServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/service/impl/VehicleStatisticsServiceImpl.java new file mode 100644 index 0000000..1ac370f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/datascreen/service/impl/VehicleStatisticsServiceImpl.java @@ -0,0 +1,378 @@ +package com.ningdatech.carapi.car.datascreen.service.impl; + +import java.math.BigDecimal; +import java.util.*; +import java.util.concurrent.atomic.AtomicLong; +import java.util.stream.Collectors; + +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.car.datascreen.mapper.VehicleStatisticsMapper; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.po.*; +import com.ningdatech.carapi.car.datascreen.model.vo.*; +import com.ningdatech.carapi.car.datascreen.service.VehicleStatisticsService; +import com.ningdatech.carapi.car.vehicle.mapper.VehicleBaseInfoJoinMapper; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfoJoin; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.model.KeyValueDTO; +import com.ningdatech.carapi.common.model.po.MapDataPO; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +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.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +@RequiredArgsConstructor +public class VehicleStatisticsServiceImpl implements VehicleStatisticsService { + + private final VehicleStatisticsMapper vehicleStatisticsMapper; + private final VehicleBaseInfoJoinMapper vehicleBaseInfoJoinMapper; + private final RegionsCacheHelper regionsCacheHelper; + private final INdInsureOutDangerService insureOutDangerService; + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final INdInsureInfoService insureInfoService; + + private final String USEFUL_LIFE_ONE = "3年以下"; + private final String USEFUL_LIFE_TWO = "3-5年"; + private final String USEFUL_LIFE_THREE = "5-10年"; + private final String USEFUL_LIFE_FOUR = "10年以上"; + + /** + * 获取车辆类型分布 + * + * @param param + * @return + */ + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List getVehicleTypesStatistics(DataScreenParam param) { + List typesStatistics = vehicleStatisticsMapper.getTypesStatistics(param); + if (CollUtil.isEmpty(typesStatistics)) { + return Collections.emptyList(); + } + return convertVehicleTypes(typesStatistics); + } + + /** + * 获取区域车辆分布 + * + * @param param + * @return + */ + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List getRegionDistribution(DataScreenParam param) { + //区域车辆 根据 所传的regionId来判断 查询甚么数据 + CodeUtil.buildRegionLevel(param); + List list = statisticsRegionDistribution(vehicleStatisticsMapper.getZjRegionsStatistics(param)); + complementaryRegion(list, param.getRegionId()); + return list; + } + + /** + * 获取保险公司分布 + * + * @param param + * @return + */ + @Override + public List getInsureDistribution(DataScreenParam param) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdInsureOutDanger.class); + VehicleStatisticsServiceImpl context = (VehicleStatisticsServiceImpl) AopContext.currentProxy(); + context.buildWrapper(wrapper,param); + // 获取系统车牌号 + List carPlates = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .select(NdVehicleBaseInfo::getCarPlate)).stream() + .map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + // 获取筛选时间的车辆出险数据,并过滤出在系统内的车辆 + List insureList = insureOutDangerService.list(wrapper) + .stream().filter(c -> carPlates.contains(c.getCarPlate())).collect(Collectors.toList()); + // 获取车辆的保险信息 + List insureInfos = insureInfoService.list(Wrappers.lambdaQuery(NdInsureInfo.class) + .in(NdInsureInfo::getCarPlate, carPlates)); + Map> insureInfoMap = insureInfos.stream() + .collect(Collectors.groupingBy(NdInsureInfo::getInsureCompany)); + + // 按照保险机构分组,再将车牌号去重,统计数量 + Map> insureMap = insureList.stream() + .filter(c -> Objects.nonNull(c.getInsureCompany())) + .collect(Collectors.groupingBy(NdInsureOutDanger::getInsureCompany)); + List resultList = Lists.newArrayList(); + for (String insureCompany : insureMap.keySet()) { + InsureDistributionStatisticsVO vo = new InsureDistributionStatisticsVO(); + vo.setInsureCompany(insureCompany); + List outDangers = insureMap.get(insureCompany); + long count = outDangers.stream().map(NdInsureOutDanger::getCarPlate).distinct().count(); + vo.setVehicleNum(count); + // 获取该保险公司下保险的车辆总数 + List infoList = insureInfoMap.get(insureCompany); + if (CollUtil.isEmpty(infoList)){ + // 该保险公司不在车辆承保信息中,跳过该保险机构 + continue; + } + long total = infoList.stream().map(NdInsureInfo::getCarPlate).distinct().count(); + vo.setRatio(BigDecimal.valueOf(count).multiply(BigDecimal.valueOf(100)) + .divide(BigDecimal.valueOf(total), 2, BigDecimal.ROUND_HALF_UP)); + resultList.add(vo); + } + return resultList; + //List insuresStatistics = vehicleStatisticsMapper.getInsureDistribution(param); + //if (CollUtil.isEmpty(insuresStatistics)) { + // return Collections.emptyList(); + //} + //return convertInsures(insuresStatistics); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + private void buildWrapper(LambdaQueryWrapper wrapper,DataScreenParam param) { + wrapper.between(NdInsureOutDanger::getAccidentTime, param.getStartTime(), param.getEndTime()); + } + + /** + * 运营商分布 + * + * @param param + * @return + */ + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List getOperatorDistribution(DataScreenParam param) { + List operatorStatistics = vehicleStatisticsMapper.getOperatorDistribution(param); + if (CollUtil.isEmpty(operatorStatistics)) { + return Collections.emptyList(); + } + return convertOperators(operatorStatistics); + } + + /** + * 新增车辆分布图 + * + * @param param + * @return + */ + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List getNewVehicleNum(DataScreenParam param) { + List yearVehicleStatistics = vehicleStatisticsMapper.getNewVehicleDistribution(param); + if (CollUtil.isEmpty(yearVehicleStatistics)) { + return Collections.emptyList(); + } + return convertYears(yearVehicleStatistics); + } + + /** + * 车辆年限分布 + * + * @param param + * @return + */ + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List getUsefulLiftDistribution(DataScreenParam param) { + List vehicleUsefulLife = vehicleStatisticsMapper.getVehicleUsefulLife(param); + if (CollUtil.isEmpty(vehicleUsefulLife)) { + return Collections.emptyList(); + } + return vehicleUsefulLife.stream().map(v -> { + VehicleUsefulLifeStatisticsVO vo = new VehicleUsefulLifeStatisticsVO(); + BeanUtils.copyProperties(v, vo); + return vo; + }).collect(Collectors.toList()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public List searchVehicleList(LambdaQueryWrapper wrapper, + DataScreenParam param) { + log.info(param.toString()); + return vehicleBaseInfoJoinMapper.listJoin(wrapper); + } + + @Override + @XmlDataScope + public Long getVehicleNums(DataScreenParam param) { + return vehicleStatisticsMapper.getVehicleNums(param); + } + + @Override + @XmlDataScope + public List> getVehicleNumsGroupByRegion(DataScreenParam param) { + return vehicleStatisticsMapper.getVehicleNumsGroupByRegion(param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List getOverspeedRegions(DataScreenParam param) { + CodeUtil.buildRegionLevel(param); + return vehicleStatisticsMapper.getOverspeedRegions(param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List getViolationRegions(DataScreenParam param) { + CodeUtil.buildRegionLevel(param); + return vehicleStatisticsMapper.getViolationRegions(param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List getOutDangerRegions(DataScreenParam param) { + CodeUtil.buildRegionLevel(param); + return vehicleStatisticsMapper.getOutDangerRegions(param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List getInjuriesRegion(DataScreenParam param) { + CodeUtil.buildRegionLevel(param); + return vehicleStatisticsMapper.getInjuriesRegion(param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List getDeathRegion(DataScreenParam param) { + CodeUtil.buildRegionLevel(param); + return vehicleStatisticsMapper.getDeathRegion(param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List getOnlineRateToday(DataScreenParam param) { + String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(), "yyyy_MM"); + return vehicleStatisticsMapper.getOnlineRateToday(param, tableName); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List getVehicleOnlineRegions(DataScreenParam param) { + CodeUtil.buildRegionLevel(param); + return vehicleStatisticsMapper.getVehicleOnlineRegions(param); + } + + private List convertUsefulLife(List vehicles) { + List res = Lists.newArrayList(); + AtomicLong usefulLifeOne = new AtomicLong(0L); + AtomicLong usefulLifeTwo = new AtomicLong(0L); + AtomicLong usefulLifeThree = new AtomicLong(0L); + AtomicLong usefulLifeFour = new AtomicLong(0L); + vehicles.forEach(v -> { + if (Objects.isNull(v.getUsefulLife())) { + return; + } + if (0 < v.getUsefulLife() && 3 > v.getUsefulLife()) { + usefulLifeOne.addAndGet(1L); + } else if (3 <= v.getUsefulLife() && 5 > v.getUsefulLife()) { + usefulLifeTwo.addAndGet(1L); + } else if (5 <= v.getUsefulLife() && 10 > v.getUsefulLife()) { + usefulLifeThree.addAndGet(1L); + } else if (10 <= v.getUsefulLife()) { + usefulLifeFour.addAndGet(1L); + } + }); + //1.3年以下 + res.add(new VehicleUsefulLifeStatisticsVO(usefulLifeOne.get(), USEFUL_LIFE_ONE)); + //2.3-5年 + res.add(new VehicleUsefulLifeStatisticsVO(usefulLifeTwo.get(), USEFUL_LIFE_TWO)); + //3.5-10年 + res.add(new VehicleUsefulLifeStatisticsVO(usefulLifeThree.get(), USEFUL_LIFE_THREE)); + //4.10年以上 + res.add(new VehicleUsefulLifeStatisticsVO(usefulLifeFour.get(), USEFUL_LIFE_FOUR)); + return res; + } + + private List convertYears(List yearVehicleStatistics) { + if (CollUtil.isEmpty(yearVehicleStatistics)) { + return Collections.emptyList(); + } + return yearVehicleStatistics.stream().map(t -> BeanUtil.copyProperties(t, YearVehicleStatisticsVO.class)).collect(Collectors.toList()); + } + + + private List convertVehicleTypes(List typesStatistics) { + long sum = typesStatistics.stream().mapToLong(VehicleTypeStatisticsPO::getVehicleNum).sum(); + return typesStatistics.stream().map(t -> { + VehicleTypeStatisticsVO vo = BeanUtil.copyProperties(t, VehicleTypeStatisticsVO.class); + vo.setVehicleTypesName(VehicleTypeEnum.getDescByCode(vo.getVehicleTypesId())); + vo.setRatio(BigDecimal.valueOf(vo.getVehicleNum()).multiply(BigDecimal.valueOf(100)) + .divide(BigDecimal.valueOf(sum), 2, BigDecimal.ROUND_HALF_UP)); + return vo; + }).collect(Collectors.toList()); + } + + private List statisticsRegionDistribution(List regionsStatistics) { + if (CollUtil.isEmpty(regionsStatistics)) { + return Collections.emptyList(); + } + return regionsStatistics.stream().map(t -> BeanUtil.copyProperties(t, RegionDistributionStatisticsVO.class)).collect(Collectors.toList()); + } + + private List convertInsures(List insuresStatistics) { + long sum = insuresStatistics.stream().mapToLong(InsureDistributionStatisticsPO::getVehicleNum).sum(); + return insuresStatistics.stream().map(insure -> { + InsureDistributionStatisticsVO vo = BeanUtil.copyProperties(insure, InsureDistributionStatisticsVO.class); + vo.setRatio(BigDecimal.valueOf(vo.getVehicleNum()).multiply(BigDecimal.valueOf(100)) + .divide(BigDecimal.valueOf(sum), 2, BigDecimal.ROUND_HALF_UP)); + return vo; + }).collect(Collectors.toList()); + } + + private List convertOperators(List operatorStatistics) { + long sum = operatorStatistics.stream().mapToLong(OperatorDistributionStatisticsPO::getVehicleNum).sum(); + return operatorStatistics.stream().map(operator -> { + OperatorDistributionStatisticsVO vo = BeanUtil.copyProperties(operator, OperatorDistributionStatisticsVO.class); + vo.setRatio(BigDecimal.valueOf(vo.getVehicleNum()).multiply(BigDecimal.valueOf(100)) + .divide(BigDecimal.valueOf(sum), 2, BigDecimal.ROUND_HALF_UP)); + return vo; + }).collect(Collectors.toList()); + } + + public void complementaryRegion(List list, Long regionId) { + Map dataMap = CollUtils.listToMap(list, m -> m.getRegionName()); + List regions = regionsCacheHelper.listChildOnly(regionId); + for (RegionDTO region : regions) { + if (!dataMap.containsKey(region.getRegionName())) { + RegionDistributionStatisticsVO data = new RegionDistributionStatisticsVO(); + data.setRegionId(region.getId()); + data.setRegionName(region.getRegionName()); + data.setVehicleNum(0L); + list.add(data); + } + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/controller/VehicleEquipmentController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/controller/VehicleEquipmentController.java new file mode 100644 index 0000000..ec24067 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/controller/VehicleEquipmentController.java @@ -0,0 +1,110 @@ +package com.ningdatech.carapi.car.equipment.controller; + +import cn.hutool.core.bean.BeanUtil; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.car.equipment.model.res.SipEquipmentRes; +import com.ningdatech.carapi.car.equipment.model.vo.VehicleEquipmentVO; +import com.ningdatech.carapi.car.equipment.manage.VehicleEquipmentManage; +import com.ningdatech.carapi.car.equipment.model.dto.EquipmentSaveDTO; +import com.ningdatech.carapi.car.equipment.model.dto.EquipmentUpdateDTO; +import com.ningdatech.carapi.car.equipment.model.dto.VehicleEquipmentPageQuery; +import com.ningdatech.carapi.car.equipment.model.dto.VehicleEquipmentQueryDTO; +import com.ningdatech.carapi.car.equipment.service.INdVehicleEquipmentInfoService; +import com.ningdatech.carapi.car.vehicle.model.dto.VehicleArchivesPageQuery; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import com.ningdatech.log.annotation.WebLog; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/archives/equipment") +@Api(value = "archives", tags = "车辆管理-档案管理") +@RequiredArgsConstructor +public class VehicleEquipmentController { + private final VehicleEquipmentManage equipmentManage; + private final INdVehicleEquipmentInfoService vehicleEquipmentInfoService; + + @ApiOperation(value = "车辆设备待添加列表", notes = "车辆设备待添加列表") + @GetMapping("/toBeAddedList") + public PageVo queryToBeAdded(@ModelAttribute VehicleArchivesPageQuery vehicleArchivesPageQuery) { + return equipmentManage.queryToBeAdded(vehicleArchivesPageQuery); + } + + @ApiOperation(value = "车辆设备已添加列表", notes = "车辆设备已添加列表") + @GetMapping("/addedList") + public PageVo queryAdded(@ModelAttribute VehicleEquipmentPageQuery vehicleArchivesPageQuery) { + return equipmentManage.queryAdded(vehicleArchivesPageQuery); + } + + @ApiOperation(value = "车辆设备列表导出", notes = "车辆设备列表导出") + @GetMapping("/export") + @WebLog + public void export(VehicleEquipmentPageQuery req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, equipmentManage::export); + } + + /** + * 查询车辆设备信息 + * @param id 设备ID + * @return 查询结果 + */ + @ApiOperation(value = "查询车辆设备信息-以设备ID查询", notes = "查询车辆设备信息-以设备ID查询") + @GetMapping("/detailsbyId/{id}") + public VehicleEquipmentQueryDTO getEquipmentById(@PathVariable("id") Long id) { + return equipmentManage.getEquipmentById(id); + } + + /** + * 查询车辆设备信息 + * @param vehicleId 车辆ID + * @return 查询结果 + */ + @ApiOperation(value = "查询车辆设备信息-以车辆ID查询", notes = "查询车辆设备信息-以车辆ID查询") + @GetMapping("/detailsbyVehicleId/{vehicleId}") + public List getEquipment(@PathVariable("vehicleId") Long vehicleId) { + return equipmentManage.getEquipment(vehicleId); + } + + @ApiOperation(value = "批量保存车辆设备", notes = "批量保存车辆设备") + @PostMapping("/save") + @WebLog + public List handlerSave(@Valid @RequestBody List datas) { + vehicleEquipmentInfoService.save(datas, LoginUserUtil.getUserId()); + return CollUtils.convert(datas,w -> BeanUtil.toBean(w, VehicleEquipmentQueryDTO.class)); + } + + @ApiOperation(value = "编辑车辆设备", notes = "编辑车辆设备") + @PostMapping("/modify") + @WebLog + public VehicleEquipmentQueryDTO handlerUpdate(@Valid @RequestBody EquipmentUpdateDTO data) { + vehicleEquipmentInfoService.update(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(data, VehicleEquipmentQueryDTO.class); + } + + @ApiOperation(value = "删除车辆设备", notes = "删除车辆设备") + @PostMapping("/remove") + @WebLog + public Boolean handlerDelete(@Valid @RequestBody List ids) { + return vehicleEquipmentInfoService.removeByIdWithCache(ids); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/converter/VehicleEquipmentConverter.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/converter/VehicleEquipmentConverter.java new file mode 100644 index 0000000..b4b2120 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/converter/VehicleEquipmentConverter.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.car.equipment.converter; + +import java.util.Objects; + +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentJoin; +import com.ningdatech.carapi.car.equipment.model.vo.VehicleEquipmentVO; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfoJoin; +import com.ningdatech.carapi.common.constant.CarStatusEnum; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; + +import cn.hutool.core.bean.BeanUtil; + +/** + * @Classname CompanyRegionConverter + * @Description + * @Date 2022/10/9 10:30 + * @Created by PoffyZhang + */ +public class VehicleEquipmentConverter { + + public static VehicleEquipmentVO convert(NdVehicleBaseInfoJoin vehicle) { + if(Objects.isNull(vehicle) || Objects.isNull(vehicle.getId())){ + return null; + } + VehicleEquipmentVO res = BeanUtil.copyProperties(vehicle, VehicleEquipmentVO.class); + CodeUtil.searchCompanyNameAndRegionName(res); + res.setVehicleTypeName(VehicleTypeEnum.getDescByCode(res.getVehicleType())); + res.setVehicleStatus(vehicle.getVehicleStatus()); + res.setVehicleStatusName(CarStatusEnum.getDescByCode(vehicle.getVehicleStatus())); + res.setLastOnlineTime(vehicle.getLastOnlineTime()); + return res; + } + + public static VehicleEquipmentVO convert(NdVehicleEquipmentJoin equipment) { + if(Objects.isNull(equipment) || Objects.isNull(equipment.getId())){ + return null; + } + VehicleEquipmentVO res = BeanUtil.copyProperties(equipment, VehicleEquipmentVO.class); + CodeUtil.searchCompanyNameAndRegionName(res); + res.setId(equipment.getVehicleId()); + res.setEquipmentId(equipment.getId()); + res.setVehicleTypeName(VehicleTypeEnum.getDescByCode(res.getVehicleType())); + return res; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/manage/VehicleEquipmentManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/manage/VehicleEquipmentManage.java new file mode 100644 index 0000000..380fdab --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/manage/VehicleEquipmentManage.java @@ -0,0 +1,510 @@ +package com.ningdatech.carapi.car.equipment.manage; + +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Repository; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +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.google.common.collect.Lists; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.archives.enums.AuditStateEnum; +import com.ningdatech.carapi.car.equipment.converter.VehicleEquipmentConverter; +import com.ningdatech.carapi.car.equipment.model.DataAccessDevices; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentChannels; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentInfo; +import com.ningdatech.carapi.car.equipment.model.VehicleEquipmentNo; +import com.ningdatech.carapi.car.equipment.model.dto.VehicleEquipmentDTO; +import com.ningdatech.carapi.car.equipment.model.dto.VehicleEquipmentPageQuery; +import com.ningdatech.carapi.car.equipment.model.dto.VehicleEquipmentQueryDTO; +import com.ningdatech.carapi.car.equipment.model.res.SipEquipmentRes; +import com.ningdatech.carapi.car.equipment.model.vo.VehicleEquipmentVO; +import com.ningdatech.carapi.car.equipment.service.IDataAccessDevicesService; +import com.ningdatech.carapi.car.equipment.service.INdVehicleEquipmentChannelsService; +import com.ningdatech.carapi.car.equipment.service.INdVehicleEquipmentInfoService; +import com.ningdatech.carapi.car.equipment.service.IVehicleEquipmentNoService; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfoJoin; +import com.ningdatech.carapi.car.vehicle.model.dto.VehicleArchivesPageQuery; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoJoinService; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.constant.VehicleEquipFuncEnum; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +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 lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname VehicleEquipmentRepository + * @Description + * @Date 2022/10/14 14:33 + * @Created by PoffyZhang + */ +@Repository +@RequiredArgsConstructor +@Slf4j +public class VehicleEquipmentManage { + + private final IVehicleBaseInfoJoinService vehicleBaseInfoJoinService; + + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final INdVehicleEquipmentInfoService vehicleEquipmentInfoService; + private final INdVehicleEquipmentChannelsService vehicleEquipmentChannelsService; + private final OperatorsCacheHelper operatorsCacheHelper; + private final IDataAccessDevicesService dataAccessDevicesService; + private final IVehicleEquipmentNoService vehicleEquipmentNoService; + + public PageVo queryToBeAdded(VehicleArchivesPageQuery vehicleArchivesPageQuery) { + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商id、名字 + Long operatorId = operatorQueryDTO.getId(); + + Page page = vehicleArchivesPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + buildBaseInfoQueryWrapper(wrapper,vehicleArchivesPageQuery); + wrapper.eq(NdVehicleBaseInfoJoin::getOperatorId,operatorId); + vehicleBaseInfoJoinService.pageJoinWithNotEquipment(page,wrapper); + List data = CollUtils.convert(page.getRecords(), VehicleEquipmentConverter::convert); + return PageVo.of(data, page.getTotal()); + } else if (UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId().equals(roleId)) { + Long companyId = userDetail.getCompanyId(); + Page page = vehicleArchivesPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + buildBaseInfoQueryWrapper(wrapper,vehicleArchivesPageQuery); + wrapper.and(w -> w.eq(NdVehicleBaseInfoJoin::getCompanyId,companyId).or() + .eq(NdVehicleBaseInfoJoin::getUseCompanyId,companyId)); + vehicleBaseInfoJoinService.pageJoinWithNotEquipmentAndUseCompany(page,wrapper); + List data = CollUtils.convert(page.getRecords(), VehicleEquipmentConverter::convert); + return PageVo.of(data, page.getTotal()); + } else { + Page page = vehicleArchivesPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + VehicleEquipmentManage context = (VehicleEquipmentManage) AopContext.currentProxy(); + context.searchTobeAddedPage(page, wrapper, vehicleArchivesPageQuery); + List data = CollUtils.convert(page.getRecords(), VehicleEquipmentConverter::convert); + return PageVo.of(data, page.getTotal()); + } + } + + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public void searchTobeAddedPage(Page page, LambdaQueryWrapper wrapper, + VehicleArchivesPageQuery vehicleArchivesPageQuery) { + buildBaseInfoQueryWrapper(wrapper,vehicleArchivesPageQuery); + vehicleBaseInfoJoinService.pageJoinWithNotEquipment(page,wrapper); + } + + public PageVo queryAdded(VehicleEquipmentPageQuery vehicleArchivesPageQuery) { + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商id + VUtils.isTrue(Objects.isNull(operatorQueryDTO)).throwMessage("运营商:" + companyName + "不存在!"); + Long operatorId = operatorQueryDTO.getId(); + + Page page = vehicleArchivesPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + buildQueryWrapper(wrapper,vehicleArchivesPageQuery); + wrapper.eq(NdVehicleBaseInfoJoin::getOperatorId,operatorId); + vehicleBaseInfoJoinService.pageJoinWithEquipment(page,wrapper); + List data = CollUtils.convert(page.getRecords(), VehicleEquipmentConverter::convert); + return PageVo.of(data, page.getTotal()); + } else if (UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId().equals(roleId)) { + Long companyId = userDetail.getCompanyId(); + Page page = vehicleArchivesPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + buildQueryWrapper(wrapper,vehicleArchivesPageQuery); + wrapper.and(w -> w.eq(NdVehicleBaseInfoJoin::getCompanyId,companyId).or() + .eq(NdVehicleBaseInfoJoin::getUseCompanyId,companyId)); + vehicleBaseInfoJoinService.pageJoinWithEquipmentAndUseCompany(page,wrapper); + List data = CollUtils.convert(page.getRecords(), VehicleEquipmentConverter::convert); + return PageVo.of(data, page.getTotal()); + } else { + Page page = vehicleArchivesPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + VehicleEquipmentManage context = (VehicleEquipmentManage) AopContext.currentProxy(); + context.searchAddedPage(page, wrapper, vehicleArchivesPageQuery); + List data = CollUtils.convert(page.getRecords(), VehicleEquipmentConverter::convert); + return PageVo.of(data, page.getTotal()); + } + } + + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public void searchAddedPage(Page page, + LambdaQueryWrapper wrapper, VehicleEquipmentPageQuery vehicleArchivesPageQuery) { + buildQueryWrapper(wrapper,vehicleArchivesPageQuery); + vehicleBaseInfoJoinService.pageJoinWithEquipment(page,wrapper); + } + + public VehicleEquipmentQueryDTO getEquipmentById(Long id) { + + NdVehicleEquipmentInfo vehicleEquipmentInfo = vehicleEquipmentInfoService.getById(id); + if (Objects.isNull(vehicleEquipmentInfo)){ + return null; + } + Long vehicleId = vehicleEquipmentInfo.getVehicleId(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + VehicleEquipmentManage context = (VehicleEquipmentManage) AopContext.currentProxy(); + context.buildQuery(wrapper, vehicleId); + NdVehicleBaseInfo ndVehicleBaseInfo = vehicleBaseInfoService.getOne(wrapper); + // 设备所属的车辆,当前登录用户没有权限查看 + if (Objects.isNull(ndVehicleBaseInfo)){ + return null; + } + + VehicleEquipmentQueryDTO query = BeanUtil.toBean(vehicleEquipmentInfo, VehicleEquipmentQueryDTO.class); + if(Objects.nonNull(query)){ + query.setChannels(vehicleEquipmentChannelsService.list(Wrappers.lambdaQuery(NdVehicleEquipmentChannels.class) + .eq(NdVehicleEquipmentChannels::getEquipmentId,query.getId()))); + if(Objects.nonNull(vehicleEquipmentInfo.getSubordinatePlatform()) && + StringUtils.isNumeric(vehicleEquipmentInfo.getSubordinatePlatform())){ + query.setSubordinatePlatform(Long.valueOf(vehicleEquipmentInfo.getSubordinatePlatform())); + } + + } + return query; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(NdVehicleBaseInfo::getId,id); + } + + + public List getEquipmentByCarPlate(String carPlate) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleEquipmentInfo.class); + wrapper.eq(NdVehicleEquipmentInfo::getCarPlate,carPlate); + wrapper.eq(NdVehicleEquipmentInfo::getEquipmentFunction, VehicleEquipFuncEnum.video.name()); + List vehicleEquipments = vehicleEquipmentInfoService.list(wrapper); + return CollUtils.convert(vehicleEquipments, w -> { + VehicleEquipmentQueryDTO equipmentQueryDTO = BeanUtil.copyProperties(w, VehicleEquipmentQueryDTO.class); + if(Objects.nonNull(w.getSubordinatePlatform()) && + StringUtils.isNumeric(w.getSubordinatePlatform())){ + equipmentQueryDTO.setSubordinatePlatform(Long.valueOf(w.getSubordinatePlatform())); + } + return equipmentQueryDTO; + }); + } + + public List getEquipment(Long vehicleId) { + List vehicleEquipments = vehicleEquipmentInfoService + .list(Wrappers.lambdaQuery(NdVehicleEquipmentInfo.class).eq(NdVehicleEquipmentInfo::getVehicleId,vehicleId)); + List res = CollUtils.convert(vehicleEquipments, e -> BeanUtil.copyProperties(e,VehicleEquipmentQueryDTO.class)); + if(CollUtil.isNotEmpty(res)){ + for(VehicleEquipmentQueryDTO dto: res){ + dto.setChannels(vehicleEquipmentChannelsService.list(Wrappers.lambdaQuery(NdVehicleEquipmentChannels.class) + .eq(NdVehicleEquipmentChannels::getEquipmentId,dto.getId()))); + dto.setSubordinatePlatformName(operatorsCacheHelper.getNameById(dto.getSubordinatePlatform())); + } + } + return res; + } + + /** + * 处理regionCode 拼接 + * @param wrapper + * @param vehicleEquipmentPageQuery + */ + private void buildQueryWrapper(LambdaQueryWrapper wrapper, VehicleEquipmentPageQuery vehicleEquipmentPageQuery) { + wrapper.like(StringUtils.isNotBlank(vehicleEquipmentPageQuery.getCarPlate()), NdVehicleBaseInfoJoin::getCarPlate, vehicleEquipmentPageQuery.getCarPlate()) + .like(StringUtils.isNotBlank(vehicleEquipmentPageQuery.getCompanyName()), NdVehicleBaseInfoJoin::getCompanyName, vehicleEquipmentPageQuery.getCompanyName()) + .eq(Objects.nonNull(vehicleEquipmentPageQuery.getVehicleType()), NdVehicleBaseInfoJoin::getVehicleType, vehicleEquipmentPageQuery.getVehicleType()) + .eq(Objects.nonNull(vehicleEquipmentPageQuery.getVehicleStatus()),NdVehicleBaseInfoJoin::getVehicleStatus,vehicleEquipmentPageQuery.getVehicleStatus()) + //只有审核成功的才会进入该列表 + .eq(NdVehicleBaseInfoJoin::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()) + .like(StringUtils.isNotBlank(vehicleEquipmentPageQuery.getOperatorName()), NdVehicleBaseInfoJoin::getOperatorName, vehicleEquipmentPageQuery.getOperatorName()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdVehicleBaseInfoJoin::getUpdateOn); + } + + + /** + * + * @param wrapper + * @param vehicleArchivesPageQuery + */ + private void buildBaseInfoQueryWrapper(LambdaQueryWrapper wrapper, + VehicleArchivesPageQuery vehicleArchivesPageQuery) { + wrapper.like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getCarPlate()), NdVehicleBaseInfoJoin::getCarPlate, vehicleArchivesPageQuery.getCarPlate()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getCompanyName()), NdVehicleBaseInfoJoin::getCompanyName, vehicleArchivesPageQuery.getCompanyName()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getVehicleType()), NdVehicleBaseInfoJoin::getVehicleType, vehicleArchivesPageQuery.getVehicleType()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getVehicleStatus()),NdVehicleBaseInfoJoin::getVehicleStatus,vehicleArchivesPageQuery.getVehicleStatus()) + //只有审核成功的才会进入该列表 + .eq(NdVehicleBaseInfoJoin::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getOperatorName()), NdVehicleBaseInfoJoin::getOperatorName, vehicleArchivesPageQuery.getOperatorName()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdVehicleBaseInfoJoin::getUpdateOn); + + } + + public void export(HttpServletResponse response, VehicleEquipmentPageQuery equipmentPageQuery) { + equipmentPageQuery.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + VehicleArchivesPageQuery vehicleArchivesPageQuery = BeanUtil.copyProperties(equipmentPageQuery,VehicleArchivesPageQuery.class); + PageVo toBePage = queryToBeAdded(vehicleArchivesPageQuery); + PageVo addPage = queryAdded(equipmentPageQuery); + List toBeList = toBePage.getRecords().stream().map(w -> BeanUtil.copyProperties(w, VehicleEquipmentVO.class)).collect(Collectors.toList()); + List auditList = addPage.getRecords().stream().map(w -> BeanUtil.copyProperties(w, VehicleEquipmentVO.class)).collect(Collectors.toList()); + String fileName = "车辆设备列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + String sheetNameToBe = "车辆设备待安装列表"; + String sheetNameAdded = "车辆设备已安装列表"; + try { + ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build(); + //埋点基础信息 sheet + WriteSheet writeSheet = EasyExcel.writerSheet(0, sheetNameToBe) + .head(VehicleEquipmentDTO.class).build(); + excelWriter.write(toBeList, writeSheet); + //埋点数据转换信息 sheet + writeSheet = EasyExcel.writerSheet(1, sheetNameAdded) + .head(VehicleEquipmentDTO.class).build(); + excelWriter.write(auditList, writeSheet); + excelWriter.finish(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * 从sip获取到 该车牌号的设备 + * @param car_plate + * @return + */ + public Boolean initEquipmentFromSip(String car_plate) { + List sipEquipments = vehicleEquipmentInfoService.getSipEquipmentsByCarPlate(car_plate); + if(CollUtil.isNotEmpty(sipEquipments)){ + //如果有设备的话 就去更新这个车牌下的所有设备 + //1.查看系统里 是否有这个车牌号 + NdVehicleBaseInfo vehicle = vehicleBaseInfoService.getOne( + Wrappers.lambdaQuery(NdVehicleBaseInfo.class).eq(NdVehicleBaseInfo::getCarPlate,car_plate) + .eq(NdVehicleBaseInfo::getDeleted,Boolean.FALSE) + .eq(NdVehicleBaseInfo::getAuditState,AuditStateEnum.AUDIT_SUCCESS.getCode())); + if(Objects.isNull(vehicle)){ + log.warn("该车辆 【{}】不存在 系统中",car_plate); + return Boolean.FALSE; + } + //2.先删除现有的设备 + vehicleEquipmentInfoService.remove(Wrappers.lambdaQuery(NdVehicleEquipmentInfo.class) + .eq(NdVehicleEquipmentInfo::getCarPlate,car_plate)); + List toAdds = sipEquipments.stream() + .filter(e -> Objects.nonNull(e) && StringUtils.isNotBlank(e.getDevice_id())) + .map(e -> { + NdVehicleEquipmentInfo equipmentInfo = new NdVehicleEquipmentInfo(); + equipmentInfo.setName(e.getName()); + equipmentInfo.setEquipmentNo(e.getDevice_id()); + equipmentInfo.setCarPlate(car_plate); + equipmentInfo.setVehicleId(vehicle.getId()); + equipmentInfo.setSubordinatePlatform(e.getPlatform_id()); + return equipmentInfo; + }).collect(Collectors.toList()); + //3.再批量添加 + vehicleEquipmentInfoService.saveBatch(toAdds); + return Boolean.TRUE; + } + return Boolean.FALSE; + } + + public Boolean initEquipmentFromSipAll() { + //1.查看系统里 审核过的车牌号 + List vehicles = vehicleBaseInfoService.list( + Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getDeleted,Boolean.FALSE) + .eq(NdVehicleBaseInfo::getAuditState,AuditStateEnum.AUDIT_SUCCESS.getCode())); + Integer total = 0; + if(CollUtil.isNotEmpty(vehicles)){ + //2.去遍历 并且添加车辆的设备 + for(NdVehicleBaseInfo vehicle : vehicles){ + if(StringUtils.isNotBlank(vehicle.getCarPlate())){ + List sipEquipments = vehicleEquipmentInfoService.getSipEquipmentsByCarPlate(vehicle.getCarPlate()); + //2.先删除现有的设备 + vehicleEquipmentInfoService.remove(Wrappers.lambdaQuery(NdVehicleEquipmentInfo.class) + .eq(NdVehicleEquipmentInfo::getCarPlate,vehicle.getCarPlate())); + if(CollUtil.isNotEmpty(sipEquipments)){ + List toAdds = sipEquipments.stream() + .filter(e -> Objects.nonNull(e) && StringUtils.isNotBlank(e.getDevice_id())) + .map(e -> { + NdVehicleEquipmentInfo equipmentInfo = new NdVehicleEquipmentInfo(); + equipmentInfo.setName(e.getName()); + equipmentInfo.setEquipmentNo(e.getDevice_id()); + equipmentInfo.setCarPlate(vehicle.getCarPlate()); + equipmentInfo.setVehicleId(vehicle.getId()); + equipmentInfo.setSubordinatePlatform("1"); + return equipmentInfo; + }).collect(Collectors.toList()); + //3.再批量添加 + total += toAdds.size(); + if(CollUtil.isNotEmpty(toAdds)){ + vehicleEquipmentInfoService.insertBatch(toAdds); + } + log.info("当前插入了 total :{}",total); + } + } + } + log.info("最后的批量插入了 total :{}",total); + return Boolean.TRUE; + } + return Boolean.FALSE; + } + + public void getEquipNo() { + // 获取系统中所有车牌号 + List carPlateList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()) + .select(NdVehicleBaseInfo::getCarPlate) + .isNotNull(NdVehicleBaseInfo::getCarPlate)) + .stream().map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + // 获取实时视频设备表中的车牌号集合 + Set dataCarPlates = dataAccessDevicesService.list(Wrappers.lambdaQuery(DataAccessDevices.class) + .select(DataAccessDevices::getCarPlate)) + .stream().filter(Objects::nonNull).map(DataAccessDevices::getCarPlate) + .collect(Collectors.toSet()); + // 获取在系统中的车牌号 + List carNoList = dataCarPlates.stream().filter(carPlateList::contains).collect(Collectors.toList()); + log.info("存在于系统中的车牌号数量:{}", carNoList.size()); + // 获取实时视频设备表中所有数据 并按车牌号分组 + Map> devicesDataMap = dataAccessDevicesService.list(Wrappers.lambdaQuery(DataAccessDevices.class) + .isNotNull(DataAccessDevices::getDeviceId) + .isNotNull(DataAccessDevices::getPlatformId) + .select(DataAccessDevices::getId, DataAccessDevices::getCarPlate, DataAccessDevices::getDeviceId, + DataAccessDevices::getStatus,DataAccessDevices::getPlatformId) + .in(DataAccessDevices::getCarPlate,carNoList)) + .stream().collect(Collectors.groupingBy(DataAccessDevices::getCarPlate)); + // 实时视频设备表中车牌号集合 + Set deviceCarPlates = devicesDataMap.keySet(); + + // 获取同步设备编号表中的数据 + Map> dataMap = vehicleEquipmentNoService.list(Wrappers.lambdaQuery(VehicleEquipmentNo.class) + .select(VehicleEquipmentNo::getId, VehicleEquipmentNo::getCarPlate, + VehicleEquipmentNo::getDeviceId, VehicleEquipmentNo::getStatus, VehicleEquipmentNo::getPlatformId)) + .stream().collect(Collectors.groupingBy(VehicleEquipmentNo::getCarPlate)); + // 同步设备编号表中车牌号集合 + Set carPlates = dataMap.keySet(); + + // 判断数据是否需要新增、删除或者更新 + // 新增:实时视频设备表中有的车牌号而同步设备表中没有 + Set addCarPlates = deviceCarPlates.stream().filter(d -> !carPlates.contains(d)).collect(Collectors.toSet()); + if (CollUtil.isNotEmpty(addCarPlates)){ + addCarPlates.forEach(d -> { + List dataAccessDevices = devicesDataMap.get(d); + List addDataList = Lists.newArrayList(); + int i = 1; + for (DataAccessDevices dataAccessDevice : dataAccessDevices) { + VehicleEquipmentNo vehicleEquipmentNo = new VehicleEquipmentNo(); + vehicleEquipmentNo.setCarPlate(d); + vehicleEquipmentNo.setDeviceId(dataAccessDevice.getDeviceId()); + vehicleEquipmentNo.setDeviceName(d + StrPool.DASH + DefValConstants.TONG_DAO + i++); + String status = dataAccessDevice.getStatus(); + if (StringUtils.isNotBlank(status)) { + vehicleEquipmentNo.setStatus(status); + } + vehicleEquipmentNo.setPlatformId(dataAccessDevice.getPlatformId()); + vehicleEquipmentNo.setCreateBy(1L); + vehicleEquipmentNo.setCreateOn(LocalDateTime.now()); + vehicleEquipmentNo.setUpdateBy(1L); + vehicleEquipmentNo.setUpdateOn(LocalDateTime.now()); + addDataList.add(vehicleEquipmentNo); + } + vehicleEquipmentNoService.saveBatch(addDataList); + }); + } + // 删除:实时视频设备表中没有车牌号而同步设备表中有 + Set delCarPlates = carPlates.stream().filter(d -> !deviceCarPlates.contains(d)).collect(Collectors.toSet()); + if (CollUtil.isNotEmpty(delCarPlates)){ + vehicleEquipmentNoService.remove(Wrappers.lambdaQuery(VehicleEquipmentNo.class) + .in(VehicleEquipmentNo::getCarPlate, delCarPlates)); + } + + // 更新:实时视频设备表和同步设备编号表中对应车牌号下对应ID的设备编号、设备状态不一致或者不存在 + for (Map.Entry> entry : dataMap.entrySet()) { + String carPlate = entry.getKey(); + List equipmentNos = entry.getValue(); + List dataAccessDevices = devicesDataMap.get(carPlate); + + // 如果当前车牌号对应的设备编号及设备状态完全相同,则不做任何操作 + Set data = equipmentNos.stream().map(e -> e.getDeviceId() + StrPool.DASH + e.getStatus()).collect(Collectors.toSet()); + Set deviceData = dataAccessDevices.stream().map(d -> { + String status = d.getStatus(); + if (StrPool.EMPTY.equals(status)) { + status = StrPool.NULL; + } + return d.getDeviceId() + StrPool.DASH + status; + }).collect(Collectors.toSet()); + if (data.equals(deviceData)) { + log.info("车牌号:{}下的设备编号及设备状态完全相同,无需更新", carPlate); + continue; + } + + Map equipmentNoMap = equipmentNos.stream().collect(Collectors.toMap(e -> e.getDeviceId() + StrPool.DASH + e.getPlatformId(), e -> e)); + Map dataAccessDevicesMap = dataAccessDevices.stream().collect(Collectors.toMap(d -> d.getDeviceId() + StrPool.DASH + d.getPlatformId(), d -> d)); + + // 如果对应车牌号下的设备数不为0,先删除再保存 + if (CollUtil.isNotEmpty(equipmentNoMap) && CollUtil.isNotEmpty(dataAccessDevicesMap)) { + vehicleEquipmentNoService.remove(Wrappers.lambdaQuery(VehicleEquipmentNo.class) + .eq(VehicleEquipmentNo::getCarPlate, carPlate)); + int index = 1; + List addDataList = Lists.newArrayList(); + for (Map.Entry devicesEntry : dataAccessDevicesMap.entrySet()) { + String[] split = devicesEntry.getKey().split(StrPool.DASH); + String addEquipNo = split[0]; + DataAccessDevices accessDevices = devicesEntry.getValue(); + VehicleEquipmentNo vehicleEquipmentNo = new VehicleEquipmentNo(); + vehicleEquipmentNo.setCarPlate(carPlate); + vehicleEquipmentNo.setDeviceId(addEquipNo); + vehicleEquipmentNo.setDeviceName(carPlate + StrPool.DASH + DefValConstants.TONG_DAO + index++); + if (Objects.nonNull(accessDevices)){ + String status = accessDevices.getStatus(); + if (StringUtils.isNotBlank(status)) { + vehicleEquipmentNo.setStatus(status); + } + } + vehicleEquipmentNo.setPlatformId(accessDevices.getPlatformId()); + vehicleEquipmentNo.setCreateBy(1L); + vehicleEquipmentNo.setCreateOn(LocalDateTime.now()); + vehicleEquipmentNo.setUpdateBy(1L); + vehicleEquipmentNo.setUpdateOn(LocalDateTime.now()); + addDataList.add(vehicleEquipmentNo); + } + vehicleEquipmentNoService.saveBatch(addDataList); + + } + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/DataAccessDevicesMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/DataAccessDevicesMapper.java new file mode 100644 index 0000000..b8a12ca --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/DataAccessDevicesMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.equipment.mapper; + +import com.ningdatech.carapi.car.equipment.model.DataAccessDevices; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-05-17 + */ +public interface DataAccessDevicesMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/DataAccessDevicesMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/DataAccessDevicesMapper.xml new file mode 100644 index 0000000..ee5a7d4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/DataAccessDevicesMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentChannelsMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentChannelsMapper.java new file mode 100644 index 0000000..2d251d2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentChannelsMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.equipment.mapper; + +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentChannels; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdVehicleEquipmentChannelsMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentChannelsMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentChannelsMapper.xml new file mode 100644 index 0000000..46f1967 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentChannelsMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentInfoMapper.java new file mode 100644 index 0000000..c31603c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentInfoMapper.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.equipment.mapper; + +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdVehicleEquipmentInfoMapper extends BaseMapper { + + Boolean insertBatch(@Param("list") List toAddEp); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentInfoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentInfoMapper.xml new file mode 100644 index 0000000..d672136 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentInfoMapper.xml @@ -0,0 +1,31 @@ + + + + + INSERT INTO nd_vehicle_equipment_info + (name, + sim_card_no, + end_point, + equipment_no, + equipment_function, + end_type, + subordinate_platform, + vehicle_id, + car_plate + ) + values + + ( + #{item.name}, + #{item.simCardNo}, + #{item.endPoint}, + #{item.equipmentNo}, + #{item.equipmentFunction}, + #{item.endType}, + #{item.subordinatePlatform}, + #{item.vehicleId}, + #{item.carPlate} + ) + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentJoinMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentJoinMapper.java new file mode 100644 index 0000000..625d6bd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/NdVehicleEquipmentJoinMapper.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.car.equipment.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentJoin; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdVehicleEquipmentJoinMapper extends BaseMapper { + String QUERY_SQL = "SELECT eq.*,b.vehicle_type,c.id as company_id,c.name as company_name,o.name as operator_name," + + "c.region_id,b.audit_state" + + " FROM nd_vehicle_equipment_info AS eq " + + " LEFT JOIN nd_vehicle_base_info AS b ON eq.vehicle_id = b.id " + + " LEFT JOIN nd_company_info AS c ON b.company_id = c.id " + + " LEFT JOIN nd_operator_info AS o ON b.operator_id = o.id "; + String WRAPPER_SQL = "SELECT * from ( " + QUERY_SQL + " ) AS q ${ew.customSqlSegment}"; + + @Select(WRAPPER_SQL) + Page pageJoinBaseInfo(Page page, @Param("ew") LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/VehicleEquipmentNoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/VehicleEquipmentNoMapper.java new file mode 100644 index 0000000..ec2d003 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/VehicleEquipmentNoMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.equipment.mapper; + +import com.ningdatech.carapi.car.equipment.model.VehicleEquipmentNo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2024-02-23 + */ +public interface VehicleEquipmentNoMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/VehicleEquipmentNoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/VehicleEquipmentNoMapper.xml new file mode 100644 index 0000000..db3129f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/mapper/VehicleEquipmentNoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/DataAccessDevices.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/DataAccessDevices.java new file mode 100644 index 0000000..34be19f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/DataAccessDevices.java @@ -0,0 +1,115 @@ +package com.ningdatech.carapi.car.equipment.model; + +import java.io.Serializable; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-05-17 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName("nd_data_access_devices") +@ApiModel(value = "DataAccessDevices对象", description = "") +public class DataAccessDevices implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + private Long addtime; + + private Long uptime; + + private Long deltime; + + private String deviceId; + + private String name; + + private String manufacturer; + + private String model; + + private String owner; + + private String civilCode; + + private String address; + + private Integer parental; + + private String parentId; + + private Integer safetyWay; + + private Integer registerWay; + + private String certnum; + + private Integer certifiable; + + private Integer errCode; + + private String endTime; + + private Integer secrecy; + + private String ipAddress; + + private String port; + + private String password; + + private String status; + + private String longitude; + + private String latitude; + + private String resolution; + + private String firmware; + + private String channel; + + private String platformId; + + private String region; + + private String host; + + private String transport; + + private String proto; + + private String report; + + private String raddr; + + private String deviceType; + + private String uri; + + private String active; + + private String source; + + private String url; + + private String carPlate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/NdVehicleEquipmentChannels.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/NdVehicleEquipmentChannels.java new file mode 100644 index 0000000..b1f7b13 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/NdVehicleEquipmentChannels.java @@ -0,0 +1,52 @@ +package com.ningdatech.carapi.car.equipment.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_vehicle_equipment_channels") +@Data +public class NdVehicleEquipmentChannels extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 通道名称 + */ + private String name; + + /** + * 位置 + */ + private String location; + + /** + * 备注 + */ + private String remark; + + /** + * 车辆设备ID + */ + private Long equipmentId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/NdVehicleEquipmentInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/NdVehicleEquipmentInfo.java new file mode 100644 index 0000000..43d2177 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/NdVehicleEquipmentInfo.java @@ -0,0 +1,143 @@ +package com.ningdatech.carapi.car.equipment.model; + +import java.io.Serializable; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_vehicle_equipment_info") +@Data +@ApiModel(value = "NdVehicleBaseInfo", description = "车辆档案-车辆设备信息") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleEquipmentInfo extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private String name; + + /** + * SIM卡号 + */ + @ApiModelProperty("SIM卡号") + @TableField(value = "sim_card_no") + private String simCardNo; + + /** + * 终端号 + */ + @ApiModelProperty("终端号") + @TableField(value = "end_point") + private String endPoint; + + /** + * 设备号 + */ + @ApiModelProperty("设备号") + @TableField(value = "equipment_no") + private String equipmentNo; + + /** + * 设备功能 + */ + @ApiModelProperty("设备功能") + @TableField(value = "equipment_function") + private String equipmentFunction; + + /** + * 终端类型 + */ + @ApiModelProperty("终端类型") + @TableField(value = "end_type") + private String endType; + + /** + * 下级平台 + */ + @ApiModelProperty("下级平台") + @TableField(value = "subordinate_platform") + private String subordinatePlatform; + + /** + * 车辆ID + */ + @ApiModelProperty("车辆ID") + @TableField(value = "vehicle_id") + private Long vehicleId; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 车牌类型 + */ + @ApiModelProperty("车牌类型") + @TableField(exist = false) + private Long vehicleType; + + /** + * 企业名称 + */ + @ApiModelProperty("企业名称") + @TableField(exist = false) + private String companyName; + + /** + * 运营商名称 + */ + @ApiModelProperty("运营商名称") + @TableField(exist = false) + private String operatorName; + + + /** + * 区域id + */ + @ApiModelProperty("区域id") + @TableField(exist = false) + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(exist = false) + private String regionName; + + /** + * 平台ID + */ + @ApiModelProperty("平台ID") + @TableField(value = "platform_id") + private String platformId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/NdVehicleEquipmentJoin.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/NdVehicleEquipmentJoin.java new file mode 100644 index 0000000..1799c5b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/NdVehicleEquipmentJoin.java @@ -0,0 +1,145 @@ +package com.ningdatech.carapi.car.equipment.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_vehicle_equipment_info") +@Data +@ApiModel(value = "NdVehicleBaseInfo", description = "车辆档案-车辆设备信息") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleEquipmentJoin extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * SIM卡号 + */ + @ApiModelProperty("SIM卡号") + @TableField(value = "sim_card_no") + private String simCardNo; + + + + /** + * 终端号 + */ + @ApiModelProperty("终端号") + @TableField(value = "end_point") + private String endPoint; + + /** + * 设备号 + */ + @ApiModelProperty("设备号") + @TableField(value = "equipment_no") + private String equipmentNo; + + /** + * 设备功能 + */ + @ApiModelProperty("设备功能") + @TableField(value = "equipment_function") + private String equipmentFunction; + + /** + * 终端类型 + */ + @ApiModelProperty("终端类型") + @TableField(value = "end_type") + private String endType; + + /** + * 下级平台 + */ + @ApiModelProperty("下级平台") + @TableField(value = "subordinate_platform") + private String subordinatePlatform; + + /** + * 车辆ID + */ + @ApiModelProperty("车辆ID") + @TableField(value = "vehicle_id") + private Long vehicleId; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @TableField(value = "car_plate") + private String carPlate; + + /** + * 车牌类型 + */ + @ApiModelProperty("车牌类型") + private Long vehicleType; + + /** + * 企业名称 + */ + @ApiModelProperty("企业id") + private Long companyId; + + /** + * 企业名称 + */ + @ApiModelProperty("企业名称") + private String companyName; + + /** + * 运营商名称 + */ + @ApiModelProperty("运营商名称") + private String operatorName; + + + /** + * 区域id + */ + @ApiModelProperty("区域id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(exist = false) + private String regionName; + + /** + * 审核状态 + */ + @ApiModelProperty("审核状态") + private Long auditState; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/VehicleEquipmentNo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/VehicleEquipmentNo.java new file mode 100644 index 0000000..d87eb8b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/VehicleEquipmentNo.java @@ -0,0 +1,59 @@ +package com.ningdatech.carapi.car.equipment.model; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2024-02-23 + */ +@Data +@TableName("nd_vehicle_equipment_no") +@ApiModel(value = "VehicleEquipmentNo对象", description = "") +public class VehicleEquipmentNo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("设备编号") + private String deviceId; + + @ApiModelProperty("设备名称") + private String deviceName; + + @ApiModelProperty("设备状态 ON 在线、OFF 离线") + private String status; + + @ApiModelProperty("平台ID") + private String platformId; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/EquipmentChannelsSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/EquipmentChannelsSaveDTO.java new file mode 100644 index 0000000..ae30177 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/EquipmentChannelsSaveDTO.java @@ -0,0 +1,52 @@ +package com.ningdatech.carapi.car.equipment.model.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "EquipmentChannelsSaveDTO", description = "车辆设备通道") +public class EquipmentChannelsSaveDTO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 通道名称 + */ + @ApiModelProperty("通道名称") + private String name; + + /** + * 位置 + */ + @ApiModelProperty("位置") + private String location; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String remark; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/EquipmentSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/EquipmentSaveDTO.java new file mode 100644 index 0000000..3c99980 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/EquipmentSaveDTO.java @@ -0,0 +1,80 @@ +package com.ningdatech.carapi.car.equipment.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 车辆信息 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "EquipmentSaveDTO", description = "车辆设备保存") +public class EquipmentSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * SIM卡号 + */ + @ApiModelProperty("SIM卡号") + private String simCardNo; + + private String name; + + /** + * 终端号 + */ + @ApiModelProperty("终端号") + private String endPoint; + + /** + * 设备号 + */ + @ApiModelProperty("设备号") + private String equipmentNo; + + /** + * 设备功能 + */ + @ApiModelProperty("设备功能") + private String equipmentFunction; + + /** + * 终端类型 + */ + @ApiModelProperty("终端类型") + private String endType; + + /** + * 下级平台 + */ + @ApiModelProperty("下级平台") + private String subordinatePlatform; + + /** + * 车辆ID + */ + @ApiModelProperty("车辆ID") + @NotNull(message = "请传车辆id") + private Long vehicleId; + + @ApiModelProperty("设备通道") + private List channels; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/EquipmentUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/EquipmentUpdateDTO.java new file mode 100644 index 0000000..0749e34 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/EquipmentUpdateDTO.java @@ -0,0 +1,81 @@ +package com.ningdatech.carapi.car.equipment.model.dto; + +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentChannels; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 车辆设备 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "EquipmentUpdateDTO", description = "车辆设备编辑") +public class EquipmentUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @NotNull(message = "请传id") + private Long id; + + /** + * SIM卡号 + */ + @ApiModelProperty("SIM卡号") + private String simCardNo; + + /** + * 终端号 + */ + @ApiModelProperty("终端号") + private String endPoint; + + /** + * 设备号 + */ + @ApiModelProperty("设备号") + private String equipmentNo; + + /** + * 设备功能 + */ + @ApiModelProperty("设备功能") + private String equipmentFunction; + + /** + * 终端类型 + */ + @ApiModelProperty("终端类型") + private String endType; + + /** + * 下级平台 + */ + @ApiModelProperty("下级平台") + private String subordinatePlatform; + + /** + * 车辆ID + */ + @ApiModelProperty("车辆ID") + private Long vehicleId; + + @ApiModelProperty("设备通道") + private List channels; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/VehicleEquipmentDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/VehicleEquipmentDTO.java new file mode 100644 index 0000000..5fb59de --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/VehicleEquipmentDTO.java @@ -0,0 +1,119 @@ +package com.ningdatech.carapi.car.equipment.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.TableField; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@ApiModel(value = "VehicleEquipmentDTO", description = "车辆档案-车辆设备DTO") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class VehicleEquipmentDTO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @ExcelProperty("ID") + private Long id; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("所属企业ID") + @ExcelProperty("所属企业ID") + private Long companyId; + + @ApiModelProperty("所属企业名称") + @ExcelProperty("所属企业名称") + private String companyName; + + @ApiModelProperty("行政区域id") + @ExcelProperty("行政区域id") + private Long regionId; + + @ApiModelProperty("行政区域名称") + @ExcelProperty("行政区域名称") + private String regionName; + + @ApiModelProperty("车辆类型") + @ExcelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + @ExcelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("设备ID") + @ExcelProperty("设备ID") + private Long equipmentId; + + /** + * SIM卡号 + */ + @ApiModelProperty("SIM卡号") + @ExcelProperty("SIM卡号") + private String simCardNo; + + /** + * 终端号 + */ + @ApiModelProperty("终端号") + @ExcelProperty("终端号") + private String endPoint; + + /** + * 设备号 + */ + @ApiModelProperty("设备号") + @ExcelProperty("设备号") + private String equipmentNo; + + /** + * 设备功能 + */ + @ApiModelProperty("设备功能") + @ExcelProperty("设备功能") + private String equipmentFunction; + + /** + * 终端类型 + */ + @ApiModelProperty("终端类型") + @ExcelProperty("终端类型") + private String endType; + + /** + * 下级平台 + */ + @ApiModelProperty("下级平台") + @ExcelProperty("下级平台") + private String subordinatePlatform; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/VehicleEquipmentPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/VehicleEquipmentPageQuery.java new file mode 100644 index 0000000..ea999c9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/VehicleEquipmentPageQuery.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.car.equipment.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 实体类 + * 车辆设备 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "VehicleEquipmentPageQuery", description = "车辆设备") +public class VehicleEquipmentPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 车牌号 + */ + @ApiModelProperty(value = "车牌号") + private String carPlate; + + /** + * 所属企业名 + */ + @ApiModelProperty(value = "所属企业名") + private String companyName; + + /** + * 车辆类型 + */ + @ApiModelProperty(value = "车辆类型") + private Integer vehicleType; + + /** + * 所属区域id + */ + @ApiModelProperty(value = "所属区域id") + private Long regionId; + + + /** + * 运营商名 + */ + @ApiModelProperty(value = "运营商名") + private String operatorName; + + @ApiModelProperty("车辆状态") + private Integer vehicleStatus; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/VehicleEquipmentQueryDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/VehicleEquipmentQueryDTO.java new file mode 100644 index 0000000..1331d40 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/dto/VehicleEquipmentQueryDTO.java @@ -0,0 +1,93 @@ +package com.ningdatech.carapi.car.equipment.model.dto; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentChannels; +import lombok.Builder; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_vehicle_equipment_info") +@Data +@Builder +@ToString +public class VehicleEquipmentQueryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private Long id; + + private String name; + + /** + * 创建时间 + */ + private LocalDateTime createOn; + + /** + * 创建人 + */ + private Long createBy; + + /** + * 修改时间 + */ + private LocalDateTime updateOn; + + /** + * 修改人 + */ + private Long updateBy; + + /** + * SIM卡号 + */ + private String simCardNo; + + /** + * 终端号 + */ + private String endPoint; + + /** + * 设备号 + */ + private String equipmentNo; + + /** + * 设备功能 + */ + private String equipmentFunction; + + /** + * 终端类型 + */ + private String endType; + + /** + * 下级平台 + */ + private Long subordinatePlatform; + private String subordinatePlatformName; + + /** + * 车辆ID + */ + private Long vehicleId; + + private List channels; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/res/SipApiResponse.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/res/SipApiResponse.java new file mode 100644 index 0000000..0d967e0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/res/SipApiResponse.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.car.equipment.model.res; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.util.List; + +/** + * @Classname SipApiResponse + * @Description + * @Date 2023/3/23 14:20 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "SIP结果返回Api",description = "SIP结果返回Api") +public class SipApiResponse { + + private Integer status_code; + private String status; + private String message; + private Long t; + private List result; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/res/SipEquipmentRes.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/res/SipEquipmentRes.java new file mode 100644 index 0000000..79878f9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/res/SipEquipmentRes.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.car.equipment.model.res; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @Classname SipEquipmentRes + * @Description + * @Date 2023/3/23 14:20 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "请求车辆GPS设备信息结果返回",description = "请求车辆GPS设备信息结果返回") +public class SipEquipmentRes { + + private String device_id; + private String name; + private String manufacturer; + private String model; + private String owner; + private String civil_code; + private String address; + private Integer parental; + private String parent_id; + private Integer safety_way; + private Integer register_way; + private String certnum; + private Integer certifiable; + private Integer err_code; + private String end_time; + private Integer secrecy; + private String ip_address; + private String port; + private String password; + private String status; + private String longitude; + private String latitude; + private String resolution; + private String firmware; + private String Channel; + private String platform_id; + private String region; + private String host; + private String transport; + private String proto; + private String report; + private String raddr; + private String device_type; + private String uri; + private String active; + private String source; + private String uurlri; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/vo/NdVehicleEquipmentVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/vo/NdVehicleEquipmentVO.java new file mode 100644 index 0000000..d1ad86a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/vo/NdVehicleEquipmentVO.java @@ -0,0 +1,115 @@ +package com.ningdatech.carapi.car.equipment.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdVehicleEquipmentVO", description = "车辆档案-车辆设备信息") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleEquipmentVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private Long id; + + /** + * SIM卡号 + */ + @ApiModelProperty("SIM卡号") + private String simCardNo; + + /** + * 终端号 + */ + @ApiModelProperty("终端号") + private String endPoint; + + /** + * 设备号 + */ + @ApiModelProperty("设备号") + private String equipmentNo; + + /** + * 设备功能 + */ + @ApiModelProperty("设备功能") + private String equipmentFunction; + + /** + * 终端类型 + */ + @ApiModelProperty("终端类型") + private String endType; + + /** + * 下级平台 + */ + @ApiModelProperty("下级平台") + private String subordinatePlatform; + + /** + * 车辆ID + */ + @ApiModelProperty("车辆ID") + private Long vehicleId; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 车牌类型 + */ + @ApiModelProperty("车牌类型") + private Long vehicleType; + + /** + * 企业名称 + */ + @ApiModelProperty("企业名称") + private String companyName; + + /** + * 运营商名称 + */ + @ApiModelProperty("运营商名称") + private String operatorName; + + + /** + * 区域id + */ + @ApiModelProperty("区域id") + private String regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/vo/VehicleEquipmentVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/vo/VehicleEquipmentVO.java new file mode 100644 index 0000000..48b4768 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/model/vo/VehicleEquipmentVO.java @@ -0,0 +1,121 @@ +package com.ningdatech.carapi.car.equipment.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ningdatech.carapi.common.base.BaseEntity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@ApiModel(value = "VehicleEquipmentVO", description = "车辆档案-车辆信息VO") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class VehicleEquipmentVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Long id; + + private String name; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("所属企业ID") + private Long companyId; + + @ApiModelProperty("所属企业名称") + private String companyName; + + @ApiModelProperty("行政区域id") + private Long regionId; + + @ApiModelProperty("行政区域名称") + private String regionName; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("设备ID") + private Long equipmentId; + + /** + * SIM卡号 + */ + @ApiModelProperty("SIM卡号") + @TableField(value = "sim_card_no") + private String simCardNo; + + /** + * 终端号 + */ + @ApiModelProperty("终端号") + @TableField(value = "end_point") + private String endPoint; + + /** + * 设备号 + */ + @ApiModelProperty("设备号") + @TableField(value = "equipment_no") + private String equipmentNo; + + /** + * 设备功能 + */ + @ApiModelProperty("设备功能") + @TableField(value = "equipment_function") + private String equipmentFunction; + + /** + * 终端类型 + */ + @ApiModelProperty("终端类型") + @TableField(value = "end_type") + private String endType; + + /** + * 下级平台 + */ + @ApiModelProperty("下级平台") + @TableField(value = "subordinate_platform") + private String subordinatePlatform; + + @ApiModelProperty("车辆状态") + private Integer vehicleStatus; + + @ApiModelProperty("车辆状态名称") + private String vehicleStatusName; + + @ApiModelProperty("车辆最后上线时间") + private LocalDateTime lastOnlineTime; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/IDataAccessDevicesService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/IDataAccessDevicesService.java new file mode 100644 index 0000000..e014e10 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/IDataAccessDevicesService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.equipment.service; + +import com.ningdatech.carapi.car.equipment.model.DataAccessDevices; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-05-17 + */ +public interface IDataAccessDevicesService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/INdVehicleEquipmentChannelsService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/INdVehicleEquipmentChannelsService.java new file mode 100644 index 0000000..e76cec6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/INdVehicleEquipmentChannelsService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.equipment.service; + +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentChannels; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdVehicleEquipmentChannelsService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/INdVehicleEquipmentInfoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/INdVehicleEquipmentInfoService.java new file mode 100644 index 0000000..a4c30cd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/INdVehicleEquipmentInfoService.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.car.equipment.service; + +import com.ningdatech.carapi.car.equipment.model.dto.EquipmentSaveDTO; +import com.ningdatech.carapi.car.equipment.model.dto.EquipmentUpdateDTO; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentInfo; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.equipment.model.res.SipApiResponse; +import com.ningdatech.carapi.car.equipment.model.res.SipEquipmentRes; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdVehicleEquipmentInfoService extends IService { + void save(List equipments, Long uerId); + + void update(EquipmentUpdateDTO equipmentUpdateDTO, Long uerId); + + Boolean removeByIdWithCache(List ids); + + List getSipEquipmentsByCarPlate(String carPlate); + + Boolean insertBatch(List toAddEp); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/INdVehicleEquipmentJoinService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/INdVehicleEquipmentJoinService.java new file mode 100644 index 0000000..1ab38b9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/INdVehicleEquipmentJoinService.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.equipment.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentJoin; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdVehicleEquipmentJoinService extends IService { + + Page pageJoinBaseInfo(Page page, LambdaQueryWrapper wrapper); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/IVehicleEquipmentNoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/IVehicleEquipmentNoService.java new file mode 100644 index 0000000..361628b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/IVehicleEquipmentNoService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.equipment.service; + +import com.ningdatech.carapi.car.equipment.model.VehicleEquipmentNo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2024-02-23 + */ +public interface IVehicleEquipmentNoService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/DataAccessDevicesServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/DataAccessDevicesServiceImpl.java new file mode 100644 index 0000000..e9fafdb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/DataAccessDevicesServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.equipment.service.impl; + +import com.ningdatech.carapi.car.equipment.model.DataAccessDevices; +import com.ningdatech.carapi.car.equipment.mapper.DataAccessDevicesMapper; +import com.ningdatech.carapi.car.equipment.service.IDataAccessDevicesService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-05-17 + */ +@Service +public class DataAccessDevicesServiceImpl extends ServiceImpl implements IDataAccessDevicesService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/NdVehicleEquipmentChannelsServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/NdVehicleEquipmentChannelsServiceImpl.java new file mode 100644 index 0000000..32d9c8f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/NdVehicleEquipmentChannelsServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.equipment.service.impl; + +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentChannels; +import com.ningdatech.carapi.car.equipment.mapper.NdVehicleEquipmentChannelsMapper; +import com.ningdatech.carapi.car.equipment.service.INdVehicleEquipmentChannelsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +public class NdVehicleEquipmentChannelsServiceImpl extends ServiceImpl implements INdVehicleEquipmentChannelsService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/NdVehicleEquipmentInfoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/NdVehicleEquipmentInfoServiceImpl.java new file mode 100644 index 0000000..1fa353f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/NdVehicleEquipmentInfoServiceImpl.java @@ -0,0 +1,185 @@ +package com.ningdatech.carapi.car.equipment.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.http.HttpStatus; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Maps; +import com.ningdatech.basic.exception.BaseUncheckedException; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.exception.code.ExceptionCode; +import com.ningdatech.carapi.car.equipment.model.dto.EquipmentSaveDTO; +import com.ningdatech.carapi.car.equipment.model.dto.EquipmentUpdateDTO; +import com.ningdatech.carapi.car.equipment.model.res.SipApiResponse; +import com.ningdatech.carapi.car.equipment.model.res.SipEquipmentRes; +import com.ningdatech.carapi.car.position.contants.PositionContant; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentChannels; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentInfo; +import com.ningdatech.carapi.archives.enums.AuditStateEnum; +import com.ningdatech.carapi.car.equipment.mapper.NdVehicleEquipmentChannelsMapper; +import com.ningdatech.carapi.car.equipment.mapper.NdVehicleEquipmentInfoMapper; +import com.ningdatech.carapi.car.vehicle.mapper.VehicleBaseInfoMapper; +import com.ningdatech.carapi.car.equipment.service.INdVehicleEquipmentInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.client.RestTemplate; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class NdVehicleEquipmentInfoServiceImpl extends ServiceImpl implements INdVehicleEquipmentInfoService { + + private final NdVehicleEquipmentChannelsMapper equipmentChannelsMapper; + private final VehicleBaseInfoMapper vehicleBaseInfoMapper; + + private final NdVehicleEquipmentInfoMapper equipmentInfoMapper; + + private final RestTemplate restTemplate; + + @Value("${vedio.host}") + private String HOST; + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean removeByIdWithCache(List ids) { + if (ids.isEmpty()) { + return true; + } + // 车辆设备 + boolean removeFlag = removeByIds(ids); + + if(removeFlag){ + ids.forEach(id -> { + //删除通道信息 + equipmentChannelsMapper.delete(Wrappers.lambdaQuery(NdVehicleEquipmentChannels.class) + .eq(NdVehicleEquipmentChannels::getEquipmentId,id)); + }); + } + + return removeFlag; + } + + @Override + public List getSipEquipmentsByCarPlate(String carPlate) { + SipApiResponse res = null; + Map map = Maps.newConcurrentMap(); + map.put(PositionContant.FIELD_CAR_PLATE, carPlate); + map.put(PositionContant.HOST_FEILD, HOST); + res = restTemplate.getForObject(PositionContant.VEHICLE_DEVICE_URL, SipApiResponse.class, map); + log.info("request equipment 【{}】:", JSON.toJSONString(res)); + Integer statusCode = res.getStatus_code(); + if (null == statusCode || 0 != statusCode) { + return Collections.emptyList(); +// throw new BizException(ExceptionCode.BAD_REQUEST.getCode(), res.getMessage()); + } + return res.getResult(); + } + + @Override + public Boolean insertBatch(List toAddEp) { + return equipmentInfoMapper.insertBatch(toAddEp); + } + + + /** + * 保存车辆 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void save(List datas, Long userId) { + if(CollUtil.isEmpty(datas)){ + return; + } + + Long vehicleId = datas.get(0).getVehicleId(); + List equipments = equipmentInfoMapper.selectList(Wrappers.lambdaQuery(NdVehicleEquipmentInfo.class) + .eq(NdVehicleEquipmentInfo::getVehicleId,vehicleId)); + for(NdVehicleEquipmentInfo equipment : equipments){ + //先删除设备和通道信息 + removeById(equipment.getId()); + equipmentChannelsMapper.delete(Wrappers.lambdaQuery(NdVehicleEquipmentChannels.class) + .eq(NdVehicleEquipmentChannels::getEquipmentId,equipment.getId())); + } + + for(EquipmentSaveDTO data : datas){ + if(Objects.isNull(data.getVehicleId())){ + throw new BizException(ExceptionCode.OPERATION_EX.getCode(),String.format("添加车辆id %d 为空",data.getVehicleId())); + } + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoMapper.selectById(data.getVehicleId()); + if(Objects.isNull(vehicleBaseInfo)){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK,String.format("车辆不存在",data.getVehicleId())); + } + if(!AuditStateEnum.AUDIT_SUCCESS.getCode().equals(vehicleBaseInfo.getAuditState())){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK,String.format("车辆审核成功才能添加设备",data.getVehicleId())); + } + + NdVehicleEquipmentInfo equipmentInfo = BeanUtil.toBean(data, NdVehicleEquipmentInfo.class); + equipmentInfo.setCarPlate(vehicleBaseInfo.getCarPlate()); + //创建人 最后修改人 + equipmentInfo.setCreateBy(userId); + equipmentInfo.setUpdateBy(userId); + save(equipmentInfo); + + if(CollUtil.isNotEmpty(data.getChannels())){ + data.getChannels().forEach(channel ->{ + NdVehicleEquipmentChannels equipmentChannel = BeanUtil.toBean(channel, NdVehicleEquipmentChannels.class); + equipmentChannel.setEquipmentId(equipmentInfo.getId()); + equipmentChannel.setCreateBy(userId); + equipmentChannel.setUpdateBy(userId); + equipmentChannelsMapper.insert(equipmentChannel); + }); + } + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(EquipmentUpdateDTO data, Long userId) { + NdVehicleEquipmentInfo equipmentInfo = getById(data.getId()); + if (Objects.isNull(equipmentInfo)) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK, String.format("修改车辆设备%d 为空", data.getId())); + } + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoMapper.selectById(data.getVehicleId()); + if (Objects.isNull(vehicleBaseInfo)) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK, String.format("车辆不存在", data.getVehicleId())); + } + if (!AuditStateEnum.AUDIT_SUCCESS.getCode().equals(vehicleBaseInfo.getAuditState())) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK, String.format("车辆审核成功才能修改设备", data.getVehicleId())); + } + NdVehicleEquipmentInfo equipment = BeanUtil.toBean(data, NdVehicleEquipmentInfo.class); + //最后修改人 + equipment.setUpdateBy(userId); + updateById(equipment); + + if (CollUtil.isNotEmpty(data.getChannels())) { + //先删除通道信息 + equipmentChannelsMapper.delete(Wrappers.lambdaQuery(NdVehicleEquipmentChannels.class) + .eq(NdVehicleEquipmentChannels::getEquipmentId, equipmentInfo.getId())); + data.getChannels().forEach(channel -> { + channel.setEquipmentId(equipmentInfo.getId()); + channel.setCreateBy(userId); + channel.setUpdateBy(userId); + equipmentChannelsMapper.insert(channel); + }); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/NdVehicleEquipmentJoinServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/NdVehicleEquipmentJoinServiceImpl.java new file mode 100644 index 0000000..03883ad --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/NdVehicleEquipmentJoinServiceImpl.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.car.equipment.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentJoin; +import com.ningdatech.carapi.car.equipment.mapper.NdVehicleEquipmentJoinMapper; +import com.ningdatech.carapi.car.equipment.service.INdVehicleEquipmentJoinService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class NdVehicleEquipmentJoinServiceImpl extends ServiceImpl implements INdVehicleEquipmentJoinService { + + private final NdVehicleEquipmentJoinMapper vehicleEquipmentJoinMapper; + + @Override + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL,wrapperIndex = 1) + public Page pageJoinBaseInfo(Page page, LambdaQueryWrapper wrapper) { + return vehicleEquipmentJoinMapper.pageJoinBaseInfo(page,wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/VehicleEquipmentNoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/VehicleEquipmentNoServiceImpl.java new file mode 100644 index 0000000..bbb9921 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/equipment/service/impl/VehicleEquipmentNoServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.equipment.service.impl; + +import com.ningdatech.carapi.car.equipment.model.VehicleEquipmentNo; +import com.ningdatech.carapi.car.equipment.mapper.VehicleEquipmentNoMapper; +import com.ningdatech.carapi.car.equipment.service.IVehicleEquipmentNoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2024-02-23 + */ +@Service +public class VehicleEquipmentNoServiceImpl extends ServiceImpl implements IVehicleEquipmentNoService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/controller/StatusMonitorController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/controller/StatusMonitorController.java new file mode 100644 index 0000000..da748b7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/controller/StatusMonitorController.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.car.monitor.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.car.monitor.manage.StatusMonitorManage; +import com.ningdatech.carapi.car.monitor.model.dto.LoadMonitorPageParamDTO; +import com.ningdatech.carapi.car.monitor.model.dto.SecurityMonitorPageParamDTO; +import com.ningdatech.carapi.car.monitor.model.vo.AlarmDataLoadVO; +import com.ningdatech.carapi.car.monitor.model.vo.SecurityMonitorVO; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.sys.entity.dto.CascadeCodeDTO; +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 javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; + +/** + * @Classname SecurityMonitorController + * @Description + * @Date 2022/11/4 16:30 + * @Created by PoffyZhang + */ +@RestController +@RequestMapping(value = "/api/v1/car-manage/status-monitor") +@Api(tags = "车辆管理-状态监控") +@Validated +@RequiredArgsConstructor +public class StatusMonitorController { + + private final StatusMonitorManage statusMonitorManage; + + @ApiOperation("安全监控") + @GetMapping("/security-monitor-list") + public PageVo securityMonitorList( + @Valid @ModelAttribute SecurityMonitorPageParamDTO param) { + return statusMonitorManage.securityMonitorList(param); + } + + @ApiOperation("告警事件类型列表") + @GetMapping("/alarm-types") + public List alarmTypes() { + return statusMonitorManage.alarmTypes(); + } + + @ApiOperation("载重监控") + @GetMapping("/load-monitor-list") + public PageVo loadMonitorList( + @Valid @ModelAttribute LoadMonitorPageParamDTO param) { + return statusMonitorManage.loadMonitorList(param); + } + + @ApiOperation(value = "安全监控导出", notes = "安全监控导出") + @GetMapping("/export-security-monitor") + @WebLog + public void exportSecurityMonitor(SecurityMonitorPageParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, statusMonitorManage::exportSecurityMonitor); + } + + @ApiOperation(value = "载重监控导出", notes = "载重监控导出") + @GetMapping("/export-load-monitor") + @WebLog + public void exportLoadMonitor(LoadMonitorPageParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, statusMonitorManage::exportLoadMonitor); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/AlarmDataLoad.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/AlarmDataLoad.java new file mode 100644 index 0000000..460deb4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/AlarmDataLoad.java @@ -0,0 +1,75 @@ +package com.ningdatech.carapi.car.monitor.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 com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 异常告警 载重 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@TableName("nd_alarm_data_load") +@ApiModel(value = "AlarmDataLoad对象", description = "异常告警 载重") +@Data +public class AlarmDataLoad extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车牌号") + private String plateNo; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("区域id") + private String regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("告警事件ID") + private String alarmId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车辆自重 吨") + private Double kerbWeight; + + @ApiModelProperty("告警时间") + private LocalDateTime alarmTime; + + @ApiModelProperty("标准吨位") + private Double standardTonnage; + + @ApiModelProperty("运营商名字") + private String operatorName; + + @ApiModelProperty("运量 吨") + private Double freightVolume; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/DataAccessAlarmWarn.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/DataAccessAlarmWarn.java new file mode 100644 index 0000000..ea4baac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/DataAccessAlarmWarn.java @@ -0,0 +1,94 @@ +package com.ningdatech.carapi.car.monitor.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 报警预警表 + *

+ * + * @author PoffyZhang + * @since 2022-12-06 + */ +@TableName("nd_data_access_alarm_warn") +@ApiModel(value = "DataAccessAlarmWarn对象", description = "报警预警表") +@Data +public class DataAccessAlarmWarn implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("发起报警平台的唯一编号") + private String platformId; + + @ApiModelProperty("报警类型,详情参考jtt809-809表3-4") + private Integer warnType; + + @ApiModelProperty("报警时间") + private LocalDateTime warnTime; + + @ApiModelProperty("事件开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("事件结束时间") + private LocalDateTime endTime; + + @ApiModelProperty("车牌号码") + private String vehicleNo; + + @ApiModelProperty("车牌颜色") + private Integer vehicleColor; + + @ApiModelProperty("被报警平台的唯一编号") + private String platformId1; + + @ApiModelProperty("线路ID") + private String drvLineId; + + @ApiModelProperty("报警预警内容") + private String content; + + @ApiModelProperty("是否是主动上报 0:下发 1:主动上报") + private Boolean isActiveReport; + + @ApiModelProperty("发起报警的序列号 (可能分为开始结束)") + private Integer msgSeq; + + @ApiModelProperty("处理结果") + private Integer resultCode; + + @ApiModelProperty("报警唯一序号") + private Long alarmMsgSn; + + @ApiModelProperty("0: 瞬时报警; 1:报警开始; 2: 报警结束 ") + private Integer eventStatus; + + @ApiModelProperty("0: 无文件 1: 有文件等待下发 2:已下发 3:已上报 ") + private Boolean fileReport; + + @ApiModelProperty("平台id") + private Long gnssCenterId; + + @ApiModelProperty("告警类型") + private Integer bgType; + + @ApiModelProperty("告警级别") + private Integer grade; + + @ApiModelProperty("速度") + private Integer speed; + + @ApiModelProperty("告警地点") + private String address; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/DataAccessAlarmWarnFile.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/DataAccessAlarmWarnFile.java new file mode 100644 index 0000000..f6286dd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/DataAccessAlarmWarnFile.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.car.monitor.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; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-12-06 + */ +@TableName("nd_data_access_alarm_warn_file") +@ApiModel(value = "DataAccessAlarmWarnFile对象", description = "") +@Data +public class DataAccessAlarmWarnFile implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + private Long alarmMsgSn; + + private Integer fileType; + + private Integer fileFormat; + + private String filePath; + + private String srcPath; + + private Long gnssCenterId; + + private LocalDateTime createTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/SecurityMonitorJoin.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/SecurityMonitorJoin.java new file mode 100644 index 0000000..08a69a2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/SecurityMonitorJoin.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.car.monitor.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Classname SecurityMonitorJoin + * @Description + * @Date 2022/11/6 20:59 + * @Created by PoffyZhang + */ +@Data +public class SecurityMonitorJoin implements Serializable { + @ApiModelProperty("告警事件id") + private Long alarmId; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("事件类型") + private String alarmType; + + @ApiModelProperty("告警时间") + private String alarmTime; + + @ApiModelProperty("地址") + private String alarmAddress; + + @ApiModelProperty("图片链接") + private String pictureUrl; + + @ApiModelProperty("视频链接") + private String videoUrl; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/VehicleSecurityMonitor.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/VehicleSecurityMonitor.java new file mode 100644 index 0000000..d24e102 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/entity/VehicleSecurityMonitor.java @@ -0,0 +1,95 @@ +package com.ningdatech.carapi.car.monitor.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 车辆安全监控 + *

+ * + * @author PoffyZhang + * @since 2022-12-07 + */ +@TableName("nd_vehicle_security_monitor") +@ApiModel(value = "VehicleSecurityMonitor对象", description = "车辆安全监控") +@Data +public class VehicleSecurityMonitor 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; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("告警事件id") + private Long alarmId; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("公司名") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("告警类型") + private Integer alarmType; + + @ApiModelProperty("告警类型名") + private String alarmTypeName; + + @ApiModelProperty("告警时间") + private LocalDateTime alarmTime; + + @ApiModelProperty("告警地址") + private String alarmAddress; + + @ApiModelProperty("图片地址") + private String pictureUrl; + + @ApiModelProperty("视频地址") + private String videoUrl; + + @ApiModelProperty("级别") + private Integer alarmLevel; + + private Long operatorId; + private BigDecimal speed; + + private BigDecimal longitude; + private BigDecimal latitude; + private Integer deleted; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/manage/StatusMonitorManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/manage/StatusMonitorManage.java new file mode 100644 index 0000000..b173a8e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/manage/StatusMonitorManage.java @@ -0,0 +1,186 @@ +package com.ningdatech.carapi.car.monitor.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.excel.EasyExcel; +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.basic.util.CollUtils; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.car.monitor.entity.AlarmDataLoad; +import com.ningdatech.carapi.car.monitor.entity.VehicleSecurityMonitor; +import com.ningdatech.carapi.car.monitor.model.dto.AlarmDataLoadDTO; +import com.ningdatech.carapi.car.monitor.model.dto.LoadMonitorPageParamDTO; +import com.ningdatech.carapi.car.monitor.model.dto.SecurityMonitorExportDTO; +import com.ningdatech.carapi.car.monitor.model.dto.SecurityMonitorPageParamDTO; +import com.ningdatech.carapi.car.monitor.model.vo.AlarmDataLoadVO; +import com.ningdatech.carapi.car.monitor.model.vo.SecurityMonitorVO; +import com.ningdatech.carapi.car.monitor.service.IAlarmDataLoadService; +import com.ningdatech.carapi.car.monitor.service.IVehicleSecurityMonitorService; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.BgTypeEnum; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.sys.entity.dto.CascadeCodeDTO; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname StatusMonitorManage + * @Description + * @Date 2022/11/4 16:30 + * @Created by PoffyZhang + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class StatusMonitorManage { + + private final IAlarmDataLoadService alarmDataLoadService; + private final IVehicleSecurityMonitorService vehicleSecurityMonitorService; + private final RegionsCacheHelper regionsCacheHelper; + + public PageVo securityMonitorList(SecurityMonitorPageParamDTO param) { + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(VehicleSecurityMonitor.class); + wrapper.in(VehicleSecurityMonitor::getAlarmType, BgTypeEnum.listCode(false)); + ((StatusMonitorManage) AopContext.currentProxy()).searchSecurityMonitor(page, wrapper, param); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List data = CollUtils.convert(page.getRecords(), this::convert); + return PageVo.of(data, page.getTotal()); + } + + public PageVo loadMonitorList(LoadMonitorPageParamDTO param) { + Page page = param.page(); + searchLoad(page, param); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List data = CollUtils.convert(page.getRecords(), this::convertLoad); + return PageVo.of(data, page.getTotal()); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2, wrapperIndex = 1) + public void searchSecurityMonitor(Page page, LambdaQueryWrapper wrapper + , SecurityMonitorPageParamDTO param) { + wrapper.like(StringUtils.isNotBlank(param.getCarPlate()), VehicleSecurityMonitor::getCarPlate, param.getCarPlate()) + .eq(Objects.nonNull(param.getVehicleType()), VehicleSecurityMonitor::getVehicleType, param.getVehicleType()) + .ge(Objects.nonNull(param.getStartTime()), VehicleSecurityMonitor::getAlarmTime, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), VehicleSecurityMonitor::getAlarmTime, param.getEndTime()) + .eq(Objects.nonNull(param.getAlarmType()), VehicleSecurityMonitor::getAlarmType, param.getAlarmType()) + .orderBy(Boolean.TRUE, Boolean.FALSE, VehicleSecurityMonitor::getAlarmTime); + vehicleSecurityMonitorService.page(page, wrapper); + } + + private void searchLoad(Page page, LoadMonitorPageParamDTO param) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(AlarmDataLoad.class); + StatusMonitorManage clazz = (StatusMonitorManage) AopContext.currentProxy(); + clazz.searchLoadWrapper(page, wrapper, param); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2, wrapperIndex = 1) + public void searchLoadWrapper(Page page, LambdaQueryWrapper wrapper, LoadMonitorPageParamDTO param) { + wrapper.like(StringUtils.isNotBlank(param.getPlateNo()), AlarmDataLoad::getPlateNo, param.getPlateNo()) + .ge(Objects.nonNull(param.getStartTime()), AlarmDataLoad::getAlarmTime, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), AlarmDataLoad::getAlarmTime, param.getEndTime()) + .orderBy(Boolean.TRUE, Boolean.FALSE, AlarmDataLoad::getAlarmTime); + alarmDataLoadService.page(page, wrapper); + } + + private SecurityMonitorVO convert(VehicleSecurityMonitor securityMonitor) { + if (Objects.isNull(securityMonitor)) { + return null; + } + SecurityMonitorVO vo = BeanUtil.copyProperties(securityMonitor, SecurityMonitorVO.class); + if (StrUtil.startWith(vo.getPictureUrl(), StrPool.HTTP)) { + vo.setPictureUrl(null); + } + if (StrUtil.startWith(vo.getVideoUrl(), StrPool.HTTP)) { + vo.setVideoUrl(null); + } + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + } + + private AlarmDataLoadVO convertLoad(AlarmDataLoad data) { + if (Objects.isNull(data)) { + return null; + } + AlarmDataLoadVO vo = BeanUtil.copyProperties(data, AlarmDataLoadVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + } + + public List alarmTypes() { + return Arrays.stream(BgTypeEnum.values()) + .filter(w -> !w.getHidden()) + .map(w -> CascadeCodeDTO.of(String.valueOf(w.getCode()), w.getDesc())) + .collect(Collectors.toList()); + } + + public void exportSecurityMonitor(HttpServletResponse response, SecurityMonitorPageParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = securityMonitorList(param); + List collect = page.getRecords().stream() + .map(w -> { + SecurityMonitorExportDTO monitorExportDTO = new SecurityMonitorExportDTO(); + BeanUtils.copyProperties(w, monitorExportDTO); + String timeStr = NdDateUtils.format(w.getAlarmTime(), NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + monitorExportDTO.setAlarmTime(timeStr); + return monitorExportDTO; + }) + .collect(Collectors.toList()); + String fileName = "状态监控列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), SecurityMonitorExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void exportLoadMonitor(HttpServletResponse response, LoadMonitorPageParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = loadMonitorList(param); + List collect = page.getRecords().stream().map(w -> BeanUtil.copyProperties(w, AlarmDataLoadVO.class)).collect(Collectors.toList()); + String fileName = "载重监控列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), AlarmDataLoadDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/AlarmDataLoadMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/AlarmDataLoadMapper.java new file mode 100644 index 0000000..da76236 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/AlarmDataLoadMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.monitor.mapper; + +import com.ningdatech.carapi.car.monitor.entity.AlarmDataLoad; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 异常告警 载重 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +public interface AlarmDataLoadMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/AlarmDataLoadMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/AlarmDataLoadMapper.xml new file mode 100644 index 0000000..83f6e2d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/AlarmDataLoadMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/DataAccessAlarmWarnFileMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/DataAccessAlarmWarnFileMapper.java new file mode 100644 index 0000000..01306bb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/DataAccessAlarmWarnFileMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.monitor.mapper; + +import com.ningdatech.carapi.car.monitor.entity.DataAccessAlarmWarnFile; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-12-06 + */ +public interface DataAccessAlarmWarnFileMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/DataAccessAlarmWarnFileMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/DataAccessAlarmWarnFileMapper.xml new file mode 100644 index 0000000..8759bb4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/DataAccessAlarmWarnFileMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/DataAccessAlarmWarnMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/DataAccessAlarmWarnMapper.java new file mode 100644 index 0000000..d784cb7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/DataAccessAlarmWarnMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.monitor.mapper; + +import com.ningdatech.carapi.car.monitor.entity.DataAccessAlarmWarn; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 报警预警表 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-12-06 + */ +public interface DataAccessAlarmWarnMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/DataAccessAlarmWarnMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/DataAccessAlarmWarnMapper.xml new file mode 100644 index 0000000..6d28eef --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/DataAccessAlarmWarnMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/SecurityMonitorJoinMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/SecurityMonitorJoinMapper.java new file mode 100644 index 0000000..800756f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/SecurityMonitorJoinMapper.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.car.monitor.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.monitor.entity.SecurityMonitorJoin; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-08 + */ +public interface SecurityMonitorJoinMapper extends BaseMapper { + + String QUERY_SQL = "SELECT " + + " (case when p.alarm_id is not null then p.alarm_id else v.alarm_id end) alarm_id, " + + " (case when p.plate_no is not null then p.plate_no else v.plate_no end) car_plate, " + + " c.name company_name,c.region_id,b.vehicle_type, " + + " (case when p.alarm_type is not null then p.alarm_type else v.alarm_type end) alarm_type, " + + " (case when p.capture_time is not null then p.capture_time else v.alarm_time end) alarm_time," + + " (case when p.region_name is not null then p.region_name else v.region_name end) alarm_address, " + + " p.url picture_url,v.url video_url " + + " from nd_vehicle_base_info b " + + " left join nd_company_info c on b.company_id = c.id " + + " right join nd_alarm_data_picture p on b.car_plate = p.plate_no " + + " right join nd_alarm_data_video v on p.alarm_id = v.alarm_id " + + " group by " + + " (case when p.alarm_id is not null then p.alarm_id else v.alarm_id end), " + + " (case when p.plate_no is not null then p.plate_no else v.plate_no end), " + + " c.name,c.region_id,b.vehicle_type, " + + " (case when p.alarm_type is not null then p.alarm_type else v.alarm_type end), " + + " (case when p.capture_time is not null then p.capture_time else v.alarm_time end), " + + " (case when p.region_name is not null then p.region_name else v.region_name end),p.url,v.url "; + String WRAPPER_SQL = "SELECT * from ( " + QUERY_SQL + " ) AS q ${ew.customSqlSegment}"; + + @Select(WRAPPER_SQL) + Page pageJoin(Page page, @Param("ew") LambdaQueryWrapper wrapper); + + @Select(WRAPPER_SQL) + SecurityMonitorJoin getOneJoin(@Param("ew") LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/VehicleSecurityMonitorMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/VehicleSecurityMonitorMapper.java new file mode 100644 index 0000000..d9ce918 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/VehicleSecurityMonitorMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.monitor.mapper; + +import com.ningdatech.carapi.car.monitor.entity.VehicleSecurityMonitor; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 车辆安全监控 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-12-07 + */ +public interface VehicleSecurityMonitorMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/VehicleSecurityMonitorMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/VehicleSecurityMonitorMapper.xml new file mode 100644 index 0000000..d612553 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mapper/VehicleSecurityMonitorMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/dto/AlarmDataLoadDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/dto/AlarmDataLoadDTO.java new file mode 100644 index 0000000..bc643c2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/dto/AlarmDataLoadDTO.java @@ -0,0 +1,86 @@ +package com.ningdatech.carapi.car.monitor.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 异常告警 载重 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@ApiModel(value = "AlarmDataLoadDTO", description = "异常告警 载重") +@Data +public class AlarmDataLoadDTO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @ExcelProperty("ID") + private Long id; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("车辆类型") + @ExcelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String plateNo; + + @ApiModelProperty("车辆类型名") + @ExcelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("区域id") + @ExcelProperty("区域id") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("告警事件ID") + @ExcelProperty("告警事件ID") + private String alarmId; + + @ApiModelProperty("企业ID") + @ExcelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("车辆自重 吨") + @ExcelProperty("车辆自重 吨") + private Double kerbWeight; + + @ApiModelProperty("告警时间") + @ExcelProperty("告警时间") + private LocalDateTime alarmTime; + + @ApiModelProperty("标准吨位") + @ExcelProperty("标准吨位") + private Double standardTonnage; + + @ApiModelProperty("运营商名字") + @ExcelProperty("运营商名字") + private String operatorName; + + @ApiModelProperty("运量 吨") + @ExcelProperty("运量 吨") + private Double freightVolume; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/dto/LoadMonitorPageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/dto/LoadMonitorPageParamDTO.java new file mode 100644 index 0000000..9310a67 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/dto/LoadMonitorPageParamDTO.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.car.monitor.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author PoffyZhang + * @date 2022/11/07 下午2:10 + */ + +@Data +@ApiModel(description = "载重监控分页PARAM DTO") +public class LoadMonitorPageParamDTO extends PagePo implements Serializable { + + @ApiModelProperty("车牌号") + private String plateNo; + + @ApiModelProperty("开始时间") + private String startTime; + + @ApiModelProperty("结束时间") + private String endTime; + + @ApiModelProperty("区域ID") + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/dto/SecurityMonitorExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/dto/SecurityMonitorExportDTO.java new file mode 100644 index 0000000..b2d2767 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/dto/SecurityMonitorExportDTO.java @@ -0,0 +1,50 @@ +package com.ningdatech.carapi.car.monitor.model.dto; + +import java.io.Serializable; +import java.math.BigDecimal; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.Data; +import lombok.RequiredArgsConstructor; + +/** + * @Classname SecurityMonitorExportDTO + * @Description + * @Date 2022/11/6 20:59 + * @Created by PoffyZhang + */ +@RequiredArgsConstructor +@Data +public class SecurityMonitorExportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ExcelProperty("车牌号") + private String carPlate; + + @ExcelProperty("车辆类型") + private String vehicleTypeName; + + @ExcelProperty("所属企业") + private String companyName; + + @ExcelProperty("所属区域") + private String regionName; + + @ExcelProperty("报警类型") + private String alarmTypeName; + + @ExcelProperty("报警级别") + private String alarmLevelName; + + @ExcelProperty("速度") + private BigDecimal speed; + + @ExcelProperty("报警时间") + private String alarmTime; + + @ExcelProperty("地址") + private String alarmAddress; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/dto/SecurityMonitorPageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/dto/SecurityMonitorPageParamDTO.java new file mode 100644 index 0000000..5c60d62 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/dto/SecurityMonitorPageParamDTO.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.car.monitor.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author PoffyZhang + * @date 2022/11/03 下午2:10 + */ + +@Data +@ApiModel(description = "安全监控分页PARAM DTO") +public class SecurityMonitorPageParamDTO extends PagePo implements Serializable { + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("开始时间") + private String startTime; + + @ApiModelProperty("结束时间") + private String endTime; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("事件报警类型ID") + private String alarmType; + + @ApiModelProperty("车辆类型ID") + private Long vehicleType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/vo/AlarmDataLoadVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/vo/AlarmDataLoadVO.java new file mode 100644 index 0000000..396470a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/vo/AlarmDataLoadVO.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.car.monitor.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 异常告警 载重 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@ApiModel(value = "AlarmDataLoad对象", description = "异常告警 载重") +@Data +public class AlarmDataLoadVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车牌号") + private String plateNo; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("告警事件ID") + private String alarmId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车辆自重 吨") + private Double kerbWeight; + + @ApiModelProperty("告警时间") + private LocalDateTime alarmTime; + + @ApiModelProperty("标准吨位") + private Double standardTonnage; + + @ApiModelProperty("运营商名字") + private String operatorName; + + @ApiModelProperty("运量 吨") + private Double freightVolume; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/vo/SecurityMonitorVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/vo/SecurityMonitorVO.java new file mode 100644 index 0000000..7e0c35b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/model/vo/SecurityMonitorVO.java @@ -0,0 +1,106 @@ +package com.ningdatech.carapi.car.monitor.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Objects; +import java.util.Optional; + +import org.apache.commons.lang3.StringUtils; + +import com.ningdatech.carapi.common.constant.AlarmLevelEnum; +import com.ningdatech.carapi.common.constant.BgTypeEnum; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.RequiredArgsConstructor; + +/** + * @Classname SecurityMonitorVO + * @Description + * @Date 2022/11/6 20:59 + * @Created by PoffyZhang + */ +@RequiredArgsConstructor +@Data +public class SecurityMonitorVO implements Serializable { + + @ApiModelProperty("告警事件id") + private Long alarmId; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("事件类型") + private Integer alarmType; + + @ApiModelProperty("事件类型名") + private String alarmTypeName; + + @ApiModelProperty("告警时间") + private LocalDateTime alarmTime; + + @ApiModelProperty("地址") + private String alarmAddress; + + @ApiModelProperty("图片链接") + private String pictureUrl; + + @ApiModelProperty("视频链接") + private String videoUrl; + + @ApiModelProperty("级别") + private Integer alarmLevel; + + @ApiModelProperty("速度") + private BigDecimal speed; + + @ApiModelProperty("级别名") + private String alarmLevelName; + + public String getVehicleTypeName(){ + if(Objects.nonNull(this.vehicleType)){ + Optional.ofNullable(VehicleTypeEnum.getDescByCode(vehicleType)).ifPresent(v -> + this.vehicleTypeName = v); + return this.vehicleTypeName; + } + return StringUtils.EMPTY; + } + + public String getAlarmTypeName(){ + if(Objects.nonNull(this.alarmType)){ + Optional.ofNullable(BgTypeEnum.getDescByCode(alarmType)).ifPresent(a -> + this.alarmTypeName = a); + return this.alarmTypeName; + } + return StringUtils.EMPTY; + } + + public String getAlarmLevelName(){ + if(Objects.nonNull(this.alarmLevel)){ + Optional.ofNullable(AlarmLevelEnum.getDescByCode(alarmLevel)).ifPresent(a -> + this.alarmLevelName = a); + return this.alarmLevelName; + } + return StringUtils.EMPTY; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mqtt/MqttReceiveConfig.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mqtt/MqttReceiveConfig.java new file mode 100644 index 0000000..3165690 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/mqtt/MqttReceiveConfig.java @@ -0,0 +1,93 @@ +package com.ningdatech.carapi.car.monitor.mqtt; + + +import lombok.extern.slf4j.Slf4j; +import org.eclipse.paho.client.mqttv3.MqttConnectOptions; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.integration.annotation.ServiceActivator; +import org.springframework.integration.channel.DirectChannel; +import org.springframework.integration.core.MessageProducer; +import org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory; +import org.springframework.integration.mqtt.core.MqttPahoClientFactory; +import org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter; +import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter; +import org.springframework.messaging.MessageChannel; +import org.springframework.messaging.MessageHandler; +import org.springframework.messaging.MessagingException; +import org.springframework.scheduling.concurrent.ConcurrentTaskScheduler; + +@Configuration +//@IntegrationComponentScan +@Slf4j +public class MqttReceiveConfig { + + @Value("${spring.mqtt.username}") + private String username; + + @Value("${spring.mqtt.password}") + private String password; + + @Value("${spring.mqtt.url}") + private String hostUrl; + + @Value("${spring.mqtt.clientid}") + private String clientId; + + @Value("${spring.mqtt.default_topic}") + private String defaultTopic; + + @Value("${spring.mqtt.completionTimeout}") + private int completionTimeout; //连接超时 + +// @Bean + public MqttPahoClientFactory mqttClientFactory() { + DefaultMqttPahoClientFactory factory = new DefaultMqttPahoClientFactory(); + MqttConnectOptions mqttConnectOptions = new MqttConnectOptions(); + mqttConnectOptions.setUserName(username); + mqttConnectOptions.setPassword(password.toCharArray()); + // 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录, + // 把配置里的 cleanSession 设为false,客户端掉线后 服务器端不会清除session, + // 当重连后可以接收之前订阅主题的消息。当客户端上线后会接受到它离线的这段时间的消息 + mqttConnectOptions.setCleanSession(false); + mqttConnectOptions.setServerURIs(new String[]{hostUrl}); + // 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制 + mqttConnectOptions.setKeepAliveInterval(20); + factory.setConnectionOptions(mqttConnectOptions); + return factory; + } + + //接收通道 +// @Bean + public MessageChannel mqttInputChannel() { + return new DirectChannel(); + } + +// @Bean + public MessageProducer inbound() { + MqttPahoMessageDrivenChannelAdapter adapter = + new MqttPahoMessageDrivenChannelAdapter(clientId, mqttClientFactory(), defaultTopic); + adapter.setCompletionTimeout(completionTimeout); + adapter.setConverter(new DefaultPahoMessageConverter()); + adapter.setQos(1); + adapter.setOutputChannel(mqttInputChannel()); + adapter.setTaskScheduler(new ConcurrentTaskScheduler()); + log.info("adapter ==> " + adapter); + return adapter; + } + + //通过通道获取数据 +// @Bean + @ServiceActivator(inputChannel = "mqttInputChannel") + public MessageHandler handler() { + return message -> { + try { + String string = message.getPayload().toString(); + String res = "{\"method\":\"OnEventNotify\",\"params\":{\"ability\":\"event_msa_alarm\",\"events\":[{\"data\":{\"alarmId\":\"35323136353734221026091604000200\",\"alarmInfo\":\"{\\\"BSDRightRearWarn\\\":[{\\\"accelerateMaxValue\\\":0,\\\"accelerateValue\\\":0,\\\"alarmAttachMent\\\":{\\\"audioChans\\\":\\\"\\\",\\\"audioNum\\\":0,\\\"othersNum\\\":0,\\\"picChans\\\":\\\"\\\",\\\"picNum\\\":0,\\\"res\\\":\\\"\\\",\\\"serverType\\\":0,\\\"totalNum\\\":2,\\\"videoChans\\\":\\\"\\\",\\\"videoNum\\\":0},\\\"alarmID\\\":\\\"35323136353734221026091604000200\\\",\\\"alarmMaxValue\\\":0,\\\"alarmSeq\\\":0,\\\"alarmType\\\":0,\\\"alarmValue\\\":0,\\\"angularMaxValue\\\":0,\\\"angularValue\\\":0,\\\"fatigueValue\\\":0,\\\"frontCarDistance\\\":0,\\\"frontCarSpeed\\\":0,\\\"identifiData\\\":0.0,\\\"logicalChannel\\\":0,\\\"publicData\\\":{\\\"driverCertificatesID\\\":\\\"\\\",\\\"durationTime\\\":0,\\\"gps\\\":{\\\"altitude\\\":\\\"4000\\\",\\\"direction\\\":\\\"0\\\",\\\"directionEW\\\":\\\"E\\\",\\\"directionNS\\\":\\\"N\\\",\\\"latitude\\\":\\\"10984327\\\",\\\"longitude\\\":\\\"43253100\\\",\\\"speed\\\":\\\"0\\\"},\\\"vehicleStatus\\\":4097},\\\"similarity\\\":0,\\\"similarityMax\\\":0,\\\"targetAttrs\\\":{\\\"cameraIndexCode\\\":\\\"6f6e67980cf842a4b8fba5aa9dc68d18\\\",\\\"cameraType\\\":\\\"CZ\\\",\\\"deviceIndexCode\\\":\\\"049704746b384849b7cc8ffad89dbdda\\\"}}],\\\"channelID\\\":1,\\\"dateTime\\\":\\\"2022-10-26T09:16:04.000+08:00\\\",\\\"eventDescription\\\":\\\"BSDRightRearWarn\\\",\\\"eventType\\\":\\\"BSDRightRearWarn\\\",\\\"ipAddress\\\":\\\"36.113.97.203\\\",\\\"portNo\\\":22592}\",\"alarmTime\":\"2022-10-26 09:16:04\",\"deviceIndexCode\":\"049704746b384849b7cc8ffad89dbdda\",\"direction\":0,\"driverIndexCode\":\"\",\"driverNo\":\"\",\"eventId\":\"30FD188342653C44B9ABA7F2DA19A65\",\"eventType\":132385,\"height\":4000,\"latitude\":10984327,\"level\":\"m\",\"longitude\":43253100,\"picNum\":0,\"sourceType\":0,\"speed\":0,\"status\":0,\"vehicleIndexCode\":\"549b8b8a734a497596d43ab6f6d88241\",\"videoNum\":0},\"eventId\":\"30FD188342653C44B9ABA7F2DA19A65\",\"eventType\":5201154049,\"happenTime\":\"2022-10-26 09:17:07\",\"srcIndex\":\"549b8b8a734a497596d43ab6f6d88241\",\"srcType\":\"vehicle\",\"status\":0,\"timeout\":0}],\"sendTime\":\"2022-10-26 09:17:07\"}}\n"; + log.info("接收到消息:" + string); + } catch (MessagingException e) { + e.printStackTrace(); + } + }; + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/IAlarmDataLoadService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/IAlarmDataLoadService.java new file mode 100644 index 0000000..508833b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/IAlarmDataLoadService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.monitor.service; + +import com.ningdatech.carapi.car.monitor.entity.AlarmDataLoad; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 异常告警 载重 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +public interface IAlarmDataLoadService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/IDataAccessAlarmWarnFileService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/IDataAccessAlarmWarnFileService.java new file mode 100644 index 0000000..6e84f9e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/IDataAccessAlarmWarnFileService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.monitor.service; + +import com.ningdatech.carapi.car.monitor.entity.DataAccessAlarmWarnFile; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-12-06 + */ +public interface IDataAccessAlarmWarnFileService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/IDataAccessAlarmWarnService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/IDataAccessAlarmWarnService.java new file mode 100644 index 0000000..e6e173b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/IDataAccessAlarmWarnService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.monitor.service; + +import com.ningdatech.carapi.car.monitor.entity.DataAccessAlarmWarn; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 报警预警表 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-12-06 + */ +public interface IDataAccessAlarmWarnService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/IVehicleSecurityMonitorService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/IVehicleSecurityMonitorService.java new file mode 100644 index 0000000..ad9ad12 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/IVehicleSecurityMonitorService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.monitor.service; + +import com.ningdatech.carapi.car.monitor.entity.VehicleSecurityMonitor; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 车辆安全监控 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-12-07 + */ +public interface IVehicleSecurityMonitorService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/SecurityMonitorService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/SecurityMonitorService.java new file mode 100644 index 0000000..ccd8ca6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/SecurityMonitorService.java @@ -0,0 +1,13 @@ +package com.ningdatech.carapi.car.monitor.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.monitor.entity.SecurityMonitorJoin; + +public interface SecurityMonitorService extends IService { + + Page pageJoin(Page page, LambdaQueryWrapper wrapper); + + SecurityMonitorJoin getOneJoin(LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/AlarmDataLoadServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/AlarmDataLoadServiceImpl.java new file mode 100644 index 0000000..32967a3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/AlarmDataLoadServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.monitor.service.impl; + +import com.ningdatech.carapi.car.monitor.entity.AlarmDataLoad; +import com.ningdatech.carapi.car.monitor.mapper.AlarmDataLoadMapper; +import com.ningdatech.carapi.car.monitor.service.IAlarmDataLoadService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 异常告警 载重 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Service +public class AlarmDataLoadServiceImpl extends ServiceImpl implements IAlarmDataLoadService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/DataAccessAlarmWarnFileServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/DataAccessAlarmWarnFileServiceImpl.java new file mode 100644 index 0000000..f5a8c33 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/DataAccessAlarmWarnFileServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.monitor.service.impl; + +import com.ningdatech.carapi.car.monitor.entity.DataAccessAlarmWarnFile; +import com.ningdatech.carapi.car.monitor.mapper.DataAccessAlarmWarnFileMapper; +import com.ningdatech.carapi.car.monitor.service.IDataAccessAlarmWarnFileService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-12-06 + */ +@Service +public class DataAccessAlarmWarnFileServiceImpl extends ServiceImpl implements IDataAccessAlarmWarnFileService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/DataAccessAlarmWarnServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/DataAccessAlarmWarnServiceImpl.java new file mode 100644 index 0000000..77a1f40 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/DataAccessAlarmWarnServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.monitor.service.impl; + +import com.ningdatech.carapi.car.monitor.entity.DataAccessAlarmWarn; +import com.ningdatech.carapi.car.monitor.mapper.DataAccessAlarmWarnMapper; +import com.ningdatech.carapi.car.monitor.service.IDataAccessAlarmWarnService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 报警预警表 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-12-06 + */ +@Service +public class DataAccessAlarmWarnServiceImpl extends ServiceImpl implements IDataAccessAlarmWarnService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/SecurityMonitorServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/SecurityMonitorServiceImpl.java new file mode 100644 index 0000000..9baf715 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/SecurityMonitorServiceImpl.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.car.monitor.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.car.monitor.entity.SecurityMonitorJoin; +import com.ningdatech.carapi.car.monitor.mapper.SecurityMonitorJoinMapper; +import com.ningdatech.carapi.car.monitor.service.SecurityMonitorService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class SecurityMonitorServiceImpl extends ServiceImpl implements SecurityMonitorService { + + private final SecurityMonitorJoinMapper securityMonitorJoinMapper; + + @Override + public Page pageJoin(Page page, LambdaQueryWrapper wrapper) { + return securityMonitorJoinMapper.pageJoin(page, wrapper); + } + + @Override + public SecurityMonitorJoin getOneJoin(LambdaQueryWrapper wrapper) { + return securityMonitorJoinMapper.getOneJoin(wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/VehicleSecurityMonitorServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/VehicleSecurityMonitorServiceImpl.java new file mode 100644 index 0000000..3aa1d32 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/monitor/service/impl/VehicleSecurityMonitorServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.monitor.service.impl; + +import com.ningdatech.carapi.car.monitor.entity.VehicleSecurityMonitor; +import com.ningdatech.carapi.car.monitor.mapper.VehicleSecurityMonitorMapper; +import com.ningdatech.carapi.car.monitor.service.IVehicleSecurityMonitorService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 车辆安全监控 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-12-07 + */ +@Service +public class VehicleSecurityMonitorServiceImpl extends ServiceImpl implements IVehicleSecurityMonitorService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/contants/PositionContant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/contants/PositionContant.java new file mode 100644 index 0000000..554afce --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/contants/PositionContant.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.car.position.contants; + +/** + * @Classname PositionContant + * @Description + * @Date 2022/10/26 10:37 + * @Created by PoffyZhang + */ +public class PositionContant { + + public static final String REAL_GPS_URL = "http://{host}:8092/gps/car_plate?car_plate={car_plate}"; + + public static final String REAL_DEVICE_URL = "http://{host}:8090/devices?limit={limit}&skip={skip}&sort={sort}&filters={filters}"; + + public static final String VEHICLE_DEVICE_URL = "http://{host}:8090/get/car/device/{car_plate}"; + + public static final String RECORD_LIST_URL = "http://{host}:8090/record/{deviceId}/list?" + + "start={start}&end={end}"; + public static final String STREAM_URL = "http://%s:8090/streams/"; + + public static final String RECORD_URL = "http://%s:8090/record/"; + + public static final String HOST_FEILD = "host"; + public static final String FIELD_CAR_PLATE = "car_plate"; + + public static final String LONGITUDE = "car_longitude"; + + public static final String LATITUDE = "car_latitude"; + + public static final String ALTITUDE = "car_altitude"; + + public static final String DIRECTION = "car_direction"; + + public static final String PLATE_COLOR = "plate_color"; + + public static final String UPDATE_TIME = "update_time"; + + public static final String ONLINE_STATUS = "online_status"; + + public static final String CAR_VELOCITY = "car_velocity"; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/controller/PositionMonitorController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/controller/PositionMonitorController.java new file mode 100644 index 0000000..1951689 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/controller/PositionMonitorController.java @@ -0,0 +1,54 @@ +package com.ningdatech.carapi.car.position.controller; + +import com.ningdatech.carapi.car.position.manage.PositionMonitorManage; +import com.ningdatech.carapi.car.position.model.po.ReqRealTimeMonitorPO; +import com.ningdatech.carapi.car.position.model.po.ReqTrajectoryDataPO; +import com.ningdatech.carapi.car.position.model.vo.ResRealTimeMonitorStatisticsVO; +import com.ningdatech.carapi.car.position.model.vo.ResRealTimeMonitorVehicleGisListVO; +import com.ningdatech.carapi.car.position.model.vo.ResTrajectoryDataVO; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/8 上午10:25 + */ + +@RestController +@RequestMapping(value = "/api/v1/car-manage/position-monitor") +@Api(tags = "车辆管理-定位监控") +@Validated +@RequiredArgsConstructor +public class PositionMonitorController { + + private final PositionMonitorManage positionMonitorManage; + + @PostMapping("/trajectory-data-list") + @ApiOperation("获取车辆轨迹数据列表(无分页)") + @WebLog + public List trajectoryDatalist(@Valid @RequestBody ReqTrajectoryDataPO po) { + return positionMonitorManage.trajectoryDatalist(po); + } + + @PostMapping("/real-time-monitor-statistics") + @ApiOperation("实时监控数量统计") + public ResRealTimeMonitorStatisticsVO realTimeMonitorStatistics(@Valid @RequestBody ReqRealTimeMonitorPO po) { + return positionMonitorManage.realTimeMonitorStatistics(po); + } + + @PostMapping("/real-time-monitor-vehicle-gis-list") + @ApiOperation("实时监控车辆gis列表") + public List realTimeMonitorVehicleGisList(@Valid @RequestBody ReqRealTimeMonitorPO po) { + return positionMonitorManage.realTimeMonitorVehicleGisList(po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/entity/VehiclePositionInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/entity/VehiclePositionInfo.java new file mode 100644 index 0000000..7c413a8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/entity/VehiclePositionInfo.java @@ -0,0 +1,100 @@ +package com.ningdatech.carapi.car.position.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.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-11-17 + */ +@TableName("nd_data_access_gps_2022_11") +@Data +@ApiModel(value = "VehiclePositionInfo对象", description = "") +public class VehiclePositionInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + private String carPlate; + + private Boolean plateColor; + + private BigDecimal carLongitude; + + private BigDecimal carLatitude; + + private BigDecimal carAltitude; + + private BigDecimal carVelocity; + + private BigDecimal carDirection; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private String updateTime; + + private String operatorName; + + private String operatorId; + + @ApiModelProperty("报警标识") + private Integer alarmFlag; + + @ApiModelProperty("状态,根据需求去取对应的位数参考jtt808/8.21下的状态定义") + private Integer status; + + @ApiModelProperty("仪表盘里程数") + private Integer dashboardMileage; + + @ApiModelProperty("仪表盘速度") + private Integer dashboardSpeed; + + @ApiModelProperty("recordId") + @TableId(value = "record_id", type = IdType.AUTO) + private Long recordId; + + public BigDecimal getCarLatitude(){ + if(Objects.nonNull(this.carLatitude)){ + this.carLatitude = this.carLatitude.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carLatitude; + } + return this.carLatitude; + } + + public BigDecimal getCarLongitude(){ + if(Objects.nonNull(this.carLongitude)){ + this.carLongitude = this.carLongitude.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carLongitude; + } + return this.carLongitude; + } + + public BigDecimal getCarAltitude(){ + if(Objects.nonNull(this.carAltitude)){ + this.carAltitude = this.carAltitude.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carAltitude; + } + return this.carAltitude; + } + + public BigDecimal getCarVelocity(){ + if(Objects.nonNull(this.carVelocity)){ + this.carVelocity = this.carVelocity.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carVelocity; + } + return this.carVelocity; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/manage/PositionMonitorManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/manage/PositionMonitorManage.java new file mode 100644 index 0000000..0b6e8e7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/manage/PositionMonitorManage.java @@ -0,0 +1,381 @@ +package com.ningdatech.carapi.car.position.manage; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +import com.ningdatech.carapi.homepage.entity.model.NdDataAccessGps; +import com.ningdatech.carapi.homepage.service.IDataAccessGpsService; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.exception.code.ExceptionCode; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.archives.enums.AuditStateEnum; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.position.contants.PositionContant; +import com.ningdatech.carapi.car.position.entity.VehiclePositionInfo; +import com.ningdatech.carapi.car.position.model.po.ReqRealTimeMonitorPO; +import com.ningdatech.carapi.car.position.model.po.ReqTrajectoryDataPO; +import com.ningdatech.carapi.car.position.model.vo.ResRealTimeMonitorStatisticsVO; +import com.ningdatech.carapi.car.position.model.vo.ResRealTimeMonitorVehicleGisListVO; +import com.ningdatech.carapi.car.position.model.vo.ResTrajectoryDataVO; +import com.ningdatech.carapi.car.position.service.IVehiclePositionInfoService; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.model.po.VehicleCompanyPO; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.DeletedEnum; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.constant.VehicleLimitSpeedEnum; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.homepage.entity.model.OnlineNumCnt; +import com.ningdatech.carapi.homepage.entity.po.VehicleNumPO; +import com.ningdatech.carapi.homepage.service.IHomepageService; +import com.ningdatech.carapi.sys.contants.RegionContant; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.helper.VehiclesCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +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.date.DatePattern; +import cn.hutool.core.date.StopWatch; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author liuxinxin + * @date 2022/10/8 上午11:18 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class PositionMonitorManage { + + private final IVehiclePositionInfoService iVehiclePositionInfoService; + + private final IHomepageService homepageService; + + private final RestTemplate restTemplate; + + private final IVehicleBaseInfoService vehicleBaseInfoService; + + private final CompanyService companyService; + + private final RegionsCacheHelper regionsCacheHelper; + + private final VehiclesCacheHelper vehiclesCacheHelper; + + @Value("${gps.host}") + private String HOST; + + private final RedisTemplate redisTemplate; + private final OperatorsCacheHelper operatorsCacheHelper; + private final IDataAccessGpsService dataAccessGpsService; + + + + public List trajectoryDatalist(ReqTrajectoryDataPO po) { + String carPlate = po.getCarPlate(); + LocalDateTime startTime = po.getStartTime(); + LocalDateTime endTime = po.getEndTime(); + if (Objects.isNull(startTime)) { + startTime = LocalDateTime.now().minusHours(2); + } + // 默认时间区间为2小时前到现在。 + if (Objects.isNull(endTime)) { + endTime = LocalDateTime.now(); + } + + // 判断车辆所属区域是否在登录用户的区域权限内 + //NdVehicleBaseInfo car = vehiclesCacheHelper.getByCarPlate(carPlate); + //Long regionId = car.getRegionId(); + //Long companyId = car.getCompanyId(); + //UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + //Long userDetailRegionId = userDetail.getRegionId(); + //List listChild = regionsCacheHelper.listChildRegionId(userDetailRegionId,true,true); + //// 不在登录用户的区域权限内 返回空数据 + //if (!listChild.contains(regionId)){ + // return Collections.emptyList(); + //} + + //判断日期有没有跨天 + checkDateExtendIntoNextDay(startTime, endTime); + + // 从GPS数据列表中获取查询车牌号 查询时间区间内的数据 + List list = dataAccessGpsService.list(Wrappers.lambdaQuery(NdDataAccessGps.class) + .eq(NdDataAccessGps::getCarPlate, carPlate) + .ge(NdDataAccessGps::getUpdateTime, startTime) + .le(NdDataAccessGps::getUpdateTime, endTime)); + if (CollUtil.isEmpty(list)){ + return Collections.emptyList(); + } + + List vehiclePositionInfoList = list.stream().map(d -> { + VehiclePositionInfo vehiclePositionInfo = new VehiclePositionInfo(); + vehiclePositionInfo.setCarPlate(d.getCarPlate()); + vehiclePositionInfo.setCarAltitude(d.getCarAltitude()); + vehiclePositionInfo.setCarLongitude(d.getCarLongitude()); + vehiclePositionInfo.setCarLatitude(d.getCarLatitude()); + vehiclePositionInfo.setCarDirection(d.getCarDirection()); + vehiclePositionInfo.setCarVelocity(d.getCarVelocity()); + vehiclePositionInfo.setRecordId(d.getRecordId()); + vehiclePositionInfo.setOperatorId(d.getOperatorId()); + vehiclePositionInfo.setOperatorName(d.getOperatorName()); + vehiclePositionInfo.setUpdateTime(NdDateUtils.format(d.getUpdateTime(), DatePattern.NORM_DATETIME_PATTERN)); + return vehiclePositionInfo; + }).collect(Collectors.toList()); + + ////动态表名 + //List vehiclePositionInfoList = iVehiclePositionInfoService + // .dynamicGpsTableHistorySearch(carPlate, startTime, endTime,NdDateUtils.format(startTime, "yyyy_MM_dd")); + + + List resTrajectoryDataVOList = vehiclePositionInfoList.stream().map( + r -> { + ResTrajectoryDataVO vo = BeanUtil.copyProperties(r, ResTrajectoryDataVO.class); + //vo.setIsOverSpeed(checkIsOverSpeed(r,car)); + return vo; + }).collect(Collectors.toList()); + //连续6次超速 才算超速 + checkContinuousOverspeed(resTrajectoryDataVOList); + return resTrajectoryDataVOList; + } + + private final String REDIS_CAR_FILED = "car-gps:"; + + private void checkContinuousOverspeed(List resTrajectoryDataVOList) { + if(CollUtil.isNotEmpty(resTrajectoryDataVOList)){ + for(int i = 0;i < resTrajectoryDataVOList.size();i++){ + ResTrajectoryDataVO vo = resTrajectoryDataVOList.get(i); + String carPlate = vo.getCarPlate(); + if(vo.getIsOverSpeed()){ + Object num = redisTemplate.opsForValue().get(carPlate); + //如果之前已经有连续6个了 那就相安无事 + if(Objects.isNull(num)){ + redisTemplate.opsForValue().set(REDIS_CAR_FILED + carPlate,1,500,TimeUnit.SECONDS); + }else{ + redisTemplate.opsForValue().increment(REDIS_CAR_FILED + carPlate); + } + }else{ + Object num = redisTemplate.opsForValue().get(REDIS_CAR_FILED + carPlate); + if(Objects.isNull(num)){ + redisTemplate.opsForValue().set(REDIS_CAR_FILED + carPlate,0,500,TimeUnit.SECONDS); + continue; + } + //如果之前已经有连续6个了 那就相安无事 + Integer overNum = Integer.valueOf(String.valueOf(num)); + if(Objects.nonNull(num) && overNum >= 6){ + redisTemplate.opsForValue().set(REDIS_CAR_FILED + carPlate,0,500,TimeUnit.SECONDS); + }else{ + //如果不是的话 要把之前的 置为不超速 + changeOverspeedFalse(resTrajectoryDataVOList,i,vo,overNum); + } + } + } + } + } + + private void changeOverspeedFalse(List resTrajectoryDataVOList,int index, ResTrajectoryDataVO vo, Integer overNum) { + int flagNum = overNum; + for(int i = index;i >= 0;i--){ + if(flagNum <= 0){ + break; + } + ResTrajectoryDataVO innerVo = resTrajectoryDataVOList.get(i); + if(innerVo.getCarPlate().equals(vo.getCarPlate())){ + innerVo.setIsOverSpeed(Boolean.FALSE); + flagNum--; + } + } + } + + private Boolean checkIsOverSpeed(VehiclePositionInfo positionInfo, NdVehicleBaseInfo car) { + //混凝土和移动泵车 是50 + Integer vehicleType = car.getVehicleType(); + VehicleTypeEnum enumByValue = VehicleTypeEnum.getEnumByValue(vehicleType); + if(enumByValue.equals(VehicleTypeEnum.OTHER)){ + if(Objects.nonNull(positionInfo.getDashboardSpeed()) && + positionInfo.getCarVelocity().compareTo(BigDecimal.valueOf(80)) >= 0){ + return Boolean.TRUE; + } + }else if(enumByValue.equals(VehicleTypeEnum.KRHP)){ + if(Objects.nonNull(positionInfo.getDashboardSpeed()) && + positionInfo.getCarVelocity().compareTo(BigDecimal.valueOf(50)) >= 0) { + return Boolean.TRUE; + } + }else if(enumByValue.equals(VehicleTypeEnum.MIXER)){ + if(Objects.nonNull(positionInfo.getDashboardSpeed()) && + positionInfo.getCarVelocity().compareTo(BigDecimal.valueOf(50)) >= 0) { + return Boolean.TRUE; + } + }else if(enumByValue.equals(VehicleTypeEnum.BULK_CEMENT_TRUCK)){ + if(Objects.nonNull(positionInfo.getDashboardSpeed()) && + positionInfo.getCarVelocity().compareTo(BigDecimal.valueOf(80)) >= 0) { + return Boolean.TRUE; + } + }else if(enumByValue.equals(VehicleTypeEnum.READY_MIXED_MORTAR_TRUC)){ + if(Objects.nonNull(positionInfo.getDashboardSpeed()) && + positionInfo.getCarVelocity().compareTo(BigDecimal.valueOf(80)) >= 0) { + return Boolean.TRUE; + } + } + + return Boolean.FALSE; + } + + //判断日期有没有跨月 + private void checkDateExtendIntoNextDay(LocalDateTime startTime, LocalDateTime endTime) { + if (!NdDateUtils.format(startTime, DatePattern.NORM_DATE_PATTERN) + .equals(NdDateUtils.format(endTime, DatePattern.NORM_DATE_PATTERN))) { + throw new BizException(ExceptionCode.OPERATION_EX.getCode(), "由于GPS数据量大 不支持跨日查询!"); + } + } + + public ResRealTimeMonitorStatisticsVO realTimeMonitorStatistics(ReqRealTimeMonitorPO po) { + // 统计时间 请求发起60秒内的数据为实时数据 + LocalDateTime statistics = LocalDateTime.now().minusSeconds(60L); + + List companyIdList = po.getCompanyIdList(); + DataScreenParam param = new DataScreenParam(); + param.setCompanyIds(companyIdList); + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + List vehicleBaseInfos = Lists.newArrayList(); + // 如果登录用户是运营商,只过滤出运营商下的车辆 + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商id + Long operatorId = operatorQueryDTO.getId(); + param.setOperatorId(operatorId); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + PositionMonitorManage context = (PositionMonitorManage) AopContext.currentProxy(); + context.buildSearchQuery(wrapper, param); + vehicleBaseInfos = vehicleBaseInfoService.list(wrapper); + } + // 如果登录用户是企业信息员,过滤出使用企业和所属企业为该企业的车辆 + else if (UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId().equals(roleId)){ + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + wrapper.eq(NdVehicleBaseInfo::getDeleted, DeletedEnum.NO_DELETED.getCode()) + .eq(NdVehicleBaseInfo::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()) + .and(w -> w.eq(NdVehicleBaseInfo::getCompanyId,userDetail.getCompanyId()).or() + .eq(NdVehicleBaseInfo::getUseCompanyId,userDetail.getCompanyId())); + vehicleBaseInfos = vehicleBaseInfoService.list(wrapper); + }else{ + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + PositionMonitorManage context = (PositionMonitorManage) AopContext.currentProxy(); + context.buildSearchQuery(wrapper, param); + vehicleBaseInfos = vehicleBaseInfoService.list(wrapper); + } + ResRealTimeMonitorStatisticsVO resRealTimeMonitorStatisticsVO = new ResRealTimeMonitorStatisticsVO(); + if (CollUtil.isEmpty(vehicleBaseInfos)){ + return resRealTimeMonitorStatisticsVO; + } + VehicleNumPO vehicleNumPO = homepageService.vehicleNum(param); + Integer vehiclesTotalCount = vehicleNumPO.getTotalNum(); + Integer vehiclesOnlineCount = 0; + Integer vehiclesOfflineCount = 0; + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + Long cnt = vehicleBaseInfos.stream().filter(o -> Objects.nonNull(o) && + Objects.nonNull(o.getStatus()) && o.getStatus() == 1).count(); + stopWatch.stop(); + log.info("共耗时 {}s", stopWatch.getTotalTimeSeconds()); + log.info("缓存中车辆在线数为:" + cnt); + vehiclesOnlineCount = cnt.intValue(); + vehiclesOfflineCount = vehiclesTotalCount - vehiclesOnlineCount; + + resRealTimeMonitorStatisticsVO.setVehiclesTotalCount(vehiclesTotalCount); + resRealTimeMonitorStatisticsVO.setVehiclesOnlineCount(vehiclesOnlineCount); + resRealTimeMonitorStatisticsVO.setVehiclesOfflineCount(vehiclesOfflineCount); + resRealTimeMonitorStatisticsVO.setTodayVehiclesAccumulatedOnlineCount(vehiclesOnlineCount); + return resRealTimeMonitorStatisticsVO; + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildSearchQuery(LambdaQueryWrapper wrapper, DataScreenParam param) { + wrapper.eq(NdVehicleBaseInfo::getDeleted, DeletedEnum.NO_DELETED.getCode()) + .eq(NdVehicleBaseInfo::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()) + .eq(Objects.nonNull(param.getOperatorId()),NdVehicleBaseInfo::getOperatorId,param.getOperatorId()) + .in(Objects.nonNull(param.getCompanyIds()) && CollUtil.isNotEmpty(param.getCompanyIds()),NdVehicleBaseInfo::getCompanyId,param.getCompanyIds()); + } + + public List realTimeMonitorVehicleGisList(ReqRealTimeMonitorPO po) { + // 只查询最新的15分钟内的数据 + LocalDateTime startTime = LocalDateTime.now().minusMinutes(15); + LocalDateTime endTime = LocalDateTime.now(); + List data = dataAccessGpsService.list(Wrappers.lambdaQuery(NdDataAccessGps.class) + .ge(NdDataAccessGps::getUpdateTime, startTime).le(NdDataAccessGps::getUpdateTime, endTime) + .select(NdDataAccessGps::getCarLongitude, NdDataAccessGps::getCarLatitude, NdDataAccessGps::getCarPlate, + NdDataAccessGps::getCarVelocity, NdDataAccessGps::getCarDirection, NdDataAccessGps::getUpdateTime)); + log.info("最近15分钟 查询到{}条数据", data.size()); + // 如果最近15分钟没有数据(GPS数据不更新了) 取表中最新的10000条数据 + if (CollUtil.isEmpty(data)){ + data = dataAccessGpsService.list(Wrappers.lambdaQuery(NdDataAccessGps.class).orderByDesc(NdDataAccessGps::getUpdateTime).last("limit 10000")); + } + + //List data = dataAccessGpsService.list(Wrappers.lambdaQuery(NdDataAccessGps.class).select(NdDataAccessGps::getCarLongitude, NdDataAccessGps::getCarLatitude, NdDataAccessGps::getCarPlate, + // NdDataAccessGps::getCarVelocity, NdDataAccessGps::getCarDirection, NdDataAccessGps::getUpdateTime)); + + if(CollUtil.isEmpty(data)){ + return Collections.emptyList(); + } + List plates = data.stream().map(NdDataAccessGps::getCarPlate).collect(Collectors.toList()); + Map map = vehicleBaseInfoService.listByCarNo(plates); + return data.stream().map(d -> { + ResRealTimeMonitorVehicleGisListVO vo = BeanUtil.copyProperties(d,ResRealTimeMonitorVehicleGisListVO.class); + vo.setUpdateTime(NdDateUtils.format(d.getUpdateTime(), NdDateUtils.DEFAULT_DATE_TIME_FORMAT)); + if(map.containsKey(d.getCarPlate())){ + NdVehicleBaseInfo car = map.get(d.getCarPlate()); + vo.setVehicleType(car.getVehicleType()); + vo.setCompanyId(car.getCompanyId()); + vo.setCompanyName(car.getUseCompanyName()); + vo.setMoving(1); + vo.setPlateColor(car.getPlateColor()); + vo.setSelfNo(car.getSelfNo()); +// vo.setLimitSpeed(); + } + return vo; + }).collect(Collectors.toList()); + } + + public List realTimeMonitorVehicleGisList(DataScreenParam param) { + if (Objects.isNull(param.getRegionId())) { + param.setRegionId(RegionContant.ZJ_REGION_ID); + } + List companies = companyService.list(Wrappers.lambdaQuery(Company.class).in(Company::getRegionId, regionsCacheHelper.listChildRegionId(param.getRegionId()))); + List companyIds = CollUtil.isNotEmpty(companies) ? companies.stream().map(c -> + String.valueOf(c.getId())).collect(Collectors.toList()) : Collections.emptyList(); + return realTimeMonitorVehicleGisList(new ReqRealTimeMonitorPO(companyIds)); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/mapper/VehiclePositionInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/mapper/VehiclePositionInfoMapper.java new file mode 100644 index 0000000..9a0de55 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/mapper/VehiclePositionInfoMapper.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.position.mapper; + +import com.ningdatech.carapi.car.position.entity.VehiclePositionInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-17 + */ +public interface VehiclePositionInfoMapper extends BaseMapper { + List dynamicGpsTableHistorySearch(@Param("carPlate") String carPlate, @Param("startTime") LocalDateTime startTime, + @Param("endTime") LocalDateTime endTime, @Param("date") String date); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/mapper/VehiclePositionInfoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/mapper/VehiclePositionInfoMapper.xml new file mode 100644 index 0000000..659da9e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/mapper/VehiclePositionInfoMapper.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/po/ReqDataPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/po/ReqDataPO.java new file mode 100644 index 0000000..90b8db9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/po/ReqDataPO.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.car.position.model.po; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author ZPF + * @date 2024/3/18 上午11:23 + */ +@ApiModel(description = "对外入参") +@Data +public class ReqDataPO { + + @ApiModelProperty("车牌") + private List carPlates; + + @ApiModelProperty("身份证号") + private List idCards; + + @ApiModelProperty("开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime endTime; + + @ApiModelProperty("校验公钥") + private String key; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/po/ReqRealTimeMonitorPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/po/ReqRealTimeMonitorPO.java new file mode 100644 index 0000000..1d9b0d0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/po/ReqRealTimeMonitorPO.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.car.position.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/8 下午2:15 + */ +@ApiModel(description = "实时监控请求入参") +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ReqRealTimeMonitorPO { + + @ApiModelProperty("公司唯一标识列表") + List companyIdList; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/po/ReqRealTimeMonitorVehicleGisDetailPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/po/ReqRealTimeMonitorVehicleGisDetailPO.java new file mode 100644 index 0000000..a402a07 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/po/ReqRealTimeMonitorVehicleGisDetailPO.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.position.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/10/8 下午2:51 + */ +@ApiModel(description = "实时监控gis车辆详情请求") +@Data +public class ReqRealTimeMonitorVehicleGisDetailPO { + + @ApiModelProperty("记录id") + @NotBlank(message = "gis记录id不能为空") + private String recordId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/po/ReqTrajectoryDataPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/po/ReqTrajectoryDataPO.java new file mode 100644 index 0000000..f4f615b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/po/ReqTrajectoryDataPO.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.car.position.model.po; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/10/8 上午11:23 + */ +@ApiModel(description = "获取车辆轨迹数据列表(无分页)请求") +@Data +public class ReqTrajectoryDataPO { + + @NotBlank(message = "车牌不能为空") + @ApiModelProperty("车牌") + private String carPlate; + + @ApiModelProperty("开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime endTime; + + @ApiModelProperty("校验公钥") + @NotBlank(message = "秘钥不能为空") + private String key; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/DeviceVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/DeviceVO.java new file mode 100644 index 0000000..ec94e35 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/DeviceVO.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.car.position.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/11/03 下午2:10 + */ + +@Data +@ApiModel(description = "车辆设备返回-VO") +public class DeviceVO { + + @ApiModelProperty("设备ID") + private String deviceId; + + @ApiModelProperty("设备名") + private String name; + + @ApiModelProperty("设备品牌") + private String manufacturer; + + @ApiModelProperty("状态") + private String status; + + @ApiModelProperty("时间") + private String active; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/ResRealTimeMonitorStatisticsVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/ResRealTimeMonitorStatisticsVO.java new file mode 100644 index 0000000..7e8ea62 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/ResRealTimeMonitorStatisticsVO.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.car.position.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/8 下午2:10 + */ + +@Data +@ApiModel(description = "实时监控统计") +public class ResRealTimeMonitorStatisticsVO { + + @ApiModelProperty("车辆总数") + private Integer vehiclesTotalCount; + + @ApiModelProperty("在线数") + private Integer vehiclesOnlineCount; + + @ApiModelProperty("离线数") + private Integer vehiclesOfflineCount; + + @ApiModelProperty("今日累计在线数") + private Integer todayVehiclesAccumulatedOnlineCount; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/ResRealTimeMonitorVehicleGisDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/ResRealTimeMonitorVehicleGisDetailVO.java new file mode 100644 index 0000000..9c59184 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/ResRealTimeMonitorVehicleGisDetailVO.java @@ -0,0 +1,92 @@ +package com.ningdatech.carapi.car.position.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/10/8 下午2:30 + */ + +@ApiModel(description = "实时监控gis车辆详情") +@Data +public class ResRealTimeMonitorVehicleGisDetailVO { + + + @ApiModelProperty("记录id") + private String recordId; + + @ApiModelProperty("车牌") + private String carPlate; + + @ApiModelProperty("经度") + private BigDecimal carLongitude; + + @ApiModelProperty("纬度") + private BigDecimal carLatitude; + + @ApiModelProperty("海拔高度") + private BigDecimal carAltitude; + + @ApiModelProperty("行驶速度") + private BigDecimal carVelocity; + + @ApiModelProperty("行驶方向") + private String carDirection; + + @ApiModelProperty("上传时间") + private LocalDateTime uploadTime; + + @ApiModelProperty("在线状态") + private String onlineStatus; + + @ApiModelProperty("运营商名称") + private String operatorName; + + @ApiModelProperty("运营商id") + private String operatorId; + + @ApiModelProperty("公司名称") + private String companyName; + + @ApiModelProperty("公司id") + private String companyId; + + public BigDecimal getCarLatitude(){ + if(Objects.nonNull(this.carLatitude)){ + this.carLatitude = this.carLatitude.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carLatitude; + } + return this.carLatitude; + } + + public BigDecimal getCarLongitude(){ + if(Objects.nonNull(this.carLongitude)){ + this.carLongitude = this.carLongitude.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carLongitude; + } + return this.carLongitude; + } + + public BigDecimal getCarAltitude(){ + if(Objects.nonNull(this.carAltitude)){ + this.carAltitude = this.carAltitude.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carAltitude; + } + return this.carAltitude; + } + + public BigDecimal getCarVelocity(){ + if(Objects.nonNull(this.carVelocity)){ + this.carVelocity = this.carVelocity.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carVelocity; + } + return this.carVelocity; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/ResRealTimeMonitorVehicleGisListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/ResRealTimeMonitorVehicleGisListVO.java new file mode 100644 index 0000000..b4862fa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/ResRealTimeMonitorVehicleGisListVO.java @@ -0,0 +1,116 @@ +package com.ningdatech.carapi.car.position.model.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Objects; +import java.util.Optional; + +/** + * @author liuxinxin + * @date 2022/10/8 下午2:30 + */ + +@ApiModel(description = "实时监控车辆gis列表") +@Data +public class ResRealTimeMonitorVehicleGisListVO { + + @ApiModelProperty("车辆颜色") + private String plateColor; + + @ApiModelProperty("经度") + private BigDecimal carLongitude; + + @ApiModelProperty("纬度") + private BigDecimal carLatitude; + + @ApiModelProperty("海拔高度") + private BigDecimal carAltitude; + + @ApiModelProperty("行驶方向") + private BigDecimal carDirection; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("公司名id") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("时间") + private String updateTime; + + @ApiModelProperty("自编号") + private String selfNo; + + @ApiModelProperty("速度") + private BigDecimal carVelocity; + + private Integer limitSpeed; + + private Integer status; + private Integer moving; + + public BigDecimal getCarLatitude(){ + if(Objects.nonNull(this.carLatitude)){ + this.carLatitude = this.carLatitude.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carLatitude; + } + return this.carLatitude; + } + + public BigDecimal getCarLongitude(){ + if(Objects.nonNull(this.carLongitude)){ + this.carLongitude = this.carLongitude.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carLongitude; + } + return this.carLongitude; + } + + public BigDecimal getCarAltitude(){ + if(Objects.nonNull(this.carAltitude)){ + this.carAltitude = this.carAltitude.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carAltitude; + } + return this.carAltitude; + } + + public BigDecimal getCarVelocity(){ + if(Objects.nonNull(this.carVelocity)){ + this.carVelocity = this.carVelocity.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carVelocity; + } + return this.carVelocity; + } + + public BigDecimal getCarDirection(){ + if(Objects.nonNull(this.carDirection)){ + this.carDirection = this.carDirection.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carDirection; + } + return this.carDirection; + } + + public String getVehicleTypeName(){ + if(Objects.nonNull(this.vehicleType)){ + Optional.ofNullable(VehicleTypeEnum.getDescByCode(vehicleType)).ifPresent(v -> + this.vehicleTypeName = v); + return this.vehicleTypeName; + } + return StringUtils.EMPTY; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/ResTrajectoryDataVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/ResTrajectoryDataVO.java new file mode 100644 index 0000000..f7455af --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/model/vo/ResTrajectoryDataVO.java @@ -0,0 +1,92 @@ +package com.ningdatech.carapi.car.position.model.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/10/8 上午11:13 + */ + +@ApiModel(description = "车辆轨迹数据") +@Data +public class ResTrajectoryDataVO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("记录id") + private String recordId; + + @ApiModelProperty("车牌") + private String carPlate; + + @ApiModelProperty("经度") + private BigDecimal carLongitude; + + @ApiModelProperty("纬度") + private BigDecimal carLatitude; + + @ApiModelProperty("海拔高度") + private BigDecimal carAltitude; + + @ApiModelProperty("行驶速度") + private BigDecimal carVelocity; + + @ApiModelProperty("行驶方向") + private BigDecimal carDirection; + + @ApiModelProperty("在线状态") + private String onlineStatus; + + @ApiModelProperty("运营商名称") + private String operatorName; + + @ApiModelProperty("运营商id") + private String operatorId; + + @ApiModelProperty("时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private String updateTime; + + @ApiModelProperty("是否超速") + private Boolean isOverSpeed = Boolean.FALSE; + + public BigDecimal getCarLongitude(){ + if(Objects.nonNull(this.carLongitude)){ + this.carLongitude = this.carLongitude.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carLongitude; + } + return this.carLongitude; + } + + public BigDecimal getCarAltitude(){ + if(Objects.nonNull(this.carAltitude)){ + this.carAltitude = this.carAltitude.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carAltitude; + } + return this.carAltitude; + } + + public BigDecimal getCarVelocity(){ + if(Objects.nonNull(this.carVelocity)){ + this.carVelocity = this.carVelocity.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carVelocity; + } + return this.carVelocity; + } + + public BigDecimal getCarDirection(){ + if(Objects.nonNull(this.carDirection)){ + this.carDirection = this.carDirection.setScale(BigDecimal.ROUND_HALF_EVEN, RoundingMode.HALF_UP); + return this.carDirection; + } + return this.carDirection; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/service/IVehiclePositionInfoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/service/IVehiclePositionInfoService.java new file mode 100644 index 0000000..b3da6fe --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/service/IVehiclePositionInfoService.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.position.service; + +import com.ningdatech.carapi.car.position.entity.VehiclePositionInfo; +import com.baomidou.mybatisplus.extension.service.IService; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-17 + */ +public interface IVehiclePositionInfoService extends IService { + + List dynamicGpsTableHistorySearch(String carPlate, LocalDateTime startTime, LocalDateTime endTime,String date); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/service/impl/VehiclePositionInfoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/service/impl/VehiclePositionInfoServiceImpl.java new file mode 100644 index 0000000..d7fa8b0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/position/service/impl/VehiclePositionInfoServiceImpl.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.car.position.service.impl; + +import com.ningdatech.carapi.car.position.entity.VehiclePositionInfo; +import com.ningdatech.carapi.car.position.mapper.VehiclePositionInfoMapper; +import com.ningdatech.carapi.car.position.service.IVehiclePositionInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-17 + */ +@Service +@RequiredArgsConstructor +public class VehiclePositionInfoServiceImpl extends ServiceImpl implements IVehiclePositionInfoService { + + private final VehiclePositionInfoMapper vehiclePositionInfoMapper; + + @Override + public List dynamicGpsTableHistorySearch(String carPlate, LocalDateTime startTime, LocalDateTime endTime, String date) { + return vehiclePositionInfoMapper.dynamicGpsTableHistorySearch(carPlate,startTime,endTime,date); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/controller/RptDailyController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/controller/RptDailyController.java new file mode 100644 index 0000000..6fe6999 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/controller/RptDailyController.java @@ -0,0 +1,119 @@ +package com.ningdatech.carapi.car.rpt.controller; + + +import com.ningdatech.carapi.car.rpt.manage.RptDailyManage; +import com.ningdatech.carapi.car.rpt.model.dto.*; +import com.ningdatech.carapi.car.rpt.model.vo.*; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +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.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 报表统计 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ + +@RequestMapping("/api/car-rpt") +@RequiredArgsConstructor +@RestController +@Api(tags = "车辆管理-统计报表") +@Validated +public class RptDailyController { + + private final RptDailyManage rptDailyManage; + + @ApiOperation("浙江省专用车辆上线率日报") + @GetMapping("/daily-special-vehicles-launch-rate") + public List dailySpecialVehiclesLaunchRate( + @Valid @ModelAttribute RptDailySpecialVehiclesLaunchRateParamDTO param) { + return rptDailyManage.dailySpecialVehiclesLaunchRate(param); + } + + @ApiOperation("浙江省运营商车辆上线率日报") + @GetMapping("/daily-operator-vehicles-launch-rate") + public List dailyOperatorVehiclesLaunchRate( + @Valid @ModelAttribute RptDailyOperatorVehiclesLaunchRateParamDTO param) { + return rptDailyManage.dailyOperatorVehiclesLaunchRate(param); + } + + @ApiOperation("专用车辆企业上线率低于60日报") + @GetMapping("/daily-special-vehicles-company-launch-rate-60") + public List dailySpecialVehiclesCompanyLaunchRate( + @Valid @ModelAttribute RptDailySpecialVehiclesCompanyLaunchRateParamDTO param) { + return rptDailyManage.dailySpecialVehiclesCompanyLaunchRate(param); + } + + @ApiOperation("专用车辆超速日报") + @GetMapping("/daily-special-vehicles-overspeed") + public List dailySpecialVehiclesOverspeed( + @Valid @ModelAttribute RptDailySpecialVehiclesOverspeedParamDTO param) { + return rptDailyManage.dailySpecialVehiclesOverspeed(param); + } + + @ApiOperation("超速企业情况日报") + @GetMapping("/daily-overspeed-company") + public List dailyOverspeedCompany( + @Valid @ModelAttribute RptDailyOverspeedCompanyParamDTO param) { + return rptDailyManage.dailyOverspeedCompany(param); + } + + @ApiOperation("超速专用车辆日报") + @GetMapping("/daily-overspeed-special-vehicles") + public List dailyOverspeedSpecialVehicles( + @Valid @ModelAttribute RptDailyOverspeedSpecialVehiclesParamDTO param) { + return rptDailyManage.dailyOverspeedSpecialVehicles(param); + } + + @ApiOperation("浙江省专用车辆上线率日报表导出") + @GetMapping("/ZJ-special-vehicles-onlineRate-dailyReport-export") + public void specialVehiclesOnlineRateDailyReportExport(RptDailySpecialVehiclesLaunchRateParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,rptDailyManage::specialVehiclesOnlineRateDailyReportExport); + } + + @ApiOperation("运营商车辆上线率日报表导出") + @GetMapping("/operators-vehicles-onlineRate-dailyReport-export") + public void operatorsVehiclesOnlineRateDailyReportExport(RptDailyOperatorVehiclesLaunchRateParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,rptDailyManage::operatorsVehiclesOnlineRateDailyReportExport); + } + + @ApiOperation("浙江省专用车辆上线率低于60%的企业日报表导出") + @GetMapping("/ZJ-special-vehicles-onlineRate-enterprise-dailyReport-export-60") + public void specialVehiclesOnlineRateEnterpriseDailyReportExport60(RptDailySpecialVehiclesCompanyLaunchRateParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,rptDailyManage::specialVehiclesOnlineRateEnterpriseDailyReportExport60); + } + + @ApiOperation("浙江省专用车辆超速情况日报表导出") + @GetMapping("/ZJ-special-vehicles-overSpeed-dailyReport-export") + public void specialVehiclesOverSpeedDailyReportExport(RptDailySpecialVehiclesOverspeedParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,rptDailyManage::specialVehiclesOverSpeedDailyReportExport); + } + + @ApiOperation("浙江省超速企业排名日报表导出") + @GetMapping("/ZJ-overSpeed-enterprise-rank-dailyReport-export") + public void overSpeedEnterpriseRankDailyReportExport(RptDailyOverspeedCompanyParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,rptDailyManage::overSpeedEnterpriseRankDailyReportExport); + } + + @ApiOperation("浙江省超速专用车辆排名日报表导出") + @GetMapping("/ZJ-overSpeed-special-vehicles-rank-dailyReport-export") + public void overSpeedSpecialVehiclesRankDailyReportExport(RptDailyOverspeedSpecialVehiclesParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,rptDailyManage::overSpeedSpecialVehiclesRankDailyReportExport); + } + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/controller/RptMonthController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/controller/RptMonthController.java new file mode 100644 index 0000000..9a353e4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/controller/RptMonthController.java @@ -0,0 +1,99 @@ +package com.ningdatech.carapi.car.rpt.controller; + +import com.ningdatech.carapi.car.rpt.manage.RptMonthManage; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthOverspeedCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOfflineParamDTO; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOverspeedCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOverspeedVehiclesParamDTO; +import com.ningdatech.carapi.car.rpt.model.vo.RptMonthOverspeedCompanyVO; +import com.ningdatech.carapi.car.rpt.model.vo.RptMonthOverspeedSpecialCompanyVO; +import com.ningdatech.carapi.car.rpt.model.vo.RptMonthOverspeedSpecialVehiclesVO; +import com.ningdatech.carapi.car.rpt.model.vo.RptMonthSpecialOfflineVO; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +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.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 报表统计 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ + +@RequestMapping("/api/car-rpt") +@RequiredArgsConstructor +@RestController +@Api(tags = "车辆管理-统计报表") +@Validated +public class RptMonthController { + + private final RptMonthManage rptMonthManage; + + @ApiOperation("浙江省超速企业月报") + @GetMapping("/monthly-overspeed-company") + public List monthlyOverspeedCompany( + @Valid @ModelAttribute RptMonthOverspeedCompanyParamDTO param) { + return rptMonthManage.monthlyOverspeedCompany(param); + } + + @ApiOperation("浙江省专用车辆排名月报") + @GetMapping("/monthly-special-overspeed-company") + public List monthlySpecialOverspeedCompany( + @Valid @ModelAttribute RptMonthSpecialOverspeedCompanyParamDTO param) { + return rptMonthManage.monthlySpecialOverspeedCompany(param); + } + + @ApiOperation("浙江省专用车辆不上线排序月报") + @GetMapping("/monthly-special-offline") + public List monthlySpecialOffline( + @Valid @ModelAttribute RptMonthSpecialOfflineParamDTO param) { + return rptMonthManage.monthlySpecialOffline(param); + } + + @ApiOperation("浙江省专用车辆月对比") + @GetMapping("/monthly-special-overspeed-vehicles") + public List monthlyOverspeedVehicles( + @Valid @ModelAttribute RptMonthSpecialOverspeedVehiclesParamDTO param) { + return rptMonthManage.monthlyOverspeedVehicles(param); + } + + @ApiOperation("浙江省超速企业排名月报表导出") + @GetMapping("/ZJ-overSpeed-enterprise-rank-monthReport-export") + public void overSpeedEnterpriseRankMonthReportExport + (RptMonthOverspeedCompanyParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,rptMonthManage::overSpeedEnterpriseRankMonthReportExport); + } + + @ApiOperation("浙江省超速专用车辆排名月报表导出") + @GetMapping("/ZJ-overSpeed-special-vehicles-rank-monthReport-export") + public void overSpeedSpecialVehiclesRankMonthReportExport + (RptMonthSpecialOverspeedCompanyParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,rptMonthManage::overSpeedSpecialVehiclesRankMonthReportExport); + } + + @ApiOperation("浙江省不上线的专用车辆排序表月报导出") + @GetMapping("/ZJ-special-vehicles-offline-sorting-monthReport-export") + public void specialVehiclesOfflineSortingMonthReportExport + (RptMonthSpecialOfflineParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,rptMonthManage::specialVehiclesOfflineSortingMonthReportExport); + } + + @ApiOperation("浙江省超速专用车辆月对比报表导出") + @GetMapping("/ZJ-overSpeed-special-vehicles-contrast-monthReport-export") + public void overSpeedSpecialVehiclesContrastMonthReportExport + (RptMonthSpecialOverspeedVehiclesParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,rptMonthManage::overSpeedSpecialVehiclesContrastMonthReportExport); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/controller/RptOtherController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/controller/RptOtherController.java new file mode 100644 index 0000000..6722d6e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/controller/RptOtherController.java @@ -0,0 +1,173 @@ +package com.ningdatech.carapi.car.rpt.controller; + + +import com.ningdatech.carapi.car.rpt.manage.RptOtherManage; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.vo.*; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +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.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 车辆报警清理分析表 其它报表 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@RequestMapping("/api/car-rpt") +@RequiredArgsConstructor +@RestController +@Api(tags = "车辆管理-统计报表") +@Validated +public class RptOtherController { + private final RptOtherManage rptOtherManage; + + @ApiOperation("专用车辆超速记录") + @GetMapping("/other-special-overspeed") + public List otherSpecialOverspeed( + @Valid @ModelAttribute RptOtherParamDTO param) { + return rptOtherManage.otherSpecialOverspeed(param); + } + + @ApiOperation("专用车辆趟次记录") + @GetMapping("/other-special-trips") + public List otherSpecialTrips( + @Valid @ModelAttribute RptOtherParamDTO param) { + return rptOtherManage.otherSpecialTrips(param); + } + + @ApiOperation("企业车辆趟次记录") + @GetMapping("/other-company-trips") + public List otherCompanyTrips( + @Valid @ModelAttribute RptOtherParamDTO param) { + return rptOtherManage.otherCompanyTrips(param); + } + + @ApiOperation("车辆上线情况统计表") + @GetMapping("/other-online-vehicles") + public List otherOnlineVehicles( + @Valid @ModelAttribute RptOtherParamDTO param) { + return rptOtherManage.otherOnlineVehicles(param); + } + + @ApiOperation("车辆跨域情况统计表") + @GetMapping("/other-cross-domain-vehicles") + public List otherCrossDomainVehicles( + @Valid @ModelAttribute RptOtherParamDTO param) { + return rptOtherManage.otherCrossDomainVehicles(param); + } + + @ApiOperation("车辆报警清理情况统计表") + @GetMapping("/other-alaram-clean-vehicles") + public List otherAlarmCleanVehicles( + @Valid @ModelAttribute RptOtherParamDTO param) { + return rptOtherManage.otherAlarmCleanVehicles(param); + } + + @ApiOperation("车辆上线情况同比环比分析") + @GetMapping("/other-online-analysis-vehicles") + public List otherOnlineAnalysisVehicles( + @Valid @ModelAttribute RptOtherParamDTO param) { + return rptOtherManage.otherOnlineAnalysisVehicles(param); + } + + @ApiOperation("车辆跨域情况同比环比分析") + @GetMapping("/other-cross-domain-analysis-vehicles") + public List otherCrossDomainAnalysisVehicles( + @Valid @ModelAttribute RptOtherParamDTO param) { + return rptOtherManage.otherCrossDomainAnalysisVehicles(param); + } + + @ApiOperation("车辆告警情况同比环比分析") + @GetMapping("/other-alarm-analysis-vehicles") + public List otherAlarmAnalysisVehicles( + @Valid @ModelAttribute RptOtherParamDTO param) { + return rptOtherManage.otherAlarmAnalysisVehicles(param); + } + + @ApiOperation("企业车辆终端安装情况统计") + @GetMapping("/other-terminal-install") + public List otherTerminalInstall( + @Valid @ModelAttribute RptOtherParamDTO param) { + return rptOtherManage.otherTerminalInstall(param); + } + + + @ApiOperation("专用车辆超速记录查询导出") + @GetMapping("/special-vehicles-overSpeed-record-query-export") + public void specialVehiclesOverSpeedRecordQueryExport(RptOtherParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, rptOtherManage::specialVehiclesOverSpeedRecordQueryExport); + } + + @ApiOperation("专用车辆趟次记录查询导出") + @GetMapping("/special-vehicles-trips-record-query-export") + public void specialVehiclesTripsRecordQueryExport(RptOtherParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, rptOtherManage::specialVehiclesTripsRecordQueryExport); + } + + @ApiOperation("企业车辆趟次记录查询导出") + @GetMapping("/enterprise-vehicles-trips-record-query-export") + public void enterpriseVehiclesTripsRecordQueryExport(RptOtherParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, rptOtherManage::enterpriseVehiclesTripsRecordQueryExport); + } + + @ApiOperation("车辆上线情况统计报表导出") + @GetMapping("/vehicles-online-statistics-report-export") + public void vehiclesOnlineStatisticsReportExport(RptOtherParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, rptOtherManage::vehiclesOnlineStatisticsReportExport); + } + + @ApiOperation("车辆跨域情况统计报表导出") + @GetMapping("/vehicles-cross-domain-statistics-report-export") + public void vehiclesCrossDomainStatisticsReportExport(RptOtherParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, rptOtherManage::vehiclesCrossDomainStatisticsReportExport); + } + + @ApiOperation("车辆报警清理统计报表导出") + @GetMapping("/vehicles-alarm-clear-statistics-report-export") + public void vehiclesAlarmClearStatisticsReportExport(RptOtherParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, rptOtherManage::vehiclesAlarmClearStatisticsReportExport); + } + + @ApiOperation("车辆上线情况同比/环比分析导出") + @GetMapping("/vehicles-online-situation-annulus-analysis-report-export") + public void vehiclesOnlineSituationAnnulusAnalysisReportExport(RptOtherParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, rptOtherManage::vehiclesOnlineSituationAnnulusAnalysisReportExport); + } + + @ApiOperation("车辆报警情况同比/环比分析导出") + @GetMapping("/vehicles-alarm-situation-annulus-analysis-report-export") + public void vehiclesAlarmSituationAnnulusAnalysisReportExport(RptOtherParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, rptOtherManage::vehiclesAlarmSituationAnnulusAnalysisReportExport); + } + + @ApiOperation("车辆跨域情况同比/环比分析导出") + @GetMapping("/vehicles-cross-domain-situation-annulus-analysis-report-export") + public void vehiclesCrossDomainSituationAnnulusAnalysisReportExport(RptOtherParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, rptOtherManage::vehiclesCrossDomainSituationAnnulusAnalysisReportExport); + } + + @ApiOperation("企业车辆车载终端安装率统计导出") + @GetMapping("/enterprise-vehicles-car-terminal-installation-rate-report-export") + public void enterpriseVehiclesCarTerminalInstallationRateReportExport(RptOtherParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, rptOtherManage::enterpriseVehiclesCarTerminalInstallationRateReportExport); + } + + //@ApiOperation("9地区车辆上线情况统计导出") + //@GetMapping("/nine-areas-vehicles-online-statistics-report-export") + //public void nineAreasVehiclesOnlineStatisticsReportExport(RptOtherParamDTO req, HttpServletResponse response) { + // ExcelDownUtil.downXls(response, req, rptOtherManage::nineAreasVehiclesOnlineStatisticsReportExport); + //} +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/controller/RptTendaysController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/controller/RptTendaysController.java new file mode 100644 index 0000000..0537a2b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/controller/RptTendaysController.java @@ -0,0 +1,84 @@ +package com.ningdatech.carapi.car.rpt.controller; + +import com.ningdatech.carapi.car.rpt.manage.RptTendaysManage; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOfflineWeekSpecialParamDTO; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOverspeedSpecialCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOverspeedSpecialVehiclesParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptTendaysSpecialOfflineWeekPO; +import com.ningdatech.carapi.car.rpt.model.vo.RptTendaysSpecialOfflineWeekVO; +import com.ningdatech.carapi.car.rpt.model.vo.RptTendaysSpecialOverspeedCompanyVO; +import com.ningdatech.carapi.car.rpt.model.vo.RptTendaysSpecialOverspeedVehiclesVO; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +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.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 报表统计 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ + +@RequestMapping("/api/car-rpt") +@RequiredArgsConstructor +@RestController +@Api(tags = "车辆管理-统计报表") +@Validated +public class RptTendaysController { + + private final RptTendaysManage rptTendaysManage; + + @ApiOperation("浙江省专用车辆超速企业旬报") + @GetMapping("/tendays-special-overspeed-company") + public List tendaysSpecialOverspeedCompany( + @Valid @ModelAttribute RptTendaysOverspeedSpecialCompanyParamDTO param) { + return rptTendaysManage.tendaysSpecialOverspeedCompany(param); + } + + @ApiOperation("浙江省专用车辆超速车辆排序旬报") + @GetMapping("/tendays-special-overspeed-vehicles") + public List tendaysSpecialOverspeedVehicles( + @Valid @ModelAttribute RptTendaysOverspeedSpecialVehiclesParamDTO param) { + return rptTendaysManage.tendaysSpecialOverspeedVehicles(param); + } + + @ApiOperation("全省一周不上线的专用车辆旬报") + @GetMapping("/tendays-special-offline-week") + public List tendaysSpecialOfflineWeek( + @Valid @ModelAttribute RptTendaysOfflineWeekSpecialParamDTO param) { + return rptTendaysManage.tendaysSpecialOfflineWeek(param); + } + + @ApiOperation("全省专用车辆企业排序表导出") + @GetMapping("/special-vehicles-enterprise-sorting-tenDaysReport-export") + public void specialVehiclesEnterpriseSortingTenDaysReportExport + (RptTendaysOverspeedSpecialCompanyParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,rptTendaysManage::specialVehiclesEnterpriseSortingTenDaysReportExport); + } + + @ApiOperation("企业专用车辆排序表导出") + @GetMapping("/enterprise-special-vehicles-sorting-tenDaysReport-export") + public void enterpriseSpecialVehiclesSortingTenDaysReportExport + (RptTendaysOverspeedSpecialVehiclesParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,rptTendaysManage::enterpriseSpecialVehiclesSortingTenDaysReportExport); + } + + @ApiOperation("全省一周以上不上线的专用车辆排序导出") + @GetMapping("/special-vehicles-offline-week-tenDaysReport-export") + public void specialVehiclesOfflineWeekTenDaysReportExport + (RptTendaysOfflineWeekSpecialParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,rptTendaysManage::specialVehiclesOfflineWeekTenDaysReportExport); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailyOperatorVehiclesLaunchRate.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailyOperatorVehiclesLaunchRate.java new file mode 100644 index 0000000..85084c1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailyOperatorVehiclesLaunchRate.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 运营商车辆上线率日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@TableName("nd_rpt_daily_operator_vehicles_launch_rate") +@Data +@ApiModel(value = "RptDailyOperatorVehiclesLaunchRate对象", description = "运营商车辆上线率日报") +public class RptDailyOperatorVehiclesLaunchRate 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 vehicleNums; + + @ApiModelProperty("监控车辆数") + private Long monitoredVehicleNums; + + @ApiModelProperty("为监控车辆数") + private Long unmonitoredVehicleNums; + + @ApiModelProperty("上线率") + private BigDecimal launchRate; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailyOverspeedCompany.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailyOverspeedCompany.java new file mode 100644 index 0000000..5e125ee --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailyOverspeedCompany.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 超速企业情况日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@TableName("nd_rpt_daily_overspeed_company") +@Data +@ApiModel(value = "RptDailyOverspeedCompany对象", description = "超速企业情况日报") +public class RptDailyOverspeedCompany 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 vehicleNums; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("超速车辆总数") + private Long overspeedVehicleNums; + + @ApiModelProperty("超速率") + private BigDecimal overspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailyOverspeedSpecialVehicles.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailyOverspeedSpecialVehicles.java new file mode 100644 index 0000000..74ed28c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailyOverspeedSpecialVehicles.java @@ -0,0 +1,67 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 超速专用车辆日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@TableName("nd_rpt_daily_overspeed_special_vehicles") +@Data +@ApiModel(value = "RptDailyOverspeedSpecialVehicles对象", description = "超速专用车辆日报") +public class RptDailyOverspeedSpecialVehicles implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("超速%20-50%次数") + private Long overspeed2050Times; + + @ApiModelProperty("超速50以上 次数") + private Long overspeed50Times; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("总超速次数") + private Long overspeedTotalTimes; + + @ApiModelProperty("比例") + private BigDecimal rate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailySpecialVehiclesCompanyLaunchRate60.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailySpecialVehiclesCompanyLaunchRate60.java new file mode 100644 index 0000000..27a2e0f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailySpecialVehiclesCompanyLaunchRate60.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 专用车辆企业上线率低于60日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@TableName("nd_rpt_daily_special_vehicles_company_launch_rate_60") +@Data +@ApiModel(value = "RptDailySpecialVehiclesCompanyLaunchRate60对象", description = "专用车辆企业上线率低于60日报") +public class RptDailySpecialVehiclesCompanyLaunchRate60 implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("监控车辆数") + private Long monitoredVehicleNums; + + @ApiModelProperty("为监控车辆数") + private Long unmonitoredVehicleNums; + + @ApiModelProperty("上线率") + private BigDecimal launchRate; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("企业id") + private Long companyId; + + @ApiModelProperty("企业名") + private String companyName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailySpecialVehiclesLaunchRate.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailySpecialVehiclesLaunchRate.java new file mode 100644 index 0000000..8df9ba7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailySpecialVehiclesLaunchRate.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 专用车辆上线率日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@TableName("nd_rpt_daily_special_vehicles_launch_rate") +@ApiModel(value = "RptDailySpecialVehiclesLaunchRate对象", description = "专用车辆上线率日报") +@Data +public class RptDailySpecialVehiclesLaunchRate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("监控车辆数") + private Long monitoredVehicleNums; + + @ApiModelProperty("为监控车辆数") + private Long unmonitoredVehicleNums; + + @ApiModelProperty("上线率") + private BigDecimal launchRate; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailySpecialVehiclesOverspeed.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailySpecialVehiclesOverspeed.java new file mode 100644 index 0000000..f27e4f1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptDailySpecialVehiclesOverspeed.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.car.rpt.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; + +/** + *

+ * 专用车辆超速日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@TableName("nd_rpt_daily_special_vehicles_overspeed") +@Data +@ApiModel(value = "RptDailySpecialVehiclesOverspeed对象", description = "专用车辆超速日报") +public class RptDailySpecialVehiclesOverspeed 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 vehicleNums; + + @ApiModelProperty("20%-50%车辆数") + private Long overspeed2050VehicleNums; + + @ApiModelProperty("超速50%以上的车辆") + private Long overspeed50VehicleNums; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptMonthOverspeedCompany.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptMonthOverspeedCompany.java new file mode 100644 index 0000000..946b122 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptMonthOverspeedCompany.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 超速企业情况月报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_month_overspeed_company") +@Data +@ApiModel(value = "RptMonthOverspeedCompany对象", description = "超速企业情况月报") +public class RptMonthOverspeedCompany implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("超速次数") + private Long overspeedTimes; + + @ApiModelProperty("企业车辆数") + private Long vehicleNums; + + @ApiModelProperty("超速率") + private BigDecimal overspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptMonthOverspeedSpecialCompany.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptMonthOverspeedSpecialCompany.java new file mode 100644 index 0000000..e4d1576 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptMonthOverspeedSpecialCompany.java @@ -0,0 +1,67 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 专用车辆超速企业情况月报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_month_overspeed_special_company") +@Data +@ApiModel(value = "RptMonthOverspeedSpecialCompany对象", description = "专用车辆超速企业情况月报") +public class RptMonthOverspeedSpecialCompany implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("超速次数") + private Long overspeedTimes; + + @ApiModelProperty("超速率") + private BigDecimal overspeedRate; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("最高速率") + private BigDecimal maxSpeed; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptMonthOverspeedSpecialVehicles.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptMonthOverspeedSpecialVehicles.java new file mode 100644 index 0000000..78d4aaa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptMonthOverspeedSpecialVehicles.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 专用车辆超速月对比 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_month_overspeed_special_vehicles") +@Data +@ApiModel(value = "RptMonthOverspeedSpecialVehicles对象", description = "专用车辆超速月对比") +public class RptMonthOverspeedSpecialVehicles implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("本月超速次数") + private Long overspeedCurrentTimes; + + @ApiModelProperty("企业车辆数") + private Long vehicleNums; + + @ApiModelProperty("超速率") + private BigDecimal overspeedRate; + + @ApiModelProperty("上月超速次数") + private Long overspeedLastTimes; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptMonthSpecialOffline.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptMonthSpecialOffline.java new file mode 100644 index 0000000..d74ac7b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptMonthSpecialOffline.java @@ -0,0 +1,63 @@ +package com.ningdatech.carapi.car.rpt.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; + +/** + *

+ * 专用车辆不上线月报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_month_special_offline") +@Data +@ApiModel(value = "RptMonthSpecialOffline对象", description = "专用车辆不上线月报") +public class RptMonthSpecialOffline implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("未上线天数") + private Integer offlineDays; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherAlarmCleanVehicles.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherAlarmCleanVehicles.java new file mode 100644 index 0000000..8ae313e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherAlarmCleanVehicles.java @@ -0,0 +1,91 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 车辆报警清理表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_other_alarm_clean_vehicles") +@Data +@ApiModel(value = "RptOtherAlarmCleanVehicles对象", description = "车辆报警清理表 其它报表") +public class RptOtherAlarmCleanVehicles 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 String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("报警车总数") + private Long alarmVehicleNums; + + @ApiModelProperty("报警车辆占比") + private BigDecimal alarmVehicleRate; + + @ApiModelProperty("报警处理总数") + private Long alarmProcessNums; + + @ApiModelProperty("报警处理占比") + private BigDecimal alarmProcessRate; + + @ApiModelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherAlarmCleanVehiclesAnalysis.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherAlarmCleanVehiclesAnalysis.java new file mode 100644 index 0000000..7e40cf9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherAlarmCleanVehiclesAnalysis.java @@ -0,0 +1,118 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 车辆报警清理分析表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_other_alarm_clean_vehicles_analysis") +@Data +@ApiModel(value = "RptOtherAlarmCleanVehiclesAnalysis对象", description = "车辆报警清理分析表 其它报表") +public class RptOtherAlarmCleanVehiclesAnalysis 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 String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("报警车总数") + private Long alarmVehicleNums; + + @ApiModelProperty("报警车辆占比") + private BigDecimal alarmVehicleRate; + + @ApiModelProperty("报警处理总数") + private Long alarmProcessNums; + + @ApiModelProperty("报警处理占比") + private BigDecimal alarmProcessRate; + + @ApiModelProperty("报警车同比") + private BigDecimal alarmVehicleYoy; + + @ApiModelProperty("报警车环比") + private BigDecimal alarmVehicleQoq; + + @ApiModelProperty("报警处理同比") + private BigDecimal alarmProcessYoy; + + @ApiModelProperty("报警处理环比") + private BigDecimal alarmProcessQoq; + + @ApiModelProperty("在线同比") + private BigDecimal onlineYoy; + + @ApiModelProperty("在线环比") + private BigDecimal onlineQoq; + + @ApiModelProperty("离线同比") + private BigDecimal offlineYoy; + + @ApiModelProperty("离线环比") + private BigDecimal offlineQoq; + + @ApiModelProperty("年月") + private String yearMonthly; + + @ApiModelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherCrossDomainVehicles.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherCrossDomainVehicles.java new file mode 100644 index 0000000..339e99a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherCrossDomainVehicles.java @@ -0,0 +1,103 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 车辆跨域情况表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_other_cross_domain_vehicles") +@Data +@ApiModel(value = "RptOtherCrossDomainVehicles对象", description = "车辆跨域情况表 其它报表") +public class RptOtherCrossDomainVehicles 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 String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("散装水泥车数") + private Long bulkCementTruckNums; + + @ApiModelProperty("散装水泥车占比") + private BigDecimal bulkCementTruckRate; + + @ApiModelProperty("预拌砂浆车数") + private Long readyMixedMortarTruckNums; + + @ApiModelProperty("预拌砂浆车占比") + private BigDecimal readyMixedMortarTruckRate; + + @ApiModelProperty("混凝土搅拌车数") + private Long concreteDeliveryTruckNums; + + @ApiModelProperty("混凝土搅拌车数占比") + private BigDecimal concreteDeliveryTruckRate; + + @ApiModelProperty("移动泵车数") + private Long mobilePumpTruckNums; + + @ApiModelProperty("移动泵车占比") + private BigDecimal mobilePumpTruckRate; + + @ApiModelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherCrossDomainVehiclesAnalysis.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherCrossDomainVehiclesAnalysis.java new file mode 100644 index 0000000..6ed48dd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherCrossDomainVehiclesAnalysis.java @@ -0,0 +1,142 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 车辆跨域情况分析表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_other_cross_domain_vehicles_analysis") +@Data +@ApiModel(value = "RptOtherCrossDomainVehiclesAnalysis对象", description = "车辆跨域情况分析表 其它报表") +public class RptOtherCrossDomainVehiclesAnalysis 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 String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("散装水泥车数") + private Long bulkCementTruckNums; + + @ApiModelProperty("散装水泥车占比") + private BigDecimal bulkCementTruckRate; + + @ApiModelProperty("预拌砂浆车数") + private Long readyMixedMortarTruckNums; + + @ApiModelProperty("预拌砂浆车占比") + private BigDecimal readyMixedMortarTruckRate; + + @ApiModelProperty("混凝土搅拌车数") + private Long concreteDeliveryTruckNums; + + @ApiModelProperty("混凝土搅拌车数占比") + private BigDecimal concreteDeliveryTruckRate; + + @ApiModelProperty("移动泵车数") + private Long mobilePumpTruckNums; + + @ApiModelProperty("移动泵车占比") + private BigDecimal mobilePumpTruckRate; + + @ApiModelProperty("散装水泥车同比") + private BigDecimal bulkCementTruckYoy; + + @ApiModelProperty("散装水泥车环比") + private BigDecimal bulkCementTruckQoq; + + @ApiModelProperty("预拌砂浆车同比") + private BigDecimal readyMixedMortarTruckYoy; + + @ApiModelProperty("瘀斑砂浆车环比") + private BigDecimal readyMixedMortarTruckQoq; + + @ApiModelProperty("混凝土搅拌车同比") + private BigDecimal concreteDeliveryTruckYoy; + + @ApiModelProperty("混凝土搅拌车环比") + private BigDecimal concreteDeliveryTruckQoq; + + @ApiModelProperty("移动泵车同比") + private BigDecimal mobilePumpTruckYoy; + + @ApiModelProperty("移动泵车环比") + private BigDecimal mobilePumpTruckQoq; + + @ApiModelProperty("在线同比") + private BigDecimal onlineYoy; + + @ApiModelProperty("在线环比") + private BigDecimal onlineQoq; + + @ApiModelProperty("离线同比") + private BigDecimal offlineYoy; + + @ApiModelProperty("离线环比") + private BigDecimal offlineQoq; + + @ApiModelProperty("年月") + private String yearMonthly; + + @ApiModelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherOnlineVehicles.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherOnlineVehicles.java new file mode 100644 index 0000000..3a4be23 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherOnlineVehicles.java @@ -0,0 +1,79 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 在线车辆统计表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_other_online_vehicles") +@Data +@ApiModel(value = "RptOtherOnlineVehicles对象", description = "在线车辆统计表 其它报表") +public class RptOtherOnlineVehicles 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 String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherOnlineVehiclesAnalysis.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherOnlineVehiclesAnalysis.java new file mode 100644 index 0000000..434a70c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherOnlineVehiclesAnalysis.java @@ -0,0 +1,94 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 在线车辆统计分析表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_other_online_vehicles_analysis") +@Data +@ApiModel(value = "RptOtherOnlineVehiclesAnalysis对象", description = "在线车辆统计分析表 其它报表") +public class RptOtherOnlineVehiclesAnalysis 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 String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("年月") + private String yearMonthly; + + @ApiModelProperty("在线同比") + private BigDecimal onlineYoy; + + @ApiModelProperty("在线环比") + private BigDecimal onlineQoq; + + @ApiModelProperty("离线同比") + private BigDecimal offlineYoy; + + @ApiModelProperty("离线环比") + private BigDecimal offlineQoq; + + @ApiModelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherSpecialOverspeed.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherSpecialOverspeed.java new file mode 100644 index 0000000..63cd174 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherSpecialOverspeed.java @@ -0,0 +1,76 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 专用车辆超速记录 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_other_special_overspeed") +@Data +@ApiModel(value = "RptOtherSpecialOverspeed对象", description = "专用车辆超速记录 其它报表") +public class RptOtherSpecialOverspeed 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 LocalDateTime overspeedStartTime; + + @ApiModelProperty("超速结束时间") + private LocalDateTime overspeedEndTime; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("限速") + private BigDecimal limitSpeed; + + @ApiModelProperty("最高速") + private BigDecimal maxSpeed; + + @ApiModelProperty("超速率") + private Double overspeedRate; + + @ApiModelProperty("持续时间 秒") + private Integer duration; + + @ApiModelProperty("地点") + private String address; + + @ApiModelProperty("道路") + private String road; + + @ApiModelProperty("经纬度") + private String longtitudeLatitude; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherSpecialTrips.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherSpecialTrips.java new file mode 100644 index 0000000..cd00720 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherSpecialTrips.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.car.rpt.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; + +/** + *

+ * 专用车辆趟次记录 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_other_special_trips") +@Data +@ApiModel(value = "RptOtherSpecialTrips对象", description = "专用车辆趟次记录 其它报表") +public class RptOtherSpecialTrips 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 String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("车辆数") + private Integer vehicleNums; + + @ApiModelProperty("趟次") + private Long trips; + + @ApiModelProperty("区域名") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherTerminalInstall.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherTerminalInstall.java new file mode 100644 index 0000000..51829db --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptOtherTerminalInstall.java @@ -0,0 +1,94 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 终端车载安装统计 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_other_terminal_install") +@Data +@ApiModel(value = "RptOtherTerminalInstall对象", description = "终端车载安装统计 其它报表") +public class RptOtherTerminalInstall 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 String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("车辆类型") + private Long vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("安装终端的车辆数") + private Long installedNums; + + @ApiModelProperty("安装终端的车辆占比") + private BigDecimal installedRate; + + @ApiModelProperty("年月") + private String yearMonthly; + + @ApiModelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptTendaysSpecialOfflineWeek.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptTendaysSpecialOfflineWeek.java new file mode 100644 index 0000000..9006a5e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptTendaysSpecialOfflineWeek.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.car.rpt.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; + +/** + *

+ * 专用车辆一周以上不上线旬报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_tendays_special_offline_week") +@ApiModel(value = "RptTendaysSpecialOfflineWeek对象", description = "专用车辆一周以上不上线旬报") +@Data +public class RptTendaysSpecialOfflineWeek implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("未上线天数") + private Integer offlineDays; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptTendaysSpecialOverspeedCompany.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptTendaysSpecialOverspeedCompany.java new file mode 100644 index 0000000..adbfb9b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptTendaysSpecialOverspeedCompany.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 专用车辆超速企业情况旬报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_tendays_special_overspeed_company") +@ApiModel(value = "RptTendaysSpecialOverspeedCompany对象", description = "专用车辆超速企业情况旬报") +@Data +public class RptTendaysSpecialOverspeedCompany implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("当前旬超速次数") + private Long overspeedCurrentTimes; + + @ApiModelProperty("上一旬超速次数") + private Long overspeedLastTimes; + + @ApiModelProperty("超速率") + private BigDecimal overspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptTendaysSpecialOverspeedVehicles.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptTendaysSpecialOverspeedVehicles.java new file mode 100644 index 0000000..e7e789d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/entity/RptTendaysSpecialOverspeedVehicles.java @@ -0,0 +1,67 @@ +package com.ningdatech.carapi.car.rpt.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 专用车辆超速车辆情况旬报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_rpt_tendays_special_overspeed_vehicles") +@ApiModel(value = "RptTendaysSpecialOverspeedVehicles对象", description = "专用车辆超速车辆情况旬报") +@Data +public class RptTendaysSpecialOverspeedVehicles implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("当前旬超速次数") + private Long overspeedCurrentTimes; + + @ApiModelProperty("上一旬超速次数") + private Long overspeedLastTimes; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("超速率") + private BigDecimal overspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/manage/RptDailyManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/manage/RptDailyManage.java new file mode 100644 index 0000000..a8a204d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/manage/RptDailyManage.java @@ -0,0 +1,192 @@ +package com.ningdatech.carapi.car.rpt.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.excel.EasyExcel; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.car.rpt.entity.*; +import com.ningdatech.carapi.car.rpt.model.dto.*; +import com.ningdatech.carapi.car.rpt.model.po.*; +import com.ningdatech.carapi.car.rpt.model.vo.*; +import com.ningdatech.carapi.car.rpt.service.*; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Objects; + +/** + * @Classname RptManage + * @Description + * @Date 2022/11/8 17:03 + * @Created by PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class RptDailyManage { + private final IRptDailySpecialVehiclesLaunchRateService rptDailySpecialVehiclesLaunchRateService; + private final IRptDailyOperatorVehiclesLaunchRateService rptDailyOperatorVehiclesLaunchRateService; + private final IRptDailySpecialVehiclesCompanyLaunchRate60Service rptDailySpecialVehiclesCompanyLaunchRate60Service; + private final IRptDailySpecialVehiclesOverspeedService rptDailySpecialVehiclesOverspeedService; + private final IRptDailyOverspeedCompanyService rptDailyOverspeedCompanyService; + private final IRptDailyOverspeedSpecialVehiclesService rptDailyOverspeedSpecialVehiclesService; + + @XmlDataScope + @BuildChildrenRegionEntity + public List dailySpecialVehiclesLaunchRate( + RptDailySpecialVehiclesLaunchRateParamDTO param) { + List list = rptDailySpecialVehiclesLaunchRateService.report(param); + return CollUtils.convert(list,w -> BeanUtil.copyProperties(w,RptDailySpecialVehiclesLaunchRateVO.class)); + } + + @XmlDataScope + public List dailyOperatorVehiclesLaunchRate( + RptDailyOperatorVehiclesLaunchRateParamDTO param) { + List list = rptDailyOperatorVehiclesLaunchRateService.report(param); + return CollUtils.convert(list,w -> BeanUtil.copyProperties(w,RptDailyOperatorVehiclesLaunchRateVO.class)); + } + + public List dailySpecialVehiclesCompanyLaunchRate( + RptDailySpecialVehiclesCompanyLaunchRateParamDTO param) { + List list = rptDailySpecialVehiclesCompanyLaunchRate60Service.report(param); + return CollUtils.convert(list,w -> { + RptDailySpecialVehiclesCompanyLaunchRate60VO vo = BeanUtil.copyProperties(w, RptDailySpecialVehiclesCompanyLaunchRate60VO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public List dailySpecialVehiclesOverspeed( + RptDailySpecialVehiclesOverspeedParamDTO param) { + List list = rptDailySpecialVehiclesOverspeedService.report(param); + return CollUtils.convert(list,w -> BeanUtil.copyProperties(w,RptDailySpecialVehiclesOverspeedVO.class)); + } + + public List dailyOverspeedCompany( + RptDailyOverspeedCompanyParamDTO param) { + List list = rptDailyOverspeedCompanyService.report(param); + return CollUtils.convert(list,w -> { + RptDailyOverspeedCompanyVO vo = BeanUtil.copyProperties(w, RptDailyOverspeedCompanyVO.class); + CodeUtil.searchRegionName(vo); + return vo; + }); + } + + public List dailyOverspeedSpecialVehicles(RptDailyOverspeedSpecialVehiclesParamDTO param) { + List list = rptDailyOverspeedSpecialVehiclesService.report(param); + return CollUtils.convert(list,w -> { + RptDailyOverspeedSpecialVehiclesVO vo = BeanUtil.copyProperties(w, RptDailyOverspeedSpecialVehiclesVO.class); + CodeUtil.searchRegionName(vo); + return vo; + }); + } + + public void specialVehiclesOnlineRateDailyReportExport(HttpServletResponse response,RptDailySpecialVehiclesLaunchRateParamDTO param) { + List collect = dailySpecialVehiclesLaunchRate(param); + String fileName = "浙江省专用车辆上线率日报表"; + ExcelDownUtil.setFileName(fileName,response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(),RptDailySpecialVehiclesLaunchRateVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + + } + + public void operatorsVehiclesOnlineRateDailyReportExport(HttpServletResponse response, RptDailyOperatorVehiclesLaunchRateParamDTO param) { + List collect = dailyOperatorVehiclesLaunchRate(param); + String fileName = "运营商车辆上线率日报表"; + ExcelDownUtil.setFileName(fileName,response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(),RptDailyOperatorVehiclesLaunchRateVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void specialVehiclesOnlineRateEnterpriseDailyReportExport60(HttpServletResponse response, RptDailySpecialVehiclesCompanyLaunchRateParamDTO param) { + List collect = dailySpecialVehiclesCompanyLaunchRate(param); + String fileName = "浙江省专用车辆上线率低于60%的企业日报表"; + ExcelDownUtil.setFileName(fileName,response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(),RptDailySpecialVehiclesCompanyLaunchRate60VO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void specialVehiclesOverSpeedDailyReportExport(HttpServletResponse response, RptDailySpecialVehiclesOverspeedParamDTO param) { + List collect = dailySpecialVehiclesOverspeed(param); + String fileName = "浙江省专用车辆超速情况日报表"; + ExcelDownUtil.setFileName(fileName,response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(),RptDailySpecialVehiclesOverspeedVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void overSpeedEnterpriseRankDailyReportExport(HttpServletResponse response, RptDailyOverspeedCompanyParamDTO param) { + List collect = dailyOverspeedCompany(param); + String fileName = "浙江省超速企业排名日报表"; + ExcelDownUtil.setFileName(fileName,response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(),RptDailyOverspeedCompanyVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void overSpeedSpecialVehiclesRankDailyReportExport(HttpServletResponse response, RptDailyOverspeedSpecialVehiclesParamDTO param) { + List collect = dailyOverspeedSpecialVehicles(param); + String fileName = "浙江省超速专用车辆排名日报表"; + ExcelDownUtil.setFileName(fileName,response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(),RptDailyOverspeedSpecialVehiclesVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/manage/RptMonthManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/manage/RptMonthManage.java new file mode 100644 index 0000000..822cd11 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/manage/RptMonthManage.java @@ -0,0 +1,239 @@ +package com.ningdatech.carapi.car.rpt.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import com.alibaba.excel.EasyExcel; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthOverspeedCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOfflineParamDTO; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOverspeedCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOverspeedVehiclesParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthOverspeedCompanyPO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthOverspeedSpecialVehiclesPO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthSpecialOfflinePO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthSpecialVehiclesOverspeedPO; +import com.ningdatech.carapi.car.rpt.model.vo.RptMonthOverspeedCompanyVO; +import com.ningdatech.carapi.car.rpt.model.vo.RptMonthOverspeedSpecialCompanyVO; +import com.ningdatech.carapi.car.rpt.model.vo.RptMonthOverspeedSpecialVehiclesVO; +import com.ningdatech.carapi.car.rpt.model.vo.RptMonthSpecialOfflineVO; +import com.ningdatech.carapi.car.rpt.service.IRptMonthOverspeedCompanyService; +import com.ningdatech.carapi.car.rpt.service.IRptMonthOverspeedSpecialCompanyService; +import com.ningdatech.carapi.car.rpt.service.IRptMonthOverspeedSpecialVehiclesService; +import com.ningdatech.carapi.car.rpt.service.IRptMonthSpecialOfflineService; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.scheduler.entity.VehicleOnlineStatusDay; +import com.ningdatech.carapi.scheduler.service.IVehicleOnlineStatusDayService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.lang.reflect.Field; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Collections; +import java.util.List; + +/** + * @author CMM + * @Classname RptManage + * @Description + * @Date 2022/11/8 17:03 + * @Created by PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class RptMonthManage { + private final RegionsCacheHelper regionsCacheHelper; + private final IRptMonthOverspeedCompanyService rptMonthOverspeedCompanyService; + private final IRptMonthOverspeedSpecialCompanyService rptMonthOverspeedSpecialCompanyService; + private final IRptMonthOverspeedSpecialVehiclesService rptMonthOverspeedSpecialVehiclesService; + private final IRptMonthSpecialOfflineService rptMonthSpecialOfflineService; + private final IVehicleOnlineStatusDayService vehicleOnlineStatusDayService; + + public List monthlyOverspeedCompany(RptMonthOverspeedCompanyParamDTO param) { + validMonthDays(param); + List list = rptMonthOverspeedCompanyService.report(param); + return CollUtils.convert(list,m ->{ + RptMonthOverspeedCompanyVO vo = BeanUtil.copyProperties(m, RptMonthOverspeedCompanyVO.class); + CodeUtil.searchRegionName(vo); + return vo; + }); + } + + private void validMonthDays(T param) { + + Field startTimeField = null; + Field endTimeField = null; + String startTime = null; + String endTime = null; + try { + startTimeField = param.getClass().getDeclaredField("startTime"); + endTimeField = param.getClass().getDeclaredField("endTime"); + startTimeField.setAccessible(Boolean.TRUE); + endTimeField.setAccessible(Boolean.TRUE); + startTime = ((String) startTimeField.get(param)); + endTime = ((String) endTimeField.get(param)); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + LocalDate start = NdDateUtils.date2LocalDate(NdDateUtils.parseAsDateTime(startTime)); + LocalDate end = NdDateUtils.date2LocalDate(NdDateUtils.parseAsDateTime(endTime)); + int startYear = start.getYear(); + int endYear = end.getYear(); + if (endYear != startYear){ + throw new BizException("选择日期错误,请重新选择!"); + } + int startMonth = start.getMonthValue(); + int endMonth = end.getMonthValue(); + if (endMonth != startMonth){ + throw new BizException("选择日期错误,请重新选择!"); + } + int startDayOfMonth = start.getDayOfMonth(); + int endDayOfMonth = end.getDayOfMonth(); + int days = endDayOfMonth - startDayOfMonth; + if (days > (int) (NdDateUtils.MAX_MONTH_DAY + 1)){ + throw new BizException("选择日期天数大于31天,请重新选择!"); + } + } + + public List monthlySpecialOverspeedCompany(RptMonthSpecialOverspeedCompanyParamDTO param) { + validMonthDays(param); + List list = rptMonthOverspeedSpecialCompanyService.report(param); + return CollUtils.convert(list,m ->{ + RptMonthOverspeedSpecialCompanyVO vo = BeanUtil.copyProperties(m, RptMonthOverspeedSpecialCompanyVO.class); + CodeUtil.searchRegionName(vo); + return vo; + }); + } + + public List monthlySpecialOffline(RptMonthSpecialOfflineParamDTO param) { + // 不允许跨年和跨月,时间区间在某个月内 + validMonthDays(param); + Page page = param.page(); + + String startTimeStr = param.getStartTime(); + LocalDateTime startTime = LocalDateTime.parse(startTimeStr, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)); + int startDay = startTime.getDayOfYear(); + String endTimeStr = param.getEndTime(); + LocalDateTime endTime = LocalDateTime.parse(endTimeStr, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)); + int endDay = endTime.getDayOfYear(); + + // 从车辆天在线表中查询出所选时间区间内所有的车辆 + VehicleOnlineStatusDay statusday = new VehicleOnlineStatusDay(); + statusday.setYear(String.valueOf(LocalDateTime.now().getYear())); + statusday.setMonth(String.valueOf(LocalDateTime.now().getMonthValue())); + statusday.setDay(String.valueOf(LocalDateTime.now().getDayOfMonth())); + //vehicleOnlineStatusDayService.listInMonthTable(); + // 计算车辆最大不在线天数 + + + + List pageList = rptMonthSpecialOfflineService.reportPage(page,param); + if (CollUtil.isEmpty(pageList)){ + return Collections.emptyList(); + } + return CollUtils.convert(pageList,m ->{ + RptMonthSpecialOfflineVO vo = BeanUtil.copyProperties(m, RptMonthSpecialOfflineVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public List monthlyOverspeedVehicles(RptMonthSpecialOverspeedVehiclesParamDTO param) { + validMonthDays(param); + Page page = param.page(); + LocalDate start = NdDateUtils.date2LocalDate(NdDateUtils.parseAsDateTime(param.getStartTime())); + LocalDate end = NdDateUtils.date2LocalDate(NdDateUtils.parseAsDateTime(param.getEndTime())); + String lastMonthStartTime = start.minusMonths(1).toString(); + String lastMonthEndTime = end.minusMonths(1).toString(); + param.setLastMonthStartTime(lastMonthStartTime); + param.setLastMonthEndTime(lastMonthEndTime); + List pageList = rptMonthOverspeedSpecialVehiclesService.reportPage(page,param); + if (CollUtil.isEmpty(pageList)){ + return Collections.emptyList(); + } + return CollUtils.convert(pageList,m ->{ + RptMonthOverspeedSpecialVehiclesVO vo = BeanUtil.copyProperties(m, RptMonthOverspeedSpecialVehiclesVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public void overSpeedEnterpriseRankMonthReportExport + (HttpServletResponse response, RptMonthOverspeedCompanyParamDTO param) { + List collect = monthlyOverspeedCompany(param); + String fileName = "浙江省超速企业排名月报表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptMonthOverspeedCompanyVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void overSpeedSpecialVehiclesRankMonthReportExport(HttpServletResponse response, RptMonthSpecialOverspeedCompanyParamDTO param) { + List collect = monthlySpecialOverspeedCompany(param); + String fileName = "浙江省超速专用车辆排名月报表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptMonthOverspeedSpecialCompanyVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void specialVehiclesOfflineSortingMonthReportExport(HttpServletResponse response, RptMonthSpecialOfflineParamDTO param) { + List collect = monthlySpecialOffline(param); + String fileName = "浙江省不上线的专用车辆排序表月报"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptMonthSpecialOfflineVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void overSpeedSpecialVehiclesContrastMonthReportExport(HttpServletResponse response, RptMonthSpecialOverspeedVehiclesParamDTO param) { + List collect = monthlyOverspeedVehicles(param); + String fileName = "浙江省超速专用车辆月对比报表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptMonthOverspeedSpecialVehiclesVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/manage/RptOtherManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/manage/RptOtherManage.java new file mode 100644 index 0000000..7e8692e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/manage/RptOtherManage.java @@ -0,0 +1,389 @@ +package com.ningdatech.carapi.car.rpt.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.excel.EasyExcel; +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.basic.util.CollUtils; +import com.ningdatech.carapi.car.rpt.entity.*; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherAlarmCleanVehiclesPO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherCrossDomainVehiclesPO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherOnlineVehiclesPO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherSpecialOverspeedPO; +import com.ningdatech.carapi.car.rpt.model.vo.*; +import com.ningdatech.carapi.car.rpt.service.*; +import com.ningdatech.carapi.car.trips.manage.VehicleTripsManage; +import com.ningdatech.carapi.car.trips.model.dto.VehicleTripsParamDTO; +import com.ningdatech.carapi.car.trips.model.vo.VehicleTripsCityVO; +import com.ningdatech.carapi.car.trips.model.vo.VehicleTripsCompanyVO; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.CompanyJoin; +import com.ningdatech.carapi.sys.entity.dto.CompanyPageQuery; +import com.ningdatech.carapi.sys.entity.vo.CompanyVO; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.manage.CompanyManage; +import com.ningdatech.carapi.sys.service.CompanyService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +/** + * @Classname RptOtherManage + * @Description + * @Date 2022/11/8 17:03 + * @Created by PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class RptOtherManage { + private final VehicleTripsManage vehicleTripsManage; + + private final IRptOtherAlarmCleanVehiclesService rptOtherAlarmCleanVehiclesService; + private final IRptOtherAlarmCleanVehiclesAnalysisService rptOtherAlarmCleanVehiclesAnalysisService; + private final IRptOtherCrossDomainVehiclesAnalysisService rptOtherCrossDomainVehiclesAnalysisService; + private final IRptOtherCrossDomainVehiclesService rptOtherCrossDomainVehiclesService; + private final IRptOtherOnlineVehiclesService rptOtherOnlineVehiclesService; + private final IRptOtherOnlineVehiclesAnalysisService rptOtherOnlineVehiclesAnalysisService; + private final IRptOtherSpecialOverspeedService rptOtherSpecialOverspeedService; + private final IRptOtherSpecialTripsService rptOtherSpecialTripsService; + private final IRptOtherTerminalInstallService rptOtherTerminalInstallService; + + private final CompanyService companyService; + + public List otherSpecialOverspeed(RptOtherParamDTO param) { + Page page = param.page(); + rptOtherSpecialOverspeedService.reportPage(page,param); + if(0L == page.getTotal()){ + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(),w -> { + RptOtherSpecialOverspeedVO vo = BeanUtil.copyProperties(w, RptOtherSpecialOverspeedVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public List otherSpecialTrips(RptOtherParamDTO param) { + VehicleTripsParamDTO vehicleTripsParam = new VehicleTripsParamDTO(); + vehicleTripsParam.setRegionId(param.getRegionId()); + vehicleTripsParam.setStartTime(param.getStartTime()); + vehicleTripsParam.setEndTime(param.getEndTime()); + vehicleTripsParam.setVehicleTypes(Arrays.asList(1,2,3,4)); + PageVo pageList = vehicleTripsManage.lictGroupByCity(vehicleTripsParam); + if(0L == pageList.getTotal()){ + return Collections.emptyList(); + } + return CollUtils.convert(pageList.getRecords(),w -> { + RptOtherSpecialTripsVO vo = BeanUtil.copyProperties(w, RptOtherSpecialTripsVO.class); + vo.setTrips(w.getVehicleTripsNums()); + return vo; + }); + } + + public List otherCompanyTrips(RptOtherParamDTO param) { + VehicleTripsParamDTO vehicleTripsParam = new VehicleTripsParamDTO(); + vehicleTripsParam.setRegionId(param.getRegionId()); + vehicleTripsParam.setStartTime(param.getStartTime()); + vehicleTripsParam.setEndTime(param.getEndTime()); + PageVo pageList = vehicleTripsManage.lictGroupByCompany(vehicleTripsParam); + if(0L == pageList.getTotal()){ + return Collections.emptyList(); + } + return CollUtils.convert(pageList.getRecords(),w -> { + RptOtherCompanyTripsVO vo = BeanUtil.copyProperties(w, RptOtherCompanyTripsVO.class); + vo.setTrips(w.getVehicleTripsNums()); + return vo; + }); + } + + public List otherOnlineVehicles(RptOtherParamDTO param) { + Page page = param.page(); + companyService.pageVehicleNum(page,param); + if(0L == page.getTotal()){ + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(),w -> { + RptOtherOnlineVehiclesVO vo = BeanUtil.copyProperties(w, RptOtherOnlineVehiclesVO.class); + CodeUtil.searchRegionName(vo); + return vo; + }); + } + + public List otherCrossDomainVehicles(RptOtherParamDTO param) { + Page page = param.page(); + rptOtherCrossDomainVehiclesService.reportPage(page,param); + if(0L == page.getTotal()){ + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(),w -> { + RptOtherCrossDomainVehiclesVO vo = new RptOtherCrossDomainVehiclesVO(); + BeanUtils.copyProperties(w, vo); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public List otherAlarmCleanVehicles(RptOtherParamDTO param) { + Page page = param.page(); + rptOtherAlarmCleanVehiclesService.reportPage(page,param); + if(0L == page.getTotal()){ + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(),w -> { + RptOtherAlarmCleanVehiclesVO vo = new RptOtherAlarmCleanVehiclesVO(); + BeanUtils.copyProperties(w, vo); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public List otherOnlineAnalysisVehicles(RptOtherParamDTO param) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(RptOtherOnlineVehiclesAnalysis.class); + wrapper.like(Objects.nonNull(param.getCompanyName()),RptOtherOnlineVehiclesAnalysis::getCompanyName,param.getCompanyName()) + .eq(Objects.nonNull(param.getRegionId()),RptOtherOnlineVehiclesAnalysis::getRegionId,param.getRegionId()) + .eq(Objects.nonNull(param.getOperatorId()),RptOtherOnlineVehiclesAnalysis::getOperatorId,param.getOperatorId()) + .eq(Objects.nonNull(param.getYearMonth()),RptOtherOnlineVehiclesAnalysis::getYearMonthly,param.getYearMonth()) + .like(Objects.nonNull(param.getEnterpriseType()),RptOtherOnlineVehiclesAnalysis::getEnterpriseType,param.getEnterpriseType()) + .orderBy(Boolean.TRUE,Boolean.FALSE, RptOtherOnlineVehiclesAnalysis::getCreateOn); + List list = rptOtherOnlineVehiclesAnalysisService.list(wrapper); + return CollUtils.convert(list,w -> BeanUtil.copyProperties(w,RptOtherOnlineVehiclesAnalysisVO.class)); + } + + public List otherCrossDomainAnalysisVehicles(RptOtherParamDTO param) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(RptOtherCrossDomainVehiclesAnalysis.class); + wrapper.like(Objects.nonNull(param.getCompanyName()),RptOtherCrossDomainVehiclesAnalysis::getCompanyName,param.getCompanyName()) + .eq(Objects.nonNull(param.getRegionId()),RptOtherCrossDomainVehiclesAnalysis::getRegionId,param.getRegionId()) + .eq(Objects.nonNull(param.getOperatorId()),RptOtherCrossDomainVehiclesAnalysis::getOperatorId,param.getOperatorId()) + .like(Objects.nonNull(param.getEnterpriseType()),RptOtherCrossDomainVehiclesAnalysis::getEnterpriseType,param.getEnterpriseType()) + .eq(Objects.nonNull(param.getYearMonth()),RptOtherCrossDomainVehiclesAnalysis::getYearMonthly,param.getYearMonth()) + .orderBy(Boolean.TRUE,Boolean.FALSE, RptOtherCrossDomainVehiclesAnalysis::getCreateOn); + List list = rptOtherCrossDomainVehiclesAnalysisService.list(wrapper); + return CollUtils.convert(list,w -> BeanUtil.copyProperties(w,RptOtherCrossDomainVehiclesAnalysisVO.class)); + } + + public List otherAlarmAnalysisVehicles(RptOtherParamDTO param) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(RptOtherAlarmCleanVehiclesAnalysis.class); + wrapper.like(Objects.nonNull(param.getCompanyName()),RptOtherAlarmCleanVehiclesAnalysis::getCompanyName,param.getCompanyName()) + .eq(Objects.nonNull(param.getRegionId()),RptOtherAlarmCleanVehiclesAnalysis::getRegionId,param.getRegionId()) + .eq(Objects.nonNull(param.getOperatorId()),RptOtherAlarmCleanVehiclesAnalysis::getOperatorId,param.getOperatorId()) + .eq(Objects.nonNull(param.getYearMonth()),RptOtherAlarmCleanVehiclesAnalysis::getYearMonthly,param.getYearMonth()) + .like(Objects.nonNull(param.getEnterpriseType()),RptOtherAlarmCleanVehiclesAnalysis::getEnterpriseType,param.getEnterpriseType()) + .orderBy(Boolean.TRUE,Boolean.FALSE, RptOtherAlarmCleanVehiclesAnalysis::getCreateOn); + List list = rptOtherAlarmCleanVehiclesAnalysisService.list(wrapper); + return CollUtils.convert(list,w -> BeanUtil.copyProperties(w,RptOtherAlarmCleanVehiclesAnalysisVO.class)); + } + + public List otherTerminalInstall(RptOtherParamDTO param) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(RptOtherTerminalInstall.class); + wrapper.like(Objects.nonNull(param.getCompanyName()),RptOtherTerminalInstall::getCompanyName,param.getCompanyName()) + .eq(Objects.nonNull(param.getRegionId()),RptOtherTerminalInstall::getRegionId,param.getRegionId()) + .eq(Objects.nonNull(param.getOperatorId()),RptOtherTerminalInstall::getOperatorId,param.getOperatorId()) + .eq(Objects.nonNull(param.getYearMonth()),RptOtherTerminalInstall::getYearMonthly,param.getYearMonth()) + .like(Objects.nonNull(param.getEnterpriseType()),RptOtherTerminalInstall::getEnterpriseType,param.getEnterpriseType()) + .orderBy(Boolean.TRUE,Boolean.FALSE, RptOtherTerminalInstall::getCreateOn); + List list = rptOtherTerminalInstallService.list(wrapper); + return CollUtils.convert(list,w -> BeanUtil.copyProperties(w,RptOtherTerminalInstallVO.class)); + } + + public void specialVehiclesOverSpeedRecordQueryExport + (HttpServletResponse response, RptOtherParamDTO param) { + List collect = otherSpecialOverspeed(param); + String fileName = "专用车辆超速记录查询"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptOtherSpecialOverspeedVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void specialVehiclesTripsRecordQueryExport + (HttpServletResponse response, RptOtherParamDTO param) { + List collect = otherSpecialTrips(param); + String fileName = "专用车辆趟次记录查询导出"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptOtherSpecialTripsVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void enterpriseVehiclesTripsRecordQueryExport + (HttpServletResponse response, RptOtherParamDTO param) { + List collect = otherCompanyTrips(param); + String fileName = "企业车辆趟次记录查询"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptOtherCompanyTripsVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void vehiclesOnlineStatisticsReportExport + (HttpServletResponse response, RptOtherParamDTO param) { + List collect = otherOnlineVehicles(param); + String fileName = "车辆上线情况统计报表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptOtherOnlineVehiclesVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void vehiclesCrossDomainStatisticsReportExport(HttpServletResponse response, RptOtherParamDTO param) { + List collect = otherCrossDomainVehicles(param); + String fileName = "车辆跨域情况统计报表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptOtherCrossDomainVehiclesVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void vehiclesAlarmClearStatisticsReportExport + (HttpServletResponse response, RptOtherParamDTO param) { + List collect = otherAlarmCleanVehicles(param); + String fileName = "车辆报警清理统计报表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptOtherAlarmCleanVehiclesVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void vehiclesOnlineSituationAnnulusAnalysisReportExport + (HttpServletResponse response, RptOtherParamDTO param) { + List collect = otherOnlineAnalysisVehicles(param); + String fileName = "车辆上线情况同比环比分析"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptOtherOnlineVehiclesAnalysisVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void vehiclesAlarmSituationAnnulusAnalysisReportExport + (HttpServletResponse response, RptOtherParamDTO param) { + List collect = otherAlarmAnalysisVehicles(param); + String fileName = "车辆报警情况同比环比分析"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptOtherAlarmCleanVehiclesAnalysisVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void vehiclesCrossDomainSituationAnnulusAnalysisReportExport + (HttpServletResponse response, RptOtherParamDTO param) { + List collect = otherCrossDomainAnalysisVehicles(param); + String fileName = "车辆跨域情况同比环比分析"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptOtherCrossDomainVehiclesAnalysisVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void enterpriseVehiclesCarTerminalInstallationRateReportExport + (HttpServletResponse response, RptOtherParamDTO param) { + List collect = otherTerminalInstall(param); + String fileName = "企业车辆车载终端安装率统计"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptOtherTerminalInstallVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + //public void nineAreasVehiclesOnlineStatisticsReportExport + // (HttpServletResponse response, RptOtherParamDTO param) { + // List collect = otherOnlineVehicles(param); + // String fileName = "9地区车辆上线情况统计"; + // ExcelDownUtil.setFileName(fileName, response); + // // 数据导出处理函数 + // try { + // EasyExcel.write(response.getOutputStream(), RptOtherOnlineVehiclesVO.class) + // .autoCloseStream(false) + // .registerWriteHandler(ExcelExportStyle.formalStyle()) + // .sheet(fileName) + // .doWrite(collect); + // } catch (IOException e) { + // throw new RuntimeException(e); + // } + //} +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/manage/RptTendaysManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/manage/RptTendaysManage.java new file mode 100644 index 0000000..f4c2480 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/manage/RptTendaysManage.java @@ -0,0 +1,158 @@ +package com.ningdatech.carapi.car.rpt.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.StopWatch; +import com.alibaba.excel.EasyExcel; +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.basic.util.CollUtils; +import com.ningdatech.carapi.car.rpt.entity.RptTendaysSpecialOfflineWeek; +import com.ningdatech.carapi.car.rpt.entity.RptTendaysSpecialOverspeedCompany; +import com.ningdatech.carapi.car.rpt.entity.RptTendaysSpecialOverspeedVehicles; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOfflineWeekSpecialParamDTO; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOverspeedSpecialCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOverspeedSpecialVehiclesParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptTendaysSpecialOfflineWeekPO; +import com.ningdatech.carapi.car.rpt.model.po.RptTendaysSpecialOverspeedCompanyPO; +import com.ningdatech.carapi.car.rpt.model.po.RptTendaysSpecialOverspeedVehiclesPO; +import com.ningdatech.carapi.car.rpt.model.vo.RptTendaysSpecialOfflineWeekVO; +import com.ningdatech.carapi.car.rpt.model.vo.RptTendaysSpecialOverspeedCompanyVO; +import com.ningdatech.carapi.car.rpt.model.vo.RptTendaysSpecialOverspeedVehiclesVO; +import com.ningdatech.carapi.car.rpt.service.IRptTendaysSpecialOfflineWeekService; +import com.ningdatech.carapi.car.rpt.service.IRptTendaysSpecialOverspeedCompanyService; +import com.ningdatech.carapi.car.rpt.service.IRptTendaysSpecialOverspeedVehiclesService; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAdjusters; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +/** + * @Classname RptManage + * @Description + * @Date 2022/11/8 17:03 + * @Created by PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class RptTendaysManage { + private final IRptTendaysSpecialOverspeedCompanyService rptTendaysSpecialOverspeedCompanyService; + private final IRptTendaysSpecialOverspeedVehiclesService rptTendaysSpecialOverspeedVehiclesService; + private final IRptTendaysSpecialOfflineWeekService rptTendaysSpecialOfflineWeekService; + + + public List tendaysSpecialOverspeedCompany(RptTendaysOverspeedSpecialCompanyParamDTO param) { + //包装本旬和上旬时间 + CodeUtil.buildCurrentTendaysStartEnd(param); + CodeUtil.buildLastTendaysStartEnd(param); + List list = rptTendaysSpecialOverspeedCompanyService.report(param); + return CollUtils.convert(list,w -> { + RptTendaysSpecialOverspeedCompanyVO vo = BeanUtil.copyProperties(w, + RptTendaysSpecialOverspeedCompanyVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public List tendaysSpecialOverspeedVehicles(RptTendaysOverspeedSpecialVehiclesParamDTO param) { + //包装本旬和上旬时间 + CodeUtil.buildCurrentTendaysStartEnd(param); + CodeUtil.buildLastTendaysStartEnd(param); + List list = rptTendaysSpecialOverspeedVehiclesService.report(param); + return CollUtils.convert(list,w -> { + RptTendaysSpecialOverspeedVehiclesVO vo = BeanUtil.copyProperties(w, + RptTendaysSpecialOverspeedVehiclesVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public List tendaysSpecialOfflineWeek(RptTendaysOfflineWeekSpecialParamDTO param) { + //包装本旬和上旬时间 + CodeUtil.buildCurrentTendaysStartEnd(param); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + Page page = param.page(); + Page pageList = rptTendaysSpecialOfflineWeekService.reportPage(page,param); + if(0L == pageList.getTotal()){ + return Collections.emptyList(); + } + stopWatch.stop(); + log.info("时间1 {}",stopWatch.getTotalTimeSeconds()); + return CollUtils.convert(pageList.getRecords(),w -> { + RptTendaysSpecialOfflineWeekVO vo = BeanUtil.copyProperties(w, + RptTendaysSpecialOfflineWeekVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public void specialVehiclesEnterpriseSortingTenDaysReportExport + (HttpServletResponse response, RptTendaysOverspeedSpecialCompanyParamDTO param) { + List collect = tendaysSpecialOverspeedCompany(param); + String fileName = "全省专用车辆企业排序表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptTendaysSpecialOverspeedCompanyVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + + public void enterpriseSpecialVehiclesSortingTenDaysReportExport + (HttpServletResponse response, RptTendaysOverspeedSpecialVehiclesParamDTO param) { + List collect = tendaysSpecialOverspeedVehicles(param); + String fileName = "企业专用车辆车辆排序表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptTendaysSpecialOverspeedVehiclesVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void specialVehiclesOfflineWeekTenDaysReportExport + (HttpServletResponse response, RptTendaysOfflineWeekSpecialParamDTO param) { + List collect = tendaysSpecialOfflineWeek(param); + String fileName = "全省一周以上不上线的专用车辆排序"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), RptTendaysSpecialOfflineWeekVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOperatorVehiclesLaunchRateMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOperatorVehiclesLaunchRateMapper.java new file mode 100644 index 0000000..2e58286 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOperatorVehiclesLaunchRateMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptDailyOperatorVehiclesLaunchRate; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailyOperatorVehiclesLaunchRateParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailyOperatorVehiclesLaunchRatePO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 运营商车辆上线率日报 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface RptDailyOperatorVehiclesLaunchRateMapper extends BaseMapper { + + List report(@Param("po") RptDailyOperatorVehiclesLaunchRateParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOperatorVehiclesLaunchRateMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOperatorVehiclesLaunchRateMapper.xml new file mode 100644 index 0000000..3be058d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOperatorVehiclesLaunchRateMapper.xml @@ -0,0 +1,39 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOverspeedCompanyMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOverspeedCompanyMapper.java new file mode 100644 index 0000000..6f0e50b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOverspeedCompanyMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptDailyOverspeedCompany; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailyOverspeedCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailyOverspeedCompanyPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 超速企业情况日报 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface RptDailyOverspeedCompanyMapper extends BaseMapper { + + List report(@Param("param") RptDailyOverspeedCompanyParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOverspeedCompanyMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOverspeedCompanyMapper.xml new file mode 100644 index 0000000..7152176 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOverspeedCompanyMapper.xml @@ -0,0 +1,58 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOverspeedSpecialVehiclesMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOverspeedSpecialVehiclesMapper.java new file mode 100644 index 0000000..b25fd9c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOverspeedSpecialVehiclesMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptDailyOverspeedSpecialVehicles; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailyOverspeedSpecialVehiclesParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailyOverspeedSpecialVehiclesPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 超速专用车辆日报 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface RptDailyOverspeedSpecialVehiclesMapper extends BaseMapper { + + List report(@Param("param") RptDailyOverspeedSpecialVehiclesParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOverspeedSpecialVehiclesMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOverspeedSpecialVehiclesMapper.xml new file mode 100644 index 0000000..a58b461 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailyOverspeedSpecialVehiclesMapper.xml @@ -0,0 +1,62 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesCompanyLaunchRate60Mapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesCompanyLaunchRate60Mapper.java new file mode 100644 index 0000000..b0a29e6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesCompanyLaunchRate60Mapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptDailySpecialVehiclesCompanyLaunchRate60; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailySpecialVehiclesCompanyLaunchRateParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailySpecialVehiclesCompanyLaunchRate60PO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 专用车辆企业上线率低于60日报 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface RptDailySpecialVehiclesCompanyLaunchRate60Mapper extends BaseMapper { + + List report(@Param("param") RptDailySpecialVehiclesCompanyLaunchRateParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesCompanyLaunchRate60Mapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesCompanyLaunchRate60Mapper.xml new file mode 100644 index 0000000..8712455 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesCompanyLaunchRate60Mapper.xml @@ -0,0 +1,72 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesLaunchRateMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesLaunchRateMapper.java new file mode 100644 index 0000000..2716301 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesLaunchRateMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptDailySpecialVehiclesLaunchRate; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailySpecialVehiclesLaunchRateParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailySpecialVehiclesLaunchRatePO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 专用车辆上线率日报 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface RptDailySpecialVehiclesLaunchRateMapper extends BaseMapper { + + List report(@Param("po") RptDailySpecialVehiclesLaunchRateParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesLaunchRateMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesLaunchRateMapper.xml new file mode 100644 index 0000000..5311eef --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesLaunchRateMapper.xml @@ -0,0 +1,73 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesOverspeedMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesOverspeedMapper.java new file mode 100644 index 0000000..9de574b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesOverspeedMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptDailySpecialVehiclesOverspeed; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailySpecialVehiclesOverspeedParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailySpecialVehiclesOverspeedPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 专用车辆超速日报 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface RptDailySpecialVehiclesOverspeedMapper extends BaseMapper { + + List report(@Param("param") RptDailySpecialVehiclesOverspeedParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesOverspeedMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesOverspeedMapper.xml new file mode 100644 index 0000000..88f62d3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptDailySpecialVehiclesOverspeedMapper.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedCompanyMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedCompanyMapper.java new file mode 100644 index 0000000..80341c5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedCompanyMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptMonthOverspeedCompany; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthOverspeedCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthOverspeedCompanyPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 超速企业情况月报 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptMonthOverspeedCompanyMapper extends BaseMapper { + + List report(@Param("param") RptMonthOverspeedCompanyParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedCompanyMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedCompanyMapper.xml new file mode 100644 index 0000000..62e6d6a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedCompanyMapper.xml @@ -0,0 +1,72 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedSpecialCompanyMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedSpecialCompanyMapper.java new file mode 100644 index 0000000..1205ad3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedSpecialCompanyMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptMonthOverspeedSpecialCompany; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOverspeedCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthSpecialVehiclesOverspeedPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 专用车辆超速企业情况月报 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptMonthOverspeedSpecialCompanyMapper extends BaseMapper { + + List report(@Param("param") RptMonthSpecialOverspeedCompanyParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedSpecialCompanyMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedSpecialCompanyMapper.xml new file mode 100644 index 0000000..6efed2a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedSpecialCompanyMapper.xml @@ -0,0 +1,70 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedSpecialVehiclesMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedSpecialVehiclesMapper.java new file mode 100644 index 0000000..5d00c92 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedSpecialVehiclesMapper.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptMonthOverspeedSpecialVehicles; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOverspeedVehiclesParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthOverspeedSpecialVehiclesPO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthSpecialOfflinePO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 专用车辆超速月对比 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptMonthOverspeedSpecialVehiclesMapper extends BaseMapper { + + List reportPage(Page page, @Param("param") RptMonthSpecialOverspeedVehiclesParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedSpecialVehiclesMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedSpecialVehiclesMapper.xml new file mode 100644 index 0000000..4fe7507 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthOverspeedSpecialVehiclesMapper.xml @@ -0,0 +1,56 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthSpecialOfflineMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthSpecialOfflineMapper.java new file mode 100644 index 0000000..a37f8df --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthSpecialOfflineMapper.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptMonthSpecialOffline; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOfflineParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthSpecialOfflinePO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 专用车辆不上线月报 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptMonthSpecialOfflineMapper extends BaseMapper { + + List reportPage(Page page, @Param("param") RptMonthSpecialOfflineParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthSpecialOfflineMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthSpecialOfflineMapper.xml new file mode 100644 index 0000000..5f94365 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptMonthSpecialOfflineMapper.xml @@ -0,0 +1,86 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherAlarmCleanVehiclesAnalysisMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherAlarmCleanVehiclesAnalysisMapper.java new file mode 100644 index 0000000..0ed385b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherAlarmCleanVehiclesAnalysisMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherAlarmCleanVehiclesAnalysis; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 车辆报警清理分析表 其它报表 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptOtherAlarmCleanVehiclesAnalysisMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherAlarmCleanVehiclesAnalysisMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherAlarmCleanVehiclesAnalysisMapper.xml new file mode 100644 index 0000000..c25b8bd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherAlarmCleanVehiclesAnalysisMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherAlarmCleanVehiclesMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherAlarmCleanVehiclesMapper.java new file mode 100644 index 0000000..821fe17 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherAlarmCleanVehiclesMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptOtherAlarmCleanVehicles; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherAlarmCleanVehiclesPO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 车辆报警清理表 其它报表 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptOtherAlarmCleanVehiclesMapper extends BaseMapper { + + Page reportPage(Page page, + @Param("param") RptOtherParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherAlarmCleanVehiclesMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherAlarmCleanVehiclesMapper.xml new file mode 100644 index 0000000..8dd7bac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherAlarmCleanVehiclesMapper.xml @@ -0,0 +1,61 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherCrossDomainVehiclesAnalysisMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherCrossDomainVehiclesAnalysisMapper.java new file mode 100644 index 0000000..ef1a813 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherCrossDomainVehiclesAnalysisMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherCrossDomainVehiclesAnalysis; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 车辆跨域情况分析表 其它报表 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptOtherCrossDomainVehiclesAnalysisMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherCrossDomainVehiclesAnalysisMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherCrossDomainVehiclesAnalysisMapper.xml new file mode 100644 index 0000000..c3eeac9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherCrossDomainVehiclesAnalysisMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherCrossDomainVehiclesMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherCrossDomainVehiclesMapper.java new file mode 100644 index 0000000..640bcfa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherCrossDomainVehiclesMapper.java @@ -0,0 +1,26 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptOtherCrossDomainVehicles; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherCrossDomainVehiclesPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 车辆跨域情况表 其它报表 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptOtherCrossDomainVehiclesMapper extends BaseMapper { + + List report(@Param("param") RptOtherParamDTO param); + + Page reportPage(Page page, + @Param("param") RptOtherParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherCrossDomainVehiclesMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherCrossDomainVehiclesMapper.xml new file mode 100644 index 0000000..c979bf0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherCrossDomainVehiclesMapper.xml @@ -0,0 +1,103 @@ + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherOnlineVehiclesAnalysisMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherOnlineVehiclesAnalysisMapper.java new file mode 100644 index 0000000..855a3b6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherOnlineVehiclesAnalysisMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherOnlineVehiclesAnalysis; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 在线车辆统计分析表 其它报表 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptOtherOnlineVehiclesAnalysisMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherOnlineVehiclesAnalysisMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherOnlineVehiclesAnalysisMapper.xml new file mode 100644 index 0000000..f9d3a1d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherOnlineVehiclesAnalysisMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherOnlineVehiclesMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherOnlineVehiclesMapper.java new file mode 100644 index 0000000..f348020 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherOnlineVehiclesMapper.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptOtherOnlineVehicles; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherOnlineVehiclesPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 在线车辆统计表 其它报表 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptOtherOnlineVehiclesMapper extends BaseMapper { + + List report(@Param("param") RptOtherParamDTO param); + + Page reportPage(Page page, @Param("param") RptOtherParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherOnlineVehiclesMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherOnlineVehiclesMapper.xml new file mode 100644 index 0000000..f6daa5a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherOnlineVehiclesMapper.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherSpecialOverspeedMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherSpecialOverspeedMapper.java new file mode 100644 index 0000000..360a9de --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherSpecialOverspeedMapper.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptOtherSpecialOverspeed; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherSpecialOverspeedPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 专用车辆超速记录 其它报表 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptOtherSpecialOverspeedMapper extends BaseMapper { + + List report(@Param("param") RptOtherParamDTO param); + + Page reportPage(Page page,@Param("param") RptOtherParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherSpecialOverspeedMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherSpecialOverspeedMapper.xml new file mode 100644 index 0000000..c7c0b1f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherSpecialOverspeedMapper.xml @@ -0,0 +1,119 @@ + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherSpecialTripsMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherSpecialTripsMapper.java new file mode 100644 index 0000000..d9ec1a9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherSpecialTripsMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherSpecialTrips; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 专用车辆趟次记录 其它报表 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptOtherSpecialTripsMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherSpecialTripsMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherSpecialTripsMapper.xml new file mode 100644 index 0000000..ec67cac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherSpecialTripsMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherTerminalInstallMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherTerminalInstallMapper.java new file mode 100644 index 0000000..d463d48 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherTerminalInstallMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherTerminalInstall; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 终端车载安装统计 其它报表 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptOtherTerminalInstallMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherTerminalInstallMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherTerminalInstallMapper.xml new file mode 100644 index 0000000..0accaac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptOtherTerminalInstallMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOfflineWeekMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOfflineWeekMapper.java new file mode 100644 index 0000000..1c2f95a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOfflineWeekMapper.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptTendaysSpecialOfflineWeek; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOfflineWeekSpecialParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptTendaysSpecialOfflineWeekPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 专用车辆一周以上不上线旬报 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptTendaysSpecialOfflineWeekMapper extends BaseMapper { + + List report(@Param("param") RptTendaysOfflineWeekSpecialParamDTO param); + + Page reportPage(Page page,@Param("param") RptTendaysOfflineWeekSpecialParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOfflineWeekMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOfflineWeekMapper.xml new file mode 100644 index 0000000..0b3ccd3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOfflineWeekMapper.xml @@ -0,0 +1,107 @@ + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOverspeedCompanyMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOverspeedCompanyMapper.java new file mode 100644 index 0000000..2969912 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOverspeedCompanyMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptTendaysSpecialOverspeedCompany; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOverspeedSpecialCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptTendaysSpecialOverspeedCompanyPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 专用车辆超速企业情况旬报 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptTendaysSpecialOverspeedCompanyMapper extends BaseMapper { + + List report(@Param("param") RptTendaysOverspeedSpecialCompanyParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOverspeedCompanyMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOverspeedCompanyMapper.xml new file mode 100644 index 0000000..34b512e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOverspeedCompanyMapper.xml @@ -0,0 +1,49 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOverspeedVehiclesMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOverspeedVehiclesMapper.java new file mode 100644 index 0000000..63cd232 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOverspeedVehiclesMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.rpt.mapper; + +import com.ningdatech.carapi.car.rpt.entity.RptTendaysSpecialOverspeedVehicles; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOverspeedSpecialVehiclesParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptTendaysSpecialOverspeedVehiclesPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 专用车辆超速车辆情况旬报 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface RptTendaysSpecialOverspeedVehiclesMapper extends BaseMapper { + + List report(@Param("param") RptTendaysOverspeedSpecialVehiclesParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOverspeedVehiclesMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOverspeedVehiclesMapper.xml new file mode 100644 index 0000000..ea81ce6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/mapper/RptTendaysSpecialOverspeedVehiclesMapper.xml @@ -0,0 +1,52 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailyOperatorVehiclesLaunchRateParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailyOperatorVehiclesLaunchRateParamDTO.java new file mode 100644 index 0000000..5bfbca6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailyOperatorVehiclesLaunchRateParamDTO.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.util.NdDateUtils; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +/** + * @Classname RptDailyOperatorVehiclesLaunchRateParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptDailyOperatorVehiclesLaunchRateParamDTO implements Serializable { + + @ApiModelProperty("日期") + private String date; + + private String dataScopeSql; + + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailyOverspeedCompanyParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailyOverspeedCompanyParamDTO.java new file mode 100644 index 0000000..5173780 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailyOverspeedCompanyParamDTO.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.util.NdDateUtils; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.models.auth.In; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Classname RptDailyOverspeedCompanyParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptDailyOverspeedCompanyParamDTO implements Serializable { + + @ApiModelProperty("日期") + private String date; + + @ApiModelProperty("排名") + private Integer rank; + + private Integer startRate; + private Integer endRate; + private String dataScopeSql; + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailyOverspeedSpecialVehiclesParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailyOverspeedSpecialVehiclesParamDTO.java new file mode 100644 index 0000000..97c7083 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailyOverspeedSpecialVehiclesParamDTO.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.util.NdDateUtils; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Classname RptDailyOverspeedSpecialVehiclesParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptDailyOverspeedSpecialVehiclesParamDTO implements Serializable { + + @ApiModelProperty("日期") + private String date; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("开始超速率") + private Integer startRate; + + @ApiModelProperty("结束超速率") + private Integer endRate; + + private String dataScopeSql; + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailySpecialVehiclesCompanyLaunchRateParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailySpecialVehiclesCompanyLaunchRateParamDTO.java new file mode 100644 index 0000000..d56d69c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailySpecialVehiclesCompanyLaunchRateParamDTO.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.util.NdDateUtils; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Classname RptDailySpecialVehiclesCompanyLaunchRateParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptDailySpecialVehiclesCompanyLaunchRateParamDTO implements Serializable { + + @ApiModelProperty("日期") + private String date; + + @ApiModelProperty("区域ID") + private Long regionId; + private List regionIds; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("上线率") + private Integer launchRate; + + private String dataScopeSql; + + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailySpecialVehiclesLaunchRateParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailySpecialVehiclesLaunchRateParamDTO.java new file mode 100644 index 0000000..1590616 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailySpecialVehiclesLaunchRateParamDTO.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.sys.contants.RegionContant; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +/** + * @Classname RptDailySpecialVehiclesLaunchRateParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptDailySpecialVehiclesLaunchRateParamDTO implements Serializable { + + @ApiModelProperty("日期") + @NotNull(message = "请选择日期") + private String date; + + @ApiModelProperty("区域ID") + private Long regionId; + private Integer regionLevel; + private List regionIds; + + private String dataScopeSql; + + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + + public Long getRegionId(){ + if(Objects.isNull(this.regionId)){ + this.regionId = RegionContant.ZJ_REGION_ID; + return this.regionId; + } + return this.regionId; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailySpecialVehiclesOverspeedParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailySpecialVehiclesOverspeedParamDTO.java new file mode 100644 index 0000000..ecd86ab --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptDailySpecialVehiclesOverspeedParamDTO.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.util.NdDateUtils; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Classname RptDailySpecialVehiclesOverspeedParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptDailySpecialVehiclesOverspeedParamDTO implements Serializable { + + @ApiModelProperty("日期") + private String date; + + private String dataScopeSql; + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptMonthOverspeedCompanyParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptMonthOverspeedCompanyParamDTO.java new file mode 100644 index 0000000..c2eb75c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptMonthOverspeedCompanyParamDTO.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.util.NdDateUtils; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * @Classname RptDailyOverspeedSpecialVehiclesParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptMonthOverspeedCompanyParamDTO implements Serializable { + + @ApiModelProperty("起始时间") + @NotNull(message = "请选择起始时间") + private String startTime; + + @ApiModelProperty("结束时间") + @NotNull(message = "请选择结束时间") + private String endTime; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("开始超速率") + private Integer startRate; + + @ApiModelProperty("结束超速率") + private Integer endRate; + + private String dataScopeSql; + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptMonthSpecialOfflineParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptMonthSpecialOfflineParamDTO.java new file mode 100644 index 0000000..94dc85b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptMonthSpecialOfflineParamDTO.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.basic.util.NdDateUtils; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * @author CMM + * @Classname RptDailyOverspeedSpecialVehiclesParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptMonthSpecialOfflineParamDTO extends PagePo implements Serializable { + + @ApiModelProperty("起始时间") + @NotNull(message = "请选择起始时间") + private String startTime; + + @ApiModelProperty("结束时间") + @NotNull(message = "请选择结束时间") + private String endTime; + + @ApiModelProperty("不上线天数") + private Integer offlineDays; + + private String dataScopeSql; + + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptMonthSpecialOverspeedCompanyParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptMonthSpecialOverspeedCompanyParamDTO.java new file mode 100644 index 0000000..bfd3fff --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptMonthSpecialOverspeedCompanyParamDTO.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.util.NdDateUtils; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * @author CMM + * @Classname RptDailyOverspeedSpecialVehiclesParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptMonthSpecialOverspeedCompanyParamDTO implements Serializable { + + private static final long serialVersionUID = 9172042172933510469L; + + @ApiModelProperty("起始时间") + @NotNull(message = "请选择起始时间") + private String startTime; + + @ApiModelProperty("结束时间") + @NotNull(message = "请选择结束时间") + private String endTime; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("开始超速率") + private Integer startRate; + + @ApiModelProperty("结束超速率") + private Integer endRate; + + private String dataScopeSql; + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptMonthSpecialOverspeedVehiclesParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptMonthSpecialOverspeedVehiclesParamDTO.java new file mode 100644 index 0000000..8d99a4a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptMonthSpecialOverspeedVehiclesParamDTO.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.basic.util.NdDateUtils; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * @Classname RptDailyOverspeedSpecialVehiclesParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptMonthSpecialOverspeedVehiclesParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = -7253421068317400397L; + @ApiModelProperty("起始时间") + @NotNull(message = "请选择起始时间") + private String startTime; + + @ApiModelProperty("结束时间") + @NotNull(message = "请选择结束时间") + private String endTime; + + @ApiModelProperty("上月开始时间") + private String lastMonthStartTime; + + @ApiModelProperty("上月结束时间") + private String lastMonthEndTime; + + @ApiModelProperty("开始超速率") + private Integer startRate; + + @ApiModelProperty("结束超速率") + private Integer endRate; + + private String dataScopeSql; + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptOtherParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptOtherParamDTO.java new file mode 100644 index 0000000..d95cf9b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptOtherParamDTO.java @@ -0,0 +1,85 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.sys.contants.RegionContant; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.*; + +/** + * @Classname RptOtherParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptOtherParamDTO extends PagePo implements Serializable { + + @ApiModelProperty("区域ID") + private Long regionId; + private List regionIds; + private Integer regionLevel; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("车辆类别") + private Integer vehicleType; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("报警类别") + private Integer alarmType; + + @ApiModelProperty("企业类型") + private String enterpriseType; + private List enterpriseTypes; + + @ApiModelProperty("运营商") + private String operatorName; + + @ApiModelProperty("开始时间") + private String startTime; + + @ApiModelProperty("结束时间") + private String endTime; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("开始速率") + private String startRate; + + @ApiModelProperty("结束速率") + private String endRate; + + @ApiModelProperty("年月") + private String yearMonth; + + private String dataScopeSql; + + public Long getRegionId(){ + if(Objects.isNull(this.regionId)){ + this.regionId = RegionContant.ZJ_REGION_ID; + return this.regionId; + } + return this.regionId; + } + + public List getEnterpriseTypes(){ + if(StringUtils.isNotBlank(this.enterpriseType)){ + this.enterpriseTypes = Arrays.asList(this.enterpriseType.split(StrPool.COMMA)); + return this.enterpriseTypes; + } + return Collections.emptyList(); + } + + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptTendaysOfflineWeekSpecialParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptTendaysOfflineWeekSpecialParamDTO.java new file mode 100644 index 0000000..98b9951 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptTendaysOfflineWeekSpecialParamDTO.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.basic.util.NdDateUtils; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +/** + * @Classname RptDailyOverspeedSpecialVehiclesParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptTendaysOfflineWeekSpecialParamDTO extends PagePo implements Serializable { + + @ApiModelProperty("月份") + @NotNull(message = "请选择月份") + @DateTimeFormat(pattern = "yyyy-MM") + private String month; + + @ApiModelProperty("类型 1上旬 2中旬 3下旬") + @NotNull(message = "请选择旬") + private Integer type; + + private LocalDateTime startTime; + private LocalDateTime endTime; + private LocalDateTime lastStartTime; + private LocalDateTime lastEndTime; + private String dataScopeSql; + + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptTendaysOverspeedSpecialCompanyParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptTendaysOverspeedSpecialCompanyParamDTO.java new file mode 100644 index 0000000..d02ede0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptTendaysOverspeedSpecialCompanyParamDTO.java @@ -0,0 +1,49 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.util.NdDateUtils; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.checkerframework.checker.formatter.qual.Format; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +/** + * @Classname RptDailyOverspeedSpecialVehiclesParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptTendaysOverspeedSpecialCompanyParamDTO implements Serializable { + + @ApiModelProperty("月份") + @NotNull(message = "请选择月份") + @DateTimeFormat(pattern = "yyyy-MM") + private String month; + + @ApiModelProperty("类型 1上旬 2中旬 3下旬") + @NotNull(message = "请选择旬") + private Integer type; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("开始超速率") + private Integer startRate; + + @ApiModelProperty("结束超速率") + private Integer endRate; + + private LocalDateTime startTime; + private LocalDateTime endTime; + private LocalDateTime lastStartTime; + private LocalDateTime lastEndTime; + private String dataScopeSql; + + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptTendaysOverspeedSpecialVehiclesParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptTendaysOverspeedSpecialVehiclesParamDTO.java new file mode 100644 index 0000000..a6766f6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/dto/RptTendaysOverspeedSpecialVehiclesParamDTO.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.car.rpt.model.dto; + +import com.ningdatech.basic.util.NdDateUtils; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +/** + * @Classname RptDailyOverspeedSpecialVehiclesParamDTO + * @Description + * @Date 2022/11/8 17:06 + * @Created by PoffyZhang + */ +@Data +public class RptTendaysOverspeedSpecialVehiclesParamDTO implements Serializable { + + @ApiModelProperty("月份") + @NotNull(message = "请选择月份") + @DateTimeFormat(pattern = "yyyy-MM") + private String month; + + @ApiModelProperty("类型 1上旬 2中旬 3下旬") + @NotNull(message = "请选择旬") + private Integer type; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("开始超速率") + private Integer startRate; + + @ApiModelProperty("结束超速率") + private Integer endRate; + + private LocalDateTime startTime; + private LocalDateTime endTime; + private LocalDateTime lastStartTime; + private LocalDateTime lastEndTime; + private String dataScopeSql; + + private String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailyOperatorVehiclesLaunchRatePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailyOperatorVehiclesLaunchRatePO.java new file mode 100644 index 0000000..94006aa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailyOperatorVehiclesLaunchRatePO.java @@ -0,0 +1,65 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 运营商车辆上线率日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Data +@ApiModel(value = "RptDailyOperatorVehiclesLaunchRatePO", description = "运营商车辆上线率日报") +public class RptDailyOperatorVehiclesLaunchRatePO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("监控车辆数") + @ExcelProperty("监控车辆数") + private Long monitoredVehicleNums; + + @ApiModelProperty("未监控车辆数") + @ExcelProperty("未监控车辆数") + private Long unmonitoredVehicleNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal launchRate; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailyOverspeedCompanyPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailyOverspeedCompanyPO.java new file mode 100644 index 0000000..4821094 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailyOverspeedCompanyPO.java @@ -0,0 +1,61 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 超速企业情况日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Data +@ApiModel(value = "RptDailyOverspeedCompanyPO", description = "超速企业情况日报") +public class RptDailyOverspeedCompanyPO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("超速车辆总数") + private Long overspeedVehicleNums; + + @ApiModelProperty("超速率") + private BigDecimal overspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailyOverspeedSpecialVehiclesPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailyOverspeedSpecialVehiclesPO.java new file mode 100644 index 0000000..58c2e3d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailyOverspeedSpecialVehiclesPO.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 超速专用车辆日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Data +@ApiModel(value = "RptDailyOverspeedSpecialVehiclesPO", description = "超速专用车辆日报") +public class RptDailyOverspeedSpecialVehiclesPO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + @ExcelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("超速%20-50%次数") + @ExcelProperty("超速20%-50%次数") + private Long overspeed2050Times; + + @ApiModelProperty("超速50以上 次数") + @ExcelProperty("超速50以上 次数") + private Long overspeed50Times; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("总超速次数") + @ExcelProperty("总超速次数") + private Long overspeedTotalTimes; + + @ApiModelProperty("比例") + @ExcelProperty("比例") + private BigDecimal rate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailySpecialVehiclesCompanyLaunchRate60PO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailySpecialVehiclesCompanyLaunchRate60PO.java new file mode 100644 index 0000000..b0b9214 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailySpecialVehiclesCompanyLaunchRate60PO.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆企业上线率低于60日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Data +@ApiModel(value = "RptDailySpecialVehiclesCompanyLaunchRate60PO", description = "专用车辆企业上线率低于60日报") +public class RptDailySpecialVehiclesCompanyLaunchRate60PO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("监控车辆数") + @ExcelProperty("监控车辆数") + private Long monitoredVehicleNums; + + @ApiModelProperty("未监控车辆数") + @ExcelProperty("未监控车辆数") + private Long unmonitoredVehicleNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal launchRate; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("企业id") + @ExcelProperty("企业id") + private Long companyId; + + @ApiModelProperty("企业名") + @ExcelProperty("企业名") + private String companyName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailySpecialVehiclesLaunchRatePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailySpecialVehiclesLaunchRatePO.java new file mode 100644 index 0000000..dab9072 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailySpecialVehiclesLaunchRatePO.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆上线率日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@ApiModel(value = "RptDailySpecialVehiclesLaunchRatePO", description = "专用车辆上线率日报") +@Data +public class RptDailySpecialVehiclesLaunchRatePO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("监控车辆数") + @ExcelProperty("监控车辆数") + private Long monitoredVehicleNums; + + @ApiModelProperty("未监控车辆数") + @ExcelProperty("未监控车辆数") + private Long unmonitoredVehicleNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal launchRate; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商Id") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域Id") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailySpecialVehiclesOverspeedPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailySpecialVehiclesOverspeedPO.java new file mode 100644 index 0000000..cf9d960 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptDailySpecialVehiclesOverspeedPO.java @@ -0,0 +1,52 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆超速日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@ApiModel(value = "RptDailySpecialVehiclesOverspeedPO", description = "专用车辆超速日报") +@Data +public class RptDailySpecialVehiclesOverspeedPO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("20%-50%车辆数") + @ExcelProperty("20%-50%车辆数") + private Long overspeed2050VehicleNums; + + @ApiModelProperty("超速50%以上的车辆") + @ExcelProperty("超速50%以上的车辆") + private Long overspeed50VehicleNums; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptMonthOverspeedCompanyPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptMonthOverspeedCompanyPO.java new file mode 100644 index 0000000..a8843b4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptMonthOverspeedCompanyPO.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 超速企业情况月报 + * @author CMM + * @description + * @since 2022/12/09 17:13 + */ +@Data +public class RptMonthOverspeedCompanyPO { + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("超速车辆总数") + private Long overspeedVehicleNums; + + @ApiModelProperty("超速次数") + private Long overspeedTimes; + + @ApiModelProperty("超速率") + private BigDecimal overspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptMonthOverspeedSpecialVehiclesPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptMonthOverspeedSpecialVehiclesPO.java new file mode 100644 index 0000000..b4c493b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptMonthOverspeedSpecialVehiclesPO.java @@ -0,0 +1,12 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import lombok.Data; + +/** + * @author CMM + * @description + * @since 2022/12/13 15:09 + */ +@Data +public class RptMonthOverspeedSpecialVehiclesPO { +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptMonthSpecialOfflinePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptMonthSpecialOfflinePO.java new file mode 100644 index 0000000..88467dc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptMonthSpecialOfflinePO.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @author CMM + * @description + * @since 2022/12/12 17:46 + */ +@Data +@ApiModel(value = "RptMonthSpecialOfflinePO", description = "专用车辆不上线月报") +public class RptMonthSpecialOfflinePO implements Serializable { + + private static final long serialVersionUID = -5951994953374490890L; + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("未上线天数") + @ExcelProperty("未上线天数") + private Integer offlineDays; + + //@ApiModelProperty("未上线车辆数") + //@ExcelProperty("未上线车辆数") + //private Long offlineVehicleNums; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名称") + @ExcelProperty("运营商名称") + private String operatorName; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptMonthSpecialVehiclesOverspeedPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptMonthSpecialVehiclesOverspeedPO.java new file mode 100644 index 0000000..25cf4f0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptMonthSpecialVehiclesOverspeedPO.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @author CMM + * @description + * @since 2022/12/12 12:00 + */ +@Data +public class RptMonthSpecialVehiclesOverspeedPO implements Serializable { + + private static final long serialVersionUID = -1510410272441829172L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("超速次数") + private Long overspeedTimes; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("最高速率") + private BigDecimal maxSpeed; + + @ApiModelProperty("最高超速率") + private BigDecimal maxOverspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptOtherAlarmCleanVehiclesPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptOtherAlarmCleanVehiclesPO.java new file mode 100644 index 0000000..4aac98a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptOtherAlarmCleanVehiclesPO.java @@ -0,0 +1,109 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 车辆报警清理表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherAlarmCleanVehiclesPO", description = "车辆报警清理表 其它报表") +public class RptOtherAlarmCleanVehiclesPO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + @ExcelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + @ExcelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + @ExcelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("报警车总数") + @ExcelProperty("报警车总数") + private Long alarmVehicleNums; + + @ApiModelProperty("报警车辆占比") + @ExcelProperty("报警车辆占比") + private BigDecimal alarmVehicleRate; + + @ApiModelProperty("报警处理总数") + @ExcelProperty("报警处理总数") + private Long alarmProcessNums; + + @ApiModelProperty("报警处理占比") + @ExcelProperty("报警处理占比") + private BigDecimal alarmProcessRate; + + @ApiModelProperty("企业类型") + @ExcelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + @ExcelProperty("企业类型") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptOtherCrossDomainVehiclesPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptOtherCrossDomainVehiclesPO.java new file mode 100644 index 0000000..9a96ea1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptOtherCrossDomainVehiclesPO.java @@ -0,0 +1,125 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 车辆跨域情况表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherCrossDomainVehiclesPO", description = "车辆跨域情况表 其它报表") +public class RptOtherCrossDomainVehiclesPO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + @ExcelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + @ExcelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + @ExcelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("散装水泥车数") + @ExcelProperty("散状水泥车数") + private Long bulkCementTruckNums; + + @ApiModelProperty("散装水泥车占比") + @ExcelProperty("散装水泥车占比") + private BigDecimal bulkCementTruckRate; + + @ApiModelProperty("预拌砂浆车数") + @ExcelProperty("预拌砂浆车数") + private Long readyMixedMortarTruckNums; + + @ApiModelProperty("预拌砂浆车占比") + @ExcelProperty("预拌砂浆车占比") + private BigDecimal readyMixedMortarTruckRate; + + @ApiModelProperty("混凝土搅拌车数") + @ExcelProperty("混凝土搅拌车数") + private Long concreteDeliveryTruckNums; + + @ApiModelProperty("混凝土搅拌车数占比") + @ExcelProperty("混凝土搅拌车数占比") + private BigDecimal concreteDeliveryTruckRate; + + @ApiModelProperty("移动泵车数") + @ExcelProperty("移动泵车数") + private Long mobilePumpTruckNums; + + @ApiModelProperty("移动泵车占比") + @ExcelProperty("移动泵车占比") + private BigDecimal mobilePumpTruckRate; + + @ApiModelProperty("企业类型") + @ExcelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + @ExcelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptOtherOnlineVehiclesPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptOtherOnlineVehiclesPO.java new file mode 100644 index 0000000..e46d368 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptOtherOnlineVehiclesPO.java @@ -0,0 +1,93 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 在线车辆统计表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherOnlineVehiclesPO", description = "在线车辆统计表 其它报表") +public class RptOtherOnlineVehiclesPO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + @ExcelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + @ExcelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + @ExcelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("企业类型") + @ExcelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + @ExcelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptOtherSpecialOverspeedPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptOtherSpecialOverspeedPO.java new file mode 100644 index 0000000..5d32676 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptOtherSpecialOverspeedPO.java @@ -0,0 +1,89 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆超速记录 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherSpecialOverspeedPO", description = "专用车辆超速记录 其它报表") +public class RptOtherSpecialOverspeedPO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("超速开始时间") + @ExcelProperty("超速开始时间") + private LocalDateTime overspeedStartTime; + + @ApiModelProperty("超速结束时间") + @ExcelProperty("超速结束时间") + private LocalDateTime overspeedEndTime; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("限速") + @ExcelProperty("限速") + private BigDecimal limitSpeed; + + @ApiModelProperty("最高速") + @ExcelProperty("最高速") + private BigDecimal maxSpeed; + + @ApiModelProperty("超速率") + @ExcelProperty("超速率") + private Double overspeedRate; + + @ApiModelProperty("持续时间 秒") + @ExcelProperty("持续时间 秒") + private Integer duration; + + @ApiModelProperty("地点") + @ExcelProperty("地点") + private String address; + + @ApiModelProperty("道路") + @ExcelProperty("道路") + private String road; + + @ApiModelProperty("经纬度") + @ExcelProperty("经纬度") + private String longtitudeLatitude; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptTendaysSpecialOfflineWeekPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptTendaysSpecialOfflineWeekPO.java new file mode 100644 index 0000000..958ceab --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptTendaysSpecialOfflineWeekPO.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆一周以上不上线旬报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@ApiModel(value = "RptTendaysSpecialOfflineWeekPO", description = "专用车辆一周以上不上线旬报") +@Data +public class RptTendaysSpecialOfflineWeekPO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("未上线天数") + @ExcelProperty("未上线天数") + private Integer offlineDays; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptTendaysSpecialOverspeedCompanyPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptTendaysSpecialOverspeedCompanyPO.java new file mode 100644 index 0000000..bf26e8f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptTendaysSpecialOverspeedCompanyPO.java @@ -0,0 +1,60 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆超速企业情况旬报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@ApiModel(value = "RptTendaysSpecialOverspeedCompanyPO", description = "专用车辆超速企业情况旬报") +@Data +public class RptTendaysSpecialOverspeedCompanyPO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("当前旬超速次数") + private Long overspeedCurrentTimes; + + @ApiModelProperty("上一旬超速次数") + private Long overspeedLastTimes; + + @ApiModelProperty("超速率") + private BigDecimal overspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptTendaysSpecialOverspeedVehiclesPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptTendaysSpecialOverspeedVehiclesPO.java new file mode 100644 index 0000000..0860229 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/po/RptTendaysSpecialOverspeedVehiclesPO.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.car.rpt.model.po; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆超速车辆情况旬报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@ApiModel(value = "RptTendaysSpecialOverspeedVehiclesPO", description = "专用车辆超速车辆情况旬报") +@Data +public class RptTendaysSpecialOverspeedVehiclesPO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + @ExcelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("当前旬超速次数") + @ExcelProperty("当前旬超速次数") + private Long overspeedCurrentTimes; + + @ApiModelProperty("上一旬超速次数") + @ExcelProperty("上一旬超速次数") + private Long overspeedLastTimes; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("超速率") + @ExcelProperty("超速率") + private BigDecimal overspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailyOperatorVehiclesLaunchRateVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailyOperatorVehiclesLaunchRateVO.java new file mode 100644 index 0000000..305932a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailyOperatorVehiclesLaunchRateVO.java @@ -0,0 +1,65 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 运营商车辆上线率日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Data +@ApiModel(value = "RptDailyOperatorVehiclesLaunchRateVO", description = "运营商车辆上线率日报") +public class RptDailyOperatorVehiclesLaunchRateVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("监控车辆数") + @ExcelProperty("监控车辆数") + private Long monitoredVehicleNums; + + @ApiModelProperty("未监控车辆数") + @ExcelProperty("未监控车辆数") + private Long unmonitoredVehicleNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal launchRate; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailyOverspeedCompanyVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailyOverspeedCompanyVO.java new file mode 100644 index 0000000..4b568af --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailyOverspeedCompanyVO.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 超速企业情况日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Data +@ApiModel(value = "RptDailyOverspeedCompanyVO", description = "超速企业情况日报") +public class RptDailyOverspeedCompanyVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + @ExcelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("超速车辆总数") + @ExcelProperty("超速车辆总数") + private Long overspeedVehicleNums; + + @ApiModelProperty("超速率") + @ExcelProperty("超速率") + private BigDecimal overspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailyOverspeedSpecialVehiclesVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailyOverspeedSpecialVehiclesVO.java new file mode 100644 index 0000000..93986f8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailyOverspeedSpecialVehiclesVO.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 超速专用车辆日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Data +@ApiModel(value = "RptDailyOverspeedSpecialVehiclesVO", description = "超速专用车辆日报") +public class RptDailyOverspeedSpecialVehiclesVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + @ExcelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("超速%20-50%次数") + @ExcelProperty("超速20%-50%次数") + private Long overspeed2050Times; + + @ApiModelProperty("超速50以上 次数") + @ExcelProperty("超速50以上 次数") + private Long overspeed50Times; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("总超速次数") + @ExcelProperty("总超速次数") + private Long overspeedTotalTimes; + + @ApiModelProperty("比例") + @ExcelProperty("比例") + private BigDecimal rate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailySpecialVehiclesCompanyLaunchRate60VO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailySpecialVehiclesCompanyLaunchRate60VO.java new file mode 100644 index 0000000..b30fd65 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailySpecialVehiclesCompanyLaunchRate60VO.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆企业上线率低于60日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Data +@ApiModel(value = "RptDailySpecialVehiclesCompanyLaunchRate60VO", description = "专用车辆企业上线率低于60日报") +public class RptDailySpecialVehiclesCompanyLaunchRate60VO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("监控车辆数") + @ExcelProperty("监控车辆数") + private Long monitoredVehicleNums; + + @ApiModelProperty("未监控车辆数") + @ExcelProperty("未监控车辆数") + private Long unmonitoredVehicleNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal launchRate; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("企业id") + @ExcelProperty("企业id") + private Long companyId; + + @ApiModelProperty("企业名") + @ExcelProperty("企业名") + private String companyName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailySpecialVehiclesLaunchRateVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailySpecialVehiclesLaunchRateVO.java new file mode 100644 index 0000000..a8da724 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailySpecialVehiclesLaunchRateVO.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆上线率日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@ApiModel(value = "RptDailySpecialVehiclesLaunchRateVO", description = "专用车辆上线率日报") +@Data +public class RptDailySpecialVehiclesLaunchRateVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("监控车辆数") + @ExcelProperty("监控车辆数") + private Long monitoredVehicleNums; + + @ApiModelProperty("未监控车辆数") + @ExcelProperty("未监控车辆数") + private Long unmonitoredVehicleNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal launchRate; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商Id") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域Id") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailySpecialVehiclesOverspeedVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailySpecialVehiclesOverspeedVO.java new file mode 100644 index 0000000..b654a45 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptDailySpecialVehiclesOverspeedVO.java @@ -0,0 +1,52 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆超速日报 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@ApiModel(value = "RptDailySpecialVehiclesOverspeedVO", description = "专用车辆超速日报") +@Data +public class RptDailySpecialVehiclesOverspeedVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("20%-50%车辆数") + @ExcelProperty("20%-50%车辆数") + private Long overspeed2050VehicleNums; + + @ApiModelProperty("超速50%以上的车辆") + @ExcelProperty("超速50%以上的车辆") + private Long overspeed50VehicleNums; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptMonthOverspeedCompanyVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptMonthOverspeedCompanyVO.java new file mode 100644 index 0000000..0918e35 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptMonthOverspeedCompanyVO.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 超速企业情况月报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptMonthOverspeedCompanyVO", description = "超速企业情况月报") +public class RptMonthOverspeedCompanyVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + @ExcelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("超速次数") + @ExcelProperty("超速次数") + private Long overspeedTimes; + + @ApiModelProperty("企业车辆数") + @ExcelProperty("企业车辆数") + private Long vehicleNums; + + @ApiModelProperty("超速率") + @ExcelProperty("超速率") + private BigDecimal overspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptMonthOverspeedSpecialCompanyVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptMonthOverspeedSpecialCompanyVO.java new file mode 100644 index 0000000..43d88fc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptMonthOverspeedSpecialCompanyVO.java @@ -0,0 +1,81 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆超速企业情况月报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptMonthOverspeedSpecialCompanyVO", description = "专用车辆超速企业情况月报") +public class RptMonthOverspeedSpecialCompanyVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + @ExcelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("超速次数") + @ExcelProperty("超速次数") + private Long overspeedTimes; + + @ApiModelProperty("超速率") + @ExcelProperty("超速率") + private BigDecimal overspeedRate; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("最高速率") + @ExcelProperty("最高速率") + private BigDecimal maxSpeed; + + @ApiModelProperty("最高超速率") + @ExcelProperty("最高超速率") + private BigDecimal maxOverspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptMonthOverspeedSpecialVehiclesVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptMonthOverspeedSpecialVehiclesVO.java new file mode 100644 index 0000000..a241fff --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptMonthOverspeedSpecialVehiclesVO.java @@ -0,0 +1,65 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆超速月对比 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptMonthOverspeedSpecialVehiclesVO", description = "专用车辆超速月对比") +public class RptMonthOverspeedSpecialVehiclesVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("本月超速次数") + @ExcelProperty("本月超速次数") + private Long overspeedCurrentTimes; + + @ApiModelProperty("企业车辆数") + @ExcelProperty("企业车辆数") + private Long vehicleNums; + + @ApiModelProperty("超速率") + @ExcelProperty("超速率") + private BigDecimal maxOverspeedRate; + + @ApiModelProperty("上月超速次数") + @ExcelProperty("上月超速次数") + private Long overspeedLastTimes; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptMonthSpecialOfflineVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptMonthSpecialOfflineVO.java new file mode 100644 index 0000000..3323d2d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptMonthSpecialOfflineVO.java @@ -0,0 +1,74 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆不上线月报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptMonthSpecialOffline对象", description = "专用车辆不上线月报") +public class RptMonthSpecialOfflineVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("未上线天数") + @ExcelProperty("未上线天数") + private Integer offlineDays; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherAlarmCleanVehiclesAnalysisVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherAlarmCleanVehiclesAnalysisVO.java new file mode 100644 index 0000000..8c4e099 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherAlarmCleanVehiclesAnalysisVO.java @@ -0,0 +1,145 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 车辆报警清理分析表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherAlarmCleanVehiclesAnalysisVO", description = "车辆报警清理分析表 其它报表") +public class RptOtherAlarmCleanVehiclesAnalysisVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + @ExcelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + @ExcelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + @ExcelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("报警车总数") + @ExcelProperty("报警车总数") + private Long alarmVehicleNums; + + @ApiModelProperty("报警车辆占比") + @ExcelProperty("报警车辆占比") + private BigDecimal alarmVehicleRate; + + @ApiModelProperty("报警处理总数") + @ExcelProperty("报警处理总数") + private Long alarmProcessNums; + + @ApiModelProperty("报警处理占比") + @ExcelProperty("报警处理占比") + private BigDecimal alarmProcessRate; + + @ApiModelProperty("报警车同比") + @ExcelProperty("报警车同比") + private BigDecimal alarmVehicleYoy; + + @ApiModelProperty("报警车环比") + @ExcelProperty("报警车环比") + private BigDecimal alarmVehicleQoq; + + @ApiModelProperty("报警处理同比") + @ExcelProperty("报警处理同比") + private BigDecimal alarmProcessYoy; + + @ApiModelProperty("报警处理环比") + @ExcelProperty("报警处理环比") + private BigDecimal alarmProcessQoq; + + @ApiModelProperty("在线同比") + @ExcelProperty("在线同比") + private BigDecimal onlineYoy; + + @ApiModelProperty("在线环比") + @ExcelProperty("在线环比") + private BigDecimal onlineQoq; + + @ApiModelProperty("离线同比") + @ExcelProperty("离线同比") + private BigDecimal offlineYoy; + + @ApiModelProperty("离线环比") + @ExcelProperty("离线环比") + private BigDecimal offlineQoq; + + @ApiModelProperty("年月") + @ExcelProperty("年月") + private String yearMonthly; + + @ApiModelProperty("企业类型") + @ExcelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + @ExcelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherAlarmCleanVehiclesVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherAlarmCleanVehiclesVO.java new file mode 100644 index 0000000..94434f8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherAlarmCleanVehiclesVO.java @@ -0,0 +1,109 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 车辆报警清理表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherAlarmCleanVehiclesVO", description = "车辆报警清理表 其它报表") +public class RptOtherAlarmCleanVehiclesVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + @ExcelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + @ExcelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + @ExcelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("报警车总数") + @ExcelProperty("报警车总数") + private Long alarmVehicleNums; + + @ApiModelProperty("报警车辆占比") + @ExcelProperty("报警车辆占比") + private BigDecimal alarmVehicleRate; + + @ApiModelProperty("报警处理总数") + @ExcelProperty("报警处理总数") + private Long alarmProcessNums; + + @ApiModelProperty("报警处理占比") + @ExcelProperty("报警处理占比") + private BigDecimal alarmProcessRate; + + @ApiModelProperty("企业类型") + @ExcelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + @ExcelProperty("企业类型") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherCompanyTripsVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherCompanyTripsVO.java new file mode 100644 index 0000000..6b62ca1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherCompanyTripsVO.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆趟次记录 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherSpecialTrips对象", description = "专用车辆趟次记录 其它报表") +public class RptOtherCompanyTripsVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("车辆数") + @ExcelProperty("车辆数") + private Integer vehicleNums; + + @ApiModelProperty("趟次") + @ExcelProperty("趟次") + private Long trips; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherCrossDomainVehiclesAnalysisVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherCrossDomainVehiclesAnalysisVO.java new file mode 100644 index 0000000..e61753b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherCrossDomainVehiclesAnalysisVO.java @@ -0,0 +1,177 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 车辆跨域情况分析表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherCrossDomainVehiclesAnalysisVO", description = "车辆跨域情况分析表 其它报表") +public class RptOtherCrossDomainVehiclesAnalysisVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + @ExcelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + @ExcelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + @ExcelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("散装水泥车数") + @ExcelProperty("散状水泥车数") + private Long bulkCementTruckNums; + + @ApiModelProperty("散装水泥车占比") + @ExcelProperty("散装水泥车占比") + private BigDecimal bulkCementTruckRate; + + @ApiModelProperty("预拌砂浆车数") + @ExcelProperty("预拌砂浆车数") + private Long readyMixedMortarTruckNums; + + @ApiModelProperty("预拌砂浆车占比") + @ExcelProperty("预拌砂浆车占比") + private BigDecimal readyMixedMortarTruckRate; + + @ApiModelProperty("混凝土搅拌车数") + @ExcelProperty("混凝土搅拌车数") + private Long concreteDeliveryTruckNums; + + @ApiModelProperty("混凝土搅拌车数占比") + @ExcelProperty("混凝土搅拌车数占比") + private BigDecimal concreteDeliveryTruckRate; + + @ApiModelProperty("移动泵车数") + @ExcelProperty("移动泵车数") + private Long mobilePumpTruckNums; + + @ApiModelProperty("移动泵车占比") + @ExcelProperty("移动泵车占比") + private BigDecimal mobilePumpTruckRate; + + @ApiModelProperty("散装水泥车同比") + @ExcelProperty("散装水泥车同比") + private BigDecimal bulkCementTruckYoy; + + @ApiModelProperty("散装水泥车环比") + @ExcelProperty("散装水泥车环比") + private BigDecimal bulkCementTruckQoq; + + @ApiModelProperty("预拌砂浆车同比") + @ExcelProperty("预拌砂浆车同比") + private BigDecimal readyMixedMortarTruckYoy; + + @ApiModelProperty("预拌砂浆车环比") + @ExcelProperty("预拌砂浆车环比") + private BigDecimal readyMixedMortarTruckQoq; + + @ApiModelProperty("混凝土搅拌车同比") + @ExcelProperty("混凝土搅拌车同比") + private BigDecimal concreteDeliveryTruckYoy; + + @ApiModelProperty("混凝土搅拌车环比") + @ExcelProperty("混凝土搅拌车环比") + private BigDecimal concreteDeliveryTruckQoq; + + @ApiModelProperty("移动泵车同比") + @ExcelProperty("移动泵车同比") + private BigDecimal mobilePumpTruckYoy; + + @ApiModelProperty("移动泵车环比") + @ExcelProperty("移动泵车环比") + private BigDecimal mobilePumpTruckQoq; + + @ApiModelProperty("在线同比") + @ExcelProperty("在线同比") + private BigDecimal onlineYoy; + + @ApiModelProperty("在线环比") + @ExcelProperty("在线环比") + private BigDecimal onlineQoq; + + @ApiModelProperty("离线同比") + @ExcelProperty("离线同比") + private BigDecimal offlineYoy; + + @ApiModelProperty("离线环比") + @ExcelProperty("离线环比") + private BigDecimal offlineQoq; + + @ApiModelProperty("年月") + @ExcelProperty("年月") + private String yearMonthly; + + @ApiModelProperty("企业类型") + @ExcelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + @ExcelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherCrossDomainVehiclesVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherCrossDomainVehiclesVO.java new file mode 100644 index 0000000..0221479 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherCrossDomainVehiclesVO.java @@ -0,0 +1,125 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 车辆跨域情况表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherCrossDomainVehiclesVO", description = "车辆跨域情况表 其它报表") +public class RptOtherCrossDomainVehiclesVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + @ExcelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + @ExcelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + @ExcelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("散装水泥车数") + @ExcelProperty("散状水泥车数") + private Long bulkCementTruckNums; + + @ApiModelProperty("散装水泥车占比") + @ExcelProperty("散装水泥车占比") + private BigDecimal bulkCementTruckRate; + + @ApiModelProperty("预拌砂浆车数") + @ExcelProperty("预拌砂浆车数") + private Long readyMixedMortarTruckNums; + + @ApiModelProperty("预拌砂浆车占比") + @ExcelProperty("预拌砂浆车占比") + private BigDecimal readyMixedMortarTruckRate; + + @ApiModelProperty("混凝土搅拌车数") + @ExcelProperty("混凝土搅拌车数") + private Long concreteDeliveryTruckNums; + + @ApiModelProperty("混凝土搅拌车数占比") + @ExcelProperty("混凝土搅拌车数占比") + private BigDecimal concreteDeliveryTruckRate; + + @ApiModelProperty("移动泵车数") + @ExcelProperty("移动泵车数") + private Long mobilePumpTruckNums; + + @ApiModelProperty("移动泵车占比") + @ExcelProperty("移动泵车占比") + private BigDecimal mobilePumpTruckRate; + + @ApiModelProperty("企业类型") + @ExcelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + @ExcelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherOnlineVehiclesAnalysisVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherOnlineVehiclesAnalysisVO.java new file mode 100644 index 0000000..4ebec18 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherOnlineVehiclesAnalysisVO.java @@ -0,0 +1,113 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 在线车辆统计分析表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherOnlineVehiclesAnalysisVO", description = "在线车辆统计分析表 其它报表") +public class RptOtherOnlineVehiclesAnalysisVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + @ExcelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + @ExcelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + @ExcelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("年月") + @ExcelProperty("年月") + private String yearMonthly; + + @ApiModelProperty("在线同比") + @ExcelProperty("在线同比") + private BigDecimal onlineYoy; + + @ApiModelProperty("在线环比") + @ExcelProperty("在线环比") + private BigDecimal onlineQoq; + + @ApiModelProperty("离线同比") + @ExcelProperty("离线同比") + private BigDecimal offlineYoy; + + @ApiModelProperty("离线环比") + @ExcelProperty("离线环比") + private BigDecimal offlineQoq; + + @ApiModelProperty("企业类型") + @ExcelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + @ExcelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherOnlineVehiclesVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherOnlineVehiclesVO.java new file mode 100644 index 0000000..e992dad --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherOnlineVehiclesVO.java @@ -0,0 +1,93 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 在线车辆统计表 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherOnlineVehiclesVO", description = "在线车辆统计表 其它报表") +public class RptOtherOnlineVehiclesVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + @ExcelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + @ExcelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + @ExcelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("企业类型") + @ExcelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + @ExcelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherSpecialOverspeedVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherSpecialOverspeedVO.java new file mode 100644 index 0000000..736651d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherSpecialOverspeedVO.java @@ -0,0 +1,89 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆超速记录 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherSpecialOverspeedVO", description = "专用车辆超速记录 其它报表") +public class RptOtherSpecialOverspeedVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("超速开始时间") + @ExcelProperty("超速开始时间") + private LocalDateTime overspeedStartTime; + + @ApiModelProperty("超速结束时间") + @ExcelProperty("超速结束时间") + private LocalDateTime overspeedEndTime; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("限速") + @ExcelProperty("限速") + private BigDecimal limitSpeed; + + @ApiModelProperty("最高速") + @ExcelProperty("最高速") + private BigDecimal maxSpeed; + + @ApiModelProperty("超速率") + @ExcelProperty("超速率") + private Double overspeedRate; + + @ApiModelProperty("持续时间 秒") + @ExcelProperty("持续时间 秒") + private Integer duration; + + @ApiModelProperty("地点") + @ExcelProperty("地点") + private String address; + + @ApiModelProperty("道路") + @ExcelProperty("道路") + private String road; + + @ApiModelProperty("经纬度") + @ExcelProperty("经纬度") + private String longtitudeLatitude; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherSpecialTripsVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherSpecialTripsVO.java new file mode 100644 index 0000000..f608ad4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherSpecialTripsVO.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆趟次记录 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherSpecialTrips对象", description = "专用车辆趟次记录 其它报表") +public class RptOtherSpecialTripsVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("车辆数") + @ExcelProperty("车辆数") + private Integer vehicleNums; + + @ApiModelProperty("趟次") + @ExcelProperty("趟次") + private Long trips; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherTerminalInstallVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherTerminalInstallVO.java new file mode 100644 index 0000000..6c543d2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptOtherTerminalInstallVO.java @@ -0,0 +1,113 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 终端车载安装统计 其它报表 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "RptOtherTerminalInstallVO", description = "终端车载安装统计 其它报表") +public class RptOtherTerminalInstallVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("在线车辆数") + @ExcelProperty("在线车辆数") + private Long onlineNums; + + @ApiModelProperty("上线率") + @ExcelProperty("上线率") + private BigDecimal onlineRate; + + @ApiModelProperty("离线车辆数") + @ExcelProperty("离线车辆数") + private Long offlineNums; + + @ApiModelProperty("离线率") + @ExcelProperty("离线率") + private BigDecimal offlineRate; + + @ApiModelProperty("车辆类型") + @ExcelProperty("车辆类型") + private Long vehicleType; + + @ApiModelProperty("车辆类型名") + @ExcelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("安装终端的车辆数") + @ExcelProperty("安装终端的车辆数") + private Long installedNums; + + @ApiModelProperty("安装终端的车辆占比") + @ExcelProperty("安装终端的车辆占比") + private BigDecimal installedRate; + + @ApiModelProperty("年月") + @ExcelProperty("年月") + private String yearMonthly; + + @ApiModelProperty("企业类型") + @ExcelProperty("企业类型") + private String enterpriseType; + + @ApiModelProperty("企业类型名") + @ExcelProperty("企业类型名") + private String enterpriseTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptTendaysSpecialOfflineWeekVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptTendaysSpecialOfflineWeekVO.java new file mode 100644 index 0000000..9eecf0f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptTendaysSpecialOfflineWeekVO.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆一周以上不上线旬报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@ApiModel(value = "RptTendaysSpecialOfflineWeek对象", description = "专用车辆一周以上不上线旬报") +@Data +public class RptTendaysSpecialOfflineWeekVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("未上线天数") + @ExcelProperty("未上线天数") + private Integer offlineDays; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptTendaysSpecialOverspeedCompanyVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptTendaysSpecialOverspeedCompanyVO.java new file mode 100644 index 0000000..a4f3319 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptTendaysSpecialOverspeedCompanyVO.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆超速企业情况旬报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@ApiModel(value = "RptTendaysSpecialOverspeedCompanyVO", description = "专用车辆超速企业情况旬报") +@Data +public class RptTendaysSpecialOverspeedCompanyVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + @ExcelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("当前旬超速次数") + @ExcelProperty("当前旬超速次数") + private Long overspeedCurrentTimes; + + @ApiModelProperty("上一旬超速次数") + @ExcelProperty("上一旬超速次数") + private Long overspeedLastTimes; + + @ApiModelProperty("超速率") + @ExcelProperty("超速率") + private BigDecimal overspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptTendaysSpecialOverspeedVehiclesVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptTendaysSpecialOverspeedVehiclesVO.java new file mode 100644 index 0000000..a7c0251 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/model/vo/RptTendaysSpecialOverspeedVehiclesVO.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.car.rpt.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 专用车辆超速车辆情况旬报 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@ApiModel(value = "RptTendaysSpecialOverspeedVehiclesVO", description = "专用车辆超速车辆情况旬报") +@Data +public class RptTendaysSpecialOverspeedVehiclesVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("名称") + @ExcelProperty("名称") + private String name; + + @ApiModelProperty("报表时间") + @ExcelProperty("报表时间") + private LocalDateTime rptDate; + + @ApiModelProperty("排名") + @ExcelProperty("排名") + private Integer rank; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("当前旬超速次数") + @ExcelProperty("当前旬超速次数") + private Long overspeedCurrentTimes; + + @ApiModelProperty("上一旬超速次数") + @ExcelProperty("上一旬超速次数") + private Long overspeedLastTimes; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("超速率") + @ExcelProperty("超速率") + private BigDecimal overspeedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailyOperatorVehiclesLaunchRateService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailyOperatorVehiclesLaunchRateService.java new file mode 100644 index 0000000..df7cc69 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailyOperatorVehiclesLaunchRateService.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptDailyOperatorVehiclesLaunchRate; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailyOperatorVehiclesLaunchRateParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailyOperatorVehiclesLaunchRatePO; + +import java.util.List; + +/** + *

+ * 运营商车辆上线率日报 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface IRptDailyOperatorVehiclesLaunchRateService extends IService { + + List report(RptDailyOperatorVehiclesLaunchRateParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailyOverspeedCompanyService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailyOverspeedCompanyService.java new file mode 100644 index 0000000..0bd4628 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailyOverspeedCompanyService.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptDailyOverspeedCompany; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailyOverspeedCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailyOverspeedCompanyPO; + +import java.util.List; + +/** + *

+ * 超速企业情况日报 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface IRptDailyOverspeedCompanyService extends IService { + + List report(RptDailyOverspeedCompanyParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailyOverspeedSpecialVehiclesService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailyOverspeedSpecialVehiclesService.java new file mode 100644 index 0000000..36cd1ac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailyOverspeedSpecialVehiclesService.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptDailyOverspeedSpecialVehicles; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailyOverspeedSpecialVehiclesParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailyOverspeedSpecialVehiclesPO; + +import java.util.List; + +/** + *

+ * 超速专用车辆日报 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface IRptDailyOverspeedSpecialVehiclesService extends IService { + + List report(RptDailyOverspeedSpecialVehiclesParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailySpecialVehiclesCompanyLaunchRate60Service.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailySpecialVehiclesCompanyLaunchRate60Service.java new file mode 100644 index 0000000..e850008 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailySpecialVehiclesCompanyLaunchRate60Service.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptDailySpecialVehiclesCompanyLaunchRate60; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailySpecialVehiclesCompanyLaunchRateParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailySpecialVehiclesCompanyLaunchRate60PO; + +import java.util.List; + +/** + *

+ * 专用车辆企业上线率低于60日报 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface IRptDailySpecialVehiclesCompanyLaunchRate60Service extends IService { + + List report(RptDailySpecialVehiclesCompanyLaunchRateParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailySpecialVehiclesLaunchRateService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailySpecialVehiclesLaunchRateService.java new file mode 100644 index 0000000..583cd4c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailySpecialVehiclesLaunchRateService.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptDailySpecialVehiclesLaunchRate; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailySpecialVehiclesLaunchRateParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailySpecialVehiclesLaunchRatePO; + +import java.util.List; + +/** + *

+ * 专用车辆上线率日报 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface IRptDailySpecialVehiclesLaunchRateService extends IService { + + List report(RptDailySpecialVehiclesLaunchRateParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailySpecialVehiclesOverspeedService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailySpecialVehiclesOverspeedService.java new file mode 100644 index 0000000..86694e0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptDailySpecialVehiclesOverspeedService.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptDailySpecialVehiclesOverspeed; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailySpecialVehiclesOverspeedParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailySpecialVehiclesOverspeedPO; + +import java.util.List; + +/** + *

+ * 专用车辆超速日报 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface IRptDailySpecialVehiclesOverspeedService extends IService { + + List report(RptDailySpecialVehiclesOverspeedParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptMonthOverspeedCompanyService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptMonthOverspeedCompanyService.java new file mode 100644 index 0000000..668287c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptMonthOverspeedCompanyService.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.entity.RptMonthOverspeedCompany; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthOverspeedCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthOverspeedCompanyPO; + +import java.util.List; + +/** + *

+ * 超速企业情况月报 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptMonthOverspeedCompanyService extends IService { + + List report(RptMonthOverspeedCompanyParamDTO param); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptMonthOverspeedSpecialCompanyService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptMonthOverspeedSpecialCompanyService.java new file mode 100644 index 0000000..94afe10 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptMonthOverspeedSpecialCompanyService.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptMonthOverspeedSpecialCompany; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOverspeedCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthSpecialVehiclesOverspeedPO; + +import java.util.List; + +/** + *

+ * 专用车辆超速企业情况月报 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptMonthOverspeedSpecialCompanyService extends IService { + + List report(RptMonthSpecialOverspeedCompanyParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptMonthOverspeedSpecialVehiclesService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptMonthOverspeedSpecialVehiclesService.java new file mode 100644 index 0000000..3bbede6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptMonthOverspeedSpecialVehiclesService.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptMonthOverspeedSpecialVehicles; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOverspeedVehiclesParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthOverspeedSpecialVehiclesPO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthSpecialOfflinePO; + +import java.util.List; + +/** + *

+ * 专用车辆超速月对比 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptMonthOverspeedSpecialVehiclesService extends IService { + + List reportPage(Page page, RptMonthSpecialOverspeedVehiclesParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptMonthSpecialOfflineService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptMonthSpecialOfflineService.java new file mode 100644 index 0000000..af8dc0b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptMonthSpecialOfflineService.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptMonthSpecialOffline; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOfflineParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthSpecialOfflinePO; + +import java.util.List; + +/** + *

+ * 专用车辆不上线月报 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptMonthSpecialOfflineService extends IService { + + List reportPage(Page page, RptMonthSpecialOfflineParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherAlarmCleanVehiclesAnalysisService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherAlarmCleanVehiclesAnalysisService.java new file mode 100644 index 0000000..55c196a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherAlarmCleanVehiclesAnalysisService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherAlarmCleanVehiclesAnalysis; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 车辆报警清理分析表 其它报表 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptOtherAlarmCleanVehiclesAnalysisService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherAlarmCleanVehiclesService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherAlarmCleanVehiclesService.java new file mode 100644 index 0000000..e55fb61 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherAlarmCleanVehiclesService.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptOtherAlarmCleanVehicles; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherAlarmCleanVehiclesPO; + +/** + *

+ * 车辆报警清理表 其它报表 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptOtherAlarmCleanVehiclesService extends IService { + + Page reportPage(Page page, RptOtherParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherCrossDomainVehiclesAnalysisService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherCrossDomainVehiclesAnalysisService.java new file mode 100644 index 0000000..36d2594 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherCrossDomainVehiclesAnalysisService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherCrossDomainVehiclesAnalysis; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 车辆跨域情况分析表 其它报表 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptOtherCrossDomainVehiclesAnalysisService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherCrossDomainVehiclesService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherCrossDomainVehiclesService.java new file mode 100644 index 0000000..a907e28 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherCrossDomainVehiclesService.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptOtherCrossDomainVehicles; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherCrossDomainVehiclesPO; + +import java.util.List; + +/** + *

+ * 车辆跨域情况表 其它报表 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptOtherCrossDomainVehiclesService extends IService { + + List report(RptOtherParamDTO param); + + Page reportPage(Page page, RptOtherParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherOnlineVehiclesAnalysisService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherOnlineVehiclesAnalysisService.java new file mode 100644 index 0000000..4be86f8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherOnlineVehiclesAnalysisService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherOnlineVehiclesAnalysis; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 在线车辆统计分析表 其它报表 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptOtherOnlineVehiclesAnalysisService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherOnlineVehiclesService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherOnlineVehiclesService.java new file mode 100644 index 0000000..630d6e2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherOnlineVehiclesService.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptOtherOnlineVehicles; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherOnlineVehiclesPO; + +import java.util.List; + +/** + *

+ * 在线车辆统计表 其它报表 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptOtherOnlineVehiclesService extends IService { + + List report(RptOtherParamDTO param); + + Page reportPage(Page page, RptOtherParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherSpecialOverspeedService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherSpecialOverspeedService.java new file mode 100644 index 0000000..32893cd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherSpecialOverspeedService.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptOtherSpecialOverspeed; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherSpecialOverspeedPO; + +import java.util.List; + +/** + *

+ * 专用车辆超速记录 其它报表 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptOtherSpecialOverspeedService extends IService { + + List report(RptOtherParamDTO param); + + Page reportPage(Page page, RptOtherParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherSpecialTripsService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherSpecialTripsService.java new file mode 100644 index 0000000..4997562 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherSpecialTripsService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherSpecialTrips; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 专用车辆趟次记录 其它报表 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptOtherSpecialTripsService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherTerminalInstallService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherTerminalInstallService.java new file mode 100644 index 0000000..6ea2055 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptOtherTerminalInstallService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherTerminalInstall; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 终端车载安装统计 其它报表 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptOtherTerminalInstallService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptTendaysSpecialOfflineWeekService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptTendaysSpecialOfflineWeekService.java new file mode 100644 index 0000000..102f6a7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptTendaysSpecialOfflineWeekService.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptTendaysSpecialOfflineWeek; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOfflineWeekSpecialParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptTendaysSpecialOfflineWeekPO; + +import java.util.List; + +/** + *

+ * 专用车辆一周以上不上线旬报 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptTendaysSpecialOfflineWeekService extends IService { + + List report(RptTendaysOfflineWeekSpecialParamDTO param); + + Page reportPage(Page page, RptTendaysOfflineWeekSpecialParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptTendaysSpecialOverspeedCompanyService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptTendaysSpecialOverspeedCompanyService.java new file mode 100644 index 0000000..26499b5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptTendaysSpecialOverspeedCompanyService.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptTendaysSpecialOverspeedCompany; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOverspeedSpecialCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptTendaysSpecialOverspeedCompanyPO; + +import java.util.List; + +/** + *

+ * 专用车辆超速企业情况旬报 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptTendaysSpecialOverspeedCompanyService extends IService { + + List report(RptTendaysOverspeedSpecialCompanyParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptTendaysSpecialOverspeedVehiclesService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptTendaysSpecialOverspeedVehiclesService.java new file mode 100644 index 0000000..ccbeb89 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/IRptTendaysSpecialOverspeedVehiclesService.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.car.rpt.service; + +import com.ningdatech.carapi.car.rpt.entity.RptTendaysSpecialOverspeedVehicles; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOverspeedSpecialVehiclesParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptTendaysSpecialOverspeedVehiclesPO; + +import java.util.List; + +/** + *

+ * 专用车辆超速车辆情况旬报 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface IRptTendaysSpecialOverspeedVehiclesService extends IService { + + List report(RptTendaysOverspeedSpecialVehiclesParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailyOperatorVehiclesLaunchRateServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailyOperatorVehiclesLaunchRateServiceImpl.java new file mode 100644 index 0000000..e489413 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailyOperatorVehiclesLaunchRateServiceImpl.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.ningdatech.carapi.car.rpt.entity.RptDailyOperatorVehiclesLaunchRate; +import com.ningdatech.carapi.car.rpt.mapper.RptDailyOperatorVehiclesLaunchRateMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailyOperatorVehiclesLaunchRateParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailyOperatorVehiclesLaunchRatePO; +import com.ningdatech.carapi.car.rpt.service.IRptDailyOperatorVehiclesLaunchRateService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 运营商车辆上线率日报 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Service +@RequiredArgsConstructor +public class RptDailyOperatorVehiclesLaunchRateServiceImpl extends ServiceImpl implements IRptDailyOperatorVehiclesLaunchRateService { + + private final RptDailyOperatorVehiclesLaunchRateMapper mapper; + + @Override + @XmlDataScope + public List report(RptDailyOperatorVehiclesLaunchRateParamDTO param) { + return mapper.report(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailyOverspeedCompanyServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailyOverspeedCompanyServiceImpl.java new file mode 100644 index 0000000..708a5fa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailyOverspeedCompanyServiceImpl.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.ningdatech.carapi.car.rpt.entity.RptDailyOverspeedCompany; +import com.ningdatech.carapi.car.rpt.mapper.RptDailyOverspeedCompanyMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailyOverspeedCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailyOverspeedCompanyPO; +import com.ningdatech.carapi.car.rpt.service.IRptDailyOverspeedCompanyService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 超速企业情况日报 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Service +@RequiredArgsConstructor +public class RptDailyOverspeedCompanyServiceImpl extends ServiceImpl implements IRptDailyOverspeedCompanyService { + + private final RptDailyOverspeedCompanyMapper mapper; + + @Override + @XmlDataScope + public List report(RptDailyOverspeedCompanyParamDTO param) { + return mapper.report(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailyOverspeedSpecialVehiclesServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailyOverspeedSpecialVehiclesServiceImpl.java new file mode 100644 index 0000000..e7983b6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailyOverspeedSpecialVehiclesServiceImpl.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.ningdatech.carapi.car.rpt.entity.RptDailyOverspeedSpecialVehicles; +import com.ningdatech.carapi.car.rpt.mapper.RptDailyOverspeedSpecialVehiclesMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailyOverspeedSpecialVehiclesParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailyOverspeedSpecialVehiclesPO; +import com.ningdatech.carapi.car.rpt.service.IRptDailyOverspeedSpecialVehiclesService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 超速专用车辆日报 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Service +@RequiredArgsConstructor +public class RptDailyOverspeedSpecialVehiclesServiceImpl extends ServiceImpl implements IRptDailyOverspeedSpecialVehiclesService { + + private final RptDailyOverspeedSpecialVehiclesMapper mapper; + + @Override + @XmlDataScope + public List report(RptDailyOverspeedSpecialVehiclesParamDTO param) { + return mapper.report(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailySpecialVehiclesCompanyLaunchRate60ServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailySpecialVehiclesCompanyLaunchRate60ServiceImpl.java new file mode 100644 index 0000000..d267536 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailySpecialVehiclesCompanyLaunchRate60ServiceImpl.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.ningdatech.carapi.car.rpt.entity.RptDailySpecialVehiclesCompanyLaunchRate60; +import com.ningdatech.carapi.car.rpt.mapper.RptDailySpecialVehiclesCompanyLaunchRate60Mapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailySpecialVehiclesCompanyLaunchRateParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailySpecialVehiclesCompanyLaunchRate60PO; +import com.ningdatech.carapi.car.rpt.service.IRptDailySpecialVehiclesCompanyLaunchRate60Service; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 专用车辆企业上线率低于60日报 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Service +@RequiredArgsConstructor +public class RptDailySpecialVehiclesCompanyLaunchRate60ServiceImpl extends ServiceImpl implements IRptDailySpecialVehiclesCompanyLaunchRate60Service { + + private final RptDailySpecialVehiclesCompanyLaunchRate60Mapper mapper; + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List report(RptDailySpecialVehiclesCompanyLaunchRateParamDTO param) { + return mapper.report(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailySpecialVehiclesLaunchRateServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailySpecialVehiclesLaunchRateServiceImpl.java new file mode 100644 index 0000000..1185463 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailySpecialVehiclesLaunchRateServiceImpl.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.car.rpt.entity.RptDailySpecialVehiclesLaunchRate; +import com.ningdatech.carapi.car.rpt.mapper.RptDailySpecialVehiclesLaunchRateMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailySpecialVehiclesLaunchRateParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailySpecialVehiclesLaunchRatePO; +import com.ningdatech.carapi.car.rpt.service.IRptDailySpecialVehiclesLaunchRateService; +import com.ningdatech.carapi.common.util.CodeUtil; + +import lombok.RequiredArgsConstructor; + +/** + *

+ * 专用车辆上线率日报 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Service +@RequiredArgsConstructor +public class RptDailySpecialVehiclesLaunchRateServiceImpl extends ServiceImpl implements IRptDailySpecialVehiclesLaunchRateService { + + private final RptDailySpecialVehiclesLaunchRateMapper mapper; + + @Override + public List report(RptDailySpecialVehiclesLaunchRateParamDTO param) { + CodeUtil.buildRegionLevel(param); + Date date = NdDateUtils.parseAsDate(param.getDate()); + String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(date,"yyyy_MM"); + param.setTableName(tableName); + List res = mapper.report(param); + return res; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailySpecialVehiclesOverspeedServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailySpecialVehiclesOverspeedServiceImpl.java new file mode 100644 index 0000000..366b4bd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptDailySpecialVehiclesOverspeedServiceImpl.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.ningdatech.carapi.car.rpt.entity.RptDailySpecialVehiclesOverspeed; +import com.ningdatech.carapi.car.rpt.mapper.RptDailySpecialVehiclesOverspeedMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptDailySpecialVehiclesOverspeedParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptDailySpecialVehiclesOverspeedPO; +import com.ningdatech.carapi.car.rpt.service.IRptDailySpecialVehiclesOverspeedService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 专用车辆超速日报 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Service +@RequiredArgsConstructor +public class RptDailySpecialVehiclesOverspeedServiceImpl extends ServiceImpl implements IRptDailySpecialVehiclesOverspeedService { + + private final RptDailySpecialVehiclesOverspeedMapper mapper; + + @Override + @XmlDataScope + public List report(RptDailySpecialVehiclesOverspeedParamDTO param) { + return mapper.report(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptMonthOverspeedCompanyServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptMonthOverspeedCompanyServiceImpl.java new file mode 100644 index 0000000..d694984 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptMonthOverspeedCompanyServiceImpl.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.car.rpt.entity.RptMonthOverspeedCompany; +import com.ningdatech.carapi.car.rpt.mapper.RptMonthOverspeedCompanyMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthOverspeedCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthOverspeedCompanyPO; +import com.ningdatech.carapi.car.rpt.service.IRptMonthOverspeedCompanyService; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 超速企业情况月报 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +@RequiredArgsConstructor +public class RptMonthOverspeedCompanyServiceImpl extends ServiceImpl implements IRptMonthOverspeedCompanyService { + + private final RptMonthOverspeedCompanyMapper mapper; + + @Override + @XmlDataScope + public List report(RptMonthOverspeedCompanyParamDTO param) { + return mapper.report(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptMonthOverspeedSpecialCompanyServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptMonthOverspeedSpecialCompanyServiceImpl.java new file mode 100644 index 0000000..7d30a08 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptMonthOverspeedSpecialCompanyServiceImpl.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.car.rpt.entity.RptMonthOverspeedSpecialCompany; +import com.ningdatech.carapi.car.rpt.mapper.RptMonthOverspeedSpecialCompanyMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOverspeedCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthSpecialVehiclesOverspeedPO; +import com.ningdatech.carapi.car.rpt.service.IRptMonthOverspeedSpecialCompanyService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 专用车辆超速企业情况月报 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +@RequiredArgsConstructor +public class RptMonthOverspeedSpecialCompanyServiceImpl extends ServiceImpl implements IRptMonthOverspeedSpecialCompanyService { + + private final RptMonthOverspeedSpecialCompanyMapper mapper; + + @Override + public List report(RptMonthSpecialOverspeedCompanyParamDTO param) { + return mapper.report(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptMonthOverspeedSpecialVehiclesServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptMonthOverspeedSpecialVehiclesServiceImpl.java new file mode 100644 index 0000000..0ef8554 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptMonthOverspeedSpecialVehiclesServiceImpl.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptMonthOverspeedSpecialVehicles; +import com.ningdatech.carapi.car.rpt.mapper.RptMonthOverspeedSpecialVehiclesMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOverspeedVehiclesParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthOverspeedSpecialVehiclesPO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthSpecialOfflinePO; +import com.ningdatech.carapi.car.rpt.service.IRptMonthOverspeedSpecialVehiclesService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 专用车辆超速月对比 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +@RequiredArgsConstructor +public class RptMonthOverspeedSpecialVehiclesServiceImpl extends ServiceImpl implements IRptMonthOverspeedSpecialVehiclesService { + + private final RptMonthOverspeedSpecialVehiclesMapper mapper; + + @Override + public List reportPage(Page page, RptMonthSpecialOverspeedVehiclesParamDTO param) { + return mapper.reportPage(page,param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptMonthSpecialOfflineServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptMonthSpecialOfflineServiceImpl.java new file mode 100644 index 0000000..ff0805b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptMonthSpecialOfflineServiceImpl.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptMonthSpecialOffline; +import com.ningdatech.carapi.car.rpt.mapper.RptMonthSpecialOfflineMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptMonthSpecialOfflineParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptMonthSpecialOfflinePO; +import com.ningdatech.carapi.car.rpt.service.IRptMonthSpecialOfflineService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 专用车辆不上线月报 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +@RequiredArgsConstructor +public class RptMonthSpecialOfflineServiceImpl extends ServiceImpl implements IRptMonthSpecialOfflineService { + + private final RptMonthSpecialOfflineMapper mapper; + + @Override + @XmlDataScope + public List reportPage(Page page, RptMonthSpecialOfflineParamDTO param) { + return mapper.reportPage(page,param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherAlarmCleanVehiclesAnalysisServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherAlarmCleanVehiclesAnalysisServiceImpl.java new file mode 100644 index 0000000..c407c27 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherAlarmCleanVehiclesAnalysisServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherAlarmCleanVehiclesAnalysis; +import com.ningdatech.carapi.car.rpt.mapper.RptOtherAlarmCleanVehiclesAnalysisMapper; +import com.ningdatech.carapi.car.rpt.service.IRptOtherAlarmCleanVehiclesAnalysisService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 车辆报警清理分析表 其它报表 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +public class RptOtherAlarmCleanVehiclesAnalysisServiceImpl extends ServiceImpl implements IRptOtherAlarmCleanVehiclesAnalysisService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherAlarmCleanVehiclesServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherAlarmCleanVehiclesServiceImpl.java new file mode 100644 index 0000000..896d3e3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherAlarmCleanVehiclesServiceImpl.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptOtherAlarmCleanVehicles; +import com.ningdatech.carapi.car.rpt.mapper.RptOtherAlarmCleanVehiclesMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherAlarmCleanVehiclesPO; +import com.ningdatech.carapi.car.rpt.service.IRptOtherAlarmCleanVehiclesService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 车辆报警清理表 其它报表 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +@RequiredArgsConstructor +public class RptOtherAlarmCleanVehiclesServiceImpl extends ServiceImpl implements IRptOtherAlarmCleanVehiclesService { + + private final RptOtherAlarmCleanVehiclesMapper mapper; + + @Override + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public Page reportPage(Page page, + RptOtherParamDTO param) { + return mapper.reportPage(page,param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherCrossDomainVehiclesAnalysisServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherCrossDomainVehiclesAnalysisServiceImpl.java new file mode 100644 index 0000000..3fea362 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherCrossDomainVehiclesAnalysisServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherCrossDomainVehiclesAnalysis; +import com.ningdatech.carapi.car.rpt.mapper.RptOtherCrossDomainVehiclesAnalysisMapper; +import com.ningdatech.carapi.car.rpt.service.IRptOtherCrossDomainVehiclesAnalysisService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 车辆跨域情况分析表 其它报表 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +public class RptOtherCrossDomainVehiclesAnalysisServiceImpl extends ServiceImpl implements IRptOtherCrossDomainVehiclesAnalysisService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherCrossDomainVehiclesServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherCrossDomainVehiclesServiceImpl.java new file mode 100644 index 0000000..5ac81a3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherCrossDomainVehiclesServiceImpl.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptOtherCrossDomainVehicles; +import com.ningdatech.carapi.car.rpt.mapper.RptOtherCrossDomainVehiclesMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherCrossDomainVehiclesPO; +import com.ningdatech.carapi.car.rpt.service.IRptOtherCrossDomainVehiclesService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +/** + *

+ * 车辆跨域情况表 其它报表 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +@RequiredArgsConstructor +public class RptOtherCrossDomainVehiclesServiceImpl extends ServiceImpl implements IRptOtherCrossDomainVehiclesService { + + private final RptOtherCrossDomainVehiclesMapper mapper; + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List report(RptOtherParamDTO param) { + return mapper.report(param); + } + + @Override + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public Page reportPage(Page page, RptOtherParamDTO param) { + return mapper.reportPage(page, param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherOnlineVehiclesAnalysisServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherOnlineVehiclesAnalysisServiceImpl.java new file mode 100644 index 0000000..4639d15 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherOnlineVehiclesAnalysisServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherOnlineVehiclesAnalysis; +import com.ningdatech.carapi.car.rpt.mapper.RptOtherOnlineVehiclesAnalysisMapper; +import com.ningdatech.carapi.car.rpt.service.IRptOtherOnlineVehiclesAnalysisService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 在线车辆统计分析表 其它报表 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +public class RptOtherOnlineVehiclesAnalysisServiceImpl extends ServiceImpl implements IRptOtherOnlineVehiclesAnalysisService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherOnlineVehiclesServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherOnlineVehiclesServiceImpl.java new file mode 100644 index 0000000..56659e6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherOnlineVehiclesServiceImpl.java @@ -0,0 +1,41 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptOtherOnlineVehicles; +import com.ningdatech.carapi.car.rpt.mapper.RptOtherOnlineVehiclesMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherOnlineVehiclesPO; +import com.ningdatech.carapi.car.rpt.service.IRptOtherOnlineVehiclesService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 在线车辆统计表 其它报表 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +@RequiredArgsConstructor +public class RptOtherOnlineVehiclesServiceImpl extends ServiceImpl implements IRptOtherOnlineVehiclesService { + + private final RptOtherOnlineVehiclesMapper mapper; + + @Override + @XmlDataScope + public List report(RptOtherParamDTO param) { + return mapper.report(param); + } + + @Override + @XmlDataScope + public Page reportPage(Page page, RptOtherParamDTO param) { + return mapper.reportPage(page, param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherSpecialOverspeedServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherSpecialOverspeedServiceImpl.java new file mode 100644 index 0000000..1daf6a0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherSpecialOverspeedServiceImpl.java @@ -0,0 +1,41 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptOtherSpecialOverspeed; +import com.ningdatech.carapi.car.rpt.mapper.RptOtherSpecialOverspeedMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherSpecialOverspeedPO; +import com.ningdatech.carapi.car.rpt.service.IRptOtherSpecialOverspeedService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 专用车辆超速记录 其它报表 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +@RequiredArgsConstructor +public class RptOtherSpecialOverspeedServiceImpl extends ServiceImpl implements IRptOtherSpecialOverspeedService { + + private final RptOtherSpecialOverspeedMapper mapper; + + @Override + @XmlDataScope + public List report(RptOtherParamDTO param) { + return mapper.report(param); + } + + @Override + @XmlDataScope + public Page reportPage(Page page, RptOtherParamDTO param) { + return mapper.reportPage(page,param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherSpecialTripsServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherSpecialTripsServiceImpl.java new file mode 100644 index 0000000..4e1f178 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherSpecialTripsServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherSpecialTrips; +import com.ningdatech.carapi.car.rpt.mapper.RptOtherSpecialTripsMapper; +import com.ningdatech.carapi.car.rpt.service.IRptOtherSpecialTripsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 专用车辆趟次记录 其它报表 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +public class RptOtherSpecialTripsServiceImpl extends ServiceImpl implements IRptOtherSpecialTripsService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherTerminalInstallServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherTerminalInstallServiceImpl.java new file mode 100644 index 0000000..bc0a44d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptOtherTerminalInstallServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.ningdatech.carapi.car.rpt.entity.RptOtherTerminalInstall; +import com.ningdatech.carapi.car.rpt.mapper.RptOtherTerminalInstallMapper; +import com.ningdatech.carapi.car.rpt.service.IRptOtherTerminalInstallService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 终端车载安装统计 其它报表 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +public class RptOtherTerminalInstallServiceImpl extends ServiceImpl implements IRptOtherTerminalInstallService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptTendaysSpecialOfflineWeekServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptTendaysSpecialOfflineWeekServiceImpl.java new file mode 100644 index 0000000..2116c08 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptTendaysSpecialOfflineWeekServiceImpl.java @@ -0,0 +1,41 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.rpt.entity.RptTendaysSpecialOfflineWeek; +import com.ningdatech.carapi.car.rpt.mapper.RptTendaysSpecialOfflineWeekMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOfflineWeekSpecialParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptTendaysSpecialOfflineWeekPO; +import com.ningdatech.carapi.car.rpt.service.IRptTendaysSpecialOfflineWeekService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 专用车辆一周以上不上线旬报 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +@RequiredArgsConstructor +public class RptTendaysSpecialOfflineWeekServiceImpl extends ServiceImpl implements IRptTendaysSpecialOfflineWeekService { + + private final RptTendaysSpecialOfflineWeekMapper mapper; + + @Override + @XmlDataScope + public List report(RptTendaysOfflineWeekSpecialParamDTO param) { + return mapper.report(param); + } + + @Override + @XmlDataScope + public Page reportPage(Page page, RptTendaysOfflineWeekSpecialParamDTO param) { + return mapper.reportPage(page,param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptTendaysSpecialOverspeedCompanyServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptTendaysSpecialOverspeedCompanyServiceImpl.java new file mode 100644 index 0000000..2d1dea6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptTendaysSpecialOverspeedCompanyServiceImpl.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.ningdatech.carapi.car.rpt.entity.RptTendaysSpecialOverspeedCompany; +import com.ningdatech.carapi.car.rpt.mapper.RptTendaysSpecialOverspeedCompanyMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOverspeedSpecialCompanyParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptTendaysSpecialOverspeedCompanyPO; +import com.ningdatech.carapi.car.rpt.service.IRptTendaysSpecialOverspeedCompanyService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 专用车辆超速企业情况旬报 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +@RequiredArgsConstructor +public class RptTendaysSpecialOverspeedCompanyServiceImpl extends ServiceImpl implements IRptTendaysSpecialOverspeedCompanyService { + + private final RptTendaysSpecialOverspeedCompanyMapper mapper; + + @Override + @XmlDataScope + public List report(RptTendaysOverspeedSpecialCompanyParamDTO param) { + return mapper.report(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptTendaysSpecialOverspeedVehiclesServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptTendaysSpecialOverspeedVehiclesServiceImpl.java new file mode 100644 index 0000000..c793114 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/rpt/service/impl/RptTendaysSpecialOverspeedVehiclesServiceImpl.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.car.rpt.service.impl; + +import com.ningdatech.carapi.car.rpt.entity.RptTendaysSpecialOverspeedVehicles; +import com.ningdatech.carapi.car.rpt.mapper.RptTendaysSpecialOverspeedVehiclesMapper; +import com.ningdatech.carapi.car.rpt.model.dto.RptTendaysOverspeedSpecialVehiclesParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptTendaysSpecialOverspeedVehiclesPO; +import com.ningdatech.carapi.car.rpt.service.IRptTendaysSpecialOverspeedVehiclesService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 专用车辆超速车辆情况旬报 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +@RequiredArgsConstructor +public class RptTendaysSpecialOverspeedVehiclesServiceImpl extends ServiceImpl implements IRptTendaysSpecialOverspeedVehiclesService { + + private final RptTendaysSpecialOverspeedVehiclesMapper mapper; + + @Override + @XmlDataScope + public List report(RptTendaysOverspeedSpecialVehiclesParamDTO param) { + return mapper.report(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/controller/VehicleTripsController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/controller/VehicleTripsController.java new file mode 100644 index 0000000..83b8c43 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/controller/VehicleTripsController.java @@ -0,0 +1,54 @@ +package com.ningdatech.carapi.car.trips.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.car.monitor.model.dto.LoadMonitorPageParamDTO; +import com.ningdatech.carapi.car.monitor.model.vo.SecurityMonitorVO; +import com.ningdatech.carapi.car.trips.manage.VehicleTripsManage; +import com.ningdatech.carapi.car.trips.model.dto.VehicleTripsParamDTO; +import com.ningdatech.carapi.car.trips.model.vo.VehicleTripsCityVO; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +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.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +/** + *

+ * 车辆单趟记录 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Controller +@RestController +@RequestMapping(value = "/api/car-manage/trips") +@Api(tags = "车辆管理-车辆趟次") +@Validated +@RequiredArgsConstructor +public class VehicleTripsController { + + private final VehicleTripsManage vehicleTripsManage; + + @ApiOperation("车辆趟次查询-按城市维度") + @GetMapping("/list-groupby-city") + public PageVo lictGroupByCity(@Valid @ModelAttribute VehicleTripsParamDTO param) { + return vehicleTripsManage.lictGroupByCity(param); + } + + @ApiOperation(value = "车辆趟次导出", notes = "车辆趟次导出") + @GetMapping("/export-list-groupby-city") + public void exportGroupByCity(VehicleTripsParamDTO param, HttpServletResponse response) { + ExcelDownUtil.downXls(response, param, vehicleTripsManage::exportGroupByCity); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/entity/VehicleTrips.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/entity/VehicleTrips.java new file mode 100644 index 0000000..82ad498 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/entity/VehicleTrips.java @@ -0,0 +1,99 @@ +package com.ningdatech.carapi.car.trips.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.LocalDate; +import java.time.LocalDateTime; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 车辆单趟记录 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@TableName("nd_vehicle_trips") +@Data +@ApiModel(value = "VehicleTrips对象", description = "车辆单趟记录") +public class VehicleTrips extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("车辆单趟记录流水号") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("发生日期") + private LocalDate happenDate; + + @ApiModelProperty("车辆ID") + private Long vehicleId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("离场经纬度") + private String leaveLngLat; + + @ApiModelProperty("离场日期时间") + private LocalDateTime leaveDateTime; + + @ApiModelProperty("最远停车点经纬度") + private String farStopLnglat; + + @ApiModelProperty("最远停车点日期时间") + private LocalDateTime farStopDateTime; + + @ApiModelProperty("最久停车点经纬度") + private String stayStopLngLat; + + @ApiModelProperty("最久停车点日期时间") + private LocalDateTime stayStopDateTime; + + @ApiModelProperty("离场信息(json数组)") + private String leaveJson; + + @ApiModelProperty("最远停车点信息(json数组)") + private String farStopJson; + + @ApiModelProperty("最久停车点信息(json数组)") + private String stayStopJson; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型 1:泵车 2:混凝土搅拌车 3:散装水泥车 4:预拌砂浆车 5:其他") + private Integer vehicleType; + + @ApiModelProperty("单位完整名称") + private String companyName; + + @ApiModelProperty("轻重车辆类型(根据所属企业距离判断) 0:未知 1:轻车 2:重车") + private Integer weightType; + + @ApiModelProperty("操作时间") + private LocalDateTime updateOn; + + @ApiModelProperty("新增时间") + private LocalDateTime createOn; + + @ApiModelProperty("是否删除 0:删除 1:存在") + private Integer status; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/entity/VehicleTripsCity.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/entity/VehicleTripsCity.java new file mode 100644 index 0000000..54b80f2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/entity/VehicleTripsCity.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.car.trips.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +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; + +/** + *

+ * 车辆单趟记录 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@TableName("nd_vehicle_trips") +@Data +@ApiModel(value = "VehicleTripsCity", description = "车辆趟次记录") +public class VehicleTripsCity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆趟次数") + private Long vehicleTripsNums; + + @ApiModelProperty("发生日期") + @TableField(exist = false) + private LocalDateTime happenDate; + + @ApiModelProperty("区域ID") + @TableField(exist = false) + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/entity/VehicleTripsCompany.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/entity/VehicleTripsCompany.java new file mode 100644 index 0000000..0e2d106 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/entity/VehicleTripsCompany.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.car.trips.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +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; + +/** + *

+ * 车辆单趟记录 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Data +@ApiModel(value = "VehicleTripsCompany", description = "车辆趟次记录") +public class VehicleTripsCompany implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车辆趟次数") + private Long vehicleTripsNums; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/manage/VehicleTripsManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/manage/VehicleTripsManage.java new file mode 100644 index 0000000..2e8937e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/manage/VehicleTripsManage.java @@ -0,0 +1,117 @@ +package com.ningdatech.carapi.car.trips.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.excel.EasyExcel; +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.google.common.collect.Lists; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.monitor.entity.AlarmDataLoad; +import com.ningdatech.carapi.car.monitor.entity.SecurityMonitorJoin; +import com.ningdatech.carapi.car.monitor.model.dto.AlarmDataLoadDTO; +import com.ningdatech.carapi.car.monitor.model.dto.LoadMonitorPageParamDTO; +import com.ningdatech.carapi.car.monitor.model.dto.SecurityMonitorPageParamDTO; +import com.ningdatech.carapi.car.monitor.model.vo.AlarmDataLoadVO; +import com.ningdatech.carapi.car.monitor.model.vo.SecurityMonitorVO; +import com.ningdatech.carapi.car.monitor.service.IAlarmDataLoadService; +import com.ningdatech.carapi.car.monitor.service.SecurityMonitorService; +import com.ningdatech.carapi.car.trips.entity.VehicleTripsCity; +import com.ningdatech.carapi.car.trips.entity.VehicleTripsCompany; +import com.ningdatech.carapi.car.trips.model.dto.VehicleTripsCityExportDTO; +import com.ningdatech.carapi.car.trips.model.dto.VehicleTripsParamDTO; +import com.ningdatech.carapi.car.trips.model.vo.VehicleTripsCityVO; +import com.ningdatech.carapi.car.trips.model.vo.VehicleTripsCompanyVO; +import com.ningdatech.carapi.car.trips.service.IVehicleTripsCityService; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.common.constant.AlarmTypeEnum; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.sys.entity.dto.CascadeCodeDTO; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +/** + * @Classname VehicleTripsManage + * @Description + * @Date 2022/11/4 16:30 + * @Created by PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class VehicleTripsManage { + + private final IVehicleTripsCityService vehicleTripsCityService; + + //逻辑修改为 从上车记录里取 + public PageVo lictGroupByCity(VehicleTripsParamDTO param) { + Page page = param.page(); + ((VehicleTripsManage)AopContext.currentProxy()).search(page,param); + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.of(Collections.emptyList(), page.getTotal()); + } + List data = page.getRecords().stream().map(w -> BeanUtil.copyProperties(w, VehicleTripsCityVO.class)).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + public PageVo lictGroupByCompany(VehicleTripsParamDTO param) { + Page page = param.page(); + ((VehicleTripsManage)AopContext.currentProxy()).searchGroupCompany(page,param); + if(0L == page.getTotal()){ + return PageVo.empty(); + } + List data = page.getRecords().stream().map(w -> BeanUtil.copyProperties(w, VehicleTripsCompanyVO.class)).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public void search(Page page, VehicleTripsParamDTO param) { + CodeUtil.buildRegionLevel(param); + vehicleTripsCityService.pageCityGetOn(page, param); + } + + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public void searchGroupCompany(Page page, VehicleTripsParamDTO param) { + vehicleTripsCityService.pageCityGetOnCompany(page, param); + } + + public void exportGroupByCity(HttpServletResponse response, VehicleTripsParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = lictGroupByCity(param); + List collect = page.getRecords().stream().map(w -> BeanUtil.copyProperties(w, VehicleTripsCityVO.class)).collect(Collectors.toList()); + String fileName = "车辆趟次列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), VehicleTripsCityExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/mapper/VehicleTripsCityMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/mapper/VehicleTripsCityMapper.java new file mode 100644 index 0000000..1ced628 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/mapper/VehicleTripsCityMapper.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.car.trips.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.trips.entity.VehicleTripsCity; +import com.ningdatech.carapi.car.trips.entity.VehicleTripsCompany; +import com.ningdatech.carapi.car.trips.model.dto.VehicleTripsParamDTO; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + *

+ * 车辆单趟记录 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface VehicleTripsCityMapper extends BaseMapper { + Page pageCity(Page page, @Param("regionIds") List regionIds, + @Param("startTime") String startTime,@Param("endTime") String endTime); + + Page pageCityGetOn(Page page, @Param("param") VehicleTripsParamDTO param); + + Page pageCityGetOnCompany(Page page, @Param("param") VehicleTripsParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/mapper/VehicleTripsCityMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/mapper/VehicleTripsCityMapper.xml new file mode 100644 index 0000000..1f707fc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/mapper/VehicleTripsCityMapper.xml @@ -0,0 +1,110 @@ + + + + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/mapper/VehicleTripsMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/mapper/VehicleTripsMapper.java new file mode 100644 index 0000000..1435ad5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/mapper/VehicleTripsMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.trips.mapper; + +import com.ningdatech.carapi.car.trips.entity.VehicleTrips; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 车辆单趟记录 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface VehicleTripsMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/mapper/VehicleTripsMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/mapper/VehicleTripsMapper.xml new file mode 100644 index 0000000..62cbd21 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/mapper/VehicleTripsMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/model/dto/VehicleTripsCityExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/model/dto/VehicleTripsCityExportDTO.java new file mode 100644 index 0000000..9733976 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/model/dto/VehicleTripsCityExportDTO.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.car.trips.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 车辆单趟记录 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Data +@ApiModel(value = "VehicleTripsCity", description = "车辆趟次记录") +public class VehicleTripsCityExportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("车辆总数") + @ExcelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆趟次数") + @ExcelProperty("车辆趟次数") + private Long vehicleTripsNums; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/model/dto/VehicleTripsParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/model/dto/VehicleTripsParamDTO.java new file mode 100644 index 0000000..a14139b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/model/dto/VehicleTripsParamDTO.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.car.trips.model.dto; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.carapi.sys.contants.RegionContant; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; +import java.util.Objects; + +/** + *

+ * 车辆趟次分页传参 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Data +@Builder +@ApiModel(value = "VehicleTripsParamDTO", description = "车辆趟次分页传参") +@AllArgsConstructor +@NoArgsConstructor +public class VehicleTripsParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("开始时间") + private String startTime; + + @ApiModelProperty("结束时间") + private String endTime; + + @ApiModelProperty("区域ID") + private Long regionId; + + private List regionIds; + private String regionCode; + private String dataScopeSql; + private Integer regionLevel; + private List vehicleTypes; + + public Long getRegionId(){ + if(Objects.isNull(this.regionId)){ + this.regionId = RegionContant.ZJ_REGION_ID; + return this.regionId; + } + return this.regionId; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/model/vo/VehicleTripsCityVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/model/vo/VehicleTripsCityVO.java new file mode 100644 index 0000000..8f17b83 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/model/vo/VehicleTripsCityVO.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.car.trips.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 车辆单趟记录 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Data +@ApiModel(value = "VehicleTripsCity", description = "车辆趟次记录") +public class VehicleTripsCityVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆趟次数") + private Long vehicleTripsNums; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/model/vo/VehicleTripsCompanyVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/model/vo/VehicleTripsCompanyVO.java new file mode 100644 index 0000000..b7523d4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/model/vo/VehicleTripsCompanyVO.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.car.trips.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 车辆单趟记录 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Data +@ApiModel(value = "VehicleTripsCompanyVO", description = "车辆趟次记录") +public class VehicleTripsCompanyVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("车辆总数") + private Long vehicleNums; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车辆趟次数") + private Long vehicleTripsNums; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/service/IVehicleTripsCityService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/service/IVehicleTripsCityService.java new file mode 100644 index 0000000..c1a8b5c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/service/IVehicleTripsCityService.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.car.trips.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.trips.entity.VehicleTripsCity; +import com.ningdatech.carapi.car.trips.entity.VehicleTripsCompany; +import com.ningdatech.carapi.car.trips.model.dto.VehicleTripsParamDTO; + +import java.util.List; + +/** + *

+ * 车辆单趟记录 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface IVehicleTripsCityService extends IService { + Page pageCity(Page page, List regionIds, + String startTime, String endTime); + + Page pageCityGetOn(Page page, + VehicleTripsParamDTO param); + + Page pageCityGetOnCompany(Page page, + VehicleTripsParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/service/IVehicleTripsService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/service/IVehicleTripsService.java new file mode 100644 index 0000000..2a4190e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/service/IVehicleTripsService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.car.trips.service; + +import com.ningdatech.carapi.car.trips.entity.VehicleTrips; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 车辆单趟记录 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +public interface IVehicleTripsService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/service/impl/VehicleTripsServiceCityImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/service/impl/VehicleTripsServiceCityImpl.java new file mode 100644 index 0000000..495a942 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/service/impl/VehicleTripsServiceCityImpl.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.car.trips.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.car.trips.entity.VehicleTrips; +import com.ningdatech.carapi.car.trips.entity.VehicleTripsCity; +import com.ningdatech.carapi.car.trips.entity.VehicleTripsCompany; +import com.ningdatech.carapi.car.trips.mapper.VehicleTripsCityMapper; +import com.ningdatech.carapi.car.trips.mapper.VehicleTripsMapper; +import com.ningdatech.carapi.car.trips.model.dto.VehicleTripsParamDTO; +import com.ningdatech.carapi.car.trips.service.IVehicleTripsCityService; +import com.ningdatech.carapi.car.trips.service.IVehicleTripsService; +import lombok.RequiredArgsConstructor; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 车辆单趟记录 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Service +@RequiredArgsConstructor +public class VehicleTripsServiceCityImpl extends ServiceImpl implements IVehicleTripsCityService { + + private final VehicleTripsCityMapper vehicleTripsCityMapper; + + @Override + public Page pageCity(Page page, List regionIds, + String startTime, String endTime) { + return vehicleTripsCityMapper.pageCity(page,regionIds,startTime,endTime); + } + + @Override + public Page pageCityGetOn(Page page, VehicleTripsParamDTO param) { + return vehicleTripsCityMapper.pageCityGetOn(page,param); + } + + @Override + public Page pageCityGetOnCompany(Page page, VehicleTripsParamDTO param) { + return vehicleTripsCityMapper.pageCityGetOnCompany(page,param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/service/impl/VehicleTripsServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/service/impl/VehicleTripsServiceImpl.java new file mode 100644 index 0000000..7097aea --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/trips/service/impl/VehicleTripsServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.car.trips.service.impl; + +import com.ningdatech.carapi.car.trips.entity.VehicleTrips; +import com.ningdatech.carapi.car.trips.mapper.VehicleTripsMapper; +import com.ningdatech.carapi.car.trips.service.IVehicleTripsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 车辆单趟记录 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-08 + */ +@Service +public class VehicleTripsServiceImpl extends ServiceImpl implements IVehicleTripsService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/contants/VehicleContant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/contants/VehicleContant.java new file mode 100644 index 0000000..de83b2e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/contants/VehicleContant.java @@ -0,0 +1,10 @@ +package com.ningdatech.carapi.car.vehicle.contants; + +public interface VehicleContant { + + String DEFAULT_CHANNEL_NAME = "通道1"; + + String DEFAULT_NULL_AUDIT = "无"; + + String ADMIN_COMPANY_NAME = "散装中心"; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/controller/VehicleController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/controller/VehicleController.java new file mode 100644 index 0000000..f820493 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/controller/VehicleController.java @@ -0,0 +1,150 @@ +package com.ningdatech.carapi.car.vehicle.controller; + +import cn.hutool.core.bean.BeanUtil; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.manage.VehicleManage; +import com.ningdatech.carapi.car.vehicle.model.vo.VehicleBaseVO; +import com.ningdatech.carapi.car.vehicle.model.dto.*; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import com.ningdatech.log.annotation.WebLog; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/archives/vehicle") +@Api(value = "archives", tags = "车辆管理-档案管理") +@RequiredArgsConstructor +public class VehicleController { + + private final VehicleManage vehicleManage; + private final IVehicleBaseInfoService vehicleBaseInfoService; + + @ApiOperation(value = "车辆列表查询", notes = "车辆列表查询") + @GetMapping("/list") + public PageVo queryList(@Valid @ModelAttribute VehicleArchivesPageQuery vehicleArchivesPageQuery) { + return vehicleManage.queryNewAddList(vehicleArchivesPageQuery); + } + + @ApiOperation(value = "车辆列表导出", notes = "车辆列表导出") + @GetMapping("/exportBase") + public void export(VehicleArchivesPageQuery req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, vehicleManage::exportNewAddBase); + } + + @ApiOperation(value = "车辆档案列表查询", notes = "车辆档案列表查询") + @GetMapping("/archivesList") + public PageVo queryArchivesList(@Valid @ModelAttribute VehicleArchivesPageQuery vehicleArchivesPageQuery) { + return vehicleManage.queryList(vehicleArchivesPageQuery); + } + + @ApiOperation(value = "车辆档案导出", notes = "车辆档案导出") + @GetMapping("/exportArchives") + @WebLog(value = "导出车辆档案") + public void exportArchives(VehicleArchivesPageQuery req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, vehicleManage::exportArchives); + } + + @ApiOperation(value = "车辆待审核列表查询", notes = "车辆待审核列表查询") + @GetMapping("/toBeAuditList") + public PageVo queryToBeAudit(@Valid @ModelAttribute VehicleAuditPageQuery vehicleAuditPageQuery) { + return vehicleManage.queryToBeAudit(vehicleAuditPageQuery); + } + + @ApiOperation(value = "车辆已审核列表查询", notes = "车辆已审核列表查询") + @GetMapping("/auditedList") + public PageVo queryAuditedList(@Valid @ModelAttribute VehicleAuditPageQuery vehicleAuditPageQuery) { + return vehicleManage.queryAuditedList(vehicleAuditPageQuery); + } + + @ApiOperation(value = "车辆审核列表导出", notes = "车辆审核列表导出") + @GetMapping("/exportAudit") + @WebLog + public void exportAudit(VehicleAuditPageQuery req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, vehicleManage::exportAudit); + } + + /** + * 查询车辆基本信息 + * + * @param id 主键id + * @return 查询结果 + */ + @ApiOperation(value = "查询车辆基本信息", notes = "查询车辆基本信息") + @GetMapping("/baseInfo") + public VehicleArchivesQueryDTO getDetails(@Valid @RequestParam Long id) { + return vehicleManage.getDetails(id); + } + + @ApiOperation(value = "保存新车辆", notes = "保存新车辆") + @PostMapping("/save") + @WebLog + public VehicleArchivesQueryDTO handlerSave(@Valid @RequestBody VehicleSaveDTO data) { + NdVehicleBaseInfo entity = vehicleManage.save(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(entity, VehicleArchivesQueryDTO.class); + } + + @ApiOperation(value = "编辑车辆(重新提交)", notes = "编辑车辆(重新提交)") + @PostMapping("/modify") + @WebLog + public VehicleArchivesQueryDTO handlerUpdate(@Valid @RequestBody VehicleUpdateDTO data) { + NdVehicleBaseInfo entity = vehicleManage.update(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(entity, VehicleArchivesQueryDTO.class); + } + + @ApiOperation(value = "删除车辆", notes = "删除车辆") + @PostMapping("/remove") + @WebLog + public Boolean handlerDelete(@Valid @RequestBody List ids) { + return vehicleManage.removeByIdWithCache(ids); + } + + @ApiOperation(value = "车辆审核", notes = "车辆审核") + @PostMapping("/audit") + @WebLog + public Boolean handlerAudit(@Valid @RequestBody VehicleAuditDTO data) { + return vehicleBaseInfoService.audit(data, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "编辑车辆基本信息", notes = "编辑车辆基本信息") + @PostMapping("/modifyBaseInfo") + @WebLog + public VehicleArchivesQueryDTO modifyUpdate(@Valid @RequestBody VehicleUpdateDTO data) { + NdVehicleBaseInfo entity = vehicleManage.modifyAndUpdate(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(entity, VehicleArchivesQueryDTO.class); + } + + @ApiOperation(value = "更新天表在线时间", notes = "更新天表在线时间") + @GetMapping("/updateOnlineTime") + public String updateOnlineTime() { + vehicleManage.updateOnlineTime(); + return "更新成功"; + } + + @ApiOperation(value = "取消车辆与所属企业、使用企业及区域的绑定") + @GetMapping("/cancel-relevance") + public String cancelRelevance(@Valid @RequestParam Long id){ + return vehicleManage.cancelRelevance(id); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/manage/VehicleManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/manage/VehicleManage.java new file mode 100644 index 0000000..4a85eaf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/manage/VehicleManage.java @@ -0,0 +1,804 @@ +package com.ningdatech.carapi.car.vehicle.manage; + +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import com.ningdatech.carapi.car.position.model.po.ReqDataPO; +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.archives.enums.AuditStateEnum; +import com.ningdatech.carapi.car.vehicle.contants.VehicleContant; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfoJoin; +import com.ningdatech.carapi.car.vehicle.model.dto.*; +import com.ningdatech.carapi.car.vehicle.model.vo.VehicleBaseVO; +import com.ningdatech.carapi.car.vehicle.model.vo.VehicleCarPlateVO; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoJoinService; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.*; +import com.ningdatech.carapi.common.helper.UserInfoHelper; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.company.enumeration.CompanyTypeEnum; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.scheduler.entity.VehicleOnlineStatusDay; +import com.ningdatech.carapi.scheduler.service.IVehicleOnlineStatusDayService; +import com.ningdatech.carapi.scheduler.service.IVehicleOnlineStatusHourService; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.helper.UserCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.model.vo.UserBasicInfoVO; +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 lombok.RequiredArgsConstructor; + +/** + * @Classname VehicleManage + * @Description + * @Date 2022/10/14 14:33 + * @Created by PoffyZhang + */ +@Component +@RequiredArgsConstructor +public class VehicleManage { + + private final IVehicleBaseInfoJoinService vehicleBaseInfoJoinService; + private final IVehicleBaseInfoService vehicleBaseInfoService; + + private final UserCacheHelper userCacheHelper; + private final OperatorsCacheHelper operatorsCacheHelper; + private final UserInfoHelper userInfoHelper; + private final RegionsCacheHelper regionsCacheHelper; + private final CompanyService companyService; + private final IVehicleOnlineStatusHourService vehicleOnlineStatusHourService; + private final IVehicleOnlineStatusDayService vehicleOnlineStatusDayService; + private final CompaniesCacheHelper companiesCacheHelper; + + /** + * 车辆档案列表查询 + * @param vehicleArchivesPageQuery + * @return + */ + public PageVo queryList(VehicleArchivesPageQuery vehicleArchivesPageQuery) { + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + + // 如果要展示没有所属企业的车 + List baseJoins = Lists.newArrayList(); + if (Boolean.TRUE.equals(vehicleArchivesPageQuery.getShowWithoutCompany())) { + LambdaQueryWrapper otherWrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + buildOtherWrapper(otherWrapper, vehicleArchivesPageQuery); + List baseInfos = vehicleBaseInfoService.list(otherWrapper).stream() + .filter(v -> Objects.isNull(v.getCompanyId())).collect(Collectors.toList()); + // 如果根据所属企业名称查询,结果置为空(因为查出的车辆所属企业不在系统中) + if (Objects.nonNull(vehicleArchivesPageQuery.getCompanyName())) { + baseInfos = Lists.newArrayList(); + } else if (Objects.nonNull(vehicleArchivesPageQuery.getOperatorName())) { + // 所属企业名称查询为空,运营商名称不为空 + baseInfos = baseInfos.stream().filter(b -> { + Long operatorId = b.getOperatorId(); + if (Objects.nonNull(operatorId)) { + OperatorQueryDTO dto = operatorsCacheHelper.getById(operatorId); + String operatorName = dto.getName(); + if (vehicleArchivesPageQuery.getOperatorName().equals(operatorName)) { + return true; + } + } + return false; + }).collect(Collectors.toList()); + } + + baseJoins = CollUtils.convert(baseInfos, r -> { + NdVehicleBaseInfoJoin join = new NdVehicleBaseInfoJoin(); + BeanUtils.copyProperties(r, join); + Long operatorId = r.getOperatorId(); + if (Objects.nonNull(operatorId)) { + OperatorQueryDTO dto = operatorsCacheHelper.getById(operatorId); + join.setOperatorName(dto.getName()); + } + return join; + }); + } + + + Integer pageSize = vehicleArchivesPageQuery.getPageSize(); + Integer pageNumber = vehicleArchivesPageQuery.getPageNumber(); + List joins; + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商id + Long operatorId = operatorQueryDTO.getId(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + buildQueryWrapper(wrapper,vehicleArchivesPageQuery); + wrapper.eq(NdVehicleBaseInfoJoin::getOperatorId,operatorId); + joins = vehicleBaseInfoJoinService.listCarJoin(wrapper); + } else if (UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId().equals(roleId)) { + Long companyId = userDetail.getCompanyId(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + buildQueryWrapper(wrapper,vehicleArchivesPageQuery); + wrapper.and(w -> w.eq(NdVehicleBaseInfoJoin::getCompanyId,companyId).or().eq(NdVehicleBaseInfoJoin::getUseCompanyId,companyId)); + joins = vehicleBaseInfoJoinService.listCarJoinWithUseCompany(wrapper); + } else { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + VehicleManage context = (VehicleManage) AopContext.currentProxy(); + joins = context.searchCar(wrapper, vehicleArchivesPageQuery); + } + joins.addAll(baseJoins); + List records = joins.stream().skip((pageNumber - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); + List data = CollUtils.convert(records, v -> { + VehicleBaseVO vo = BeanUtil.copyProperties(v, VehicleBaseVO.class); + // 根据所属企业的区域Id展示所属区域 + Long companyId = vo.getCompanyId(); + if (Objects.nonNull(companyId)) { + CompanyDTO companyDto = companiesCacheHelper.getById(companyId); + Long regionId = companyDto.getRegionId(); + if (Objects.nonNull(regionId)) { + vo.setRegionId(regionId); + vo.setRegionName(regionsCacheHelper.getDisplayName(regionId)); + } + } + CodeUtil.searchCompanyNameAndRegionName(vo); + vo.setVehicleStatus(v.getVehicleStatus()); + vo.setVehicleStatusName(CarStatusEnum.getDescByCode(v.getVehicleStatus())); + vo.setVehicleTypeName(VehicleTypeEnum.getDescByCode(vo.getVehicleType())); + return vo; + }); + return PageVo.of(data, joins.size()); + } + + /** + * 车辆新增列表查询 + * @param vehicleArchivesPageQuery + * @return + */ + public PageVo queryNewAddList(VehicleArchivesPageQuery vehicleArchivesPageQuery) { + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商id + Long operatorId = operatorQueryDTO.getId(); + Page page = vehicleArchivesPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + buildNewAddQueryWrapper(wrapper,vehicleArchivesPageQuery); + wrapper.eq(NdVehicleBaseInfoJoin::getOperatorId,operatorId); + vehicleBaseInfoJoinService.pageJoin(page,wrapper); + List data = CollUtils.convert(page.getRecords(), v -> { + VehicleBaseVO vo = BeanUtil.copyProperties(v, VehicleBaseVO.class); + // 根据所属企业的区域Id展示所属区域 + Long companyId = vo.getCompanyId(); + CompanyDTO companyDto = companiesCacheHelper.getById(companyId); + if (Objects.nonNull(companyDto)) { + Long regionId = companyDto.getRegionId(); + if (Objects.nonNull(regionId)) { + vo.setRegionId(regionId); + vo.setRegionName(regionsCacheHelper.getDisplayName(regionId)); + } + } + CodeUtil.searchCompanyNameAndRegionName(vo); + vo.setVehicleStatus(v.getVehicleStatus()); + vo.setVehicleStatusName(CarStatusEnum.getDescByCode(v.getVehicleStatus())); + vo.setVehicleTypeName(VehicleTypeEnum.getDescByCode(vo.getVehicleType())); + vo.setAuditStateName(AuditStateEnum.getDescByCode(vo.getAuditState())); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + // 如果是企业信息员账号登录,则查询该企业为所属企业和使用企业的所有车辆信息 + else if (UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId().equals(roleId)) { + Long companyId = userDetail.getCompanyId(); + Page page = vehicleArchivesPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + buildNewAddQueryWrapper(wrapper,vehicleArchivesPageQuery); + wrapper.and(w -> w.eq(NdVehicleBaseInfoJoin::getCompanyId,companyId).or().eq(NdVehicleBaseInfoJoin::getUseCompanyId,companyId)); + vehicleBaseInfoJoinService.pageJoinWithUseCompany(page,wrapper); + List data = CollUtils.convert(page.getRecords(), v -> { + VehicleBaseVO vo = BeanUtil.copyProperties(v, VehicleBaseVO.class); + vo.setVehicleStatus(v.getVehicleStatus()); + vo.setVehicleStatusName(CarStatusEnum.getDescByCode(v.getVehicleStatus())); + CodeUtil.searchCompanyNameAndRegionName(vo); + vo.setVehicleTypeName(VehicleTypeEnum.getDescByCode(vo.getVehicleType())); + vo.setAuditStateName(AuditStateEnum.getDescByCode(vo.getAuditState())); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } else { + Page page = vehicleArchivesPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + VehicleManage context = (VehicleManage) AopContext.currentProxy(); + context.searchNewAddPage(page, wrapper, vehicleArchivesPageQuery); + List data = CollUtils.convert(page.getRecords(), v -> { + VehicleBaseVO vo = BeanUtil.copyProperties(v, VehicleBaseVO.class); + vo.setVehicleStatus(v.getVehicleStatus()); + vo.setVehicleStatusName(CarStatusEnum.getDescByCode(v.getVehicleStatus())); + CodeUtil.searchCompanyNameAndRegionName(vo); + vo.setVehicleTypeName(VehicleTypeEnum.getDescByCode(vo.getVehicleType())); + vo.setAuditStateName(AuditStateEnum.getDescByCode(vo.getAuditState())); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + } + + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public void searchNewAddPage(Page page, LambdaQueryWrapper wrapper, VehicleArchivesPageQuery vehicleArchivesPageQuery) { + buildNewAddQueryWrapper(wrapper,vehicleArchivesPageQuery); + vehicleBaseInfoJoinService.pageJoin(page,wrapper); + } + + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public void searchPage(Page page, LambdaQueryWrapper wrapper, VehicleArchivesPageQuery vehicleArchivesPageQuery) { + buildQueryWrapper(wrapper,vehicleArchivesPageQuery); + vehicleBaseInfoJoinService.pageJoin(page,wrapper); + } + + @BuildChildrenRegionWrapper + public List searchCar(LambdaQueryWrapper wrapper, VehicleArchivesPageQuery vehicleArchivesPageQuery) { + buildQueryWrapper(wrapper,vehicleArchivesPageQuery); + return vehicleBaseInfoJoinService.listCarJoin(wrapper); + } + + + + /** + * 车辆审核列表 + * @param vehicleArchivesPageQuery + * @return + */ + public PageVo queryArchivesList(VehicleArchivesPageQuery vehicleArchivesPageQuery) { + Page page = vehicleArchivesPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + VehicleManage context = (VehicleManage)AopContext.currentProxy(); + context.searchArchivesPage(page,wrapper,vehicleArchivesPageQuery); + PageVo pageVo = PageVo.empty(); + VUtils.isTrueOrFalse(0L == page.getTotal()).trueOrFalseHandler( + () -> {}, + () -> { + pageVo.setRecords(CollUtils.convert(page.getRecords(), v -> { + VehicleBaseVO vo = BeanUtil.copyProperties(v, VehicleBaseVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + vo.setVehicleTypeName(VehicleTypeEnum.getDescByCode(vo.getVehicleType())); + return vo; + })); + pageVo.setTotal(page.getTotal()); + } + ); + + return pageVo; + } + + public PageVo queryArchivesListOpen(VehicleArchivesPageQuery vehicleArchivesPageQuery) { + Page page = vehicleArchivesPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + buildWrapper(wrapper,vehicleArchivesPageQuery); + vehicleBaseInfoService.page(page,wrapper); + PageVo pageVo = PageVo.empty(); + VUtils.isTrueOrFalse(0L == page.getTotal()).trueOrFalseHandler( + () -> {}, + () -> { + pageVo.setRecords(CollUtils.convert(page.getRecords(), v -> { + VehicleBaseVO vo = BeanUtil.copyProperties(v, VehicleBaseVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + vo.setVehicleTypeName(VehicleTypeEnum.getDescByCode(vo.getVehicleType())); + return vo; + })); + pageVo.setTotal(page.getTotal()); + } + ); + return pageVo; + } + + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public void searchArchivesPage(Page page, LambdaQueryWrapper wrapper, + VehicleArchivesPageQuery vehicleArchivesPageQuery) { + buildHasEquipmentQueryWrapper(wrapper,vehicleArchivesPageQuery); + vehicleBaseInfoJoinService.pageJoinWithEquipment(page,wrapper); + } + + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public void searchArchivesPageOpen(Page page, LambdaQueryWrapper wrapper, + VehicleArchivesPageQuery vehicleArchivesPageQuery) { + buildHasEquipmentQueryWrapper(wrapper,vehicleArchivesPageQuery); + vehicleBaseInfoJoinService.pageJoinWithEquipmentOpen(page,wrapper); + } + + /** + * 车辆待审核 + * @param vehicleAuditPageQuery + * @return + */ + public PageVo queryToBeAudit(VehicleAuditPageQuery vehicleAuditPageQuery) { + Page page = vehicleAuditPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + wrapper.eq(NdVehicleBaseInfoJoin::getAuditState, AuditStateEnum.AUDIT.getCode()); + VehicleManage context = (VehicleManage)AopContext.currentProxy(); + context.searchTobeAuditPage(page,wrapper,vehicleAuditPageQuery); + List data = CollUtils.convert(page.getRecords(), v -> { + VehicleBaseVO vo = BeanUtil.copyProperties(v, VehicleBaseVO.class); + // 根据所属企业的区域Id展示所属区域 + Long companyId = vo.getCompanyId(); + if (Objects.nonNull(companyId)) { + CompanyDTO companyDto = companiesCacheHelper.getById(companyId); + if (Objects.nonNull(companyDto)) { + Long regionId = companyDto.getRegionId(); + if (Objects.nonNull(regionId)) { + vo.setRegionId(regionId); + vo.setRegionName(regionsCacheHelper.getDisplayName(regionId)); + } + } + } + CodeUtil.searchCompanyNameAndRegionName(vo); + vo.setVehicleTypeName(VehicleTypeEnum.getDescByCode(vo.getVehicleType())); + vo.setVehicleStatus(v.getVehicleStatus()); + vo.setVehicleStatusName(CarStatusEnum.getDescByCode(v.getVehicleStatus())); + // 判断当前登录用户是否可以审核该车辆 + if (!checkCanAudit(vo)){ + vo.setCanAudit(Boolean.FALSE); + } + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + private boolean checkCanAudit(VehicleBaseVO vo) { + // 根据当前登录用户角色判断: + // 如果登录用户是区县散办管理员,且车辆所属区域有区县散办则可以审核; + // 如果登录用户是市级散办管理员,且车辆所属区域没有区县散办则可以审核; + UserBasicInfoVO userFullInfo = userInfoHelper.getUserFullInfo(); + Long roleId = userFullInfo.getRoleId(); + Long userRegionId = userFullInfo.getRegionId(); + Long regionId = vo.getRegionId(); + if (UserRoleTypeEnum.REGION_ADMIN_ROLE_ID.getId().equals(roleId) + && regionId.equals(userRegionId)){ + return true; + } else if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(roleId)) { + // 如果是市级散办 + // 查询车辆所属区域是否为该市下属区域且无区县散办 + List childRegions = regionsCacheHelper.listChild(userRegionId); + if (CollUtil.isNotEmpty(childRegions) && childRegions.contains(regionId)){ + // 获取车辆所属区域的区县散办 + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + if (Objects.nonNull(regionDto)) { + String adminCompanyName = regionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME; + // 根据区县散办所属管理企业名称查询管理企业,如果不存在,说明没有相应的区县散办 + Company company = companyService.getCompanyByCompanyNames(adminCompanyName); + if (Objects.isNull(company) || !company.getCompanyType().equals(CompanyTypeEnum.MANAGE_BU.getCode())){ + // 没有下属区县散办,则可以审核 + return true; + }else { + // 有下属区县散办,不可以审核 + return false; + } + } + } + // 该市没有下属子区域,可以审核 + return true; + } + return false; + } + + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public void searchTobeAuditPage(Page page, LambdaQueryWrapper wrapper, + VehicleAuditPageQuery vehicleAuditPageQuery) { + buildAuditQueryWrapper(wrapper,vehicleAuditPageQuery); + vehicleBaseInfoJoinService.pageJoin(page,wrapper); + } + + /** + * 车辆已审核 + * @param vehicleAuditPageQuery + * @return + */ + public PageVo queryAuditedList(VehicleAuditPageQuery vehicleAuditPageQuery) { + Page page = vehicleAuditPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class); + VehicleManage context = (VehicleManage)AopContext.currentProxy(); + context.searchAuditedPage(page,wrapper,vehicleAuditPageQuery); + List data = CollUtils.convert(page.getRecords(), v -> { + VehicleBaseVO vo = BeanUtil.copyProperties(v, VehicleBaseVO.class); + // 根据所属企业的区域Id展示所属区域 + Long companyId = vo.getCompanyId(); + if (Objects.nonNull(companyId)) { + CompanyDTO companyDto = companiesCacheHelper.getById(companyId); + if (Objects.nonNull(companyDto)) { + Long regionId = companyDto.getRegionId(); + if (Objects.nonNull(regionId)) { + vo.setRegionId(regionId); + vo.setRegionName(regionsCacheHelper.getDisplayName(regionId)); + } + } + } + CodeUtil.searchCompanyNameAndRegionName(vo); + vo.setVehicleTypeName(VehicleTypeEnum.getDescByCode(vo.getVehicleType())); + vo.setVehicleStatus(v.getVehicleStatus()); + vo.setVehicleStatusName(CarStatusEnum.getDescByCode(v.getVehicleStatus())); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public void searchAuditedPage(Page page, LambdaQueryWrapper wrapper, + VehicleAuditPageQuery vehicleAuditPageQuery) { + buildAuditQueryWrapper(wrapper,vehicleAuditPageQuery); + wrapper.and(wp -> wp.eq(NdVehicleBaseInfoJoin::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()).or() + .eq(NdVehicleBaseInfoJoin::getAuditState, AuditStateEnum.AUDIT_FAIL.getCode())); + vehicleBaseInfoJoinService.pageJoin(page,wrapper); + } + + /** + * 获取车辆详情 + * @param id + * @return + */ + public VehicleArchivesQueryDTO getDetails(Long id) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + VehicleManage context = (VehicleManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + NdVehicleBaseInfo ndVehicleBaseInfo = vehicleBaseInfoService.getOne(wrapper); + if (Objects.isNull(ndVehicleBaseInfo)){ + return null; + } + + VehicleArchivesQueryDTO query = BeanUtil.toBean(ndVehicleBaseInfo, VehicleArchivesQueryDTO.class); + Long useCompanyId = ndVehicleBaseInfo.getUseCompanyId(); + if (Objects.nonNull(useCompanyId)){ + CompanyDTO companyDto = companiesCacheHelper.getById(useCompanyId); + if (Objects.nonNull(companyDto)) { + query.setUseCompanyName(companyDto.getName()); + } + } + CodeUtil.searchCompanyNameAndRegionName(query); + NdUserInfo user = userCacheHelper.getById(ndVehicleBaseInfo.getAuditBy()); + query.setAuditBy(Objects.nonNull(user) ? user.getUsername() : (Objects.nonNull(ndVehicleBaseInfo.getAuditBy()) ? ndVehicleBaseInfo.getAuditBy() +StringUtils.EMPTY : VehicleContant.DEFAULT_NULL_AUDIT)); + query.setVehicleStatusName(CarStatusEnum.getDescByCode(ndVehicleBaseInfo.getVehicleStatus())); + Long operatorId = query.getOperatorId(); + if (Objects.nonNull(operatorId)) { + OperatorQueryDTO operatorQueryDto = operatorsCacheHelper.getById(operatorId); + if (Objects.nonNull(operatorQueryDto)) { + query.setOperatorName(operatorQueryDto.getName()); + } + } + return query; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(NdVehicleBaseInfo::getId,id); + } + + /** + * 查询车牌号 + * @param companyIds + * @return + */ + public List listByCompanyIds(List companyIds) { + List ndVehicleBaseInfos = vehicleBaseInfoJoinService.listJoin( + Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class).in(NdVehicleBaseInfoJoin::getCompanyId,companyIds)); + List query = CollUtils.convert(ndVehicleBaseInfos,w -> BeanUtil.copyProperties(w, VehicleCarPlateVO.class)); + return query; + } + + /** + * 处理 + * @param wrapper + * @param vehicleArchivesPageQuery + */ + private void buildQueryWrapper(LambdaQueryWrapper wrapper, VehicleArchivesPageQuery vehicleArchivesPageQuery) { + + wrapper.eq(NdVehicleBaseInfoJoin::getDeleted, DeletedEnum.NO_DELETED.getCode()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getCompanyId()),NdVehicleBaseInfoJoin::getCompanyId,vehicleArchivesPageQuery.getCompanyId()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getCarPlate()), NdVehicleBaseInfoJoin::getCarPlate, vehicleArchivesPageQuery.getCarPlate()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getCompanyName()), NdVehicleBaseInfoJoin::getCompanyName, vehicleArchivesPageQuery.getCompanyName()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getUseCompanyName()),NdVehicleBaseInfoJoin::getUseCompanyName,vehicleArchivesPageQuery.getUseCompanyName()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getVehicleType()), NdVehicleBaseInfoJoin::getVehicleType, vehicleArchivesPageQuery.getVehicleType()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getVehicleStatus()),NdVehicleBaseInfoJoin::getVehicleStatus,vehicleArchivesPageQuery.getVehicleStatus()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getOperatorName()), NdVehicleBaseInfoJoin::getOperatorName, vehicleArchivesPageQuery.getOperatorName()) + //.eq(Objects.nonNull(vehicleArchivesPageQuery.getRegionId()),NdVehicleBaseInfoJoin::getRegionId,vehicleArchivesPageQuery.getRegionId()) + .eq(NdVehicleBaseInfoJoin::getAuditState,AuditStateEnum.AUDIT_SUCCESS.getCode()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdVehicleBaseInfoJoin::getUpdateOn); + } + + /** + * 处理 + * @param wrapper + * @param vehicleArchivesPageQuery + */ + private void buildOtherWrapper(LambdaQueryWrapper wrapper, VehicleArchivesPageQuery vehicleArchivesPageQuery) { + + wrapper.eq(NdVehicleBaseInfo::getDeleted, DeletedEnum.NO_DELETED.getCode()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getCompanyId()),NdVehicleBaseInfo::getCompanyId,vehicleArchivesPageQuery.getCompanyId()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getCarPlate()), NdVehicleBaseInfo::getCarPlate, vehicleArchivesPageQuery.getCarPlate()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getUseCompanyName()),NdVehicleBaseInfo::getUseCompanyName,vehicleArchivesPageQuery.getUseCompanyName()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getVehicleType()), NdVehicleBaseInfo::getVehicleType, vehicleArchivesPageQuery.getVehicleType()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getVehicleStatus()),NdVehicleBaseInfo::getVehicleStatus,vehicleArchivesPageQuery.getVehicleStatus()) + //.eq(Objects.nonNull(vehicleArchivesPageQuery.getRegionId()),NdVehicleBaseInfo::getRegionId,vehicleArchivesPageQuery.getRegionId()) + .eq(NdVehicleBaseInfo::getAuditState,AuditStateEnum.AUDIT_SUCCESS.getCode()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdVehicleBaseInfo::getUpdateOn); + } + + /** + * 处理 + * @param wrapper + * @param vehicleArchivesPageQuery + */ + private void buildNewAddQueryWrapper(LambdaQueryWrapper wrapper, VehicleArchivesPageQuery vehicleArchivesPageQuery) { + //if(Objects.nonNull(vehicleArchivesPageQuery.getAuditType())){ + // wrapper.eq(AuditStateEnum.AUDIT.getCode().equals(vehicleArchivesPageQuery.getAuditType()), NdVehicleBaseInfoJoin::getAuditState, AuditStateEnum.AUDIT.getCode()) + // .and(AuditStateEnum.AUDIT_SUCCESS.getCode().equals(vehicleArchivesPageQuery.getAuditType()) || + // AuditStateEnum.AUDIT_FAIL.getCode().equals(vehicleArchivesPageQuery.getAuditType()), + // wp -> wp.eq(NdVehicleBaseInfoJoin::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()) + // .or().eq(NdVehicleBaseInfoJoin::getAuditState, AuditStateEnum.AUDIT_FAIL.getCode())); + //} + wrapper.eq(NdVehicleBaseInfoJoin::getDeleted, DeletedEnum.NO_DELETED.getCode()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getCarPlate()), NdVehicleBaseInfoJoin::getCarPlate, vehicleArchivesPageQuery.getCarPlate()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getVehicleType()), NdVehicleBaseInfoJoin::getVehicleType, vehicleArchivesPageQuery.getVehicleType()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getRegionId()),NdVehicleBaseInfoJoin::getRegionId,vehicleArchivesPageQuery.getRegionId()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getAuditType()), NdVehicleBaseInfoJoin::getAuditState,vehicleArchivesPageQuery.getAuditType()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdVehicleBaseInfoJoin::getUpdateOn); + } + + /** + * 处理 + * @param wrapper + * @param vehicleArchivesPageQuery + */ + private void buildWrapper(LambdaQueryWrapper wrapper, VehicleArchivesPageQuery vehicleArchivesPageQuery) { + if(Objects.nonNull(vehicleArchivesPageQuery.getAuditType())){ + wrapper.eq(AuditStateEnum.AUDIT.getCode().equals(vehicleArchivesPageQuery.getAuditType()), NdVehicleBaseInfo::getAuditState, AuditStateEnum.AUDIT.getCode()) + .and(AuditStateEnum.AUDIT_SUCCESS.getCode().equals(vehicleArchivesPageQuery.getAuditType()) || + AuditStateEnum.AUDIT_FAIL.getCode().equals(vehicleArchivesPageQuery.getAuditType()), + wp -> wp.eq(NdVehicleBaseInfo::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()) + .or().eq(NdVehicleBaseInfo::getAuditState, AuditStateEnum.AUDIT_FAIL.getCode())); + } + wrapper.eq(NdVehicleBaseInfo::getDeleted, DeletedEnum.NO_DELETED.getCode()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getCompanyId()),NdVehicleBaseInfo::getCompanyId,vehicleArchivesPageQuery.getCompanyId()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getCarPlate()), NdVehicleBaseInfo::getCarPlate, vehicleArchivesPageQuery.getCarPlate()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getUseCompanyName()),NdVehicleBaseInfo::getUseCompanyName,vehicleArchivesPageQuery.getUseCompanyName()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getVehicleType()), NdVehicleBaseInfo::getVehicleType, vehicleArchivesPageQuery.getVehicleType()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdVehicleBaseInfo::getUpdateOn); + } + + private void buildHasEquipmentQueryWrapper(LambdaQueryWrapper wrapper, + VehicleArchivesPageQuery vehicleArchivesPageQuery) { + wrapper.eq(NdVehicleBaseInfoJoin::getDeleted, DeletedEnum.NO_DELETED.getCode()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getCarPlate()), NdVehicleBaseInfoJoin::getCarPlate, vehicleArchivesPageQuery.getCarPlate()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getCompanyName()), NdVehicleBaseInfoJoin::getCompanyName, vehicleArchivesPageQuery.getCompanyName()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getVehicleType()), NdVehicleBaseInfoJoin::getVehicleType, vehicleArchivesPageQuery.getVehicleType()) + //要审核成功 并且审核通过才能进档案 + .eq(NdVehicleBaseInfoJoin::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getCompanyId()),NdVehicleBaseInfoJoin::getCompanyId, vehicleArchivesPageQuery.getCompanyId()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getOperatorName()), NdVehicleBaseInfoJoin::getOperatorName, vehicleArchivesPageQuery.getOperatorName()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdVehicleBaseInfoJoin::getUpdateOn); + } + + /** + * 处理 + * @param wrapper + * @param vehicleAuditPageQuery + */ + private void buildAuditQueryWrapper(LambdaQueryWrapper wrapper, VehicleAuditPageQuery vehicleAuditPageQuery) { + wrapper.eq(NdVehicleBaseInfoJoin::getDeleted, DeletedEnum.NO_DELETED.getCode()) + .like(StringUtils.isNotBlank(vehicleAuditPageQuery.getCarPlate()), NdVehicleBaseInfoJoin::getCarPlate, vehicleAuditPageQuery.getCarPlate()) + .like(StringUtils.isNotBlank(vehicleAuditPageQuery.getCompanyName()), NdVehicleBaseInfoJoin::getCompanyName, vehicleAuditPageQuery.getCompanyName()) + .eq(Objects.nonNull(vehicleAuditPageQuery.getVehicleType()), NdVehicleBaseInfoJoin::getVehicleType, vehicleAuditPageQuery.getVehicleType()) + .eq(Objects.nonNull(vehicleAuditPageQuery.getAuditType()),NdVehicleBaseInfoJoin::getAuditState,vehicleAuditPageQuery.getAuditType()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdVehicleBaseInfoJoin::getUpdateOn); + } + + public void exportNewAddBase(HttpServletResponse response, VehicleArchivesPageQuery archivesPageQuery) { + archivesPageQuery.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = queryNewAddList(archivesPageQuery); + List collect = page.getRecords().stream().map(w -> BeanUtil.copyProperties(w, VehicleBaseExportDTO.class)).collect(Collectors.toList()); + String fileName = "车辆信息"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), VehicleBaseExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void exportArchives(HttpServletResponse response, VehicleArchivesPageQuery archivesPageQuery) { + archivesPageQuery.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = queryList(archivesPageQuery); + List exportData = page.getRecords().stream() + .map(w -> BeanUtil.copyProperties(w, VehicleBaseVO.class)) + .collect(Collectors.toList()); + String fileName = "车辆档案信息"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), VehicleBaseExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(exportData); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void export(HttpServletResponse response, VehicleArchivesPageQuery archivesPageQuery) { + archivesPageQuery.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = queryArchivesList(archivesPageQuery); + List collect = page.getRecords().stream().map(w -> BeanUtil.copyProperties(w, VehicleBaseVO.class)).collect(Collectors.toList()); + String fileName = "车辆档案信息"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), VehicleBaseExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void exportAudit(HttpServletResponse response, VehicleAuditPageQuery auditPageQuery) { + auditPageQuery.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo toBePage = queryToBeAudit(auditPageQuery); + PageVo auditPage = queryAuditedList(auditPageQuery); + List toBeList = toBePage.getRecords().stream().map(w -> BeanUtil.copyProperties(w, VehicleBaseVO.class)).collect(Collectors.toList()); + List auditList = auditPage.getRecords().stream().map(w -> BeanUtil.copyProperties(w, VehicleBaseVO.class)).collect(Collectors.toList()); + String fileName = "车辆审核列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + String sheetNameToBe = "车辆待审核列表"; + String sheetNameAudited = "车辆已审核列表"; + try { + ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build(); + //埋点基础信息 sheet + WriteSheet writeSheet = EasyExcel.writerSheet(0, sheetNameToBe) + .head(VehicleBaseExportDTO.class).build(); + excelWriter.write(toBeList, writeSheet); + //埋点数据转换信息 sheet + writeSheet = EasyExcel.writerSheet(1, sheetNameAudited) + .head(VehicleBaseExportDTO.class).build(); + excelWriter.write(auditList, writeSheet); + //埋点触发规则信息 sheet + excelWriter.finish(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + + /** + * 根据车牌号和公司ID 获取车辆 信息 是唯一 + * @param carPlate + * @param companyId + * @return + */ + public NdVehicleBaseInfo queryByCarPlateAndCompanyId(String carPlate, Long companyId) { + return vehicleBaseInfoService.getOne(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getCarPlate, carPlate) + .eq(NdVehicleBaseInfo::getCompanyId, companyId)); + } + + public NdVehicleBaseInfo update(VehicleUpdateDTO data, Long userId) { + return vehicleBaseInfoService.update(data, userId); + } + + public NdVehicleBaseInfo save(VehicleSaveDTO data, Long userId) { + return vehicleBaseInfoService.save(data, userId); + } + + public Boolean removeByIdWithCache(List ids) { + return vehicleBaseInfoService.removeByIdWithCache(ids); + } + + public NdVehicleBaseInfo modifyAndUpdate(VehicleUpdateDTO data, Long userId) { + return vehicleBaseInfoService.modifyAndUpdate(data, userId); + } + + public void updateOnlineTime() { + // 获取所有车辆信息 + Map timeMap = vehicleBaseInfoService.list().stream() + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + // 查出天表所有 累计在线的车辆 + VehicleOnlineStatusDay statusday = new VehicleOnlineStatusDay(); + statusday.setYear(String.valueOf(LocalDateTime.now().getYear())); + statusday.setMonth(String.valueOf(LocalDateTime.now().getMonthValue())); + statusday.setDay(String.valueOf(LocalDateTime.now().getDayOfMonth())); + List onlineDays = vehicleOnlineStatusDayService.listByReqInMonthTable(statusday); + Map onlineDayMap = onlineDays.stream().collect(Collectors.toMap(v -> v.getCarPlate() + v.getYear() + + v.getMonth() + v.getDay(), v -> v)); + + // 将天表在线数据按车牌号分组,获取每个车牌号最新的一条在线数据 + Map onlineStatusDayMap = onlineDays.stream().collect(Collectors.groupingBy(VehicleOnlineStatusDay::getCarPlate, + Collectors.collectingAndThen(Collectors.maxBy(Comparator.comparing(VehicleOnlineStatusDay::getOnlineTime)), Optional::get))); + + // 遍历所有车牌号,如果天表中没有在线数据,需要到对应的GPS表中 + for (String carPlate : timeMap.keySet()) { + VehicleOnlineStatusDay vehicleOnlineStatusDay = onlineStatusDayMap.get(carPlate); + NdVehicleBaseInfo ndVehicleBaseInfo = timeMap.get(carPlate); + if (Objects.isNull(vehicleOnlineStatusDay)) { + ndVehicleBaseInfo.setLastOnlineTime(vehicleOnlineStatusDay.getOnlineTime()); + } + } + } + + public String cancelRelevance(Long id) { + NdVehicleBaseInfo baseInfo = vehicleBaseInfoService.getById(id); + if (Objects.isNull(baseInfo)){ + throw new BizException("车辆信息不存在!"); + } + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(NdVehicleBaseInfo.class); + updateWrapper.set(NdVehicleBaseInfo::getCompanyId, null) + .set(NdVehicleBaseInfo::getUseCompanyId, null) + .set(NdVehicleBaseInfo::getUseCompanyName, null) + .set(NdVehicleBaseInfo::getRegionId, null) + .set(NdVehicleBaseInfo::getRegionName, null) + .eq(NdVehicleBaseInfo::getId, baseInfo.getId()); + boolean update = vehicleBaseInfoService.update(updateWrapper); + if (update){ + return "取消关联成功!"; + } + return "取消关联失败!"; + } + + /** + * 批量查询 车辆信息 用车牌号 + * @param + * @return + */ + public List listByCarplate(ReqDataPO po) { + List carPlates = po.getCarPlates(); + if(CollUtil.isEmpty(carPlates)){ + return Collections.emptyList(); + } + List ndVehicleBaseInfos = vehicleBaseInfoJoinService.listJoin( + Wrappers.lambdaQuery(NdVehicleBaseInfoJoin.class).in(NdVehicleBaseInfoJoin::getCarPlate,carPlates)); + List query = CollUtils.convert(ndVehicleBaseInfos,w -> BeanUtil.copyProperties(w, VehicleBaseVO.class)); + return query; + } +} + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/mapper/VehicleBaseInfoJoinMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/mapper/VehicleBaseInfoJoinMapper.java new file mode 100644 index 0000000..f4c060e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/mapper/VehicleBaseInfoJoinMapper.java @@ -0,0 +1,79 @@ +package com.ningdatech.carapi.car.vehicle.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfoJoin; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +public interface VehicleBaseInfoJoinMapper extends BaseMapper { + + String QUERY_SQL = "SELECT b.*, c.name as company_name,o.name as operator_name, " + + "null as equipment_id FROM nd_vehicle_base_info AS b " + + "LEFT JOIN nd_company_info AS c ON b.company_id = c.id " + + "LEFT JOIN nd_operator_info AS o ON b.operator_id = o.id "; + String WRAPPER_SQL = "SELECT * from ( " + QUERY_SQL + " ) AS q ${ew.customSqlSegment}"; + + + String QUERY_SQL_WITH_NO_COMPANY = "SELECT b.*, c.name as company_name,o.name as operator_name, " + + "null as equipment_id FROM nd_vehicle_base_info AS b " + + "LEFT JOIN nd_company_info AS c ON b.company_id = c.id " + + "LEFT JOIN nd_operator_info AS o ON b.operator_id = o.id where b.company_id is not null "; + String WRAPPER_NO_COMPANY_SQL = "SELECT * from ( " + QUERY_SQL_WITH_NO_COMPANY + ") AS q ${ew.customSqlSegment}"; + + String QUERY_SQL_WITH_EQUIPMENT = "SELECT" + + " b.*," + + " c.NAME AS company_name," + + " o.NAME AS operator_name," + + " null as equipment_id" + + " FROM " + + " nd_vehicle_base_info AS b" + + " LEFT JOIN nd_company_info AS c ON b.company_id = c.id" + + " LEFT JOIN nd_operator_info AS o ON b.operator_id = o.id" + + " where b.id in (select vehicle_id from nd_vehicle_equipment_info where equipment_function = 'video') "; + String WRAPPER_SQL_WITH_EQUIPMENT = "SELECT * from ( " + QUERY_SQL_WITH_EQUIPMENT + " ) AS q ${ew.customSqlSegment}"; + + String QUERY_SQL_WITH_NOT_EQUIPMENT = "SELECT" + + " b.*," + + " c.NAME AS company_name," + + " o.NAME AS operator_name," + + " null as equipment_id" + + " FROM " + + " nd_vehicle_base_info AS b" + + " LEFT JOIN nd_company_info AS c ON b.company_id = c.id" + + " LEFT JOIN nd_operator_info AS o ON b.operator_id = o.id" + + " where b.car_plate not in (select car_plate from nd_vehicle_equipment_info where equipment_function = 'video') "; + String WRAPPER_SQL_WITH_NOT_EQUIPMENT = "SELECT * from ( " + QUERY_SQL_WITH_NOT_EQUIPMENT + " ) AS q ${ew.customSqlSegment}"; + + @Select(WRAPPER_SQL) + Page pageJoin(Page page, @Param("ew") LambdaQueryWrapper wrapper); + + @Select(WRAPPER_SQL) + List listJoin(@Param("ew") LambdaQueryWrapper wrapper); + + @Select(WRAPPER_SQL) + NdVehicleBaseInfoJoin oneJoin(@Param("ew") LambdaQueryWrapper wrapper); + + @Select(WRAPPER_SQL_WITH_EQUIPMENT) + Page pageJoinWithEquipment(Page page,@Param("ew") LambdaQueryWrapper wrapper); + + @Select(WRAPPER_SQL_WITH_EQUIPMENT) + NdVehicleBaseInfoJoin oneJoinWithEquipment(@Param("ew") LambdaQueryWrapper wrapper); + + @Select(WRAPPER_SQL_WITH_NOT_EQUIPMENT) + Page pageJoinWithNotEquipment(Page page,@Param("ew") LambdaQueryWrapper wrapper); + + @Select(WRAPPER_NO_COMPANY_SQL) + List listCarJoin(@Param("ew") LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/mapper/VehicleBaseInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/mapper/VehicleBaseInfoMapper.java new file mode 100644 index 0000000..163a216 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/mapper/VehicleBaseInfoMapper.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.car.vehicle.mapper; + +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.vehicle.model.po.VehicleCompanyPO; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.po.OverspeedStatisticsPO; +import com.ningdatech.carapi.homepage.entity.po.VehicleNumPO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +public interface VehicleBaseInfoMapper extends BaseMapper { + + /** + * 获取车牌号 通过企业ID + * @param companyIds + * @return + */ + List getCarPlatesByCompanyIds(@Param("companyIds") List companyIds); + + List getZj(@Param("param") DataScreenParam param); + + List getCity(@Param("param") DataScreenParam param); + + List getDistrict(@Param("param") DataScreenParam param); + + VehicleNumPO searchVehicleNum(@Param("param") DataScreenParam param); + + Boolean updateOfflineNotInCarPlates(@Param("cars") List carsOnline); + + boolean batchUpdate(@Param("cars") List batchSaveCars); + + List getCarPlatesByUseCompanyId(Long companyId); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/mapper/VehicleBaseInfoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/mapper/VehicleBaseInfoMapper.xml new file mode 100644 index 0000000..319282c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/mapper/VehicleBaseInfoMapper.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + update nd_vehicle_base_info + set status = 0,moving = 0 + where car_plate not in ( + + #{item} + + ) + + + + update nd_vehicle_base_info + set status = 0,moving = 0 + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/NdVehicleBaseInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/NdVehicleBaseInfo.java new file mode 100644 index 0000000..be9e393 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/NdVehicleBaseInfo.java @@ -0,0 +1,211 @@ +package com.ningdatech.carapi.car.vehicle.model; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import javax.validation.constraints.Size; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@TableName("nd_vehicle_base_info") +@ApiModel(value = "NdVehicleBaseInfo", description = "车辆档案-车辆基本信息") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleBaseInfo extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("车牌号") + @Size(max = 20, message = "车牌号不能超过20") + @TableField(value = "car_plate") + private String carPlate; + + @ApiModelProperty("自编号") + @Size(max = 30, message = "自编号长度不能超过30") + @TableField(value = "self_no") + private String selfNo; + + @ApiModelProperty("车辆颜色") + @TableField(value = "plate_color") + private String plateColor; + + @ApiModelProperty("所属企业ID") + @TableField(value = "company_id") + private Long companyId; + + @ApiModelProperty("车辆类型") + @TableField(value = "vehicle_type") + private Integer vehicleType; + + @ApiModelProperty("总质量 单位:吨") + @TableField(value = "standard_tonnage") + private Double standardTonnage; + + @ApiModelProperty("发动机号") + @TableField(value = "engine_no") + private String engineNo; + + @ApiModelProperty("底盘号") + @TableField(value = "chassis_no") + private String chassisNo; + + @ApiModelProperty("运营商ID") + @TableField(value = "operator_id") + private Long operatorId; + + @ApiModelProperty("责任驾驶员一") + @TableField(value = "responsible_driver_first") + private String responsibleDriverFirst; + + @ApiModelProperty("责任驾驶员一 电话") + @TableField(value = "responsible_driver_first_mobile") + private String responsibleDriverFirstMobile; + + @ApiModelProperty("责任驾驶员二") + @TableField(value = "responsible_driver_second") + private String responsibleDriverSecond; + + @ApiModelProperty("责任驾驶员二 电话") + @TableField(value = "responsible_driver_second_mobile") + private String responsibleDriverSecondMobile; + + @ApiModelProperty("百公里油耗 单位: L/km") + @TableField(value = "fuel_consumption_per") + private Double fuelConsumptionPer; + + @ApiModelProperty("限速值 公里/小时") + @TableField(value = "limited_speed") + private Double limitedSpeed; + + @ApiModelProperty("标准油量 L") + @TableField(value = "standard_oil_quantity") + private Double standardOilQuantity; + + @ApiModelProperty("车身长度 cm") + @TableField(value = "vehicle_length") + private Double vehicleLength; + + @ApiModelProperty("保养时间") + @TableField(value = "service_time") + private LocalDateTime serviceTime; + + @ApiModelProperty("保养时间周期 天") + @TableField(value = "service_time_interval") + private Integer serviceTimeInterval; + + @ApiModelProperty("保养里程 km") + @TableField(value = "service_cycle") + private Double serviceCycle; + + @ApiModelProperty("保养时间周期 天") + @TableField(value = "service_cycle_interval") + private Integer serviceCycleInterval; + + @ApiModelProperty("服务费开始时间") + @TableField(value = "service_fee_start") + private LocalDateTime serviceFeeStart; + + @ApiModelProperty("服务费结束时间") + @TableField(value = "service_fee_end") + private LocalDateTime serviceFeeEnd; + + @ApiModelProperty("燃油级别") + @TableField(value = "fuel_level") + private String fuelLevel; + + @ApiModelProperty("道路运证编号") + @TableField(value = "road_transportation_num") + private String roadTransportationNum; + + @ApiModelProperty("审核状态 1.审核中 2.审核通过 3.审核不通过") + @TableField(value = "audit_state") + private Integer auditState; + + @ApiModelProperty("审核时间") + @TableField(value = "audit_time") + private LocalDateTime auditTime; + + @ApiModelProperty("审核人") + @TableField(value = "audit_by") + private Long auditBy; + + @ApiModelProperty("审核意见") + @TableField(value = "audit_mind") + private String auditMind; + + @ApiModelProperty("使用年限") + @TableField(value = "useful_life") + private Integer usefulLife; + + @ApiModelProperty("整备质量 吨") + @TableField(value = "self_weight") + private Double selfWeight; + + @ApiModelProperty("排放标准") + private String effluentDischargeStandard; + + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; + + @ApiModelProperty("车辆状态 0离线 1在线 2异常") + private Integer status; + + @ApiModelProperty("车辆是否行驶 0没有行驶 1行驶中") + private Integer moving; + + @ApiModelProperty("是否删除 0未删除 1已删除") + private Integer deleted; + + @ApiModelProperty("使用企业ID") + private Long useCompanyId; + + @ApiModelProperty("使用企业名称") + private String useCompanyName; + + @ApiModelProperty("车辆状态") + private Integer vehicleStatus; + + @ApiModelProperty("上次在线时间") + private LocalDateTime lastOnlineTime; + + @ApiModelProperty("上次修改前所属企业ID") + private Long beforeCompanyId; + + @ApiModelProperty("上次修改前使用企业ID") + private Long beforeUseCompanyId; + + @ApiModelProperty("附件") + private String appendix; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/NdVehicleBaseInfoJoin.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/NdVehicleBaseInfoJoin.java new file mode 100644 index 0000000..7cf7eb5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/NdVehicleBaseInfoJoin.java @@ -0,0 +1,226 @@ +package com.ningdatech.carapi.car.vehicle.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@TableName("nd_vehicle_base_info") +@ApiModel(value = "NdVehicleBaseInfo", description = "车辆档案-车辆基本信息") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleBaseInfoJoin implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private Long createBy; + + private Long updateBy; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + @ApiModelProperty("车牌号") + @Size(max = 20, message = "车牌号不能超过20") + @TableField(value = "car_plate") + private String carPlate; + + @ApiModelProperty("自编号") + @Size(max = 30, message = "自编号长度不能超过30") + @TableField(value = "self_no") + private String selfNo; + + @ApiModelProperty("车辆颜色") + @TableField(value = "plate_color") + private String plateColor; + + @ApiModelProperty("所属企业ID") + @TableField(value = "company_id") + private Long companyId; + + @ApiModelProperty("所属企业名称") +// @TableField(exist = false) + private String companyName; + + @ApiModelProperty("行政区域id") + @TableField(value = "region_id") + private Long regionId; + + @ApiModelProperty("行政区域名称") + @TableField(exist = false) + private String regionName; + + @ApiModelProperty("车辆类型") + @TableField(value = "vehicle_type") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + @TableField(exist = false) + private String vehicleTypeName; + + @ApiModelProperty("标准吨位 单位:吨") + @TableField(value = "standard_tonnage") + private Double standardTonnage; + + @ApiModelProperty("发动机号") + @TableField(value = "engine_no") + private String engineNo; + + @ApiModelProperty("底盘号") + @TableField(value = "chassis_no") + private String chassisNo; + + @ApiModelProperty("运营商ID") + @TableField(value = "operator_id") + private Long operatorId; + + @ApiModelProperty("运营商名") +// @TableField(exist = false) + private String operatorName; + + @ApiModelProperty("责任驾驶员一") + @TableField(value = "responsible_driver_first") + private String responsibleDriverFirst; + + @ApiModelProperty("责任驾驶员一 电话") + @TableField(value = "responsible_driver_first_mobile") + private String responsibleDriverFirstMobile; + + @ApiModelProperty("责任驾驶员二") + @TableField(value = "responsible_driver_second") + private String responsibleDriverSecond; + + @ApiModelProperty("责任驾驶员二 电话") + @TableField(value = "responsible_driver_second_mobile") + private String responsibleDriverSecondMobile; + + @ApiModelProperty("百公里油耗 单位: L/km") + @TableField(value = "fuel_consumption_per") + private Double fuelConsumptionPer; + + @ApiModelProperty("限速值 公里/小时") + @TableField(value = "limited_speed") + private Double limitedSpeed; + + @ApiModelProperty("标准油量 L") + @TableField(value = "standard_oil_quantity") + private Double standardOilQuantity; + + @ApiModelProperty("车身长度 cm") + @TableField(value = "vehicle_length") + private Double vehicleLength; + + @ApiModelProperty("保养时间") + @TableField(value = "service_time") + private LocalDateTime serviceTime; + + @ApiModelProperty("保养时间周期 天") + @TableField(value = "service_time_interval") + private Integer serviceTimeInterval; + + @ApiModelProperty("保养里程 km") + @TableField(value = "service_cycle") + private Double serviceCycle; + + @ApiModelProperty("保养时间周期 天") + @TableField(value = "service_cycle_interval") + private Integer serviceCycleInterval; + + @ApiModelProperty("服务费开始时间") + @TableField(value = "service_fee_start") + private LocalDateTime serviceFeeStart; + + @ApiModelProperty("服务费结束时间") + @TableField(value = "service_fee_end") + private LocalDateTime serviceFeeEnd; + + @ApiModelProperty("燃油级别") + @TableField(value = "fuel_level") + private String fuelLevel; + + @ApiModelProperty("道路运证编号") + @TableField(value = "road_transportation_num") + private String roadTransportationNum; + + + @ApiModelProperty("审核状态 1.审核中 2.审核通过 3.审核不通过") + @TableField(value = "audit_state") + private Integer auditState; + + @ApiModelProperty("审核时间") + @TableField(value = "audit_time") + private LocalDateTime auditTime; + + + @ApiModelProperty("审核人") + @TableField(value = "audit_by") + private Long auditBy; + + @ApiModelProperty("审核意见") + @TableField(value = "audit_mind") + private String auditMind; + + @ApiModelProperty("排放标准") + @TableField(value = "effluent_discharge_standard") + private String effluentDischargeStandard; + + @ApiModelProperty("使用年限") + @TableField(value = "useful_life") + private Integer usefulLife; + + @ApiModelProperty("自重 吨") + @TableField(value = "self_weight") + private Double selfWeight; + + @ApiModelProperty("设备ID") + @TableField(value = "equipment_id") + private Long equipmentId; + + @ApiModelProperty("车辆状态 0离线 1在线 2异常") + private Integer status; + + @ApiModelProperty("车辆是否行驶 0没有行驶 1行驶中") + private Integer moving; + + @ApiModelProperty("是否删除 0未删除 1已删除") + private Integer deleted; + + @ApiModelProperty("使用企业ID") + private Long useCompanyId; + + @ApiModelProperty("使用企业名称") + private String useCompanyName; + + @ApiModelProperty("车辆状态") + private Integer vehicleStatus; + + @ApiModelProperty("上次在线时间") + private LocalDateTime lastOnlineTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleArchivesPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleArchivesPageQuery.java new file mode 100644 index 0000000..f8f14ba --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleArchivesPageQuery.java @@ -0,0 +1,95 @@ +package com.ningdatech.carapi.car.vehicle.model.dto; + +import java.io.Serializable; +import java.util.List; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + *

+ * 实体类 + * 车辆档案 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "VehicleArchivesPageQuery", description = "车辆档案") +public class VehicleArchivesPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 车牌号 + */ + @ApiModelProperty(value = "车牌号") + private String carPlate; + + /** + * 所属企业名 + */ + @ApiModelProperty(value = "所属企业名") + private String companyName; + + /** + * 使用企业ID + */ + @ApiModelProperty(value = "使用企业ID") + private Long useCompanyId; + + /** + * 使用企业名 + */ + @ApiModelProperty(value = "使用企业名") + private String useCompanyName; + + /** + * 所属企业ID + */ + @ApiModelProperty(value = "所属企业ID") + private Long companyId; + + /** + * 车辆类型 + */ + @ApiModelProperty(value = "车辆类型") + private Integer vehicleType; + + /** + * 所属区域id + */ + @ApiModelProperty(value = "所属区域id") + private Long regionId; + + + /** + * 运营商名 + */ + @ApiModelProperty(value = "运营商名") + private String operatorName; + + @ApiModelProperty("审核类型 1.待审核 2.已审核 3.审核不通过") + private Integer auditType; + + @ApiModelProperty("车辆状态") + private Integer vehicleStatus; + + @ApiModelProperty("企业列表") + private List companyIdList; + + @ApiModelProperty("是否显示没有所属企业车辆") + private Boolean showWithoutCompany; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleArchivesQueryDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleArchivesQueryDTO.java new file mode 100644 index 0000000..434576e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleArchivesQueryDTO.java @@ -0,0 +1,166 @@ +package com.ningdatech.carapi.car.vehicle.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 实体类 + * 车辆档案 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "VehicleArchivesQueryDTO", description = "车辆档案") +public class VehicleArchivesQueryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("自编号") + private String selfNo; + + @ApiModelProperty("车辆颜色") + private String plateColor; + + @ApiModelProperty("所属企业ID") + private Long companyId; + + @ApiModelProperty("所属企业名称") + private String companyName; + + @ApiModelProperty("行政区域id") + private Long regionId; + + @ApiModelProperty("行政区域") + private String regionName; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("标准吨位 单位:吨") + private Double standardTonnage; + + @ApiModelProperty("发动机号") + private String engineNo; + + @ApiModelProperty("底盘号") + private String chassisNo; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("责任驾驶员一") + private String responsibleDriverFirst; + + @ApiModelProperty("责任驾驶员一 电话") + private Long responsibleDriverFirstMobile; + + @ApiModelProperty("责任驾驶员二") + private String responsibleDriverSecond; + + @ApiModelProperty("责任驾驶员二 电话") + private Long responsibleDriverSecondMobile; + + @ApiModelProperty("百公里油耗 单位: L/km") + private Double fuelConsumptionPer; + + @ApiModelProperty("限速值 公里/小时") + private Double limitedSpeed; + + @ApiModelProperty("标准油量 L") + private Double standardOilQuantity; + + @ApiModelProperty("车身长度 cm") + private Double vehicleLength; + + @ApiModelProperty("保养时间") + private LocalDateTime serviceTime; + + @ApiModelProperty("保养时间周期 天") + private Integer serviceTimeInterval; + + @ApiModelProperty("保养里程 km") + private Double serviceCycle; + + @ApiModelProperty("保养时间周期 天") + private Integer serviceCycleInterval; + + @ApiModelProperty("服务费开始时间") + private LocalDateTime serviceFeeStart; + + @ApiModelProperty("服务费结束时间") + private LocalDateTime serviceFeeEnd; + + @ApiModelProperty("燃油级别") + private String fuelLevel; + + @ApiModelProperty("道路运证编号") + private String roadTransportationNum; + + @ApiModelProperty("审核状态 1.审核中 2.审核通过 3.审核不通过") + private Integer auditState; + + @ApiModelProperty("审核时间") + private LocalDateTime auditTime; + + @ApiModelProperty("审核人") + private String auditBy; + + @ApiModelProperty("审核意见") + private String auditMind; + + @ApiModelProperty("排放标准") + private String effluentDischargeStandard; + + @ApiModelProperty("使用年限") + private Integer usefulLife; + + @ApiModelProperty("自重 吨") + private Double selfWeight; + + @ApiModelProperty("车辆状态 0离线 1在线 2异常") + private Integer status; + + @ApiModelProperty("车辆是否行驶 0没有行驶 1行驶中") + private Integer moving; + + @ApiModelProperty("是否删除 0未删除 1已删除") + private Integer deleted; + + @ApiModelProperty("使用企业ID") + private Long useCompanyId; + + @ApiModelProperty("使用企业名称") + private String useCompanyName; + + @ApiModelProperty("车辆状态") + private Integer vehicleStatus; + + @ApiModelProperty("车辆状态名称") + private String vehicleStatusName; + + @ApiModelProperty("附件") + private String appendix; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleAuditDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleAuditDTO.java new file mode 100644 index 0000000..56e2949 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleAuditDTO.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.car.vehicle.model.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 实体类 + * 车辆信息审核 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "VehicleAuditDTO", description = "车辆信息审核") +public class VehicleAuditDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "车俩ID",required = true) + @NotNull(message = "请传车辆id!") + private Long id; + + @ApiModelProperty(value = "审核状态 2.审核通过 3.审核不通过",required = true) + @NotNull(message = "请传审核状态!") + private Integer auditState; + + @ApiModelProperty(value = "审核意见") + private String auditMind; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleAuditPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleAuditPageQuery.java new file mode 100644 index 0000000..d3fb5c0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleAuditPageQuery.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.car.vehicle.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 实体类 + * 车辆审核 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "VehicleAuditPageQuery", description = "车辆审核") +public class VehicleAuditPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 车牌号 + */ + @ApiModelProperty(value = "车牌号") + private String carPlate; + + /** + * 所属企业名 + */ + @ApiModelProperty(value = "所属企业名") + private String companyName; + + /** + * 车辆类型 + */ + @ApiModelProperty(value = "车辆类型") + private Integer vehicleType; + + /** + * 所属区域id + */ + @ApiModelProperty(value = "所属区域id") + private Long regionId; + + @ApiModelProperty("审核类型 1.待审核 2.已审核 3.审核不通过") + private Integer auditType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleBaseExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleBaseExportDTO.java new file mode 100644 index 0000000..66fe041 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleBaseExportDTO.java @@ -0,0 +1,201 @@ +package com.ningdatech.carapi.car.vehicle.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@ApiModel(value = "VehicleBaseExportDTO", description = "车辆档案-车辆基本信息-导出") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class VehicleBaseExportDTO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @ExcelProperty("ID") + private Long id; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("自编号") + @ExcelProperty("自编号") + private String selfNo; + + @ApiModelProperty("车辆颜色") + @ExcelProperty("车辆颜色") + private String plateColor; + + @ApiModelProperty("所属企业ID") + @ExcelProperty("所属企业ID") + private Long companyId; + + @ApiModelProperty("驾驶员ID") + @ExcelProperty("驾驶员ID") + private Long driverId; + + @ApiModelProperty("所属企业名称") + @ExcelProperty("所属企业名称") + private String companyName; + + @ApiModelProperty("行政区域id") + @ExcelProperty("行政区域id") + private Long regionId; + + @ApiModelProperty("行政区域名称") + @ExcelProperty("行政区域名称") + private String regionName; + + @ApiModelProperty("车辆类型") + @ExcelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + @ExcelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("标准吨位 单位:吨") + @ExcelProperty("标准吨位 单位:吨") + private Double standardTonnage; + + @ApiModelProperty("发动机号") + @ExcelProperty("发动机号") + private String engineNo; + + @ApiModelProperty("底盘号") + @ExcelProperty("底盘号") + private String chassisNo; + + @ApiModelProperty("运营商ID") + @ExcelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + @ExcelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("责任驾驶员一") + @ExcelProperty("责任驾驶员一") + private String responsibleDriverFirst; + + @ApiModelProperty("责任驾驶员一 电话") + @ExcelProperty("责任驾驶员一 电话") + private String responsibleDriverFirstMobile; + + @ApiModelProperty("责任驾驶员二") + @ExcelProperty("责任驾驶员二") + private String responsibleDriverSecond; + + @ApiModelProperty("责任驾驶员二 电话") + @ExcelProperty("责任驾驶员二 电话") + private String responsibleDriverSecondMobile; + + @ApiModelProperty("百公里油耗 单位: L/km") + @ExcelProperty("百公里油耗 单位: L/km") + private Double fuelConsumptionPer; + + @ApiModelProperty("限速值 公里/小时") + @ExcelProperty("限速值 公里/小时") + private Double limitedSpeed; + + @ApiModelProperty("标准油量 L") + @ExcelProperty("标准油量 L") + private Double standardOilQuantity; + + @ApiModelProperty("车身长度 cm") + @ExcelProperty("车身长度 cm") + private Double vehicleLength; + + @ApiModelProperty("保养时间") + @ExcelProperty("保养时间") + private LocalDateTime serviceTime; + + @ApiModelProperty("保养时间周期 天") + @ExcelProperty("保养时间周期 天") + private Integer serviceTimeInterval; + + @ApiModelProperty("保养里程 km") + @ExcelProperty("保养里程 km") + private Double serviceCycle; + + @ApiModelProperty("保养时间周期 天") + @ExcelProperty("保养时间周期 天") + private Integer serviceCycleInterval; + + @ApiModelProperty("服务费开始时间") + @ExcelProperty("服务费开始时间") + private LocalDateTime serviceFeeStart; + + @ApiModelProperty("服务费结束时间") + @ExcelProperty("服务费结束时间") + private LocalDateTime serviceFeeEnd; + + @ApiModelProperty("燃油级别") + @ExcelProperty("燃油级别") + private String fuelLevel; + + @ApiModelProperty("道路运证编号") + @ExcelProperty("道路运证编号") + private String roadTransportationNum; + + @ApiModelProperty("审核状态 1.审核中 2.审核通过 3.审核不通过") + @ExcelProperty("审核状态 1.审核中 2.审核通过 3.审核不通过") + private Integer auditState; + + @ApiModelProperty("审核时间") + @ExcelProperty("审核时间") + private LocalDateTime auditTime; + + @ApiModelProperty("审核人") + @ExcelProperty("审核人") + private Long auditBy; + + @ApiModelProperty("审核意见") + @ExcelProperty("审核意见") + private String audiMind; + + @ApiModelProperty("排放标准") + @ExcelProperty("排放标准") + private String effluentDischargeStandard; + + @ApiModelProperty("自重 吨") + @ExcelProperty("自重 吨") + private Double selfWeight; + + @ApiModelProperty("车辆状态 0离线 1在线 2异常") + @ExcelProperty("车辆状态 0离线 1在线 2异常") + private Integer status; + + @ApiModelProperty("车辆是否行驶 0没有行驶 1行驶中") + @ExcelProperty("车辆是否行驶 0没有行驶 1行驶中") + private Integer moving; + + @ApiModelProperty("使用企业") + @ExcelProperty("使用企业") + private String useCompanyName; + + @ApiModelProperty("车辆状态") + @ExcelProperty("车辆状态") + private String vehicleStatusName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleSaveDTO.java new file mode 100644 index 0000000..951febe --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleSaveDTO.java @@ -0,0 +1,132 @@ +package com.ningdatech.carapi.car.vehicle.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 实体类 + * 车辆信息 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "VehicleSaveDTO", description = "车辆信息保存") +public class VehicleSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("车牌号") + @NotEmpty(message = "请输入车牌号!") + private String carPlate; + + @ApiModelProperty("自编号") + private String selfNo; + + @ApiModelProperty("车辆颜色") + private String plateColor; + + @ApiModelProperty("所属企业ID") + private Long companyId; + + @ApiModelProperty("车辆类型") + @NotNull(message = "请选择车辆类型!") + private Integer vehicleType; + + @ApiModelProperty("标准吨位 单位:吨") + private Double standardTonnage; + + @ApiModelProperty("发动机号") + private String engineNo; + + @ApiModelProperty("底盘号") + @NotBlank + private String chassisNo; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("责任驾驶员一") + private String responsibleDriverFirst; + + @ApiModelProperty("责任驾驶员一 电话") + private String responsibleDriverFirstMobile; + + @ApiModelProperty("责任驾驶员二") + private String responsibleDriverSecond; + + @ApiModelProperty("责任驾驶员二 电话") + private String responsibleDriverSecondMobile; + + @ApiModelProperty("百公里油耗 单位: L/km") + private Double fuelConsumptionPer; + + @ApiModelProperty("限速值 公里/小时") + private Double limitedSpeed; + + @ApiModelProperty("标准油量 L") + private Double standardOilQuantity; + + @ApiModelProperty("车身长度 cm") + private Double vehicleLength; + + @ApiModelProperty("保养时间") + private LocalDateTime serviceTime; + + @ApiModelProperty("保养时间周期 天") + private Integer serviceTimeInterval; + + @ApiModelProperty("保养里程 km") + private Double serviceCycle; + + @ApiModelProperty("保养时间周期 天") + private Integer serviceCycleInterval; + + @ApiModelProperty("服务费开始时间") + private LocalDateTime serviceFeeStart; + + @ApiModelProperty("服务费结束时间") + private LocalDateTime serviceFeeEnd; + + @ApiModelProperty("燃油级别") + private String fuelLevel; + + @ApiModelProperty("道路运证编号") + private String roadTransportationNum; + + @ApiModelProperty("排放标准") + private String effluentDischargeStandard; + + @ApiModelProperty("使用年限") + private Integer usefulLife; + + @ApiModelProperty("自重 吨") + private Double selfWeight; + + @ApiModelProperty("使用企业ID") + private Long useCompanyId; + + @ApiModelProperty("使用企业名称") + private String useCompanyName; + + @ApiModelProperty("车辆状态") + private Integer vehicleStatus; + + @ApiModelProperty("附件") + private String appendix; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleUpdateDTO.java new file mode 100644 index 0000000..6af7c89 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleUpdateDTO.java @@ -0,0 +1,132 @@ +package com.ningdatech.carapi.car.vehicle.model.dto; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import javax.validation.constraints.NotNull; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + *

+ * 实体类 + * 车辆信息 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "VehicleUpdateDTO", description = "车辆信编辑") +public class VehicleUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @NotNull(message = "请传id") + private Long id; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("自编号") + private String selfNo; + + @ApiModelProperty("车辆颜色") + private String plateColor; + + @ApiModelProperty("所属企业ID") + private Long companyId; + + @ApiModelProperty("使用企业ID") + private Long useCompanyId; + + @ApiModelProperty("使用企业名称") + private String useCompanyName; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("标准吨位 单位:吨") + private Double standardTonnage; + + @ApiModelProperty("发动机号") + private String engineNo; + + @ApiModelProperty("底盘号") + private String chassisNo; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("责任驾驶员一") + private String responsibleDriverFirst; + + @ApiModelProperty("责任驾驶员一 电话") + private String responsibleDriverFirstMobile; + + @ApiModelProperty("责任驾驶员二") + private String responsibleDriverSecond; + + @ApiModelProperty("责任驾驶员二 电话") + private String responsibleDriverSecondMobile; + + @ApiModelProperty("百公里油耗 单位: L/km") + private Double fuelConsumptionPer; + + @ApiModelProperty("限速值 公里/小时") + private Double limitedSpeed; + + @ApiModelProperty("标准油量 L") + private Double standardOilQuantity; + + @ApiModelProperty("车身长度 cm") + private Double vehicleLength; + + @ApiModelProperty("保养时间") + private LocalDateTime serviceTime; + + @ApiModelProperty("保养时间周期 天") + private Integer serviceTimeInterval; + + @ApiModelProperty("保养里程 km") + private Double serviceCycle; + + @ApiModelProperty("保养时间周期 天") + private Integer serviceCycleInterval; + + @ApiModelProperty("服务费开始时间") + private LocalDateTime serviceFeeStart; + + @ApiModelProperty("服务费结束时间") + private LocalDateTime serviceFeeEnd; + + @ApiModelProperty("燃油级别") + private String fuelLevel; + + @ApiModelProperty("道路运证编号") + private String roadTransportationNum; + + @ApiModelProperty("排放标准") + private String effluentDischargeStandard; + + @ApiModelProperty("使用年限") + private Integer usefulLife; + + @ApiModelProperty("自重 吨") + private Double selfWeight; + + @ApiModelProperty("车辆状态") + private Integer vehicleStatus; + + @ApiModelProperty("附件") + private String appendix; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleViolationDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleViolationDTO.java new file mode 100644 index 0000000..df85e3f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/dto/VehicleViolationDTO.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.car.vehicle.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + *

+ * 实体类 + * 车辆违章 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "VehicleViolationDTO", description = "车辆违章") +public class VehicleViolationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "车牌号",required = true) + @NotBlank(message = "车牌号!") + private String carPlate; + + @ApiModelProperty(value = "违章类型 1.无证驾驶 2.闯红灯 3.超载 4.违规路段行驶 5.违规时间行驶") + private String violationType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/po/VehicleCompanyPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/po/VehicleCompanyPO.java new file mode 100644 index 0000000..8564e46 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/po/VehicleCompanyPO.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.car.vehicle.model.po; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Classname VehicleCompanyPO + * @Description + * @Date 2022/10/26 11:05 + * @Created by PoffyZhang + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class VehicleCompanyPO { + + @ApiModelProperty("公司id") + private Long companyId; + + @ApiModelProperty("使用企业id") + private Long useCompanyId; + + @ApiModelProperty("公司名称") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("自编号") + private String selfNo; + + @ApiModelProperty("状态") + private Integer status; + + @ApiModelProperty("是否行驶") + private Integer moving; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + public String getVechileTypeName(){ + if(Objects.nonNull(this.vehicleType)){ + this.vehicleTypeName = VehicleTypeEnum.getDescByCode(this.vehicleType); + return this.vehicleTypeName; + } + return StringUtils.EMPTY; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/vo/VehicleBaseVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/vo/VehicleBaseVO.java new file mode 100644 index 0000000..712925e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/vo/VehicleBaseVO.java @@ -0,0 +1,172 @@ +package com.ningdatech.carapi.car.vehicle.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.ningdatech.carapi.common.base.BaseEntity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@ApiModel(value = "VehicleBaseVO", description = "车辆档案-车辆基本信息") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class VehicleBaseVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("自编号") + private String selfNo; + + @ApiModelProperty("车辆颜色") + private String plateColor; + + @ApiModelProperty("所属企业ID") + private Long companyId; + + @ApiModelProperty("使用企业ID") + private Long useCompanyId; + + @ApiModelProperty("驾驶员ID") + private Long driverId; + + @ApiModelProperty("所属企业名称") + private String companyName; + + @ApiModelProperty("使用企业名称") + private String useCompanyName; + + @ApiModelProperty("行政区域id") + private Long regionId; + + @ApiModelProperty("行政区域名称") + private String regionName; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("标准吨位 单位:吨") + private Double standardTonnage; + + @ApiModelProperty("发动机号") + private String engineNo; + + @ApiModelProperty("底盘号") + private String chassisNo; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("责任驾驶员一") + private String responsibleDriverFirst; + + @ApiModelProperty("责任驾驶员一 电话") + private String responsibleDriverFirstMobile; + + @ApiModelProperty("责任驾驶员二") + private String responsibleDriverSecond; + + @ApiModelProperty("责任驾驶员二 电话") + private String responsibleDriverSecondMobile; + + @ApiModelProperty("百公里油耗 单位: L/km") + private Double fuelConsumptionPer; + + @ApiModelProperty("限速值 公里/小时") + private Double limitedSpeed; + + @ApiModelProperty("标准油量 L") + private Double standardOilQuantity; + + @ApiModelProperty("车身长度 cm") + private Double vehicleLength; + + @ApiModelProperty("保养时间") + private LocalDateTime serviceTime; + + @ApiModelProperty("保养时间周期 天") + private Integer serviceTimeInterval; + + @ApiModelProperty("保养里程 km") + private Double serviceCycle; + + @ApiModelProperty("保养时间周期 天") + private Integer serviceCycleInterval; + + @ApiModelProperty("服务费开始时间") + private LocalDateTime serviceFeeStart; + + @ApiModelProperty("服务费结束时间") + private LocalDateTime serviceFeeEnd; + + @ApiModelProperty("燃油级别") + private String fuelLevel; + + @ApiModelProperty("道路运证编号") + private String roadTransportationNum; + + @ApiModelProperty("审核状态 1.审核中 2.审核通过 3.审核不通过") + private Integer auditState; + + @ApiModelProperty("审核状态名称 1.审核中 2.审核通过 3.审核不通过") + private String auditStateName; + + @ApiModelProperty("审核时间") + private LocalDateTime auditTime; + + @ApiModelProperty("审核人") + private Long auditBy; + + @ApiModelProperty("审核意见") + private String audiMind; + + @ApiModelProperty("排放标准") + private String effluentDischargeStandard; + + @ApiModelProperty("自重 吨") + private Double selfWeight; + + @ApiModelProperty("车辆状态 0离线 1在线 2异常") + private Integer status; + + @ApiModelProperty("车辆是否行驶 0没有行驶 1行驶中") + private Integer moving; + + @ApiModelProperty("车辆状态") + private Integer vehicleStatus; + + @ApiModelProperty("车辆状态名称") + private String vehicleStatusName; + + @ApiModelProperty("是否可以审核") + private Boolean canAudit = Boolean.TRUE; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/vo/VehicleCarPlateVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/vo/VehicleCarPlateVO.java new file mode 100644 index 0000000..1ff3a0b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/model/vo/VehicleCarPlateVO.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.car.vehicle.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@ApiModel(value = "VehicleCarPlateVO", description = "车辆") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class VehicleCarPlateVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("所属企业ID") + private Long companyId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/service/IVehicleBaseInfoJoinService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/service/IVehicleBaseInfoJoinService.java new file mode 100644 index 0000000..ae7f97b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/service/IVehicleBaseInfoJoinService.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.car.vehicle.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfoJoin; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +public interface IVehicleBaseInfoJoinService extends IService { + + Page pageJoin(Page page, LambdaQueryWrapper wrapper); + Page pageJoinWithUseCompany(Page page, LambdaQueryWrapper wrapper); + Page pageOpenJoin(Page page, LambdaQueryWrapper wrapper); + + NdVehicleBaseInfoJoin oneJoin(LambdaQueryWrapper wrapper); + + Page pageJoinWithEquipment(Page page, LambdaQueryWrapper wrapper); + Page pageJoinWithEquipmentAndUseCompany(Page page, LambdaQueryWrapper wrapper); + + Page pageJoinWithEquipmentOpen(Page page, LambdaQueryWrapper wrapper); + + NdVehicleBaseInfoJoin oneJoinWithEquipment(LambdaQueryWrapper wrapper); + + List listJoin(LambdaQueryWrapper in); + + List listCarJoin(LambdaQueryWrapper in); + List listCarJoinWithUseCompany(LambdaQueryWrapper in); + + Page pageJoinWithNotEquipment(Page page, LambdaQueryWrapper wrapper); + Page pageJoinWithNotEquipmentAndUseCompany(Page page, LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/service/IVehicleBaseInfoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/service/IVehicleBaseInfoService.java new file mode 100644 index 0000000..b9d7415 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/service/IVehicleBaseInfoService.java @@ -0,0 +1,49 @@ +package com.ningdatech.carapi.car.vehicle.service; + +import com.ningdatech.carapi.car.vehicle.model.dto.VehicleAuditDTO; +import com.ningdatech.carapi.car.vehicle.model.dto.VehicleSaveDTO; +import com.ningdatech.carapi.car.vehicle.model.dto.VehicleUpdateDTO; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.vehicle.model.po.VehicleCompanyPO; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.po.OverspeedStatisticsPO; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +public interface IVehicleBaseInfoService extends IService { + + NdVehicleBaseInfo save(VehicleSaveDTO vehicleSaveDTO, Long uerId); + + NdVehicleBaseInfo update(VehicleUpdateDTO vehicleUpdateDTO, Long uerId); + + Boolean removeByIdWithCache(List ids); + + Boolean audit(VehicleAuditDTO data, Long userId); + + Map listByCarNo(Collection carNos); + + List getCarPlatesByCompanyIds(List companyIds); + List getCarPlatesByUseCompanyId(Long companyId); + + List getZj(DataScreenParam param); + + List getCity(DataScreenParam param); + + List getDistrict(DataScreenParam param); + + NdVehicleBaseInfo modifyAndUpdate(VehicleUpdateDTO data, Long userId); + + Boolean updateOfflineNotInCarPlates(List carsOnline); + + boolean batchUpdate(List batchSaveCars,Integer batchSize); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/service/impl/VehicleBaseInfoJoinServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/service/impl/VehicleBaseInfoJoinServiceImpl.java new file mode 100644 index 0000000..6280b05 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/service/impl/VehicleBaseInfoJoinServiceImpl.java @@ -0,0 +1,104 @@ +package com.ningdatech.carapi.car.vehicle.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfoJoin; +import com.ningdatech.carapi.car.vehicle.mapper.VehicleBaseInfoJoinMapper; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoJoinService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class VehicleBaseInfoJoinServiceImpl extends ServiceImpl + implements IVehicleBaseInfoJoinService { + + private final VehicleBaseInfoJoinMapper vehicleBaseInfoJoinMapper; + + @Override + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL,wrapperIndex = 1) + public Page pageJoin(Page page, LambdaQueryWrapper wrapper) { + return vehicleBaseInfoJoinMapper.pageJoin(page,wrapper); + } + + @Override + public Page pageJoinWithUseCompany(Page page, LambdaQueryWrapper wrapper) { + return vehicleBaseInfoJoinMapper.pageJoin(page,wrapper); + } + + @Override + public Page pageOpenJoin(Page page, LambdaQueryWrapper wrapper) { + return vehicleBaseInfoJoinMapper.pageJoin(page,wrapper); + } + + @Override + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public NdVehicleBaseInfoJoin oneJoin(LambdaQueryWrapper wrapper) { + return vehicleBaseInfoJoinMapper.oneJoin(wrapper); + } + + @Override + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL,wrapperIndex = 1) + public Page pageJoinWithEquipment(Page page, LambdaQueryWrapper wrapper) { + return vehicleBaseInfoJoinMapper.pageJoinWithEquipment(page,wrapper); + } + + @Override + public Page pageJoinWithEquipmentAndUseCompany(Page page, LambdaQueryWrapper wrapper) { + return vehicleBaseInfoJoinMapper.pageJoinWithEquipment(page,wrapper); + } + + @Override + public Page pageJoinWithEquipmentOpen(Page page, LambdaQueryWrapper wrapper) { + return vehicleBaseInfoJoinMapper.pageJoinWithEquipment(page,wrapper); + } + + @Override + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public NdVehicleBaseInfoJoin oneJoinWithEquipment(LambdaQueryWrapper wrapper) { + return vehicleBaseInfoJoinMapper.oneJoinWithEquipment(wrapper); + } + + @Override + public List listJoin(LambdaQueryWrapper wrapper) { + return vehicleBaseInfoJoinMapper.listJoin(wrapper); + } + + @Override + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL,wrapperIndex = 1) + public Page pageJoinWithNotEquipment(Page page, LambdaQueryWrapper wrapper) { + return vehicleBaseInfoJoinMapper.pageJoinWithNotEquipment(page,wrapper); + } + + @Override + public Page pageJoinWithNotEquipmentAndUseCompany(Page page, LambdaQueryWrapper wrapper) { + return vehicleBaseInfoJoinMapper.pageJoinWithNotEquipment(page,wrapper); + } + + @Override + @LambdaDataScope + public List listCarJoin(LambdaQueryWrapper wrapper) { + return vehicleBaseInfoJoinMapper.listCarJoin(wrapper); + } + + @Override + public List listCarJoinWithUseCompany(LambdaQueryWrapper wrapper) { + return vehicleBaseInfoJoinMapper.listCarJoin(wrapper); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/service/impl/VehicleBaseInfoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/service/impl/VehicleBaseInfoServiceImpl.java new file mode 100644 index 0000000..c43ef67 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/service/impl/VehicleBaseInfoServiceImpl.java @@ -0,0 +1,415 @@ +package com.ningdatech.carapi.car.vehicle.service.impl; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.atomic.AtomicReference; + +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.exception.code.ExceptionCode; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.archives.enums.AuditStateEnum; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.po.OverspeedStatisticsPO; +import com.ningdatech.carapi.car.equipment.mapper.NdVehicleEquipmentChannelsMapper; +import com.ningdatech.carapi.car.equipment.mapper.NdVehicleEquipmentInfoMapper; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentChannels; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentInfo; +import com.ningdatech.carapi.car.vehicle.mapper.VehicleBaseInfoMapper; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.model.dto.VehicleAuditDTO; +import com.ningdatech.carapi.car.vehicle.model.dto.VehicleSaveDTO; +import com.ningdatech.carapi.car.vehicle.model.dto.VehicleUpdateDTO; +import com.ningdatech.carapi.car.vehicle.model.po.VehicleCompanyPO; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.car.vehicle.utils.VinUtils; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.scheduler.enums.DataTypeEnum; +import com.ningdatech.carapi.scheduler.enums.OperatorTypeEnum; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.helper.VehiclesCacheHelper; +import com.ningdatech.carapi.sys.service.UserRoleService; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class VehicleBaseInfoServiceImpl extends ServiceImpl + implements IVehicleBaseInfoService { + + private final VehicleBaseInfoMapper vehicleBaseInfoMapper; + private final NdVehicleEquipmentInfoMapper vehicleEquipmentInfoMapper; + private final NdVehicleEquipmentChannelsMapper vehicleEquipmentChannelsMapper; + + private final VehiclesCacheHelper vehiclesCacheHelper; + + private final CompaniesCacheHelper companiesCacheHelper; + + private final ApplicationContext applicationContext; + private final RegionsCacheHelper regionCacheHelper; + private final UserRoleService userRoleService; + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean removeByIdWithCache(List ids) { + if (ids.isEmpty()) { + return true; + } + AtomicReference removeFlag = new AtomicReference<>(true); + //只能删除 审核不成功的车辆 + ids.forEach(id -> { + NdVehicleBaseInfo vehicle = getById(id); + VUtils.isTrueFormat(Objects.isNull(vehicle)) + .throwMessage(ExceptionCode.OPERATION_EX.getCode(), "该id车辆不存在 {}", id); + + VUtils.isTrueFormat(!AuditStateEnum.AUDIT_FAIL.getCode().equals(vehicle.getAuditState())) + .throwMessage(ExceptionCode.OPERATION_EX.getCode(), "只有审核失败的车辆才能删除"); + + if (!removeById(id)) { + removeFlag.set(false); + return; + } + + //删除 车辆下的设备 + List ndVehicleEquipmentInfos = vehicleEquipmentInfoMapper.selectList( + Wrappers.lambdaQuery(NdVehicleEquipmentInfo.class).eq(NdVehicleEquipmentInfo::getVehicleId, id)); + if (CollUtil.isNotEmpty(ndVehicleEquipmentInfos)) { + ndVehicleEquipmentInfos.forEach(equipment -> { + vehicleEquipmentChannelsMapper.delete(Wrappers.lambdaQuery(NdVehicleEquipmentChannels.class).eq(NdVehicleEquipmentChannels::getEquipmentId, equipment.getId())); + vehicleEquipmentInfoMapper.deleteById(equipment); + }); + } + //更新车辆缓存 + vehiclesCacheHelper.refresh(id); + }); + return removeFlag.get(); + } + + /** + * 车辆审核 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean audit(VehicleAuditDTO data, Long userId) { + VUtils.isTrue(!AuditStateEnum.AUDIT_SUCCESS.getCode().equals(data.getAuditState()) && + !AuditStateEnum.AUDIT_FAIL.getCode().equals(data.getAuditState())).throwMessage("请确认传入的审核code正确"); + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoMapper.selectById(data.getId()); + VUtils.isTrueFormat(Objects.isNull(vehicleBaseInfo)) + .throwMessage(ExceptionCode.OPERATION_EX.getCode(), "修改车辆 {} 为空", data.getId()); + VUtils.isTrueFormat(!AuditStateEnum.AUDIT.getCode().equals(vehicleBaseInfo.getAuditState())) + .throwMessage(ExceptionCode.OPERATION_EX.getCode(), "只能审核待审核的车辆 {}", data.getId()); + + vehicleBaseInfo.setAuditState(data.getAuditState()); + vehicleBaseInfo.setAuditBy(userId); + vehicleBaseInfo.setAuditTime(LocalDateTime.now()); + vehicleBaseInfo.setAuditMind(data.getAuditMind()); + //最后修改人 + vehicleBaseInfo.setUpdateBy(userId); + vehicleBaseInfo.setUpdateOn(LocalDateTime.now()); + if(updateById(vehicleBaseInfo)){ + // 如果审核通过 + if (AuditStateEnum.AUDIT_SUCCESS.getCode().equals(data.getAuditState())) { + return Boolean.TRUE; + } else if (AuditStateEnum.AUDIT_FAIL.getCode().equals(data.getAuditState())) { + // 审核不通过,车辆的所属企业和使用企业要恢复到提交审核前的状态, + // 防止使用企业和所属企业更新后,原企业无法重新提交 + NdVehicleBaseInfo baseInfo = vehicleBaseInfoMapper.selectById(data.getId()); + Long beforeCompanyId = baseInfo.getBeforeCompanyId(); + Long beforeUseCompanyId = baseInfo.getBeforeUseCompanyId(); + + baseInfo.setCompanyId(beforeCompanyId); + baseInfo.setUseCompanyId(beforeUseCompanyId); + + if (Objects.nonNull(beforeUseCompanyId)) { + CompanyDTO companyDto = companiesCacheHelper.getById(beforeUseCompanyId); + baseInfo.setUseCompanyName(companyDto.getName()); + } + vehicleBaseInfoMapper.updateById(baseInfo); + } + } + return Boolean.FALSE; + } + + + /** + * 保存车辆 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public NdVehicleBaseInfo save(VehicleSaveDTO data, Long userId) { + Long companyId = LoginUserUtil.loginUserDetail().getCompanyId(); + checkNewCar(data.getCarPlate()); + //VUtils.isTrue(!VinUtils.isLegal(data.getChassisNo())).throwMessage("底盘号错误 请重新填入!"); + NdVehicleBaseInfo vehicleBaseInfo = BeanUtil.toBean(data, NdVehicleBaseInfo.class); + //创建人 最后修改人 + vehicleBaseInfo.setCreateBy(userId); + vehicleBaseInfo.setUpdateBy(userId); + vehicleBaseInfo.setAuditState(AuditStateEnum.AUDIT.getCode()); + vehicleBaseInfo.setCompanyId(companyId); + CompanyDTO company = companiesCacheHelper.getById(companyId); + VUtils.isTrue(Objects.isNull(company)).throwMessage("获取不到当前操作人的公司信息!"); + vehicleBaseInfo.setRegionId(company.getRegionId()); + CodeUtil.searchRegionName(vehicleBaseInfo); + if(save(vehicleBaseInfo)){ + vehiclesCacheHelper.refresh(vehicleBaseInfo.getId()); + } + return vehicleBaseInfo; + } + + private void checkCar(String oldCarPlate, String carPlate) { + // 如果提交的车牌号已经在审核中 + VUtils.isTrue(count(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getCarPlate, carPlate) + .eq(NdVehicleBaseInfo::getAuditState,AuditStateEnum.AUDIT.getCode())) > 0) + .throwMessage("该车牌车辆待审核中 请勿重新提交!"); + // 如果修改信息修改了车牌号,校验车牌号是否已经存在 + // 如果提交的车牌号已经审核通过存在于系统中 + NdVehicleBaseInfo baseInfo = vehicleBaseInfoMapper.selectOne(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getCarPlate, carPlate)); + String companyName = null; + if (Objects.nonNull(baseInfo)) { + Long companyId = baseInfo.getCompanyId(); + if (Objects.nonNull(companyId)) { + companyName = companiesCacheHelper.getNameById(companyId); + } + } + if (!carPlate.equals(oldCarPlate)) { + VUtils.isTrue(count(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getCarPlate, carPlate) + .eq(NdVehicleBaseInfo::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode())) > 0) + .throwMessage("系统企业:" + companyName + "已有该车牌车辆 不能重复添加!"); + } + } + + private void checkNewCar(String carPlate) { + // 如果提交的车牌号已经在审核中 + VUtils.isTrue(count(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getCarPlate, carPlate) + .eq(NdVehicleBaseInfo::getAuditState,AuditStateEnum.AUDIT.getCode())) > 0) + .throwMessage("该车牌车辆待审核中 请勿重新提交!"); + // 如果提交的车牌号审核不通过 + VUtils.isTrue(count(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getCarPlate, carPlate) + .eq(NdVehicleBaseInfo::getAuditState,AuditStateEnum.AUDIT_FAIL.getCode())) > 0) + .throwMessage("该车牌车辆审核不通过 请到车辆新增界面修改信息后重新提交!"); + NdVehicleBaseInfo baseInfo = vehicleBaseInfoMapper.selectOne(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getCarPlate, carPlate)); + String companyName = null; + if (Objects.nonNull(baseInfo)) { + Long companyId = baseInfo.getCompanyId(); + if (Objects.nonNull(companyId)) { + companyName = companiesCacheHelper.getNameById(companyId); + } + } + // 如果提交的车牌号已经审核通过存在于系统中 + VUtils.isTrue(count(Wrappers.lambdaQuery(NdVehicleBaseInfo.class).eq(NdVehicleBaseInfo::getCarPlate, carPlate) + .eq(NdVehicleBaseInfo::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode())) > 0) + .throwMessage("系统企业:" + companyName + "已有该车牌车辆 不能重复添加!"); + + } + + @Override + @Transactional(rollbackFor = Exception.class) + public NdVehicleBaseInfo update(VehicleUpdateDTO data, Long userId) { + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoMapper.selectById(data.getId()); + VUtils.isTrueFormat(Objects.isNull(vehicleBaseInfo)) + .throwMessage(ExceptionCode.OPERATION_EX.getCode(), String.format("修改车辆%d 为空", data.getId())); + + VUtils.isTrueFormat(!AuditStateEnum.AUDIT_FAIL.getCode().equals(vehicleBaseInfo.getAuditState())) + .throwMessage(ExceptionCode.OPERATION_EX.getCode(), String.format("车辆状态为审核失败才能修改", data.getId())); + + VUtils.isTrue(StringUtils.isNotBlank(data.getCarPlate()) && !vehicleBaseInfo.getCarPlate().equals(data.getCarPlate()) && + count(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getCarPlate, data.getCarPlate())) > 0) + .throwMessage("此公司已经有该车牌车辆 不能重复添加!"); + + if(StringUtils.isNotBlank(data.getChassisNo())){ + VUtils.isTrue(!VinUtils.isLegal(data.getChassisNo())).throwMessage("底盘号错误 请重新填入!"); + } + + NdVehicleBaseInfo vehicle = BeanUtil.toBean(data, NdVehicleBaseInfo.class); + + //最后修改人 置为审核中 + vehicle.setAuditState(AuditStateEnum.AUDIT.getCode()); + vehicle.setUpdateBy(userId); + if(updateById(vehicle)){ + vehiclesCacheHelper.refresh(vehicle.getId()); + } + return vehicle; + } + + /** + * 根据企业ids 获取车牌号 + * + * @param companyIds + * @return + */ + @Override + public List getCarPlatesByCompanyIds(List companyIds) { + return vehicleBaseInfoMapper.getCarPlatesByCompanyIds(companyIds); + } + + /** + * 根据企业ID获取所属企业和使用企业为该企业的车牌号 + * + * @param companyId + * @return + */ + @Override + public List getCarPlatesByUseCompanyId(Long companyId) { + return vehicleBaseInfoMapper.getCarPlatesByUseCompanyId(companyId); + } + + @Override + @XmlDataScope + public List getZj(DataScreenParam param) { + return vehicleBaseInfoMapper.getZj(param); + } + + @Override + @XmlDataScope + public List getCity(DataScreenParam param) { + return vehicleBaseInfoMapper.getCity(param); + } + + @Override + @XmlDataScope + public List getDistrict(DataScreenParam param) { + return vehicleBaseInfoMapper.getDistrict(param); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public NdVehicleBaseInfo modifyAndUpdate(VehicleUpdateDTO data, Long userId) { + UserRole userRole = userRoleService.getOne(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getUserId, userId)); + if (Objects.isNull(userRole)){ + throw new BizException("当前登录用户角色不存在!"); + } + Long roleId = userRole.getRoleId(); + + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoMapper.selectById(data.getId()); + String oldCarPlate = vehicleBaseInfo.getCarPlate(); + VUtils.isTrueFormat(Objects.isNull(vehicleBaseInfo)) + .throwMessage(ExceptionCode.OPERATION_EX.getCode(), String.format("修改车辆%d 为空", data.getId())); + + //if(StringUtils.isNotBlank(data.getChassisNo())){ + // VUtils.isTrue(!VinUtils.isLegal(data.getChassisNo())).throwMessage("底盘号错误 请重新填入!"); + //} + + //修改车牌号,原车辆的违法违章记录不变,以原车牌号为准,不用更新 + + // 先保存旧的所属企业和使用企业,防止填写错误,审核不通过,回显错误 + vehicleBaseInfo.setBeforeCompanyId(vehicleBaseInfo.getCompanyId()); + vehicleBaseInfo.setBeforeUseCompanyId(vehicleBaseInfo.getUseCompanyId()); + vehicleBaseInfoMapper.updateById(vehicleBaseInfo); + + // 更新编辑过之后的车辆信息 + NdVehicleBaseInfo vehicle = BeanUtil.toBean(data, NdVehicleBaseInfo.class); + // 如果修改了所属企业,车辆所属区域也要更新 + Long oldCompanyId = vehicleBaseInfo.getCompanyId(); + Long newCompanyId = vehicle.getCompanyId(); + if (Objects.isNull(oldCompanyId) || !newCompanyId.equals(oldCompanyId)){ + CompanyDTO companyDto = companiesCacheHelper.getById(newCompanyId); + if (Objects.nonNull(companyDto)) { + Long regionId = companyDto.getRegionId(); + if (Objects.nonNull(regionId)) { + vehicle.setRegionId(regionId); + vehicle.setRegionName(regionCacheHelper.getDisplayName(regionId)); + } + } + } + + String carPlate = vehicle.getCarPlate(); + checkCar(oldCarPlate,carPlate); + // 最后修改人 + // 修改后,车辆审核状态变更为待审核 + // 如果登录用户为超管、市、区县散办不需要更改车辆状态为待审核 + if (UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId().equals(roleId) || + UserRoleTypeEnum.DRIVER_ROLE_ID.getId().equals(roleId)) { + vehicle.setAuditState(AuditStateEnum.AUDIT.getCode()); + }else if(Objects.nonNull(vehicleBaseInfo.getAuditState()) && + AuditStateEnum.AUDIT_FAIL.getCode().equals(vehicleBaseInfo.getAuditState())){ + //另外一种情况 不满足以上情况 但是审核失败需要重新提交的 + vehicle.setAuditState(AuditStateEnum.AUDIT.getCode()); + } + vehicle.setUpdateBy(userId); + if(updateById(vehicle)){ + vehiclesCacheHelper.refresh(vehicle.getId()); + } + return vehicle; + } + + @Override + public Boolean updateOfflineNotInCarPlates(List carsOnline) { + return vehicleBaseInfoMapper.updateOfflineNotInCarPlates(carsOnline); + } + + @Override + public boolean batchUpdate(List batchSaveCars,Integer batchSize) { + if (CollectionUtils.isEmpty(batchSaveCars)) { + return false; + } + List infos = Lists.newArrayList(); + for (NdVehicleBaseInfo batchSaveCar : batchSaveCars) { + NdVehicleBaseInfo car = new NdVehicleBaseInfo(); + car.setId(batchSaveCar.getId()); + car.setCarPlate(batchSaveCar.getCarPlate()); + car.setStatus(batchSaveCar.getStatus()); + car.setLastOnlineTime(batchSaveCar.getLastOnlineTime()); + car.setUpdateOn(batchSaveCar.getUpdateOn()); + infos.add(car); + // 每当达到批次大小时就进行一次更新 + if (infos.size() == batchSize) { + updateBatchById(infos); + infos.clear(); + } + } + // 处理剩余不足批次大小的数据 + if (!infos.isEmpty()) { + updateBatchById(infos); + return true; + } + return false; + } + + @Override + public Map listByCarNo(Collection carNos) { + if (CollectionUtils.isEmpty(carNos)) { + return Collections.emptyMap(); + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .in(NdVehicleBaseInfo::getCarPlate, carNos) + .eq(NdVehicleBaseInfo::getAuditState, 2); + List list = this.list(query); + return CollUtils.listToMap(this.list(query), NdVehicleBaseInfo::getCarPlate); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/utils/VinUtils.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/utils/VinUtils.java new file mode 100644 index 0000000..5bb77c8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/vehicle/utils/VinUtils.java @@ -0,0 +1,95 @@ +package com.ningdatech.carapi.car.vehicle.utils; + +import java.util.HashMap; +import java.util.Map; + +public class VinUtils { + public static Map kv = new HashMap<>(); + + public static Map wv = new HashMap<>(); + + static{ + kv.put('a',1); + kv.put('b', 2); + kv.put('c', 3); + kv.put('d', 4); + kv.put('e', 5); + kv.put('f', 6); + kv.put('g', 7); + kv.put('h', 8); + kv.put('j', 1); + kv.put('k', 2); + kv.put('l', 3); + kv.put('m', 4); + kv.put('n', 5); + kv.put('p', 7); + kv.put('q', 8); + kv.put('r', 9); + kv.put('s', 2); + kv.put('t', 3); + kv.put('u', 4); + kv.put('v', 5); + kv.put('w', 6); + kv.put('x', 7); + kv.put('y', 8); + kv.put('z', 9); + kv.put('0',0); + kv.put('1',1); + kv.put('2',2); + kv.put('3',4); + kv.put('4',4); + kv.put('5',5); + kv.put('6',6); + kv.put('7',7); + kv.put('8',8); + kv.put('9',9); + + wv.put(1, 8); + wv.put(2, 7); + wv.put(3, 6); + wv.put(4, 5); + wv.put(5, 4); + wv.put(6, 3); + wv.put(7, 2); + wv.put(8, 10); + wv.put(10, 9); + wv.put(11, 8); + wv.put(12, 7); + wv.put(13, 6); + wv.put(14, 5); + wv.put(15, 4); + wv.put(16, 3); + wv.put(17, 2); + }; + + public final static boolean isLegal(String vin) { + if (vin == null) { + return false; + } else if (vin.trim().length() == 17) { + vin = vin.trim().toLowerCase(); + char[] codes = vin.toCharArray(); + int resultInCode = 0; + if ("0123456789".contains(vin.subSequence(8, 9))) { + resultInCode = Integer.valueOf(vin.subSequence(8, 9).toString()); + } else { + return false; + } + int total = 0; + for (int i = 1; i < codes.length + 1; i++) { + char code = codes[i - 1]; + if (kv.containsKey(code)) { + if (i == 9) { + continue; + } else { + total += kv.get(code) * wv.get(i); + } + } else { + return false; + } + } + return resultInCode == total % 11; + } else { + return false; + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/controller/VideoMonitorController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/controller/VideoMonitorController.java new file mode 100644 index 0000000..6b2a7b7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/controller/VideoMonitorController.java @@ -0,0 +1,76 @@ +package com.ningdatech.carapi.car.video.controller; + +import java.util.List; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.carapi.car.position.model.vo.DeviceVO; +import com.ningdatech.carapi.car.video.manage.VideoMonitorManage; +import com.ningdatech.carapi.car.video.model.dto.PlaybackVideoParamDTO; +import com.ningdatech.carapi.car.video.model.dto.PlaybackVideoStartParamDTO; +import com.ningdatech.carapi.car.video.model.vo.PlaybackVideoVO; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + * @author Poffy Zhang + * @date 2022/11/01 上午10:25 + */ + +@RestController +@RequestMapping(value = "/api/v1/car-manage/video-monitor") +@Api(tags = "车辆管理-视频监控") +@Validated +@RequiredArgsConstructor +public class VideoMonitorController { + + private final VideoMonitorManage videoMonitorManage; + + @ApiOperation("获取某辆车在线的设备") + @GetMapping("/get-online-devices/{carPlate}") + public List getOnlineDevices(@Valid @PathVariable String carPlate) { + return videoMonitorManage.getOnlineDevices(carPlate); + } + + @ApiOperation("开始预览设备") + @PostMapping("/start-play/{deviceId}") + @WebLog + public JSONObject startPlay(@Valid @PathVariable String deviceId) { + return videoMonitorManage.startPlay(deviceId); + } + + @ApiOperation("结束预览设备") + @PostMapping("/stop-play/{deviceId}") + @WebLog + public void stopPlay(@Valid @PathVariable String deviceId) { + videoMonitorManage.stopPlay(deviceId); + } + + @ApiOperation("获取回放视频列表") + @GetMapping("/playback-videos") + @WebLog + public List playBackVideos(@Valid @ModelAttribute PlaybackVideoParamDTO param) { + return videoMonitorManage.playBackVideos(param); + } + + @ApiOperation("开始播放回放流视频") + @PostMapping("/start-playback") + @WebLog + public JSONObject startPlayBack(@Valid @RequestBody PlaybackVideoStartParamDTO param) { + return videoMonitorManage.startPlayBack(param); + } + + @ApiOperation("结束播放回放流视频") + @PostMapping("/stop-playback/{streamId}") + @WebLog + public JSONObject stopPlayBack(@Valid @PathVariable String streamId) { + return videoMonitorManage.stopPlayBack(streamId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/manage/VideoMonitorManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/manage/VideoMonitorManage.java new file mode 100644 index 0000000..6ecdcd6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/manage/VideoMonitorManage.java @@ -0,0 +1,246 @@ +package com.ningdatech.carapi.car.video.manage; + +import java.util.*; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.exception.code.ExceptionCode; +import com.ningdatech.carapi.car.equipment.manage.VehicleEquipmentManage; +import com.ningdatech.carapi.car.equipment.model.VehicleEquipmentNo; +import com.ningdatech.carapi.car.equipment.model.dto.VehicleEquipmentQueryDTO; +import com.ningdatech.carapi.car.equipment.service.IVehicleEquipmentNoService; +import com.ningdatech.carapi.car.position.contants.PositionContant; +import com.ningdatech.carapi.car.position.model.vo.DeviceVO; +import com.ningdatech.carapi.car.vehicle.contants.VehicleContant; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.car.video.model.dto.PlaybackVideoParamDTO; +import com.ningdatech.carapi.car.video.model.dto.PlaybackVideoStartParamDTO; +import com.ningdatech.carapi.car.video.model.vo.PlaybackVideoVO; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.sys.helper.VehiclesCacheHelper; + +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author PoffyZhang + * @date 2022/11/1 上午11:18 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class VideoMonitorManage { + + private final VehicleEquipmentManage vehicleEquipmentManage; + + private final RestTemplate restTemplate; + + private final VehiclesCacheHelper vehiclesCacheHelper; + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final IVehicleEquipmentNoService vehicleEquipmentNoService; + + @Value("${vedio.host}") + private String HOST; + + /** + * 实时视频 + * @param carPlate + * @return + */ + public List getOnlineDevices(String carPlate) { + //1.先获取 该车牌号的 所有视频设备 + //List equipmentByCarPlate = vehicleEquipmentManage.getEquipmentByCarPlate(carPlate); + List equipmentByCarPlate = vehicleEquipmentNoService.list(Wrappers.lambdaQuery(VehicleEquipmentNo.class) + .eq(VehicleEquipmentNo::getCarPlate, carPlate)); + if(CollUtil.isEmpty(equipmentByCarPlate)){ + return Collections.emptyList(); + } + String devicesId = equipmentByCarPlate.stream() + .map(VehicleEquipmentNo::getDeviceId) + .collect(Collectors.joining(",")); + return equipmentByCarPlate.stream().map(o -> { + DeviceVO deviceVO = new DeviceVO(); + deviceVO.setDeviceId(o.getDeviceId()); + deviceVO.setName(o.getDeviceName()); + deviceVO.setStatus(o.getStatus()); + return deviceVO; + }).collect(Collectors.toList()); + + //String devicesId = equipmentByCarPlate.stream() + // .map(VehicleEquipmentQueryDTO::getEquipmentNo) + // .collect(Collectors.joining(",")); + + //return equipmentByCarPlate.stream().map(o -> { + // DeviceVO deviceVO = new DeviceVO(); + // deviceVO.setDeviceId(o.getEquipmentNo()); + // deviceVO.setName(o.getName()); + // return deviceVO; + //}).collect(Collectors.toList()); + } + + public JSONObject startPlay(String deviceId) { + String url = String.format("%s%s/start",String.format(PositionContant.STREAM_URL,HOST),deviceId); + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.valueOf("application/json")); + HttpEntity requestEntity = new HttpEntity(String.format(""), headers); + log.info("vedio url : {}",url); + try{ + JSONObject response = restTemplate.postForObject(url,requestEntity,JSONObject.class); + log.info("vedio url response : {}",response); + if(Objects.isNull(response)){ + throw new BizException(ExceptionCode.BAD_REQUEST.getCode(),"开始播放流失败 网络异常"); + } + log.info("requst start play datas :{}", JSON.toJSONString(response)); + Integer statusCode = response.getInteger("status_code"); + if(0 != statusCode){ + throw new BizException(ExceptionCode.BAD_REQUEST.getCode(),response.getString("message")); + } + JSONObject jsonObject = response.getJSONObject("result"); + return jsonObject; + }catch (Exception e){ + log.error("此次请求有异常 :" + deviceId,e); + throw new BizException("此设备不在线 :" + deviceId); + } + } + + public void stopPlay(String deviceId) { + String url = String.format( "%s%s/stop",String.format(PositionContant.STREAM_URL,HOST),deviceId); + JSONObject response = restTemplate.postForObject(url,null,JSONObject.class); + if(Objects.isNull(response)){ + throw new BizException(ExceptionCode.BAD_REQUEST.getCode(),"关闭流 网络异常"); + } + log.info("requst stop play datas :{}", JSON.toJSONString(response)); + Integer statusCode = response.getInteger("status_code"); + if (statusCode == 0){ + log.info("关闭流成功"); + }else{ + log.info("关闭流失败"); + } + } + + /** + * 回放视频 + * @param param + * @return + */ + public List playBackVideos(PlaybackVideoParamDTO param) { + List res = Lists.newArrayList(); + //// 判断车辆是否在登录用户的区域权限内 + //NdVehicleBaseInfo car = vehiclesCacheHelper.getByCarPlate(param.getCarPlate()); + //if (Objects.isNull(car)){ + // return Collections.emptyList(); + //} + //LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + //VideoMonitorManage context = (VideoMonitorManage) AopContext.currentProxy(); + //context.buildQuery(wrapper, car.getId()); + //NdVehicleBaseInfo ndVehicleBaseInfo = vehicleBaseInfoService.getOne(wrapper); + //if (Objects.isNull(ndVehicleBaseInfo)){ + // return Collections.emptyList(); + //} + ////1.先获取 该车牌号的 所有设备 + //List equipmentByCarPlate = vehicleEquipmentManage.getEquipmentByCarPlate(param.getCarPlate()); + //if(CollUtil.isEmpty(equipmentByCarPlate)){ + // return Collections.emptyList(); + //} + ////2.请求回放视频接口 + //for(VehicleEquipmentQueryDTO equipment : equipmentByCarPlate){ + // if(StringUtils.isBlank(equipment.getEquipmentNo())){ + // log.info("这个设备 {} 没有设备编号",equipment.getId()); + // continue; + // } + // Map map = Maps.newConcurrentMap(); + // map.put("deviceId",equipment.getEquipmentNo()); + // map.put("start", param.getStart()); + // map.put("end",param.getEnd()); + // map.put("host",HOST); + // JSONObject response = restTemplate.getForObject(PositionContant.RECORD_LIST_URL,JSONObject.class,map); + // if(Objects.isNull(response)){ + // throw new BizException(ExceptionCode.BAD_REQUEST.getCode(),"回放视频数据请求失败 网络异常"); + // } + // log.info("requst playback datas :{}", JSON.toJSONString(response)); + // Integer statusCode = response.getInteger("status_code"); + // //先不返回异常 + // if(0 != statusCode){ + // log.warn("运营商的历史回放视频 有异常 {}, :{}",equipment.getEquipmentNo(),response.getString("message")); + // } + // JSONObject resultJson = response.getJSONObject("result"); + // if(Objects.isNull(resultJson)){ + // continue; + // } + // + // JSONArray list = resultJson.getJSONArray("list"); + // if(Objects.isNull(list) || list.size() == 0){ + // continue; + // } + // + // list.stream().forEach(o -> { + // LinkedHashMap j = (LinkedHashMap)o; + // Object items = j.get("items"); + // if(Objects.isNull(items)){ + // return; + // } + // List itemList = (List)items; + // itemList.stream().forEach(item -> { + // PlaybackVideoVO vo = new PlaybackVideoVO(equipment.getEquipmentNo(),equipment.getName(), VehicleContant.DEFAULT_CHANNEL_NAME + // ,Long.valueOf(String.valueOf(item.get("start"))),Long.valueOf(String.valueOf(item.get("end")))); + // res.add(vo); + // }); + // }); + //} + return res; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(NdVehicleBaseInfo::getId,id); + } + + public JSONObject startPlayBack(PlaybackVideoStartParamDTO param) { + String url = String.format("%s%s/start?start=%s&end=%s", + String.format(PositionContant.RECORD_URL,HOST),param.getDeviceId(),param.getStart(),param.getEnd()); + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.valueOf("application/json")); + HttpEntity requestEntity = new HttpEntity(String.format(""), headers); + JSONObject response = restTemplate.postForObject(url,requestEntity,JSONObject.class); + if(Objects.isNull(response)){ + throw new BizException(ExceptionCode.BAD_REQUEST.getCode(),"开始播放流失败 网络异常"); + } + log.info("requst start playback datas :{}", JSON.toJSONString(response)); + Integer statusCode = response.getInteger("status_code"); + if(0 != statusCode){ + throw new BizException(ExceptionCode.BAD_REQUEST.getCode(),response.getString("message")); + } + JSONObject jsonObject = response.getJSONObject("result"); + return jsonObject; + } + + public JSONObject stopPlayBack(String streamId) { + String url = String.format("%s%s/stop",String.format(PositionContant.RECORD_URL,HOST),streamId); + JSONObject response = restTemplate.postForObject(url,null,JSONObject.class); + if(Objects.isNull(response)){ + throw new BizException(ExceptionCode.BAD_REQUEST.getCode(),"关闭流 网络异常"); + } + log.info("requst stop playback datas :{}", JSON.toJSONString(response)); + JSONObject jsonObject = response.getJSONObject("result"); + return jsonObject; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/model/dto/PlaybackVideoParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/model/dto/PlaybackVideoParamDTO.java new file mode 100644 index 0000000..a86c3c9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/model/dto/PlaybackVideoParamDTO.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.car.video.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 回放视频传参 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Data +@Builder +@ApiModel(value = "PlaybackVideoParamDTO", description = "回放视频传参") +public class PlaybackVideoParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("开始时间时间戳") + @NotNull(message = "请输入开始时间") + private Long start; + + @ApiModelProperty("结束时间时间戳") + @NotNull(message = "请输入结束时间") + private Long end; + + @ApiModelProperty("车牌号") + @NotBlank(message = "请输入车牌号") + private String carPlate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/model/dto/PlaybackVideoStartParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/model/dto/PlaybackVideoStartParamDTO.java new file mode 100644 index 0000000..aa3bb9f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/model/dto/PlaybackVideoStartParamDTO.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.car.video.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 开始回放视频传参 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@ApiModel(value = "PlaybackVideoStartParamDTO", description = "开始回放视频传参") +public class PlaybackVideoStartParamDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("开始时间时间戳") + @NotNull(message = "请输入开始时间") + private Long start; + + @ApiModelProperty("结束时间时间戳") + @NotNull(message = "请输入结束时间") + private Long end; + + @ApiModelProperty("设备id") + @NotBlank(message = "设备id") + private String deviceId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/model/vo/PlaybackVideoVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/model/vo/PlaybackVideoVO.java new file mode 100644 index 0000000..9dc25d1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/car/video/model/vo/PlaybackVideoVO.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.car.video.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author PoffyZhang + * @date 2022/11/07 下午2:10 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(description = "回放视频-VO") +public class PlaybackVideoVO { + + @ApiModelProperty("设备ID") + private String deviceId; + + @ApiModelProperty("设备名称") + private String deviceName; + + @ApiModelProperty("通道名称") + private String channelName; + + @ApiModelProperty("流开始时间戳") + private Long start; + + @ApiModelProperty("流结束时间戳") + private Long end; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/aop/BuildChildrenRegionEntity.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/aop/BuildChildrenRegionEntity.java new file mode 100644 index 0000000..8cac57f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/aop/BuildChildrenRegionEntity.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.common.aop; + +import java.lang.annotation.*; + +/** + * @Classname BuildChildrenRegion + * @Description + * @Date 2022/11/11 15:34 + * @Created by PoffyZhang + */ + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface BuildChildrenRegionEntity { + + //要生成地区的实体下标 + int entityIndex() default 0; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/aop/BuildChildrenRegionEntityAspect.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/aop/BuildChildrenRegionEntityAspect.java new file mode 100644 index 0000000..f8049f4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/aop/BuildChildrenRegionEntityAspect.java @@ -0,0 +1,76 @@ +package com.ningdatech.carapi.common.aop; + +import cn.hutool.core.collection.CollUtil; +import com.google.common.collect.Lists; +import com.ningdatech.carapi.sys.contants.RegionContant; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Objects; + +/** + * @program: + * @description: 生成子区域 + * BuildChildrenRegionAspect + * @author: PoffyZhang + * @created: 2022/11/11 09:12 + */ +@Aspect +@Component +@Slf4j +@AllArgsConstructor +@Order(10) +public class BuildChildrenRegionEntityAspect { + + @Autowired + private RegionsCacheHelper regionsCacheHelper; + + @Pointcut("@annotation(com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity)") + public void buildChildrenRegionEntityAspect() { + + } + + @Before("buildChildrenRegionEntityAspect() && @annotation(buildChildrenRegionEntity)") + public void before(JoinPoint joinPoint, BuildChildrenRegionEntity buildChildrenRegionEntity) throws Throwable { + + Object entity = joinPoint.getArgs()[buildChildrenRegionEntity.entityIndex()]; + + if (Objects.isNull(entity)) { + return; + } + + Class clazz = entity.getClass(); + Method getRegionId = clazz.getMethod("getRegionId"); + Long regionId = (Long) getRegionId.invoke(entity); + if (Objects.nonNull(regionId)) { + RegionDTO currRegion = regionsCacheHelper.getByRegionId(regionId); + List regionIds; + if (currRegion.getRegionCode().equals(currRegion.getParentCode()) + || currRegion.getRegionLevel().equals(RegionContant.THIRD_LEVEL)) { + regionIds = Lists.newArrayList(regionId); + } else { + regionIds = regionsCacheHelper.listChildRegionId(regionId, false, true); + } + if (CollUtil.isNotEmpty(regionIds)) { + Field field = clazz.getDeclaredField("regionIds"); + field.setAccessible(true); + field.set(entity, regionIds); + } + } + + } + + +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/aop/BuildChildrenRegionWrapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/aop/BuildChildrenRegionWrapper.java new file mode 100644 index 0000000..a198fa6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/aop/BuildChildrenRegionWrapper.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.common.aop; + +import java.lang.annotation.*; + +/** + * @Classname BuildChildrenRegionWrapper + * @Description + * @Date 2022/11/11 15:34 + * @Created by PoffyZhang + */ + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface BuildChildrenRegionWrapper { + + //要生成地区的wrapper下标 + int wrapperIndex() default 0; + + int entityIndex() default 1; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/aop/BuildChildrenRegionWrapperAspect.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/aop/BuildChildrenRegionWrapperAspect.java new file mode 100644 index 0000000..67d312f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/aop/BuildChildrenRegionWrapperAspect.java @@ -0,0 +1,63 @@ +package com.ningdatech.carapi.common.aop; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ningdatech.carapi.datascope.model.DataScopeEntity; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; +import java.util.List; +import java.util.Objects; + +/** + * @program: + * @description: 生成子区域 + * BuildChildrenRegionAspect + * @author: PoffyZhang + * @created: 2022/11/11 09:12 + */ +@Aspect +@Component +@Slf4j +@AllArgsConstructor +@Order(10) +public class BuildChildrenRegionWrapperAspect { + + @Autowired + private RegionsCacheHelper regionsCacheHelper; + + @Pointcut("@annotation(com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper)") + public void buildChildrenRegionWrapperAspect() { + + } + + @Before("buildChildrenRegionWrapperAspect() && @annotation(buildChildrenRegionWrapper)") + public void before(JoinPoint joinPoint, BuildChildrenRegionWrapper buildChildrenRegionWrapper) throws Throwable { + + LambdaQueryWrapper wrapper = (LambdaQueryWrapper) joinPoint.getArgs()[buildChildrenRegionWrapper.wrapperIndex()]; + Object entity = joinPoint.getArgs()[buildChildrenRegionWrapper.entityIndex()]; + + if(Objects.isNull(wrapper)){ + return; + } + + Class clazz = entity.getClass(); + Method getRegionId = clazz.getMethod("getRegionId"); + Long regionId = (Long) getRegionId.invoke(entity); + if(Objects.nonNull(regionId)){ + List regionIds = regionsCacheHelper.listChildRegionId(regionId); + if (CollUtil.isNotEmpty(regionIds)){ + wrapper.in(CollUtil.isNotEmpty(regionIds), DataScopeEntity::getRegionId,regionIds); + } + } + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/base/BaseDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/base/BaseDTO.java new file mode 100644 index 0000000..de976c2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/base/BaseDTO.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.common.base; + +import lombok.Getter; +import lombok.Setter; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; + +/** + * @author qinxianyun + */ +@Getter +@Setter +public class BaseDTO implements Serializable { + + private String createBy; + + private String updateBy; + + private Timestamp createTime; + + private Timestamp updateTime; + + @Override + public String toString() { + ToStringBuilder builder = new ToStringBuilder(this); + Field[] fields = this.getClass().getDeclaredFields(); + try { + for (Field f : fields) { + f.setAccessible(true); + builder.append(f.getName(), f.get(this)).append("\n"); + } + } catch (Exception e) { + builder.append("toString builder encounter an error"); + } + return builder.toString(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/base/BaseEntity.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/base/BaseEntity.java new file mode 100644 index 0000000..c63f985 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/base/BaseEntity.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.common.base; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +/** + * 通用字段, is_del 根据需求自行添加 + * @author PoffyZhang + */ +@Getter +@Setter +public class BaseEntity implements Serializable { + + @ApiModelProperty("创建人userId") + protected Long createBy; + + @ApiModelProperty("最后修改人userId") + protected Long updateBy; + + @ApiModelProperty("创建时间") + protected LocalDateTime createOn; + + @ApiModelProperty("修改时间") + protected LocalDateTime updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/base/BaseMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/base/BaseMapper.java new file mode 100644 index 0000000..e7a1e50 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/base/BaseMapper.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.common.base; + +import java.util.List; + +/** + * @author qinxianyun + */ +public interface BaseMapper { + + /** + * DTO转Entity + * @param dto / + * @return / + */ + E toEntity(D dto); + + /** + * Entity转DTO + * @param entity / + * @return / + */ + D toDto(E entity); + + /** + * DTO集合转Entity集合 + * @param dtoList / + * @return / + */ + List toEntity(List dtoList); + + /** + * Entity集合转DTO集合 + * @param entityList / + * @return / + */ + List toDto(List entityList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/config/BeanConfig.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/config/BeanConfig.java new file mode 100644 index 0000000..146aad5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/config/BeanConfig.java @@ -0,0 +1,109 @@ +package com.ningdatech.carapi.common.config; + +import com.ningdatech.cache.properties.CustomCacheProperties; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.Header; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy; +import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.message.BasicHeader; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.StringHttpMessageConverter; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.web.client.RestTemplate; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * @Classname BeanConfig + * @Description + * @Date 2022/10/26 9:42 + * @Created by PoffyZhang + */ +@Configuration +@Slf4j +@RequiredArgsConstructor +public class BeanConfig { + private final CustomCacheProperties cacheProperties; + + @Bean + public RestTemplate restTemplate() { + // 添加内容转换器,使用默认的内容转换器 + RestTemplate restTemplate = new RestTemplate(httpRequestFactory()); + // 设置编码格式为UTF-8,解决中文乱码问题 + List> converterList = restTemplate.getMessageConverters(); + HttpMessageConverter converterTarget = null; + for (HttpMessageConverter item : converterList) { + if (item.getClass() == StringHttpMessageConverter.class) { + converterTarget = item; + break; + } + } + if (converterTarget != null) { + converterList.remove(converterTarget); + } + HttpMessageConverter converter = new StringHttpMessageConverter(StandardCharsets.UTF_8); + converterList.add(1,converter); + + MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(); + mappingJackson2HttpMessageConverter.setSupportedMediaTypes(Arrays.asList( + MediaType.TEXT_HTML, + MediaType.TEXT_PLAIN)); + restTemplate.getMessageConverters().add(mappingJackson2HttpMessageConverter); + + log.info("-----restTemplate-----初始化完成"); + return restTemplate; + } + + @Bean + public ClientHttpRequestFactory httpRequestFactory() { + return new HttpComponentsClientHttpRequestFactory(httpClient()); + } + + @Bean + public HttpClient httpClient() { + // 长连接保持30秒 + PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(30, TimeUnit.SECONDS); + //设置整个连接池最大连接数 根据自己的场景决定 + connectionManager.setMaxTotal(500); + //同路由的并发数,路由是对maxTotal的细分 + connectionManager.setDefaultMaxPerRoute(500); + + //requestConfig + RequestConfig requestConfig = RequestConfig.custom() + //服务器返回数据(response)的时间,超过该时间抛出read timeout + .setSocketTimeout(30000) + //连接上服务器(握手成功)的时间,超出该时间抛出connect timeout + .setConnectTimeout(5000) + //从连接池中获取连接的超时时间,超过该时间未拿到可用连接,会抛出org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool + .setConnectionRequestTimeout(500) + .build(); + //headers + List
headers = new ArrayList<>(); + headers.add(new BasicHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.16 Safari/537.36")); + headers.add(new BasicHeader("Accept-Encoding", "gzip,deflate")); + headers.add(new BasicHeader("Accept-Language", "zh-CN")); + headers.add(new BasicHeader("Connection", "Keep-Alive")); + headers.add(new BasicHeader("Content-type", "application/json;charset=UTF-8")); + + return HttpClientBuilder.create() + .setDefaultRequestConfig(requestConfig) + .setConnectionManager(connectionManager) + .setDefaultHeaders(headers) + // 保持长连接配置,需要在头添加Keep-Alive + .setKeepAliveStrategy(new DefaultConnectionKeepAliveStrategy()) + //重试次数,默认是3次,没有开启 + .setRetryHandler(new DefaultHttpRequestRetryHandler(2, true)) + .build(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/config/WebConfig.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/config/WebConfig.java new file mode 100644 index 0000000..e59f46b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/config/WebConfig.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.common.config; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import com.ningdatech.basic.config.BaseConfig; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + *

+ * WebConfig + *

+ * + * @author WendyYang + * @since 14:09 2022/9/30 + */ +@Configuration +public class WebConfig extends BaseConfig { + + /** + * 设置mybatis-plus分页插件 + **/ + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); + return interceptor; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/AlarmLevelEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/AlarmLevelEnum.java new file mode 100644 index 0000000..af34cce --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/AlarmLevelEnum.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.common.constant; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * 告警等级 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "AlarmLevelEnum", description = "告警等级-枚举") +public enum AlarmLevelEnum { + /** + * 主动抓拍事件 + */ + EARLY_WARNING(1, "预警"), + GIVE_ALARM(2, "报警"); + + private Integer code; + private String desc; + + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(int code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (AlarmLevelEnum t : AlarmLevelEnum.values()) { + if (code == t.getCode()) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/AlarmTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/AlarmTypeEnum.java new file mode 100644 index 0000000..68d0834 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/AlarmTypeEnum.java @@ -0,0 +1,89 @@ +package com.ningdatech.carapi.common.constant; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * 告警类型 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "AlarmTypeEnum", description = "告警类型-枚举") +public enum AlarmTypeEnum { + /** + * 視頻遮擋 + */ + ADAS_ALARM_20102("视频遮挡", "0x00020102"), + ADAS_ALARM_20502("前向碰撞", "0x00020502"), + ADAS_ALARM_20504("车道偏离(左)", "0x00020504"), + ADAS_ALARM_20506("车道偏离(右)", "0x00020506"), + ADAS_ALARM_20508("车距过近", "0x00020508"), + ADAS_ALARM_20510("行人防撞", "0x00020510"), + ADAS_ALARM_20511("不礼让行人", "0x00020511"), + ADAS_ALARM_37005("路口快速通过", "0x00037005"), + ADAS_ALARM_20512("疲劳驾驶预警", "0x00020512"), + ADAS_ALARM_20513("疲劳驾驶", "0x00020513"), + ADAS_ALARM_20514("分神提醒预警", "0x00020514"), + ADAS_ALARM_20515("分神提醒", "0x00020515"), + ADAS_ALARM_20516("接打电话", "0x00020516"), + ADAS_ALARM_20517("抽烟", "0x00020517"), + ADAS_ALARM_20519("驾驶员检测异常", "0x00020519"), + ADAS_ALARM_2051A("驾驶员异常", "0x0002051A"), + ADAS_ALARM_20523("急加速", "0x00020523"), + ADAS_ALARM_20524("急减速", "0x00020524"), + ADAS_ALARM_20525("急左转弯", "0x00020525"), + ADAS_ALARM_20526("急右转弯", "0x00020526"), + ADAS_ALARM_20534("驾驶员身份异常", "0x00020534"), + ADAS_ALARM_20518("未系安全带", "0x00020518"), + ADAS_ALARM_37001("墨镜红外阻断报警", "0x00037001"), + ADAS_ALARM_37002("双手脱离方向盘报警", "0x00037002"), + ADAS_ALARM_37006("单手脱离方向盘报警", "0x00037006"), + ADAS_ALARM_37101("右转弯不停车", "0x00037101"), + ADAS_ALARM_37100("右转弯超速", "0x00037100"), + ADAS_ALARM_20559("紧急告警", "0x00020559"), + ADAS_ALARM_20528("车辆碰撞", "0x00020528"), + ADAS_ALARM_20530("车辆侧翻", "0x00020530"), + ADAS_ALARM_20560("车辆被盗", "0x00020560"), + ADAS_ALARM_20561("车辆非法点火", "0x00020561"), + ADAS_ALARM_20562("车辆非法位移", "0x00020562"), + NA("不支持的报警类型", "999"); + + + + private String desc; + private String code; + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(String code) { + if(StringUtils.isBlank(code)){ + return StringUtils.EMPTY; + } + for (AlarmTypeEnum t : AlarmTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/ApprovedMotorcycleTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/ApprovedMotorcycleTypeEnum.java new file mode 100644 index 0000000..9e76b4d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/ApprovedMotorcycleTypeEnum.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.common.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/12 下午2:41 + * 准驾车型 + */ +@AllArgsConstructor +@Getter +public enum ApprovedMotorcycleTypeEnum { + /** + * 搅拌车 + */ + MIXER, + + /** + * 泵车 + */ + PUMP_TRUCK, + + /** + * 散装水泥车 + */ + BULK_CEMENT_TRUCK, + + /** + * 砂浆车 + */ + MORTAR_TRUCK, + + OTHER; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/BgTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/BgTypeEnum.java new file mode 100644 index 0000000..14c2178 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/BgTypeEnum.java @@ -0,0 +1,107 @@ +package com.ningdatech.carapi.common.constant; + +import com.ningdatech.carapi.sys.entity.enumeration.CodingRuleBehaviorTypeEnum; +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static com.ningdatech.carapi.sys.entity.enumeration.CodingRuleBehaviorTypeEnum.*; + +/** + * 告警类型 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "BgTypeEnum", description = "告警类型 新-枚举") +public enum BgTypeEnum { + /** + * 主动抓拍事件 + */ + ADAS_DSM_ALARM_100(100, "ADAS主动抓拍事件", adas_initiative_capture_events, false), + ADAS_ALARM_101(101, "前向碰撞报警", forward_collision_warning, false), + ADAS_ALARM_102(102, "车道偏离(左)报警", lane_departure_left_warning, false), + ADAS_ALARM_103(103, "车道偏离(右)报警", lane_departure_right_warning, false), + ADAS_ALARM_104(104, "频繁变道报警", change_lanes_frequently_warning, false), + ADAS_ALARM_105(105, "车距过近(前车)报警", distance_too_close_warning, false), + ADAS_ALARM_106(106, "行人碰撞报警", pedestrian_collisions_warning, false), + ADAS_ALARM_107(107, "不礼让行人", no_comity_pedestrian, false), + ADAS_ALARM_108(108, "道路标志识别事件", road_sign_recognition_event, false), + ADAS_ALARM_109(109, "道路标识超速报警", road_signs_overspeed_warning, false), + ADAS_ALARM_110(110, "路口快速通过报警", crossroads_quickly_through_warning, false), + DSM_ALARM_200(200, "DSM主动抓拍事件", dsm_initiative_capture_events, false), + DSM_ALARM_201(201, "探头遮挡报警", probe_cover_alarm, false), + DSM_ALARM_202(202, "驾驶员人脸身份识别事件", driver_face_identification_events, false), + DSM_ALARM_203(203, "换人驾驶报警", substitution_driving_alarm, false), + DSM_ALARM_204(204, "超时驾驶报警", driver_timeout_alarm, false), + DSM_ALARM_205(205, "疲劳驾驶报警", fatigue_driving_alarm, false), + DSM_ALARM_206(206, "接打手持电话报警", holding_a_call_alarm, false), + DSM_ALARM_207(207, "抽烟报警", smoke_alarm, false), + DSM_ALARM_208(208, "分神驾驶报警", distracted_driving_alarm, false), + DSM_ALARM_209(209, "驾驶员状态异常报警", driver_abnormal_state_alarm, false), + DSM_ALARM_210(210, "未系安全带报警", not_wearing_seatbelt_alarm, false), + DSM_ALARM_211(211, "驾驶员身份异常报警", driver_abnormal_status_alarm, false), + BSD_ALARM_300(300, "后方接近报警", close_behind_alarm, false), + BSD_ALARM_301(301, "左侧后方接近报警", left_rear_near_alarm, false), + BSD_ALARM_302(302, "右侧后方接近报警", right_rear_near_alarm, false); + + private Integer code; + private String desc; + private CodingRuleBehaviorTypeEnum crbType; + private Boolean hidden; + + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + + public static List listCode(Boolean hidden) { + return Arrays.stream(values()) + .filter(w -> { + if (hidden == null) { + return Boolean.TRUE; + } + return hidden.equals(w.getHidden()); + }) + .map(BgTypeEnum::getCode) + .collect(Collectors.toList()); + } + + + public static String getDescByCode(int code) { + for (BgTypeEnum t : BgTypeEnum.values()) { + if (code == t.getCode()) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + + public static CodingRuleBehaviorTypeEnum getCrbTypeByCode(int code) { + for (BgTypeEnum t : BgTypeEnum.values()) { + if (code == t.getCode()) { + return t.crbType; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/CarStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/CarStatusEnum.java new file mode 100644 index 0000000..7ecec98 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/CarStatusEnum.java @@ -0,0 +1,76 @@ +package com.ningdatech.carapi.common.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 车辆在线状态 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "CarStatusEnum", description = "车辆状态-枚举") +public enum CarStatusEnum { + /** + * 启用 + */ + ENABLE(1, "启用"), + + /** + *停用 + */ + DISABLE(2, "停用"), + + /** + * 维修 + */ + REPAIR(3, "维修"), + + /** + * 报废 + */ + SCRAP(4,"报废"), + + /** + * 出售 + */ + SELL(5,"出售"); + + + 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 (CarStatusEnum t : CarStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/CommonConstant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/CommonConstant.java new file mode 100644 index 0000000..4e04cf8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/CommonConstant.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.common.constant; + +/** + * @description: 常量 + * @author: LiuXinXin + * @date: 2022/5/5 17:31 + */ +public class CommonConstant { + + public static final String COOKIE_KEY = "ND_JSESSION"; + + public static final Integer EXPORT_PAGE_NUMBER= 1; + + public static final Integer EXPORT_PAGE_SIZE= 100000; + public static final String CALL_STATUS = "status"; + public static final String CALL_STATUS_OK_VALUE = "ok"; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/CompanyTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/CompanyTypeEnum.java new file mode 100644 index 0000000..dd82f7d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/CompanyTypeEnum.java @@ -0,0 +1,59 @@ +package com.ningdatech.carapi.common.constant; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * 公司类型 + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "CompanyTypeEnum", description = "公司类型-枚举") +public enum CompanyTypeEnum { + /** + * 管理公司 + */ + ADMIN(1, "管理单位"), + + /** + * 企业公司 + */ + ENTERPRISE(2, "企业单位"); + + + 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 (CompanyTypeEnum t : CompanyTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/DeletedEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/DeletedEnum.java new file mode 100644 index 0000000..ad0d61f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/DeletedEnum.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.common.constant; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +/** + * 是否删除 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "DeletedEnum", description = "是否删除-枚举") +public enum DeletedEnum { + /** + * 是否删除 + */ + NO_DELETED(0, "未删除"), + DELETED(1, "已删除"); + + + + + private Integer code; + private String desc; + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(String code) { + if(StringUtils.isBlank(code)){ + return StringUtils.EMPTY; + } + for (DeletedEnum t : DeletedEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/DriverLicenseTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/DriverLicenseTypeEnum.java new file mode 100644 index 0000000..b3a24d5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/DriverLicenseTypeEnum.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.common.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/12 下午2:26 + * 驾驶员类型 + */ +@AllArgsConstructor +@Getter +public enum DriverLicenseTypeEnum { + /** + * 驾照类型 + */ + A1, + A2, + B1, + B2, + C1, + OTHER +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/DriverVehicleTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/DriverVehicleTypeEnum.java new file mode 100644 index 0000000..8767cc4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/DriverVehicleTypeEnum.java @@ -0,0 +1,108 @@ +package com.ningdatech.carapi.common.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 车辆类型 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "VehicleTypeEnum", description = "车辆类型-枚举") +public enum DriverVehicleTypeEnum { + /** + * 散装水泥运输车 + */ + BULK_CEMENT_TRUCK(1, "散装水泥车"), + + /** + *预拌砂浆运输车 + */ + READY_MIXED_MORTAR_TRUC(2, "砂浆车"), + + /** + * 混凝土搅拌车 + */ + MIXER(3, "搅拌车"), + + /** + * 移动泵车 + */ + KRHP(4, "泵车"), + + OTHER(99, "其他"); + + + 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 OTHER.desc; + } + for (DriverVehicleTypeEnum t : DriverVehicleTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return OTHER.desc; + } + + public static Integer getCodeByDesc(String desc) { + if(StringUtils.isBlank(desc)){ + return OTHER.code; + } + for (DriverVehicleTypeEnum t : DriverVehicleTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return OTHER.code; + } + + public static DriverVehicleTypeEnum getEnumByValue(Integer code) { + if(Objects.isNull(code)){ + return null; + } + for (DriverVehicleTypeEnum t : DriverVehicleTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } + + public static DriverVehicleTypeEnum getEnum(String desc) { + if(Objects.isNull(desc)){ + return null; + } + for (DriverVehicleTypeEnum t : DriverVehicleTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/EducationDegreeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/EducationDegreeEnum.java new file mode 100644 index 0000000..8011453 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/EducationDegreeEnum.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.common.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/12 下午2:28 + * 文化程度 + */ + +@AllArgsConstructor +@Getter +public enum EducationDegreeEnum { + /** + * 小学 + */ + PRIMARY_SCHOOL, + /** + * 初中 + */ + JUNIOR_HIGH_SCHOOL, + /** + * 高中 + */ + HIGH_SCHOOL, + /** + * 大专 + */ + JUNIOR_COLLEGE, + /** + * 本科 + */ + UNDERGRADUATE, + /** + * 硕士 + */ + MASTER, + /** + * 博士 + */ + DOCTOR + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/EducationEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/EducationEnum.java new file mode 100644 index 0000000..3233a9d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/EducationEnum.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.common.constant; + +import java.util.Objects; + +import lombok.Getter; + +/** + * EducationEnum + * @return + * @author CMM + * @since 2023/06/26 12:39 + */ +@Getter +public enum EducationEnum { + + /** + * 学历编码定义 + */ + PRIMARY(0, "小学"), + JUNIOR(1, "初中"), + HIGH(2, "高中"), + TECHNICAL(3, "专科"), + UNDERGRADUATE(4, "本科"), + POSTGRADUATE(5, "研究生"), + DOCTOR(6, "博士"); + + private final int code; + private final String value; + + EducationEnum(int code, String value) { + this.code = code; + this.value = value; + } + + public boolean eq(String val) { + return this.getValue().equals(val); + } + + public boolean eq(int code) { + return this.getCode() == code; + } + + public static EducationEnum getByCode(int code) { + for (EducationEnum genderEnum : EducationEnum.values()) { + if (genderEnum.getCode() == code) { + return genderEnum; + } + } + return null; + } + + public static String getDescByCode(int code) { + for (EducationEnum genderEnum : EducationEnum.values()) { + if (genderEnum.getCode() == code) { + return genderEnum.getValue(); + } + } + return null; + } + + public static EducationEnum getByValue(String value) { + if (Objects.isNull(value)) { + return null; + } + for (EducationEnum genderEnum : EducationEnum.values()) { + if (genderEnum.getValue().contains(value)) { + return genderEnum; + } + } + return null; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/GPSDataEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/GPSDataEnum.java new file mode 100644 index 0000000..c3d6986 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/GPSDataEnum.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.common.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum GPSDataEnum { + + /** + * 高度 + */ + ALTITUDE(0,"altitude"), + /** + * 方向 + */ + + DIRECTION(1,"direction"), + /** + * 方向 + */ + + SPEED(2,"speed"), + /** + * 纬度 + */ + + LATITUDE(3,"latitude"), + /** + * 精度 + */ + + LONGITUDE(4,"longitude"); + + private final int code; + private final String desc; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/GenderEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/GenderEnum.java new file mode 100644 index 0000000..498c2d8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/GenderEnum.java @@ -0,0 +1,72 @@ +package com.ningdatech.carapi.common.constant; + +import java.util.Objects; + +import lombok.Getter; + +/** + *

+ * GenderEnum + *

+ * + * @author WendyYang + * @since 15:15 2022/11/4 + */ +@Getter +public enum GenderEnum { + + /** + * 性别编码定义 + */ + WOMAN(0, "女"), + MAN(1, "男"), + UNKNOWN(2, "未知"), + OTHER(3, "其他"); + + private final int code; + private final String value; + + GenderEnum(int code, String value) { + this.code = code; + this.value = value; + } + + public boolean eq(String val) { + return this.getValue().equals(val); + } + + public boolean eq(int code) { + return this.getCode() == code; + } + + public static GenderEnum getByCode(int code) { + for (GenderEnum genderEnum : GenderEnum.values()) { + if (genderEnum.getCode() == code) { + return genderEnum; + } + } + return GenderEnum.UNKNOWN; + } + + public static String getDescByCode(int code) { + for (GenderEnum genderEnum : GenderEnum.values()) { + if (genderEnum.getCode() == code) { + return genderEnum.getValue(); + } + } + return GenderEnum.UNKNOWN.getValue(); + } + + public static GenderEnum getByValue(String value) { + if (Objects.isNull(value)) { + return GenderEnum.UNKNOWN; + } + for (GenderEnum genderEnum : GenderEnum.values()) { + if (genderEnum.getValue().contains(value)) { + return genderEnum; + } + } + return GenderEnum.UNKNOWN; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/InsureCompanyEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/InsureCompanyEnum.java new file mode 100644 index 0000000..6f05878 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/InsureCompanyEnum.java @@ -0,0 +1,95 @@ +package com.ningdatech.carapi.common.constant; + +import com.google.common.collect.Lists; +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.List; +import java.util.Objects; + +/** + * 保险公司 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "InsureCompanyEnum", description = "保险公司-枚举") +public enum InsureCompanyEnum { + /** + * 阳光财产 + */ + SUN(1, "阳光财产"), + + /** + * 人寿财产 + */ + LIFE(2, "人寿财产"), + + /** + * 大地财产 + */ + LAND(3, "大地财产"), + + /** + * 太平洋财产 + */ + PACIFIC(4, "太平洋财产"), + + /** + * 人民财产 + */ + PEOPLE(5, "人民财产"), + + /** + * 中华联合 + */ + CHUT(6, "中华联合"), + + /** + * 其他保险 + */ + OTHER(99, "其他保险"); + + + private Integer code; + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public static String getNameByCode(Integer code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (InsureCompanyEnum t : InsureCompanyEnum.values()) { + if (code.equals(t.getCode())) { + return t.name; + } + } + return StringUtils.EMPTY; + } + + + public boolean eq(String val) { + return this.name().equals(val); + } + + public static List getNames() { + List res = Lists.newArrayList(); + for(InsureCompanyEnum e : InsureCompanyEnum.values()){ + res.add(e.getName()); + } + return res; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/MissCertEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/MissCertEnum.java new file mode 100644 index 0000000..5947537 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/MissCertEnum.java @@ -0,0 +1,60 @@ +package com.ningdatech.carapi.common.constant; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * 丢失证件类型 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "MissCertEnum", description = "丢失证件类型-枚举") +public enum MissCertEnum { + /** + * 驾驶证 + */ + DRIVER_LINCENSE(1, "驾驶证"), + + /** + * 行驶证 + */ + DRIVE_PERMIT(2, "行驶证"); + + + 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 (MissCertEnum t : MissCertEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/UserRoleTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/UserRoleTypeEnum.java new file mode 100644 index 0000000..b3590ae --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/UserRoleTypeEnum.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.common.constant; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * @author CMM + * @description + * @since 2022/11/23 16:58 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("用户角色类型枚举") +public enum UserRoleTypeEnum { + /** + * 系统管理员 + */ + SYSTEM_ADMIN_ROLE_ID("系统管理员",4L), + SYSTEM_ROLE_ID("系统管理员",25L), + REGION_ADMIN_ROLE_ID("本区域管理员",24L), + COMPANY_INFO_OFFICER_ROLE_ID("企业信息员",3L), + OPERATOR_ROLE_ID("运营商",2L), + DRIVER_ROLE_ID("驾驶员",11L), + BULK_CEMENT_ADMIN_ROLE_ID("散办",10L); + + private String desc; + private Long id; + + public String getDesc() { + return desc; + } + public Long getId() { + return id; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescById(Long id){ + if (Objects.isNull(id)){ + return StringUtils.EMPTY; + } + for (UserRoleTypeEnum u : UserRoleTypeEnum.values()){ + if (id.equals(u.getId())){ + return u.desc; + } + } + return StringUtils.EMPTY; + } +} + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleEquipFuncEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleEquipFuncEnum.java new file mode 100644 index 0000000..1cca6de --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleEquipFuncEnum.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.common.constant; + +/** + * 车辆设备功能 + * @author CMM + * @since 2023/05/31 14:27 + */ +public enum VehicleEquipFuncEnum { + + /** + * 视频设备 + */ + video, + + /** + * 定位设备 + */ + gps; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleLimitSpeedEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleLimitSpeedEnum.java new file mode 100644 index 0000000..7f30e59 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleLimitSpeedEnum.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.common.constant; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.Objects; + +/** + * 车辆类型限速 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "VehicleLimitSpeedEnum", description = "车辆类型限速-枚举") +public enum VehicleLimitSpeedEnum { + /** + * 散装水泥运输车 + */ + BULK_CEMENT_TRUCK_LIMITSPEED(1, "散装水泥运输车",60), + + /** + *预拌砂浆运输车 + */ + READY_MIXED_MORTAR_TRUC(2, "预拌砂浆运输车",60), + + /** + * 混凝土搅拌车 + */ + MIXER(3, "混凝土搅拌车",50), + + /** + * 移动泵车 + */ + KRHP(4, "移动泵车",50); + + + private Integer code; + private String desc; + private Integer limitSpeed; + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static Integer getLimitSpeedByCode(Integer code) { + if(Objects.isNull(code)){ + return 60; + } + for (VehicleLimitSpeedEnum t : VehicleLimitSpeedEnum.values()) { + if (code.equals(t.getCode())) { + return t.limitSpeed; + } + } + return 60; + } + + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleMovingEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleMovingEnum.java new file mode 100644 index 0000000..3868f8e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleMovingEnum.java @@ -0,0 +1,60 @@ +package com.ningdatech.carapi.common.constant; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * 车辆是否行驶 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "VehicleMovingEnum", description = "车辆是否行驶-枚举") +public enum VehicleMovingEnum { + /** + * + */ + MOVING(1, "行驶中"), + + /** + *离线 + */ + NOT_MOVING(0, "不在行驶"); + + + 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 (VehicleMovingEnum t : VehicleMovingEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleStatusEnum.java new file mode 100644 index 0000000..0dc5210 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleStatusEnum.java @@ -0,0 +1,80 @@ +package com.ningdatech.carapi.common.constant; + +import com.ningdatech.carapi.scheduler.enums.OperatorTypeEnum; +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * 车辆在线状态 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "VehicleStatusEnum", description = "车辆在线状态-枚举") +public enum VehicleStatusEnum { + /** + * 在线 + */ + ONLINE(1, "在线", OperatorTypeEnum.ONLINE), + + /** + *离线 + */ + OFFLINE(0, "离线",OperatorTypeEnum.OFFLINE), + + /** + * 异常 + */ + EXCEPTIONAL(2, "异常",OperatorTypeEnum.EXCEPTION); + + + private Integer code; + private String desc; + + private OperatorTypeEnum operatorType; + + 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 (VehicleStatusEnum t : VehicleStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static OperatorTypeEnum getOperatorTypeByCode(Integer code) { + if(Objects.isNull(code)){ + return null; + } + for (VehicleStatusEnum t : VehicleStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.operatorType; + } + } + return null; + } + + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleTypeEnum.java new file mode 100644 index 0000000..2263e05 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/VehicleTypeEnum.java @@ -0,0 +1,121 @@ +package com.ningdatech.carapi.common.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 车辆类型 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "VehicleTypeEnum", description = "车辆类型-枚举") +public enum VehicleTypeEnum { + /** + * 散装水泥运输车 + */ + BULK_CEMENT_TRUCK(1, "散装水泥运输车"), + + /** + *预拌砂浆运输车 + */ + READY_MIXED_MORTAR_TRUC(2, "预拌砂浆运输车"), + + /** + * 混凝土搅拌车 + */ + MIXER(3, "混凝土搅拌车"), + + /** + * 移动泵车 + */ + KRHP(4, "移动泵车"), + + OTHER(99, "其他"); + + + 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 OTHER.desc; + } + for (VehicleTypeEnum t : VehicleTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return OTHER.desc; + } + + public static String getDescByEnum(String e) { + if(StringUtils.isBlank(e)){ + return null; + } + for (VehicleTypeEnum t : VehicleTypeEnum.values()) { + String substring = e.substring(1, e.length() - 1); + if (substring.equals(t.name())) { + return t.desc; + } + } + return null; + } + + public static Integer getCodeByDesc(String desc) { + if(StringUtils.isBlank(desc)){ + return OTHER.code; + } + for (VehicleTypeEnum t : VehicleTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return OTHER.code; + } + + public static VehicleTypeEnum getEnumByValue(Integer code) { + if(Objects.isNull(code)){ + return null; + } + for (VehicleTypeEnum t : VehicleTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } + + public static VehicleTypeEnum getEnum(String desc) { + if(Objects.isNull(desc)){ + return null; + } + for (VehicleTypeEnum t : VehicleTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/ViolationTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/ViolationTypeEnum.java new file mode 100644 index 0000000..261c7ac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/constant/ViolationTypeEnum.java @@ -0,0 +1,75 @@ +package com.ningdatech.carapi.common.constant; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * 违章类型 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "ViolationTypeEnum", description = "违章类型-枚举") +public enum ViolationTypeEnum { + /** + * 无证驾驶 + */ + MISS_CERT(1, "无证驾驶"), + + /** + * 闯红灯 + */ + RED_LIGHT(2, "闯红灯"), + + /** + * 超载 + */ + OVER_LOAD(3, "超载"), + + /** + * 违规路段 + */ + SECTION(4, "违规路段"), + + /** + * 违规时间段 + */ + PERIOD(5, "违规时间段"); + + + 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 (ViolationTypeEnum t : ViolationTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/contants/DefValConstants.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/contants/DefValConstants.java new file mode 100644 index 0000000..13de443 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/contants/DefValConstants.java @@ -0,0 +1,124 @@ +package com.ningdatech.carapi.common.contants; + + +import com.ningdatech.basic.util.StrPool; + +/** + * 默认值 + * + * @author PoffyZhang + */ +public interface DefValConstants { + + /** + * 默认的根节点path + */ + String ROOT_PATH = StrPool.COMMA; + /** + * 默认树层级 + */ + Integer TREE_GRADE = 0; + /** + * 默认的父id + */ + Long PARENT_ID = 0L; + /** + * 默认的排序 + */ + Integer SORT_VALUE = 0; + /** + * 字典占位符 + */ + String DICT_PLACEHOLDER = "###"; + /** + * 浙江省的region_id + */ + Long ZJREGION_ID = 116L; + Long SYSTEM_ID = 1L; + String ZJ_PROVINCE = "浙江省"; + String PROVINCE = "省"; + + /** + * 城市 level + */ + Integer CITY_REGION_LEVEL = 2; + + /** + * 区的 level + */ + Integer QU_REGION_LEVEL = 3; + + /** + * 驾驶员异常数据GPS字符串起始偏移量 + */ + Integer GPS_START_OFFSET = 5; + + /** + * 驾驶员异常数据GPS字符串结尾偏移量 + */ + Integer GPS_END_OFFSET = 69; + + /** + * 新增线下驾驶员培训,发送短信模板 + */ + String OFFLINE_MESSAGE_TEMPLATE = "{%s}您好:{散办名称}组织了关于{培训主题}的{培训模式}培训,培训时间为{培训开始 至 结束时间},培训地点为{培训地点:线下培训时显示},培训链接{生成培训链接,点击后跳转培训页面},请准时参加培训。联系人:{联系人},联系电话:{联系电话},考证号:{准考证号}."; + + /** + * 新增线上驾驶员培训,发送短信模板 + */ + String ONLINE_MESSAGE_TEMPLATE = "{%s}您好:{散办名称}组织了关于{培训主题}的{培训模式}培训,培训时间为{培训开始 至 结束时间},培训链接{生成培训链接,点击后跳转培训页面},请准时参加培训。联系人:{联系人},联系电话:{联系电话},考证号:{准考证号}."; + + /** + * SQL查询一条 + */ + String LIMIT_1 = " limit 1"; + /** + * 随机试卷 + */ + String RANDOM_PAPER = "随机试卷"; + /** + * 随机试卷ID + */ + Long RANDOM_EXAM_PAPER_ID = 0L; + /** + * 线上培训 + */ + String ONLINE = "线上"; + /** + * 线下培训 + */ + String OFFLINE = "线下"; + /** + * 取证培训 + */ + String FORENSIC_REGISTRATION_TRAINING = "取证培训"; + /** + * 继续教育 + */ + String CONTINUING_EDUCATION_TRAINING = "继续教育"; + /** + * 换证培训 + */ + String REPLACEMENT_REGISTRATION_TRAINING = "换证培训"; + /** + * 转码培训 + */ + String TRANSCODING_TRAINING = "转码培训"; + /** + * 通道 + */ + String TONG_DAO = "通道"; + + /** + * 隧道回放 + */ + String SUI_DAO_PLAY_BACK = "tunnel-play-back"; + /** + * 驾驶员实时回放 + */ + String DRIVER_REAL_TIME_PLAY_BACK = "driver-real-time-play-back"; + /** + * 驾驶员远程回放 + */ + String DRIVER_REMOTE_PLAY_BACK = "driver-remote-play-back"; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/contants/IrsConst.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/contants/IrsConst.java new file mode 100644 index 0000000..01e9fa5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/contants/IrsConst.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.common.contants; + +/** + *

+ * IrsConst + *

+ * + * @author WendyYang + * @since 2023/5/16 + **/ +public interface IrsConst { + + // 驾驶证查询接口地址 + String DRIVER_LICENSE_URL = "https://interface.zjzwfw.gov.cn/gateway/api/001003007/dataSharing/driverLicenseInfo.htm"; + + String DRIVING_LICENSE_URL = "https://interface.zjzwfw.gov.cn/gateway/api/001003007/dataSharing/vehicleQmInfo.htm"; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/exception/AppErrorCode.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/exception/AppErrorCode.java new file mode 100644 index 0000000..614fc59 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/exception/AppErrorCode.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.common.exception; + +public enum AppErrorCode { + /** + * 用戶 + */ + USER(100), + + AUTH(101); + + private final Integer code; + + AppErrorCode(Integer code) { + this.code = code; + } + + public Integer getCode() { + return code; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/filter/SqlInjectFilter.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/filter/SqlInjectFilter.java new file mode 100644 index 0000000..483d04f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/filter/SqlInjectFilter.java @@ -0,0 +1,112 @@ +package com.ningdatech.carapi.common.filter; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Component; + +import javax.servlet.*; +import javax.servlet.annotation.WebFilter; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Enumeration; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @description: sql注入过滤 + * @author: liushuai + * @date: 2022/3/25 11:42 + */ +@Component +@Configuration +@ConfigurationProperties(prefix = "security.sql") +@WebFilter(filterName = "SqlInjectFilter", urlPatterns = "/*") +public class SqlInjectFilter implements Filter { + /** + * 过滤器配置对象 + */ + FilterConfig filterConfig = null; + + /** + * 忽略的URL + */ + private List excludes; + + public void setExcludes(List excludes) { + this.excludes = excludes; + } + + /** + * 初始化 + */ + @Override + public void init(FilterConfig filterConfig) throws ServletException { + this.filterConfig = filterConfig; + } + + /** + * 拦截 + */ + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) + throws IOException, ServletException { + HttpServletRequest request = (HttpServletRequest) servletRequest; + HttpServletResponse response = (HttpServletResponse) servletResponse; + // 已忽略的URL不拦截 + if (isExcludeUrl(request.getServletPath())) { + filterChain.doFilter(servletRequest, servletResponse); + return; + } + + //获得所有请求参数名 + Enumeration names = request.getParameterNames(); + while (names.hasMoreElements()) { + //得到参数名 + String name = names.nextElement(); + //得到参数对应值 + String[] values = request.getParameterValues(name); + for (String value : values) { + if (sqlValidate(value)) { + throw new IOException("您发送请求中的参数中含有非法字符"); + } + } + } + filterChain.doFilter(request, response); + } + + /** + * 销毁 + */ + @Override + public void destroy() { + this.filterConfig = null; + } + + /** + * 判断是否为忽略的URL + * + * @param url URL路径 + * @return true-忽略,false-过滤 + */ + private boolean isExcludeUrl(String url) { + if (excludes == null || excludes.isEmpty()) { + return false; + } + return excludes.stream().map(pattern -> Pattern.compile("^" + pattern)).map(p -> p.matcher(url)) + .anyMatch(Matcher::find); + } + + protected static boolean sqlValidate(String str) { + //统一转为小写 + String s = str.toLowerCase(); + //过滤掉的sql关键字,特殊字符前面需要加\\进行转义 + String badStr = + "select|update|and|or|delete|insert|truncate|char|into|substr|ascii|declare|exec|count|master|into|drop|execute|table|" + + "char|declare|sitename|xp_cmdshell|like|from|grant|use|group_concat|column_name|" + + "information_schema.columns|table_schema|union|where|order|by"; + //使用正则表达式进行匹配 + return s.matches(badStr); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/handler/GlobalExceptionHandler.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/handler/GlobalExceptionHandler.java new file mode 100644 index 0000000..70657da --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/handler/GlobalExceptionHandler.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.common.handler; + +import com.ningdatech.basic.enumeration.Status; +import com.ningdatech.basic.model.ApiResponse; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.support.DefaultMessageSourceResolvable; +import org.springframework.http.HttpStatus; +import org.springframework.validation.BindException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.servlet.NoHandlerFoundException; + +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import java.util.stream.Collectors; + +/** + * @description: 统一错误处理 + * @author: liushuai + * @date: 2022/3/25 11:39 + */ +@Slf4j +@ControllerAdvice +@ResponseStatus(HttpStatus.BAD_REQUEST) +public class GlobalExceptionHandler { + + @ResponseBody + @ExceptionHandler(value = NoHandlerFoundException.class) + public ApiResponse noHandlerFoundException(NoHandlerFoundException e) { + log.error("【全局异常拦截】NoHandlerFoundException: 请求方法 {}, 请求路径 {}", e.getRequestURL(), e.getHttpMethod()); + return ApiResponse.ofStatus(Status.REQUEST_NOT_FOUND); + } + + @ResponseBody + @ExceptionHandler(value = {MethodArgumentNotValidException.class, BindException.class}) + public ApiResponse bindException(BindException e) { + String msg = e.getAllErrors().stream() + .map(DefaultMessageSourceResolvable::getDefaultMessage) + .collect(Collectors.joining(",")); + return ApiResponse.of(Status.BAD_REQUEST.getCode(), msg, null); + } + + @ResponseBody + @ExceptionHandler(value = ConstraintViolationException.class) + public ApiResponse constraintViolationException(ConstraintViolationException e) { + String msg = e.getConstraintViolations().stream() + .map(ConstraintViolation::getMessage) + .collect(Collectors.joining(",")); + return ApiResponse.of(Status.BAD_REQUEST.getCode(), msg, null); + } + + @ResponseBody + @ExceptionHandler(value = Exception.class) + public ApiResponse handlerException(Exception e) { + log.error("【全局异常拦截】: 异常信息 {}: {} ", e.getClass().getSimpleName(), e); + return ApiResponse.of(Status.BAD_REQUEST.getCode(), e.getMessage(), null); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/handler/GlobalResponseHandler.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/handler/GlobalResponseHandler.java new file mode 100644 index 0000000..eed7d6a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/handler/GlobalResponseHandler.java @@ -0,0 +1,79 @@ +package com.ningdatech.carapi.common.handler; + +import cn.hutool.json.JSONUtil; +import com.ningdatech.basic.model.ApiResponse; +import org.springframework.core.MethodParameter; +import org.springframework.http.MediaType; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.server.ServerHttpRequest; +import org.springframework.http.server.ServerHttpResponse; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; + +/** + * @Author liuxinxin + * @Date 2021/7/21 11:26 + * @Version 1.0 + **/ +@RestControllerAdvice(basePackages = { + "com.ningdatech.carapi.car.position.controller", + "com.ningdatech.carapi.car.video.controller", + "com.ningdatech.carapi.car.monitor.controller", + "com.ningdatech.carapi.car.rpt.controller", + "com.ningdatech.carapi.car.trips.controller", + "com.ningdatech.carapi.car.datascreen.controller", + "com.ningdatech.carapi.car.vehicle.controller", + "com.ningdatech.carapi.car.equipment.controller", + "com.ningdatech.carapi.meta.controller", + "com.ningdatech.carapi.sys.controller", + "com.ningdatech.carapi.driver.controller", + "com.ningdatech.carapi.archives.controller", + "com.ningdatech.carapi.company.controller", + "com.ningdatech.carapi.analysis.controller", + "com.ningdatech.carapi.safe.controller", + "com.ningdatech.carapi.qrcode.controller", + "com.ningdatech.carapi.open.controller", + "com.ningdatech.carapi.industry.controller", + "com.ningdatech.carapi.homepage.controller", + "com.ningdatech.carapi.radar.controller", + "com.ningdatech.carapi.gps.controller", + "com.ningdatech.carapi.road.controller" +}) +public class GlobalResponseHandler implements ResponseBodyAdvice { + + private static final String SWAGGER_CLASS_PREFIX = "springfox.documentation"; + + @Override + public boolean supports(MethodParameter methodParameter, Class> aClass) { + return filter(methodParameter); + } + + @Override + public Object beforeBodyWrite(Object o, MethodParameter methodParameter, MediaType mediaType, + Class> aClass, ServerHttpRequest serverHttpRequest, + ServerHttpResponse serverHttpResponse) { + ApiResponse apiResponse = ApiResponse.ofSuccess(o); + // 处理字符串时,遇到了类型转换的问题,debug一步一步跟踪,原来是对于字符串的ContentType是“text-plain”, + // ConverterType是StringHttpMessageConverter这个类型转换, + // 由于将结果封装成了自定义的ApiResponse类型,所以有ApiResponse转换成String报错 + // 所以需要对String类型的返回值单独进行处理 + if (o instanceof String) { + return JSONUtil.toJsonStr(apiResponse); + } + return ApiResponse.ofSuccess(o); + } + + private Boolean filter(MethodParameter methodParameter) { + Class declaringClass = methodParameter.getDeclaringClass(); + // swagger中的所有返回不进行统一封装 + if (declaringClass.getName().contains(SWAGGER_CLASS_PREFIX)) { + return false; + } + if (methodParameter.hasMethodAnnotation(ExceptionHandler.class)) { + return false; + } + // 如果本身就是使用ApiResponse返回,则不需要进行格式化 + return !methodParameter.getGenericParameterType().equals(ApiResponse.class); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/helper/UserInfoHelper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/helper/UserInfoHelper.java new file mode 100644 index 0000000..02f13cf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/helper/UserInfoHelper.java @@ -0,0 +1,146 @@ +package com.ningdatech.carapi.common.helper; + +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +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.carapi.datascope.model.DataScopeDto; +import com.ningdatech.carapi.datascope.provider.DataScopeContext; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.sys.convert.UserAuthConverter; +import com.ningdatech.carapi.sys.convert.UserRoleConverter; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.Role; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.entity.vo.UserInfoVO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.sys.service.RoleService; +import com.ningdatech.carapi.sys.service.UserRoleService; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.model.vo.UserBasicInfoVO; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; + +/** + * @author liuxinxin + * @date 2022/10/22 上午11:50 + *

+ */ +@Component +@RequiredArgsConstructor +public class UserInfoHelper { + private final CompanyService companyService; + private final INdUserInfoService iNdUserInfoService; + private final IDriverInfoService driverInfoService; + private final CompaniesCacheHelper companiesCacheHelper; + private final INdUserAuthService userAuthService; + private final UserRoleService userRoleService; + private final RoleService roleService; + + public Long getUserCompanyId() { + Long userId = LoginUserUtil.getUserId(); + NdUserInfo userInfo = iNdUserInfoService.getById(userId); + if (Objects.isNull(userInfo.getCompanyId())) { + throw new BizException("当前非公司或驾驶员账号"); + } + return userInfo.getCompanyId(); + } + + public String getUserCompanyName() { + Company company = companyService.getById(getUserCompanyId()); + return company.getName(); + } + + public Long getUserRegionId() { + Company company = companyService.getById(getUserCompanyId()); + return company.getRegionId(); + } + + public UserBasicInfoVO getUserFullInfo() { + UserBasicInfoVO userBasicInfoVO = new UserBasicInfoVO(); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + Long userId = user.getUserId(); + Long roleId = user.getRoleId(); + Optional dataScope = DataScopeContext.getDataScope(user.getDataScope()); + if(dataScope.isPresent()){ + userBasicInfoVO.setMaxRegion(dataScope.get().getMaxRegion()); + } + userBasicInfoVO.setNickName(user.getNickName()); + // 获取驾驶员信息 + DriverInfo driverInfo = driverInfoService.getOne(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getUserId, userId)); + if (Objects.nonNull(driverInfo)) { + userBasicInfoVO.setDriverId(driverInfo.getId()); + } + userBasicInfoVO.setUserId(userId); + userBasicInfoVO.setRoleId(roleId); + userBasicInfoVO.setCompanyId(user.getCompanyId()); + Company company = companyService.getById(user.getCompanyId()); + userBasicInfoVO.setCompanyName(company.getName()); + userBasicInfoVO.setRegionId(company.getRegionId()); + userBasicInfoVO.setRegionName(company.getRegionName()); + + return userBasicInfoVO; + } + + public UserInfoVO getUserDetailByUserId(Long userId) { + + NdUserInfo user = iNdUserInfoService.getById(userId); + if (Objects.isNull(user)) { + return null; + } + + UserInfoVO query = BeanUtil.toBean(user, UserInfoVO.class); + //查出帐号 + searchAuth(query); + //查出角色 + searchRoleName(query); + return query; + } + + private void searchAuth(UserInfoVO user) { + if(Objects.isNull(user)){ + return; + } + //查出帐号 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdUserAuth.class); + wrapper.in(NdUserAuth::getUserId, user.getId()); + List auths = userAuthService.list(wrapper); + if(CollUtil.isNotEmpty(auths)){ + UserAuthConverter.convert(user,auths); + } + } + + private void searchRoleName(UserInfoVO user) { + if(Objects.isNull(user)){ + return; + } + //查出角色名 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(UserRole.class); + wrapper.in(UserRole::getUserId, user.getId()); + List userRoles = userRoleService.list(wrapper); + if(CollUtil.isEmpty(userRoles)){ + return; + } + List roleIds = userRoles.stream().map(UserRole::getRoleId).distinct().collect(Collectors.toList()); + List roles = roleService.listByIds(roleIds); + if(CollUtil.isNotEmpty(roles)){ + UserRoleConverter.convert(user,userRoles,roles); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/interceptor/DataPermissionInterceptor.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/interceptor/DataPermissionInterceptor.java new file mode 100644 index 0000000..e63aaa5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/interceptor/DataPermissionInterceptor.java @@ -0,0 +1,71 @@ +package com.ningdatech.carapi.common.interceptor; + +import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper; +import com.baomidou.mybatisplus.core.toolkit.PluginUtils; +import com.baomidou.mybatisplus.extension.parser.JsqlParserSupport; +import com.baomidou.mybatisplus.extension.plugins.handler.DataPermissionHandler; +import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor; +import lombok.*; +import net.sf.jsqlparser.expression.Expression; +import net.sf.jsqlparser.statement.select.PlainSelect; +import net.sf.jsqlparser.statement.select.Select; +import net.sf.jsqlparser.statement.select.SelectBody; +import net.sf.jsqlparser.statement.select.SetOperationList; +import org.apache.ibatis.executor.Executor; +import org.apache.ibatis.mapping.BoundSql; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.session.ResultHandler; +import org.apache.ibatis.session.RowBounds; + +import java.sql.SQLException; +import java.util.List; + +/** + * 数据权限处理器 + * + * @author hubin + * @since 3.4.1 + + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@SuppressWarnings({"rawtypes"}) +public class DataPermissionInterceptor extends JsqlParserSupport implements InnerInterceptor { + private DataPermissionHandler dataPermissionHandler; + + @Override + public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException { + if (InterceptorIgnoreHelper.willIgnoreDataPermission(ms.getId())){ + return; + } + PluginUtils.MPBoundSql mpBs = PluginUtils.mpBoundSql(boundSql); + mpBs.sql(parserSingle(mpBs.sql(), ms.getId())); + } + + @Override + protected void processSelect(Select select, int index, String sql, Object obj) { + SelectBody selectBody = select.getSelectBody(); + if (selectBody instanceof PlainSelect) { + this.setWhere((PlainSelect) selectBody, (String) obj); + } else if (selectBody instanceof SetOperationList) { + SetOperationList setOperationList = (SetOperationList) selectBody; + List selectBodyList = setOperationList.getSelects(); + selectBodyList.forEach(s -> this.setWhere((PlainSelect) s, (String) obj)); + } + } + + /** + * 设置 where 条件 + * + * @param plainSelect 查询对象 + * @param whereSegment 查询条件片段 + */ + protected void setWhere(PlainSelect plainSelect, String whereSegment) { + Expression sqlSegment = dataPermissionHandler.getSqlSegment(plainSelect.getWhere(), whereSegment); + if (null != sqlSegment) { + plainSelect.setWhere(sqlSegment); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/DataChartVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/DataChartVo.java new file mode 100644 index 0000000..c54c1c4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/DataChartVo.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.common.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * DataChartVo + *

+ * + * @author WendyYang + * @since 09:18 2022/10/26 + */ +@Data +@ApiModel("数据图表视图类") +public class DataChartVo { + + @ApiModelProperty("名称") + private String label; + + @ApiModelProperty("数量") + private Integer value; + + @ApiModelProperty("百分比") + private String percent; + + @ApiModelProperty("预警等级") + private Integer dangerLevel; + + public DataChartVo(String label, Integer value) { + this.label = label; + this.value = value; + } + + public DataChartVo() { + } + + public DataChartVo(String label, Integer value, String percent) { + this.label = label; + this.value = value; + this.percent = percent; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/FileBasicInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/FileBasicInfo.java new file mode 100644 index 0000000..a2c880b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/FileBasicInfo.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.common.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/7/25 下午1:55 + * 用于包装使用 + */ +@Data +@ApiModel("文件信息基类") +public class FileBasicInfo { + + @ApiModelProperty("文件id") + private Long fileId; + + @ApiModelProperty("文件名") + private String fileName; + + @ApiModelProperty("文件类型") + private Integer fileType; + + @ApiModelProperty("文件路径") + private String filePath; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/GroupByDto.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/GroupByDto.java new file mode 100644 index 0000000..bb61c61 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/GroupByDto.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.common.model; + +import lombok.Data; + +/** + *

+ * GroupByDto + *

+ * + * @author WendyYang + * @since 16:07 2022/10/25 + */ +@Data +public class GroupByDto { + + private T groupKey; + + private Integer count; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/KeyValueDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/KeyValueDTO.java new file mode 100644 index 0000000..6d3ed66 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/KeyValueDTO.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.common.model; + +import lombok.Data; + +/** + *

+ * + *

+ * + * @author WendyYang + * @since 15:27 2022/10/25 + */ +@Data +public class KeyValueDTO { + + private K key; + + private V value; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/MapDataVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/MapDataVO.java new file mode 100644 index 0000000..2a93824 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/MapDataVO.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.common.model; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +/** + *

+ * MapDataVo + *

+ * + * @author WendyYang + * @since 20:09 2022/11/16 + */ +@Data +@Builder +public class MapDataVO { + + @Tolerate + public MapDataVO() { + } + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域编码") + private String regionCode; + + @ApiModelProperty("数量") + private Integer value; + + @ApiModelProperty("百分比") + private String percent; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/RegionContainsBO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/RegionContainsBO.java new file mode 100644 index 0000000..e82dcdb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/RegionContainsBO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.common.model; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/26 下午4:48 + */ +@Data +public class RegionContainsBO { + + /** + * 最高级节点级别 + */ + private Integer parentRegionTreeLevel; + + /** + * 所有区域码列表 + */ + private List containsRegionCodeList; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/po/MapDataPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/po/MapDataPO.java new file mode 100644 index 0000000..526f5df --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/model/po/MapDataPO.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.common.model.po; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +import java.math.BigDecimal; + +/** + *

+ * MapDataVo + *

+ * + * @author WendyYang + * @since 20:09 2022/11/16 + */ +@Data +@Builder +public class MapDataPO { + + @Tolerate + public MapDataPO() { + } + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域编码") + private String regionCode; + + @ApiModelProperty("数量") + private Integer value; + + @ApiModelProperty("百分比") + private String percent; + + @ApiModelProperty("最高速率") + private BigDecimal maxSpeed; + + @ApiModelProperty("车牌号") + private String carPlate; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/BizUtils.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/BizUtils.java new file mode 100644 index 0000000..7d4224f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/BizUtils.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.common.util; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +import cn.hutool.core.util.NumberUtil; + +/** + *

+ * BizUtils + *

+ * + * @author WendyYang + * @since 17:34 2022/12/5 + */ +public class BizUtils { + + public static String percent(Long numerator, Long denominator) { + if (numerator == null || numerator == 0) { + return "0%"; + } + if (denominator == null || denominator == 0 ){ + return NumberUtil.div(numerator, BigDecimal.valueOf(1)).multiply(BigDecimal.valueOf(100)) + .setScale(2, RoundingMode.HALF_UP) + "%"; + } + return NumberUtil.div(numerator, denominator).multiply(BigDecimal.valueOf(100)) + .setScale(2, RoundingMode.HALF_UP) + "%"; + } + + + public static void main(String[] args) { + System.out.println(percent(-1L, 0L)); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/CodeUtil.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/CodeUtil.java new file mode 100644 index 0000000..c1a5711 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/CodeUtil.java @@ -0,0 +1,394 @@ +package com.ningdatech.carapi.common.util; + +import cn.hutool.core.collection.CollUtil; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.car.datascreen.model.po.OnlineVehicleRegionsPO; +import com.ningdatech.carapi.common.model.MapDataVO; +import com.ningdatech.carapi.sys.contants.RegionContant; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAdjusters; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; +import java.util.function.Predicate; + +/** + * @Classname CodeUtil + * @Description + * @Date 2022/11/22 16:21 + * @Created by PoffyZhang + */ +@RequiredArgsConstructor +@Slf4j +@Component +public class CodeUtil { + + @Autowired + private RegionsCacheHelper regionsCacheHelper; + @Autowired + private CompaniesCacheHelper companiesCacheHelper; + private static CodeUtil codeUtil; + + @PostConstruct + public void init() { + codeUtil = this; + codeUtil.regionsCacheHelper = this.regionsCacheHelper; + codeUtil.companiesCacheHelper = this.companiesCacheHelper; + } + + public static Predicate distinctByKey(Function keyExtractor) { + Set seen = ConcurrentHashMap.newKeySet(); + return t -> seen.add(keyExtractor.apply(t)); + } + + public static void searchCompanyName(T obj) { + try { + Class clazz = obj.getClass(); + Field companyNameField = clazz.getDeclaredField("companyName"); + Field companyIdField = clazz.getDeclaredField("companyId"); + companyNameField.setAccessible(Boolean.TRUE); + companyIdField.setAccessible(Boolean.TRUE); + Long companyId = Objects.nonNull(companyIdField.get(obj)) ? (Long)companyIdField.get(obj) : null; + if (Objects.isNull(companyId)) { + return; + } + String companyName = Objects.nonNull(companyNameField.get(obj)) ? (String)companyNameField.get(obj) : null; + if (Objects.isNull(codeUtil)){ + log.error("codeUtil is null"); + return; + } + companyNameField.set(obj, codeUtil.companiesCacheHelper.getNameById(companyId, companyName)); + } catch (Exception e) { + log.error("searchCompanyName err :",e); + } + } + + public static void searchCompanyNames(List records) { + if (CollUtil.isEmpty(records)) { + return; + } + for (Object obj : records) { + searchCompanyName(obj); + } + } + + public static void searchRegionName(T record) { + try { + Class clazz = record.getClass(); + Field regionNameField = clazz.getDeclaredField("regionName"); + Field regionIdField = clazz.getDeclaredField("regionId"); + regionNameField.setAccessible(Boolean.TRUE); + regionIdField.setAccessible(Boolean.TRUE); + Long regionId = Objects.nonNull(regionIdField.get(record)) ? (Long)regionIdField.get(record) : null; + if (Objects.isNull(regionId)) { + return; + } + if (Objects.isNull(codeUtil)){ + log.error("codeUtil is null"); + return; + } + regionNameField.set(record, codeUtil.regionsCacheHelper.getDisplayName(regionId)); + } catch (Exception e) { + log.error(e.getMessage()); + } + } + + public static void searchRegionNames(List records) { + if (CollUtil.isEmpty(records)) { + return; + } + for (Object obj : records) { + searchRegionName(obj); + } + } + + public static void searchCompanyNameAndRegionName(T record) { + searchCompanyName(record); + searchRegionName(record); + } + + public static void searchCompanyNamesAndRegionNames(List records) { + if (CollUtil.isEmpty(records)) { + return; + } + for (Object obj : records) { + searchCompanyNameAndRegionName(obj); + } + } + + /** + * 字符串是否是json类型 + * + * @param str + * @return + */ + public static boolean getJSONType(String str) { + boolean result = false; + if (StringUtils.isNotBlank(str)) { + str = str.trim(); + if (str.startsWith("{") && str.endsWith("}")) { + result = true; + } else if (str.startsWith("[") && str.endsWith("]")) { + result = true; + } + } + return result; + } + + /** + * 获取 区域等级 + * + * @param record + */ + public static void buildRegionLevel(T record) { + try { + Class clazz = record.getClass(); + Field regionLevelField = clazz.getDeclaredField("regionLevel"); + Field regionIdField = clazz.getDeclaredField("regionId"); + regionLevelField.setAccessible(Boolean.TRUE); + regionIdField.setAccessible(Boolean.TRUE); + Long regionId = Objects.nonNull(regionIdField.get(record)) ? (Long)regionIdField.get(record) : null; + if (Objects.isNull(regionId)) { + regionId = RegionContant.ZJ_REGION_ID; + } + if (Objects.isNull(codeUtil)){ + log.error("codeUtil is null"); + return; + } + RegionDTO regionDto = codeUtil.regionsCacheHelper.getByRegionId(regionId); + if (Objects.nonNull(regionDto)) { + regionLevelField.set(record, regionDto.getRegionLevel()); + } + } catch (Exception e) { + log.error("buildRegionLevel err :",e); + } + } + + /** + * 根据月份 和type 来build 这一旬的起始结束日期 + * + * @param record + * @param + */ + public static void buildCurrentTendaysStartEnd(T record) { + try { + Class clazz = record.getClass(); + Field monthField = clazz.getDeclaredField("month"); + Field typeField = clazz.getDeclaredField("type"); + monthField.setAccessible(Boolean.TRUE); + typeField.setAccessible(Boolean.TRUE); + String month = Objects.nonNull(monthField.get(record)) ? (String)monthField.get(record) : null; + Integer type = Objects.nonNull(typeField.get(record)) ? (Integer)typeField.get(record) : null; + if (StringUtils.isBlank(month) || Objects.isNull(type)) { + return; + } + LocalDateTime date = + LocalDateTime.parse(month + "-01 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + LocalDateTime startTime = date.with(TemporalAdjusters.firstDayOfMonth()); + LocalDateTime endTime = date.plusMonths(1).minusSeconds(1); + // 获取当前月的第一天 + if (type.equals(1)) { + endTime = date.plusDays(10).minusSeconds(1); + } else if (type.equals(2)) { + startTime = startTime.plusDays(10); + endTime = date.plusDays(20).minusSeconds(1); + } else if (type.equals(3)) { + startTime = startTime.plusDays(20); + } + Field startTimeField = clazz.getDeclaredField("startTime"); + Field endTimeField = clazz.getDeclaredField("endTime"); + startTimeField.setAccessible(Boolean.TRUE); + endTimeField.setAccessible(Boolean.TRUE); + startTimeField.set(record, startTime); + endTimeField.set(record, endTime); + } catch (Exception e) { + log.error("buildCurrentTendaysStartEnd err :",e); + } + } + + /** + * 根据月份 和type 来build 上一旬的起始结束日期 + * + * @param record + * @param + */ + public static void buildLastTendaysStartEnd(T record) { + try { + Class clazz = record.getClass(); + Field monthField = clazz.getDeclaredField("month"); + Field typeField = clazz.getDeclaredField("type"); + monthField.setAccessible(Boolean.TRUE); + typeField.setAccessible(Boolean.TRUE); + String month = Objects.nonNull(monthField.get(record)) ? (String)monthField.get(record) : null; + Integer type = Objects.nonNull(typeField.get(record)) ? (Integer)typeField.get(record) : null; + if (StringUtils.isBlank(month) || Objects.isNull(type)) { + return; + } + LocalDateTime date = + LocalDateTime.parse(month + "-01 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + // 上一旬 用type来判断 如果不是1 就减一 + if (!type.equals(1)) { + type = type - 1; + } else if (type.equals(1)) { + // 否则就是上一个月的 下旬 + type = 3; + date = date.minusMonths(1); + } + + LocalDateTime startTime = date.with(TemporalAdjusters.firstDayOfMonth()); + LocalDateTime endTime = date.plusMonths(1).minusSeconds(1); + // 获取当前月的第一天 + if (type.equals(1)) { + endTime = date.plusDays(10).minusSeconds(1); + } else if (type.equals(2)) { + startTime = startTime.plusDays(10); + endTime = date.plusDays(20).minusSeconds(1); + } else if (type.equals(3)) { + startTime = startTime.plusDays(20); + } + Field lastStartTimeField = clazz.getDeclaredField("lastStartTime"); + Field lastEndTimeField = clazz.getDeclaredField("lastEndTime"); + lastStartTimeField.setAccessible(Boolean.TRUE); + lastEndTimeField.setAccessible(Boolean.TRUE); + lastStartTimeField.set(record, startTime); + lastEndTimeField.set(record, endTime); + } catch (Exception e) { + log.error("buildLastTendaysStartEnd err :",e); + } + } + + /** + * Returns the 转换regionCode 成 id + * + * @param record + */ + public static void convertRegionCodeToId(T record) { + try { + Class clazz = record.getClass(); + Field regionIdField = clazz.getDeclaredField("regionId"); + regionIdField.setAccessible(Boolean.TRUE); + String regionCode = + Objects.nonNull(regionIdField.get(record)) ? String.valueOf(regionIdField.get(record)) : null; + Long regionId = codeUtil.regionsCacheHelper.getIdByCode(regionCode); + if (Objects.nonNull(regionId) && !regionId.equals(0L)) { + // 能查得到 说明传入的code 直接转换为id + regionIdField.set(record, regionId); + } + } catch (Exception e) { + log.error("convertRegionCodeToId err :",e); + } + } + + public static Long convertRegionCodeToId(Long regionId) { + try { + String regionCode = String.valueOf(regionId); + if (Objects.isNull(codeUtil)) { + log.error("codeUtil is null"); + return null; + } + Long newRegionId = codeUtil.regionsCacheHelper.getIdByCode(regionCode); + if (Objects.nonNull(newRegionId) && !newRegionId.equals(0L)) { + // 能查得到 说明传入的code 直接转换为id + return newRegionId; + } + } catch (Exception e) { + log.error("convertRegionCodeToId err :",e); + } + return regionId; + } + + /** + * 求一个十进制数的 某个二进制位数上的值 + * + * @param number + * @param index + * @return + */ + public static Integer getBinaryStringIndexValue(Long number, int index) { + char[] chars = Long.toBinaryString(number).toCharArray(); + if (chars.length >= index + 1) { + return Integer.valueOf(String.valueOf(chars[index]), 2); + } + return 0; + } + + public static void complementaryRegion(List list, Long regionId) { + Map dataMap = CollUtils.listToMap(list, m -> m.getRegionId()); + if (Objects.isNull(codeUtil)){ + log.error("codeUtil is null"); + return; + } + List regions = codeUtil.regionsCacheHelper.listChildOnly(regionId); + for (RegionDTO region : regions) { + if (!dataMap.containsKey(region.getId())) { + MapDataVO mapDataVo = new MapDataVO(); + mapDataVo.setRegionId(region.getId()); + mapDataVo.setRegionName(region.getRegionName()); + mapDataVo.setRegionCode(region.getRegionCode()); + mapDataVo.setValue(0); + mapDataVo.setPercent("0%"); + list.add(mapDataVo); + } + } + } + + public static void complementaryRegions(List list, Long regionId) { + Map dataMap = CollUtils.listToMap(list, m -> m.getRegionId()); + if (Objects.isNull(codeUtil)){ + log.error("codeUtil is null"); + return; + } + List regions = codeUtil.regionsCacheHelper.listChildOnly(regionId); + for (RegionDTO region : regions) { + if (!dataMap.containsKey(region.getId())) { + OnlineVehicleRegionsPO onlineVehicleRegions = new OnlineVehicleRegionsPO(); + onlineVehicleRegions.setRegionId(region.getId()); + onlineVehicleRegions.setRegionName(region.getRegionName()); + onlineVehicleRegions.setRegionCode(region.getRegionCode()); + onlineVehicleRegions.setOnlineNum(0); + onlineVehicleRegions.setVehicleNum(0); + onlineVehicleRegions.setRate(BigDecimal.ZERO); + list.add(onlineVehicleRegions); + } + } + } + + // 生成验证码 + public static String codeFen(Integer length) { + String str = "0123456789"; + // 将字符串转换为一个新的字符数组。 + char[] VerificationCodeArray = str.toCharArray(); + Random random = new Random(); + int count = 0;// 计数器 + StringBuilder stringBuilder = new StringBuilder(); + while (true) { + // 随机生成一个随机数 + int index = random.nextInt(VerificationCodeArray.length); + char c = VerificationCodeArray[index]; + // 限制四位不重复数字 + if (stringBuilder.indexOf(c + "") == -1) { + stringBuilder.append(c); + // 计数器加1 + count++; + } + // 当count等于4时结束,随机生成四位数的验证码 + if (count == length) { + break; + } + } + return stringBuilder.toString(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/ExcelDownUtil.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/ExcelDownUtil.java new file mode 100644 index 0000000..84e1747 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/ExcelDownUtil.java @@ -0,0 +1,68 @@ +package com.ningdatech.carapi.common.util; + +import cn.hutool.poi.excel.ExcelUtil; +import com.alibaba.fastjson.JSON; +import com.ningdatech.basic.model.ApiResponse; +import com.ningdatech.basic.util.StrPool; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.HttpStatus; + +import javax.servlet.http.HttpServletResponse; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.UUID; +import java.util.function.BiConsumer; + +/** + *

+ * ExcelDownUtil + *

+ * + * @author WendyYang + * @since 00:48 2022/11/5 + */ +@Slf4j +public class ExcelDownUtil { + + private static String encodeName(String name) { + String fileName; + try { + fileName = URLEncoder.encode(name, "UTF-8"); + } catch (UnsupportedEncodingException e) { + log.error("文件名编码异常:", e); + fileName = UUID.randomUUID().toString().replace("-", ""); + } + return fileName; + } + + @SneakyThrows + private static void down(HttpServletResponse response, T param, BiConsumer consumer) { + response.setCharacterEncoding("utf-8"); + try { + consumer.accept(response, param); + } catch (Exception e) { + log.error("文件导出失败:", e); + response.reset(); + response.setContentType(StrPool.CONTENT_TYPE); + ApiResponse res = ApiResponse.of(HttpStatus.SC_BAD_REQUEST, "导出失败", null); + response.setStatus(HttpStatus.SC_BAD_REQUEST); + response.getWriter().println(JSON.toJSONString(res)); + } + } + + public static void downXls(HttpServletResponse response, T param, BiConsumer consumer) { + response.setContentType(ExcelUtil.XLS_CONTENT_TYPE); + down(response, param, consumer); + } + + public static void downXlsx(HttpServletResponse response, T param, BiConsumer consumer) { + response.setContentType(ExcelUtil.XLSX_CONTENT_TYPE); + down(response, param, consumer); + } + + public static void setFileName(String fileName, HttpServletResponse response) { + response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".xls"); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/ExcelExportStyle.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/ExcelExportStyle.java new file mode 100644 index 0000000..798e765 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/ExcelExportStyle.java @@ -0,0 +1,79 @@ +package com.ningdatech.carapi.common.util; + +import com.alibaba.excel.write.metadata.style.WriteCellStyle; +import com.alibaba.excel.write.metadata.style.WriteFont; +import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; +import org.apache.poi.ss.usermodel.*; + +/** + *

+ * ExcelExportStyle + *

+ * + * @author WendyYang + * @since 01:39 2022/11/5 + */ +public class ExcelExportStyle { + + public static HorizontalCellStyleStrategy formalStyle() { + // 表头样式策略 + WriteCellStyle headStyle = new WriteCellStyle(); + // 是否换行 + headStyle.setWrapped(false); + // 水平对齐方式 + headStyle.setHorizontalAlignment(HorizontalAlignment.LEFT); + // 垂直对齐方式 + headStyle.setVerticalAlignment(VerticalAlignment.CENTER); + // 前景色 + headStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); + // 背景色 + headStyle.setFillBackgroundColor(IndexedColors.AUTOMATIC.getIndex()); + + // 设置为1时,单元格将被前景色填充 + headStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); + // 控制单元格是否应自动调整大小以适应文本过长时的大小 + headStyle.setShrinkToFit(false); + // 单元格边框类型 + headStyle.setBorderBottom(BorderStyle.NONE); + headStyle.setBorderLeft(BorderStyle.NONE); + headStyle.setBorderRight(BorderStyle.NONE); + headStyle.setBorderTop(BorderStyle.NONE); + // 单元格边框颜色 + headStyle.setLeftBorderColor(IndexedColors.BLACK.index); + headStyle.setRightBorderColor(IndexedColors.BLACK.index); + headStyle.setTopBorderColor(IndexedColors.BLACK.index); + headStyle.setBottomBorderColor(IndexedColors.BLACK.index); + // 字体策略 + WriteFont writeFont = new WriteFont(); + // 是否加粗/黑体 + writeFont.setBold(false); + // 字体颜色 + writeFont.setColor(Font.COLOR_NORMAL); + // 字体名称 + writeFont.setFontName("宋体"); + // 字体大小 + writeFont.setFontHeightInPoints((short) 11); + // 是否使用斜体 + writeFont.setItalic(false); + // 是否在文本中使用横线删除 + writeFont.setStrikeout(false); + // 设置要使用的文本下划线的类型 + writeFont.setUnderline(Font.U_NONE); + // 设置要使用的字符集 + writeFont.setCharset((int) Font.DEFAULT_CHARSET); + headStyle.setWriteFont(writeFont); + + // 内容样式策略策略 + WriteCellStyle contentStyle = new WriteCellStyle(); + contentStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex()); + contentStyle.setHorizontalAlignment(HorizontalAlignment.GENERAL); + contentStyle.setBorderBottom(BorderStyle.NONE); + contentStyle.setBorderLeft(BorderStyle.NONE); + contentStyle.setBorderRight(BorderStyle.NONE); + contentStyle.setBorderTop(BorderStyle.NONE); + contentStyle.setFillPatternType(FillPatternType.NO_FILL); + contentStyle.setWrapped(false); + return new HorizontalCellStyleStrategy(headStyle, contentStyle); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/OssUtils.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/OssUtils.java new file mode 100644 index 0000000..5f95cad --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/OssUtils.java @@ -0,0 +1,120 @@ +package com.ningdatech.carapi.common.util; + +import java.util.List; + +import org.apache.commons.lang3.StringUtils; + +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClient; +import com.aliyun.oss.model.ListObjectsRequest; +import com.aliyun.oss.model.OSSObjectSummary; +import com.aliyun.oss.model.ObjectListing; + +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/09/01 15:12 + */ +@Slf4j +public class OssUtils { + private static String ENDPOINT = "oss-cn-hangzhou-zwynet-d01-a.internet.cloud-inner.zj.gov.cn"; + //private fileout String ENDPOINT = "oss-cn-hangzhou.aliyuncs.com"; + private static String ACCESSKEYID = "oZFNfkh9YexqzTED"; + //private fileout String ACCESSKEYID = "LTAI4GL7uypycnBjiRn55rMG"; + private static String ACCESSKEYSECRET = "xewpDvACMzLQAGvY14fcXjkijBKSNH"; + //private fileout String ACCESSKEYSECRET = "qwYC7bW9bkStsko7qkLVnToAzj0Y98"; + private static String NEW_BUCKET = "sanzhuangche2"; + //private fileout String NEW_BUCKET = "devplat"; + + private static OSSClient client = null; + + + /** 创建OSSClient实例 + * + * @return + */ + private static OSSClient getOssClient(){ + client = new OSSClient(ENDPOINT, ACCESSKEYID, ACCESSKEYSECRET); + return client; + } + + /** 关闭OSSClient + * + */ + private static void close(){ + OssUtils.getOssClient().shutdown(); + } + + + /** + * 获取根目录下所有文件大小 + * @param bucketName + * @return + */ + public static Long getOss(String bucketName){ + try { + if (StringUtils.isBlank(bucketName)) { + bucketName = NEW_BUCKET; + } + long sizeTotal = 0L; + ObjectListing objectListing = null; + do { + // 列举bucket所有文件或目录,每次1000个 + ListObjectsRequest request = new ListObjectsRequest(bucketName).withDelimiter("/").withMaxKeys(1000); + // 列举bucket的指定目录(yourPrefix)下文件,每次1000个 + // ListObjectsRequest request = new ListObjectsRequest(bucketName).withMaxKeys(1000).withPrefix("yourPrefix"); + + if (objectListing != null) { + request.setMarker(objectListing.getNextMarker()); + } + objectListing = OssUtils.getOssClient().listObjects(request); + //获取当前文件夹下所有子目录大小 + List folders = objectListing.getCommonPrefixes(); + for (String folder : folders) { + sizeTotal = calculateFolderLength(OssUtils.getOssClient(), bucketName, folder)+sizeTotal; + } + + //获取当前文件夹下所有文件大小 + List sums = objectListing.getObjectSummaries(); + if (sums.size()==0){ + continue; + } + for (OSSObjectSummary s : sums) { + sizeTotal = sizeTotal+s.getSize(); + } + + } while (objectListing.isTruncated()); + //转换为TB + //sizeTotal = sizeTotal/1024/1024/1024/1024; + //转换为GB + sizeTotal = sizeTotal/1024/1024/1024; + //log.info(" 文件夹下所有子目录大小 : [{}] TB",sizeTotal); + log.info(" 文件夹下所有子目录大小 : [{}] GB",sizeTotal); + return sizeTotal; + }catch (Exception e){ + e.printStackTrace(); + return 0L; + }finally { + OssUtils.close(); + } + + } + private static long calculateFolderLength(OSS ossClient, String bucketName, String folder) { + long size = 0L; + ObjectListing objectListing = null; + do { + // MaxKey默认值为100,最大值为1000。 + ListObjectsRequest request = new ListObjectsRequest(bucketName).withPrefix(folder).withMaxKeys(1000); + if (objectListing != null) { + request.setMarker(objectListing.getNextMarker()); + } + objectListing = ossClient.listObjects(request); + List sums = objectListing.getObjectSummaries(); + for (OSSObjectSummary s : sums) { + size += s.getSize(); + } + } while (objectListing.isTruncated()); + return size; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/QrCoder.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/QrCoder.java new file mode 100644 index 0000000..18c7e29 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/QrCoder.java @@ -0,0 +1,103 @@ +package com.ningdatech.carapi.common.util; + +import cn.hutool.extra.qrcode.QrCodeUtil; +import cn.hutool.extra.qrcode.QrConfig; +import lombok.extern.slf4j.Slf4j; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.*; + +/** + * @description: 二维码生成 + * @author: liushuai + * @date: 2022/8/11 15:04 + */ +@Slf4j +public class QrCoder { + /** + * 图片的宽度 + */ + private static final int IMAGE_WIDTH = 150; + /** + * 图片的高度(需按实际内容高度进行调整) + */ + private static final int IMAGE_HEIGHT = 150; + /** + * 二维码的宽度 + */ + private static final int QR_CODE_WIDTH = 145; + /** + * 二维码的高度 + */ + private static final int QR_CODE_HEIGHT = 145; + + + /** + * @param content 内容 + * @param footer 底部文字 + */ + public static BufferedImage createQrCode(String content, String footer) { + // 创建主模板图片 + BufferedImage image = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB); + Graphics2D main = image.createGraphics(); + // 设置图片的背景色 + main.setColor(Color.white); + main.fillRect(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT); + + // 动态高度 + int height = 0; + + //***************插入二维码图片*********************************************** + Graphics codePic = image.getGraphics(); + BufferedImage codeImg; + QrConfig config = new QrConfig(); + config.setWidth(QR_CODE_WIDTH); + config.setHeight(QR_CODE_HEIGHT); + config.setMargin(0); + codeImg = QrCodeUtil.generate(content, config); + // 绘制二维码 + codePic.drawImage(codeImg, (IMAGE_WIDTH - QR_CODE_WIDTH) / 2, height, QR_CODE_WIDTH, QR_CODE_HEIGHT, null); + codePic.dispose(); + + //**********************底部文字描述****************************************** + Graphics2D typeLeft = image.createGraphics(); + // 设置字体颜色 + typeLeft.setColor(Color.black); + // 设置字体 + Font footerFont = new Font("宋体", Font.PLAIN, 14); + typeLeft.setFont(footerFont); + typeLeft.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); + // x开始的位置:(图片宽度-字体大小*字的个数)/2 + int startX = (IMAGE_WIDTH - (footerFont.getSize() * footer.length())) / 2 + 25; + height += QR_CODE_HEIGHT + 2.5; + typeLeft.drawString(footer, startX, height); + + // 返回image方便后续处理是生成图片还是生成base64字符串 + return image; + } + + + /** + * 生成图片文件 + * + * @param image 图片 + * @param fileLocation 地址 + */ + public static void createImage(BufferedImage image, String fileLocation) { + if (image != null) { + try { + ImageIO.write(image, "jpg", new File(fileLocation)); + } catch (IOException e) { + log.error("二维码生成图片失败:", e); + } + } + } + + public static void main(String[] args) { + BufferedImage bufferedImage = createQrCode("https://www.baidu.com", "编码:N20220001"); + createImage(bufferedImage, "/Users/qinxianyun/Downloads/test.jpg"); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/SignUtil.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/SignUtil.java new file mode 100644 index 0000000..06d5c7b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/common/util/SignUtil.java @@ -0,0 +1,67 @@ +package com.ningdatech.carapi.common.util; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Map; +import java.util.TreeMap; + +/** + * 签名校验 + * + * @author CMM + * @since 2023/06/05 11:55 + */ +@RequiredArgsConstructor +@Slf4j +@Component +public class SignUtil { + /** + * 生成签名 + * + * @param params 请求参数 + * @param key 密钥 + * @return 签名 + */ + public static String generateSign(Map params, String key) { + // 将参数按照字典序排序 + Map sortedParams = new TreeMap<>(params); + // 拼接参数 + StringBuilder sb = new StringBuilder(); + for (Map.Entry entry : sortedParams.entrySet()) { + sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&"); + } + sb.append("key=").append(key); + // 使用MD5进行加密 + String sign = null; + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + byte[] bytes = md.digest(sb.toString().getBytes()); + sign = bytesToHexString(bytes); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + return sign; + } + + /** + * 将字节数组转换为十六进制字符串 + * + * @param bytes 字节数组 + * @return 十六进制字符串 + */ + private static String bytesToHexString(byte[] bytes) { + StringBuilder sb = new StringBuilder(); + for (byte b : bytes) { + String hex = Integer.toHexString(b & 0xFF); + if (hex.length() == 1) { + sb.append("0"); + } + sb.append(hex); + } + return sb.toString(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/CompanyArchivesController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/CompanyArchivesController.java new file mode 100644 index 0000000..62825d9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/CompanyArchivesController.java @@ -0,0 +1,155 @@ +package com.ningdatech.carapi.company.controller; + +import java.util.List; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import org.springframework.web.bind.annotation.*; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.company.entity.CompanyCertificate; +import com.ningdatech.carapi.company.entity.CompanyCommonCredit; +import com.ningdatech.carapi.company.entity.dto.*; +import com.ningdatech.carapi.company.entity.vo.CompanyEmployeesVO; +import com.ningdatech.carapi.company.service.ICompanyArchivesService; +import com.ningdatech.carapi.company.service.ICompanyCertificateService; +import com.ningdatech.carapi.company.service.ICompanyCommonCreditService; +import com.ningdatech.carapi.company.service.ICompanyVehicleNotGetOnService; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + * @description: 企业档案管理 + * @author: liushuai + * @date: 2022/10/25 17:58 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/company-archives") +public class CompanyArchivesController { + private final ICompanyArchivesService iCompanyArchivesService; + private final ICompanyCertificateService iCompanyCertificateService; + private final ICompanyCommonCreditService iCompanyCommonCreditService; + + private final ICompanyVehicleNotGetOnService companyVehicleNotGetOnService; + + @GetMapping + public PageVo getCompanyList(@Valid CompanyListParamDTO param) { + return iCompanyArchivesService.getCompanyList(param); + } + + @GetMapping("/detail") + public ResCompanyArchivesDetailsDTO getCompanyDetail(@RequestParam(value = "companyId", required = false) Long companyId) { + return iCompanyArchivesService.getCompanyDetail(companyId); + } + + @GetMapping("/employees") + public List getCompanyEmployees(@RequestParam(value = "companyId", required = false) Long companyId) { + return iCompanyArchivesService.getCompanyEmployees(companyId); + } + + @PutMapping + public void updateCompanyInfo(@RequestBody ReqCompanyArchivesDetailsDTO reqCompanyArchivesDetailsDTO) { + iCompanyArchivesService.updateCompanyInfo(reqCompanyArchivesDetailsDTO); + } + + @GetMapping("/employees/count") + public PageVo getCompanyEmployeesList(CompanyListParamDTO param) { + return iCompanyArchivesService.getCompanyEmployeesList(param); + } + + @PostMapping("/certificate") + public void saveCertificate(@RequestBody CompanyCertificate companyCertificate) { + iCompanyCertificateService.save(companyCertificate); + } + + @GetMapping("/certificate") + public Page getCompanyCertificateList(@RequestParam(value = "companyId", required = false) Long companyId, + @RequestParam(value = "pageNumber") int pageNum, + @RequestParam(value = "pageSize") int pageSize) { + return iCompanyCertificateService.getCertificates(new Page<>(pageNum, pageSize),companyId); + } + + @GetMapping("/basic/credit") + public PageVo getCompanyBasicCreditList(CompanyListParamDTO param) { + return iCompanyArchivesService.getCompanyBasicCreditList(param); + } + + @GetMapping("/basic/credit/detail") + public ResCompanyBasicCreditDetailDTO getCompanyBasicCreditDetail(@RequestParam(value = "companyId") Long companyId) { + return iCompanyArchivesService.getCompanyBasicCreditDetail(companyId); + } + + @GetMapping("/common/credit") + public PageVo getCompanyCommonCreditList(CompanyListParamDTO param) { + return iCompanyArchivesService.getCompanyCommonCreditList(param); + } + + @GetMapping("/common/credit/detail") + public Page getCompanyCommonCreditDetailList(@RequestParam(value = "companyId", required = false) Long companyId, + @RequestParam(value = "pageNumber") int pageNum, + @RequestParam(value = "pageSize") int pageSize) { + return iCompanyCommonCreditService.getCompanyBasicCreditDetail(new Page<>(pageNum, pageSize),companyId); + } + + @ApiOperation("企业列表导出") + @GetMapping("/companyListExport") + public void companyListExport(CompanyListParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, iCompanyArchivesService::companyListExport); + } + + @ApiOperation("企业证书信息列表导出") + @GetMapping("/companyCertificateInformationListExport") + public void companyCertificateInformationListExport(CompanyListParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, iCompanyArchivesService::companyCertificateInformationListExport); + } + + @ApiOperation("企业基本信用列表导出") + @GetMapping("/companyBasicCreditListExport") + public void companyBasicCreditListExport(CompanyListParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, iCompanyArchivesService::companyBasicCreditListExport); + } + + @ApiOperation("企业公共信用列表导出") + @GetMapping("/companyCommonCreditListExport") + public void companyCommonCreditListExport(CompanyListParamDTO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, iCompanyArchivesService::companyCommonCreditListExport); + } + + /** + * 查询车辆未上车行驶记录 + * + * @param param / + * @return / + */ + @ApiOperation(value = "查询车辆未上车行驶记录-驾驶员ID", notes = "查询车辆未上车行驶记录") + @PostMapping("/vehicle/getNotGetOnList") + public PageVo getNotOnCarDriver(@Valid @RequestBody ReqNotGetOnCarDTO param) { + return iCompanyArchivesService.getNotOnCarList(param); + } + + @ApiOperation(value = "企业待审核列表查询", notes = "企业待审核列表查询") + @GetMapping("/toBeAuditList") + public PageVo queryToBeAudit(@Valid @ModelAttribute CompanyAuditPageQuery param) { + return iCompanyArchivesService.queryToBeAudit(param); + } + + @ApiOperation(value = "企业已审核列表查询", notes = "企业已审核列表查询") + @GetMapping("/auditedList") + public PageVo queryAuditedList(@Valid @ModelAttribute CompanyAuditPageQuery param) { + return iCompanyArchivesService.queryAuditedList(param); + } + + @ApiOperation(value = "企业审核", notes = "企业审核") + @PostMapping("/audit") + @WebLog + public Boolean handlerAudit(@Valid @RequestBody CompanyAuditDTO data) { + return iCompanyArchivesService.audit(data, LoginUserUtil.getUserId()); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/CompanyLargeScreenController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/CompanyLargeScreenController.java new file mode 100644 index 0000000..961b026 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/CompanyLargeScreenController.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.company.controller; + +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.company.entity.dto.ResCompanyTotalDTO; +import com.ningdatech.carapi.company.service.ICompanyLargeScreenService; +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @description: 企业管理大屏 + * @author: liushuai + * @date: 2022/10/25 10:12 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/company-large-screen") +public class CompanyLargeScreenController { + private final ICompanyLargeScreenService iCompanyLargeScreenService; + + @GetMapping("/statistics") + @ApiOperation(value = "按区域统计数量",notes = "按区域统计数量") + public List getCompanyCount(@RequestParam(value = "regionId") Long regionId) { + regionId = CodeUtil.convertRegionCodeToId(regionId); + return iCompanyLargeScreenService.getCompanyTotalByRegionId(regionId); + } + + @GetMapping("/enterprise-type") + @ApiOperation(value = "按企业类型统计数量",notes = "按企业类型统计数量") + public List enterpriseType(@RequestParam(value = "regionId") Long regionId) { + regionId = CodeUtil.convertRegionCodeToId(regionId); + return iCompanyLargeScreenService.countEnterpriseType(regionId); + } + + @GetMapping("/dead-accident") + @ApiOperation(value = "半年内发生死亡事故",notes = "半年内发生死亡事故") + public List deadAccident(@RequestParam(value = "regionId") Long regionId) { + regionId = CodeUtil.convertRegionCodeToId(regionId); + return iCompanyLargeScreenService.deadAccident(regionId); + } + + @GetMapping("/mortar-quality") + @ApiOperation(value = "砂浆质量通道",notes = "砂浆质量通道") + public List mortarQuality(@RequestParam(value = "regionId") Long regionId) { + regionId = CodeUtil.convertRegionCodeToId(regionId); + return iCompanyLargeScreenService.mortarQuality(regionId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyBlackListController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyBlackListController.java new file mode 100644 index 0000000..8bd93b0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyBlackListController.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.company.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditBlackListPageParam; +import com.ningdatech.carapi.company.entity.dto.ResCompanyBlackDetailListDTO; +import com.ningdatech.carapi.company.entity.dto.ResCompanyBlackListDTO; +import com.ningdatech.carapi.company.service.INdCompanyBlackListService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + *

+ * 企业失信名单 前端控制器 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/company-black-list") +public class NdCompanyBlackListController { + private final INdCompanyBlackListService iNdCompanyBlackListService; + + @GetMapping + private Page companyBlackList(@ModelAttribute CompanyCreditBlackListPageParam param) { + return iNdCompanyBlackListService.companyBlackList(param); + } + + @GetMapping("/info") + private List companyBlackInfoList(@RequestParam(value = "companyId", required = false) Long companyId) { + return iNdCompanyBlackListService.companyBlackInfoList(companyId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyCreditDeductController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyCreditDeductController.java new file mode 100644 index 0000000..f7ebe9b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyCreditDeductController.java @@ -0,0 +1,54 @@ +package com.ningdatech.carapi.company.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyCreditDeduct; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditDeductPageParam; +import com.ningdatech.carapi.company.service.INdCompanyCreditDeductService; +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 lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +/** + *

+ * 平安办扣分 前端控制器 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/company-credit-deduct") +public class NdCompanyCreditDeductController { + private final INdCompanyCreditDeductService iNdCompanyCreditDeductService; + private final RegionsCacheHelper regionsCacheHelper; + private final CompaniesCacheHelper companiesCacheHelper; + + @PostMapping + private Boolean saveCreditDeduct(@RequestBody NdCompanyCreditDeduct ndCompanyCreditDeduct) { + CompanyDTO company = companiesCacheHelper.getById(ndCompanyCreditDeduct.getCompanyId()); + if (0 != company.getRegionId() && null != company.getRegionId()){ + RegionDTO region = regionsCacheHelper.getByRegionId(company.getRegionId()); + ndCompanyCreditDeduct.setRegionName(region.getRegionName()); + } + return iNdCompanyCreditDeductService.save(ndCompanyCreditDeduct); + } + + @GetMapping + private Page getCreditDeductList(@ModelAttribute CompanyCreditDeductPageParam param) { + return iNdCompanyCreditDeductService.getCreditDeductList(param); + } + + @PutMapping + private Boolean updateCreditDeduct(@RequestBody NdCompanyCreditDeduct ndCompanyCreditDeduct) { + return iNdCompanyCreditDeductService.updateById(ndCompanyCreditDeduct); + } + + @DeleteMapping + private Boolean deleteCreditDeduct(@RequestBody NdCompanyCreditDeduct ndCompanyCreditDeduct) { + return iNdCompanyCreditDeductService.delete(ndCompanyCreditDeduct.getId()); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyCreditInsideController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyCreditInsideController.java new file mode 100644 index 0000000..3526fe6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyCreditInsideController.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.company.controller; + +import javax.validation.Valid; + +import org.springframework.web.bind.annotation.*; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyCreditInside; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditInsidePageParam; +import com.ningdatech.carapi.company.service.INdCompanyCreditInsideService; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; + +import lombok.RequiredArgsConstructor; + +/** + *

+ * 内部/联合检查 前端控制器 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/company-credit-inside") +@Valid +public class NdCompanyCreditInsideController { + private final INdCompanyCreditInsideService iNdCompanyCreditInsideService; + private final RegionsCacheHelper regionsCacheHelper; + + private final CompaniesCacheHelper companiesCacheHelper; + + @PostMapping + private Boolean saveCreditInside(@RequestBody NdCompanyCreditInside ndCompanyCreditInside) { + CompanyDTO company = companiesCacheHelper.getById(ndCompanyCreditInside.getCompanyId()); + if (0 != company.getRegionId() && null != company.getRegionId()){ + ndCompanyCreditInside.setRegionName(regionsCacheHelper.getDisplayName(company.getRegionId())); + } + return iNdCompanyCreditInsideService.save(ndCompanyCreditInside); + } + + @GetMapping + private Page getCreditInsideList(@Valid @ModelAttribute CompanyCreditInsidePageParam param) { + return iNdCompanyCreditInsideService.getList(param); + } + + @PutMapping + private Boolean updateCreditInside(@RequestBody NdCompanyCreditInside ndCompanyCreditInside) { + return iNdCompanyCreditInsideService.updateById(ndCompanyCreditInside); + } + + @DeleteMapping + private Boolean deleteCreditInside(@RequestBody NdCompanyCreditInside ndCompanyCreditInside) { + return iNdCompanyCreditInsideService.delete(ndCompanyCreditInside.getId()); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyCreditLevelController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyCreditLevelController.java new file mode 100644 index 0000000..c990c10 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyCreditLevelController.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.company.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyCreditLevel; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditLevelPageParam; +import com.ningdatech.carapi.company.service.INdCompanyCreditLevelService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +/** + *

+ * 信用等级 前端控制器 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/company-credit-level") +public class NdCompanyCreditLevelController { + private final INdCompanyCreditLevelService iNdCompanyCreditLevelService; + + @GetMapping + private Page getCreditLevelList(@ModelAttribute CompanyCreditLevelPageParam param) { + return iNdCompanyCreditLevelService.getCreditLevelList(param); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyCreditRewardController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyCreditRewardController.java new file mode 100644 index 0000000..846af15 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyCreditRewardController.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.company.controller; + +import org.springframework.web.bind.annotation.*; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyCreditReward; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditRewardPageParam; +import com.ningdatech.carapi.company.service.INdCompanyCreditRewardService; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; + +import lombok.RequiredArgsConstructor; + + +/** + *

+ * 政府/行业嘉奖 前端控制器 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/company-credit-reward") +public class NdCompanyCreditRewardController { + private final INdCompanyCreditRewardService iNdCompanyCreditRewardService; + private final RegionsCacheHelper regionsCacheHelper; + private final CompaniesCacheHelper companiesCacheHelper; + + @PostMapping + private Boolean saveCreditReward(@RequestBody NdCompanyCreditReward ndCompanyCreditReward) { + CompanyDTO company = companiesCacheHelper.getById(ndCompanyCreditReward.getCompanyId()); + if (0 != company.getRegionId() && null != company.getRegionId()){ + ndCompanyCreditReward.setRegionName(regionsCacheHelper.getDisplayName(company.getRegionId())); + } + return iNdCompanyCreditRewardService.save(ndCompanyCreditReward); + } + + @GetMapping + private Page getCreditRewardList(@ModelAttribute CompanyCreditRewardPageParam param) { + return iNdCompanyCreditRewardService.getCreditRewardList(param); + } + + @PutMapping + private Boolean updateCreditReward(@RequestBody NdCompanyCreditReward ndCompanyCreditReward) { + return iNdCompanyCreditRewardService.updateById(ndCompanyCreditReward); + } + + @DeleteMapping + private Boolean deleteCreditReward(@RequestBody NdCompanyCreditReward ndCompanyCreditReward) { + return iNdCompanyCreditRewardService.delete(ndCompanyCreditReward.getId()); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyProductManageController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyProductManageController.java new file mode 100644 index 0000000..6e4612c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyProductManageController.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.company.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.dto.ResProductManageDTO; +import com.ningdatech.carapi.company.service.INdCompanyProductManageService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +/** + *

+ * 公司生产管理 前端控制器 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@RestController +@RequestMapping("/api/v1/company-product-manage") +@RequiredArgsConstructor +public class NdCompanyProductManageController { + private final INdCompanyProductManageService iNdCompanyProductManageService; + + @GetMapping + public Page manageList(@RequestParam(value = "companyName", required = false) String companyName, + @RequestParam(value = "regionId", required = false) Long regionId, + @RequestParam(value = "pageNumber") int pageNum, + @RequestParam(value = "pageSize") int pageSize) { + return iNdCompanyProductManageService.manageList(companyName, regionId, pageNum, pageSize); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyQualityManageController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyQualityManageController.java new file mode 100644 index 0000000..c358d76 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanyQualityManageController.java @@ -0,0 +1,59 @@ +package com.ningdatech.carapi.company.controller; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyQualityManage; +import com.ningdatech.carapi.company.entity.dto.ReqQualityManageDTO; +import com.ningdatech.carapi.company.entity.dto.ResQualityManageDTO; +import com.ningdatech.carapi.company.service.INdCompanyQualityManageService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +/** + *

+ * 质量通报 前端控制器 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@RestController +@RequestMapping("/api/v1/company-quality-manage") +@RequiredArgsConstructor +public class NdCompanyQualityManageController { + + private final INdCompanyQualityManageService iNdCompanyQualityManageService; + private final RegionsCacheHelper regionsCacheHelper; + + @PostMapping + public Boolean saveQualityManage(@RequestBody ReqQualityManageDTO reqQualityManageDTO) { + NdCompanyQualityManage entity = new NdCompanyQualityManage(); + BeanUtil.copyProperties(reqQualityManageDTO, entity); + entity.setDownloadCount(0); + entity.setCompanyId(LoginUserUtil.loginUserDetail().getCompanyId()); + entity.setRegionName(regionsCacheHelper.getDisplayName(reqQualityManageDTO.getRegionId())); + return iNdCompanyQualityManageService.save(entity); + } + + @GetMapping + public Page qualityManageList(@RequestParam(value = "regionId", required = false) Long regionId, + @RequestParam(value = "year", required = false) String year, + @RequestParam(value = "pageNumber") int pageNum, + @RequestParam(value = "pageSize") int pageSize) { + return iNdCompanyQualityManageService.qualityManageList(regionId, year, pageNum, pageSize); + } + + @DeleteMapping + public Boolean deleteQualityManage(@RequestBody ReqQualityManageDTO reqQualityManageDTO) { + return iNdCompanyQualityManageService.delete(reqQualityManageDTO.getId()); + } + + @ApiOperation("增加下载次数") + @GetMapping("/incrementDownCount/{id}") + public void incrementDownCount(@PathVariable Long id) { + iNdCompanyQualityManageService.incrementDownCount(id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanySecurityProductDutyController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanySecurityProductDutyController.java new file mode 100644 index 0000000..26c268b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanySecurityProductDutyController.java @@ -0,0 +1,109 @@ +package com.ningdatech.carapi.company.controller; + +import javax.validation.Valid; + +import org.springframework.web.bind.annotation.*; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.company.entity.NdCompanySecurityProductDuty; +import com.ningdatech.carapi.company.entity.dto.*; +import com.ningdatech.carapi.company.entity.vo.CompanySecurityCommitmentVO; +import com.ningdatech.carapi.company.entity.vo.CompanySecurityGovernmentVO; +import com.ningdatech.carapi.company.manage.CompanySecurityManage; +import com.ningdatech.carapi.company.service.ICompanySecurityCommitmentService; +import com.ningdatech.carapi.company.service.ICompanySecurityGovernmentService; +import com.ningdatech.carapi.company.service.INdCompanySecurityProductDutyService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 安全生产责任体系 前端控制器 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/company-security-product-duty") +public class NdCompanySecurityProductDutyController { + + private final INdCompanySecurityProductDutyService iNdCompanySecurityProductDutyService; + private final RegionsCacheHelper regionsCacheHelper; + + private final CompanySecurityManage securityManage; + + private final ICompanySecurityCommitmentService commitmentService; + + private final ICompanySecurityGovernmentService governmentService; + + @PostMapping + private Boolean saveSecurityProductDuty(@RequestBody ReqSecurityProductDutyDTO reqSecurityProductDutyDTO) { + NdCompanySecurityProductDuty entity = new NdCompanySecurityProductDuty(); + BeanUtil.copyProperties(reqSecurityProductDutyDTO, entity); + entity.setRegionName(regionsCacheHelper.getDisplayName(reqSecurityProductDutyDTO.getRegionId())); + return iNdCompanySecurityProductDutyService.save(entity); + } + + @GetMapping + private Page securityProductDutyList(@RequestParam(value = "regionId", required = false) Long regionId, + @RequestParam(value = "companyName", required = false) String companyName, + @RequestParam(value = "startTime", required = false) String startTime, + @RequestParam(value = "endTime", required = false) String endTime, + @RequestParam(value = "fileType") Integer fileType, + @RequestParam(value = "pageNumber") int pageNum, + @RequestParam(value = "pageSize") int pageSize) { + return iNdCompanySecurityProductDutyService.securityProductDutyList(regionId, companyName,startTime,endTime, fileType, pageNum, pageSize); + } + + @ApiOperation(value = "安全承诺书列表", notes = "安全承诺书列表") + @GetMapping("/list-commitments") + public PageVo listCommitments(@Valid @ModelAttribute CompanySecurityCommitmentParam param) { + return securityManage.pageCommitments(param); + } + + @ApiOperation(value = "管理机构列表", notes = "管理机构列表") + @GetMapping("/list-governments") + public PageVo listGovernments(@Valid @ModelAttribute CompanySecurityCommitmentParam param) { + return securityManage.pageGovernments(param); + } + + @PostMapping("/upload-commitment") + private Boolean uploadCommitment(@Valid @RequestBody UploadCommitmentDTO dto) { + return securityManage.uploadCommitment(dto); + } + + @PostMapping("/upload-government") + private Boolean uploadGovernment(@Valid @RequestBody UploadGovernmentDTO dto) { + return securityManage.uploadGovernment(dto); + } + + @ApiOperation("删除管理机构文件") + @DeleteMapping("/delete-government") + public void deleteGovernmentFile(@RequestParam Long id) { + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + securityManage.deleteGovernmentFile(id,roleId); + } + + @ApiOperation("删除行业企业安全生产责任书") + @DeleteMapping("/delete-commitment") + public void deleteCommitmentFile(@RequestParam Long id) { + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + securityManage.deleteCommitmentFile(id,roleId); + } + + @ApiOperation("增加下载次数") + @GetMapping("/incrementDownCount/{id}") + public void incrementDownCount(@PathVariable Long id) { + securityManage.incrementDownCount(id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanySecurityProductExecuteController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanySecurityProductExecuteController.java new file mode 100644 index 0000000..e4c2685 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanySecurityProductExecuteController.java @@ -0,0 +1,79 @@ +package com.ningdatech.carapi.company.controller; + +import javax.validation.Valid; + +import org.springframework.web.bind.annotation.*; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.company.entity.NdCompanySecurityProductExecute; +import com.ningdatech.carapi.company.entity.dto.CompanySecurityProductExecuteParam; +import com.ningdatech.carapi.company.entity.dto.ReqSecurityProductExecuteDTO; +import com.ningdatech.carapi.company.entity.dto.ResSecurityProductExecuteDTO; +import com.ningdatech.carapi.company.entity.dto.UploadExecutionDTO; +import com.ningdatech.carapi.company.entity.vo.ComSecProExeVO; +import com.ningdatech.carapi.company.manage.CompanySecurityManage; +import com.ningdatech.carapi.company.service.INdCompanySecurityProductExecuteService; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + + +/** + *

+ * 安全生产制度执行 前端控制器 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/company-security-product-execute") +public class NdCompanySecurityProductExecuteController { + + private final INdCompanySecurityProductExecuteService iNdCompanySecurityProductExecuteService; + + private final CompanySecurityManage securityManage; + @PostMapping + private Boolean saveSecurityProductExecute(@RequestBody ReqSecurityProductExecuteDTO reqSecurityProductExecuteDTO) { + NdCompanySecurityProductExecute entity = new NdCompanySecurityProductExecute(); + BeanUtil.copyProperties(reqSecurityProductExecuteDTO, entity); + entity.setRegionId(LoginUserUtil.loginUserDetail().getRegionId()); + entity.setCompanyId(LoginUserUtil.loginUserDetail().getCompanyId()); + return iNdCompanySecurityProductExecuteService.save(entity); + } + + @GetMapping + private Page securityProductExecuteList(@RequestParam(value = "name", required = false) String name, + @RequestParam(value = "startTime", required = false) String startTime, + @RequestParam(value = "endTime", required = false) String endTime, + @RequestParam(value = "fileType") Integer fileType, + @RequestParam(value = "pageNumber") int pageNum, + @RequestParam(value = "pageSize") int pageSize) { + return iNdCompanySecurityProductExecuteService.securityProductExecuteList(name, startTime, endTime,fileType, pageNum, pageSize); + } + + + @ApiOperation(value = "安全生产制度执行情况列表", notes = "安全生产制度执行情况列表") + @GetMapping("/safety-product-execute-list") + public PageVo listExecutes(@Valid @ModelAttribute CompanySecurityProductExecuteParam param) { + return securityManage.pageExecutes(param); + } + + @PostMapping("/upload-execution") + private Boolean uploadExecution(@Valid @RequestBody UploadExecutionDTO dto) { + return securityManage.uploadExecution(dto); + } + + @ApiOperation("删除安全生产制度执行情况文件") + @DeleteMapping("/delete-execute") + public void deleteCommitmentFile(@RequestParam Long id) { + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + securityManage.deleteExecuteFile(id,roleId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanySecurityProductRegulationsController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanySecurityProductRegulationsController.java new file mode 100644 index 0000000..88adc5d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/controller/NdCompanySecurityProductRegulationsController.java @@ -0,0 +1,80 @@ +package com.ningdatech.carapi.company.controller; + + +import javax.validation.Valid; + +import org.springframework.web.bind.annotation.*; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.company.entity.NdCompanySecurityProductRegulations; +import com.ningdatech.carapi.company.entity.dto.CompanySecurityProductRegulationParam; +import com.ningdatech.carapi.company.entity.dto.ReqSecurityProductRegulationsDTO; +import com.ningdatech.carapi.company.entity.dto.ResSecurityProductRegulationsDTO; +import com.ningdatech.carapi.company.entity.dto.UploadRegulationDTO; +import com.ningdatech.carapi.company.entity.vo.ComSecProRegVO; +import com.ningdatech.carapi.company.manage.CompanySecurityManage; +import com.ningdatech.carapi.company.service.INdCompanySecurityProductRegulationsService; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + + +/** + *

+ * 安全生产制度体系 前端控制器 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/company-security-product-regulations") +public class NdCompanySecurityProductRegulationsController { + private final INdCompanySecurityProductRegulationsService iNdCompanySecurityProductRegulationsService; + + private final CompanySecurityManage securityManage; + + @PostMapping + private Boolean saveSecurityProductRegulations(@RequestBody ReqSecurityProductRegulationsDTO reqSecurityProductRegulationsDTO) { + NdCompanySecurityProductRegulations entity = new NdCompanySecurityProductRegulations(); + BeanUtil.copyProperties(reqSecurityProductRegulationsDTO, entity); + entity.setCompanyId(LoginUserUtil.loginUserDetail().getCompanyId()); + return iNdCompanySecurityProductRegulationsService.save(entity); + } + + @GetMapping + private Page securityProductRegulationsList(@RequestParam(value = "regulationsName", required = false) String regulationsName, + @RequestParam(value = "competentDepartment", required = false) String competentDepartment, + @RequestParam(value = "startTime", required = false) String startTime, + @RequestParam(value = "endTime", required = false) String endTime, + @RequestParam(value = "fileType") Integer fileType, + @RequestParam(value = "pageNumber") int pageNum, + @RequestParam(value = "pageSize") int pageSize) { + return iNdCompanySecurityProductRegulationsService.securityProductRegulationsList(regulationsName, competentDepartment, startTime, endTime, fileType, pageNum, pageSize); + } + + @ApiOperation(value = "安全生产制度体系列表", notes = "安全生产制度体系列表") + @GetMapping("/safety-education-training-list") + public PageVo listRegulations(@Valid @ModelAttribute CompanySecurityProductRegulationParam param) { + return securityManage.pageRegulations(param); + } + + @PostMapping("/upload-regulation") + private Boolean uploadRegulation(@Valid @RequestBody UploadRegulationDTO dto) { + return securityManage.uploadRegulation(dto); + } + + @ApiOperation("删除安全生产责任体系文件") + @DeleteMapping("/delete-regulation") + public void deleteCommitmentFile(@RequestParam Long id) { + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + securityManage.deleteRegulationFile(id,roleId); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyBasicCredit.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyBasicCredit.java new file mode 100644 index 0000000..ef91416 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyBasicCredit.java @@ -0,0 +1,71 @@ +package com.ningdatech.carapi.company.entity; + +import java.io.Serializable; +import java.sql.Timestamp; + +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; + +/** + *

+ * 企业基础信用信息 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +@TableName("nd_company_basic_credit") +@ApiModel(value = "CompanyBasicCredit对象", description = "企业基础信用信息") +@Data +public class CompanyBasicCredit implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("企业id") + private Long companyId; + + @ApiModelProperty("基本管理信用分值") + private Integer basicCreditScore; + + @ApiModelProperty("注册资金") + private String registeredCapital; + + @ApiModelProperty("营业期限") + private String businessTerm; + + @ApiModelProperty("成立日期") + private Timestamp createTime; + + @ApiModelProperty("评价机构") + private String evaluationOrganization; + + @ApiModelProperty("企业网址") + private String website; + + @ApiModelProperty("经营范围") + private String natureBusiness; + + @ApiModelProperty("营业执照地址") + private String businessLicensePath; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("修改人") + private String updateBy; + + @ApiModelProperty("创建日期") + private Timestamp createOn; + + @ApiModelProperty("更新时间") + private Timestamp updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyCertificate.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyCertificate.java new file mode 100644 index 0000000..ffd9f5b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyCertificate.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.company.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.sql.Timestamp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 企业证书 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +@TableName("nd_company_certificate") +@ApiModel(value = "CompanyCertificate对象", description = "企业证书") +@Data +public class CompanyCertificate implements Serializable { + + private static final long serialVersionUID = -2010985253469107704L; + + @ApiModelProperty("ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("企业id") + private Long companyId; + + @ApiModelProperty("证书名称") + private String certificateName; + + @ApiModelProperty("证书内容") + private String certificateContent; + + @ApiModelProperty("有效日期") + private Timestamp deadlineTime; + + @ApiModelProperty("证书路径") + private String certificatePath; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("修改人") + private String updateBy; + + @ApiModelProperty("创建日期") + private Timestamp createOn; + + @ApiModelProperty("更新时间") + private Timestamp updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyCommonCredit.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyCommonCredit.java new file mode 100644 index 0000000..10758c7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyCommonCredit.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.company.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.sql.Timestamp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 企业公共信用信息 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +@TableName("nd_company_common_credit") +@ApiModel(value = "CompanyCommonCredit对象", description = "企业公共信用信息") +@Data +public class CompanyCommonCredit implements Serializable { + + private static final long serialVersionUID = 1260840521011159951L; + + @ApiModelProperty("ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("企业id") + private Long companyId; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("失信情况(0-失信,1-否)") + private String blackList; + + @ApiModelProperty("失信内容") + private String blackListContent; + + @ApiModelProperty("纠纷内容") + private String disputeContent; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("修改人") + private String updateBy; + + @ApiModelProperty("创建日期") + private Timestamp createOn; + + @ApiModelProperty("更新时间") + private Timestamp updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyEmployees.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyEmployees.java new file mode 100644 index 0000000..b498f6b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyEmployees.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.company.entity; + +import java.io.Serializable; +import java.sql.Timestamp; + +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; + +/** + *

+ * + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +@TableName("nd_company_employees") +@ApiModel(value = "CompanyEmployees对象", description = "企业员工信息") +@Data +public class CompanyEmployees implements Serializable { + + private static final long serialVersionUID = 4740513010149140128L; + + @ApiModelProperty("ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("创建时间") + private Timestamp createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + private Timestamp updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("员工名称") + private String name; + + @ApiModelProperty("企业id") + private Long companyId; + + @ApiModelProperty("电话") + private String mobile; + + @ApiModelProperty("邮箱") + private String email; + + @ApiModelProperty("住址") + private String address; + + @ApiModelProperty("出生日期") + private Timestamp birthday; + + @ApiModelProperty("性别(0-女,1-男)") + private Integer sex; + + @ApiModelProperty("身份证号") + private String cardNum; + + @ApiModelProperty("学历(0-小学,1-初中,2-高中,3-专科,4-本科,5-研究生,6-博士)") + private Integer education; + + @ApiModelProperty("职务(1-领导,2车队长)") + private String employeesStatus; + + @ApiModelProperty("区域id") + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanySecurityCommitment.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanySecurityCommitment.java new file mode 100644 index 0000000..8faa6dc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanySecurityCommitment.java @@ -0,0 +1,54 @@ +package com.ningdatech.carapi.company.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.sql.Timestamp; +import java.time.LocalDateTime; + +/** + * @Classname CompanySecurityCommitment + * @Description + * @Date 2023/5/23 16:23 + * @Author PoffyZhang + */ +@Data +@TableName("nd_company_security_commitment") +@ApiModel(value = "CompanySecurityCommitment", description = "企业 承诺书") +public class CompanySecurityCommitment { + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("企业id") + private Long companyId; + + @ApiModelProperty("承诺对象") + private String commitmentTarget; + + @ApiModelProperty("承诺人") + private String promisee; + + @ApiModelProperty("文件") + private String file; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanySecurityGovernment.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanySecurityGovernment.java new file mode 100644 index 0000000..33e38e9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanySecurityGovernment.java @@ -0,0 +1,54 @@ +package com.ningdatech.carapi.company.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.sql.Timestamp; +import java.time.LocalDateTime; + +/** + * @Classname CompanySecurityCommitment + * @Description + * @Date 2023/5/23 16:23 + * @Author PoffyZhang + */ +@Data +@TableName("nd_company_security_government") +@ApiModel(value = "CompanySecurityGovernment", description = "企业管理机构") +public class CompanySecurityGovernment { + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("企业id") + private Long companyId; + + @ApiModelProperty("文件性质") + private String docNature; + + @ApiModelProperty("部门名称") + private String departmentName; + + @ApiModelProperty("文件") + private String file; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanySecurityProductExecute.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanySecurityProductExecute.java new file mode 100644 index 0000000..bf3faee --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanySecurityProductExecute.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.company.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * 安全生产制度执行 + *

+ * + * @author CMM + * @since 2023-05-24 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName("nd_company_security_product_execute_file") +@ApiModel(value = "CompanySecurityProductExecuteFile对象", description = "安全生产制度执行") +public class CompanySecurityProductExecute implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("通报名称") + private String fileName; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("文件ID") + private Long fileId; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("修改人") + private Long updateBy; + + @ApiModelProperty("创建日期") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanySecurityProductRegulation.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanySecurityProductRegulation.java new file mode 100644 index 0000000..7359912 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanySecurityProductRegulation.java @@ -0,0 +1,66 @@ +package com.ningdatech.carapi.company.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * 安全生产制度体系 + *

+ * + * @author CMM + * @since 2023-05-24 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName("nd_company_security_product_regulations_file") +@ApiModel(value = "CompanySecurityProductRegulationsFile对象", description = "安全生产制度体系") +public class CompanySecurityProductRegulation implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("主管企业ID") + private Long companyId; + + @ApiModelProperty("主管企业名称") + private String companyName; + + @ApiModelProperty("制度名称") + private String fileName; + + @ApiModelProperty("文件类型") + private Integer fileType; + + @ApiModelProperty("制度文件ID") + private Long fileId; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("修改人") + private Long updateBy; + + @ApiModelProperty("创建日期") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyVehicleNotGetOn.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyVehicleNotGetOn.java new file mode 100644 index 0000000..0a8bedd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/CompanyVehicleNotGetOn.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.company.entity; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +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.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * 上车表 + *

+ * + * @author CMM + * @since 2023-01-10 + */ +@TableName("nd_company_vehicle_not_get_on") +@ApiModel(value = "CompanyVehicleNotGetOn对象", description = "未上车行驶表") +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CompanyVehicleNotGetOn 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; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("修改人") + private Long updateBy; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("公司id") + private Long companyId; + + @ApiModelProperty("发生时间") + private LocalDate time; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyBlackList.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyBlackList.java new file mode 100644 index 0000000..23184fe --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyBlackList.java @@ -0,0 +1,91 @@ +package com.ningdatech.carapi.company.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import lombok.Data; + +/** + *

+ * 企业失信名单 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@TableName("nd_company_black_list") +@Data +public class NdCompanyBlackList implements Serializable { + + private static final long serialVersionUID = 5717102444084515804L; + + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 企业id + */ + private Long companyId; + + /** + * 企业名称 + */ + private String companyName; + + /** + * 区域id + */ + private Long regionId; + + /** + * 描述 + */ + private String regionName; + + /** + * 失信类型 + */ + private String type; + + /** + * 失信日期 + */ + private LocalDateTime blackTime; + + /** + * 地点 + */ + private String site; + + /** + * 描述 + */ + private String content; + + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建日期 + */ + private LocalDateTime createOn; + + /** + * 更新时间 + */ + private LocalDateTime updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyCreditDeduct.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyCreditDeduct.java new file mode 100644 index 0000000..3c94f2d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyCreditDeduct.java @@ -0,0 +1,90 @@ +package com.ningdatech.carapi.company.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + *

+ * 平安办扣分 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@TableName("nd_company_credit_deduct") +@Data +public class NdCompanyCreditDeduct implements Serializable { + + private static final long serialVersionUID = 5515044435449828584L; + + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 企业id + */ + private Long companyId; + + /** + * 企业名称 + */ + private String companyName; + + /** + * 区域id + */ + private Long regionId; + + /** + * 区域名称 + */ + private String regionName; + + /** + * 检查指标类型 + */ + private String type; + + /** + * 备注 + */ + private String remark; + + /** + * 检查日期 + */ + private Timestamp checkTime; + + /** + * 分值 + */ + private Integer score; + + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建日期 + */ + private Timestamp createOn; + + /** + * 更新时间 + */ + private Timestamp updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyCreditInside.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyCreditInside.java new file mode 100644 index 0000000..b89c47a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyCreditInside.java @@ -0,0 +1,105 @@ +package com.ningdatech.carapi.company.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + *

+ * 内部/联合检查 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@TableName("nd_company_credit_inside") +@Data +public class NdCompanyCreditInside implements Serializable { + + private static final long serialVersionUID = -2499448161989294318L; + + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 企业id + */ + private Long companyId; + + /** + * 企业名称 + */ + private String companyName; + + /** + * 区域id + */ + private Long regionId; + + /** + * 区域名称 + */ + private String regionName; + + /** + * 驾驶员id + */ + private Long driverId; + + /** + * 驾驶员名称 + */ + private String driverName; + + /** + * 行政监管类别 + */ + private String type; + + /** + * 车牌号 + */ + private String carNo; + + /** + * 备注 + */ + private String remark; + + /** + * 检查日期 + */ + private Timestamp checkTime; + + /** + * 检查类型(1-联合,0-内部) + */ + private Boolean checkType; + + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建日期 + */ + private Timestamp createOn; + + /** + * 更新时间 + */ + private Timestamp updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyCreditLevel.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyCreditLevel.java new file mode 100644 index 0000000..7725537 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyCreditLevel.java @@ -0,0 +1,88 @@ +package com.ningdatech.carapi.company.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + *

+ * 信用等级 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@TableName("nd_company_credit_level") +@Data +public class NdCompanyCreditLevel implements Serializable { + + private static final long serialVersionUID = -9064829467713108944L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("年度") + private String year; + + @ApiModelProperty("信用等级") + private String level; + + @ApiModelProperty("企业信用评价总分") + private Integer score; + + @ApiModelProperty("公共信用评价分值 300分") + private Integer commonCreditScore; + + @ApiModelProperty("基本管理信用分值 120分") + private Integer basicCreditScore; + + @ApiModelProperty("安全生产管理信用分值 240分") + private Integer safeProductCreditScore; + + @ApiModelProperty("行业监管信用分值 240分") + private Integer industryRegulateCreditScore; + + @ApiModelProperty("行业荣誉加分 100分") + private Integer industryHonorBonus; + @ApiModelProperty("政府部门嘉奖分值 50分") + private Integer governmentAwardScore; + @ApiModelProperty("行业标杆分值 50分") + private Integer industryBenchMarkScore; + + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建日期 + */ + private Timestamp createOn; + + /** + * 更新时间 + */ + private Timestamp updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyCreditReward.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyCreditReward.java new file mode 100644 index 0000000..9419674 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyCreditReward.java @@ -0,0 +1,90 @@ +package com.ningdatech.carapi.company.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + *

+ * 政府/行业嘉奖 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@TableName("nd_company_credit_reward") +@Data +public class NdCompanyCreditReward implements Serializable { + + private static final long serialVersionUID = -1797772033801294340L; + + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 企业id + */ + private Long companyId; + + /** + * 企业名称 + */ + private String companyName; + + /** + * 区域id + */ + private Long regionId; + + /** + * 区域名称 + */ + private String regionName; + + /** + * 嘉奖内容 + */ + private String content; + + /** + * 备注 + */ + private String remark; + + /** + * 日期 + */ + private Timestamp rewardTime; + + /** + * 嘉奖类型(1-行业标杆,0-政府) + */ + private Boolean rewardType; + + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建日期 + */ + private Timestamp createOn; + + /** + * 更新时间 + */ + private Timestamp updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyProductManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyProductManage.java new file mode 100644 index 0000000..43691e6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyProductManage.java @@ -0,0 +1,95 @@ +package com.ningdatech.carapi.company.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + *

+ * 公司生产管理 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@TableName("nd_company_product_manage") +@Data +public class NdCompanyProductManage implements Serializable { + + private static final long serialVersionUID = -7938578496309798035L; + + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 企业id + */ + private Long companyId; + + /** + * 企业名称 + */ + private String companyName; + + /** + * 区域id + */ + private Long regionId; + + /** + * 区域名称 + */ + private String regionName; + + /** + * 生产线名称 + */ + private String productName; + + /** + * 发车日期 + */ + private Timestamp carStartTime; + + /** + * 设备状态 + */ + private String equipmentStatus; + + /** + * 当天累计生产方量 + */ + private Integer sumProductCount; + + /** + * 当天实际生产方量 + */ + private Integer realProductCount; + + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建日期 + */ + private Timestamp createOn; + + /** + * 更新时间 + */ + private Timestamp updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyQualityManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyQualityManage.java new file mode 100644 index 0000000..1634737 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanyQualityManage.java @@ -0,0 +1,82 @@ +package com.ningdatech.carapi.company.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + *

+ * 质量通报 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@TableName("nd_company_quality_manage") +@Data +public class NdCompanyQualityManage implements Serializable { + + private static final long serialVersionUID = 7983510778303663592L; + + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 区域id + */ + private Long regionId; + + private Long companyId; + + /** + * 区域名称 + */ + private String regionName; + + /** + * 通报年月 + */ + private Timestamp fileTime; + + /** + * 文件地址 + */ + private String filePath; + + /** + * 文件名称 + */ + private String fileName; + + /** + * 下载次数 + */ + private Integer downloadCount; + + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建日期 + */ + private Timestamp createOn; + + /** + * 更新时间 + */ + private Timestamp updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanySecurityProductDuty.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanySecurityProductDuty.java new file mode 100644 index 0000000..df7bafa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanySecurityProductDuty.java @@ -0,0 +1,80 @@ +package com.ningdatech.carapi.company.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + *

+ * 安全生产责任体系 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@TableName("nd_company_security_product_duty") +@Data +public class NdCompanySecurityProductDuty implements Serializable { + + private static final long serialVersionUID = 8490965101415954146L; + + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 区域id + */ + private Long regionId; + + /** + * 区域名称 + */ + private String regionName; + + /** + * 企业id + */ + private Long companyId; + + /** + * 企业名称 + */ + private String companyName; + + /** + * 文件地址 + */ + private String filePath; + + /** + * 文件类型 + */ + private Integer fileType; + + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建日期 + */ + private Timestamp createOn; + + /** + * 更新时间 + */ + private Timestamp updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanySecurityProductExecute.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanySecurityProductExecute.java new file mode 100644 index 0000000..f71f9c9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanySecurityProductExecute.java @@ -0,0 +1,72 @@ +package com.ningdatech.carapi.company.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + *

+ * 安全生产制度执行 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@TableName("nd_company_security_product_execute") +@Data +public class NdCompanySecurityProductExecute implements Serializable { + + private static final long serialVersionUID = -1721410303272349639L; + + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 通报名称 + */ + private String name; + + /** + * 区域id + */ + private Long regionId; + + private Long companyId; + + /** + * 文件地址 + */ + private String filePath; + + /** + * 文件类型 + */ + private Integer fileType; + + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建日期 + */ + private Timestamp createOn; + + /** + * 更新时间 + */ + private Timestamp updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanySecurityProductRegulations.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanySecurityProductRegulations.java new file mode 100644 index 0000000..045b3a1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/NdCompanySecurityProductRegulations.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.company.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; + +/** + *

+ * 安全生产制度体系 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@TableName("nd_company_security_product_regulations") +@Data +public class NdCompanySecurityProductRegulations implements Serializable { + + private static final long serialVersionUID = 2870266919266149636L; + + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 区域id + */ + private Long regionId; + + private Long companyId; + + /** + * 制度名称 + */ + private String regulationsName; + + /** + * 主管部门 + */ + private String competentDepartment; + + /** + * 文件地址 + */ + private String filePath; + + /** + * 文件类型 + */ + private Integer fileType; + + /** + * 创建人 + */ + private String createBy; + + /** + * 修改人 + */ + private String updateBy; + + /** + * 创建日期 + */ + private Timestamp createOn; + + /** + * 更新时间 + */ + private Timestamp updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyAuditDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyAuditDTO.java new file mode 100644 index 0000000..7c2cb6e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyAuditDTO.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.company.entity.dto; + +import java.io.Serializable; + +import javax.validation.constraints.NotNull; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 企业信息审核 + * @return + * @author CMM + * @since 2023/06/06 13:36 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "CompanyAuditDTO", description = "企业信息审核") +public class CompanyAuditDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "企业ID",required = true) + @NotNull(message = "请传企业id!") + private Long id; + + @ApiModelProperty(value = "审核状态 2.审核通过 3.审核不通过",required = true) + @NotNull(message = "请传审核状态!") + private Integer auditStatus; + + @ApiModelProperty(value = "审核意见") + private String auditMind; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyAuditPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyAuditPageQuery.java new file mode 100644 index 0000000..0dc54a2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyAuditPageQuery.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.company.entity.dto; + +import java.io.Serializable; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * @author CMM + * @description + * @since 2022/11/17 14:34 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "CompanyAuditPageQuery", description = "企业审核") +public class CompanyAuditPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("区域Id") + private Long regionId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty(value = "公司类型 0管理企业 1生产企业 2物流企业 3其他") + private Integer companyType; + + @ApiModelProperty(value = "生产企业类型 2预拌砂浆生产企业 3预拌混凝土生产企业 4水泥生产企业") + private Integer productCompanyType; + + @ApiModelProperty("审核类型 1待审核 2已审核") + private Integer auditStatus; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditBlackListPageParam.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditBlackListPageParam.java new file mode 100644 index 0000000..2815254 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditBlackListPageParam.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.company.entity.dto; + +import com.ningdatech.basic.model.PagePo; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @Classname CompanyProductPO + * @Description + * @Date 2022/11/20 21:22 + * @Created by PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CompanyCreditBlackListPageParam extends PagePo implements Serializable { + private Long regionId; + + private String companyName; + + private List regionIds; + + private String dataScopeSql; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditDeductPageParam.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditDeductPageParam.java new file mode 100644 index 0000000..d7cf43b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditDeductPageParam.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.company.entity.dto; + +import com.ningdatech.basic.model.PagePo; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Classname CompanyProductPO + * @Description + * @Date 2022/11/20 21:22 + * @Created by PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CompanyCreditDeductPageParam extends PagePo implements Serializable { + private Long regionId; + + private String companyName; + + private String startTime; + + private String endTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditInsidePageParam.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditInsidePageParam.java new file mode 100644 index 0000000..edd8054 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditInsidePageParam.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.company.entity.dto; + +import com.ningdatech.basic.model.PagePo; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @Classname CompanyProductPO + * @Description + * @Date 2022/11/20 21:22 + * @Created by PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CompanyCreditInsidePageParam extends PagePo implements Serializable { + private Long regionId; + + private List regionIds; + + private String companyName; + + private String type; + + private String startTime; + + private String endTime; + + private Boolean checkType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditLevelPageParam.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditLevelPageParam.java new file mode 100644 index 0000000..eb106a9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditLevelPageParam.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.company.entity.dto; + +import com.ningdatech.basic.model.PagePo; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Classname CompanyProductPO + * @Description + * @Date 2022/11/20 21:22 + * @Created by PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CompanyCreditLevelPageParam extends PagePo implements Serializable { + private Long regionId; + + private String companyName; + + private String year; + + private String level; + + private Boolean rewardType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditRewardPageParam.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditRewardPageParam.java new file mode 100644 index 0000000..59db3a6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyCreditRewardPageParam.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.company.entity.dto; + +import com.ningdatech.basic.model.PagePo; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Classname CompanyProductPO + * @Description + * @Date 2022/11/20 21:22 + * @Created by PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CompanyCreditRewardPageParam extends PagePo implements Serializable { + private Long regionId; + + private String companyName; + + private String startTime; + + private String endTime; + + private Boolean rewardType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyListParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyListParamDTO.java new file mode 100644 index 0000000..dcda0a6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanyListParamDTO.java @@ -0,0 +1,41 @@ +package com.ningdatech.carapi.company.entity.dto; + +import java.io.Serializable; +import java.util.List; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @description + * @since 2022/11/17 14:34 + */ +@Data +public class CompanyListParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("区域Id") + private Long regionId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty(value = "是否失信") + private Boolean blackList; + + @ApiModelProperty(value = "公司类型 1生产 2物流 3其他") + private Integer companyType; + + @ApiModelProperty(value = "公司类型列表") + private List companyTypeList; + + @ApiModelProperty(value = "生产企业类型") + private Integer productCompanyType; + + @ApiModelProperty("审核类型 0待审核 1已审核") + private Integer auditStatus; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanySecurityCommitmentParam.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanySecurityCommitmentParam.java new file mode 100644 index 0000000..3c96961 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanySecurityCommitmentParam.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.company.entity.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @Classname CompanySecurityCommitmentParam + * @Description + * @Date 2023/5/23 16:23 + * @Author PoffyZhang + */ +@Data +public class CompanySecurityCommitmentParam extends PagePo { + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + private LocalDateTime endTime; + + @ApiModelProperty("文件性质") + private String docNature; + + @ApiModelProperty("部门名称") + private String departmentName; + + private String dataScopeSql; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanySecurityProductExecuteParam.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanySecurityProductExecuteParam.java new file mode 100644 index 0000000..590049b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanySecurityProductExecuteParam.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.company.entity.dto; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * CompanySecurityProductExecuteParam + * @return + * @author CMM + * @since 2023/05/24 21:58 + */ +@Data +public class CompanySecurityProductExecuteParam extends PagePo { + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("文件名称") + private String fileName; + + @ApiModelProperty("开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + private LocalDateTime endTime; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanySecurityProductRegulationParam.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanySecurityProductRegulationParam.java new file mode 100644 index 0000000..7de6787 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/CompanySecurityProductRegulationParam.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.company.entity.dto; + +import java.time.LocalDateTime; + +import javax.validation.constraints.NotNull; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Classname CompanySecurityProductSystemParam + * @Description + * @Date 2023/5/23 16:23 + * @Author PoffyZhang + */ +@Data +public class CompanySecurityProductRegulationParam extends PagePo { + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("文件名称") + private String fileName; + + @ApiModelProperty("主管单位名称") + private String companyName; + + /** + * @link SecurityProductRegulationFileType + */ + @ApiModelProperty("文件类型") + @NotNull(message = "文件类型不能为空!") + private Integer fileType; + + @ApiModelProperty("开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + private LocalDateTime endTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqCompanyArchivesDetailsDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqCompanyArchivesDetailsDTO.java new file mode 100644 index 0000000..011d3b8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqCompanyArchivesDetailsDTO.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.company.entity.dto; + +import com.ningdatech.carapi.company.entity.CompanyBasicCredit; +import com.ningdatech.carapi.company.entity.CompanyEmployees; +import com.ningdatech.carapi.sys.entity.Company; +import lombok.Data; + +import java.util.List; + +/** + * @description: + * @author: liushuai + * @date: 2022/10/26 09:27 + */ +@Data +public class ReqCompanyArchivesDetailsDTO { + private Company company; + private CompanyBasicCredit companyBasicCredit; + private List companyEmployeesList; + private List enterpriseTypes; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqNotGetOnCarDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqNotGetOnCarDTO.java new file mode 100644 index 0000000..1c5b584 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqNotGetOnCarDTO.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.company.entity.dto; + +import java.io.Serializable; +import java.time.LocalDate; + +import javax.validation.constraints.NotNull; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 未上车行驶记录查询实体 + * + * @author CMM + * @since 2023/01/10 09:24 + */ +@Data +public class ReqNotGetOnCarDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("公司ID") + @NotNull(message = "公司ID不能为空!") + private Long companyId; + + @ApiModelProperty("车牌") + private String carPlate; + + @ApiModelProperty("查询时间") + private LocalDate queryTime; + + @ApiModelProperty("表名拼接字符串") + private String tableNameStr; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqQualityManageDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqQualityManageDTO.java new file mode 100644 index 0000000..b2f3067 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqQualityManageDTO.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.company.entity.dto; + +import lombok.Data; + +import java.sql.Timestamp; + +/** + * @description: 质量通报 + * @author: liushuai + * @date: 2022/10/10 15:50 + */ +@Data +public class ReqQualityManageDTO { + private Long id; + private Long regionId; + + private Long companyId; + /** + * 通报年月 + */ + private Timestamp fileTime; + + /** + * 文件地址 + */ + private String filePath; + /** + * 文件名称 + */ + private String fileName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqSecurityProductDutyDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqSecurityProductDutyDTO.java new file mode 100644 index 0000000..b85e0b1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqSecurityProductDutyDTO.java @@ -0,0 +1,41 @@ +package com.ningdatech.carapi.company.entity.dto; + +import lombok.Data; + +/** + * @description: 生成责任体系请求 + * @author: liushuai + * @date: 2022/10/11 14:55 + */ +@Data +public class ReqSecurityProductDutyDTO { + /** + * 区域id + */ + private Long regionId; + + /** + * 企业id + */ + private Long companyId; + + /** + * 文件地址 + */ + private String filePath; + + /** + * 区域名称 + */ + private String regionName; + + /** + * 企业名称 + */ + private String companyName; + + /** + * 安全生产责任质量通报文件类型 + */ + private Integer fileType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqSecurityProductExecuteDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqSecurityProductExecuteDTO.java new file mode 100644 index 0000000..fee56fe --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqSecurityProductExecuteDTO.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.company.entity.dto; + +import lombok.Data; + +import java.sql.Timestamp; + +/** + * @description: + * @author: liushuai + * @date: 2022/10/11 15:46 + */ +@Data +public class ReqSecurityProductExecuteDTO { + /** + * 通报名称 + */ + private String name; + + /** + * 文件地址 + */ + private String filePath; + + /** + * 文件类型 + */ + private Integer fileType; + + /** + * 创建日期 + */ + private Timestamp createOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqSecurityProductRegulationsDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqSecurityProductRegulationsDTO.java new file mode 100644 index 0000000..f8a86d5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ReqSecurityProductRegulationsDTO.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.company.entity.dto; + +import lombok.Data; + +/** + * @description: + * @author: liushuai + * @date: 2022/10/11 15:26 + */ +@Data +public class ReqSecurityProductRegulationsDTO { + /** + * 区域id + */ + private Long regionId; + + /** + * 制度名称 + */ + private String regulationsName; + + /** + * 主管部门 + */ + private String competentDepartment; + + /** + * 文件地址 + */ + private String filePath; + + /** + * 文件类型 + */ + private Integer fileType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyArchivesDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyArchivesDTO.java new file mode 100644 index 0000000..c56a262 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyArchivesDTO.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.company.entity.dto; + +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.Data; + +/** + * @description: 企业详情 + * @author: liushuai + * @date: 2022/10/26 08:44 + */ +@Data +public class ResCompanyArchivesDTO { + @ExcelProperty("id") + private Long id; + @ExcelProperty("企业名称") + private String name; + @ExcelProperty("区域ID") + private Long regionId; + @ExcelProperty("区域名") + private String regionName; + @ExcelProperty("企业简称") + private String sortName; + @ExcelProperty("企业地址") + private String address; + @ExcelProperty("企业类型") + private String carCompanyType; + @ExcelProperty("法人姓名") + private String legalPerson; + @ExcelProperty("创建时间") + private LocalDateTime createOn; + @ExcelProperty("安全培训人数") + private Long securityDrillPerson; + @ExcelProperty("培训合格证数") + private Long drillPassCount; + @ExcelProperty("企业风险等级") + private String dangerLevel; + @ExcelProperty("企业风险名称") + private String dangerLevelName; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyArchivesDetailsDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyArchivesDetailsDTO.java new file mode 100644 index 0000000..2424191 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyArchivesDetailsDTO.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.company.entity.dto; + +import lombok.Data; + +/** + * @description: + * @author: liushuai + * @date: 2022/10/26 08:44 + */ +@Data +public class ResCompanyArchivesDetailsDTO { + private Integer companyType; + private String companyTypeName; + private String carCompanyType; + private String carCompanyTypeName; + private String businessLicense; + private String name; + private String fax; + private String email; + private Long regionId; + private String regionCode; + private String regionName; + private String address; + private Integer employeesNum; + private String bankName; + private String sortName; + private String dutyParagraph; + private String bankCardNo; + private String legalPerson; + private String legalPersonPhone; + private String legalPersonEmail; + private String contactPerson; + private String contactPhone; + private Integer companyStatus; + private String registeredCapital; + private Long securityDrillPerson; + private Long drillPassCount; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyBasicCreditDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyBasicCreditDTO.java new file mode 100644 index 0000000..bfa385b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyBasicCreditDTO.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.company.entity.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +/** + * @description: + * @author: liushuai + * @date: 2022/10/26 10:15 + */ +@Data +public class ResCompanyBasicCreditDTO { + @ExcelProperty("id") + private Long id; + @ExcelProperty("企业名称") + private String name; + @ExcelProperty("区域名") + private String regionName; + @ExcelProperty("统一社会信用代码") + private String dutyParagraph; + @ExcelProperty("企业类型") + private String carCompanyType; + @ExcelProperty("法人") + private String legalPerson; + @ExcelProperty("联系地址") + private String address; + @ExcelProperty("基本管理信用分值") + private Integer basicCreditScore; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyBasicCreditDetailDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyBasicCreditDetailDTO.java new file mode 100644 index 0000000..d5ed36f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyBasicCreditDetailDTO.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.company.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.sql.Timestamp; + +/** + * @description: + * @author: liushuai + * @date: 2022/10/26 10:38 + */ +@Data +public class ResCompanyBasicCreditDetailDTO { + private String name; + private String dutyParagraph; + private String carCompanyType; + private String address; + private String legalPerson; + private String registeredCapital; + private Timestamp createTime; + private String businessTerm; + private String evaluationOrganization; + private String website; + private String natureBusiness; + private String contactPhone; + private String fax; + private String businessLicensePath; + private String regionCode; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyBlackDetailListDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyBlackDetailListDTO.java new file mode 100644 index 0000000..2fafa3e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyBlackDetailListDTO.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.company.entity.dto; + +import java.time.LocalDateTime; + +import lombok.Data; + +/** + * @description: + * @author: liushuai + * @date: 2022/10/11 16:21 + */ +@Data +public class ResCompanyBlackDetailListDTO { + /** + * 失信类型 + */ + private String type; + + /** + * 失信日期 + */ + private LocalDateTime blackTime; + + /** + * 地点 + */ + private String site; + + /** + * 描述 + */ + private String content; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyBlackListDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyBlackListDTO.java new file mode 100644 index 0000000..e045d64 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyBlackListDTO.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.company.entity.dto; + +import lombok.Data; + +/** + * @description: + * @author: liushuai + * @date: 2022/10/11 16:07 + */ +@Data +public class ResCompanyBlackListDTO { + private Long regionId; + private String regionName; + + private Long companyId; + private String companyName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyCommonCreditDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyCommonCreditDTO.java new file mode 100644 index 0000000..380df48 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyCommonCreditDTO.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.company.entity.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +/** + * @description: + * @author: liushuai + * @date: 2022/10/26 10:21 + */ +@Data +public class ResCompanyCommonCreditDTO { + @ExcelProperty("id") + private Long id; + @ExcelProperty("企业名称") + private String name; + @ExcelProperty("区域名") + private String regionName; + @ExcelProperty("失信情况") + private Boolean blackList; + @ExcelProperty("公共信用评价分值") + private Integer commonCreditScore; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyEmployeesCountDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyEmployeesCountDTO.java new file mode 100644 index 0000000..9e7ac4c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyEmployeesCountDTO.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.company.entity.dto; + +import lombok.Data; + +/** + * @description: 员工统计 + * @author: liushuai + * @date: 2022/10/26 09:53 + */ +@Data +public class ResCompanyEmployeesCountDTO { + private Long id; + private String name; + private Long employeesNum; + private Long adminCount; + private Long driverCount; + private Long captainCount; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyTotalDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyTotalDTO.java new file mode 100644 index 0000000..a0223ca --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResCompanyTotalDTO.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.company.entity.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @description: 公司统计 + * @author: liushuai + * @date: 2022/10/25 10:16 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ResCompanyTotalDTO { + + /** + * 区域名称 + */ + private String regionName; + private String regionCode; + private Long regionId; + private String name; + private Long fileId; + /** + * 企业数量 + */ + private Long companyCount; + private Long count; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResNotGetOnCarRecordDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResNotGetOnCarRecordDTO.java new file mode 100644 index 0000000..bf36b73 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResNotGetOnCarRecordDTO.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.company.entity.dto; + +import java.time.LocalDate; + +import org.springframework.format.annotation.DateTimeFormat; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +/** + * 未上车行驶记录 + * + * @author CMM + * @since 2023/01/09 18:16 + */ +@Data +@ApiModel(value = "ResNotGetOnCarRecordDTO", description = "未上车行驶记录对象") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class ResNotGetOnCarRecordDTO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("时间") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate time; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResProductManageDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResProductManageDTO.java new file mode 100644 index 0000000..65e44cf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResProductManageDTO.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.company.entity.dto; + +import lombok.Data; + +import java.sql.Timestamp; + +/** + * @description: 生产管理返回 + * @author: liushuai + * @date: 2022/10/10 14:46 + */ +@Data +public class ResProductManageDTO { + private Long regionId; + private String regionName; + private Long companyId; + private String companyName; + private String productName; + private Timestamp carStartTime; + private String equipmentStatus; + private Integer sumProductCount; + private Integer realProductCount; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResQualityManageDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResQualityManageDTO.java new file mode 100644 index 0000000..6cbb15d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResQualityManageDTO.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.company.entity.dto; + +import lombok.Data; + +import java.sql.Timestamp; + +/** + * @description: 质量通报 + * @author: liushuai + * @date: 2022/10/10 16:03 + */ +@Data +public class ResQualityManageDTO { + private Long id; + private Long regionId; + private String regionName; + /** + * 通报年月 + */ + private Timestamp fileTime; + /** + * 文件地址 + */ + private String filePath; + /** + * 下载次数 + */ + private Integer downloadCount; + /** + * 文件名称 + */ + private String fileName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResSecurityProductDutyDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResSecurityProductDutyDTO.java new file mode 100644 index 0000000..1fccbba --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResSecurityProductDutyDTO.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.company.entity.dto; + +import lombok.Data; + +import java.sql.Timestamp; + +/** + * @description: 生成责任体系响应 + * @author: liushuai + * @date: 2022/10/11 14:55 + */ +@Data +public class ResSecurityProductDutyDTO { + /** + * 区域 + */ + private Long regionId; + private String regionName; + + /** + * 企业 + */ + private Long companyId; + private String companyName; + + /** + * 文件地址 + */ + private String filePath; + + /** + * 文件类型 + */ + private Integer fileType; + + /** + * 创建日期 + */ + private Timestamp createOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResSecurityProductExecuteDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResSecurityProductExecuteDTO.java new file mode 100644 index 0000000..8c377e2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResSecurityProductExecuteDTO.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.company.entity.dto; + +import lombok.Data; + +import java.sql.Timestamp; + +/** + * @description: + * @author: liushuai + * @date: 2022/10/11 15:46 + */ +@Data +public class ResSecurityProductExecuteDTO { + /** + * 通报名称 + */ + private String name; + + /** + * 文件地址 + */ + private String filePath; + + /** + * 文件类型 + */ + private Integer fileType; + + /** + * 创建日期 + */ + private Timestamp createOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResSecurityProductRegulationsDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResSecurityProductRegulationsDTO.java new file mode 100644 index 0000000..79a3e98 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/ResSecurityProductRegulationsDTO.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.company.entity.dto; + +import lombok.Data; + +import java.sql.Timestamp; + +/** + * @description: + * @author: liushuai + * @date: 2022/10/11 15:26 + */ +@Data +public class ResSecurityProductRegulationsDTO { + /** + * 制度名称 + */ + private String regulationsName; + + /** + * 主管部门 + */ + private String competentDepartment; + + /** + * 文件地址 + */ + private String filePath; + + /** + * 创建日期 + */ + private Timestamp createOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/UploadCommitmentDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/UploadCommitmentDTO.java new file mode 100644 index 0000000..f488fd6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/UploadCommitmentDTO.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.company.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Classname UploadCommitmentDTO + * @Description + * @Date 2023/5/23 16:23 + * @Author PoffyZhang + */ +@Data +public class UploadCommitmentDTO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("企业id") + private Long companyId; + + @ApiModelProperty("承诺对象") + private String commitmentTarget; + + @ApiModelProperty("承诺人") + private String promisee; + + @ApiModelProperty("文件") + private String file; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/UploadExecutionDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/UploadExecutionDTO.java new file mode 100644 index 0000000..e4ddd9b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/UploadExecutionDTO.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.company.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * UploadRegulationDTO + * @return + * @author CMM + * @since 2023/05/24 21:26 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class UploadExecutionDTO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("文件ID") + private Long fileId; + + @ApiModelProperty("上传文件名称") + private String fileName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/UploadGovernmentDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/UploadGovernmentDTO.java new file mode 100644 index 0000000..5fcf2e8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/UploadGovernmentDTO.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.company.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Classname UploadCommitmentDTO + * @Description + * @Date 2023/5/23 16:23 + * @Author PoffyZhang + */ +@Data +public class UploadGovernmentDTO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("企业id") + private Long companyId; + + @ApiModelProperty("文件性质") + private String docNature; + + @ApiModelProperty("部门名称") + private String departmentName; + + @ApiModelProperty("文件") + private String file; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/UploadRegulationDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/UploadRegulationDTO.java new file mode 100644 index 0000000..37137ac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/dto/UploadRegulationDTO.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.company.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * UploadRegulationDTO + * @return + * @author CMM + * @since 2023/05/24 21:26 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class UploadRegulationDTO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("企业id") + private Long companyId; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("文件ID") + private Long fileId; + + @ApiModelProperty("上传文件名称") + private String fileName; + + @ApiModelProperty("上传文件类型") + private Integer fileType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanyProductPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanyProductPO.java new file mode 100644 index 0000000..d8a03a5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanyProductPO.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.company.entity.po; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @Classname CompanyProductPO + * @Description + * @Date 2022/11/20 21:22 + * @Created by PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CompanyProductPO { + + private Long regionId; + + private List regionIds; + + private String companyName; + + private String dataScopeSql; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanyQualityPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanyQualityPO.java new file mode 100644 index 0000000..34470f3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanyQualityPO.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.company.entity.po; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @Classname CompanyProductPO + * @Description + * @Date 2022/11/20 21:22 + * @Created by PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CompanyQualityPO { + + private Long regionId; + + private List regionIds; + + private String year; + + private String dataScopeSql; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanySecurityProductDutyPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanySecurityProductDutyPO.java new file mode 100644 index 0000000..c3e4877 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanySecurityProductDutyPO.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.company.entity.po; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @Classname CompanyProductPO + * @Description + * @Date 2022/11/20 21:22 + * @Created by PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CompanySecurityProductDutyPO { + + private Long regionId; + + private List regionIds; + + private String companyName; + + private String startTime; + + private String endTime; + + private Integer fileType; + + private String dataScopeSql; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanySecurityProductExecutePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanySecurityProductExecutePO.java new file mode 100644 index 0000000..5741448 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanySecurityProductExecutePO.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.company.entity.po; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Classname CompanySecurityProductExecutePO + * @Description + * @Date 2022/11/20 21:22 + * @Created by PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CompanySecurityProductExecutePO { + + private String name; + + private String startTime; + + private String endTime; + + private Integer fileType; + + private String dataScopeSql; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanySecurityProductRegulationPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanySecurityProductRegulationPO.java new file mode 100644 index 0000000..d3ac4de --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanySecurityProductRegulationPO.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.company.entity.po; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Classname CompanySecurityProductExecutePO + * @Description + * @Date 2022/11/20 21:22 + * @Created by PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CompanySecurityProductRegulationPO { + + private String regulationsName; + + private String competentDepartment; + + private String startTime; + + private String endTime; + + private Integer fileType; + + private String dataScopeSql; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanyVehicleNotGetOnPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanyVehicleNotGetOnPO.java new file mode 100644 index 0000000..d5b0bc0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/CompanyVehicleNotGetOnPO.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.company.entity.po; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 公司车辆未上车行驶表对象 + * + * @author CMM + * @since 2023/01/10 15:40 + */ +@Data +public class CompanyVehicleNotGetOnPO { + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("公司id") + private Long companyId; + + @ApiModelProperty("Gps数据车辆状态") + private Long status; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/ResCompanyTotalPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/ResCompanyTotalPO.java new file mode 100644 index 0000000..e517e88 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/po/ResCompanyTotalPO.java @@ -0,0 +1,26 @@ +package com.ningdatech.carapi.company.entity.po; + +import lombok.Data; + +/** + * @description: 公司统计 + * @author: liushuai + * @date: 2022/10/25 10:16 + */ +@Data +public class ResCompanyTotalPO { + private Long regionId; + /** + * 区域名称 + */ + private String regionName; + private String regionCode; + + private String name; + + /** + * 企业数量 + */ + private Long companyCount; + private Long count; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/ComSecProExeVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/ComSecProExeVO.java new file mode 100644 index 0000000..f5a0c1e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/ComSecProExeVO.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.company.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * ComSecProExeVO + * @return + * @author CMM + * @since 2023/05/24 21:56 + */ +@Data +@ApiModel(value = "ComSecProExeVO", description = "企业安全生产制度执行通报列表VO") +public class ComSecProExeVO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("通报名称") + private String fileName; + + @ApiModelProperty("通报文件ID") + private String fileId; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/ComSecProRegVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/ComSecProRegVO.java new file mode 100644 index 0000000..32717a8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/ComSecProRegVO.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.company.entity.vo; + +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Classname ComSecProRegVO + * @Description + * @Date 2023/5/23 16:23 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "ComSecProRegVO", description = "企业安全生产制度体系列表VO") +public class ComSecProRegVO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("制度名称") + private String fileName; + + @ApiModelProperty("主管企业id") + private Long companyId; + + @ApiModelProperty("主管企业名称") + private String companyName; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("文件类型") + private Integer fileType; + + @ApiModelProperty("文件类型名称") + private String fileTypeName; + + @ApiModelProperty("文件ID") + private Long fileId; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/CompanyEmployeesVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/CompanyEmployeesVO.java new file mode 100644 index 0000000..0f6eb00 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/CompanyEmployeesVO.java @@ -0,0 +1,74 @@ +package com.ningdatech.carapi.company.entity.vo; + +import java.io.Serializable; +import java.sql.Timestamp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +@ApiModel(value = "CompanyEmployees对象", description = "企业员工信息") +@Data +public class CompanyEmployeesVO implements Serializable { + + private static final long serialVersionUID = 4740513010149140128L; + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("创建时间") + private Timestamp createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + private Timestamp updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("员工名称") + private String name; + + @ApiModelProperty("企业id") + private Long companyId; + + @ApiModelProperty("电话") + private String mobile; + + @ApiModelProperty("邮箱") + private String email; + + @ApiModelProperty("住址") + private String address; + + @ApiModelProperty("出生日期") + private Timestamp birthday; + + @ApiModelProperty("性别(0-女,1-男)") + private Integer sex; + + @ApiModelProperty("身份证号") + private String cardNum; + + @ApiModelProperty("学历(0-小学,1-初中,2-高中,3-专科,4-本科,5-研究生,6-博士)") + private Integer education; + + @ApiModelProperty("学历(0-小学,1-初中,2-高中,3-专科,4-本科,5-研究生,6-博士)") + private String educationName; + + @ApiModelProperty("职务(1-领导,2车队长)") + private String employeesStatus; + + @ApiModelProperty("区域id") + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/CompanySecurityCommitmentVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/CompanySecurityCommitmentVO.java new file mode 100644 index 0000000..b020be8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/CompanySecurityCommitmentVO.java @@ -0,0 +1,54 @@ +package com.ningdatech.carapi.company.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @Classname CompanySecurityCommitment + * @Description + * @Date 2023/5/23 16:23 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "CompanySecurityCommitment", description = "企业 承诺书") +public class CompanySecurityCommitmentVO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("企业id") + private Long companyId; + + @ApiModelProperty("企业id") + private String companyName; + + @ApiModelProperty("承诺对象") + private String commitmentTarget; + + @ApiModelProperty("承诺人") + private String promisee; + + @ApiModelProperty("文件") + private String file; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/CompanySecurityGovernmentVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/CompanySecurityGovernmentVO.java new file mode 100644 index 0000000..200f0ec --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/entity/vo/CompanySecurityGovernmentVO.java @@ -0,0 +1,54 @@ +package com.ningdatech.carapi.company.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @Classname CompanySecurityGovernment + * @Description + * @Date 2023/5/23 16:23 + * @Author PoffyZhang + */ +@Data +@ApiModel(value = "CompanySecurityGovernment", description = "企业管理机构") +public class CompanySecurityGovernmentVO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("企业id") + private Long companyId; + + @ApiModelProperty("企业id") + private String companyName; + + @ApiModelProperty("文件性质") + private String docNature; + + @ApiModelProperty("部门名称") + private String departmentName; + + @ApiModelProperty("文件") + private String file; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/CompanyBlackListTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/CompanyBlackListTypeEnum.java new file mode 100644 index 0000000..c972d68 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/CompanyBlackListTypeEnum.java @@ -0,0 +1,80 @@ +package com.ningdatech.carapi.company.enumeration; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * 企业失信类型枚举 + * @author CMM + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "CompanyBlackListTypeEnum", description = "企业失信类型-枚举") +public enum CompanyBlackListTypeEnum { + /** + * 存在不正当竞争关系 + */ + + UNFAIR_COMPETITION_RELATION(0, "存在不正当竞争关系"), + + /** + * 重大质量事故 + */ + MAJOR_QUALITY_ACCIDENT(1, "重大质量事故"), + + /** + * 严重扰乱市场秩序 + */ + DISRUPT_MARKET_ORDER(2,"严重扰乱市场秩序"), + + /** + * 严重环保问题 + */ + ENVIRONMENTAL_PROBLEMS(3,"严重环保问题"); + + + 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 (CompanyBlackListTypeEnum t : CompanyBlackListTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static CompanyBlackListTypeEnum getEnumByValue(Integer code) { + if(Objects.isNull(code)){ + return null; + } + for (CompanyBlackListTypeEnum t : CompanyBlackListTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/CompanyCreditLevelEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/CompanyCreditLevelEnum.java new file mode 100644 index 0000000..1eae390 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/CompanyCreditLevelEnum.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.company.enumeration; + +import org.apache.commons.lang3.StringUtils; + +import lombok.Getter; + +/** + * CompanyCreditLevelEnum + * @return + * @author CMM + * @since 2023/05/26 13:36 + */ +@Getter +public enum CompanyCreditLevelEnum { + /** + * 企业信用等级 + */ + A("A", "信用优秀"), + B("B", "信用良好"), + C("C","信用一般"), + D("D","信用较差"), + E("E","信用差"); + + private final String code; + private final String desc; + + CompanyCreditLevelEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static String getDescByCode(String code) { + if(StringUtils.isBlank(code)){ + return StringUtils.EMPTY; + } + for (CompanyCreditLevelEnum t : CompanyCreditLevelEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static String getCodeByDesc(String desc) { + if(StringUtils.isBlank(desc)){ + return null; + } + for (CompanyCreditLevelEnum t : CompanyCreditLevelEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/CompanyTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/CompanyTypeEnum.java new file mode 100644 index 0000000..b65d36d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/CompanyTypeEnum.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.company.enumeration; + +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + *

+ * CompanyType + *

+ * + * @author WendyYang + * @since 16:43 2022/11/3 + */ +@Getter +public enum CompanyTypeEnum { + /** + * 管理单位 + */ + MANAGE_BU(0, "管理企业"), + PRODUCT_BU(1, "生产企业"), + LOGISTICS_BU(2,"物流企业"), + OTHER(3,"其他"); + + private final Integer code; + private final String desc; + + CompanyTypeEnum(int code, String desc) { + this.code = code; + this.desc = desc; + } + + public static String getDescByCode(Integer code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (CompanyTypeEnum t : CompanyTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static Integer getCodeByDesc(String desc) { + if(Objects.isNull(desc)){ + return null; + } + for (CompanyTypeEnum t : CompanyTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/ProductCompanyType.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/ProductCompanyType.java new file mode 100644 index 0000000..03e8c03 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/ProductCompanyType.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.company.enumeration; + +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + *

+ * ProductCompanyType + *

+ * + * @author WendyYang + * @since 16:43 2022/11/3 + */ +@Getter +public enum ProductCompanyType { + /** + * 生产企业类型 + */ + MORTAR(2L, "预拌砂浆生产企业"), + CONCRETE(3L, "预拌混凝土生产企业"), + CEMENT(4L,"水泥生产企业"); + + private final Long code; + private final String value; + + ProductCompanyType(Long code, String value) { + this.code = code; + this.value = value; + } + + public static String getDescByCode(Long code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (ProductCompanyType t : ProductCompanyType.values()) { + if (code.equals(t.getCode())) { + return t.value; + } + } + return StringUtils.EMPTY; + } + + public static Long getCodeByDesc(String desc) { + if(Objects.isNull(desc)){ + return null; + } + for (ProductCompanyType t : ProductCompanyType.values()) { + if (desc.equals(t.getValue())) { + return t.code; + } + } + return null; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/SecurityProductFileType.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/SecurityProductFileType.java new file mode 100644 index 0000000..2f00bf2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/SecurityProductFileType.java @@ -0,0 +1,51 @@ +package com.ningdatech.carapi.company.enumeration; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 企业安全主体责任-通报文件类型 + * @return + * @author CMM + * @since 2023/05/17 14:42 + */ +@Getter +@AllArgsConstructor +public enum SecurityProductFileType { + + MANAGE_BU(0, "管理部门"), + COMPANY_INNER(1, "企业内部"), + REGULATION_NOTICE(2,"监管通报"), + HIGHER_CHECK(3,"上级检查"); + + + + + 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 (SecurityProductFileType t : SecurityProductFileType.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/SecurityProductRegulationFileType.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/SecurityProductRegulationFileType.java new file mode 100644 index 0000000..03a0472 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/enumeration/SecurityProductRegulationFileType.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.company.enumeration; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 企业安全主体责任-通报文件类型 + * @return + * @author CMM + * @since 2023/05/17 14:42 + */ +@Getter +@AllArgsConstructor +public enum SecurityProductRegulationFileType { + + ALL_SAFETY_EDUCATION_TRAIN_DATA(0, "全员安全教育培训考试资料"), + DRIVER_SAFETY_EDUCATION_TRAIN_LEDGER(1, "驾驶员安全教育培训台账"), + SAFETY_MANAGE_REGIME(2,"安全管理制度"), + SAFETY_PRODUCT_WORK_PLAN(3,"安全生产工作计划"), + SAFETY_PRODUCT_MEETING_RECORD(4,"安全生产会议记录"), + COMMERCIAL_CONCRETE_COMPANY_ACCIDENT_SUMMARY(5,"商品混凝土企业事故案例汇编"); + + + + + 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 (SecurityProductRegulationFileType t : SecurityProductRegulationFileType.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/manage/CompanySecurityManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/manage/CompanySecurityManage.java new file mode 100644 index 0000000..e06d544 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/manage/CompanySecurityManage.java @@ -0,0 +1,431 @@ +package com.ningdatech.carapi.company.manage; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +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.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.PageVo; +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.company.entity.CompanySecurityCommitment; +import com.ningdatech.carapi.company.entity.CompanySecurityGovernment; +import com.ningdatech.carapi.company.entity.CompanySecurityProductExecute; +import com.ningdatech.carapi.company.entity.CompanySecurityProductRegulation; +import com.ningdatech.carapi.company.entity.dto.*; +import com.ningdatech.carapi.company.entity.vo.ComSecProExeVO; +import com.ningdatech.carapi.company.entity.vo.ComSecProRegVO; +import com.ningdatech.carapi.company.entity.vo.CompanySecurityCommitmentVO; +import com.ningdatech.carapi.company.entity.vo.CompanySecurityGovernmentVO; +import com.ningdatech.carapi.company.service.ICompanySecurityCommitmentService; +import com.ningdatech.carapi.company.service.ICompanySecurityGovernmentService; +import com.ningdatech.carapi.company.service.ICompanySecurityProductExecuteFileService; +import com.ningdatech.carapi.company.service.ICompanySecurityProductRegulationsFileService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.service.CompanyService; +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 lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname CompanySecurityManage + * @Description + * @Date 2023/5/23 17:32 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class CompanySecurityManage { + + private final ICompanySecurityCommitmentService commitmentService; + private final ICompanySecurityGovernmentService governmentService; + private final CompanyService companyService; + private final ICompanySecurityProductRegulationsFileService regulationsFileService; + private final ICompanySecurityProductExecuteFileService executeFileService; + + /** + * 上传安全承诺书 + * @param dto + * @return + */ + public Boolean uploadCommitment(UploadCommitmentDTO dto) { + CompanySecurityCommitment commitment = BeanUtil.copyProperties(dto,CompanySecurityCommitment.class); + commitment.setCreateOn(LocalDateTime.now()); + return commitmentService.save(commitment); + } + + /** + * 上传安全管理机构 + * @param dto + * @return + */ + public Boolean uploadGovernment(UploadGovernmentDTO dto) { + CompanySecurityGovernment government = BeanUtil.copyProperties(dto,CompanySecurityGovernment.class); + government.setCreateOn(LocalDateTime.now()); + return governmentService.save(government); + } + + public PageVo pageCommitments(CompanySecurityCommitmentParam param) { + Page page = param.page(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(CompanySecurityCommitment.class) + .ge(Objects.nonNull(param.getStartTime()), CompanySecurityCommitment::getCreateOn, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), CompanySecurityCommitment::getCreateOn, param.getEndTime()) + .eq(Objects.nonNull(param.getRegionId()), CompanySecurityCommitment::getRegionId, param.getRegionId()); + + //如果需要公司名称模糊匹配 + if(StringUtils.isNotBlank(param.getCompanyName())){ + List companies = companyService.list(Wrappers.lambdaQuery(Company.class) + .like(Company::getName, param.getCompanyName())); + if(CollUtil.isEmpty(companies)) { + return PageVo.empty(); + } + List companyIds = companies.stream().map(Company::getId).collect(Collectors.toList()); + wrapper.in(CompanySecurityCommitment::getCompanyId,companyIds); + + } + + commitmentService.pageDataScope(page,wrapper,param); + if(0L == page.getTotal()){ + return PageVo.empty(); + } + List res = page.getRecords().stream().map(data -> { + CompanySecurityCommitmentVO vo = BeanUtil.copyProperties(data,CompanySecurityCommitmentVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(res,page.getTotal()); + } + + + + public PageVo pageGovernments(CompanySecurityCommitmentParam param) { + // Page page = param.page(); + + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(CompanySecurityGovernment.class) + .ge(Objects.nonNull(param.getStartTime()), CompanySecurityGovernment::getCreateOn, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), CompanySecurityGovernment::getCreateOn, param.getEndTime()) + .like(Objects.nonNull(param.getDocNature()),CompanySecurityGovernment::getDocNature,param.getDocNature()) + .like(Objects.nonNull(param.getDepartmentName()),CompanySecurityGovernment::getDepartmentName,param.getDepartmentName()) + .eq(Objects.nonNull(param.getRegionId()), CompanySecurityGovernment::getRegionId, param.getRegionId()); + //如果需要公司名称模糊匹配 + if(StringUtils.isNotBlank(param.getCompanyName())){ + List companies = companyService.list(Wrappers.lambdaQuery(Company.class) + .like(Company::getName, param.getCompanyName())); + if(CollUtil.isEmpty(companies)) { + return PageVo.empty(); + } + List companyIds = companies.stream().map(Company::getId).collect(Collectors.toList()); + wrapper.in(CompanySecurityGovernment::getCompanyId,companyIds); + } + + List governmentList = governmentService.dataScopeList(wrapper, param); + + // 省级部门上传的文件,下级账号也要能看到 + if (!UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId)) { + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(CompanySecurityGovernment.class); + if (Objects.nonNull(param.getRegionId())){ + queryWrapper.eq(CompanySecurityGovernment::getRegionId,param.getRegionId()); + }else { + queryWrapper.eq(CompanySecurityGovernment::getRegionId, DefValConstants.ZJREGION_ID); + } + queryWrapper.ge(Objects.nonNull(param.getStartTime()), CompanySecurityGovernment::getCreateOn, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), CompanySecurityGovernment::getCreateOn, param.getEndTime()) + .like(Objects.nonNull(param.getDocNature()),CompanySecurityGovernment::getDocNature,param.getDocNature()) + .like(Objects.nonNull(param.getDepartmentName()),CompanySecurityGovernment::getDepartmentName,param.getDepartmentName()); + //如果需要公司名称模糊匹配 + if(StringUtils.isNotBlank(param.getCompanyName())){ + List companies = companyService.list(Wrappers.lambdaQuery(Company.class) + .like(Company::getName, param.getCompanyName())); + List companyIds = companies.stream().map(Company::getId).collect(Collectors.toList()); + queryWrapper.in(CompanySecurityGovernment::getCompanyId,companyIds); + } + List governments = governmentService.list(queryWrapper); + governmentList.addAll(governments); + } + + if (CollUtil.isEmpty(governmentList)){ + return PageVo.empty(); + } + + List records = governmentList.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + + List res = records.stream().map(data -> { + CompanySecurityGovernmentVO vo = BeanUtil.copyProperties(data,CompanySecurityGovernmentVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(res,governmentList.size()); + + + // governmentService.pageDataScope(page,wrapper,param); + //if(0L == page.getTotal()){ + // return PageVo.empty(); + //} + + //List res = page.getRecords().stream().map(data -> { + // CompanySecurityGovernmentVO vo = BeanUtil.copyProperties(data,CompanySecurityGovernmentVO.class); + // CodeUtil.searchCompanyNameAndRegionName(vo); + // return vo; + //}).collect(Collectors.toList()); + //return PageVo.of(res,page.getTotal()); + } + + public PageVo pageRegulations(CompanySecurityProductRegulationParam param) { + // Page page = param.page(); + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(CompanySecurityProductRegulation.class) + .eq(CompanySecurityProductRegulation::getFileType,param.getFileType()) + .ge(Objects.nonNull(param.getStartTime()), CompanySecurityProductRegulation::getCreateOn, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), CompanySecurityProductRegulation::getCreateOn, param.getEndTime()) + .like(Objects.nonNull(param.getFileName()),CompanySecurityProductRegulation::getFileName,param.getFileName()) + .like(Objects.nonNull(param.getCompanyName()), CompanySecurityProductRegulation::getCompanyName, param.getCompanyName()); + + List regulationList = regulationsFileService.dataScopeList(wrapper, param); + + // 省级部门上传的文件(所属区域为省级),按照文件类型,下级账号也要能看到 + if (!UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId)) { + List regulations = regulationsFileService.list(Wrappers.lambdaQuery(CompanySecurityProductRegulation.class) + .eq(CompanySecurityProductRegulation::getRegionId, DefValConstants.ZJREGION_ID) + .eq(CompanySecurityProductRegulation::getFileType,param.getFileType())); + regulationList.addAll(regulations); + } + + if (CollUtil.isEmpty(regulationList)){ + return PageVo.empty(); + } + + List records = regulationList.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + + List res = records.stream() + .map(data -> { + ComSecProRegVO vo = BeanUtil.copyProperties(data, ComSecProRegVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }) + .collect(Collectors.toList()); + return PageVo.of(res,regulationList.size()); + + //regulationsFileService.pageDataScope(page,wrapper,param); + //if(0L == page.getTotal()){ + // return PageVo.empty(); + //} + //List res = page.getRecords().stream().map(data -> { + // ComSecProRegVO vo = BeanUtil.copyProperties(data,ComSecProRegVO.class); + // return vo; + //}).collect(Collectors.toList()); + //return PageVo.of(res,page.getTotal()); + } + + public Boolean uploadRegulation(UploadRegulationDTO dto) { + CompanySecurityProductRegulation regulation = BeanUtil.copyProperties(dto,CompanySecurityProductRegulation.class); + regulation.setCreateOn(LocalDateTime.now()); + regulation.setCreateBy(LoginUserUtil.getUserId()); + regulation.setUpdateOn(LocalDateTime.now()); + regulation.setUpdateBy(LoginUserUtil.getUserId()); + return regulationsFileService.save(regulation); + } + + public PageVo pageExecutes(CompanySecurityProductExecuteParam param) { + //Page page = param.page(); + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(CompanySecurityProductExecute.class) + .ge(Objects.nonNull(param.getStartTime()), CompanySecurityProductExecute::getCreateOn, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), CompanySecurityProductExecute::getCreateOn, param.getEndTime()) + .like(Objects.nonNull(param.getFileName()),CompanySecurityProductExecute::getFileName,param.getFileName()); + List executeList = executeFileService.dataScopeList(wrapper, param); + // 省级部门上传的文件(所属区域为省级),下级账号也要能看到 + if (!UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId)) { + List executes = executeFileService.list(Wrappers.lambdaQuery(CompanySecurityProductExecute.class) + .eq(CompanySecurityProductExecute::getRegionId, DefValConstants.ZJREGION_ID)); + executeList.addAll(executes); + } + + if (CollUtil.isEmpty(executeList)){ + return PageVo.empty(); + } + + List records = executeList.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + + List res = records.stream() + .map(data -> { + ComSecProExeVO vo = BeanUtil.copyProperties(data, ComSecProExeVO.class); + CodeUtil.searchRegionName(vo); + return vo; + }) + .collect(Collectors.toList()); + return PageVo.of(res,executeList.size()); + + //executeFileService.pageDataScope(page,wrapper,param); + //if(0L == page.getTotal()){ + // return PageVo.empty(); + //} + //List res = page.getRecords().stream().map(data -> { + // ComSecProExeVO vo = BeanUtil.copyProperties(data,ComSecProExeVO.class); + // return vo; + //}).collect(Collectors.toList()); + //return PageVo.of(res,page.getTotal()); + } + + public Boolean uploadExecution(UploadExecutionDTO dto) { + CompanySecurityProductExecute execution = BeanUtil.copyProperties(dto,CompanySecurityProductExecute.class); + execution.setCreateOn(LocalDateTime.now()); + execution.setCreateBy(LoginUserUtil.getUserId()); + execution.setUpdateOn(LocalDateTime.now()); + execution.setUpdateBy(LoginUserUtil.getUserId()); + return executeFileService.save(execution); + } + + public void deleteGovernmentFile(Long id, Long roleId) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(CompanySecurityGovernment.class); + CompanySecurityManage context = (CompanySecurityManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + CompanySecurityGovernment government = governmentService.getOne(wrapper); + if (Objects.isNull(government)){ + throw new BizException("文件无法删除!"); + } + //CompanySecurityGovernment government = governmentService.getById(id); + + // 如果文件是省级部门上传的文件,只有省级管理员角色可以删除 + Long regionId = government.getRegionId(); + if (Objects.nonNull(regionId) && + DefValConstants.ZJREGION_ID.equals(regionId)){ + // 判断登录用户角色是否为省管理员 + if (!UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId)){ + throw new BizException("您没有权限删除该文件!"); + } + } + governmentService.deleteById(id); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(CompanySecurityGovernment::getId,id); + } + + public void incrementDownCount(Long id) { + executeFileService.incrementDownCount(id); + } + + public void deleteCommitmentFile(Long id, Long roleId) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(CompanySecurityCommitment.class); + CompanySecurityManage context = (CompanySecurityManage) AopContext.currentProxy(); + context.buildCommitmentQuery(wrapper, id); + CompanySecurityCommitment commitment = commitmentService.getOne(wrapper); + if (Objects.isNull(commitment)){ + throw new BizException("文件无法删除!"); + } + //CompanySecurityCommitment commitment = commitmentService.getById(id); + // 如果文件是省级部门上传的文件,只有省级管理员角色可以删除 + Long regionId = commitment.getRegionId(); + if (Objects.nonNull(regionId) && + DefValConstants.ZJREGION_ID.equals(regionId)){ + // 判断登录用户角色是否为省管理员 + if (!UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId)){ + throw new BizException("您没有权限删除该文件!"); + } + } + commitmentService.deleteById(id); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildCommitmentQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(CompanySecurityCommitment::getId,id); + } + + public void deleteRegulationFile(Long id, Long roleId) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(CompanySecurityProductRegulation.class); + CompanySecurityManage context = (CompanySecurityManage) AopContext.currentProxy(); + context.buildRegulationQuery(wrapper, id); + CompanySecurityProductRegulation regulation = regulationsFileService.getOne(wrapper); + if (Objects.isNull(regulation)){ + throw new BizException("文件无法删除!"); + } + // CompanySecurityProductRegulation regulation = regulationsFileService.getById(id); + + // 如果文件是省级部门上传的文件,只有省级管理员角色可以删除 + Long regionId = regulation.getRegionId(); + if (Objects.nonNull(regionId) && + DefValConstants.ZJREGION_ID.equals(regionId)){ + // 判断登录用户角色是否为省管理员 + if (!UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId)){ + throw new BizException("您没有权限删除该文件!"); + } + } + regulationsFileService.deleteById(id); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildRegulationQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(CompanySecurityProductRegulation::getId,id); + } + + public void deleteExecuteFile(Long id, Long roleId) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(CompanySecurityProductExecute.class); + CompanySecurityManage context = (CompanySecurityManage) AopContext.currentProxy(); + context.buildExecuteQuery(wrapper, id); + CompanySecurityProductExecute execute = executeFileService.getOne(wrapper); + if (Objects.isNull(execute)){ + throw new BizException("文件无法删除!"); + } + // CompanySecurityProductExecute execute = executeFileService.getById(id); + // 如果文件是省级部门上传的文件,只有省级管理员角色可以删除 + Long regionId = execute.getRegionId(); + if (Objects.nonNull(regionId) && + DefValConstants.ZJREGION_ID.equals(regionId)){ + // 判断登录用户角色是否为省管理员 + if (!UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId)){ + throw new BizException("您没有权限删除该文件!"); + } + } + executeFileService.deleteById(id); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ONLY_REGION) + public void buildExecuteQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(CompanySecurityProductExecute::getId,id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyBasicCreditMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyBasicCreditMapper.java new file mode 100644 index 0000000..78f25f8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyBasicCreditMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.company.mapper; + +import com.ningdatech.carapi.company.entity.CompanyBasicCredit; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 企业基础信用信息 Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +public interface CompanyBasicCreditMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyBasicCreditMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyBasicCreditMapper.xml new file mode 100644 index 0000000..4905d8e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyBasicCreditMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyCertificateMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyCertificateMapper.java new file mode 100644 index 0000000..16daec0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyCertificateMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.company.mapper; + +import com.ningdatech.carapi.company.entity.CompanyCertificate; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 企业证书 Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +public interface CompanyCertificateMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyCertificateMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyCertificateMapper.xml new file mode 100644 index 0000000..3bbc342 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyCertificateMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyCommonCreditMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyCommonCreditMapper.java new file mode 100644 index 0000000..a37b480 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyCommonCreditMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.company.mapper; + +import com.ningdatech.carapi.company.entity.CompanyCommonCredit; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 企业公共信用信息 Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +public interface CompanyCommonCreditMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyCommonCreditMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyCommonCreditMapper.xml new file mode 100644 index 0000000..c46beb9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyCommonCreditMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyEmployeesMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyEmployeesMapper.java new file mode 100644 index 0000000..cc125d9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyEmployeesMapper.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.company.mapper; + +import com.ningdatech.carapi.company.entity.CompanyEmployees; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.company.entity.dto.ResCompanyEmployeesCountDTO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +public interface CompanyEmployeesMapper extends BaseMapper { + + List countEmployeesByCompanyIds(@Param("companyIds") List companyIds); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyEmployeesMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyEmployeesMapper.xml new file mode 100644 index 0000000..5bf5837 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyEmployeesMapper.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanySecurityProductExecuteFileMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanySecurityProductExecuteFileMapper.java new file mode 100644 index 0000000..edc342a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanySecurityProductExecuteFileMapper.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.company.mapper; + +import com.ningdatech.carapi.company.entity.CompanySecurityProductExecute; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 安全生产制度执行 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-05-24 + */ +public interface CompanySecurityProductExecuteFileMapper extends BaseMapper { + + int incrementDownCount(Long id); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanySecurityProductExecuteFileMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanySecurityProductExecuteFileMapper.xml new file mode 100644 index 0000000..ca49d21 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanySecurityProductExecuteFileMapper.xml @@ -0,0 +1,8 @@ + + + + + + update nd_security_advisory set download_times = download_times + 1 where id = #{id} + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanySecurityProductRegulationsFileMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanySecurityProductRegulationsFileMapper.java new file mode 100644 index 0000000..3f05eca --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanySecurityProductRegulationsFileMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.company.mapper; + +import com.ningdatech.carapi.company.entity.CompanySecurityProductRegulation; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 安全生产制度体系 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-05-24 + */ +public interface CompanySecurityProductRegulationsFileMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanySecurityProductRegulationsFileMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanySecurityProductRegulationsFileMapper.xml new file mode 100644 index 0000000..e1f9bf4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanySecurityProductRegulationsFileMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyVehicleNotGetOnMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyVehicleNotGetOnMapper.java new file mode 100644 index 0000000..d9e06a2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyVehicleNotGetOnMapper.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.company.mapper; + +import java.time.LocalDateTime; +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.company.entity.CompanyVehicleNotGetOn; +import com.ningdatech.carapi.company.entity.dto.ReqNotGetOnCarDTO; +import com.ningdatech.carapi.company.entity.po.CompanyVehicleNotGetOnPO; + +/** + *

+ * 上车表 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-01-10 + */ +public interface CompanyVehicleNotGetOnMapper extends BaseMapper { + List getNotOnCarList(@Param("param") ReqNotGetOnCarDTO param); + + String checkDataExistByDay(LocalDateTime queryTime); + + void saveBatchNotGetOnList(@Param("singleList") List singleList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyVehicleNotGetOnMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyVehicleNotGetOnMapper.xml new file mode 100644 index 0000000..e6f0ea3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/CompanyVehicleNotGetOnMapper.xml @@ -0,0 +1,38 @@ + + + + + insert into nd_company_vehicle_not_get_on + (id,create_on,create_by,update_on,update_by,car_plate,company_id,time) + values + + (null,now(),null,now(),null,#{notGetOn.carPlate},#{notGetOn.companyId},#{notGetOn.time}) + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyBlackListMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyBlackListMapper.java new file mode 100644 index 0000000..db13985 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyBlackListMapper.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.company.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyBlackList; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditBlackListPageParam; +import com.ningdatech.carapi.company.entity.dto.ResCompanyBlackDetailListDTO; +import com.ningdatech.carapi.company.entity.dto.ResCompanyBlackListDTO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 企业失信名单 Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface NdCompanyBlackListMapper extends BaseMapper { + /** + * 获取失信名单 + * + * @param blackListPage 分页 + * @param param + * @return 失信名单 + */ + Page companyBlackList(Page blackListPage, + @Param("po")CompanyCreditBlackListPageParam param); + + /** + * 获取失信详情 + * + * @param companyId 公司id + * @return 失信详情 + */ + List companyBlackInfoList(@Param("companyId") Long companyId); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyBlackListMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyBlackListMapper.xml new file mode 100644 index 0000000..27b99ec --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyBlackListMapper.xml @@ -0,0 +1,42 @@ + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditDeductMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditDeductMapper.java new file mode 100644 index 0000000..6967157 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditDeductMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.company.mapper; + +import com.ningdatech.carapi.company.entity.NdCompanyCreditDeduct; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 平安办扣分 Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface NdCompanyCreditDeductMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditDeductMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditDeductMapper.xml new file mode 100644 index 0000000..62e8ef3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditDeductMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditInsideMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditInsideMapper.java new file mode 100644 index 0000000..e6a6937 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditInsideMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.company.mapper; + +import com.ningdatech.carapi.company.entity.NdCompanyCreditInside; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 内部/联合检查 Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface NdCompanyCreditInsideMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditInsideMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditInsideMapper.xml new file mode 100644 index 0000000..19b70f3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditInsideMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditLevelMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditLevelMapper.java new file mode 100644 index 0000000..8811102 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditLevelMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.company.mapper; + +import com.ningdatech.carapi.company.entity.NdCompanyCreditLevel; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 信用等级 Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface NdCompanyCreditLevelMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditLevelMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditLevelMapper.xml new file mode 100644 index 0000000..664cdc8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditLevelMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditRewardMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditRewardMapper.java new file mode 100644 index 0000000..164b9f3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditRewardMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.company.mapper; + +import com.ningdatech.carapi.company.entity.NdCompanyCreditReward; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 政府/行业嘉奖 Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface NdCompanyCreditRewardMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditRewardMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditRewardMapper.xml new file mode 100644 index 0000000..acdda0a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyCreditRewardMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyProductManageMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyProductManageMapper.java new file mode 100644 index 0000000..81802b3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyProductManageMapper.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.company.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyProductManage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.company.entity.dto.ResProductManageDTO; +import com.ningdatech.carapi.company.entity.po.CompanyProductPO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 公司生产管理 Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface NdCompanyProductManageMapper extends BaseMapper { + + /** + * 生成管理列表 + * @param managePage 分页 + * @return 分页列表 + */ + Page manageList(Page managePage, + @Param("po") CompanyProductPO po); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyProductManageMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyProductManageMapper.xml new file mode 100644 index 0000000..5186c49 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyProductManageMapper.xml @@ -0,0 +1,35 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyQualityManageMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyQualityManageMapper.java new file mode 100644 index 0000000..a7cc59b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyQualityManageMapper.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.company.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyQualityManage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.company.entity.dto.ResQualityManageDTO; +import com.ningdatech.carapi.company.entity.po.CompanyQualityPO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 质量通报 Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface NdCompanyQualityManageMapper extends BaseMapper { + /** + * 获取分页数据 + * + * @param managePage 分页 + * @param + * @return 分页数据 + */ + Page qualityManageList(Page managePage, + @Param("po") CompanyQualityPO po); + + int incrementDownCount(@Param("id") Long id); + + Page qualityAllManageList(Page page, @Param("po") CompanyQualityPO po); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyQualityManageMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyQualityManageMapper.xml new file mode 100644 index 0000000..5c0d47e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanyQualityManageMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + update nd_company_quality_manage set download_count = download_count + 1 where id = #{id} + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityCommitmentMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityCommitmentMapper.java new file mode 100644 index 0000000..4da1839 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityCommitmentMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.company.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.company.entity.CompanySecurityCommitment; + +/** + *

+ * 安全 安全承诺书 Mapper 接口 + *

+ * + * @author zpf + * @since 2023-05-23 + */ +public interface NdCompanySecurityCommitmentMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityCommitmentMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityCommitmentMapper.xml new file mode 100644 index 0000000..5740814 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityCommitmentMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityGovernmentMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityGovernmentMapper.java new file mode 100644 index 0000000..21e7cd8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityGovernmentMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.company.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.company.entity.CompanySecurityGovernment; + +/** + *

+ * 安全 管理机构 Mapper 接口 + *

+ * + * @author zpf + * @since 2023-05-23 + */ +public interface NdCompanySecurityGovernmentMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityGovernmentMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityGovernmentMapper.xml new file mode 100644 index 0000000..9d773ce --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityGovernmentMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductDutyMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductDutyMapper.java new file mode 100644 index 0000000..b11e2d4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductDutyMapper.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.company.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanySecurityProductDuty; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.company.entity.dto.ResQualityManageDTO; +import com.ningdatech.carapi.company.entity.dto.ResSecurityProductDutyDTO; +import com.ningdatech.carapi.company.entity.po.CompanySecurityProductDutyPO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 安全生产责任体系 Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface NdCompanySecurityProductDutyMapper extends BaseMapper { + /** + * 获取分页数据 + * + * @param dutyPage 分页 + * @return 列表 + */ + Page securityProductDutyList(Page dutyPage, + @Param("po")CompanySecurityProductDutyPO po); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductDutyMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductDutyMapper.xml new file mode 100644 index 0000000..f523e72 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductDutyMapper.xml @@ -0,0 +1,44 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductExecuteMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductExecuteMapper.java new file mode 100644 index 0000000..7a71a6e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductExecuteMapper.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.company.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanySecurityProductExecute; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.company.entity.dto.ResSecurityProductExecuteDTO; +import com.ningdatech.carapi.company.entity.po.CompanySecurityProductExecutePO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 安全生产制度执行 Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface NdCompanySecurityProductExecuteMapper extends BaseMapper { + /** + * 获取分页数据 + * + * @param executePage 分页 + * @param + * @return 列表 + */ + Page securityProductExecuteList(Page executePage, + @Param("po")CompanySecurityProductExecutePO po); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductExecuteMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductExecuteMapper.xml new file mode 100644 index 0000000..ae78541 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductExecuteMapper.xml @@ -0,0 +1,34 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductRegulationsMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductRegulationsMapper.java new file mode 100644 index 0000000..2cdd099 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductRegulationsMapper.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.company.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanySecurityProductRegulations; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.company.entity.dto.ResSecurityProductRegulationsDTO; +import com.ningdatech.carapi.company.entity.po.CompanySecurityProductRegulationPO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 安全生产制度体系 Mapper 接口 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface NdCompanySecurityProductRegulationsMapper extends BaseMapper { + /** + * 获取分页数据 + * + * @param dutyPage 分页 + * @param + * @return 列表 + */ + Page securityProductRegulationsList(Page dutyPage, + @Param("po")CompanySecurityProductRegulationPO po); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductRegulationsMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductRegulationsMapper.xml new file mode 100644 index 0000000..b519ed3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/mapper/NdCompanySecurityProductRegulationsMapper.xml @@ -0,0 +1,40 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyArchivesService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyArchivesService.java new file mode 100644 index 0000000..7fe5bb7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyArchivesService.java @@ -0,0 +1,103 @@ +package com.ningdatech.carapi.company.service; + +import java.util.List; + +import javax.servlet.http.HttpServletResponse; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.company.entity.dto.*; +import com.ningdatech.carapi.company.entity.vo.CompanyEmployeesVO; +import com.ningdatech.carapi.open.model.vo.CompanySecurityInfoVO; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.dto.CompanySaveDTO; + + +/** + * @description: + * @author: liushuai + * @date: 2022/10/26 08:50 + */ +public interface ICompanyArchivesService { + + /** + * 获取企业信息 + * + * @param + * @return 企业列表 + */ + PageVo getCompanyList(CompanyListParamDTO param); + + /** + * 获取企业详情 + * + * @param companyId 公司id + * @return 企业详情 + */ + ResCompanyArchivesDetailsDTO getCompanyDetail(Long companyId); + + /** + * 获取企业员工信息 + * + * @param companyId 企业id + * @return 企业员工信息 + */ + List getCompanyEmployees(Long companyId); + + /** + * 修改企业信息 + * + * @param reqCompanyArchivesDetailsDTO {@link ReqCompanyArchivesDetailsDTO} + */ + void updateCompanyInfo(ReqCompanyArchivesDetailsDTO reqCompanyArchivesDetailsDTO); + + /** + * 获取员工统计 + * + * @param param + * @return 分页统计 + */ + PageVo getCompanyEmployeesList(CompanyListParamDTO param); + + /** + * 获取企业基础信用 + * + * @param + * @return 基础信用列表 + */ + PageVo getCompanyBasicCreditList(CompanyListParamDTO param); + + /** + * 获取基础信用详情 + * + * @param companyId 企业id + * @return 信用详情 + */ + ResCompanyBasicCreditDetailDTO getCompanyBasicCreditDetail(Long companyId); + + /** + * 获取企业公共信用 + * + * @param param + * @return 公共信用信息 + */ + PageVo getCompanyCommonCreditList(CompanyListParamDTO param); + + void companyListExport(HttpServletResponse response, CompanyListParamDTO param); + + void companyBasicCreditListExport(HttpServletResponse response, CompanyListParamDTO param); + + void companyCommonCreditListExport(HttpServletResponse response, CompanyListParamDTO param); + + void companyCertificateInformationListExport(HttpServletResponse response, CompanyListParamDTO param); + PageVo getNotOnCarList(ReqNotGetOnCarDTO param); + + CompanySecurityInfoVO getCompanySecurityInfo(Long companyId); + + Company saveCompany(CompanySaveDTO data); + + PageVo queryToBeAudit(CompanyAuditPageQuery param); + + PageVo queryAuditedList(CompanyAuditPageQuery param); + + Boolean audit(CompanyAuditDTO data, Long userId); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyBasicCreditService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyBasicCreditService.java new file mode 100644 index 0000000..c9000a4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyBasicCreditService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.company.service; + +import com.ningdatech.carapi.company.entity.CompanyBasicCredit; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 企业基础信用信息 服务类 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +public interface ICompanyBasicCreditService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyCertificateService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyCertificateService.java new file mode 100644 index 0000000..d0ee905 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyCertificateService.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.CompanyCertificate; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 企业证书 服务类 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +public interface ICompanyCertificateService extends IService { + + Page getCertificates(Page page, Long companyId); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyCommonCreditService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyCommonCreditService.java new file mode 100644 index 0000000..0c1d6b0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyCommonCreditService.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.CompanyCommonCredit; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 企业公共信用信息 服务类 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +public interface ICompanyCommonCreditService extends IService { + + Page getCompanyBasicCreditDetail(Page page, Long companyId); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyEmployeesService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyEmployeesService.java new file mode 100644 index 0000000..f46c11b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyEmployeesService.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.company.service; + +import com.ningdatech.carapi.company.entity.CompanyEmployees; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.dto.ResCompanyEmployeesCountDTO; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +public interface ICompanyEmployeesService extends IService { + + List countEmployeesByCompanyIds(List collect); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyLargeScreenService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyLargeScreenService.java new file mode 100644 index 0000000..175eaa9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyLargeScreenService.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.company.service; + +import com.ningdatech.carapi.company.entity.dto.ResCompanyTotalDTO; + +import java.util.List; + +/** + * @description: + * @author: liushuai + * @date: 2022/10/25 10:14 + */ +public interface ICompanyLargeScreenService { + /** + * 根据区域id获取企业数据统计 + * @param regionId 区域id + * @return 企业数据统计 + */ + List getCompanyTotalByRegionId(Long regionId); + + List countEnterpriseType(Long regionId); + + List deadAccident(Long regionId); + + List mortarQuality(Long regionId); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanySecurityCommitmentService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanySecurityCommitmentService.java new file mode 100644 index 0000000..6bccfe8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanySecurityCommitmentService.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.CompanySecurityCommitment; +import com.ningdatech.carapi.company.entity.dto.CompanySecurityCommitmentParam; + +/** + *

+ * 安全 承诺书 服务类 + *

+ * + * @author zpf + * @since 2023-05-23 + */ +public interface ICompanySecurityCommitmentService extends IService { + + Page pageDataScope(Page page, LambdaQueryWrapper wrapper, CompanySecurityCommitmentParam param); + + void deleteById(Long id); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanySecurityGovernmentService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanySecurityGovernmentService.java new file mode 100644 index 0000000..b07f7c6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanySecurityGovernmentService.java @@ -0,0 +1,26 @@ +package com.ningdatech.carapi.company.service; + +import java.util.List; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.CompanySecurityGovernment; +import com.ningdatech.carapi.company.entity.dto.CompanySecurityCommitmentParam; + +/** + *

+ * 安全 管理机构 服务类 + *

+ * + * @author zpf + * @since 2023-05-23 + */ +public interface ICompanySecurityGovernmentService extends IService { + + Page pageDataScope(Page page, LambdaQueryWrapper wrapper, CompanySecurityCommitmentParam param); + + List dataScopeList(LambdaQueryWrapper wrapper, CompanySecurityCommitmentParam param); + + void deleteById(Long id); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanySecurityProductExecuteFileService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanySecurityProductExecuteFileService.java new file mode 100644 index 0000000..7c89d07 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanySecurityProductExecuteFileService.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.CompanySecurityProductExecute; +import com.ningdatech.carapi.company.entity.dto.CompanySecurityProductExecuteParam; + +import java.util.List; + +/** + *

+ * 安全生产制度执行 服务类 + *

+ * + * @author CMM + * @since 2023-05-24 + */ +public interface ICompanySecurityProductExecuteFileService extends IService { + + Page pageDataScope(Page page, LambdaQueryWrapper wrapper, CompanySecurityProductExecuteParam param); + + List dataScopeList(LambdaQueryWrapper wrapper, CompanySecurityProductExecuteParam param); + + void deleteById(Long id); + + Boolean incrementDownCount(Long id); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanySecurityProductRegulationsFileService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanySecurityProductRegulationsFileService.java new file mode 100644 index 0000000..daac4dc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanySecurityProductRegulationsFileService.java @@ -0,0 +1,26 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.CompanySecurityProductRegulation; +import com.ningdatech.carapi.company.entity.dto.CompanySecurityProductRegulationParam; + +import java.util.List; + +/** + *

+ * 安全生产制度体系 服务类 + *

+ * + * @author CMM + * @since 2023-05-24 + */ +public interface ICompanySecurityProductRegulationsFileService extends IService { + + Page pageDataScope(Page page, LambdaQueryWrapper wrapper, CompanySecurityProductRegulationParam param); + + List dataScopeList(LambdaQueryWrapper wrapper, CompanySecurityProductRegulationParam param); + + void deleteById(Long id); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyVehicleNotGetOnService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyVehicleNotGetOnService.java new file mode 100644 index 0000000..409e568 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/ICompanyVehicleNotGetOnService.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.company.service; + +import java.time.LocalDateTime; +import java.util.List; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.CompanyVehicleNotGetOn; +import com.ningdatech.carapi.company.entity.dto.ReqNotGetOnCarDTO; +import com.ningdatech.carapi.company.entity.po.CompanyVehicleNotGetOnPO; + +/** + *

+ * 上车表 服务类 + *

+ * + * @author CMM + * @since 2023-01-10 + */ +public interface ICompanyVehicleNotGetOnService extends IService { + + /** + * 查询企业车辆未扫码行驶记录 + * @param param + * @return + */ + List getNotOnCarList(ReqNotGetOnCarDTO param); + + String checkDataExistByDay(LocalDateTime queryTime); + + void saveBatchNotGetOnList(List singleList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyBlackListService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyBlackListService.java new file mode 100644 index 0000000..f2ab7db --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyBlackListService.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyBlackList; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditBlackListPageParam; +import com.ningdatech.carapi.company.entity.dto.ResCompanyBlackDetailListDTO; +import com.ningdatech.carapi.company.entity.dto.ResCompanyBlackListDTO; + +import java.util.List; + +/** + *

+ * 企业失信名单 服务类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface INdCompanyBlackListService extends IService { + + /** + * 获取失信名单 + * + * @param param + * @return 失信名单 + */ + Page companyBlackList(CompanyCreditBlackListPageParam param); + + /** + * 获取失信详情 + * + * @param companyId 公司id + * @return 失信详情 + */ + List companyBlackInfoList(Long companyId); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyCreditDeductService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyCreditDeductService.java new file mode 100644 index 0000000..0d66a2f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyCreditDeductService.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyCreditDeduct; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditDeductPageParam; + +/** + *

+ * 平安办扣分 服务类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface INdCompanyCreditDeductService extends IService { + + /** + * 获取扣分列表 + * + * @param param + * @return 扣分列表 + */ + Page getCreditDeductList(CompanyCreditDeductPageParam param); + + Boolean delete(Long id); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyCreditInsideService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyCreditInsideService.java new file mode 100644 index 0000000..e418624 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyCreditInsideService.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyCreditInside; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditInsidePageParam; + +/** + *

+ * 内部/联合检查 服务类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface INdCompanyCreditInsideService extends IService { + /** + * 获取列表 + * @param param + * @return 分页信息 + */ + Page getList(CompanyCreditInsidePageParam param); + + Boolean delete(Long id); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyCreditLevelService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyCreditLevelService.java new file mode 100644 index 0000000..544fcc0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyCreditLevelService.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyCreditLevel; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditLevelPageParam; + +/** + *

+ * 信用等级 服务类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface INdCompanyCreditLevelService extends IService { + + /** + * 获取信用列表 + * + * @param param + * @return 信用等级列表 + */ + Page getCreditLevelList(CompanyCreditLevelPageParam param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyCreditRewardService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyCreditRewardService.java new file mode 100644 index 0000000..b528ece --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyCreditRewardService.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyCreditReward; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditRewardPageParam; + +/** + *

+ * 政府/行业嘉奖 服务类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface INdCompanyCreditRewardService extends IService { + + /** + * 获取嘉奖列表 + * + * @param param + * @return 嘉奖列表 + */ + Page getCreditRewardList(CompanyCreditRewardPageParam param); + + Boolean delete(Long id); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyProductManageService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyProductManageService.java new file mode 100644 index 0000000..b2699d0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyProductManageService.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanyProductManage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.dto.ResProductManageDTO; + +/** + *

+ * 公司生产管理 服务类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface INdCompanyProductManageService extends IService { + + /** + * 获取管理列表 + * + * @param companyName 公司名称 + * @param regionId 区域id + * @param pageNum 当前页 + * @param pageSize 页面大小 + * @return 列表 + */ + Page manageList(String companyName, Long regionId, int pageNum, int pageSize); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyQualityManageService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyQualityManageService.java new file mode 100644 index 0000000..d7672c3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanyQualityManageService.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.NdCompanyQualityManage; +import com.ningdatech.carapi.company.entity.dto.ResQualityManageDTO; + +/** + *

+ * 质量通报 服务类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface INdCompanyQualityManageService extends IService { + /** + * 获取分页 + * @param regionId 区域 + * @param year 年份 + * @param pageNum 当前页 + * @param pageSize 页面大小 + * @return 分页数据 + */ + Page qualityManageList(Long regionId,String year, int pageNum,int pageSize); + + boolean incrementDownCount(Long id); + + Boolean delete(Long id); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanySecurityProductDutyService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanySecurityProductDutyService.java new file mode 100644 index 0000000..ab6c9e1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanySecurityProductDutyService.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanySecurityProductDuty; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.dto.ResSecurityProductDutyDTO; + +/** + *

+ * 安全生产责任体系 服务类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface INdCompanySecurityProductDutyService extends IService { + + /** + * 获取生成责任体系 + * @param regionId 区域id + * @param companyName 公司名称 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @param pageNum 当前页 + * @param pageSize 页面大小 + * @return 列表 + */ + Page securityProductDutyList(Long regionId, String companyName, String startTime, + String endTime, Integer fileType, int pageNum, int pageSize); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanySecurityProductExecuteService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanySecurityProductExecuteService.java new file mode 100644 index 0000000..c4ac5da --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanySecurityProductExecuteService.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanySecurityProductExecute; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.dto.ResSecurityProductExecuteDTO; + +/** + *

+ * 安全生产制度执行 服务类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface INdCompanySecurityProductExecuteService extends IService { + + /** + * 获取制度执行 + * + * @param name 通报名称 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @param pageNum 当前页 + * @param pageSize 页面大小 + * @return 列表 + */ + Page securityProductExecuteList(String name, String startTime, + String endTime, Integer fileType, int pageNum, int pageSize); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanySecurityProductRegulationsService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanySecurityProductRegulationsService.java new file mode 100644 index 0000000..ba7be08 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/INdCompanySecurityProductRegulationsService.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.company.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanySecurityProductRegulations; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.company.entity.dto.ResSecurityProductRegulationsDTO; + +/** + *

+ * 安全生产制度体系 服务类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +public interface INdCompanySecurityProductRegulationsService extends IService { + + /** + * 获取制度体系 + * @param regulationsName 制度名称 + * @param competentDepartment 主管部门 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @param pageNum 当前页 + * @param pageSize 页面大小 + * @return 列表 + */ + Page securityProductRegulationsList(String regulationsName, String competentDepartment, String startTime, + String endTime, Integer fileType, int pageNum, int pageSize); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyBasicCreditServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyBasicCreditServiceImpl.java new file mode 100644 index 0000000..caa61d6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyBasicCreditServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.company.service.impl; + +import com.ningdatech.carapi.company.entity.CompanyBasicCredit; +import com.ningdatech.carapi.company.mapper.CompanyBasicCreditMapper; +import com.ningdatech.carapi.company.service.ICompanyBasicCreditService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 企业基础信用信息 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +@Service +public class CompanyBasicCreditServiceImpl extends ServiceImpl implements ICompanyBasicCreditService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyCertificateServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyCertificateServiceImpl.java new file mode 100644 index 0000000..d21ca48 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyCertificateServiceImpl.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.company.service.impl; + +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.company.entity.CompanyCertificate; +import com.ningdatech.carapi.company.mapper.CompanyCertificateMapper; +import com.ningdatech.carapi.company.service.ICompanyCertificateService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; + +/** + *

+ * 企业证书 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +@Service +public class CompanyCertificateServiceImpl extends ServiceImpl implements ICompanyCertificateService { + @Override + public Page getCertificates(Page page, Long companyId) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(CompanyCertificate.class); + CompanyCertificateServiceImpl context = (CompanyCertificateServiceImpl) AopContext.currentProxy(); + context.buildQuery(wrapper, companyId); + return page(page,wrapper); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long companyId) { + wrapper.eq(CompanyCertificate::getCompanyId,companyId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyCommonCreditServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyCommonCreditServiceImpl.java new file mode 100644 index 0000000..3b18d79 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyCommonCreditServiceImpl.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.company.service.impl; + +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.company.entity.CompanyCommonCredit; +import com.ningdatech.carapi.company.mapper.CompanyCommonCreditMapper; +import com.ningdatech.carapi.company.service.ICompanyCommonCreditService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; + +/** + *

+ * 企业公共信用信息 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +@Service +public class CompanyCommonCreditServiceImpl extends ServiceImpl implements ICompanyCommonCreditService { + + @Override + public Page getCompanyBasicCreditDetail(Page page, Long companyId) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(CompanyCommonCredit.class); + CompanyCommonCreditServiceImpl context = (CompanyCommonCreditServiceImpl) AopContext.currentProxy(); + context.buildQuery(wrapper, companyId); + return page(page,wrapper); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long companyId) { + wrapper.eq(CompanyCommonCredit::getCompanyId,companyId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyEmployeesServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyEmployeesServiceImpl.java new file mode 100644 index 0000000..3c6dc18 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyEmployeesServiceImpl.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.company.service.impl; + +import com.ningdatech.carapi.company.entity.CompanyEmployees; +import com.ningdatech.carapi.company.entity.dto.ResCompanyEmployeesCountDTO; +import com.ningdatech.carapi.company.mapper.CompanyEmployeesMapper; +import com.ningdatech.carapi.company.service.ICompanyEmployeesService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-25 + */ +@Service +@RequiredArgsConstructor +public class CompanyEmployeesServiceImpl extends ServiceImpl implements ICompanyEmployeesService { + + private final CompanyEmployeesMapper companyEmployeesMapper; + + @Override + public List countEmployeesByCompanyIds(List companyIds) { + return companyEmployeesMapper.countEmployeesByCompanyIds(companyIds); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyLargeScreenServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyLargeScreenServiceImpl.java new file mode 100644 index 0000000..2aeb3c4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyLargeScreenServiceImpl.java @@ -0,0 +1,140 @@ +package com.ningdatech.carapi.company.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.company.entity.NdCompanyQualityManage; +import com.ningdatech.carapi.company.entity.dto.ResCompanyTotalDTO; +import com.ningdatech.carapi.company.entity.po.ResCompanyTotalPO; +import com.ningdatech.carapi.company.service.ICompanyLargeScreenService; +import com.ningdatech.carapi.company.service.INdCompanyQualityManageService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.industry.service.IReadyMixedMortarIndustryManageService; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentDead; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentDeadService; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @description: 大屏管理 + * @author: liushuai + * @date: 2022/10/25 10:14 + */ +@Service +@RequiredArgsConstructor +public class CompanyLargeScreenServiceImpl implements ICompanyLargeScreenService { + private final INdVehicleAccidentDeadService accidentDeadService; + private final CompanyService companyService; + private final CompaniesCacheHelper companiesCacheHelper; + private final IReadyMixedMortarIndustryManageService mortarQualityService; + + private final INdCompanyQualityManageService iNdCompanyQualityManageService; + + @Override + public List getCompanyTotalByRegionId(Long regionId) { + DataScreenParam param = new DataScreenParam(); + param.setRegionId(regionId); + List resCompanyTotalList = companyService.countByRegion(param); + if (CollUtil.isEmpty(resCompanyTotalList)) { + return Collections.emptyList(); + } + return resCompanyTotalList.stream().map(w -> { + ResCompanyTotalDTO dto = new ResCompanyTotalDTO(); + BeanUtils.copyProperties(w, dto); + return dto; + }).collect(Collectors.toList()); + } + + @Override + public List countEnterpriseType(Long regionId) { + DataScreenParam param = new DataScreenParam(); + param.setRegionId(regionId); + List resCompanyTotalList = companyService.countEnterpriseType(param); + if (CollUtil.isEmpty(resCompanyTotalList)) { + return Collections.emptyList(); + } + return resCompanyTotalList.stream().map(w -> { + ResCompanyTotalDTO dto = new ResCompanyTotalDTO(); + BeanUtils.copyProperties(w, dto); + return dto; + }).collect(Collectors.toList()); + } + + @Override + public List deadAccident(Long regionId) { + DataScreenParam param = new DataScreenParam(); + param.setRegionId(regionId); + param.setStartTime(LocalDateTime.now().minusMonths(6)); + //半年内 + param.setEndTime(LocalDateTime.now()); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleAccidentDead.class); + List accidentDeadList = ((CompanyLargeScreenServiceImpl) AopContext.currentProxy()).countDeadCompany(wrapper, param); + + if (CollUtil.isEmpty(accidentDeadList)) { + return Collections.emptyList(); + } + return accidentDeadList.stream().filter(w -> { + if (w.getCompanyId() == null) { + return false; + } + String companyName = companiesCacheHelper.getNameById(w.getCompanyId()); + boolean notBlank = StrUtil.isNotBlank(companyName); + if (notBlank) { + w.setCompanyName(companyName); + } + return notBlank; + }).map(w -> ResCompanyTotalDTO.builder().name(w.getCompanyName()).build()) + .collect(Collectors.toList()); + } + + @Override + public List mortarQuality(Long regionId) { + DataScreenParam param = new DataScreenParam(); + param.setRegionId(regionId); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdCompanyQualityManage.class); + List list = ((CompanyLargeScreenServiceImpl) AopContext.currentProxy()).mortarQualityies(wrapper, param); + + if (CollUtil.isEmpty(list)) { + return Collections.emptyList(); + } + return list.stream().map(w -> { + ResCompanyTotalDTO dto = new ResCompanyTotalDTO(); + dto.setFileId(StringUtils.isNotBlank(w.getFilePath()) ? + Long.parseLong(w.getFilePath()) : null); + dto.setName(w.getFileName()); + return dto; + }).collect(Collectors.toList()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public List mortarQualityies(LambdaQueryWrapper wrapper, DataScreenParam param) { + return iNdCompanyQualityManageService.list(wrapper + .orderBy(Boolean.TRUE, Boolean.FALSE, NdCompanyQualityManage::getUpdateOn)); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public List countDeadCompany(LambdaQueryWrapper wrapper, DataScreenParam param) { + wrapper.select(NdVehicleAccidentDead::getCompanyId) + .ge(Objects.nonNull(param.getStartTime()), NdVehicleAccidentDead::getAccidentTime, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), NdVehicleAccidentDead::getAccidentTime, param.getEndTime()) + .groupBy(NdVehicleAccidentDead::getCompanyId); + return accidentDeadService.list(wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanySecurityProductExecuteFileServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanySecurityProductExecuteFileServiceImpl.java new file mode 100644 index 0000000..fa04123 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanySecurityProductExecuteFileServiceImpl.java @@ -0,0 +1,52 @@ +package com.ningdatech.carapi.company.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.company.entity.CompanySecurityProductExecute; +import com.ningdatech.carapi.company.entity.dto.CompanySecurityProductExecuteParam; +import com.ningdatech.carapi.company.mapper.CompanySecurityProductExecuteFileMapper; +import com.ningdatech.carapi.company.service.ICompanySecurityProductExecuteFileService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; + +/** + *

+ * 安全生产制度执行 服务实现类 + *

+ * + * @author CMM + * @since 2023-05-24 + */ +@Service +public class CompanySecurityProductExecuteFileServiceImpl extends ServiceImpl implements ICompanySecurityProductExecuteFileService { + + @Override + @BuildChildrenRegionWrapper(wrapperIndex = 1,entityIndex = 2) + @LambdaDataScope(wrapperIndex = 1,type = LambdaDataScopeTypeEnum.ONLY_REGION) + public Page pageDataScope(Page page, LambdaQueryWrapper wrapper, CompanySecurityProductExecuteParam param) { + return page(page,wrapper); + } + + @Override + @BuildChildrenRegionWrapper + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ONLY_REGION) + public List dataScopeList(LambdaQueryWrapper wrapper, CompanySecurityProductExecuteParam param) { + return baseMapper.selectList(wrapper); + } + + @Override + public void deleteById(Long id) { + baseMapper.deleteById(id); + } + + @Override + public Boolean incrementDownCount(Long id) { + return baseMapper.incrementDownCount(id) > 0; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanySecurityProductRegulationsFileServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanySecurityProductRegulationsFileServiceImpl.java new file mode 100644 index 0000000..1ac6f71 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanySecurityProductRegulationsFileServiceImpl.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.company.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.company.entity.CompanySecurityProductRegulation; +import com.ningdatech.carapi.company.entity.dto.CompanySecurityProductRegulationParam; +import com.ningdatech.carapi.company.mapper.CompanySecurityProductRegulationsFileMapper; +import com.ningdatech.carapi.company.service.ICompanySecurityProductRegulationsFileService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 安全生产制度体系 服务实现类 + *

+ * + * @author CMM + * @since 2023-05-24 + */ +@Service +public class CompanySecurityProductRegulationsFileServiceImpl extends ServiceImpl implements ICompanySecurityProductRegulationsFileService { + + @Override + @BuildChildrenRegionWrapper(wrapperIndex = 1,entityIndex = 2) + @LambdaDataScope(wrapperIndex = 1) + public Page pageDataScope(Page page, LambdaQueryWrapper wrapper, CompanySecurityProductRegulationParam param) { + return page(page,wrapper); + } + + @Override + @BuildChildrenRegionWrapper + @LambdaDataScope + public List dataScopeList(LambdaQueryWrapper wrapper, CompanySecurityProductRegulationParam param) { + return baseMapper.selectList(wrapper); + } + + @Override + public void deleteById(Long id) { + baseMapper.deleteById(id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyVehicleNotGetOnServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyVehicleNotGetOnServiceImpl.java new file mode 100644 index 0000000..ef71e52 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/CompanyVehicleNotGetOnServiceImpl.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.company.service.impl; + +import java.time.LocalDateTime; +import java.util.List; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.company.entity.CompanyVehicleNotGetOn; +import com.ningdatech.carapi.company.entity.dto.ReqNotGetOnCarDTO; +import com.ningdatech.carapi.company.entity.po.CompanyVehicleNotGetOnPO; +import com.ningdatech.carapi.company.mapper.CompanyVehicleNotGetOnMapper; +import com.ningdatech.carapi.company.service.ICompanyVehicleNotGetOnService; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * 上车表 服务实现类 + *

+ * + * @author CMM + * @since 2023-01-10 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class CompanyVehicleNotGetOnServiceImpl extends ServiceImpl implements ICompanyVehicleNotGetOnService { + + private final CompanyVehicleNotGetOnMapper companyVehicleNotGetOnMapper; + + @Override + public List getNotOnCarList(ReqNotGetOnCarDTO param) { + return companyVehicleNotGetOnMapper.getNotOnCarList(param); + } + + @Override + public String checkDataExistByDay(LocalDateTime queryTime) { + return companyVehicleNotGetOnMapper.checkDataExistByDay(queryTime); + } + + @Override + public void saveBatchNotGetOnList(List singleList) { + companyVehicleNotGetOnMapper.saveBatchNotGetOnList(singleList); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/ICompanyArchivesServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/ICompanyArchivesServiceImpl.java new file mode 100644 index 0000000..aed7e34 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/ICompanyArchivesServiceImpl.java @@ -0,0 +1,810 @@ +package com.ningdatech.carapi.company.service.impl; + +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.context.ApplicationContext; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.exception.code.ExceptionCode; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.analysis.common.DangerLevelEnum; +import com.ningdatech.carapi.analysis.entity.WarnAnalysisCompany; +import com.ningdatech.carapi.analysis.service.IWarnAnalysisCompanyService; +import com.ningdatech.carapi.archives.enums.AuditStateEnum; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.constant.EducationEnum; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.company.entity.CompanyBasicCredit; +import com.ningdatech.carapi.company.entity.CompanyEmployees; +import com.ningdatech.carapi.company.entity.CompanyVehicleNotGetOn; +import com.ningdatech.carapi.company.entity.NdCompanyCreditLevel; +import com.ningdatech.carapi.company.entity.dto.*; +import com.ningdatech.carapi.company.entity.vo.CompanyEmployeesVO; +import com.ningdatech.carapi.company.enumeration.CompanyCreditLevelEnum; +import com.ningdatech.carapi.company.enumeration.CompanyTypeEnum; +import com.ningdatech.carapi.company.enumeration.ProductCompanyType; +import com.ningdatech.carapi.company.service.*; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.driver.constant.UserCanLoginEnum; +import com.ningdatech.carapi.driver.constants.DriverConstant; +import com.ningdatech.carapi.open.model.vo.CompanySecurityInfoVO; +import com.ningdatech.carapi.scheduler.enums.DataTypeEnum; +import com.ningdatech.carapi.scheduler.enums.OperatorTypeEnum; +import com.ningdatech.carapi.sys.entity.*; +import com.ningdatech.carapi.sys.entity.dto.CompanyPageQuery; +import com.ningdatech.carapi.sys.entity.dto.CompanySaveDTO; +import com.ningdatech.carapi.sys.entity.vo.CompanyVO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.manage.CompanyManage; +import com.ningdatech.carapi.sys.service.*; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.security.auth.constant.AuthTypeEnum; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.DesensitizedUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @description: + * @author: liushuai + * @date: 2022/10/26 08:50 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class ICompanyArchivesServiceImpl implements ICompanyArchivesService { + private final CompanyManage companyManage; + private final CompanyService companyService; + private final ICompanyBasicCreditService iCompanyBasicCreditService; + private final IRegionService iRegionService; + private final ICompanyEmployeesService iCompanyEmployeesService; + private final CompanyTypeService companyTypeService; + private final CompanyTypeRelatedService companyTypeRelatedService; + private final ApplicationContext applicationContext; + private final ICompanyVehicleNotGetOnService companyVehicleNotGetOnService; + + private final INdCompanyCreditLevelService companyCreditLevelService; + private final IWarnAnalysisCompanyService warnAnalysisCompanyService; + private final RegionsCacheHelper regionCacheHelper; + private final CompaniesCacheHelper companiesCacheHelper; + private final INdUserInfoService userInfoService; + private final PasswordEncoder passwordEncoder; + private final INdUserAuthService ndUserAuthService; + private final UserRoleService userRoleService; + + @Override + public PageVo getCompanyList(CompanyListParamDTO param) { + CompanyPageQuery companyPageQuery = new CompanyPageQuery(); + + companyPageQuery.setCompanyTypeList(param.getCompanyTypeList()); + companyPageQuery.setCompanyType(param.getCompanyType()); + companyPageQuery.setProductCompanyType(param.getProductCompanyType()); + companyPageQuery.setName(param.getCompanyName()); + + companyPageQuery.setRegionId(param.getRegionId()); + companyPageQuery.setPageSize(param.getPageSize()); + companyPageQuery.setPageNumber(param.getPageNumber()); + PageVo pageVo = companyManage.queryList(companyPageQuery); + if (pageVo.getTotal() != null && 0L != pageVo.getTotal()) { + List res = pageVo.getRecords().stream().map(w -> { + ResCompanyArchivesDTO dto = new ResCompanyArchivesDTO(); + BeanUtil.copyProperties(w, dto); + dto.setCarCompanyType(w.getCompanyTypeName()); + return dto; + }).collect(Collectors.toList()); + return PageVo.of(res, pageVo.getTotal()); + } + return PageVo.empty(); + } + + @Override + public ResCompanyArchivesDetailsDTO getCompanyDetail(Long companyId) { + ResCompanyArchivesDetailsDTO companyArchivesDTO = new ResCompanyArchivesDetailsDTO(); + // 获取企业信息 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Company.class); + ICompanyArchivesServiceImpl context = (ICompanyArchivesServiceImpl) AopContext.currentProxy(); + context.buildQuery(wrapper, companyId); + Company company = companyService.getOne(wrapper); + if (Objects.isNull(company)) { + throw new BizException("企业不存在"); + } + //Company company = companyService.getById(companyId); + + BeanUtil.copyProperties(company, companyArchivesDTO); + // 对手机号进行脱敏处理 + String contactPhone = company.getContactPhone(); + String legalPersonPhone = company.getLegalPersonPhone(); + String encryptContactPhone = DesensitizedUtil.mobilePhone(contactPhone); + String encryptLegalPersonPhone = DesensitizedUtil.mobilePhone(legalPersonPhone); + companyArchivesDTO.setContactPhone(encryptContactPhone); + companyArchivesDTO.setLegalPersonPhone(encryptLegalPersonPhone); + companyArchivesDTO.setCompanyTypeName(CompanyTypeEnum.getDescByCode(company.getCompanyType())); + // 获取基础信息 + CompanyBasicCredit companyBasicCredit = + iCompanyBasicCreditService.getOne(new QueryWrapper().eq("company_id", companyId)); + BeanUtil.copyProperties(companyBasicCredit, companyArchivesDTO); + // 获取区域信息 + Region region = iRegionService.getById(company.getRegionId()); + companyArchivesDTO.setRegionCode(region.getRegionCode()); + String regionName = regionCacheHelper.getDisplayName(region.getId()); + companyArchivesDTO.setRegionName(regionName); + // 查询企业类型 + List companyTypeRelateds = companyTypeRelatedService + .list(Wrappers.lambdaQuery(CompanyTypeRelated.class).eq(CompanyTypeRelated::getCompanyId, companyId)); + if (CollUtil.isNotEmpty(companyTypeRelateds)) { + companyArchivesDTO.setCarCompanyType(companyTypeRelateds.stream() + .map(c -> String.valueOf(c.getCompanyTypeId())).collect(Collectors.joining(StrPool.COMMA))); + companyArchivesDTO.setCarCompanyTypeName(companyTypeRelateds.stream().map(r -> { + Long companyTypeId = r.getCompanyTypeId(); + CompanyType companyType = companyTypeService.getById(companyTypeId); + return Objects.nonNull(companyType) ? companyType.getName() : StringUtils.EMPTY; + }).filter(StringUtils::isNotBlank).collect(Collectors.joining(StrPool.COMMA))); + } + return companyArchivesDTO; + } + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ONLY_REGION) + public void buildQuery(LambdaQueryWrapper wrapper, Long companyId) { + wrapper.eq(Company::getId,companyId); + } + + @Override + public List getCompanyEmployees(Long companyId) { + List employeesList = iCompanyEmployeesService.list(new QueryWrapper().eq("company_id", companyId)); + return employeesList.stream().map(e -> { + CompanyEmployeesVO vo = new CompanyEmployeesVO(); + BeanUtils.copyProperties(e, vo); + + // 对手机号和身份证号进行脱敏处理 + String mobile = e.getMobile(); + String idCard = e.getCardNum(); + String encryptMobile = DesensitizedUtil.mobilePhone(mobile); + String encryptIdCard = DesensitizedUtil.idCardNum(idCard, DriverConstant.ID_CARD_DESENSITIZED_FRONT, DriverConstant.ID_CARD_DESENSITIZED_END); + vo.setMobile(encryptMobile); + vo.setCardNum(encryptIdCard); + + vo.setEducationName(EducationEnum.getDescByCode(vo.getEducation())); + return vo; + }).collect(Collectors.toList()); + } + + @Override + public void updateCompanyInfo(ReqCompanyArchivesDetailsDTO reqCompanyArchivesDetailsDTO) { + Company company = reqCompanyArchivesDetailsDTO.getCompany(); + // 更新企业信息 + Company companyCache = companyService.getById(company.getId()); + BeanUtil.copyProperties(company, companyCache); + List enterpriseTypes = reqCompanyArchivesDetailsDTO.getEnterpriseTypes(); + if (CollUtil.isNotEmpty(enterpriseTypes)) { + // 先删除原来关联的信息,再保存 + companyTypeRelatedService.remove(Wrappers.lambdaQuery(CompanyTypeRelated.class) + .eq(CompanyTypeRelated::getCompanyId, companyCache.getId())); + for (Long enterpriseType : enterpriseTypes) { + CompanyTypeRelated companyTypeRelated = new CompanyTypeRelated(); + companyTypeRelated.setCompanyId(companyCache.getId()); + companyTypeRelated.setCompanyTypeId(enterpriseType); + companyTypeRelatedService.save(companyTypeRelated); + } + } + companyService.updateById(companyCache); + CompanyBasicCredit companyBasicCredit = reqCompanyArchivesDetailsDTO.getCompanyBasicCredit(); + // 更新企业基础信息 + if (companyBasicCredit != null) { + CompanyBasicCredit companyBasicCreditCache = iCompanyBasicCreditService + .getOne(new QueryWrapper().eq("company_id", company.getId())); + BeanUtil.copyProperties(companyBasicCredit, companyCache); + iCompanyBasicCreditService.updateById(companyBasicCreditCache); + } + // 更新企业员工信息 + List companyEmployeesList = reqCompanyArchivesDetailsDTO.getCompanyEmployeesList(); + if (CollectionUtil.isNotEmpty(companyEmployeesList)) { + // 要先需不需要删除 + List oldEmployees = + iCompanyEmployeesService.list(Wrappers.lambdaQuery(CompanyEmployees.class) + .eq(CompanyEmployees::getCompanyId, companyEmployeesList.get(0).getCompanyId())); + Map employeesMap = CollUtils.listToMap(oldEmployees, CompanyEmployees::getId); + for (CompanyEmployees companyEmployee : companyEmployeesList) { + if (Objects.nonNull(companyEmployee.getId()) && employeesMap.containsKey(companyEmployee.getId())) { + oldEmployees.remove(employeesMap.get(companyEmployee.getId())); + } + iCompanyEmployeesService.saveOrUpdate(companyEmployee); + } + + if (CollUtil.isNotEmpty(oldEmployees)) { + // 说明有要删除的 + for (CompanyEmployees companyEmployee : oldEmployees) { + iCompanyEmployeesService.removeById(companyEmployee.getId()); + log.info("触发删除员工事件 :{}", JSON.toJSONString(companyEmployee)); + } + } + } + // 公司类型 + if (StringUtils.isNotEmpty(company.getCarCompanyType())) { + companyTypeRelatedService.remove( + Wrappers.lambdaQuery(CompanyTypeRelated.class).eq(CompanyTypeRelated::getCompanyId, company.getId())); + String carCompanyType = company.getCarCompanyType(); + for (String enterpriseType : carCompanyType.split(StrPool.COMMA)) { + CompanyType companyType = companyTypeService.getById(enterpriseType); + if (Objects.nonNull(companyType)) { + companyTypeRelatedService.save(new CompanyTypeRelated(null, company.getId(), companyType.getId())); + } + } + } + } + + @Override + public PageVo getCompanyEmployeesList(CompanyListParamDTO param) { + PageVo page = new PageVo<>(); + CompanyPageQuery companyPageQuery = new CompanyPageQuery(); + companyPageQuery.setRegionId(param.getRegionId()); + companyPageQuery.setName(param.getCompanyName()); + companyPageQuery.setPageNumber(param.getPageNumber()); + companyPageQuery.setPageSize(param.getPageSize()); + PageVo pageVo = companyManage.queryList(companyPageQuery); + if (CollUtil.isEmpty(pageVo.getRecords())) { + return PageVo.empty(); + } + List countDtos = iCompanyEmployeesService.countEmployeesByCompanyIds( + pageVo.getRecords().stream().map(CompanyVO::getId).collect(Collectors.toList())); + + page.setTotal(pageVo.getTotal()); + page.setRecords(countDtos); + return page; + } + + @Override + public PageVo getCompanyBasicCreditList(CompanyListParamDTO param) { + PageVo page = new PageVo<>(); + List result = new ArrayList<>(); + CompanyPageQuery companyPageQuery = new CompanyPageQuery(); + companyPageQuery.setRegionId(param.getRegionId()); + companyPageQuery.setName(param.getCompanyName()); + companyPageQuery.setPageNumber(param.getPageNumber()); + companyPageQuery.setPageSize(param.getPageSize()); + // 筛选掉管理企业 + companyPageQuery.setCompanyTypeList(Lists.newArrayList(1, 2, 3)); + PageVo pageVo = companyManage.queryList(companyPageQuery); + // 获取企业信用信息 + Map> listMap = companyCreditLevelService.list().stream() + .collect(Collectors.groupingBy(NdCompanyCreditLevel::getCompanyId)); + if (pageVo.getTotal() != null && 0L != pageVo.getTotal()) { + List companyVOList = new ArrayList<>(pageVo.getRecords()); + for (CompanyVO companyVO : companyVOList) { + ResCompanyBasicCreditDTO resCompanyBasicCreditDTO = new ResCompanyBasicCreditDTO(); + BeanUtil.copyProperties(companyVO, resCompanyBasicCreditDTO); + Company company = companyService.getById(companyVO.getId()); + BeanUtil.copyProperties(company, resCompanyBasicCreditDTO); + resCompanyBasicCreditDTO.setRegionName(companyVO.getRegionName()); + resCompanyBasicCreditDTO.setCarCompanyType(CompanyTypeEnum.getDescByCode(company.getCompanyType())); + resCompanyBasicCreditDTO.setDutyParagraph(company.getBusinessLicense()); + List creditLevelList = listMap.get(companyVO.getId()); + if (CollUtil.isNotEmpty(creditLevelList)) { + String year = String.valueOf(LocalDateTime.now().getYear()); + // 筛选当前年份的数据 + List levels = + creditLevelList.stream().filter(c -> year.equals(c.getYear())).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(levels)) { + NdCompanyCreditLevel creditLevel = levels.get(0); + resCompanyBasicCreditDTO.setBasicCreditScore(creditLevel.getBasicCreditScore()); + } + } else { + // 信用表中不存在该企业,设为0 + log.info("企业信息等级表中不存在该企业{}", companyVO.getId()); + resCompanyBasicCreditDTO.setBasicCreditScore(0); + } + result.add(resCompanyBasicCreditDTO); + } + } + page.setTotal(pageVo.getTotal()); + page.setRecords(result); + return page; + } + + @Override + public ResCompanyBasicCreditDetailDTO getCompanyBasicCreditDetail(Long companyId) { + ResCompanyBasicCreditDetailDTO resCompanyBasicCreditDetailDTO = new ResCompanyBasicCreditDetailDTO(); + // 获取企业信息 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Company.class); + ICompanyArchivesServiceImpl context = (ICompanyArchivesServiceImpl) AopContext.currentProxy(); + context.buildQuery(wrapper, companyId); + Company company = companyService.getOne(wrapper); + if (Objects.isNull(company)) { + throw new BizException("企业不存在"); + } + //Company company = companyService.getById(companyId); + + BeanUtil.copyProperties(company, resCompanyBasicCreditDetailDTO); + + // 对手机号和身份证号进行脱敏处理 + String contactPhone = company.getContactPhone(); + String encryptPhone = DesensitizedUtil.mobilePhone(contactPhone); + resCompanyBasicCreditDetailDTO.setContactPhone(encryptPhone); + + CompanyBasicCredit companyBasicCredit = + iCompanyBasicCreditService.getOne(new QueryWrapper().eq("company_id", companyId)); + BeanUtil.copyProperties(companyBasicCredit, resCompanyBasicCreditDetailDTO); + if (company.getRegionId() != null && 0L != company.getRegionId()) { + Region region = iRegionService.getById(company.getRegionId()); + resCompanyBasicCreditDetailDTO.setRegionCode(region.getRegionCode()); + } + return resCompanyBasicCreditDetailDTO; + } + + @Override + public PageVo getCompanyCommonCreditList(CompanyListParamDTO param) { + PageVo page = new PageVo<>(); + List result = new ArrayList<>(); + CompanyPageQuery companyPageQuery = new CompanyPageQuery(); + companyPageQuery.setRegionId(param.getRegionId()); + companyPageQuery.setName(param.getCompanyName()); + companyPageQuery.setPageNumber(param.getPageNumber()); + companyPageQuery.setPageSize(param.getPageSize()); + companyPageQuery.setBlackList(param.getBlackList()); + PageVo pageVo = companyManage.queryList(companyPageQuery); + // 获取企业信用信息 + Map> listMap = companyCreditLevelService.list().stream() + .collect(Collectors.groupingBy(NdCompanyCreditLevel::getCompanyId)); + if (pageVo.getTotal() != null && 0L != pageVo.getTotal()) { + List companyVOList = new ArrayList<>(pageVo.getRecords()); + for (CompanyVO companyVO : companyVOList) { + ResCompanyCommonCreditDTO resCompanyCommonCreditDTO = new ResCompanyCommonCreditDTO(); + BeanUtil.copyProperties(companyVO, resCompanyCommonCreditDTO); + List creditLevelList = listMap.get(companyVO.getId()); + if (CollUtil.isNotEmpty(creditLevelList)) { + String year = String.valueOf(LocalDateTime.now().getYear()); + // 筛选当前年份的数据 + List levels = + creditLevelList.stream().filter(c -> year.equals(c.getYear())).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(levels)) { + NdCompanyCreditLevel creditLevel = levels.get(0); + resCompanyCommonCreditDTO.setCommonCreditScore(creditLevel.getCommonCreditScore()); + } + } else { + // 信用表中不存在该企业,设为0 + log.info("企业信息等级表中不存在该企业{}", companyVO.getId()); + resCompanyCommonCreditDTO.setCommonCreditScore(0); + } + result.add(resCompanyCommonCreditDTO); + } + } + page.setTotal(pageVo.getTotal()); + page.setRecords(result); + return page; + } + + @Override + public void companyListExport(HttpServletResponse response, CompanyListParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = getCompanyList(param); + + List collect = (List)page.getRecords(); + + String fileName = "企业列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), ResCompanyArchivesDTO.class).autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()).sheet(fileName).doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @Override + public void companyBasicCreditListExport(HttpServletResponse response, CompanyListParamDTO param) { + PageVo page = getCompanyBasicCreditList(param); + List collect = (List)page.getRecords(); + String fileName = "企业基本信用列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), ResCompanyBasicCreditDTO.class).autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()).sheet(fileName).doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @Override + public void companyCommonCreditListExport(HttpServletResponse response, CompanyListParamDTO param) { + PageVo page = getCompanyCommonCreditList(param); + List collect = (List)page.getRecords(); + String fileName = "企业公共信用列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), ResCompanyCommonCreditDTO.class).autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()).sheet(fileName).doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @Override + public void companyCertificateInformationListExport(HttpServletResponse response, CompanyListParamDTO param) { + param.setPageNumber(1); + param.setPageSize(10000); + PageVo page = getCompanyList(param); + List collect = (List)page.getRecords(); + + String fileName = "企业证书信息列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), ResCompanyArchivesDTO.class).autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()).sheet(fileName).doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @Override + public PageVo getNotOnCarList(ReqNotGetOnCarDTO param) { + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(CompanyVehicleNotGetOn.class); + ICompanyArchivesServiceImpl context = (ICompanyArchivesServiceImpl) AopContext.currentProxy(); + context.buildNotOnCarQuery(wrapper,param); + Page notGetOnPage = companyVehicleNotGetOnService.page(page, wrapper); + List resData = notGetOnPage.getRecords().stream().map(c -> { + ResNotGetOnCarRecordDTO res = new ResNotGetOnCarRecordDTO(); + res.setId(c.getId()); + res.setCarPlate(c.getCarPlate()); + res.setTime(c.getTime()); + return res; + }).collect(Collectors.toList()); + return PageVo.of(resData, page.getTotal()); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ONLY_COMPANY) + public void buildNotOnCarQuery(LambdaQueryWrapper wrapper, ReqNotGetOnCarDTO param) { + wrapper.eq(CompanyVehicleNotGetOn::getCompanyId, param.getCompanyId()) + .eq(Objects.nonNull(param.getCarPlate()), CompanyVehicleNotGetOn::getCarPlate, param.getCarPlate()) + .eq(Objects.nonNull(param.getQueryTime()), CompanyVehicleNotGetOn::getTime, param.getQueryTime()); + } + + @Override + public CompanySecurityInfoVO getCompanySecurityInfo(Long companyId) { + CompanySecurityInfoVO vo = new CompanySecurityInfoVO(); + // 默认显示查询时间所在年度的信用等级 + String year = String.valueOf(LocalDateTime.now().getYear()); + // 获取企业信用等级信息 + NdCompanyCreditLevel creditLevel = + companyCreditLevelService.getOne(Wrappers.lambdaQuery(NdCompanyCreditLevel.class) + .eq(NdCompanyCreditLevel::getCompanyId, companyId).eq(NdCompanyCreditLevel::getYear, year)); + if (Objects.nonNull(creditLevel)) { + vo.setCreditLevel(creditLevel.getLevel()); + vo.setCreditLevelName(CompanyCreditLevelEnum.getDescByCode(creditLevel.getLevel())); + vo.setCompanyCreditEvaluateTotalScore(creditLevel.getScore()); + vo.setCommonCreditScore(creditLevel.getCommonCreditScore()); + vo.setBasicCreditScore(creditLevel.getBasicCreditScore()); + vo.setSafeProductCreditScore(creditLevel.getSafeProductCreditScore()); + vo.setIndustryRegulateCreditScore(creditLevel.getIndustryRegulateCreditScore()); + vo.setIndustryHonorBonus(creditLevel.getIndustryHonorBonus()); + } + + // 获取企业风险等级信息 + WarnAnalysisCompany warnAnalysisCompany = warnAnalysisCompanyService + .getOne(Wrappers.lambdaQuery(WarnAnalysisCompany.class).eq(WarnAnalysisCompany::getCompanyId, companyId)); + if (Objects.nonNull(warnAnalysisCompany)) { + vo.setDangerLevel(warnAnalysisCompany.getDangerLevel()); + vo.setDangerLevelName(DangerLevelEnum.getDescByCode(warnAnalysisCompany.getDangerLevel())); + vo.setCompanySafeRiskScore(warnAnalysisCompany.getTotalScore()); + vo.setViolationCnt(warnAnalysisCompany.getViolationCount()); + vo.setOutDangerCnt(warnAnalysisCompany.getDangerCount()); + vo.setInjuryCnt(warnAnalysisCompany.getInjuredCount()); + vo.setDeadCnt(warnAnalysisCompany.getDeadCount()); + } + return vo; + } + + public Company saveCompany(CompanySaveDTO data) { + Company company = companyService.save(data, null); + companiesCacheHelper.refresh(company.getId()); + return company; + } + + @Override + public PageVo queryToBeAudit(CompanyAuditPageQuery param) { + + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + Integer productCompanyType = param.getProductCompanyType(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Company.class); + ICompanyArchivesServiceImpl context = (ICompanyArchivesServiceImpl)AopContext.currentProxy(); + // 判断登录用户的角色 + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + // 如果是区县管理员 + if (UserRoleTypeEnum.REGION_ADMIN_ROLE_ID.getId().equals(roleId)) { + context.searchRegionTobeAuditWrapper(wrapper, param); + } else if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(roleId)) { + context.searchCityTobeAuditWrapper(wrapper, param); + } else if (UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId) || + UserRoleTypeEnum.SYSTEM_ROLE_ID.getId().equals(roleId)){ + context.searchAllTobeAuditWrapper(wrapper,param); + } else { + return PageVo.empty(); + } + List companyList = companyService.list(wrapper); + Map> companyTypeRelatedMap = + companyTypeRelatedService.list().stream().collect(Collectors.groupingBy(CompanyTypeRelated::getCompanyId)); + + // 如果具体到生产企业类型筛选 + if (Objects.nonNull(productCompanyType)) { + // 从企业类型关联表中查出对应的企业 + List relatedList = companyTypeRelatedService.list().stream().filter(c -> { + Long value = productCompanyType.longValue(); + Long companyTypeId = c.getCompanyTypeId(); + if (value.equals(companyTypeId)) { + return true; + } + return false; + }).collect(Collectors.toList()); + // 去重 + List companies = + relatedList.stream().map(CompanyTypeRelated::getCompanyId).distinct().collect(Collectors.toList()); + if (CollUtil.isNotEmpty(companies)) { + companyList = + companyList.stream().filter(d -> companies.contains(d.getId())).collect(Collectors.toList()); + } + } + + List records = + companyList.stream().skip((long)(pageNumber - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); + + List res = records.stream().map(w -> { + ResCompanyArchivesDTO dto = new ResCompanyArchivesDTO(); + BeanUtil.copyProperties(w, dto); + CodeUtil.searchRegionName(dto); + if (Objects.nonNull(w.getCompanyType())) { + // 如果是生产企业,展示具体的企业类型 + if (CompanyTypeEnum.PRODUCT_BU.getCode().equals(w.getCompanyType())) { + List relatedList = companyTypeRelatedMap.get(w.getId()); + List nameList = relatedList.stream() + .map(r -> ProductCompanyType.getDescByCode(r.getCompanyTypeId())).collect(Collectors.toList()); + String typeName = nameList.stream().collect(Collectors.joining(StrPool.COMMA)); + dto.setCarCompanyType(typeName); + } else { + dto.setCarCompanyType(CompanyTypeEnum.getDescByCode(w.getCompanyType())); + } + } + return dto; + }).collect(Collectors.toList()); + return PageVo.of(res, companyList.size()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + private void searchAllTobeAuditWrapper(LambdaQueryWrapper wrapper, CompanyAuditPageQuery param) { + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()), Company::getBankName, param.getCompanyName()) + .eq(Objects.nonNull(param.getCompanyType()), Company::getCompanyType, param.getCompanyType()) + .eq(Objects.nonNull(param.getAuditStatus()), Company::getCityAuditStatus, param.getAuditStatus()) + .and(wp -> wp.eq(Company::getCityAuditStatus, AuditStateEnum.AUDIT.getCode()) + .or() + .eq(Company::getRegionAuditStatus,AuditStateEnum.AUDIT.getCode())) + .orderBy(Boolean.TRUE, Boolean.FALSE, Company::getUpdateOn); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void searchCityTobeAuditWrapper(LambdaQueryWrapper wrapper, CompanyAuditPageQuery param) { + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()), Company::getBankName, param.getCompanyName()) + .eq(Objects.nonNull(param.getCompanyType()), Company::getCompanyType, param.getCompanyType()) + .eq(Objects.nonNull(param.getAuditStatus()), Company::getCityAuditStatus, param.getAuditStatus()) + .eq(Company::getCityAuditStatus, AuditStateEnum.AUDIT.getCode()) + .orderBy(Boolean.TRUE, Boolean.FALSE, Company::getUpdateOn); + } + + @Override + public PageVo queryAuditedList(CompanyAuditPageQuery param) { + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + Integer productCompanyType = param.getProductCompanyType(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Company.class); + ICompanyArchivesServiceImpl context = (ICompanyArchivesServiceImpl)AopContext.currentProxy(); + // 判断登录用户的角色 + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + // 如果是区县管理员 + if (UserRoleTypeEnum.REGION_ADMIN_ROLE_ID.getId().equals(roleId)) { + context.searchRegionAuditedWrapper(wrapper, param); + } else if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(roleId)) { + context.searchCityAuditedWrapper(wrapper, param); + }else if (UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId) || + UserRoleTypeEnum.SYSTEM_ROLE_ID.getId().equals(roleId)) { + context.searchAllAuditedWrapper(wrapper, param); + } else { + return PageVo.empty(); + } + + List companyList = companyService.list(wrapper); + Map> companyTypeRelatedMap = + companyTypeRelatedService.list().stream().collect(Collectors.groupingBy(CompanyTypeRelated::getCompanyId)); + + // 如果具体到生产企业类型筛选 + if (Objects.nonNull(productCompanyType)) { + // 从企业类型关联表中查出对应的企业 + List relatedList = companyTypeRelatedService.list().stream().filter(c -> { + Long value = productCompanyType.longValue(); + Long companyTypeId = c.getCompanyTypeId(); + if (value.equals(companyTypeId)) { + return true; + } + return false; + }).collect(Collectors.toList()); + // 去重 + List companies = + relatedList.stream().map(CompanyTypeRelated::getCompanyId).distinct().collect(Collectors.toList()); + if (CollUtil.isNotEmpty(companies)) { + companyList = + companyList.stream().filter(d -> companies.contains(d.getId())).collect(Collectors.toList()); + } + } + + List records = + companyList.stream().skip((long)(pageNumber - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); + + List res = records.stream().map(w -> { + ResCompanyArchivesDTO dto = new ResCompanyArchivesDTO(); + BeanUtil.copyProperties(w, dto); + CodeUtil.searchRegionName(dto); + if (Objects.nonNull(w.getCompanyType())) { + // 如果是生产企业,展示具体的企业类型 + if (CompanyTypeEnum.PRODUCT_BU.getCode().equals(w.getCompanyType())) { + List relatedList = companyTypeRelatedMap.get(w.getId()); + List nameList = relatedList.stream() + .map(r -> ProductCompanyType.getDescByCode(r.getCompanyTypeId())).collect(Collectors.toList()); + String typeName = nameList.stream().collect(Collectors.joining(StrPool.COMMA)); + dto.setCarCompanyType(typeName); + } else { + dto.setCarCompanyType(CompanyTypeEnum.getDescByCode(w.getCompanyType())); + } + } + return dto; + }).collect(Collectors.toList()); + return PageVo.of(res, companyList.size()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + private void searchAllAuditedWrapper(LambdaQueryWrapper wrapper, CompanyAuditPageQuery param) { + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()), Company::getBankName, param.getCompanyName()) + .eq(Objects.nonNull(param.getCompanyType()), Company::getCompanyType, param.getCompanyType()) + .eq(Objects.nonNull(param.getAuditStatus()), Company::getCityAuditStatus, param.getAuditStatus()) + .and(wp -> wp.eq(Company::getCityAuditStatus, AuditStateEnum.AUDIT_SUCCESS.getCode()) + .or() + .eq(Company::getCityAuditStatus, AuditStateEnum.AUDIT_FAIL.getCode()) + .or() + .eq(Company::getRegionAuditStatus, AuditStateEnum.AUDIT_SUCCESS.getCode()) + .or() + .eq(Company::getRegionAuditStatus, AuditStateEnum.AUDIT_FAIL.getCode())) + .orderBy(Boolean.TRUE, Boolean.FALSE, Company::getUpdateOn); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void searchCityAuditedWrapper(LambdaQueryWrapper wrapper, CompanyAuditPageQuery param) { + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()), Company::getBankName, param.getCompanyName()) + .eq(Objects.nonNull(param.getCompanyType()), Company::getCompanyType, param.getCompanyType()) + .eq(Objects.nonNull(param.getAuditStatus()), Company::getCityAuditStatus, param.getAuditStatus()) + .and(wp -> wp.eq(Company::getCityAuditStatus, AuditStateEnum.AUDIT_SUCCESS.getCode()).or() + .eq(Company::getCityAuditStatus, AuditStateEnum.AUDIT_FAIL.getCode())) + .orderBy(Boolean.TRUE, Boolean.FALSE, Company::getUpdateOn); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean audit(CompanyAuditDTO data, Long userId) { + VUtils.isTrue(!AuditStateEnum.AUDIT_SUCCESS.getCode().equals(data.getAuditStatus()) + && !AuditStateEnum.AUDIT_FAIL.getCode().equals(data.getAuditStatus())).throwMessage("请确认传入的审核code正确"); + Company company = companyService.getById(data.getId()); + VUtils.isTrueFormat(Objects.isNull(company)).throwMessage(ExceptionCode.OPERATION_EX.getCode(), "修改企业 {} 为空", + data.getId()); + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + // 如果是区县散办管理员 + if (UserRoleTypeEnum.REGION_ADMIN_ROLE_ID.getId().equals(roleId)) { + company.setRegionAuditStatus(data.getAuditStatus()); + company.setRegionAuditBy(userId); + company.setRegionAuditTime(LocalDateTime.now()); + company.setRegionAuditMind(data.getAuditMind()); + } + // 当且仅当登录用户是市级散办管理员账号,且审核通过,才更新企业审核状态为通过,并创建企业账号信息 + else if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(roleId)) { + company.setCityAuditStatus(data.getAuditStatus()); + company.setCityAuditBy(userId); + company.setCityAuditTime(LocalDateTime.now()); + company.setCityAuditMind(data.getAuditMind()); + // 市散办审核通过 + if (AuditStateEnum.AUDIT_SUCCESS.getCode().equals(data.getAuditStatus())) { + // 创建企业用户账号 + NdUserInfo userInfo = new NdUserInfo(); + userInfo.setCanLogin(UserCanLoginEnum.CAN_LOGIN.getCode()); + userInfo.setUsername(company.getName()); + userInfo.setCompanyId(company.getId()); + userInfo.setCreateOn(LocalDateTime.now()); + userInfo.setUpdateOn(LocalDateTime.now()); + userInfoService.save(userInfo); + + Long userInfoId = userInfo.getId(); + NdUserAuth userAuth = new NdUserAuth(); + userAuth.setUserId(userInfoId); + userAuth.setIdentifier(company.getName()); + userAuth.setCredential(passwordEncoder.encode("123456Aa")); + userAuth.setAuthType(AuthTypeEnum.ACCOUNT_PASSWORD.getKey()); + userAuth.setIsAvailable(true); + ndUserAuthService.save(userAuth); + + UserRole userRole = new UserRole(); + userRole.setUserId(userInfoId); + userRole.setRoleId(UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId()); + userRoleService.save(userRole); + } + + } + // 最后修改人 + company.setUpdateBy(userId); + company.setUpdateOn(LocalDateTime.now()); + return companyService.updateById(company); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void searchRegionAuditedWrapper(LambdaQueryWrapper wrapper, CompanyAuditPageQuery param) { + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()), Company::getBankName, param.getCompanyName()) + .eq(Objects.nonNull(param.getCompanyType()), Company::getCompanyType, param.getCompanyType()) + .eq(Objects.nonNull(param.getAuditStatus()), Company::getRegionAuditStatus, param.getAuditStatus()) + .and(wp -> wp.eq(Company::getRegionAuditStatus, AuditStateEnum.AUDIT_SUCCESS.getCode()).or() + .eq(Company::getRegionAuditStatus, AuditStateEnum.AUDIT_FAIL.getCode())) + .orderBy(Boolean.TRUE, Boolean.FALSE, Company::getUpdateOn); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void searchRegionTobeAuditWrapper(LambdaQueryWrapper wrapper, CompanyAuditPageQuery param) { + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()), Company::getBankName, param.getCompanyName()) + .eq(Objects.nonNull(param.getCompanyType()), Company::getCompanyType, param.getCompanyType()) + .eq(Objects.nonNull(param.getAuditStatus()), Company::getRegionAuditStatus, param.getAuditStatus()) + .eq(Company::getRegionAuditStatus, AuditStateEnum.AUDIT.getCode()) + .orderBy(Boolean.TRUE, Boolean.FALSE, Company::getUpdateOn); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyBlackListServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyBlackListServiceImpl.java new file mode 100644 index 0000000..ea9ee3c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyBlackListServiceImpl.java @@ -0,0 +1,83 @@ +package com.ningdatech.carapi.company.service.impl; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.company.entity.NdCompanyBlackList; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditBlackListPageParam; +import com.ningdatech.carapi.company.entity.dto.ResCompanyBlackDetailListDTO; +import com.ningdatech.carapi.company.entity.dto.ResCompanyBlackListDTO; +import com.ningdatech.carapi.company.mapper.NdCompanyBlackListMapper; +import com.ningdatech.carapi.company.service.INdCompanyBlackListService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; + +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 企业失信名单 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@Service +@RequiredArgsConstructor +public class NdCompanyBlackListServiceImpl extends ServiceImpl implements INdCompanyBlackListService { + + private final NdCompanyBlackListMapper ndCompanyBlackListMapper; + + @Override + public Page companyBlackList(CompanyCreditBlackListPageParam param) { + Page page = param.page(); + NdCompanyBlackListServiceImpl context = (NdCompanyBlackListServiceImpl) AopContext.currentProxy(); + return context.searchList(page,param); + } + + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public Page searchList(Page page, CompanyCreditBlackListPageParam param) { + ndCompanyBlackListMapper.companyBlackList(page, param); + CodeUtil.searchCompanyNames(page.getRecords()); + return page; + } + + @Override + public List companyBlackInfoList(Long companyId) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdCompanyBlackList.class); + NdCompanyBlackListServiceImpl context = (NdCompanyBlackListServiceImpl) AopContext.currentProxy(); + context.buildQuery(wrapper, companyId); + List companyBlackLists = ndCompanyBlackListMapper.selectList(wrapper); + if (CollUtil.isEmpty(companyBlackLists)){ + return Collections.emptyList(); + } + return companyBlackLists.stream().map(c -> { + ResCompanyBlackDetailListDTO dto = new ResCompanyBlackDetailListDTO(); + dto.setType(c.getType()); + dto.setBlackTime(c.getBlackTime()); + dto.setContent(c.getContent()); + dto.setSite(c.getSite()); + return dto; + }).collect(Collectors.toList()); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long companyId) { + wrapper.eq(NdCompanyBlackList::getCompanyId,companyId) + .orderByDesc(NdCompanyBlackList::getId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyCreditDeductServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyCreditDeductServiceImpl.java new file mode 100644 index 0000000..f2f8e75 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyCreditDeductServiceImpl.java @@ -0,0 +1,76 @@ +package com.ningdatech.carapi.company.service.impl; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.company.entity.NdCompanyCreditDeduct; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditDeductPageParam; +import com.ningdatech.carapi.company.mapper.NdCompanyCreditDeductMapper; +import com.ningdatech.carapi.company.service.INdCompanyCreditDeductService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; + +import lombok.RequiredArgsConstructor; + +/** + *

+ * 平安办扣分 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@Service +@RequiredArgsConstructor +public class NdCompanyCreditDeductServiceImpl extends ServiceImpl implements INdCompanyCreditDeductService { + + private final NdCompanyCreditDeductMapper ndCompanyCreditDeductMapper; + + @Override + public Page getCreditDeductList(CompanyCreditDeductPageParam param) { + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdCompanyCreditDeduct.class); + NdCompanyCreditDeductServiceImpl context = (NdCompanyCreditDeductServiceImpl) AopContext.currentProxy(); + Page ndCompanyCreditDeductPage = context.searchList(page, wrapper, param); + CodeUtil.searchCompanyNamesAndRegionNames(page.getRecords()); + return ndCompanyCreditDeductPage; + } + + @Override + public Boolean delete(Long id) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdCompanyCreditDeduct.class); + NdCompanyCreditDeductServiceImpl context = (NdCompanyCreditDeductServiceImpl) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + NdCompanyCreditDeduct creditDeduct = ndCompanyCreditDeductMapper.selectOne(wrapper); + if (Objects.isNull(creditDeduct)){ + return false; + } + ndCompanyCreditDeductMapper.deleteById(creditDeduct); + return true; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(NdCompanyCreditDeduct::getId,id); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public Page searchList(Page page, LambdaQueryWrapper wrapper + , CompanyCreditDeductPageParam param) { + wrapper.like(StringUtils.isNotEmpty(param.getCompanyName()),NdCompanyCreditDeduct::getCompanyName, param.getCompanyName()) + .ge(StringUtils.isNotEmpty(param.getStartTime()),NdCompanyCreditDeduct::getCreateOn, param.getStartTime()) + .le(StringUtils.isNotEmpty(param.getEndTime()),NdCompanyCreditDeduct::getCreateOn, param.getEndTime()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdCompanyCreditDeduct::getUpdateOn); + return ndCompanyCreditDeductMapper.selectPage(page, wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyCreditInsideServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyCreditInsideServiceImpl.java new file mode 100644 index 0000000..c937dab --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyCreditInsideServiceImpl.java @@ -0,0 +1,78 @@ +package com.ningdatech.carapi.company.service.impl; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.company.entity.NdCompanyCreditInside; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditInsidePageParam; +import com.ningdatech.carapi.company.mapper.NdCompanyCreditInsideMapper; +import com.ningdatech.carapi.company.service.INdCompanyCreditInsideService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; + +import lombok.RequiredArgsConstructor; + +/** + *

+ * 内部/联合检查 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@Service +@RequiredArgsConstructor +public class NdCompanyCreditInsideServiceImpl extends ServiceImpl implements INdCompanyCreditInsideService { + + private final NdCompanyCreditInsideMapper ndCompanyCreditInsideMapper; + + @Override + public Page getList(CompanyCreditInsidePageParam param) { + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdCompanyCreditInside.class); + NdCompanyCreditInsideServiceImpl context = (NdCompanyCreditInsideServiceImpl)AopContext.currentProxy(); + return context.searchList(page,wrapper,param); + } + + @Override + public Boolean delete(Long id) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdCompanyCreditInside.class); + NdCompanyCreditInsideServiceImpl context = (NdCompanyCreditInsideServiceImpl) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + NdCompanyCreditInside creditInside = ndCompanyCreditInsideMapper.selectOne(wrapper); + if (Objects.isNull(creditInside)){ + return false; + } + ndCompanyCreditInsideMapper.deleteById(creditInside); + return true; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(NdCompanyCreditInside::getId,id); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public Page searchList(Page page,LambdaQueryWrapper wrapper + ,CompanyCreditInsidePageParam param) { + wrapper.eq(NdCompanyCreditInside::getCheckType, param.getCheckType()) + .like(StringUtils.isNotEmpty(param.getCompanyName()),NdCompanyCreditInside::getCompanyName, param.getCompanyName()) + .eq(StringUtils.isNotEmpty(param.getType()),NdCompanyCreditInside::getType, param.getType()) + .ge(StringUtils.isNotEmpty(param.getStartTime()),NdCompanyCreditInside::getCreateOn, param.getStartTime()) + .le(StringUtils.isNotEmpty(param.getEndTime()),NdCompanyCreditInside::getCreateOn, param.getEndTime()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdCompanyCreditInside::getUpdateOn); + Page res = ndCompanyCreditInsideMapper.selectPage(page, wrapper); + CodeUtil.searchCompanyNamesAndRegionNames(res.getRecords()); + return res; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyCreditLevelServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyCreditLevelServiceImpl.java new file mode 100644 index 0000000..293f88e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyCreditLevelServiceImpl.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.company.service.impl; + +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.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.company.entity.NdCompanyCreditLevel; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditLevelPageParam; +import com.ningdatech.carapi.company.mapper.NdCompanyCreditLevelMapper; +import com.ningdatech.carapi.company.service.INdCompanyCreditLevelService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +/** + *

+ * 信用等级 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@Service +@RequiredArgsConstructor +public class NdCompanyCreditLevelServiceImpl extends ServiceImpl implements INdCompanyCreditLevelService { + + private final NdCompanyCreditLevelMapper ndCompanyCreditLevelMapper; + + @Override + public Page getCreditLevelList(CompanyCreditLevelPageParam param) { + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdCompanyCreditLevel.class); + NdCompanyCreditLevelServiceImpl context = (NdCompanyCreditLevelServiceImpl) AopContext.currentProxy(); + return context.searchList(page,wrapper,param); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public Page searchList(Page page, + LambdaQueryWrapper wrapper, CompanyCreditLevelPageParam param) { + wrapper.like(StringUtils.isNotEmpty(param.getCompanyName()),NdCompanyCreditLevel::getCompanyName, param.getCompanyName()) + .eq(StringUtils.isNotEmpty(param.getYear()),NdCompanyCreditLevel::getYear, param.getYear()) + .eq(StringUtils.isNotEmpty(param.getLevel()),NdCompanyCreditLevel::getLevel, param.getLevel()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdCompanyCreditLevel::getUpdateOn); + ndCompanyCreditLevelMapper.selectPage(page, wrapper); + CodeUtil.searchCompanyNamesAndRegionNames(page.getRecords()); + return page; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyCreditRewardServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyCreditRewardServiceImpl.java new file mode 100644 index 0000000..f74392f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyCreditRewardServiceImpl.java @@ -0,0 +1,75 @@ +package com.ningdatech.carapi.company.service.impl; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.company.entity.NdCompanyCreditReward; +import com.ningdatech.carapi.company.entity.dto.CompanyCreditRewardPageParam; +import com.ningdatech.carapi.company.mapper.NdCompanyCreditRewardMapper; +import com.ningdatech.carapi.company.service.INdCompanyCreditRewardService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; + +import lombok.RequiredArgsConstructor; + +/** + *

+ * 政府/行业嘉奖 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@Service +@RequiredArgsConstructor +public class NdCompanyCreditRewardServiceImpl extends ServiceImpl implements INdCompanyCreditRewardService { + + private final NdCompanyCreditRewardMapper ndCompanyCreditRewardMapper; + + @Override + public Page getCreditRewardList(CompanyCreditRewardPageParam param) { + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdCompanyCreditReward.class); + NdCompanyCreditRewardServiceImpl context = (NdCompanyCreditRewardServiceImpl) AopContext.currentProxy(); + return context.searchList(page,wrapper,param); + } + + @Override + public Boolean delete(Long id) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdCompanyCreditReward.class); + NdCompanyCreditRewardServiceImpl context = (NdCompanyCreditRewardServiceImpl) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + NdCompanyCreditReward creditReward = ndCompanyCreditRewardMapper.selectOne(wrapper); + if (Objects.isNull(creditReward)){ + return false; + } + ndCompanyCreditRewardMapper.deleteById(creditReward); + return true; + } + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(NdCompanyCreditReward::getId,id); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public Page searchList(Page page, LambdaQueryWrapper wrapper, CompanyCreditRewardPageParam param) { + wrapper.eq(NdCompanyCreditReward::getRewardType, param.getRewardType()) + .like(StringUtils.isNotEmpty(param.getCompanyName()),NdCompanyCreditReward::getCompanyName, param.getCompanyName()) + .ge(StringUtils.isNotEmpty(param.getStartTime()),NdCompanyCreditReward::getCreateOn, param.getStartTime()) + .le(StringUtils.isNotEmpty(param.getEndTime()),NdCompanyCreditReward::getCreateOn, param.getEndTime()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdCompanyCreditReward::getUpdateOn); + ndCompanyCreditRewardMapper.selectPage(page, wrapper); + CodeUtil.searchCompanyNamesAndRegionNames(page.getRecords()); + return page; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyProductManageServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyProductManageServiceImpl.java new file mode 100644 index 0000000..609971f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyProductManageServiceImpl.java @@ -0,0 +1,41 @@ +package com.ningdatech.carapi.company.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.company.entity.NdCompanyProductManage; +import com.ningdatech.carapi.company.entity.dto.ResProductManageDTO; +import com.ningdatech.carapi.company.entity.po.CompanyProductPO; +import com.ningdatech.carapi.company.mapper.NdCompanyProductManageMapper; +import com.ningdatech.carapi.company.service.INdCompanyProductManageService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +/** + *

+ * 公司生产管理 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@Service +@RequiredArgsConstructor +public class NdCompanyProductManageServiceImpl extends ServiceImpl implements INdCompanyProductManageService { + private final NdCompanyProductManageMapper ndCompanyProductManageMapper; + + @Override + public Page manageList(String companyName, Long regionId, int pageNum, int pageSize) { + NdCompanyProductManageServiceImpl context = (NdCompanyProductManageServiceImpl)AopContext.currentProxy(); + return context.searchList(new Page<>(pageNum, pageSize), + new CompanyProductPO(regionId, null, companyName, null)); + } + + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public Page searchList(Page page,CompanyProductPO po){ + return ndCompanyProductManageMapper.manageList(page,po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyQualityManageServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyQualityManageServiceImpl.java new file mode 100644 index 0000000..779175c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanyQualityManageServiceImpl.java @@ -0,0 +1,95 @@ +package com.ningdatech.carapi.company.service.impl; + +import java.util.Objects; + +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.company.entity.NdCompanyQualityManage; +import com.ningdatech.carapi.company.entity.dto.ResQualityManageDTO; +import com.ningdatech.carapi.company.entity.po.CompanyQualityPO; +import com.ningdatech.carapi.company.mapper.NdCompanyQualityManageMapper; +import com.ningdatech.carapi.company.service.INdCompanyQualityManageService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import lombok.RequiredArgsConstructor; + +/** + *

+ * 质量通报 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@Service +@RequiredArgsConstructor +public class NdCompanyQualityManageServiceImpl extends ServiceImpl implements INdCompanyQualityManageService { + + private final NdCompanyQualityManageMapper ndCompanyQualityManageMapper; + + @Override + public Page qualityManageList(Long regionId, String year, int pageNum, int pageSize) { + NdCompanyQualityManageServiceImpl context = (NdCompanyQualityManageServiceImpl)AopContext.currentProxy(); + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + // 非省系统管理员 + if (!UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId)) { + return context.searchList(new Page<>(pageNum, pageSize), + new CompanyQualityPO(regionId, null, year, null)); + }else { + return context.searchAllList(new Page<>(pageNum, pageSize), + new CompanyQualityPO(regionId, null, year, null)); + } + } + + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public Page searchList(Page page, CompanyQualityPO po) { + ndCompanyQualityManageMapper.qualityManageList(page, po); + CodeUtil.searchRegionNames(page.getRecords()); + return page; + } + + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public Page searchAllList(Page page, CompanyQualityPO po) { + ndCompanyQualityManageMapper.qualityAllManageList(page, po); + CodeUtil.searchRegionNames(page.getRecords()); + return page; + } + + @Override + public boolean incrementDownCount(Long id) { + return ndCompanyQualityManageMapper.incrementDownCount(id) > 0; + } + + @Override + public Boolean delete(Long id) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdCompanyQualityManage.class); + NdCompanyQualityManageServiceImpl context = (NdCompanyQualityManageServiceImpl) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + NdCompanyQualityManage qualityManage = ndCompanyQualityManageMapper.selectOne(wrapper); + if (Objects.isNull(qualityManage)){ + return false; + } + ndCompanyQualityManageMapper.deleteById(qualityManage); + return true; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(NdCompanyQualityManage::getId,id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityCommitmentServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityCommitmentServiceImpl.java new file mode 100644 index 0000000..a3238a2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityCommitmentServiceImpl.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.company.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.company.entity.CompanySecurityCommitment; +import com.ningdatech.carapi.company.entity.dto.CompanySecurityCommitmentParam; +import com.ningdatech.carapi.company.mapper.NdCompanySecurityCommitmentMapper; +import com.ningdatech.carapi.company.service.ICompanySecurityCommitmentService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 安全生产责任体系 安全承诺书 + *

+ * + * @author zpf + * @since 2023-05-23 + */ +@Service +@RequiredArgsConstructor +public class NdCompanySecurityCommitmentServiceImpl extends ServiceImpl implements ICompanySecurityCommitmentService { + + @Override + @BuildChildrenRegionWrapper(wrapperIndex = 1,entityIndex = 2) + @LambdaDataScope(wrapperIndex = 1) + public Page pageDataScope(Page page, LambdaQueryWrapper wrapper, CompanySecurityCommitmentParam param) { + return page(page,wrapper); + } + + @Override + public void deleteById(Long id) { + baseMapper.deleteById(id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityGovernmentServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityGovernmentServiceImpl.java new file mode 100644 index 0000000..26bf45e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityGovernmentServiceImpl.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.company.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.company.entity.CompanySecurityGovernment; +import com.ningdatech.carapi.company.entity.dto.CompanySecurityCommitmentParam; +import com.ningdatech.carapi.company.mapper.NdCompanySecurityGovernmentMapper; +import com.ningdatech.carapi.company.service.ICompanySecurityGovernmentService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 安全 管理机构 + *

+ * + * @author zpf + * @since 2023-05-23 + */ +@Service +@RequiredArgsConstructor +public class NdCompanySecurityGovernmentServiceImpl extends ServiceImpl implements ICompanySecurityGovernmentService { + + @Override + @BuildChildrenRegionWrapper(wrapperIndex = 1,entityIndex = 2) + @LambdaDataScope(wrapperIndex = 1) + public Page pageDataScope(Page page, LambdaQueryWrapper wrapper, CompanySecurityCommitmentParam param) { + return page(page,wrapper); + } + + @Override + @BuildChildrenRegionWrapper + @LambdaDataScope + public List dataScopeList(LambdaQueryWrapper wrapper, CompanySecurityCommitmentParam param) { + return baseMapper.selectList(wrapper); + } + + @Override + public void deleteById(Long id) { + baseMapper.deleteById(id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityProductDutyServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityProductDutyServiceImpl.java new file mode 100644 index 0000000..eab42d1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityProductDutyServiceImpl.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.company.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.company.entity.NdCompanySecurityProductDuty; +import com.ningdatech.carapi.company.entity.dto.ResSecurityProductDutyDTO; +import com.ningdatech.carapi.company.entity.po.CompanySecurityProductDutyPO; +import com.ningdatech.carapi.company.mapper.NdCompanySecurityProductDutyMapper; +import com.ningdatech.carapi.company.service.INdCompanySecurityProductDutyService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +/** + *

+ * 安全生产责任体系 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@Service +@RequiredArgsConstructor +public class NdCompanySecurityProductDutyServiceImpl extends ServiceImpl implements INdCompanySecurityProductDutyService { + + private final NdCompanySecurityProductDutyMapper ndCompanySecurityProductDutyMapper; + + @Override + public Page securityProductDutyList(Long regionId, String companyName, String startTime, String endTime, Integer fileType, int pageNum, int pageSize) { + NdCompanySecurityProductDutyServiceImpl context = (NdCompanySecurityProductDutyServiceImpl)AopContext.currentProxy(); + return context.searchList(new Page<>(pageNum, pageSize), + new CompanySecurityProductDutyPO(regionId,null, companyName, startTime, endTime, fileType,null)); + } + + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public Page searchList(Page page, + CompanySecurityProductDutyPO po) { + ndCompanySecurityProductDutyMapper.securityProductDutyList(page,po); + CodeUtil.searchCompanyNamesAndRegionNames(page.getRecords()); + return page; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityProductExecuteServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityProductExecuteServiceImpl.java new file mode 100644 index 0000000..24d3a43 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityProductExecuteServiceImpl.java @@ -0,0 +1,41 @@ +package com.ningdatech.carapi.company.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanySecurityProductExecute; +import com.ningdatech.carapi.company.entity.dto.ResSecurityProductExecuteDTO; +import com.ningdatech.carapi.company.entity.po.CompanySecurityProductExecutePO; +import com.ningdatech.carapi.company.mapper.NdCompanySecurityProductExecuteMapper; +import com.ningdatech.carapi.company.service.INdCompanySecurityProductExecuteService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +/** + *

+ * 安全生产制度执行 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@Service +@RequiredArgsConstructor +public class NdCompanySecurityProductExecuteServiceImpl extends ServiceImpl implements INdCompanySecurityProductExecuteService { + + private final NdCompanySecurityProductExecuteMapper ndCompanySecurityProductExecuteMapper; + + @Override + public Page securityProductExecuteList(String name, String startTime, String endTime, Integer fileType, int pageNum, int pageSize) { + NdCompanySecurityProductExecuteServiceImpl context = (NdCompanySecurityProductExecuteServiceImpl)AopContext.currentProxy(); + return context.searchList(new Page<>(pageNum, pageSize),new CompanySecurityProductExecutePO(name, startTime, endTime,fileType,null)); + + } + + @XmlDataScope(entityIndex = 1) + public Page searchList(Page page, + CompanySecurityProductExecutePO po) { + return ndCompanySecurityProductExecuteMapper.securityProductExecuteList(page, po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityProductRegulationsServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityProductRegulationsServiceImpl.java new file mode 100644 index 0000000..dbcb9e6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/company/service/impl/NdCompanySecurityProductRegulationsServiceImpl.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.company.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.company.entity.NdCompanySecurityProductRegulations; +import com.ningdatech.carapi.company.entity.dto.ResSecurityProductRegulationsDTO; +import com.ningdatech.carapi.company.entity.po.CompanySecurityProductRegulationPO; +import com.ningdatech.carapi.company.mapper.NdCompanySecurityProductRegulationsMapper; +import com.ningdatech.carapi.company.service.INdCompanySecurityProductRegulationsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import lombok.RequiredArgsConstructor; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +/** + *

+ * 安全生产制度体系 服务实现类 + *

+ * + * @author liushuai + * @since 2022-10-10 + */ +@Service +@RequiredArgsConstructor +public class NdCompanySecurityProductRegulationsServiceImpl extends ServiceImpl implements INdCompanySecurityProductRegulationsService { + + private final NdCompanySecurityProductRegulationsMapper ndCompanySecurityProductRegulationsMapper; + + @Override + public Page securityProductRegulationsList(String regulationsName, String competentDepartment, String startTime, String endTime, Integer fileType, int pageNum, int pageSize) { + NdCompanySecurityProductRegulationsServiceImpl context = (NdCompanySecurityProductRegulationsServiceImpl)AopContext.currentProxy(); + return context.searchList(new Page<>(pageNum, pageSize), + new CompanySecurityProductRegulationPO(regulationsName, competentDepartment, startTime, endTime, fileType,null)); + } + + @XmlDataScope(entityIndex = 1) + public Page searchList(Page page, CompanySecurityProductRegulationPO po) { + return ndCompanySecurityProductRegulationsMapper.securityProductRegulationsList(page,po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/aop/LambdaDataScope.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/aop/LambdaDataScope.java new file mode 100644 index 0000000..6e03582 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/aop/LambdaDataScope.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.datascope.aop; + +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; + +import java.lang.annotation.*; + +/** + * @Classname LambdaDataScope + * @Description + * @Date 2022/11/11 15:34 + * @Created by PoffyZhang + */ + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface LambdaDataScope { + LambdaDataScopeTypeEnum type() default LambdaDataScopeTypeEnum.ALL; + + //wrapper的下标位置 如果是分页的话 可能是第二个 + int wrapperIndex() default 0; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/aop/LambdaDataScopeAspect.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/aop/LambdaDataScopeAspect.java new file mode 100644 index 0000000..6f3a7e7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/aop/LambdaDataScopeAspect.java @@ -0,0 +1,89 @@ +package com.ningdatech.carapi.datascope.aop; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ningdatech.carapi.datascope.model.DataScopeDto; +import com.ningdatech.carapi.datascope.model.DataScopeEntity; +import com.ningdatech.carapi.datascope.provider.DataScopeContext; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.util.Objects; +import java.util.Optional; + +/** + * @program: + * @description: 数据权限切面 + * LambdaDataScopeAspect + * @author: PoffyZhang + * @created: 2022/11/11 09:12 + */ +@Aspect +@Component +@Slf4j +@AllArgsConstructor +@Order(10) +public class LambdaDataScopeAspect { + + @Pointcut("@annotation(com.ningdatech.carapi.datascope.aop.LambdaDataScope)") + public void lambdaDataScopeAspect() { + + } + + @Before("lambdaDataScopeAspect() && @annotation(lambdaDataScope)") + public void before(JoinPoint joinPoint, LambdaDataScope lambdaDataScope) throws Throwable { + Optional currentUserDataScoper = getCurrentUserDataScoper(); + if (!currentUserDataScoper.isPresent()) { + return; + } + DataScopeDto dataScopeDto = currentUserDataScoper.get(); + LambdaQueryWrapper wrapper = + (LambdaQueryWrapper) joinPoint.getArgs()[lambdaDataScope.wrapperIndex()]; + + if (Objects.isNull(wrapper)) { + return; + } + + switch (lambdaDataScope.type()) { + case ALL: + wrapper.in(CollUtil.isNotEmpty(dataScopeDto.getRegionIds()), DataScopeEntity::getRegionId, dataScopeDto.getRegionIds()) + .in(CollUtil.isNotEmpty(dataScopeDto.getCompanyIds()), DataScopeEntity::getCompanyId, dataScopeDto.getCompanyIds()); + break; + case ONLY_REGION: + wrapper.in(CollUtil.isNotEmpty(dataScopeDto.getRegionIds()), DataScopeEntity::getRegionId, dataScopeDto.getRegionIds()); + break; + case ONLY_COMPANY: + wrapper.in(CollUtil.isNotEmpty(dataScopeDto.getCompanyIds()), DataScopeEntity::getCompanyId, dataScopeDto.getCompanyIds()); + break; + case REGION_TABLE: + wrapper.in(CollUtil.isNotEmpty(dataScopeDto.getRegionIds()), DataScopeEntity::getId, dataScopeDto.getRegionIds()); + break; + case COMPANY_TABLE: + wrapper.in(CollUtil.isNotEmpty(dataScopeDto.getCompanyIds()), DataScopeEntity::getId, dataScopeDto.getCompanyIds()) + .in(CollUtil.isNotEmpty(dataScopeDto.getRegionIds()), DataScopeEntity::getRegionId, dataScopeDto.getRegionIds()); + break; + case NONE: + break; + default: + wrapper.in(CollUtil.isNotEmpty(dataScopeDto.getRegionIds()), DataScopeEntity::getRegionId, dataScopeDto.getRegionIds()) + .in(CollUtil.isNotEmpty(dataScopeDto.getCompanyIds()), DataScopeEntity::getCompanyId, dataScopeDto.getCompanyIds()); + } + + } + + public Optional getCurrentUserDataScoper() { + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + if (Objects.isNull(loginUser) || Objects.isNull(loginUser.getDataScope())) { + return Optional.empty(); + } + return DataScopeContext.getDataScope(loginUser.getDataScope()); + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/aop/XmlDataScope.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/aop/XmlDataScope.java new file mode 100644 index 0000000..5f126bd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/aop/XmlDataScope.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.datascope.aop; + +import java.lang.annotation.*; + +/** + * @Classname XmlDataScope + * xml 可以join 所以要设置 别名 + * @Description + * @Date 2022/11/11 15:34 + * @Created by PoffyZhang + */ + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface XmlDataScope { + + String regionAlias() default "r"; + + String companyAlias() default "c"; + + //实体的位置 默认0 如果有分页 那么可能是第二个 + int entityIndex() default 0; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/aop/XmlDataScopeAspect.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/aop/XmlDataScopeAspect.java new file mode 100644 index 0000000..eb42349 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/aop/XmlDataScopeAspect.java @@ -0,0 +1,101 @@ +package com.ningdatech.carapi.datascope.aop; + +import cn.hutool.core.collection.CollUtil; +import com.ningdatech.carapi.datascope.model.DataScopeDto; +import com.ningdatech.carapi.datascope.provider.DataScopeContext; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Field; +import java.util.List; +import java.util.Objects; +import java.util.Optional; + +; + +/** + * @program: + * @description: xml sql方式 + * 数据权限切面 + * @author: PoffyZhang + * @created: 2022/11/11 09:12 + */ +@Aspect +@Component +@Slf4j +@AllArgsConstructor +@Order(10) +public class XmlDataScopeAspect { + + @Pointcut("@annotation(com.ningdatech.carapi.datascope.aop.XmlDataScope)") + public void xmlDataScopeAspect() { + + } + + @Before("xmlDataScopeAspect() && @annotation(xmlDataScope)") + public void before(JoinPoint joinPoint, XmlDataScope xmlDataScope) throws Throwable { + Optional currentUserDataScoper = getCurrentUserDataScoper(); + if(!currentUserDataScoper.isPresent()){ + return; + } + DataScopeDto dataScopeDto = currentUserDataScoper.get(); + Object entity = joinPoint.getArgs()[xmlDataScope.entityIndex()]; + + if(Objects.isNull(entity)){ + return; + } + + StringBuilder sql = new StringBuilder(); + if(CollUtil.isEmpty(dataScopeDto.getCompanyIds()) + && CollUtil.isEmpty(dataScopeDto.getRegionIds())){ + return; + } + + if(CollUtil.isNotEmpty(dataScopeDto.getCompanyIds())){ + sql.append(" AND " + xmlDataScope.companyAlias() + ".id in (" + + convertForStr(dataScopeDto.getCompanyIds()) + ")"); + } + + + if(CollUtil.isNotEmpty(dataScopeDto.getRegionIds())){ + sql.append(" AND " + xmlDataScope.regionAlias() + ".id in (" + + convertForStr(dataScopeDto.getRegionIds()) + ")"); + } + + if(sql.length() > 0){ + Class clazz = entity.getClass(); + Field dataScopeSql = clazz.getDeclaredField("dataScopeSql"); + dataScopeSql.setAccessible(true); + dataScopeSql.set(entity, sql.toString()); + } + } + + private String convertForStr(List companyIds) { + if(CollUtil.isEmpty(companyIds)){ + return StringUtils.EMPTY; + } + StringBuilder sql = new StringBuilder(); + for(Long companyId : companyIds){ + sql.append(companyId + ","); + } + sql.delete(sql.length()-1,sql.length()); + return sql.toString(); + } + + public Optional getCurrentUserDataScoper(){ + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + if(Objects.isNull(loginUser) || Objects.isNull(loginUser.getDataScope())){ + return Optional.empty(); + } + return DataScopeContext.getDataScope(loginUser.getDataScope()); + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/contants/DataScopeColumnConst.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/contants/DataScopeColumnConst.java new file mode 100644 index 0000000..868972e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/contants/DataScopeColumnConst.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.datascope.contants; + +/** + *

+ * DataScopeColumnConst + *

+ * + * @author WendyYang + * @since 16:24 2022/11/3 + */ +public interface DataScopeColumnConst { + + String REGION_ID = "region_id"; + + String COMPANY_ID = "company_id"; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/contants/DataScopeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/contants/DataScopeEnum.java new file mode 100644 index 0000000..630cd5c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/contants/DataScopeEnum.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.datascope.contants; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.stream.Stream; + +/** + *

+ * 数据权限枚举类 + *

+ * + * @author WendyYang + * @since 2019-07-21 + */ +@Getter +@AllArgsConstructor +public enum DataScopeEnum { + + /** + * 数据权限枚举 + */ + ALL(1, "全部"), + + SELF_REGION(2, "本区域"), + + SELF_CHILD_REGION(3, "本区域及下级区域"), + + SELF_COMPANY(4, "本单位"); + + private final int val; + + private final String desc; + + + public static DataScopeEnum match(String val) { + return Stream.of(values()) + .filter((item) -> item.name().equalsIgnoreCase(val)) + .findAny() + .orElse(SELF_COMPANY); + } + + public static DataScopeEnum get(String val) { + return match(val); + } + + public boolean eq(final DataScopeEnum val) { + return val != null && this.name().equals(val.name()); + } + + public int getCode() { + return this.val; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/contants/LambdaDataScopeTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/contants/LambdaDataScopeTypeEnum.java new file mode 100644 index 0000000..11ecef0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/contants/LambdaDataScopeTypeEnum.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.datascope.contants; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * @Classname DataScopeTypeEnum + * @Description + * @Date 2022/11/18 11:15 + * @Created by PoffyZhang + */ +@ApiModel(value = "DataScopeTypeEnum", description = "数据范围类型-枚举") +public enum LambdaDataScopeTypeEnum { + /** + * 一般场景 此表有 ragion_id company_id + */ + ALL, + + /** + * 该表数据 只有地区 没有公司 + */ + ONLY_REGION, + + /** + * 只有公司 + */ + ONLY_COMPANY, + + /** + * 该表刚好是地区表 字段是id + */ + REGION_TABLE, + + /** + * 该表刚好是公司表 字段是id + */ + COMPANY_TABLE, + + /** + * 企业 公司都没有 + */ + NONE; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/model/DataScopeDto.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/model/DataScopeDto.java new file mode 100644 index 0000000..882659f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/model/DataScopeDto.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.datascope.model; + +import com.ningdatech.carapi.datascope.contants.DataScopeEnum; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import lombok.Data; + +import java.util.List; + +/** + *

+ * DataScopeDto + *

+ * + * @author WendyYang + * @since 13:42 2022/11/4 + */ +@Data +public class DataScopeDto { + + private DataScopeEnum dataScope; + + private List regionIds; + + private List companyIds; + + //该用户权限所能查询到的最大区域 + private RegionDTO maxRegion; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/model/DataScopeEntity.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/model/DataScopeEntity.java new file mode 100644 index 0000000..1ef39ad --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/model/DataScopeEntity.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.datascope.model; + +import lombok.Data; + +import java.util.Map; + +/** + * @Classname DataScopEntity + * @Description + * @Date 2022/11/11 16:25 + * @Created by PoffyZhang + */ +@Data +public class DataScopeEntity { + + protected Long id; + + protected Long regionId; + + protected Long companyId; + + protected String dataScopeSql; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/DataScopeContext.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/DataScopeContext.java new file mode 100644 index 0000000..2cffdac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/DataScopeContext.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.datascope.provider; + +import com.ningdatech.basic.util.SpringUtils; +import com.ningdatech.carapi.datascope.model.DataScopeDto; +import lombok.RequiredArgsConstructor; + +import java.util.Map; +import java.util.Optional; + +/** + *

+ * 数据权限获取 + *

+ * + * @author WendyYang + * @since 2022/1/9 23:28 + */ +@RequiredArgsConstructor +public class DataScopeContext { + + private static final String WARN_MSG = "请先创建数据权限[%s]的实现类,使其实现 DataScopeProvider"; + + private static final Map DSP_MAP; + + static { + DSP_MAP = SpringUtils.getBeansOfType(DataScopeProvider.class); + } + + public static Optional getDataScope(int type) { + String key = "DATA_SCOPE_" + type; + DataScopeProvider dataScopeProvider = DSP_MAP.get(key); + if (dataScopeProvider == null) { + throw new IllegalArgumentException(String.format(WARN_MSG, key)); + } + return dataScopeProvider.findDataFieldProperty(); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/DataScopeProvider.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/DataScopeProvider.java new file mode 100644 index 0000000..7ff6428 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/DataScopeProvider.java @@ -0,0 +1,26 @@ +package com.ningdatech.carapi.datascope.provider; + + +import com.ningdatech.carapi.datascope.model.DataScopeDto; + +import java.util.List; +import java.util.Optional; + +/** + *

+ * 数据权限获取接口 + *

+ * + * @author WendyYang + * @since 2022/1/9 23:28 + */ +public interface DataScopeProvider { + + /** + * 获取登录人的数据权限 + * + * @return 数据权限 + **/ + Optional findDataFieldProperty(); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/impl/AllDataScopeProviderImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/impl/AllDataScopeProviderImpl.java new file mode 100644 index 0000000..d9c2772 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/impl/AllDataScopeProviderImpl.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.datascope.provider.impl; + +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.datascope.model.DataScopeDto; +import com.ningdatech.carapi.datascope.contants.DataScopeEnum; +import com.ningdatech.carapi.datascope.provider.DataScopeProvider; +import com.ningdatech.carapi.sys.contants.RegionContant; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.Optional; + + +/** + *

+ * 数据权限{@link DataScopeEnum#ALL} + *

+ * + * @author WendyYang + * @since 2022/1/9 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("DATA_SCOPE_1") +public class AllDataScopeProviderImpl implements DataScopeProvider { + + private final RegionsCacheHelper regionsCacheHelper; + @Override + public Optional findDataFieldProperty() { + DataScopeDto dataScopeDto = new DataScopeDto(); + //全部权限的话 最大是浙江 + dataScopeDto.setMaxRegion(regionsCacheHelper.getByRegionId(RegionContant.ZJ_REGION_ID)); + return Optional.ofNullable(dataScopeDto); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/impl/SelfChildRegionDataScopeProviderImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/impl/SelfChildRegionDataScopeProviderImpl.java new file mode 100644 index 0000000..5cdada8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/impl/SelfChildRegionDataScopeProviderImpl.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.datascope.provider.impl; + +import com.ningdatech.carapi.datascope.contants.DataScopeEnum; +import com.ningdatech.carapi.datascope.model.DataScopeDto; +import com.ningdatech.carapi.datascope.provider.DataScopeProvider; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.service.INdUserInfoService; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Optional; + +/** + *

+ * 数据权限{@link DataScopeEnum#SELF_CHILD_REGION} + *

+ * + * @author WendyYang + * @since 2022/1/9 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("DATA_SCOPE_3") +public class SelfChildRegionDataScopeProviderImpl implements DataScopeProvider { + + private final RegionsCacheHelper regionsCacheHelper; + private final INdUserInfoService userInfoService; + private final CompaniesCacheHelper companiesCacheHelper; + + @Override + public Optional findDataFieldProperty() { + NdUserInfo user = userInfoService.getById(LoginUserUtil.getUserId()); + CompanyDTO company = companiesCacheHelper.getById(user.getCompanyId()); + List regionIds = regionsCacheHelper.listChildRegionId(company.getRegionId()); + DataScopeDto ds = new DataScopeDto(); + ds.setRegionIds(regionIds); + //最大的区域权限是 公司所在的区域 用于大屏地图 + ds.setMaxRegion(regionsCacheHelper.getByRegionId(company.getRegionId())); + return Optional.ofNullable(ds); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/impl/SelfCompanyDataScopeProviderImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/impl/SelfCompanyDataScopeProviderImpl.java new file mode 100644 index 0000000..e59b11c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/impl/SelfCompanyDataScopeProviderImpl.java @@ -0,0 +1,52 @@ +package com.ningdatech.carapi.datascope.provider.impl; + +import com.ningdatech.carapi.datascope.contants.DataScopeEnum; +import com.ningdatech.carapi.datascope.model.DataScopeDto; +import com.ningdatech.carapi.datascope.provider.DataScopeProvider; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.service.INdUserInfoService; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +/** + *

+ * 数据权限{@link DataScopeEnum#SELF_COMPANY} + *

+ * + * @author WendyYang + * @since 2022/1/9 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("DATA_SCOPE_4") +public class SelfCompanyDataScopeProviderImpl implements DataScopeProvider { + + private final RegionsCacheHelper regionsCacheHelper; + + private final CompaniesCacheHelper companiesCacheHelper; + + private final INdUserInfoService userInfoService; + + @Override + public Optional findDataFieldProperty() { + Long userId = LoginUserUtil.getUserId(); + NdUserInfo user = userInfoService.getById(userId); + List companyIds = Collections.singletonList(user.getCompanyId()); + DataScopeDto ds = new DataScopeDto(); + ds.setCompanyIds(companyIds); + CompanyDTO company = companiesCacheHelper.getById(user.getCompanyId()); + //最大的区域权限是 公司所在的区域 用于大屏地图 + ds.setMaxRegion(regionsCacheHelper.getByRegionId(company.getRegionId())); + return Optional.ofNullable(ds); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/impl/SelfRegionDataScopeProviderImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/impl/SelfRegionDataScopeProviderImpl.java new file mode 100644 index 0000000..00686e4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/datascope/provider/impl/SelfRegionDataScopeProviderImpl.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.datascope.provider.impl; + +import com.ningdatech.carapi.datascope.contants.DataScopeEnum; +import com.ningdatech.carapi.datascope.model.DataScopeDto; +import com.ningdatech.carapi.datascope.provider.DataScopeProvider; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.service.INdUserInfoService; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +/** + *

+ * 数据权限{@link DataScopeEnum#SELF_REGION} + *

+ * + * @author WendyYang + * @since 2022/1/9 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("DATA_SCOPE_2") +public class SelfRegionDataScopeProviderImpl implements DataScopeProvider { + + private final INdUserInfoService userInfoService; + private final CompaniesCacheHelper companiesCacheHelper; + + private final RegionsCacheHelper regionsCacheHelper; + + @Override + public Optional findDataFieldProperty() { + Long userId = LoginUserUtil.getUserId(); + NdUserInfo user = userInfoService.getById(userId); + CompanyDTO company = companiesCacheHelper.getById(user.getCompanyId()); + Long regionId; + regionId = company.getRegionId(); + List regionIds = Collections.singletonList(regionId); + DataScopeDto ds = new DataScopeDto(); + ds.setRegionIds(regionIds); + //最大的区域权限是 公司所在的区域 用于大屏地图 + ds.setMaxRegion(regionsCacheHelper.getByRegionId(company.getRegionId())); + return Optional.ofNullable(ds); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/assembler/TrainingAssembler.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/assembler/TrainingAssembler.java new file mode 100644 index 0000000..d4f9e2f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/assembler/TrainingAssembler.java @@ -0,0 +1,97 @@ +package com.ningdatech.carapi.driver.assembler; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; + +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.driver.constant.*; +import com.ningdatech.carapi.driver.entity.TrainingMaterial; +import com.ningdatech.carapi.driver.entity.TrainingOrganization; +import com.ningdatech.carapi.driver.entity.TrainingOrganizationTrainer; +import com.ningdatech.carapi.driver.model.TrainingBasicInfo; +import com.ningdatech.carapi.driver.model.TrainingMaterialInfo; +import com.ningdatech.carapi.driver.model.TrainingMaterialOverviewInfo; +import com.ningdatech.carapi.driver.model.vo.OrganizationTrainingTrainersInfo; + +/** + * @author liuxinxin + * @date 2022/10/22 下午3:59 + */ + +public class TrainingAssembler { + + public static TrainingBasicInfo buildTrainingBasicInfo(TrainingOrganization trainingOrganization) { + // 装配培训基本信息 + TrainingBasicInfo trainingBasicInfo = new TrainingBasicInfo(); + trainingBasicInfo.setAddress(trainingOrganization.getAddress()); + trainingBasicInfo.setContactNumber(trainingOrganization.getContactNumber()); + trainingBasicInfo.setContacts(trainingOrganization.getContacts()); + trainingBasicInfo.setRemark(trainingOrganization.getRemark()); + trainingBasicInfo.setTrainingStartTime(trainingOrganization.getTrainingStartTime()); + trainingBasicInfo.setTrainingEndTime(trainingOrganization.getTrainingEndTime()); + if (Objects.nonNull(trainingOrganization.getTrainingMode())){ + trainingBasicInfo.setTrainingMode(TrainingModeEnum.valueOf(trainingOrganization.getTrainingMode())); + } + if (Objects.nonNull(trainingOrganization.getTrainingStatus())) { + trainingBasicInfo.setTrainingStatus(TrainingStatusEnum.valueOf(trainingOrganization.getTrainingStatus())); + } + trainingBasicInfo.setTrainingTopic(trainingOrganization.getTrainingTopic()); + if (Objects.nonNull(trainingOrganization.getTrainingType())) { + trainingBasicInfo.setTrainingType(TrainingTypeEnum.valueOf(trainingOrganization.getTrainingType())); + } + return trainingBasicInfo; + } + + public static TrainingMaterialOverviewInfo buildTrainingMaterialOverviewInfo(List materialList) { + List trainingMaterialInfoList = buildTrainingMaterialInfoList(materialList); + Map> trainingMaterialMap = trainingMaterialInfoList.stream() + .collect(Collectors.groupingBy(TrainingMaterialInfo::getMaterialType)); + TrainingMaterialOverviewInfo trainingMaterialOverviewInfo = new TrainingMaterialOverviewInfo(); + trainingMaterialOverviewInfo.setRuleSystemMaterialList(trainingMaterialMap.get(MaterialTypeEnum.rule_system)); + trainingMaterialOverviewInfo.setPolicyDocumentsMaterialInfoList(trainingMaterialMap.get(MaterialTypeEnum.policy_documents)); + trainingMaterialOverviewInfo.setSafetyKnowledgeMaterialInfoList(trainingMaterialMap.get(MaterialTypeEnum.safety_knowledge)); + trainingMaterialOverviewInfo.setAccidentCaseMaterialInfoList(trainingMaterialMap.get(MaterialTypeEnum.accident_case)); + trainingMaterialOverviewInfo.setTrainingVideoMaterialInfoList(trainingMaterialMap.get(MaterialTypeEnum.training_video)); + trainingMaterialOverviewInfo.setOtherMaterialInfoList(trainingMaterialMap.get(MaterialTypeEnum.other)); + return trainingMaterialOverviewInfo; + } + + public static OrganizationTrainingTrainersInfo buildOrganizationTrainingTrainersInfo(TrainingOrganizationTrainer trainer) { + OrganizationTrainingTrainersInfo organizationTrainingTrainersInfo = new OrganizationTrainingTrainersInfo(); + organizationTrainingTrainersInfo.setId(trainer.getId()); + organizationTrainingTrainersInfo.setDriverId(trainer.getDriverId()); + organizationTrainingTrainersInfo.setDriverName(trainer.getDriverName()); + organizationTrainingTrainersInfo.setCompanyId(trainer.getCompanyId()); + organizationTrainingTrainersInfo.setCompanyName(trainer.getCompanyName()); + organizationTrainingTrainersInfo.setDriverId(trainer.getDriverId()); + organizationTrainingTrainersInfo.setDriverUserId(trainer.getDriverUserId()); + if (StringUtils.isNotBlank(trainer.getExaminationStatus())) { + organizationTrainingTrainersInfo.setExaminationStatus(ExaminationStatusEnum.valueOf(trainer.getExaminationStatus())); + } + organizationTrainingTrainersInfo.setExamPaperId(trainer.getExamPaperId()); + organizationTrainingTrainersInfo.setExamPaperName(trainer.getExamPaperName()); + organizationTrainingTrainersInfo.setExamRegistrationNo(trainer.getExamRegistrationNo()); + organizationTrainingTrainersInfo.setScore(trainer.getScore()); + organizationTrainingTrainersInfo.setIsQualified(trainer.getIsQualified()); + return organizationTrainingTrainersInfo; + } + + public static List buildTrainingMaterialInfoList(List materialList) { + return materialList.stream().map(r -> { + TrainingMaterialInfo trainingMaterialInfo = new TrainingMaterialInfo(); + String appendixListJson = r.getAppendixListJson(); + List appendixList = JSONObject.parseArray(appendixListJson,FileBasicInfo.class); + trainingMaterialInfo.setTitle(r.getTitle()); + trainingMaterialInfo.setContent(r.getContent()); + trainingMaterialInfo.setMaterialType(MaterialTypeEnum.valueOf(r.getMaterialType())); + trainingMaterialInfo.setTrainingMaterialId(r.getId()); + trainingMaterialInfo.setAppendixList(appendixList); + return trainingMaterialInfo; + }).collect(Collectors.toList()); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/call/RestTemplateToInterface.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/call/RestTemplateToInterface.java new file mode 100644 index 0000000..af4f390 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/call/RestTemplateToInterface.java @@ -0,0 +1,68 @@ +package com.ningdatech.carapi.driver.call; + +import com.ningdatech.carapi.driver.entity.OverseeInterfaceCallDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import javax.xml.transform.Result; + +/** + * @author CMM + * @description + * @since 2022/12/08 14:27 + */ +@Component +public class RestTemplateToInterface { + @Autowired + private RestTemplate restTemplate; + + /** + * 以get方式请求第三方http接口 getForEntity + * + * @param url + * @return + */ + public Result doGetWith1(String url) { + ResponseEntity responseEntity = restTemplate.getForEntity(url, Result.class); + Result result = responseEntity.getBody(); + return result; + } + + /** + * 以get方式请求第三方http接口 getForObject 返回值返回的是响应体,省去了我们再去getBody() + * + * @param url + * @return + */ + public Result doGetWith2(String url) { + Result result = restTemplate.getForObject(url, Result.class); + return result; + } + + + /** + * 以post方式请求第三方http接口 postForEntity + * @param url + * @param req + * @return + */ + public String doPostWith1(String url, OverseeInterfaceCallDTO req) { + ResponseEntity responseEntity = restTemplate.postForEntity(url, req, String.class); + String body = responseEntity.getBody(); + return body; + } + + /** + * 以post方式请求第三方http接口 postForEntity 返回值返回的是响应体,省去了我们再去getBody() + * + * @param url + * @param req + * @return + */ + public String doPostWith2(String url, OverseeInterfaceCallDTO req) { + String body = restTemplate.postForObject(url, req, String.class); + return body; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ApplicantTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ApplicantTypeEnum.java new file mode 100644 index 0000000..94fee39 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ApplicantTypeEnum.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.driver.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 驾驶员培训报名申请类型 + * @return + * @author CMM + * @since 2023/02/07 13:55 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "ApplicantTypeEnum", description = "驾驶员培训报名申请类型-枚举") +public enum ApplicantTypeEnum { + + /** + * 材料审核 + */ + MATERIAL_APPLICANT(1, "材料审核"), + + /** + * 跳槽审核 + */ + JOB_CHANGE_APPLICANT(2, "跳槽审核"); + + private Integer code; + private String desc; + + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(int code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (ApplicantTypeEnum t : ApplicantTypeEnum.values()) { + if (code == t.getCode()) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ArticleTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ArticleTypeEnum.java new file mode 100644 index 0000000..5565bd4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ArticleTypeEnum.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/9 下午4:40 + */ +@AllArgsConstructor +@Getter +public enum ArticleTypeEnum { + + /** + * 规章制度 + */ + RULES_AND_REGULATIONS +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/CurrentUserOrganizationEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/CurrentUserOrganizationEnum.java new file mode 100644 index 0000000..7288281 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/CurrentUserOrganizationEnum.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.driver.constant; + +/** + * @author liuxinxin + * @date 2022/11/3 下午6:27 + * 当前驾驶与参与培训组织状态 + */ + +public enum CurrentUserOrganizationEnum { + + // 已完成 + completed, + + // 未完成 + incomplete, + + // 未参加 + uncommitted +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverAbnormalBehaviorAppendixTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverAbnormalBehaviorAppendixTypeEnum.java new file mode 100644 index 0000000..f9c606a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverAbnormalBehaviorAppendixTypeEnum.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +@Getter +@AllArgsConstructor +public enum DriverAbnormalBehaviorAppendixTypeEnum { + PICTURE(0,"图片"), + + VIDEO(1,"视频"), + + OTHER(2,"其他"); + + private Integer code; + private String desc; + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(String code) { + if(StringUtils.isBlank(code)){ + return StringUtils.EMPTY; + } + for (DriverAbnormalBehaviorAppendixTypeEnum t : DriverAbnormalBehaviorAppendixTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverAbnormalBehaviorOverseeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverAbnormalBehaviorOverseeEnum.java new file mode 100644 index 0000000..9de1c24 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverAbnormalBehaviorOverseeEnum.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.driver.constant; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author CMM + * @description + * @since 2022/12/05 15:31 + */ +@AllArgsConstructor +@Getter +public enum DriverAbnormalBehaviorOverseeEnum { + + UN_OVERSEE(0,"待督办"), + + OVERSEE(1,"已督办"); + + private Integer code; + private String desc; + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(String code) { + if(StringUtils.isBlank(code)){ + return StringUtils.EMPTY; + } + for (DriverAbnormalBehaviorOverseeEnum t : DriverAbnormalBehaviorOverseeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverAbnormalBehaviorProcessingEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverAbnormalBehaviorProcessingEnum.java new file mode 100644 index 0000000..0a97446 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverAbnormalBehaviorProcessingEnum.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * @author CMM + * @description + * @since 2022/12/05 15:31 + */ +@AllArgsConstructor +@Getter +public enum DriverAbnormalBehaviorProcessingEnum { + + UN_DEAL(0,"待处理"), + DEAL(1,"已处理"); + + private Integer code; + private String desc; + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(Integer code) { + if(Objects.nonNull(code)){ + return StringUtils.EMPTY; + } + for (DriverAbnormalBehaviorProcessingEnum t : DriverAbnormalBehaviorProcessingEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverAgeRangeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverAgeRangeEnum.java new file mode 100644 index 0000000..381fb4c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverAgeRangeEnum.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * DriverAgeRangeEnum + *

+ * + * @author WendyYang + * @since 14:52 2022/10/27 + */ +@Getter + +public enum DriverAgeRangeEnum { + + /** + * 年龄范围 + */ + AGE_20_25(20, 25, 20, "20-25岁"), + AGE_26_30(26, 30, 26, "26-30岁"), + AGE_31_35(31, 35, 31, "31-35岁"), + AGE_36_40(36, 40, 36, "36-40岁"), + AGE_41_45(41, 45, 41, "41-45岁"), + AGE_46_50(46, 50, 46, "46-50岁"), + AGE_51(51, -1, 51, "50岁以上"); + + /** + * 无效的值 + */ + public static final int UNDEFINED = -1; + private final int start; + private final int end; + private final int key; + private final String label; + + DriverAgeRangeEnum(int start, int end, int key, String label) { + this.start = start; + this.end = end; + this.key = key; + this.label = label; + } + + public static DriverAgeRangeEnum getByKey(int key){ + return Arrays.stream(values()) + .filter(w -> w.getKey() == key) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("无效的年龄编码")); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverContinuingEducationRegistrationStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverContinuingEducationRegistrationStatusEnum.java new file mode 100644 index 0000000..dd274c3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverContinuingEducationRegistrationStatusEnum.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.driver.constant; + +/** + * @author liuxinxin + * @date 2022/10/20 下午2:28 + * 驾驶员继续教育报名状态 + */ + +public enum DriverContinuingEducationRegistrationStatusEnum { + // 初审/复核阶段 + review_stage, + + // 考试培训阶段 + exam_training_stage, + + // 已完成 + available +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverJobChangeStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverJobChangeStatusEnum.java new file mode 100644 index 0000000..65bd4cd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverJobChangeStatusEnum.java @@ -0,0 +1,15 @@ +package com.ningdatech.carapi.driver.constant; + +/** + * @author liuxinxin + * @date 2022/10/20 下午2:28 + * 驾驶员跳槽审核报名状态 + */ + +public enum DriverJobChangeStatusEnum { + // 初审/复核阶段 + review_stage, + + // 已完成 + available +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverMaterialAuditStatus.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverMaterialAuditStatus.java new file mode 100644 index 0000000..42d9a2a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverMaterialAuditStatus.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/14 上午11:14 + * 驾驶员材料审核状态 + */ +@AllArgsConstructor +@Getter +public enum DriverMaterialAuditStatus { + + /** + * 材料初审中 + */ + IN_PRELIMINARY_TRIAL, + + /** + * 材料初审通过 + */ + PRELIMINARY_TRIAL_PASS, + + /** + * 材料初审驳回 + */ + PRELIMINARY_TRIAL_REJECTION, + + /** + * 材料复核中 + */ + IN_REVIEWING, + + /** + * 材料复核通过 + */ + REVIEWING_PASS, + + /** + * 材料复核驳回 + */ + REVIEWING_REJECTION +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverRegistrationStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverRegistrationStatusEnum.java new file mode 100644 index 0000000..e6afc29 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverRegistrationStatusEnum.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.driver.constant; + +/** + * @author liuxinxin + * @date 2022/10/20 下午2:28 + * 驾驶员取证报名状态 + */ + +public enum DriverRegistrationStatusEnum { + // 初审/复核阶段 + review_stage, + + // 考试培训阶段 + exam_training_stage, + + // 上传培训合格证书阶段 + upload_training_certificate_stage, + + // 已完成 + available +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverReplacementRegistrationStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverReplacementRegistrationStatusEnum.java new file mode 100644 index 0000000..6fad9ef --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverReplacementRegistrationStatusEnum.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.driver.constant; + +/** + * @author liuxinxin + * @date 2022/10/20 下午2:28 + * 驾驶员换证报名状态 + */ + +public enum DriverReplacementRegistrationStatusEnum { + // 初审/复核阶段 + review_stage, + + // 考试培训阶段 + exam_training_stage, + + // 上传培训合格证书阶段 + upload_training_certificate_stage, + + // 已完成 + available +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverStatusEnum.java new file mode 100644 index 0000000..293c1ef --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DriverStatusEnum.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/9 下午5:47 + */ + +@AllArgsConstructor +@Getter +public enum DriverStatusEnum { + + // 入职 + induction, + + // 离职 + quit + + // 未入职 + //un_induction + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DrivingExperienceRangeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DrivingExperienceRangeEnum.java new file mode 100644 index 0000000..4dc8968 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/DrivingExperienceRangeEnum.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.Getter; + +/** + *

+ * DrivingExperienceRangeEnum + *

+ * + * @author WendyYang + * @since 19:22 2022/10/28 + */ +@Getter +public enum DrivingExperienceRangeEnum { + + /** + * 驾驶证超时范围 + */ + RANGE_0(-1, 0, 0, "1年已下"), + RANGE_1_5(1, 5, 5, "1-5年"), + RANGE_6_10(6, 10, 10, "5-10年"), + RANGE_11(11, -1, 11, "10年以上"); + + private final int start; + private final int end; + private final int key; + private final String label; + + public static final int UNDEFINED = -1; + + DrivingExperienceRangeEnum(int start, int end, int key, String label) { + this.start = start; + this.end = end; + this.key = key; + this.label = label; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ExamQualifiedEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ExamQualifiedEnum.java new file mode 100644 index 0000000..efc3cc6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ExamQualifiedEnum.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.constant; + +/** + * @author liuxinxin + * @date 2022/10/26 下午3:15 + * 考试是否合格枚举 + */ + +public enum ExamQualifiedEnum { + + // 合格 + qualified, + + // 不合格 + unqualified +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ExamTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ExamTypeEnum.java new file mode 100644 index 0000000..5ddda13 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ExamTypeEnum.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.driver.constant; + +/** + * @author liuxinxin + * @date 2022/10/26 下午3:01 + * 考试类型id + */ + +public enum ExamTypeEnum { + + // 取证报名 + forensic_registration_training, + + // 换证报名 + replacement_registration_training, + + // 继续教育 + continuing_education_training, + + // 转码培训 + transcoding_training + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ExaminationStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ExaminationStatusEnum.java new file mode 100644 index 0000000..929e9d6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ExaminationStatusEnum.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/22 上午10:32 + * 培训考试状态 + */ +@AllArgsConstructor +@Getter +public enum ExaminationStatusEnum { + // 已考试 + examined, + + // 未考试 + waiting_examination +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/MaterialStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/MaterialStatusEnum.java new file mode 100644 index 0000000..947dd50 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/MaterialStatusEnum.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/21 下午5:06 + */ +@AllArgsConstructor +@Getter +public enum MaterialStatusEnum { + // 启用 + enable, + + // 禁用 + disable +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/MaterialTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/MaterialTypeEnum.java new file mode 100644 index 0000000..17fdfc2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/MaterialTypeEnum.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/21 下午5:09 + */ +@AllArgsConstructor +@Getter +public enum MaterialTypeEnum { + // 规则制度 + rule_system, + + // 政策文件 + policy_documents, + + // 安全知识 + safety_knowledge, + + // 事故案例 + accident_case, + + // 培训视频 + training_video, + + // 其他 + other +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/QuestionTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/QuestionTypeEnum.java new file mode 100644 index 0000000..aee9cc0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/QuestionTypeEnum.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/11 上午11:11 + */ +@AllArgsConstructor +@Getter +public enum QuestionTypeEnum { + + /** + * 单项选择题 + */ + SINGLE_CHOICE, + + /** + * 多项选择题 + */ + MULTIPLE_CHOICE, + + /** + * 判断题 + */ + JUDGMENTAL; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ScoreOperateType.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ScoreOperateType.java new file mode 100644 index 0000000..2fe7674 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/ScoreOperateType.java @@ -0,0 +1,15 @@ +package com.ningdatech.carapi.driver.constant; + +/** + * @author liuxinxin + * @date 2022/11/4 上午9:37 + */ + +public enum ScoreOperateType { + + // 加分 + add, + + // 减分 + reduce +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/StarManageDisplayTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/StarManageDisplayTypeEnum.java new file mode 100644 index 0000000..061078a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/StarManageDisplayTypeEnum.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.driver.constant; + +/** + * @author liuxinxin + * @date 2022/11/15 下午1:59 + */ + +public enum StarManageDisplayTypeEnum { + /** + * 公司ID + */ + company_id, + + region_id, + + driver_id +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingModeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingModeEnum.java new file mode 100644 index 0000000..c9c289b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingModeEnum.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/21 下午2:40 + * 驾驶员培训组织 培训模式枚举 + */ +@AllArgsConstructor +@Getter +public enum TrainingModeEnum { + + // 线上 + online, + + // 线下 + offline + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingRegistrationFlagEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingRegistrationFlagEnum.java new file mode 100644 index 0000000..9e40ec0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingRegistrationFlagEnum.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.driver.constant; + +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 2023/02/15 16:03 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "TrainingRegistrationFlagEnum", description = "驾驶员是否能够参加培训报名-枚举") +public enum TrainingRegistrationFlagEnum { + CAN_NOT_TAKE(0, "false"), + + CAN_TAKE(1, "true"); + + private Integer code; + private String desc; + + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(int code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (TrainingRegistrationFlagEnum t : TrainingRegistrationFlagEnum.values()) { + if (code == t.getCode()) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingRegistrationTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingRegistrationTypeEnum.java new file mode 100644 index 0000000..c406df9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingRegistrationTypeEnum.java @@ -0,0 +1,26 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/19 下午4:43 + * 培训报名类型 + */ +@AllArgsConstructor +@Getter +public enum TrainingRegistrationTypeEnum { + + // 取证报名 + FORENSIC_REGISTRATION, + + // 换证报名 + REPLACEMENT_REGISTRATION, + + // 继续教育 + CONTINUING_EDUCATION, + + // 申请跳槽 + JOB_APPLICATION +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingStatusEnum.java new file mode 100644 index 0000000..2db4e9e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingStatusEnum.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/21 下午2:44 + */ + +@AllArgsConstructor +@Getter +public enum TrainingStatusEnum { + + // 启用 + enable, + + // 禁用 + disable +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingTypeEnum.java new file mode 100644 index 0000000..68c79e2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/TrainingTypeEnum.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.driver.constant; + +/** + * @author liuxinxin + * @date 2022/10/21 下午2:46 + * 培训类型 取证培训/继续教育/换证培训/转码培训 + */ + +public enum TrainingTypeEnum { + + + // 取证报名 + forensic_registration_training, + + // 换证报名 + replacement_registration_training, + + // 继续教育 + continuing_education_training, + + // 转码培训 + transcoding_training + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/UserCanLoginEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/UserCanLoginEnum.java new file mode 100644 index 0000000..8485998 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constant/UserCanLoginEnum.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.driver.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 用户是否可登录 + * @return + * @author CMM + * @since 2023/02/07 13:55 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "UserCanLoginEnum", description = "用户是否可登录-枚举") +public enum UserCanLoginEnum { + + CAN_NOT_LOGIN(0, "false"), + + CAN_LOGIN(1, "true"); + + private Integer code; + private String desc; + + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(int code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (UserCanLoginEnum t : UserCanLoginEnum.values()) { + if (code == t.getCode()) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constants/DriverConstant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constants/DriverConstant.java new file mode 100644 index 0000000..a808927 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/constants/DriverConstant.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.driver.constants; + +/** + * @return + * @author CMM + * @since 2023/06/07 10:27 + */ +public interface DriverConstant { + + String FILE_ID = "fileId"; + + String FILE_NAME = "fileName"; + Integer ID_CARD_DESENSITIZED_FRONT = 1; + Integer ID_CARD_DESENSITIZED_END = 2; + String NO_5 = "%05d"; + Long YEAR_3 = 3L; + String MANAGE_UNIT = "散装中心"; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/ArticleInfoController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/ArticleInfoController.java new file mode 100644 index 0000000..b5a4cff --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/ArticleInfoController.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.driver.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.driver.manage.ArticleInfoManage; +import com.ningdatech.carapi.driver.model.po.ReqArticleInfoListPO; +import com.ningdatech.carapi.driver.model.vo.ResArticleInfoListVO; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + *

+ * 前端控制器 + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +@RequestMapping("/api/v1/article-info") +@RestController +@Api(tags = "文章管理") +@Validated +@RequiredArgsConstructor +public class ArticleInfoController { + + private final ArticleInfoManage articleInfoManage; + + @PostMapping("/list") + @ApiOperation("文章列表查询") + public PageVo articleInfoList(@Valid @RequestBody ReqArticleInfoListPO reqArticleInfoListPo) { + return articleInfoManage.articleInfoList(reqArticleInfoListPo); + } + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/BehaviourManageController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/BehaviourManageController.java new file mode 100644 index 0000000..4a7d89c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/BehaviourManageController.java @@ -0,0 +1,87 @@ +package com.ningdatech.carapi.driver.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.driver.entity.BehaviorAnalysisProcessingMode; +import com.ningdatech.carapi.driver.entity.DriverAbnormalBehaviorAnalysisNoticeDTO; +import com.ningdatech.carapi.driver.entity.DriverAbnormalBehaviorAnalysisOverseeDTO; +import com.ningdatech.carapi.driver.entity.DriverAbnormalBehaviorAnalysisPageParamDTO; +import com.ningdatech.carapi.driver.manage.BehaviourAnalysisManage; +import com.ningdatech.carapi.driver.model.vo.BehaviourAnalysisVO; +import com.ningdatech.carapi.driver.model.vo.DriverAbnormalBehaviorAnalysisDetailVO; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; + +/** + * @author CMM + * @Classname BehaviourManageController + * @Description + * @Date 2022/11/07 16:30 + */ +@RestController +@RequestMapping(value = "/api/v1/driver/behaviour") +@Api(tags = "驾驶员管理-行为管理") +@Validated +@RequiredArgsConstructor +public class BehaviourManageController { + + private final BehaviourAnalysisManage behaviourAnalysisManage; + + @ApiOperation("行为分析") + @GetMapping("/behaviour-analysis-list") + public PageVo behaviourAnalysisList( + @Valid @ModelAttribute DriverAbnormalBehaviorAnalysisPageParamDTO param) { + return behaviourAnalysisManage.behaviorAnalysisList(param); + } + + @ApiOperation("驾驶员异常行为分析详情") + @GetMapping("/analysis-info/detail/{id}") + public DriverAbnormalBehaviorAnalysisDetailVO behaviourAnalysisDetail(@Valid @PathVariable Long id){ + return behaviourAnalysisManage.getBehaviourAnalysisDetail(id); + } + + @ApiOperation("驾驶员异常行为分析督办") + @PostMapping("/analysis/oversee") + public Boolean behaviorAnalysisOversee(@Valid @RequestBody DriverAbnormalBehaviorAnalysisOverseeDTO param){ + return behaviourAnalysisManage.oversee(param, LoginUserUtil.getUserId()); + } + + @ApiOperation("获取驾驶员异常行为分析处理方式-全局配置") + @GetMapping("/analysis/get/processing-mode") + public List processingModeDetail(){ + return behaviourAnalysisManage.processingModeDetail(); + } + + @ApiModelProperty("添加驾驶员异常行为分析处理方式") + @GetMapping("/addProcessingMode") + public Boolean addProcessingMode(@Valid String req){ + return behaviourAnalysisManage.addProcessingMode(req); + } + + @ApiModelProperty("删除驾驶员异常行为分析处理方式") + @DeleteMapping("/deleteProcessingMode/{id}") + public Boolean addProcessingMode(@Valid @PathVariable Integer id){ + return behaviourAnalysisManage.deleteProcessingMode(id); + } + + @ApiOperation("驾驶员异常行为分析处理详情") + @PostMapping("/analysis/deal") + public Boolean behaviorAnalysisNotice(@Valid @RequestBody DriverAbnormalBehaviorAnalysisNoticeDTO param){ + return behaviourAnalysisManage.deal(param,LoginUserUtil.getUserId()); + } + + @ApiOperation("行为分析列表导出") + @GetMapping("/behaviour-analysis-list-export") + public void exportBehaviourAnalysisList(DriverAbnormalBehaviorAnalysisPageParamDTO req, HttpServletResponse response){ + ExcelDownUtil.downXls(response,req,behaviourAnalysisManage::driverAbnormalBehaviorAnalysisListExport); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/CertificateController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/CertificateController.java new file mode 100644 index 0000000..2f8d565 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/CertificateController.java @@ -0,0 +1,50 @@ +package com.ningdatech.carapi.driver.controller; + + +import com.ningdatech.carapi.driver.manage.CertificateManage; +import com.ningdatech.carapi.driver.model.po.ReqUploadCertificatePO; +import com.ningdatech.carapi.driver.model.vo.ResCertificateVO; +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; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2022-10-24 + */ +@RequestMapping("/api/v1/certificate") +@RestController +@Api(tags = "合格证管理") +@Validated +@RequiredArgsConstructor +public class CertificateController { + + private final CertificateManage certificateManage; + + @PostMapping("/upload") + @ApiOperation("上传合格证书") + public void uploadCertificate(@Valid @RequestBody ReqUploadCertificatePO request) { + certificateManage.uploadCertificate(request); + } + + @PostMapping("/get") + @ApiOperation("登陆者获取合格证书(移动端使用)") + public ResCertificateVO getCertificate() { + return certificateManage.getCertificate(); + } + + @PostMapping("/get/web/{driverId}") + @ApiOperation("根据驾驶员id获取合格证书") + public ResCertificateVO getCertificate(@PathVariable("driverId") Long driverId) { + return certificateManage.getCertificate(driverId); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverArchivesController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverArchivesController.java new file mode 100644 index 0000000..dd33527 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverArchivesController.java @@ -0,0 +1,188 @@ +package com.ningdatech.carapi.driver.controller; + + +import java.util.List; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.driver.manage.DriverArchivesManage; +import com.ningdatech.carapi.driver.model.dto.DriverBasicInfoDTO; +import com.ningdatech.carapi.driver.model.po.*; +import com.ningdatech.carapi.driver.model.vo.ResArchivalInfoDetailVO; +import com.ningdatech.carapi.driver.model.vo.ResArchivalInfoSearchListVO; +import com.ningdatech.carapi.driver.model.vo.ResDriverTrainingRegistrationListVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentAnalysisVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentDeadVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleViolationVO; +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; + +/** + * @author LiuXinXin + * @since 2022-10-09 + */ +@RequestMapping("/api/v1/driver/archives") +@RestController +@Api(tags = "驾驶员管理-档案管理(新接口)") +@Validated +@RequiredArgsConstructor +public class DriverArchivesController { + + private final DriverArchivesManage driverArchivesManage; + + @PostMapping("/archival-info/search") + @ApiOperation("档案管理查询") + public PageVo archivalInfoSearch(@Valid @RequestBody ReqArchivalInfoSearchPO po) { + return driverArchivesManage.archivalInfoSearch(po); + } + + @PostMapping("/training/registration") + @ApiOperation("驾驶员培训报名/申请跳槽/继续教育报名/换证培训报名(新接口)") + @WebLog(value = "驾驶员培训报名/申请跳槽/继续教育报名/换证培训报名", modular = "驾驶员管理-档案管理") + public void driverTrainingRegistration + (@Valid @RequestBody ReqDriverTrainingRegistrationPO po) { + driverArchivesManage.driverTrainingRegistration(po); + } + + @PostMapping("/training/registration/un-deal/list") + @ApiOperation("驾驶员培训报名-审核列表筛选(新接口)") + public PageVo driverTrainingRegistrationUnDealList + (@Valid @RequestBody ReqDriverTrainingRegistrationListPO po) { + return driverArchivesManage.driverTrainingRegistrationUnDealList(po); + } + + @PostMapping("/archival-info/detail/review") + @ApiOperation("驾驶员档案审核详情(新接口)") + public ResArchivalInfoDetailVO getArchivalInfoReviewDetail(@Valid @RequestBody ReqGetArchivalInfoReviewDetailPO request) { + return driverArchivesManage.getArchivalInfoReviewDetail(request); + } + + @PostMapping("/archival-info/detail/{driverId}") + @ApiOperation("获取驾驶员档案详情") + public ResArchivalInfoDetailVO getArchivalInfoReviewDetail(@PathVariable("driverId") Long driverId) { + return driverArchivesManage.getDriverArchivalInfo(driverId); + } + + @PostMapping("/archival-info/detail/id-card/{idCard}") + @ApiOperation("根据身份证号获取驾驶员档案详情") + public ResArchivalInfoDetailVO getArchivalInfoReviewDetailByIdCard(@PathVariable("idCard") String idCard) { + return driverArchivesManage.getDriverArchivalInfoByIdCard(idCard); + } + + @PostMapping("/training/preliminary-trial") + @ApiOperation("驾驶员材料初审(新接口)") + public void driverTrainingPreliminaryTrial(@Valid @RequestBody ReqDriverTrainingPreliminaryTrialPO po) { + driverArchivesManage.driverTrainingPreliminaryTrial(po); + } + + @PostMapping("/training/in-review") + @ApiOperation("驾驶员材料复审(新接口)") + @WebLog(value = "驾驶员材料复审", modular = "驾驶员管理-档案管理") + public void driverTrainingInReview(@Valid @RequestBody ReqDriverInReviewingPO po) { + driverArchivesManage.driverTrainingInReview(po); + } + + @PostMapping("/quit/{driverId}") + @ApiOperation("驾驶员离职") + public void driverQuit(@PathVariable("driverId") Long driverId) { + driverArchivesManage.driverQuit(driverId); + } + + @PostMapping("/induction") + @ApiOperation("驾驶员入职") + public void driverInduction(@Valid @RequestBody ReqDriverInductionPO po) { + driverArchivesManage.driverInduction(po); + } + + @PostMapping("/changed-job") + @ApiOperation("驾驶员跳槽") + public void changedJob(@Valid @RequestBody ReqChangedJobPO request) { + driverArchivesManage.changedJob(request); + } + + /** + * 查询驾驶员违章记录档案 + * + * @param driverId,violationType + * @return + */ + @ApiOperation(value = "查询驾驶员违章记录档案", notes = "查询驾驶员违章记录档案") + @GetMapping("/violation") + public List getViolation(@Valid @RequestParam Long driverId, @Valid @RequestParam Integer violationType) { + return driverArchivesManage.getViolation(driverId, violationType); + } + + /** + * 查询驾驶员事故记录档案 + * + * @param driverId + * @return + */ + @ApiOperation(value = "查询驾驶员事故记录档案", notes = "查询驾驶员事故记录档案") + @GetMapping("/accident-driver/{driverId}") + public List getAccidentVehicle(@Valid @PathVariable Long driverId) { + return driverArchivesManage.getAccidentVehicle(driverId); + } + + /** + * 查询驾驶员死亡事故记录档案 + * + * @param driverId + * @return + */ + @ApiOperation(value = "查询驾驶员死亡事故记录档案", notes = "查询驾驶员死亡事故记录档案") + @GetMapping("/accident-dead/{driverId}") + public List getAccidentDead(@Valid @PathVariable Long driverId) { + return driverArchivesManage.getAccidentDead(driverId); + } + + /** + * 查询驾驶员事故分析记录档案 + * + * @param driverId + * @return + */ + @ApiOperation(value = "查询驾驶员事故分析记录档案", notes = "查询驾驶员事故分析记录档案") + @GetMapping("/accident-analysis/{driverId}") + public List getAccidentAnalysis(@Valid @PathVariable Long driverId) { + return driverArchivesManage.getAccidentAnalysis(driverId); + } + + @ApiOperation("驾驶员模版数据导入") + @PostMapping("/importTemplateData") + @WebLog(value = "驾驶员模版数据导入", modular = "驾驶员管理-档案管理") + public String importTemplateData(@RequestParam("template") ImportTemplateEnum template, MultipartFile file, HttpServletResponse response) { + return driverArchivesManage.importDriverArchivesData(template, file, response); + } + + @ApiOperation(value = "驾驶员档案列表导出", notes = "驾驶员档案列表导出") + @GetMapping("/exportDriverArchives") + @WebLog + public void exportDriverArchives(@Valid @ModelAttribute ReqArchivalInfoSearchPO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, driverArchivesManage::exportDriverArchives); + } + + @ApiOperation(value = "驾驶员档案数据录入", notes = "驾驶员档案数据录入") + @PostMapping("/addDriverArchives") + public Boolean addDriverArchives(@Valid @RequestBody ReqAddDriverArchivesPO param) { + return driverArchivesManage.addDriverArchives(param); + } + + @ApiOperation(value = "驾驶员基本信息编辑", notes = "驾驶员基本信息编辑") + @PostMapping("/modifyDriverBasicInfo") + public ResArchivalInfoDetailVO modifyDriverBasicInfo(@Valid @RequestBody DriverBasicInfoDTO data) { + return driverArchivesManage.modifyDriverBasicInfo(data); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverBlackListController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverBlackListController.java new file mode 100644 index 0000000..2cc14ab --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverBlackListController.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.driver.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.driver.manage.DriverBlackListManage; +import com.ningdatech.carapi.driver.model.po.ReqDriverBlackListSearchPO; +import com.ningdatech.carapi.driver.model.vo.ResDriverBlackListVO; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + *

+ * 前端控制器 + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +@RequestMapping("/api/v1/driver/black-list") +@RestController +@Api(tags = "驾驶员管理-黑名单列表") +@Validated +@RequiredArgsConstructor +public class DriverBlackListController { + + private final DriverBlackListManage driverBlackListManage; + + @PostMapping("/search") + @ApiOperation("黑名单列表查询") + public PageVo driverBlackListSearch(@Valid @RequestBody ReqDriverBlackListSearchPO po) { + return driverBlackListManage.driverBlackListSearch(po); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverManageDataViewController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverManageDataViewController.java new file mode 100644 index 0000000..31c0237 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverManageDataViewController.java @@ -0,0 +1,61 @@ +package com.ningdatech.carapi.driver.controller; + +import com.ningdatech.carapi.common.model.DataChartVo; +import com.ningdatech.carapi.common.model.MapDataVO; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.driver.manage.DriverManageDataViewManage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + *

+ * DriverManageDataViewController + *

+ * + * @author WendyYang + * @since 15:28 2022/10/26 + */ +@AllArgsConstructor +@RestController +@Api(tags = "驾驶员管理-数据大屏") +@RequestMapping("/api/v1/driver-manage/data-view") +public class DriverManageDataViewController { + + private final DriverManageDataViewManage driverManageDataViewManage; + + @ApiOperation("驾驶员比例/驾驶员分布") + @GetMapping("/driverStatisticsByRegion/{regionId}") + public List driverStatisticsByRegion(@PathVariable Long regionId) { + regionId = CodeUtil.convertRegionCodeToId(regionId); + return driverManageDataViewManage.driverStatisticsByRegion(regionId); + } + + @ApiOperation("驾驶员年龄统计") + @GetMapping("/driverAgeStatisticsByRegion/{regionId}") + public List driverAgeStatisticsByRegion(@PathVariable Long regionId) { + regionId = CodeUtil.convertRegionCodeToId(regionId); + return driverManageDataViewManage.driverAgeStatisticsByRegion(regionId); + } + + @ApiOperation("驾驶员驾龄统计") + @GetMapping("/drivingExperienceStatisticsByRegion/{regionId}") + public List drivingExperienceStatisticsByRegion(@PathVariable Long regionId) { + regionId = CodeUtil.convertRegionCodeToId(regionId); + return driverManageDataViewManage.drivingExperienceStatisticsByRegion(regionId); + } + + @ApiOperation("驾驶员籍贯统计") + @GetMapping("/driverNativePlaceStatisticsByRegion/{regionId}") + public List driverNativePlaceStatisticsByRegion(@PathVariable Long regionId) { + regionId = CodeUtil.convertRegionCodeToId(regionId); + return driverManageDataViewManage.driverNativePlaceStatisticsByRegion(regionId); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverScoreInfoController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverScoreInfoController.java new file mode 100644 index 0000000..95499bf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverScoreInfoController.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2022-10-27 + */ +@Controller +@RequestMapping("/carapi.driver/driver-score-info") +public class DriverScoreInfoController { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverScoreRecordController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverScoreRecordController.java new file mode 100644 index 0000000..93deb6d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/DriverScoreRecordController.java @@ -0,0 +1,60 @@ +package com.ningdatech.carapi.driver.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.driver.manage.DriverScoreRecordManage; +import com.ningdatech.carapi.driver.model.po.ReqScoreBonusPO; +import com.ningdatech.carapi.driver.model.po.ReqScoreListPO; +import com.ningdatech.carapi.driver.model.vo.ResDriverScoreRecordListVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Controller; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2022-10-27 + */ +@Controller +@RequestMapping("/api/v1/score") +@RestController +@Api(tags = "驾驶员分数记录列表") +@Validated +@RequiredArgsConstructor +public class DriverScoreRecordController { + + private final DriverScoreRecordManage driverScoreRecordManage; + + @PostMapping("/list") + @ApiOperation("驾驶员分数记录") + public List list() { + return driverScoreRecordManage.list(); + } + + @PostMapping("/page-list") + @ApiOperation("驾驶员分页分数记录") + public PageVo pageList(@Valid @RequestBody ReqScoreListPO request) { + return driverScoreRecordManage.pageList(request); + } + + @PostMapping("/score/{driverId}") + @ApiOperation("获取驾驶员分数") + public Integer getScore(@PathVariable("driverId") Long driverId) { + return driverScoreRecordManage.getScore(driverId); + } + + @PostMapping("/score/bonus") + @ApiOperation("培训奖励分数") + public void bonus(@Valid @RequestBody ReqScoreBonusPO request) { + driverScoreRecordManage.bonus(request); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/ExamRecordController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/ExamRecordController.java new file mode 100644 index 0000000..d78d373 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/ExamRecordController.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.driver.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.driver.manage.ExamRecordManage; +import com.ningdatech.carapi.driver.model.po.ReqListExamRecordPO; +import com.ningdatech.carapi.driver.model.vo.ResListExamRecordVO; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2022-10-26 + */ +@RequestMapping("/api/v1/exam-record") +@RestController +@Api(tags = "考试记录") +@Validated +@RequiredArgsConstructor +public class ExamRecordController { + private final ExamRecordManage examRecordManage; + + @PostMapping("/list") + @ApiOperation("培训考试列表筛选") + public PageVo listExamRecord(@Valid @RequestBody ReqListExamRecordPO request) { + return examRecordManage.listExamRecord(request); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/StarManageController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/StarManageController.java new file mode 100644 index 0000000..989945c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/StarManageController.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.driver.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.driver.manage.DriverStarManage; +import com.ningdatech.carapi.driver.model.po.ReqCompanyStarPO; +import com.ningdatech.carapi.driver.model.po.ReqDriverStarListPO; +import com.ningdatech.carapi.driver.model.po.ReqRegionStarPO; +import com.ningdatech.carapi.driver.model.vo.ResCompanyStarListVO; +import com.ningdatech.carapi.driver.model.vo.ResDriverStarListVO; +import com.ningdatech.carapi.driver.model.vo.ResRegionStarVO; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2022-11-15 + */ +@RequestMapping("/api/v1/start-manage") +@RestController +@Api(tags = "驾驶员星级管理") +@Validated +@RequiredArgsConstructor +public class StarManageController { + + public final DriverStarManage driverStarManage; + + @PostMapping("/driver-star-list") + @ApiOperation("驾驶员星级列表筛选") + public PageVo driverStarList(@Valid @RequestBody ReqDriverStarListPO request) { + return driverStarManage.driverStarList(request); + } + + @PostMapping("/region-star-summary") + @ApiOperation("区域列表筛选") + public PageVo regionStarList(@Valid @RequestBody ReqRegionStarPO request) { + return driverStarManage.regionStarList(request); + } + + @PostMapping("/company-star-summary") + @ApiOperation("公司星级列表筛选") + public PageVo companyStarList(@Valid @RequestBody ReqCompanyStarPO request) { + return driverStarManage.companyStarList(request); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/TrainingMaterialController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/TrainingMaterialController.java new file mode 100644 index 0000000..120187a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/TrainingMaterialController.java @@ -0,0 +1,60 @@ +package com.ningdatech.carapi.driver.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.driver.manage.TrainingMaterialManage; +import com.ningdatech.carapi.driver.model.po.ReqSaveTrainingMaterialPO; +import com.ningdatech.carapi.driver.model.po.ReqTrainingMaterialListPO; +import com.ningdatech.carapi.driver.model.vo.ResSaveTrainingMaterialVO; +import com.ningdatech.carapi.driver.model.vo.ResTrainingMaterialListVO; +import com.ningdatech.carapi.driver.model.vo.ResTrainingMaterialVO; +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; + +/** + *

+ * 前端控制器 + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +@RequestMapping("/api/v1/driver/training-materials") +@RestController +@Api(tags = "驾驶员管理-培训管理-培训材料") +@Validated +@RequiredArgsConstructor +public class TrainingMaterialController { + + private final TrainingMaterialManage trainingMaterialManage; + + @PostMapping("/list") + @ApiOperation("培训材料-列表查询(新接口)") + public PageVo trainingMaterialsList(@Valid @RequestBody ReqTrainingMaterialListPO po) { + return trainingMaterialManage.trainingMaterialsList(po); + } + + @PostMapping("/save") + @ApiOperation("保存培训材料(新接口)") + public ResSaveTrainingMaterialVO saveTrainingMaterial(@Valid @RequestBody ReqSaveTrainingMaterialPO request) { + return trainingMaterialManage.saveTrainingMaterial(request); + } + + @PostMapping("/detail/{trainingMaterialId}") + @ApiOperation("培训材料详情") + public ResTrainingMaterialVO getTrainingMaterialDetail(@PathVariable("trainingMaterialId") Long trainingMaterialId) { + return trainingMaterialManage.getTrainingMaterialDetail(trainingMaterialId); + } + + @PostMapping("remove/{trainingMaterialId}") + @ApiOperation("删除培训材料") + public void removeTrainingMaterial(@PathVariable("trainingMaterialId") Long trainingMaterialId) { + trainingMaterialManage.removeTrainingMaterial(trainingMaterialId); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/TrainingOrganizationController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/TrainingOrganizationController.java new file mode 100644 index 0000000..447b328 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/controller/TrainingOrganizationController.java @@ -0,0 +1,127 @@ +package com.ningdatech.carapi.driver.controller; + + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.driver.manage.TrainingOrganizationManage; +import com.ningdatech.carapi.driver.model.po.*; +import com.ningdatech.carapi.driver.model.query.TrainingOrgTrainersQuery; +import com.ningdatech.carapi.driver.model.vo.*; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 前端控制器 + *

+ * + * @author LiuXinXin + * @since 2022-10-10 + */ +@RequestMapping("/api/v1/driver/training-organization") +@RestController +@Api(tags = "驾驶员管理-培训管理-培训组织") +@Validated +@RequiredArgsConstructor +public class TrainingOrganizationController { + + private final TrainingOrganizationManage trainingOrganizationManage; + + @PostMapping("/save") + @ApiOperation("保存培训组织(新接口)") + public ResCreateTrainingOrgVO saveTrainingOrganization(@Valid @RequestBody ReqCreateTrainingOrgPO request) { + return trainingOrganizationManage.saveTrainingOrganization(request); + } + + @PostMapping("/list") + @ApiOperation("培训组织-列表查询(新接口)") + public PageVo trainingOrganizationList(@Valid @RequestBody ReqTrainingOrganizationListPO request) { + return trainingOrganizationManage.trainingOrganizationList(request); + } + + @PostMapping("/status-modify") + @ApiOperation("培训组织状态变更") + public void trainingOrganizationStatusModify(@Valid @RequestBody ReqTrainingOrganizationStatusModifyPO request) { + trainingOrganizationManage.trainingOrganizationStatusModify(request); + } + + @PostMapping("/detail/{organizationId}") + @ApiOperation("培训组织-详情") + public ResTrainingOrganizationDetailVO trainingOrganizationDetail(@Valid @PathVariable("organizationId") Long organizationId) { + return trainingOrganizationManage.trainingOrganizationDetail(organizationId); + } + + @PostMapping("/delete/{organizationId}") + @ApiOperation("培训组织-删除培训组织") + public void deleteTrainingOrganization(@Valid @PathVariable("organizationId") Long organizationId) { + trainingOrganizationManage.deleteTrainingOrganization(organizationId); + } + + @PostMapping("/upload/exam-result") + @ApiOperation("培训考试-上传考试结果") + public void uploadExamResult(@Valid @RequestBody ReqUploadExamResultPO request) { + trainingOrganizationManage.uploadExamResult(request); + } + + @PostMapping("/upload/exam-result-generate-certificate") + @ApiOperation("培训考试-上传考试结果并生成电子合格证") + public void uploadExamResultAndGenerateCertificate(@Valid @RequestBody ReqUploadExamResultPO request) { + trainingOrganizationManage.uploadExamResultAndGenerateCertificate(request); + } + + @PostMapping("/make-up-exam") + @ApiOperation("补考") + public void makeUpExam(@Valid @RequestBody ReqMakeUpExamPO request) { + trainingOrganizationManage.makeUpExam(request); + } + + @PostMapping("/get/current-user-organization") + @ApiOperation("获取当前用户培训组织") + public ResCurrentUserOrganizationVO getCurrentUserOrganization(@Valid @RequestBody ReqCurrentUserOrganizationPO request) { + return trainingOrganizationManage.getCurrentUserOrganization(request); + } + + @PostMapping("/sign/{organizationId}") + @ApiOperation("培训签到") + public void organizationSign(@PathVariable("organizationId") Long organizationId) { + trainingOrganizationManage.organizationSign(organizationId); + } + + @PostMapping("/sign/check/{organizationId}") + @ApiOperation("培训签到校验 已签到返回 true 否则返回false") + public Boolean organizationSignCheck(@PathVariable("organizationId") Long organizationId) { + return trainingOrganizationManage.organizationSignCheck(organizationId); + } + + @PostMapping("/driver-training/list") + @ApiOperation("驾驶员培训记录列表") + public PageVo driverTrainingList(@Valid @RequestBody ReqDriverTrainingListPO request) { + return trainingOrganizationManage.driverTrainingList(request); + } + + @GetMapping("/getTrainers") + @ApiOperation("获取培训组织关联的培训人员信息") + public PageVo trainerList(@Valid @ModelAttribute TrainingOrgTrainersQuery request){ + return trainingOrganizationManage.trainerList(request); + } + + @PostMapping("/set/exam-time") + @ApiOperation("培训考试-设置考试时间") + public String setExamTime(@Valid @RequestBody ReqSetExamTimePO request) { + return trainingOrganizationManage.setExamTime(request); + } + + @PostMapping("/trainer/export") + @ApiOperation("培训人员信息导出") + public void exportTrainer(@Valid @ModelAttribute ReqTrainerExportPO req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, trainingOrganizationManage::exportTrainer); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/ArticleInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/ArticleInfo.java new file mode 100644 index 0000000..f4cd5da --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/ArticleInfo.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.driver.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @author LiuXinXin + * @since 2022-10-09 + */ +@TableName("nd_article_info") +@Data +public class ArticleInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private String createOn; + + private LocalDateTime updateOn; + + /** + * 制定时间 + */ + private LocalDateTime formulationTime; + + /** + * 标题 + */ + private String title; + + /** + * 文章类型 + */ + private String articleType; + + /** + * 文章状态 + */ + private String articleStatus; + + /** + * 文件内容 + */ + private String content; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/BehaviorAnalysisProcessingMode.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/BehaviorAnalysisProcessingMode.java new file mode 100644 index 0000000..fa2b8ab --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/BehaviorAnalysisProcessingMode.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.driver.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author CMM + * @description + * @since 2022/12/14 17:29 + */ +@Data +@TableName("nd_driver_abnormal_behavior_processing_mode") +public class BehaviorAnalysisProcessingMode implements Serializable { + + private static final long serialVersionUID = 5422041381526432689L; + + @ApiModelProperty("处理方式ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("处理方式名称") + private String processingModeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/BehaviourAnalysisExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/BehaviourAnalysisExportDTO.java new file mode 100644 index 0000000..474f13f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/BehaviourAnalysisExportDTO.java @@ -0,0 +1,98 @@ +package com.ningdatech.carapi.driver.entity; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.constant.BgTypeEnum; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @author CMM + * @Classname SecurityMonitorJoin + * @Description + * @Date 2022/11/6 20:59 + */ +@Data +public class BehaviourAnalysisExportDTO implements Serializable { + + private static final long serialVersionUID = 498564167561863385L; + + @ApiModelProperty("告警事件id") + @ExcelProperty("ID") + private Long id; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("驾驶员姓名") + @ExcelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("驾驶员ID") + @ExcelProperty("驾驶员ID") + private Long driverId; + + /** + * {@link BgTypeEnum} + */ + @ApiModelProperty("告警类型") + @ExcelProperty("告警类型") + private Integer alarmType; + + @ApiModelProperty("告警类型名称") + @ExcelProperty("告警类型名称") + private String alarmTypeName; + + @ApiModelProperty(value = "告警级别",allowableValues = "1 预警,2 报警") + @ExcelProperty("告警级别") + private Integer alarmLevel; + + @ApiModelProperty("告警级别名称") + @ExcelProperty("告警级别名称") + private String alarmLevelName; + + @ApiModelProperty("车辆速度") + @ExcelProperty("车辆速度") + private Integer speed; + + @ApiModelProperty("告警时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ExcelProperty("告警时间") + private LocalDateTime alarmTime; + + @ApiModelProperty("告警地址") + @ExcelProperty("告警地址") + private String alarmAddress; + + @ApiModelProperty("告警图片附件") + @ExcelProperty("告警图片附件网址") + private String alarmPictureAppendix; + + @ApiModelProperty("告警视频附件") + @ExcelProperty("告警视频附件网址") + private String alarmVideoAppendix; + + @ApiModelProperty("处理状态") + @ExcelProperty("处理状态") + private Integer processingStatus; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/Certificate.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/Certificate.java new file mode 100644 index 0000000..5d93d97 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/Certificate.java @@ -0,0 +1,97 @@ +package com.ningdatech.carapi.driver.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; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-24 + */ +@Data +@TableName("nd_certificate") +@ApiModel(value = "Certificate对象", description = "") +public class Certificate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("驾驶员合格证表") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("驾驶员用户id") + private Long userId; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("出生年月") + private LocalDateTime birth; + + @ApiModelProperty("性别") + private Integer gender; + + @ApiModelProperty("籍贯") + private String nativePlace; + + @ApiModelProperty("健康状况") + private String health; + + @ApiModelProperty("手机号码") + private String phoneNo; + + @ApiModelProperty("住址") + private String address; + + @ApiModelProperty("驾驶证类型") + private String driverLicenseType; + + @ApiModelProperty("驾驶证号") + private String driverLicenseNo; + + @ApiModelProperty("合格证编号") + private String certificateNo; + + @ApiModelProperty("发证单位") + private String issuedBy; + + @ApiModelProperty("发证日期") + private LocalDateTime issueDate; + + @ApiModelProperty("有效期至") + private LocalDateTime expiryDate; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverAbnormalBehaviorAnalysis.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverAbnormalBehaviorAnalysis.java new file mode 100644 index 0000000..97a67a6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverAbnormalBehaviorAnalysis.java @@ -0,0 +1,139 @@ +package com.ningdatech.carapi.driver.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import com.ningdatech.carapi.common.constant.BgTypeEnum; +import com.ningdatech.carapi.driver.constant.DriverAbnormalBehaviorOverseeEnum; +import com.ningdatech.carapi.driver.constant.DriverAbnormalBehaviorProcessingEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @author CMM + * @Description + * @Date 2022/11/6 20:59 + */ +@TableName("nd_driver_abnormal_behavior_analysis") +@Data +@ApiModel(value = "DriverAbnormalBehaviorAnalysis",description = "驾驶员行为分析") +@NoArgsConstructor +@AllArgsConstructor +public class DriverAbnormalBehaviorAnalysis extends BaseEntity implements Serializable { + private static final long serialVersionUID = 4998442662608188657L; + + @ApiModelProperty("告警事件id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("驾驶员ID") + private Long driverId; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + /** + * {@link BgTypeEnum} + */ + @ApiModelProperty("告警类型") + private Integer alarmType; + + @ApiModelProperty(value = "告警级别",allowableValues = "1 预警,2 报警") + private Integer alarmLevel; + + @ApiModelProperty("告警级别名称") + private String alarmLevelName; + + @ApiModelProperty("车辆速度") + private Integer speed; + + @ApiModelProperty("告警时间") + private LocalDateTime alarmTime; + + @ApiModelProperty("告警地点") + private String alarmAddress; + + @ApiModelProperty("告警图片附件") + private String alarmPictureAppendix; + + @ApiModelProperty("告警视频附件") + private String alarmVideoAppendix; + + /** + * {@link DriverAbnormalBehaviorProcessingEnum} + */ + @ApiModelProperty(value = "处理状态",allowableValues = "0 待处理,1 已处理") + private Integer processingStatus; + + /** + * {@link DriverAbnormalBehaviorOverseeEnum} + */ + @ApiModelProperty(value = "处理状态",allowableValues = "0 待督办,1 已督办") + private Integer overseeStatus; + + @ApiModelProperty("处理方式") + private String processingMode; + + @ApiModelProperty("处理描述") + private String processingDescription; + + @ApiModelProperty("处理用户") + private String processingUser; + + @ApiModelProperty("处理时间") + private LocalDateTime processingTime; + + @ApiModelProperty("地址信息") + private String addressInfo; + + @ApiModelProperty("供应商数据关联id") + private Integer supplierDataId; + + @ApiModelProperty("告警类型名称") + private String alarmTypeName; + + @ApiModelProperty("供应商报警唯一序号") + private Long alarmMsgSn; + + @ApiModelProperty("平台ID") + private Long gnssCenterId; + + @ApiModelProperty("告警GPS高度") + private BigDecimal altitude; + + @ApiModelProperty("告警GPS经度") + private BigDecimal longitude; + + @ApiModelProperty("告警GPS纬度") + private BigDecimal latitude; + + @ApiModelProperty("督办处理结果") + private String overseeResult; + + @ApiModelProperty("督办时间") + private LocalDateTime overseeTime; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverAbnormalBehaviorAnalysisNoticeDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverAbnormalBehaviorAnalysisNoticeDTO.java new file mode 100644 index 0000000..8652353 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverAbnormalBehaviorAnalysisNoticeDTO.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.driver.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.List; + +/** + * @author CMM + * @description + * @since 2022/12/08 10:55 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "DriverAbnormalBehaviorAnalysisNoticeDTO",description = "驾驶员异常行为分析通知") +public class DriverAbnormalBehaviorAnalysisNoticeDTO implements Serializable { + + private static final long serialVersionUID = 4549243904173062235L; + + @ApiModelProperty(value = "驾驶员异常行为数据ID",required = true) + @NotNull(message = "驾驶员异常行为数据ID不能为空!") + private Long id; + + @ApiModelProperty(value = "处理方式",required = true) + @NotNull(message = "驾驶员异常行为处理方式不能为空!") + private List processingMode; + + @ApiModelProperty(value = "处理描述内容",required = true) + @NotNull(message = "请传入处理描述的内容!") + @Size(max = 100) + private String processingDescription; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverAbnormalBehaviorAnalysisOverseeDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverAbnormalBehaviorAnalysisOverseeDTO.java new file mode 100644 index 0000000..1c4bbb3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverAbnormalBehaviorAnalysisOverseeDTO.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.driver.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @author CMM + * @description + * @since 2022/12/06 23:33 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "DriverAbnormalBehaviorAnalysisOverseeDTO",description = "驾驶员异常行为分析处理") +public class DriverAbnormalBehaviorAnalysisOverseeDTO implements Serializable { + + private static final long serialVersionUID = 8267690499784450167L; + + @ApiModelProperty(value = "驾驶员异常行为数据ID",required = true) + @NotNull(message = "驾驶员异常行为数据ID不能为空!") + private Long id; + + @ApiModelProperty(value = "督办状态 0 不督办告警 1 督办告警",required = true) + @NotNull(message = "请传入督办状态!") + private Integer overseeStatus; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverAbnormalBehaviorAnalysisPageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverAbnormalBehaviorAnalysisPageParamDTO.java new file mode 100644 index 0000000..8c8f57d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverAbnormalBehaviorAnalysisPageParamDTO.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.driver.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Set; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @description + * @since 2022/12/02 17:08 + */ +@Data +@ApiModel(description = "驾驶员异常行为分析PARAM DTO") +public class DriverAbnormalBehaviorAnalysisPageParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = -7881235564388790588L; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty(value = "告警级别",allowableValues = "1 预警,2 报警") + private Integer level; + + @ApiModelProperty("告警级别名称") + private Integer alarmLevelName; + + @ApiModelProperty(value = "告警类型") + private List alarmType; + + @ApiModelProperty("开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + private LocalDateTime endTime; + + @ApiModelProperty(value = "处理状态",allowableValues = "0 待处理,1 已处理") + private Integer processingStatus; + + @ApiModelProperty(value = "督办状态",allowableValues = "0 待督办,1 已督办") + private Integer overseeStatus; + + @ApiModelProperty("系统车牌号列表") + private Set carPlateList; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverArchivesDataImportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverArchivesDataImportDTO.java new file mode 100644 index 0000000..ae2d548 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverArchivesDataImportDTO.java @@ -0,0 +1,61 @@ +package com.ningdatech.carapi.driver.entity; + +import com.ningdatech.carapi.common.constant.ApprovedMotorcycleTypeEnum; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * @author CMM + * @description + * @since 2022/11/30 11:59 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DriverArchivesDataImportDTO { + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("性别") + private String gender; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("出生年月") + private LocalDateTime birth; + + @ApiModelProperty("籍贯") + private String nativePlace; + + @ApiModelProperty("手机号码") + private String phoneNo; + + @ApiModelProperty("健康状况") + private String health; + + @ApiModelProperty("住址") + private String address; + + @ApiModelProperty("驾驶证号") + private String driverLicenseNo; + + @ApiModelProperty("准驾车型") + private String driverLicenseType; + + @ApiModelProperty("初次领证时间") + private LocalDateTime initialLicenseTime; + + /** + * {@link ApprovedMotorcycleTypeEnum} + */ + @ApiModelProperty("拟驾车型列表") + private String motorcycleTypeList; + + @ApiModelProperty("违法违规信息") + private String illegalAndIllegalInfo; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverBlackList.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverBlackList.java new file mode 100644 index 0000000..39842cf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverBlackList.java @@ -0,0 +1,86 @@ +package com.ningdatech.carapi.driver.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +@Data +@TableName("nd_driver_black_list") +public class DriverBlackList implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 驾驶员ID + */ + private Long driverId; + + /** + * 驾驶员姓名 + */ + private String driverName; + + /** + * 年度 + */ + private String year; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + /** + * 超速累计次数 + */ + private Long accumulatedOverspeedCnt; + + /** + * 出险累计次数 + */ + private Long accumulatedAccidentsCnt; + + /** + * 违章累计次数 + */ + private Long accumulatedViolationsCnt; + + /** + * 区域ID + */ + private Long regionId; + + /** + * 公司ID + */ + private Long companyId; + + /** + * 公司名 + */ + private String companyName; + + /** + * 累计伤人次数 + */ + private Long accumulatedHurtCnt; + + /** + * 累计亡人次数 + */ + private Long accumulatedDeathCnt; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverInfo.java new file mode 100644 index 0000000..e00cd38 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverInfo.java @@ -0,0 +1,147 @@ +package com.ningdatech.carapi.driver.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.constant.ApprovedMotorcycleTypeEnum; +import com.ningdatech.carapi.driver.constant.DriverContinuingEducationRegistrationStatusEnum; +import com.ningdatech.carapi.driver.constant.DriverRegistrationStatusEnum; +import com.ningdatech.carapi.driver.constant.DriverReplacementRegistrationStatusEnum; +import com.ningdatech.carapi.driver.constant.DriverStatusEnum; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +@TableName("nd_driver_info") +@Data +public class DriverInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("驾驶头像文件") + private String avatarFile; + + @ApiModelProperty("性别") + private Integer gender; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("出生年月") + private LocalDateTime birth; + + @ApiModelProperty("籍贯") + private String nativePlace; + + @ApiModelProperty("籍贯") + @NotBlank(message = "籍贯编码") + private String nativePlaceRegionCode; + + @ApiModelProperty("手机号码") + private String phoneNo; + + @ApiModelProperty("健康状况") + private String health; + + @ApiModelProperty("住址") + private String address; + + @ApiModelProperty("驾驶员证号") + private String driverLicenseNo; + + @ApiModelProperty("驾驶证类型") + private String driverLicenseType; + + @ApiModelProperty("服务企业唯一标识id") + private Long companyId; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + /** + * {@link DriverStatusEnum} + */ + @ApiModelProperty(value = "驾驶员状态", + allowableValues = " induction 入职,quit 离职") + private String driverStatus; + + @ApiModelProperty("系统用户ID") + private Long userId; + + @ApiModelProperty("区域id") + private Long regionId; + + /** + * {@link DriverRegistrationStatusEnum} + */ + @ApiModelProperty("驾驶员取证报名状态") + private String driverRegistrationStatus; + + @ApiModelProperty("违法违规信息") + private String illegalAndIllegalInfo; + + @ApiModelProperty("初次领证时间") + private LocalDateTime initialLicenseTime; + + @ApiModelProperty("离职时间") + private LocalDateTime quitTime; + + @ApiModelProperty("入职时间") + private LocalDateTime inductionTime; + + /** + * {@link DriverReplacementRegistrationStatusEnum} + */ + @ApiModelProperty("驾驶员换证培训报名状态") + private String replacementRegistrationStatus; + + /** + * {@link DriverContinuingEducationRegistrationStatusEnum} + */ + @ApiModelProperty("驾驶员继续教育报名状态") + private String continuingEducationStatus; + + /** + * {@link DriverContinuingEducationRegistrationStatusEnum} + */ + @ApiModelProperty("驾驶员跳槽审核报名状态") + private String jobChangeStatus; + + /** + * {@link ApprovedMotorcycleTypeEnum} + */ + @ApiModelProperty("拟驾车型列表") + private String motorcycleTypeList; + + @ApiModelProperty("驾驶员是否可以参加取证报名") + private Integer driverRegistrationFlag; + + @ApiModelProperty("驾驶员是否可以参加继续教育报名") + private Integer continuingEducationFlag; + + @ApiModelProperty("驾驶员是否可以参加换证培训报名") + private Integer replacementRegistrationFlag; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverScoreInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverScoreInfo.java new file mode 100644 index 0000000..69a61de --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverScoreInfo.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.driver.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; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-27 + */ +@TableName("nd_driver_score_info") +@Data +@ApiModel(value = "DriverScoreInfo对象", description = "") +public class DriverScoreInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + @ApiModelProperty("用户id") + private Long userId; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("驾驶员分数") + private Integer driverScore; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverScoreRecord.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverScoreRecord.java new file mode 100644 index 0000000..6b4bb2d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverScoreRecord.java @@ -0,0 +1,52 @@ +package com.ningdatech.carapi.driver.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; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-27 + */ +@Data +@TableName("nd_driver_score_record") +@ApiModel(value = "DriverScoreRecord对象", description = "") +public class DriverScoreRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + @ApiModelProperty("用户id") + private Long userId; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("操作分数") + private Integer operateScore; + + @ApiModelProperty("操作类型 加分减分") + private String operateType; + + @ApiModelProperty("加分减分原因") + private String operateReason; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverTrainingMaterials.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverTrainingMaterials.java new file mode 100644 index 0000000..daf311f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverTrainingMaterials.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.driver.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +@TableName("nd_driver_training_materials") +@Data +public class DriverTrainingMaterials implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * oss文件id + */ + private Long fileId; + + private String fileName; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverWorkRecordInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverWorkRecordInfo.java new file mode 100644 index 0000000..8b3f87f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/DriverWorkRecordInfo.java @@ -0,0 +1,131 @@ +package com.ningdatech.carapi.driver.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.constant.ApprovedMotorcycleTypeEnum; +import com.ningdatech.carapi.driver.constant.DriverContinuingEducationRegistrationStatusEnum; +import com.ningdatech.carapi.driver.constant.DriverRegistrationStatusEnum; +import com.ningdatech.carapi.driver.constant.DriverReplacementRegistrationStatusEnum; +import com.ningdatech.carapi.driver.constant.DriverStatusEnum; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.time.LocalDateTime; + + +@TableName("nd_driver_work_record") +@Data +public class DriverWorkRecordInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("驾驶头像文件") + private String avatarFile; + + @ApiModelProperty("性别") + private Integer gender; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("出生年月") + private LocalDateTime birth; + + @ApiModelProperty("籍贯") + private String nativePlace; + + @ApiModelProperty("籍贯") + @NotBlank(message = "籍贯编码") + private String nativePlaceRegionCode; + + @ApiModelProperty("手机号码") + private String phoneNo; + + @ApiModelProperty("健康状况") + private String health; + + @ApiModelProperty("住址") + private String address; + + @ApiModelProperty("驾驶员证号") + private String driverLicenseNo; + + @ApiModelProperty("驾驶证类型") + private String driverLicenseType; + + @ApiModelProperty("服务企业唯一标识id") + private Long companyId; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + /** + * {@link DriverStatusEnum} + */ + @ApiModelProperty("驾驶员状态:入职/离职") + private String driverStatus; + + @ApiModelProperty("系统用户ID") + private Long userId; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("区域") + private String regionName; + + /** + * {@link DriverRegistrationStatusEnum} + */ + @ApiModelProperty("驾驶员取证报名状态") + private String driverRegistrationStatus; + + @ApiModelProperty("违法违规信息") + private String illegalAndIllegalInfo; + + @ApiModelProperty("初次领证时间") + private LocalDateTime initialLicenseTime; + + @ApiModelProperty("离职时间") + private LocalDateTime quitTime; + + @ApiModelProperty("入职时间") + private LocalDateTime inductionTime; + + /** + * {@link DriverReplacementRegistrationStatusEnum} + */ + @ApiModelProperty("驾驶员换证培训报名状态") + private String replacementRegistrationStatus; + + /** + * {@link DriverContinuingEducationRegistrationStatusEnum} + */ + @ApiModelProperty("驾驶员继续教育报名状态") + private String continuingEducationStatus; + + /** + * {@link ApprovedMotorcycleTypeEnum} + */ + @ApiModelProperty("拟驾车型列表") + private String motorcycleTypeList; + + @ApiModelProperty("驾驶员Id") + private Long driverId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/ExamRecord.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/ExamRecord.java new file mode 100644 index 0000000..6aca399 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/ExamRecord.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.driver.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 com.ningdatech.carapi.driver.constant.TrainingTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-26 + */ +@Data +@TableName("nd_exam_record") +@ApiModel(value = "ExamRecord对象", description = "") +public class ExamRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + /** + * 培训类型 取证培训/继续教育/换证培训/转码培训 + * {@link TrainingTypeEnum} + */ + @NotNull(message = "培训类型不能为空") + @ApiModelProperty(value = "考试类型 取证培训/继续教育/换证培训/转码培训", allowableValues = "forensic_registration_training 取证报名,replacement_registration_training 换证报名 ,continuing_education_training 继续教育,transcoding_training 转码培训") + private String examType; + + @ApiModelProperty("训练组织id") + private Long trainingOrganizationId; + + @ApiModelProperty("考试试卷id") + private Long examPaperId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/ExamRecordDetail.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/ExamRecordDetail.java new file mode 100644 index 0000000..5a1f1dd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/ExamRecordDetail.java @@ -0,0 +1,69 @@ +package com.ningdatech.carapi.driver.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; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-26 + */ +@Data +@TableName("nd_exam_record_detail") +@ApiModel(value = "ExamRecordDetail对象", description = "") +public class ExamRecordDetail implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("驾驶员用户id") + private Long driverUserId; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("公司id") + private Long companyId; + + @ApiModelProperty("公司名称") + private String companyName; + + @ApiModelProperty("考试分数") + private Integer score; + + @ApiModelProperty("考试结果") + private String examResult; + + @ApiModelProperty("考试时间") + private LocalDateTime examTime; + + @ApiModelProperty("所属区域") + private Long regionId; + + @ApiModelProperty("考试类型") + private String examType; + + @ApiModelProperty("考试记录id") + private Long examRecordId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/OverseeInterfaceCallDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/OverseeInterfaceCallDTO.java new file mode 100644 index 0000000..e1b7975 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/OverseeInterfaceCallDTO.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.driver.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author CMM + * @description + * @since 2022/12/08 14:35 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OverseeInterfaceCallDTO implements Serializable { + + private static final long serialVersionUID = 3881169002010057397L; + + @ApiModelProperty("平台ID") + private Long GnssCenterId; + + @ApiModelProperty("告警唯一序号") + private Long MSgSn; + + @ApiModelProperty("督办截止时间") + private Integer SupervisionEndTime; + + @ApiModelProperty("督办等级") + private Integer SupervisionLevel; + + @ApiModelProperty("督办人") + private String Supervisor; + + @ApiModelProperty("督办人手机号") + private String SupervisorTel; + + @ApiModelProperty("督办人邮箱") + private String SupervisorEmail; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/RegionStarDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/RegionStarDTO.java new file mode 100644 index 0000000..aec0879 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/RegionStarDTO.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.driver.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @author CMM + * @description + * @since 2022/11/22 17:10 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class RegionStarDTO { + private List regionIdList; + private String companyName; + private Long companyId; + private String driverName; + private String dataScopeSql; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/StarManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/StarManage.java new file mode 100644 index 0000000..4fd7d61 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/StarManage.java @@ -0,0 +1,71 @@ +package com.ningdatech.carapi.driver.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; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-11-15 + */ +@Data +@TableName("nd_star_manage") +@ApiModel(value = "StarManage对象", description = "") +public class StarManage implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("公司id") + private Long companyId; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("受伤人数") + private Integer injuredCnt; + + @ApiModelProperty("事故次数") + private Integer accidentsCnt; + + @ApiModelProperty("出险次数") + private Integer insuranceCnt; + + @ApiModelProperty("死亡人数") + private Integer deathCnt; + + @ApiModelProperty("当前星级") + private Double currentStar; + + @ApiModelProperty("扣除星级") + private Double deductStar; + + @ApiModelProperty("当前分数") + private Integer currentScore; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingBonusRecord.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingBonusRecord.java new file mode 100644 index 0000000..92980c2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingBonusRecord.java @@ -0,0 +1,59 @@ +package com.ningdatech.carapi.driver.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; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-31 + */ +@Data +@TableName("nd_training_bonus_record") +@ApiModel(value = "TrainingBonusRecord对象", description = "") +public class TrainingBonusRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("继续教育培训奖励表") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("用户id") + private Long userId; + + @ApiModelProperty("材料类型") + private String materialType; + + @ApiModelProperty("培训材料id") + private Long trainingMaterialId; + + @ApiModelProperty("培训组织id") + private Long trainingOrganizationId; + + @ApiModelProperty("行为类型") + private String behaviorType; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("公司ID") + private Long companyId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingMaterial.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingMaterial.java new file mode 100644 index 0000000..428d51e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingMaterial.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.driver.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.driver.constant.MaterialStatusEnum; +import com.ningdatech.carapi.driver.constant.MaterialTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-21 + */ +@TableName("nd_training_material") +@Data +@ApiModel(value = "TrainingMaterial对象", description = "") +public class TrainingMaterial implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + @ApiModelProperty("培训材料表") + private Long id; + + @ApiModelProperty("标题") + private String title; + + /** + * {@link MaterialTypeEnum} + */ + @ApiModelProperty("材料类型") + private String materialType; + + /** + * {@link MaterialStatusEnum} + */ + @ApiModelProperty("材料状态") + private String materialStatus; + + @ApiModelProperty("内容") + private String content; + + @ApiModelProperty("附件json list") + private String appendixListJson; + + private Long regionId; + private Long companyId; + + private LocalDateTime updateOn; + + private LocalDateTime createOn; + + private Long createBy; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingOrganization.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingOrganization.java new file mode 100644 index 0000000..6d51656 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingOrganization.java @@ -0,0 +1,113 @@ +package com.ningdatech.carapi.driver.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.driver.constant.TrainingModeEnum; +import com.ningdatech.carapi.driver.constant.TrainingStatusEnum; +import com.ningdatech.carapi.driver.constant.TrainingTypeEnum; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @author LiuXinXin + * @since 2022-10-10 + */ +@TableName("nd_training_organization") +@Data +public class TrainingOrganization implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + /** + * 培训主题 + */ + private String trainingTopic; + + /** + * 培训开始时间 + */ + private LocalDateTime trainingStartTime; + + /** + * 培训结束时间 + */ + private LocalDateTime trainingEndTime; + + /** + * 培训地点 + */ + private String address; + + + /** + * 培训模式 线上/线下 + * {@link TrainingModeEnum} + */ + private String trainingMode; + + /** + * 培训类型 取证培训/继续教育/换证培训/转码培训 + * {@link TrainingTypeEnum} + */ + private String trainingType; + + /** + * 联系人 + */ + private String contacts; + + /** + * 联系电话 + */ + private String contactNumber; + + /** + * 培训状态 启用/禁用 + * {@link TrainingStatusEnum} + */ + private String trainingStatus; + + /** + * 备注 + */ + private String remark; + + /** + * 区域id + */ + private Long regionId; + + /** + * 考试试卷id + */ + private Long examPaperId; + + /** + * 考试试卷名称 + */ + private String examPaperName; + + /** + * 随机试卷id + */ + private String randomExamPaperId; + + @ApiModelProperty("考试开始时间") + private LocalDateTime examStartTime; + + @ApiModelProperty("考试结束时间") + private LocalDateTime examEndTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingOrganizationMaterial.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingOrganizationMaterial.java new file mode 100644 index 0000000..8cbf6dd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingOrganizationMaterial.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.driver.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; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-22 + */ +@Data +@TableName("nd_training_organization_material") +@ApiModel(value = "TrainingOrganizationMaterial对象", description = "") +public class TrainingOrganizationMaterial implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + @ApiModelProperty("培训组织id") + private Long trainingOrganizationId; + + @ApiModelProperty("培训材料id") + private Long trainingMaterialId; + + @ApiModelProperty("培训材料类型") + private String materialType; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingOrganizationTrainer.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingOrganizationTrainer.java new file mode 100644 index 0000000..6847a15 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingOrganizationTrainer.java @@ -0,0 +1,82 @@ +package com.ningdatech.carapi.driver.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.driver.constant.ExamQualifiedEnum; +import com.ningdatech.carapi.driver.constant.ExaminationStatusEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-22 + */ +@Data +@TableName("nd_training_organization_trainer") +@ApiModel(value = "TrainingOrganizationTrainer对象", description = "") +public class TrainingOrganizationTrainer implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("培训组织id") + private Long trainingOrganizationId; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("驾驶员用户id") + private Long driverUserId; + + @ApiModelProperty("分数") + private Integer score; + + /** + * {@link ExamQualifiedEnum} + */ + @ApiModelProperty("是否合格") + private String isQualified; + + @ApiModelProperty("试卷id") + private Long examPaperId; + + @ApiModelProperty("试卷名称") + private String examPaperName; + + @ApiModelProperty("准考证号") + private String examRegistrationNo; + + /** + * {@link ExaminationStatusEnum} + */ + @ApiModelProperty("考试状态") + private String examinationStatus; + + @ApiModelProperty("公司id") + private Long companyId; + + @ApiModelProperty("公司名称") + private String companyName; + + @ApiModelProperty("签到时间") + private LocalDateTime signTime; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingRegistrationReview.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingRegistrationReview.java new file mode 100644 index 0000000..8396d21 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/entity/TrainingRegistrationReview.java @@ -0,0 +1,84 @@ +package com.ningdatech.carapi.driver.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; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-20 + */ +@Data +@TableName("nd_training_registration_review") +@ApiModel(value = "TrainingRegistrationReview对象", description = "") +public class TrainingRegistrationReview implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + private Long updateBy; + + @ApiModelProperty("驾驶员用户id") + private Long driverUserId; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("驾驶员姓名冗余字段") + private String driverName; + + @ApiModelProperty("身份证号") + private String driverIdCard; + + @ApiModelProperty("驾驶员手机号") + private String driverPhoneNo; + + @ApiModelProperty("公司id") + private Long companyId; + + @ApiModelProperty("公司名称") + private String companyName; + + @ApiModelProperty("公司所属区域") + private Long regionId; + + @ApiModelProperty("培训类型") + private String registrationType; + + @ApiModelProperty("审核状态") + private String approvalStatus; + + @ApiModelProperty("附件信息json") + private String appendixListJson; + + @ApiModelProperty("meta审核id") + private Long metaApplyId; + + @ApiModelProperty("meta审核类型") + private String metaApplyType; + + @ApiModelProperty("审核员结果意见附件") + private String auditAppendixListJson; + + @ApiModelProperty("初复审关联ID") + private Long preliminaryReviewAssociatedId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/helper/DriverBehaviorScoreHelper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/helper/DriverBehaviorScoreHelper.java new file mode 100644 index 0000000..42fd4c8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/helper/DriverBehaviorScoreHelper.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.driver.helper; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.driver.model.bo.CodingRuleBO; +import com.ningdatech.carapi.sys.entity.CodingRule; +import com.ningdatech.carapi.sys.entity.enumeration.CodingRuleBehaviorTypeEnum; +import com.ningdatech.carapi.sys.entity.enumeration.RuleOperationTypeEnum; +import com.ningdatech.carapi.sys.service.ICodingRuleService; +import com.ningdatech.carapi.sys.service.IExamRuleService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/11/14 上午11:27 + */ +@Component +@RequiredArgsConstructor +public class DriverBehaviorScoreHelper { + + private final IExamRuleService iExamRuleService; + private final ICodingRuleService iCodingRuleService; + +// public Integer getExamScoreValue() { +// iExamRuleService.getById() +// } + + /** + * 行为类型 + * + * @param behaviorType + * @return + */ + public CodingRuleBO getCodingRuleBehaviorScore(CodingRuleBehaviorTypeEnum behaviorType, VehicleTypeEnum vehicleTypeEnum) { + CodingRule codingRule = null; + if (Objects.nonNull(vehicleTypeEnum)) { + codingRule = iCodingRuleService.getOne(Wrappers.lambdaQuery(CodingRule.class) + .eq(CodingRule::getVehicleType, vehicleTypeEnum.name()) + .eq(CodingRule::getBehaviorType, behaviorType.name())); + }else { + codingRule = iCodingRuleService.getOne(Wrappers.lambdaQuery(CodingRule.class) + .eq(CodingRule::getBehaviorType, behaviorType.name())); + } + Integer operationScore = codingRule.getOperationScore(); + String ruleOperationType = codingRule.getRuleOperationType(); + + CodingRuleBO codingRuleBO = new CodingRuleBO(); + codingRuleBO.setOperationScore(operationScore); + codingRuleBO.setRuleOperationType(RuleOperationTypeEnum.valueOf(ruleOperationType)); + return codingRuleBO; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/helper/DriverInfoHelper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/helper/DriverInfoHelper.java new file mode 100644 index 0000000..e19fd2b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/helper/DriverInfoHelper.java @@ -0,0 +1,75 @@ +package com.ningdatech.carapi.driver.helper; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.carapi.common.helper.UserInfoHelper; +import com.ningdatech.carapi.driver.entity.Certificate; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.service.ICertificateService; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/11/14 下午2:44 + */ +@Component +@RequiredArgsConstructor +public class DriverInfoHelper { + private final UserInfoHelper userInfoHelper; + private final IDriverInfoService iDriverInfoService; + private final ICertificateService iCertificateService; + + /** + * 判断驾驶员是否拥有合格证书判断 + * + * @param userId + */ + public void driverCertificateValidCheck(Long userId) { + DriverInfo driverInfo = iDriverInfoService.getOne(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getUserId, userId)); + if (Objects.isNull(driverInfo)) { + throw new BizException("当前账号无驾驶员信息"); + } else { + Certificate certificate = iCertificateService.getOne(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getUserId, userId)); + if (Objects.isNull(certificate)) { + throw new BizException("当前驾驶员无证书信息"); + } else { + LocalDateTime expiryDate = certificate.getExpiryDate(); + if (expiryDate.isBefore(LocalDateTime.now())) { + throw new BizException("当前驾驶员合格证书已过期"); + } + } + } + } + + /** + * 判断驾驶员是否拥有有效的合格证书 + * + * @param userId + */ + public Boolean hasDriverAvailableCertificate(Long userId) { + DriverInfo driverInfo = iDriverInfoService.getOne(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getUserId, userId)); + if (Objects.isNull(driverInfo)) { + return false; + } else { + Certificate certificate = iCertificateService.getOne(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getUserId, userId)); + if (Objects.isNull(certificate)) { + return false; + } else { + LocalDateTime expiryDate = certificate.getExpiryDate(); + if (expiryDate.isBefore(LocalDateTime.now())) { + return false; + } + } + } + return true; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/helper/RegistrationAvailableCheckHelper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/helper/RegistrationAvailableCheckHelper.java new file mode 100644 index 0000000..69b71d0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/helper/RegistrationAvailableCheckHelper.java @@ -0,0 +1,75 @@ +package com.ningdatech.carapi.driver.helper; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.carapi.driver.constant.DriverContinuingEducationRegistrationStatusEnum; +import com.ningdatech.carapi.driver.constant.DriverRegistrationStatusEnum; +import com.ningdatech.carapi.driver.constant.DriverReplacementRegistrationStatusEnum; +import com.ningdatech.carapi.driver.entity.Certificate; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.model.po.ReqDriverTrainingRegistrationPO; +import com.ningdatech.carapi.driver.service.ICertificateService; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/11/11 下午1:58 + */ +@Component +@RequiredArgsConstructor +public class RegistrationAvailableCheckHelper { + private final ICertificateService iCertificateService; + + public void forensicRegistration(DriverInfo driverInfo) { + String driverRegistrationStatus = driverInfo.getDriverRegistrationStatus(); + Boolean hasAlreadySignUp = StringUtils.isNotBlank(driverRegistrationStatus); + if (hasAlreadySignUp) { + throw new BizException("该驾驶员已经报名,无需重复报名"); + } + } + + public void replacementRegistrationValidCheck(ReqDriverTrainingRegistrationPO request, DriverInfo driverInfo) { + // 校验驾驶员当前是否有换证培训的权限 + String driverRegistrationStatus = driverInfo.getDriverRegistrationStatus(); + if (!DriverRegistrationStatusEnum.available.name().equals(driverRegistrationStatus)) { + throw new BizException("请先通过驾驶员取证培训!"); + } + String replacementRegistrationStatus = driverInfo.getReplacementRegistrationStatus(); + // 此次提交的报名信息为重新提交的换证报名 + if (Objects.nonNull(request.getDriverId())){ + return; + } + Boolean hasAlreadySignUp = (!DriverReplacementRegistrationStatusEnum.available.name().equals(replacementRegistrationStatus) + && StringUtils.isNotBlank(replacementRegistrationStatus)); + if (hasAlreadySignUp) { + throw new BizException("该驾驶员已经报名,无需重复报名"); + } + Certificate certificate = iCertificateService.getOne(Wrappers.lambdaQuery(Certificate.class).eq(Certificate::getDriverId, driverInfo.getId())); + LocalDateTime expiryDate = certificate.getExpiryDate(); + if (expiryDate.isAfter(LocalDateTime.now())) { + throw new BizException("该合格证尚未过期,无需重复办理"); + } + } + + public void continuingEducationRegistrationValidCheck(ReqDriverTrainingRegistrationPO request, DriverInfo driverInfo) { + String driverRegistrationStatus = driverInfo.getDriverRegistrationStatus(); + if (!DriverRegistrationStatusEnum.available.name().equals(driverRegistrationStatus)) { + throw new BizException("请先通过驾驶员取证培训报名"); + } + // 此次提交的报名信息为重新提交的继续教育报名 + if (Objects.nonNull(request.getDriverId())){ + return; + } + String continuingEducationStatus = driverInfo.getContinuingEducationStatus(); + Boolean hasAlreadySignUp = (!DriverContinuingEducationRegistrationStatusEnum.available.name().equals(continuingEducationStatus) + && StringUtils.isNotBlank(continuingEducationStatus)); + if (hasAlreadySignUp) { + throw new BizException("该驾驶员已经报名,无需重复报名"); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/ArticleInfoManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/ArticleInfoManage.java new file mode 100644 index 0000000..c69f745 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/ArticleInfoManage.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.driver.manage; + +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +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.driver.constant.ArticleTypeEnum; +import com.ningdatech.carapi.driver.entity.ArticleInfo; +import com.ningdatech.carapi.driver.model.po.ReqArticleInfoListPO; +import com.ningdatech.carapi.driver.model.vo.ResArticleInfoListVO; +import com.ningdatech.carapi.driver.service.IArticleInfoService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/10/9 下午4:34 + */ + +@Component +@RequiredArgsConstructor +public class ArticleInfoManage { + + private final IArticleInfoService iArticleInfoService; + + public PageVo articleInfoList(ReqArticleInfoListPO reqArticleInfoListPo) { + ArticleTypeEnum articleType = reqArticleInfoListPo.getArticleType(); + String title = reqArticleInfoListPo.getTitle(); + LocalDateTime startTime = reqArticleInfoListPo.getStartTime(); + LocalDateTime endTime = reqArticleInfoListPo.getEndTime(); + Integer pageNumber = reqArticleInfoListPo.getPageNumber(); + Integer pageSize = reqArticleInfoListPo.getPageSize(); + + Page page = iArticleInfoService.page(new Page<>(pageNumber, pageSize) + , Wrappers.lambdaQuery(ArticleInfo.class) + .eq(Objects.nonNull(articleType), ArticleInfo::getArticleType, articleType.name()) + .like(StringUtils.isNotBlank(title), ArticleInfo::getTitle, title) + .gt(Objects.nonNull(startTime), ArticleInfo::getFormulationTime, startTime) + .lt(Objects.nonNull(endTime), ArticleInfo::getFormulationTime, endTime)); + + PageVo pageVo = new PageVo<>(); + long total = page.getTotal(); + pageVo.setTotal(total); + if (total == 0) { + return pageVo; + } + + List records = page.getRecords(); + List resArticleInfoListVOList = records.stream().map(r -> { + ResArticleInfoListVO resArticleInfoListVO = new ResArticleInfoListVO(); + resArticleInfoListVO.setArticleId(r.getId()); + resArticleInfoListVO.setArticleStatus(r.getArticleStatus()); + String currentArticleType = r.getArticleType(); + if (StringUtils.isNotBlank(currentArticleType)) { + resArticleInfoListVO.setArticleType(ArticleTypeEnum.valueOf(currentArticleType)); + } + resArticleInfoListVO.setFormulationTime(r.getFormulationTime()); + resArticleInfoListVO.setTitle(r.getTitle()); + return resArticleInfoListVO; + }).collect(Collectors.toList()); + + pageVo.setRecords(resArticleInfoListVOList); + return pageVo; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/BehaviourAnalysisManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/BehaviourAnalysisManage.java new file mode 100644 index 0000000..1d2b7a5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/BehaviourAnalysisManage.java @@ -0,0 +1,257 @@ +package com.ningdatech.carapi.driver.manage; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; + +import com.alibaba.excel.EasyExcel; +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.NdDateUtils; +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.constant.CommonConstant; +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.driver.constant.DriverAbnormalBehaviorAppendixTypeEnum; +import com.ningdatech.carapi.driver.constant.DriverAbnormalBehaviorProcessingEnum; +import com.ningdatech.carapi.driver.entity.*; +import com.ningdatech.carapi.driver.model.vo.BehaviourAnalysisVO; +import com.ningdatech.carapi.driver.model.vo.DriverAbnormalBehaviorAnalysisDetailVO; +import com.ningdatech.carapi.driver.model.vo.DriverDailyAlarmEvent; +import com.ningdatech.carapi.driver.service.IBehaviorAnalysisProcessingModeService; +import com.ningdatech.carapi.driver.service.IBehaviourAnalysisService; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.date.StopWatch; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @Classname BehaviourAnalysisManage + * @Description + * @Date 2022/11/7 16:30 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class BehaviourAnalysisManage { + + private final IBehaviourAnalysisService behaviourAnalysisService; + private final IDriverInfoService driverInfoService; + private final IBehaviorAnalysisProcessingModeService behaviorAnalysisProcessingModeService; + private final CompanyService companyService; + private final IVehicleBaseInfoService vehicleBaseInfoService; + + + public PageVo behaviorAnalysisList(DriverAbnormalBehaviorAnalysisPageParamDTO param) { + Page page = param.page(); + + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + Map companyMap = companyService.list(Wrappers.lambdaQuery(Company.class) + .select(Company::getId,Company::getName)).stream().collect(Collectors.toMap(Company::getId, c -> c)); + Map vehicleBaseInfoMap = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .select(NdVehicleBaseInfo::getCarPlate,NdVehicleBaseInfo::getCompanyId)).stream() + .collect(Collectors.toMap(v -> v.getCarPlate() + v.getCompanyId(), v -> v)); + stopWatch.stop(); + log.info("1共耗时 {}s", stopWatch.getTotalTimeSeconds()); + + StopWatch stopWatch2 = new StopWatch(); + stopWatch2.start(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DriverAbnormalBehaviorAnalysis.class); + BehaviourAnalysisManage context = (BehaviourAnalysisManage) AopContext.currentProxy(); + context.buildBehaviourAnalysisQuery(wrapper, param); + behaviourAnalysisService.page(page, wrapper); + stopWatch2.stop(); + log.info("2共耗时 {}s", stopWatch2.getTotalTimeSeconds()); + + // 驾驶员异常行为列表查询 + if (0L == page.getTotal()) { + return PageVo.empty(); + } + + List behaviourAnalysisVOList = page.getRecords().stream().map(b -> { + BehaviourAnalysisVO resVo = new BehaviourAnalysisVO(); + BeanUtil.copyProperties(b, resVo); + BigDecimal speed = BigDecimal.valueOf(b.getSpeed()).multiply(TaskConstant.Math.SPEED_UNITS) + .setScale(BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP); + resVo.setSpeed(speed); + String alarmPictureAppendix = b.getAlarmPictureAppendix(); + String alarmVideoAppendix = b.getAlarmVideoAppendix(); + List list = getFileBasicInfos(alarmPictureAppendix, alarmVideoAppendix); + resVo.setAlarmAppendix(list); + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoMap.get(b.getCarPlate() + b.getCompanyId()); + if (Objects.nonNull(vehicleBaseInfo)) { + resVo.setCompanyId(vehicleBaseInfo.getCompanyId()); + Company company = companyMap.get(vehicleBaseInfo.getCompanyId()); + resVo.setCompanyName(company.getName()); + } + return resVo; + }).collect(Collectors.toList()); + return PageVo.of(behaviourAnalysisVOList, page.getTotal()); + } + + private List getFileBasicInfos(String alarmPic, String alarmVideo) { + List list = new ArrayList<>(); + if (StrUtil.isNotBlank(alarmPic) && !HttpUtil.isHttps(alarmPic) && !HttpUtil.isHttp(alarmPic)) { + FileBasicInfo filePictureBasicInfo = new FileBasicInfo(); + filePictureBasicInfo.setFileType(DriverAbnormalBehaviorAppendixTypeEnum.PICTURE.getCode()); + filePictureBasicInfo.setFilePath(alarmPic); + list.add(filePictureBasicInfo); + } + if (StrUtil.isNotBlank(alarmVideo) && !HttpUtil.isHttps(alarmVideo) && !HttpUtil.isHttp(alarmVideo)) { + FileBasicInfo fileVideoBasicInfo = new FileBasicInfo(); + fileVideoBasicInfo.setFileType(DriverAbnormalBehaviorAppendixTypeEnum.VIDEO.getCode()); + fileVideoBasicInfo.setFilePath(alarmVideo); + list.add(fileVideoBasicInfo); + } + return list; + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildBehaviourAnalysisQuery(LambdaQueryWrapper wrapper, DriverAbnormalBehaviorAnalysisPageParamDTO param) { + wrapper.like(StringUtils.isNotBlank(param.getCarPlate()), DriverAbnormalBehaviorAnalysis::getCarPlate, param.getCarPlate()) + .eq(Objects.nonNull(param.getLevel()), DriverAbnormalBehaviorAnalysis::getAlarmLevel, param.getLevel()) + .ge(Objects.nonNull(param.getStartTime()), DriverAbnormalBehaviorAnalysis::getAlarmTime, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), DriverAbnormalBehaviorAnalysis::getAlarmTime, param.getEndTime()) + .in(Objects.nonNull(param.getAlarmType()), DriverAbnormalBehaviorAnalysis::getAlarmType, param.getAlarmType()) + .eq(Objects.nonNull(param.getProcessingStatus()), DriverAbnormalBehaviorAnalysis::getProcessingStatus, param.getProcessingStatus()) + .eq(Objects.nonNull(param.getOverseeStatus()), DriverAbnormalBehaviorAnalysis::getOverseeStatus, param.getOverseeStatus()) + .orderBy(Boolean.TRUE, Boolean.FALSE, DriverAbnormalBehaviorAnalysis::getAlarmTime); + } + + public Boolean oversee(DriverAbnormalBehaviorAnalysisOverseeDTO param, Long userId) { + return behaviourAnalysisService.oversee(param, userId); + } + + public DriverAbnormalBehaviorAnalysisDetailVO getBehaviourAnalysisDetail(Long id) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DriverAbnormalBehaviorAnalysis.class); + BehaviourAnalysisManage context = (BehaviourAnalysisManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + DriverAbnormalBehaviorAnalysis driverAbnormalBehaviorAnalysis = behaviourAnalysisService.getOne(wrapper); + if (Objects.isNull(driverAbnormalBehaviorAnalysis)) { + throw new BizException("异常行为不存在"); + } + //DriverAbnormalBehaviorAnalysis driverAbnormalBehaviorAnalysis = behaviourAnalysisService.getById(id); + DriverAbnormalBehaviorAnalysisDetailVO resVo = BeanUtil.copyProperties(driverAbnormalBehaviorAnalysis, DriverAbnormalBehaviorAnalysisDetailVO.class); + Optional.ofNullable(driverAbnormalBehaviorAnalysis.getSpeed()).ifPresent(c -> resVo.setSpeed(BigDecimal.valueOf(c).multiply(TaskConstant.Math.SPEED_UNITS) + .setScale(BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP).intValue())); + + //统计该驾驶员当日异常行为告警事件 + //获取当前日期的起始时间和结束时间 + LocalDateTime startTime = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); + LocalDateTime endTime = NdDateUtils.endOfDay(LocalDateTime.now()); + + LambdaQueryWrapper query = Wrappers.lambdaQuery(DriverAbnormalBehaviorAnalysis.class); + query.eq(DriverAbnormalBehaviorAnalysis::getDriverId, driverAbnormalBehaviorAnalysis.getDriverId()) + .ge(DriverAbnormalBehaviorAnalysis::getAlarmTime, startTime) + .le(DriverAbnormalBehaviorAnalysis::getAlarmTime, endTime) + .orderByDesc(DriverAbnormalBehaviorAnalysis::getAlarmTime); + List driverAbnormalBehaviorAnalysisList = behaviourAnalysisService.list(query); + List data = new ArrayList<>(); + for (DriverAbnormalBehaviorAnalysis abnormalBehaviorAnalysis : driverAbnormalBehaviorAnalysisList) { + DriverDailyAlarmEvent driverDailyAlarmEvent = BeanUtil.copyProperties(abnormalBehaviorAnalysis, DriverDailyAlarmEvent.class); + List fileBasicInfos = getFileBasicInfos(abnormalBehaviorAnalysis.getAlarmPictureAppendix(), + abnormalBehaviorAnalysis.getAlarmVideoAppendix()); + driverDailyAlarmEvent.setAlarmAppendix(fileBasicInfos); + data.add(driverDailyAlarmEvent); + } + resVo.setAlarmEventList(data); + return resVo; + } + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(DriverAbnormalBehaviorAnalysis::getId,id); + } + + public Boolean deal(DriverAbnormalBehaviorAnalysisNoticeDTO param, Long userId) { + //根据异常行为数据ID查询驾驶员信息 + DriverAbnormalBehaviorAnalysis driverAbnormalBehaviorAnalysis = behaviourAnalysisService.getById(param.getId()); + String processingDescription = param.getProcessingDescription(); + String processingMode = param.getProcessingMode().toString(); + + driverAbnormalBehaviorAnalysis.setProcessingDescription(processingDescription); + driverAbnormalBehaviorAnalysis.setProcessingMode(processingMode); + driverAbnormalBehaviorAnalysis.setProcessingStatus(DriverAbnormalBehaviorProcessingEnum.DEAL.getCode()); + driverAbnormalBehaviorAnalysis.setProcessingTime(LocalDateTime.now()); + driverAbnormalBehaviorAnalysis.setProcessingUser(LoginUserUtil.getUsername()); + driverAbnormalBehaviorAnalysis.setUpdateOn(LocalDateTime.now()); + driverAbnormalBehaviorAnalysis.setUpdateBy(userId); + behaviourAnalysisService.updateById(driverAbnormalBehaviorAnalysis); + return Boolean.TRUE; + } + + public void driverAbnormalBehaviorAnalysisListExport(HttpServletResponse response, DriverAbnormalBehaviorAnalysisPageParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = behaviorAnalysisList(param); + Collection records = page.getRecords(); + List collect = records.stream().map(c -> { + BehaviourAnalysisExportDTO exportDTO = BeanUtil.copyProperties(c, BehaviourAnalysisExportDTO.class); + List alarmAppendix = c.getAlarmAppendix(); + for (FileBasicInfo fileBasicInfo : alarmAppendix) { + if (DriverAbnormalBehaviorAppendixTypeEnum.PICTURE.getCode().equals(fileBasicInfo.getFileType())) { + exportDTO.setAlarmPictureAppendix(fileBasicInfo.getFilePath()); + } else { + exportDTO.setAlarmVideoAppendix(fileBasicInfo.getFilePath()); + } + } + return exportDTO; + }).collect(Collectors.toList()); + String fileName = "驾驶员异常行为分析列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), BehaviourAnalysisExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public List processingModeDetail() { + return behaviorAnalysisProcessingModeService.list(); + } + + public Boolean addProcessingMode(String req) { + BehaviorAnalysisProcessingMode behaviorAnalysisProcessingMode = new BehaviorAnalysisProcessingMode(); + behaviorAnalysisProcessingMode.setProcessingModeName(req); + behaviorAnalysisProcessingModeService.save(behaviorAnalysisProcessingMode); + return Boolean.TRUE; + } + + public Boolean deleteProcessingMode(Integer id) { + behaviorAnalysisProcessingModeService.removeById(id); + return Boolean.TRUE; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/CertificateManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/CertificateManage.java new file mode 100644 index 0000000..6c13cc9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/CertificateManage.java @@ -0,0 +1,154 @@ +package com.ningdatech.carapi.driver.manage; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.helper.UserInfoHelper; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.driver.constant.*; +import com.ningdatech.carapi.driver.entity.Certificate; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.model.po.ReqUploadCertificatePO; +import com.ningdatech.carapi.driver.model.vo.ResCertificateVO; +import com.ningdatech.carapi.driver.service.ICertificateService; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.user.model.vo.UserBasicInfoVO; +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.CollectionUtil; +import lombok.RequiredArgsConstructor; + +/** + * @author liuxinxin + * @date 2022/10/26 下午4:20 + */ +@Component +@RequiredArgsConstructor +public class CertificateManage { + + private final ICertificateService iCertificateService; + private final IDriverInfoService iDriverInfoService; + + private final CompaniesCacheHelper companiesCacheHelper; + private final UserInfoHelper userInfoHelper; + + @Transactional(rollbackFor = Exception.class) + public void uploadCertificate(ReqUploadCertificatePO request) { + + // 按照登录用户,如果是驾驶员登录,只展示该驾驶员信息 + UserBasicInfoVO userFullInfo = userInfoHelper.getUserFullInfo(); + Long roleId = userFullInfo.getRoleId(); + if (UserRoleTypeEnum.DRIVER_ROLE_ID.getId().equals(roleId)){ + throw new BizException("当前登录用户不能上传合格证!"); + } + // 获取入参 + String certificateNo = request.getCertificateNo(); + Long driverId = request.getDriverId(); + LocalDateTime expiryDate = request.getExpiryDate(); + LocalDateTime issueDate = request.getIssueDate(); + String issuedBy = request.getIssuedBy(); + String examType = request.getExamType(); + + // 校验合格证号是否可用 + Certificate oldCertificate = iCertificateService.getOne(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getCertificateNo, certificateNo)); + + if (Objects.nonNull(oldCertificate)) { + throw new BizException("证书编号重复!"); + } + + List certificateList = iCertificateService.list(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getDriverId, driverId) + .gt(Certificate::getExpiryDate, LocalDateTime.now())); + if (CollectionUtil.isNotEmpty(certificateList)) { + throw new BizException("该驾驶员证书已上传"); + } + + // 获取驾驶员信息 + DriverInfo driverInfo = iDriverInfoService.getById(driverId); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + // 保存合格证信息 + Certificate saveRecord = new Certificate(); + saveRecord.setCertificateNo(certificateNo); + saveRecord.setDriverId(driverId); + saveRecord.setDriverName(driverInfo.getDriverName()); + saveRecord.setExpiryDate(expiryDate); + saveRecord.setIssueDate(issueDate); + saveRecord.setIssuedBy(issuedBy); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setCreateBy(user.getUserId()); + saveRecord.setUserId(driverInfo.getUserId()); + saveRecord.setBirth(driverInfo.getBirth()); + saveRecord.setGender(driverInfo.getGender()); + saveRecord.setNativePlace(driverInfo.getNativePlace()); + saveRecord.setHealth(driverInfo.getHealth()); + saveRecord.setPhoneNo(driverInfo.getPhoneNo()); + saveRecord.setAddress(driverInfo.getAddress()); + saveRecord.setDriverLicenseType(driverInfo.getDriverLicenseType()); + saveRecord.setDriverLicenseNo(driverInfo.getDriverLicenseNo()); + saveRecord.setRemark(request.getRemark()); + saveRecord.setRegionId(user.getRegionId()); + saveRecord.setRegionName(user.getRegionName()); + saveRecord.setCompanyId(user.getCompanyId()); + saveRecord.setCompanyName(user.getCompanyName()); + // 如果是换证培训,替换原来过期的取证培训合格证信息 + if (examType.equals(TrainingTypeEnum.replacement_registration_training.name())){ + Certificate certificate = iCertificateService.getOne(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getUserId, driverInfo.getUserId())); + saveRecord.setId(certificate.getId()); + } + iCertificateService.saveOrUpdate(saveRecord); + + // 取证报名和换证报名上传合格证之后,更新驾驶员状态并将对应的培训报名类型的可参加培训标志更改为可参加 + if (examType.equals(TrainingTypeEnum.forensic_registration_training.name())){ + driverInfo.setDriverRegistrationStatus(DriverRegistrationStatusEnum.available.name()); + driverInfo.setDriverRegistrationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + }else if (examType.equals(TrainingTypeEnum.replacement_registration_training.name())){ + driverInfo.setReplacementRegistrationStatus(DriverReplacementRegistrationStatusEnum.available.name()); + driverInfo.setReplacementRegistrationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } + driverInfo.setUpdateOn(LocalDateTime.now()); + // 更新驾驶员为入职 + driverInfo.setDriverStatus(DriverStatusEnum.induction.name()); + iDriverInfoService.updateById(driverInfo); + } + + public ResCertificateVO getCertificate(Long driverId) { + DriverInfo driverInfo = iDriverInfoService.getById(driverId); + if (Objects.isNull(driverInfo)) { + throw new BizException("驾驶员信息不存在"); + } + Certificate certificate = iCertificateService.getOne(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getUserId, driverInfo.getUserId())); + + ResCertificateVO resCertificateVO = new ResCertificateVO(); + resCertificateVO.setIdCard(driverInfo.getIdCard()); + resCertificateVO.setPhoneNo(driverInfo.getPhoneNo()); + resCertificateVO.setAddress(driverInfo.getAddress()); + BeanUtil.copyProperties(certificate, resCertificateVO); + CodeUtil.searchCompanyName(resCertificateVO); + return resCertificateVO; + } + + public ResCertificateVO getCertificate() { + Long userId = LoginUserUtil.getUserId(); + Certificate certificate = iCertificateService.getOne(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getUserId, userId)); + + ResCertificateVO resCertificateVO = new ResCertificateVO(); + BeanUtil.copyProperties(certificate, resCertificateVO); + CodeUtil.searchCompanyName(resCertificateVO); + return resCertificateVO; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverArchivesManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverArchivesManage.java new file mode 100644 index 0000000..706490e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverArchivesManage.java @@ -0,0 +1,2204 @@ +package com.ningdatech.carapi.driver.manage; + +import java.io.IOException; +import java.io.InputStream; +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import com.ningdatech.carapi.car.position.model.po.ReqDataPO; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +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.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.*; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.*; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.common.helper.UserInfoHelper; +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.driver.constant.*; +import com.ningdatech.carapi.driver.constants.DriverConstant; +import com.ningdatech.carapi.driver.entity.*; +import com.ningdatech.carapi.driver.helper.RegistrationAvailableCheckHelper; +import com.ningdatech.carapi.driver.model.DriverArchivesExportDTO; +import com.ningdatech.carapi.driver.model.dto.DriverBasicInfoDTO; +import com.ningdatech.carapi.driver.model.po.*; +import com.ningdatech.carapi.driver.model.vo.ResArchivalInfoDetailVO; +import com.ningdatech.carapi.driver.model.vo.ResArchivalInfoSearchListVO; +import com.ningdatech.carapi.driver.model.vo.ResDriverTrainingRegistrationListVO; +import com.ningdatech.carapi.driver.service.*; +import com.ningdatech.carapi.qrcode.entity.NdVehicleGetOn; +import com.ningdatech.carapi.qrcode.service.VehicleGetOnService; +import com.ningdatech.carapi.safe.entity.NdVehicleViolation; +import com.ningdatech.carapi.safe.manage.VehicleAccidentManage; +import com.ningdatech.carapi.safe.model.dto.AccidentPageQuery; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentAnalysisVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentDeadVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleViolationVO; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentAnalysisService; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentDeadService; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentService; +import com.ningdatech.carapi.safe.service.INdVehicleViolationService; +import com.ningdatech.carapi.sys.contants.UserLoginConstant; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.MetaApply; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.entity.constant.ImportTemplateConstant; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.entity.enumeration.BooleanDisplayEnum; +import com.ningdatech.carapi.sys.entity.enumeration.ImportTemplateEnum; +import com.ningdatech.carapi.sys.entity.enumeration.MetaApplyStatusEnum; +import com.ningdatech.carapi.sys.entity.enumeration.MetaApplyTypeEnum; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.sys.service.IMetaApplyService; +import com.ningdatech.carapi.sys.service.UserRoleService; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.model.vo.UserBasicInfoVO; +import com.ningdatech.carapi.user.security.auth.constant.AuthTypeEnum; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.lang.Validator; +import cn.hutool.core.util.DesensitizedUtil; +import cn.hutool.core.util.IdcardUtil; +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; + +/** + * @author liuxinxin + * @date 2022/10/9 上午10:33 + */ + +@Component +@RequiredArgsConstructor +@Slf4j +public class DriverArchivesManage { + + private final IDriverInfoService iDriverInfoService; + private final CompanyService companyService; + private final IMetaApplyService iMetaApplyService; + private final RegionsCacheHelper regionsCacheHelper; + private final INdUserInfoService iNdUserInfoService; + private final INdUserAuthService iNdUserAuthService; + private final UserRoleService userRoleService; + private final PasswordEncoder passwordEncoder; + private final ITrainingRegistrationReviewService iTrainingRegistrationReviewService; + private final UserInfoHelper userInfoHelper; + private final INdVehicleAccidentService vehicleAccidentService; + private final INdVehicleAccidentDeadService vehicleAccidentDeadService; + private final INdVehicleAccidentAnalysisService vehicleAccidentAnalysisService; + private final INdVehicleViolationService vehicleViolationService; + private final CompaniesCacheHelper companiesCacheHelper; + private final RegistrationAvailableCheckHelper registrationAvailableCheckHelper; + private final Logger LOG = LoggerFactory.getLogger(DriverArchivesManage.class); + private final IDriverWorkRecordService iDriverWorkRecordService; + private final ICertificateService certificateService; + private final IDriverScoreInfoService iDriverScoreInfoService; + private final VehicleAccidentManage vehicleAccidentManage; + private final VehicleGetOnService vehicleGetOnService; + private final IDriverInfoService driverInfoService; + + public PageVo archivalInfoSearch(ReqArchivalInfoSearchPO request) { + + // 按照登录用户,如果是驾驶员登录,只展示该驾驶员信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + + Page page = request.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DriverInfo.class); + DriverStatusEnum driverStatus = request.getDriverStatus(); + // 不是离职列表,要加数据权限 + if (Objects.nonNull(driverStatus) && DriverStatusEnum.quit.name().equals(driverStatus.name())) { + buildQuitInfoSearchQuery(wrapper,request); + }else { + // 不是离职列表,要加数据权限 + DriverArchivesManage context = (DriverArchivesManage) AopContext.currentProxy(); + context.buildArchivalInfoSearchQuery(wrapper, request); + } + if (UserRoleTypeEnum.DRIVER_ROLE_ID.getId().equals(roleId)) { + Long userId = userDetail.getUserId(); + DriverInfo driverInfo = driverInfoService.getOne(Wrappers.lambdaQuery(DriverInfo.class).eq(DriverInfo::getUserId, userId)); + if (Objects.nonNull(driverInfo)) { + Long driverId = driverInfo.getId(); + wrapper.eq(DriverInfo::getId, driverId); + } + } + + iDriverInfoService.page(page, wrapper); + // 培训审核列表查询 + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List records = page.getRecords(); + List returnVoList = records.stream().map(r -> { + ResArchivalInfoSearchListVO resVo = new ResArchivalInfoSearchListVO(); + BeanUtils.copyProperties(r, resVo); + resVo.setDriverId(r.getId()); + resVo.setInductionTime(r.getInitialLicenseTime()); + CodeUtil.searchCompanyNameAndRegionName(resVo); + // 对手机号和身份证号进行脱敏处理 + String phoneNo = r.getPhoneNo(); + String idCard = r.getIdCard(); + String encryptPhone = DesensitizedUtil.mobilePhone(phoneNo); + String encryptIdCard = DesensitizedUtil.idCardNum(idCard, DriverConstant.ID_CARD_DESENSITIZED_FRONT, DriverConstant.ID_CARD_DESENSITIZED_END); + resVo.setPhoneNo(encryptPhone); + resVo.setIdCard(encryptIdCard); + return resVo; + }).collect(Collectors.toList()); + return PageVo.of(returnVoList, page.getTotal()); + } + + public PageVo archivalInfoSearchOpen(ReqArchivalInfoSearchPO request) { + Page page = request.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DriverInfo.class); + buildArchivalInfoSearchQuery(wrapper, request); + iDriverInfoService.page(page, wrapper); + // 培训审核列表查询 + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List records = page.getRecords(); + List returnVoList = records.stream().map(r -> { + ResArchivalInfoSearchListVO resVo = BeanUtil.copyProperties(r, ResArchivalInfoSearchListVO.class); + resVo.setDriverId(r.getId()); + resVo.setInductionTime(r.getInitialLicenseTime()); + CodeUtil.searchCompanyNameAndRegionName(resVo); + return resVo; + }).collect(Collectors.toList()); + return PageVo.of(returnVoList, page.getTotal()); + } + + public List archivalInfoSearchBatchOpen(ReqDataPO po) { + List idCards = po.getIdCards(); + if(CollUtil.isEmpty(idCards)){ + return Collections.emptyList(); + } + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DriverInfo.class); + buildArchivalInfoSearchQuery(wrapper, idCards); + List list = iDriverInfoService.list(wrapper); + // 培训审核列表查询 + if (CollUtil.isEmpty(list)) { + return Collections.emptyList(); + } + return list.stream().map(r -> { + ResArchivalInfoSearchListVO resVo = BeanUtil.copyProperties(r, ResArchivalInfoSearchListVO.class); + resVo.setDriverId(r.getId()); + resVo.setInductionTime(r.getInitialLicenseTime()); + CodeUtil.searchCompanyNameAndRegionName(resVo); + return resVo; + }).collect(Collectors.toList()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildArchivalInfoSearchQuery(LambdaQueryWrapper wrapper, ReqArchivalInfoSearchPO request) { + // 获取入参 + String companyName = request.getCompanyName(); + String driverName = request.getDriverName(); + String idCard = request.getIdCard(); + DriverStatusEnum driverStatus = request.getDriverStatus(); + Long companyId = request.getCompanyId(); + + // 查询 + String driverStatusStr = Objects.nonNull(driverStatus) ? driverStatus.name() : null; + wrapper.like(StringUtils.isNotBlank(companyName), DriverInfo::getCompanyName, companyName) + .like(StringUtils.isNotBlank(driverName), DriverInfo::getDriverName, driverName) + .ge(request.getStartTime() != null, DriverInfo::getCreateOn, request.getStartTime()) + .le(request.getEndTime() != null, DriverInfo::getCreateOn, request.getEndTime()) + .eq(StringUtils.isNotBlank(idCard), DriverInfo::getIdCard, idCard) + .eq(StringUtils.isNotBlank(driverStatusStr), DriverInfo::getDriverStatus, driverStatus) + .eq(Objects.nonNull(companyId), DriverInfo::getCompanyId, companyId) + .orderByDesc(DriverInfo::getCreateOn) + .isNotNull(DriverInfo::getCompanyId); + if (StrUtil.isNotBlank(request.getTrainingRegistrationType())) { + if (request.getTrainingRegistrationType().equals(TrainingRegistrationTypeEnum.FORENSIC_REGISTRATION.name())) { + wrapper.eq(DriverInfo::getDriverRegistrationStatus, DriverRegistrationStatusEnum.exam_training_stage.name()); + wrapper.eq(DriverInfo::getDriverRegistrationFlag, TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + + } else if (request.getTrainingRegistrationType().equals(TrainingRegistrationTypeEnum.CONTINUING_EDUCATION.name())) { + wrapper.eq(DriverInfo::getContinuingEducationStatus, DriverRegistrationStatusEnum.exam_training_stage.name()); + wrapper.eq(DriverInfo::getContinuingEducationFlag, TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } else if (request.getTrainingRegistrationType().equals(TrainingRegistrationTypeEnum.REPLACEMENT_REGISTRATION.name())) { + wrapper.eq(DriverInfo::getReplacementRegistrationStatus, DriverRegistrationStatusEnum.exam_training_stage.name()); + wrapper.eq(DriverInfo::getReplacementRegistrationFlag, TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } + } + } + + public void buildArchivalInfoSearchQuery(LambdaQueryWrapper wrapper, List idCards) { + if(CollUtil.isEmpty(idCards)){ + //查不到 + wrapper.eq(DriverInfo::getId,0L); + return; + } + // 查询 + wrapper.in(DriverInfo::getIdCard, idCards) + .orderByDesc(DriverInfo::getCreateOn) + .isNotNull(DriverInfo::getCompanyId); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildQuitInfoSearchQuery(LambdaQueryWrapper wrapper, ReqArchivalInfoSearchPO request) { + // 获取入参 + String companyName = request.getCompanyName(); + String driverName = request.getDriverName(); + String idCard = request.getIdCard(); + // 查询 + wrapper.like(StringUtils.isNotBlank(companyName), DriverInfo::getCompanyName, companyName) + .like(StringUtils.isNotBlank(driverName), DriverInfo::getDriverName, driverName) + .eq(StringUtils.isNotBlank(idCard), DriverInfo::getIdCard, idCard) + .eq(DriverInfo::getDriverStatus,DriverStatusEnum.quit.name()) + .orderByDesc(DriverInfo::getCreateOn); + } + + public ResArchivalInfoDetailVO getDriverArchivalInfo(Long driverId) { + // 获取驾驶员信息 + DriverInfo driverInfo = validateGetDriverInfoBySerializableId(driverId); + // 获取公司信息 + Long companyId = driverInfo.getCompanyId(); + CompanyDTO company = null; + if (Objects.nonNull(companyId)) { + company = companiesCacheHelper.getById(companyId); + } + // 装配返回信息 + ResArchivalInfoDetailVO resVo = new ResArchivalInfoDetailVO(); + resVo.setDriverId(driverInfo.getId()); + resVo.setDriverName(driverInfo.getDriverName()); + resVo.setDriverLicenseNo(driverInfo.getDriverLicenseNo()); + if (StringUtils.isNotBlank(driverInfo.getDriverLicenseType())) { + List strings = Arrays.stream(DriverLicenseTypeEnum.values()).map(String::valueOf).collect(Collectors.toList()); + if (strings.contains(driverInfo.getDriverLicenseType())) { + resVo.setDriverLicenseType(DriverLicenseTypeEnum.valueOf(driverInfo.getDriverLicenseType())); + }else { + resVo.setDriverLicenseType(DriverLicenseTypeEnum.OTHER); + } + } + if (StringUtils.isNotBlank(driverInfo.getMotorcycleTypeList())) { + resVo.setMotorcycleTypeList(JSONObject.parseArray(driverInfo.getMotorcycleTypeList(), String.class)); + } + + // 对手机号和身份证号进行脱敏处理 + String phoneNo = driverInfo.getPhoneNo(); + String idCard = driverInfo.getIdCard(); + String encryptPhone = DesensitizedUtil.mobilePhone(phoneNo); + String encryptIdCard = DesensitizedUtil.idCardNum(idCard, DriverConstant.ID_CARD_DESENSITIZED_FRONT, DriverConstant.ID_CARD_DESENSITIZED_END); + resVo.setDriverPhoneNo(encryptPhone); + resVo.setIdCard(encryptIdCard); + + String avatarFile = driverInfo.getAvatarFile(); + if (StringUtils.isNotBlank(avatarFile)) { + resVo.setAvatarFile(JSONObject.parseObject(avatarFile, FileBasicInfo.class)); + } + resVo.setBirth(driverInfo.getBirth()); + resVo.setNativePlace(driverInfo.getNativePlace()); + resVo.setDriverAddress(driverInfo.getAddress()); + resVo.setIllegalAndIllegalInfo(driverInfo.getIllegalAndIllegalInfo()); + resVo.setInitialLicenseTime(driverInfo.getInitialLicenseTime()); + resVo.setHealth(driverInfo.getHealth()); + resVo.setNativePlaceRegionCode(driverInfo.getNativePlaceRegionCode()); + resVo.setGender(driverInfo.getGender()); + if (Objects.nonNull(company)) { + resVo.setCompanyId(company.getId()); + resVo.setCompanyName(company.getName()); + resVo.setCompanyAddress(company.getAddress()); + String contactPhone = company.getContactPhone(); + String encryptContactPhone = DesensitizedUtil.mobilePhone(contactPhone); + resVo.setCompanyContactPhone(encryptContactPhone); + resVo.setCompanyContactPerson(company.getContactPerson()); + } + // 取证报名的信息作为驾驶员档案基本信息 + resVo.setTrainingRegistrationType(TrainingRegistrationTypeEnum.FORENSIC_REGISTRATION); + + // 装配初审信息 + TrainingRegistrationTypeEnum trainingRegistrationType = TrainingRegistrationTypeEnum.FORENSIC_REGISTRATION; + TrainingRegistrationReview preliminaryReviewInfo = iTrainingRegistrationReviewService.getOne( + Wrappers.lambdaQuery(TrainingRegistrationReview.class) + .eq(TrainingRegistrationReview::getRegistrationType, trainingRegistrationType.name()) + .eq(TrainingRegistrationReview::getMetaApplyType, MetaApplyTypeEnum.PRELIMINARY_REVIEW.name()) + .eq(TrainingRegistrationReview::getDriverUserId, driverInfo.getUserId()) + .eq(TrainingRegistrationReview::getApprovalStatus, MetaApplyStatusEnum.FIRST_TRIAL_APPROVED.name())); + if (Objects.nonNull(preliminaryReviewInfo)) { + AuditInfo auditInfo = assemblerAuditInfo(preliminaryReviewInfo); + resVo.setPreliminaryReviewInfo(auditInfo); + + assemblerAppendixInfo(resVo, preliminaryReviewInfo); + } + + // 装配复核信息 + if (Objects.nonNull(preliminaryReviewInfo) + && MetaApplyStatusEnum.FIRST_TRIAL_APPROVED.name().equals(preliminaryReviewInfo.getApprovalStatus())) { + TrainingRegistrationReview inReviewInfo = iTrainingRegistrationReviewService.getOne( + Wrappers.lambdaQuery(TrainingRegistrationReview.class) + .eq(TrainingRegistrationReview::getRegistrationType, trainingRegistrationType.name()) + .eq(TrainingRegistrationReview::getMetaApplyType, MetaApplyTypeEnum.IN_REVIEW.name()) + .eq(TrainingRegistrationReview::getDriverUserId, driverInfo.getUserId()) + .eq(TrainingRegistrationReview::getApprovalStatus, MetaApplyStatusEnum.REEXAMINATION_APPROVED.name())); + if (Objects.nonNull(inReviewInfo)) { + AuditInfo auditInfo = assemblerAuditInfo(inReviewInfo); + resVo.setReviewInfo(auditInfo); + } + } + + // 获取培训合格证信息 + Certificate certificate = certificateService.getOne(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getDriverId, driverId) + .orderBy(Boolean.TRUE, Boolean.TRUE, Certificate::getCreateOn) + .last(DefValConstants.LIMIT_1)); + if (Objects.nonNull(certificate)){ + resVo.setCertificateNo(certificate.getCertificateNo()); + } + resVo.setDriverUserId(driverInfo.getUserId()); + return resVo; + } + + public ResArchivalInfoDetailVO getArchivalInfoReviewDetail(ReqGetArchivalInfoReviewDetailPO request) { + Long driverId = request.getDriverId(); + // 获取驾驶员信息 + DriverInfo driverInfo = validateGetDriverInfoBySerializableId(driverId); + Long metaApplyId = request.getMetaApplyId(); + MetaApply metaApply = iMetaApplyService.getById(metaApplyId); + VUtils.isTrue(Objects.isNull(metaApply)).throwMessage("审核记录不存在!"); + // 获取公司信息 + Long companyId = driverInfo.getCompanyId(); + CompanyDTO company = companiesCacheHelper.getById(companyId); + // 装配返回信息 + ResArchivalInfoDetailVO resVo = new ResArchivalInfoDetailVO(); + resVo.setDriverId(driverInfo.getId()); + resVo.setDriverName(driverInfo.getDriverName()); + resVo.setDriverLicenseNo(driverInfo.getDriverLicenseNo()); + if (StringUtils.isNotBlank(driverInfo.getDriverLicenseType())) { + resVo.setDriverLicenseType(DriverLicenseTypeEnum.valueOf(driverInfo.getDriverLicenseType())); + } + if (StringUtils.isNotBlank(driverInfo.getDriverLicenseType())) { + resVo.setDriverLicenseType(DriverLicenseTypeEnum.valueOf(driverInfo.getDriverLicenseType())); + } + if (StringUtils.isNotBlank(driverInfo.getMotorcycleTypeList())) { + resVo.setMotorcycleTypeList(JSONObject.parseArray(driverInfo.getMotorcycleTypeList(), String.class)); + } + + resVo.setDriverAddress(driverInfo.getAddress()); + + // 对手机号和身份证号进行脱敏处理 + String phoneNo = driverInfo.getPhoneNo(); + String idCard = driverInfo.getIdCard(); + //String encryptPhone = DesensitizedUtil.mobilePhone(phoneNo); + //String encryptIdCard = DesensitizedUtil.idCardNum(idCard, DriverConstant.ID_CARD_DESENSITIZED_FRONT, DriverConstant.ID_CARD_DESENSITIZED_END); + //resVo.setDriverPhoneNo(encryptPhone); + //resVo.setIdCard(encryptIdCard); + resVo.setDriverPhoneNo(phoneNo); + resVo.setIdCard(idCard); + + String avatarFile = driverInfo.getAvatarFile(); + if (StringUtils.isNotBlank(avatarFile)) { + resVo.setAvatarFile(JSONObject.parseObject(avatarFile, FileBasicInfo.class)); + } + resVo.setDriverAddress(driverInfo.getAddress()); + resVo.setBirth(driverInfo.getBirth()); + resVo.setNativePlace(driverInfo.getNativePlace()); + resVo.setHealth(driverInfo.getHealth()); + resVo.setGender(driverInfo.getGender()); + resVo.setCompanyId(company.getId()); + resVo.setCompanyName(company.getName()); + resVo.setCompanyAddress(company.getAddress()); + resVo.setCompanyContactPhone(company.getContactPhone()); + resVo.setCompanyContactPerson(company.getContactPerson()); + resVo.setTrainingRegistrationType(request.getTrainingRegistrationType()); + resVo.setNativePlaceRegionCode(driverInfo.getNativePlaceRegionCode()); + resVo.setInitialLicenseTime(driverInfo.getInitialLicenseTime()); + resVo.setIllegalAndIllegalInfo(driverInfo.getIllegalAndIllegalInfo()); + resVo.setDriverAddress(driverInfo.getAddress()); + resVo.setDriverPhoneNo(driverInfo.getPhoneNo()); + if (Objects.nonNull(metaApply.getJobChangeCompanyId())) { + resVo.setJobChangeCompanyId(metaApply.getJobChangeCompanyId()); + CompanyDTO companyDto = companiesCacheHelper.getById(metaApply.getJobChangeCompanyId()); + resVo.setJobChangeCompanyName(companyDto.getName()); + } + + // 根据id获取当前查看的培训报名记录的信息 + Long reviewId = request.getTrainingRegistrationReviewId(); + + TrainingRegistrationReview trainingRegistrationReview + = iTrainingRegistrationReviewService.getById(reviewId); + if (Objects.isNull(trainingRegistrationReview)) { + throw new BizException("培训报名信息不存在!"); + } + if (MetaApplyStatusEnum.FIRST_TRIAL_UNDER_REVIEW.name() + .equals(trainingRegistrationReview.getApprovalStatus())) { + assemblerAppendixInfo(resVo, trainingRegistrationReview); + } + // 如果是材料初审信息-已初审列表中的数据或者是材料复审信息-待复核列表中的数据,获取审核详情 + if (MetaApplyStatusEnum.FIRST_TRIAL_APPROVED.name() + .equals(trainingRegistrationReview.getApprovalStatus()) + || MetaApplyStatusEnum.FIRST_TRIAL_APPROVAL_REJECTION.name() + .equals(trainingRegistrationReview.getApprovalStatus()) + || MetaApplyStatusEnum.REEXAMINATION_UNDER_REVIEW.name() + .equals(trainingRegistrationReview.getApprovalStatus())) { + // 装配初审信息 + AuditInfo auditInfo = assemblerAuditInfo(trainingRegistrationReview); + resVo.setPreliminaryReviewInfo(auditInfo); + // 装配附件信息 + assemblerAppendixInfo(resVo, trainingRegistrationReview); + } + // 材料复审列表中已复审列表中的数据,获取审核详情 + if (MetaApplyStatusEnum.REEXAMINATION_APPROVED.name() + .equals(trainingRegistrationReview.getApprovalStatus()) + || MetaApplyStatusEnum.REEXAMINATION_APPROVAL_REJECTION.name() + .equals(trainingRegistrationReview.getApprovalStatus())) { + // 装配初审信息和复审信息 + // 获取该复审信息对应的初审报名信息(这两种状态下的复审信息对应的初审状态一定是审核通过的) + Long preliminaryReviewId = trainingRegistrationReview.getPreliminaryReviewAssociatedId(); + TrainingRegistrationReview preliminaryTrainingRegistrationReview = iTrainingRegistrationReviewService.getById(preliminaryReviewId); + // 装配初审信息 + AuditInfo preliminaryAuditInfo = assemblerAuditInfo(preliminaryTrainingRegistrationReview); + resVo.setPreliminaryReviewInfo(preliminaryAuditInfo); + assemblerAppendixInfo(resVo, preliminaryTrainingRegistrationReview); + // 装配复审信息 + AuditInfo reviewAuditInfo = assemblerAuditInfo(trainingRegistrationReview); + resVo.setReviewInfo(reviewAuditInfo); + } + + return resVo; + } + + private void assemblerAppendixInfo(ResArchivalInfoDetailVO resVo, TrainingRegistrationReview trainingRegistrationReview) { + String appendixListJson = trainingRegistrationReview.getAppendixListJson(); + if (StringUtils.isNotBlank(appendixListJson)) { + List appendixList = JSONObject.parseArray(appendixListJson, FileBasicInfo.class); + resVo.setAppendixList(appendixList); + } + } + + /** + * 只获取驾驶员基本信息 + * + * @param request + * @return ResArchivalInfoDetailVO + */ + public ResArchivalInfoDetailVO getDriverDetail(ReqGetArchivalInfoReviewDetailPO request) { + Long driverId = request.getDriverId(); + // 获取驾驶员信息 + DriverInfo driverInfo = validateGetDriverInfoBySerializableId(driverId); + // 获取公司信息 + Long companyId = driverInfo.getCompanyId(); + CompanyDTO company = companiesCacheHelper.getById(companyId); + // 装配返回信息 + ResArchivalInfoDetailVO resVo = new ResArchivalInfoDetailVO(); + resVo.setDriverId(driverInfo.getId()); + resVo.setDriverName(driverInfo.getDriverName()); + resVo.setDriverLicenseNo(driverInfo.getDriverLicenseNo()); + if (StringUtils.isNotBlank(driverInfo.getDriverLicenseType())) { + resVo.setDriverLicenseType(DriverLicenseTypeEnum.valueOf(driverInfo.getDriverLicenseType())); + } + resVo.setDriverPhoneNo(driverInfo.getPhoneNo()); + resVo.setDriverAddress(driverInfo.getAddress()); + resVo.setIdCard(driverInfo.getIdCard()); + String avatarFile = driverInfo.getAvatarFile(); + if (StringUtils.isNotBlank(avatarFile)) { + resVo.setAvatarFile(JSONObject.parseObject(avatarFile, FileBasicInfo.class)); + } + resVo.setBirth(driverInfo.getBirth()); + resVo.setNativePlace(driverInfo.getNativePlace()); + resVo.setHealth(driverInfo.getHealth()); + resVo.setGender(driverInfo.getGender()); + resVo.setCompanyId(company.getId()); + resVo.setCompanyName(company.getName()); + resVo.setCompanyAddress(company.getAddress()); + resVo.setCompanyContactPhone(company.getContactPhone()); + resVo.setCompanyContactPerson(company.getContactPerson()); + return resVo; + } + + public AuditInfo assemblerAuditInfo(TrainingRegistrationReview trainingRegistrationReview) { + Long metaApplyId = trainingRegistrationReview.getMetaApplyId(); + String auditAppendixListJson = trainingRegistrationReview.getAuditAppendixListJson(); + MetaApply metaApply = validateGetMetaApplyBySerializableId(metaApplyId); + AuditInfo auditInfo = new AuditInfo(); + auditInfo.setAuditorId(metaApply.getApproverUserId()); + auditInfo.setAuditorName(metaApply.getApprover()); + auditInfo.setAuditTime(metaApply.getReviewTime()); + auditInfo.setReviewComments(metaApply.getAuditOpinion()); + if (StringUtils.isNotBlank(auditAppendixListJson)) { + auditInfo.setAppendixList(JSONObject.parseArray(auditAppendixListJson, FileBasicInfo.class)); + } + return auditInfo; + } + + public void driverInduction(ReqDriverInductionPO request) { + Long driverId = request.getDriverId(); + // 获取驾驶员信息 + DriverInfo driverInfo = validateGetDriverInfoBySerializableId(driverId); + Long newCompanyId = request.getNewCompanyId(); + Company newCompany = companyService.getById(newCompanyId); + if ((Objects.isNull(newCompany))) { + throw new BizException("公司信息不存在"); + } + //驾驶员重新入职,将其关联到新的公司 + driverInfo.setCompanyId(newCompany.getId()); + driverInfo.setCompanyName(newCompany.getName()); + driverInfo.setRegionId(newCompany.getRegionId()); + driverInfo.setDriverStatus(DriverStatusEnum.induction.name()); + driverInfo.setInductionTime(LocalDateTime.now()); + driverInfo.setUpdateOn(LocalDateTime.now()); + iDriverInfoService.updateById(driverInfo); + } + + /** + * 装配驾驶员工作记录保存对象 + * + * @param driverInfo + * @return DriverWorkRecordInfo + */ + private DriverWorkRecordInfo assembleDriverWorkRecordInfo(DriverInfo driverInfo) { + DriverWorkRecordInfo driverWorkRecordInfo = new DriverWorkRecordInfo(); + driverWorkRecordInfo.setDriverId(driverInfo.getId()); + driverWorkRecordInfo.setDriverName(driverInfo.getDriverName()); + driverWorkRecordInfo.setAvatarFile(driverInfo.getAvatarFile()); + driverWorkRecordInfo.setGender(driverInfo.getGender()); + driverWorkRecordInfo.setIdCard(driverInfo.getIdCard()); + driverWorkRecordInfo.setBirth(driverInfo.getBirth()); + driverWorkRecordInfo.setNativePlace(driverInfo.getNativePlace()); + driverWorkRecordInfo.setNativePlaceRegionCode(driverInfo.getNativePlaceRegionCode()); + driverWorkRecordInfo.setPhoneNo(driverInfo.getPhoneNo()); + driverWorkRecordInfo.setHealth(driverInfo.getHealth()); + driverWorkRecordInfo.setAddress(driverInfo.getAddress()); + driverWorkRecordInfo.setDriverLicenseNo(driverInfo.getDriverLicenseNo()); + driverWorkRecordInfo.setDriverLicenseType(driverInfo.getDriverLicenseType()); + driverWorkRecordInfo.setCompanyId(driverInfo.getCompanyId()); + driverWorkRecordInfo.setCreateOn(LocalDateTime.now()); + driverWorkRecordInfo.setUpdateOn(LocalDateTime.now()); + driverWorkRecordInfo.setQuitTime(LocalDateTime.now()); + driverWorkRecordInfo.setReplacementRegistrationStatus(driverInfo.getReplacementRegistrationStatus()); + driverWorkRecordInfo.setContinuingEducationStatus(driverInfo.getContinuingEducationStatus()); + driverWorkRecordInfo.setMotorcycleTypeList(driverInfo.getMotorcycleTypeList()); + driverWorkRecordInfo.setDriverStatus(DriverStatusEnum.quit.name()); + driverWorkRecordInfo.setUserId(driverInfo.getUserId()); + driverWorkRecordInfo.setRegionId(driverInfo.getRegionId()); + driverWorkRecordInfo.setDriverRegistrationStatus(driverInfo.getDriverRegistrationStatus()); + driverWorkRecordInfo.setIllegalAndIllegalInfo(driverInfo.getIllegalAndIllegalInfo()); + driverWorkRecordInfo.setInitialLicenseTime(driverInfo.getInitialLicenseTime()); + CodeUtil.searchCompanyNameAndRegionName(driverWorkRecordInfo); + return driverWorkRecordInfo; + } + + public void driverQuit(Long driverId) { + // 获取驾驶员信息 + DriverInfo driverInfo = validateGetDriverInfoBySerializableId(driverId); + // 驾驶员离职 更新驾驶员状态 + driverInfo.setDriverStatus(DriverStatusEnum.quit.name()); + driverInfo.setQuitTime(LocalDateTime.now()); + iDriverInfoService.updateById(driverInfo); + // 删除驾驶员关联的企业和区域信息 + LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate(DriverInfo.class); + wrapper.set(DriverInfo::getCompanyId,null) + .set(DriverInfo::getCompanyName,null) + .set(DriverInfo::getRegionId,null) + .eq(DriverInfo::getId,driverInfo.getId()); + iDriverInfoService.update(wrapper); + //保存驾驶员工作记录 + DriverWorkRecordInfo driverWorkRecordInfo = assembleDriverWorkRecordInfo(driverInfo); + iDriverWorkRecordService.save(driverWorkRecordInfo); + } + + public void changedJob(ReqChangedJobPO request) { + Long driverId = request.getDriverId(); + // 获取驾驶员信息 + DriverInfo driverInfo = validateGetDriverInfoBySerializableId(driverId); + Long newCompanyId = request.getNewCompanyId(); + if (newCompanyId.equals(driverInfo.getCompanyId())) { + throw new BizException("跳槽公司与当前公司相同,请重新选择!"); + } + Company newCompany = companyService.getById(newCompanyId); + if (Objects.isNull(newCompany)) { + throw new BizException("公司信息不存在"); + } + //保存跳槽前的工作记录 + DriverWorkRecordInfo driverWorkRecordInfo = assembleDriverWorkRecordInfo(driverInfo); + iDriverWorkRecordService.save(driverWorkRecordInfo); + //更新跳槽后的驾驶员档案信息 + driverInfo.setInductionTime(LocalDateTime.now()); + driverInfo.setCompanyId(newCompany.getId()); + driverInfo.setCompanyName(newCompany.getName()); + driverInfo.setRegionId(newCompany.getRegionId()); + driverInfo.setUpdateOn(LocalDateTime.now()); + driverInfo.setDriverStatus(DriverStatusEnum.induction.name()); + iDriverInfoService.updateById(driverInfo); + } + + @Transactional(rollbackFor = Exception.class) + public void driverTrainingRegistration(ReqDriverTrainingRegistrationPO request) { + // 获取培训报名类型 + TrainingRegistrationTypeEnum trainingRegistrationType = request.getTrainingRegistrationType(); + switch (trainingRegistrationType) { + // 取证报名 + case FORENSIC_REGISTRATION: { + forensicRegistration(request); + } + break; + // 申请跳槽 + case JOB_APPLICATION: { + jobApplication(request); + } + break; + // 继续教育 + case CONTINUING_EDUCATION: { + continuingEducation(request); + } + break; + // 换证报名 + case REPLACEMENT_REGISTRATION: { + replacementRegistration(request); + } + break; + default: + break; + } + } + + private void jobApplication(ReqDriverTrainingRegistrationPO request) { + + // 获取录入用户信息 + UserBasicInfoVO loginUser = userInfoHelper.getUserFullInfo(); + // 获取对应身份证驾驶员的用户ID + Long driverUserId = request.getDriverUserId(); + VUtils.isTrue(Objects.isNull(driverUserId)).throwMessage("该身份证号驾驶员用户不存在!"); + // 校验提交的身份证号是否正确 + // 查询驾驶员信息 + DriverInfo driverInfo = driverInfoService.getOne(Wrappers.lambdaQuery(DriverInfo.class).eq(DriverInfo::getUserId, driverUserId)); + VUtils.isTrue(Objects.isNull(driverInfo)).throwMessage("该身份证号驾驶员信息不存在!"); + String idCard = request.getIdCard(); + VUtils.isTrue(!driverInfo.getIdCard().equals(idCard)).throwMessage("请填写正确的身份证号!"); + // 校验该驾驶员是否可以进行跳槽申请 + String driverRegistrationStatus = driverInfo.getDriverRegistrationStatus(); + if (!DriverRegistrationStatusEnum.available.name().equals(driverRegistrationStatus)) { + throw new BizException("请先通过驾驶员取证培训报名"); + } + Long companyId = driverInfo.getCompanyId(); + Company company = companyService.getById(companyId); + + Long driverId = request.getDriverId(); + if (Objects.nonNull(driverId)){ + // 如果 driverId不为空则为修改信息(重新提交),必须审核状态为初审/复审阶段(驳回状态)时才能修改 + DriverInfo driver = validateGetDriverInfoBySerializableId(driverId); + String jobChangeStatus = driver.getJobChangeStatus(); + boolean modifyAvailable = + DriverRegistrationStatusEnum.review_stage.name().equals(jobChangeStatus); + if (!modifyAvailable) { + // 只有驾驶员跳槽审核报名状态 为初审/复核阶段时 才能修改信息 + throw new BizException("当前状态不能重新提交跳槽申请!"); + } + // 根据驾驶员id获取审核表信息及审核id,重新提交并更新审核状态 + updateApprovalStatus(request, driverId); + }else { + // 提交审核申请 + MetaApply metaApply = new MetaApply(); + metaApply.setCreateOn(LocalDateTime.now()); + metaApply.setUpdateOn(LocalDateTime.now()); + metaApply.setUserId(driverInfo.getUserId()); + metaApply.setApplyType(MetaApplyTypeEnum.PRELIMINARY_REVIEW.name()); + metaApply.setApplyStatus(MetaApplyStatusEnum.FIRST_TRIAL_UNDER_REVIEW.name()); + metaApply.setApplyTime(LocalDateTime.now()); + metaApply.setApplicantId(loginUser.getUserId()); + metaApply.setApplicant(loginUser.getNickName()); + metaApply.setRegionId(loginUser.getRegionId()); + metaApply.setCompanyId(loginUser.getCompanyId()); + JSONObject extraMaterial = new JSONObject(); + extraMaterial.put("driverInfoId", driverInfo.getId()); + metaApply.setExtraMaterial(NdJsonUtil.toJson(extraMaterial)); + metaApply.setDisplayEnable(BooleanDisplayEnum.Y.name()); + metaApply.setApplicantType(ApplicantTypeEnum.JOB_CHANGE_APPLICANT.getCode()); + metaApply.setJobChangeCompanyId(loginUser.getCompanyId()); + + iMetaApplyService.save(metaApply); + + // 补充驾驶员报名审核表信息 + TrainingRegistrationReview trainingRegistrationReviewSaveRecord = new TrainingRegistrationReview(); + trainingRegistrationReviewSaveRecord.setMetaApplyId(metaApply.getId()); + trainingRegistrationReviewSaveRecord.setMetaApplyType(metaApply.getApplyType()); + trainingRegistrationReviewSaveRecord.setApprovalStatus(MetaApplyStatusEnum.FIRST_TRIAL_UNDER_REVIEW.name()); + + // 填意向跳槽企业 + trainingRegistrationReviewSaveRecord.setCompanyId(loginUser.getCompanyId()); + trainingRegistrationReviewSaveRecord.setCompanyName(loginUser.getCompanyName()); + trainingRegistrationReviewSaveRecord.setRegionId(loginUser.getRegionId()); + + trainingRegistrationReviewSaveRecord.setDriverUserId(driverInfo.getUserId()); + trainingRegistrationReviewSaveRecord.setDriverId(driverInfo.getId()); + trainingRegistrationReviewSaveRecord.setDriverIdCard(request.getIdCard()); + trainingRegistrationReviewSaveRecord.setDriverName(request.getDriverName()); + trainingRegistrationReviewSaveRecord.setDriverPhoneNo(request.getPhoneNo()); + trainingRegistrationReviewSaveRecord.setCreateBy(loginUser.getUserId()); + trainingRegistrationReviewSaveRecord.setCreateOn(LocalDateTime.now()); + trainingRegistrationReviewSaveRecord.setUpdateOn(LocalDateTime.now()); + trainingRegistrationReviewSaveRecord + .setRegistrationType(TrainingRegistrationTypeEnum.JOB_APPLICATION.name()); + List appendixList = request.getAppendixList(); + if (CollectionUtil.isNotEmpty(appendixList)) { + trainingRegistrationReviewSaveRecord.setAppendixListJson(JSONObject.toJSONString(appendixList)); + } + iTrainingRegistrationReviewService.save(trainingRegistrationReviewSaveRecord); + + // 更新驾驶员跳槽审核状态为审核阶段 + driverInfo.setJobChangeStatus(DriverJobChangeStatusEnum.review_stage.name()); + driverInfoService.updateById(driverInfo); + } + + } + + + /** + * 驾驶员培训报名-未处理列表筛选(新接口) + * + * @return PageVo + */ + public PageVo driverTrainingRegistrationUnDealList + (ReqDriverTrainingRegistrationListPO request) { + + Integer pageNumber = request.getPageNumber(); + Integer pageSize = request.getPageSize(); + + LambdaQueryWrapper wrapper + = Wrappers.lambdaQuery(TrainingRegistrationReview.class); + DriverArchivesManage context = (DriverArchivesManage) AopContext.currentProxy(); + context.buildDriverTrainingRegistrationUnDealQuery(wrapper, request); + Page page + = iTrainingRegistrationReviewService.page(new Page<>(pageNumber, pageSize), wrapper); + + // 培训审核列表查询 + PageVo pageVo = new PageVo<>(); + long total = page.getTotal(); + pageVo.setTotal(total); + if (total == 0) { + pageVo.setRecords(new ArrayList<>()); + return pageVo; + } + List records = page.getRecords(); + List returnVoList = records.stream().map(r -> { + ResDriverTrainingRegistrationListVO resVo = new ResDriverTrainingRegistrationListVO(); + resVo.setTrainingRegistrationReviewId(r.getId()); + resVo.setCompanyId(r.getCompanyId()); + resVo.setCompanyName(r.getCompanyName()); + // 装配所属区域 + Long companyRegionId = r.getRegionId(); + if (Objects.nonNull(companyRegionId)) { + String displayRegionName = regionsCacheHelper.getDisplayName(companyRegionId); + resVo.setRegionId(companyRegionId); + resVo.setRegionName(displayRegionName); + } + resVo.setDriverName(r.getDriverName()); + resVo.setDriverId(r.getDriverId()); + resVo.setMetaApplyId(r.getMetaApplyId()); + if (StringUtils.isNotBlank(r.getApprovalStatus())) { + resVo.setMetaApplyStatus(MetaApplyStatusEnum.valueOf(r.getApprovalStatus()).name()); + } + // 对驾驶员手机号和身份证号做脱敏处理 + String phoneNo = r.getDriverPhoneNo(); + String idCard = r.getDriverIdCard(); + String encryptPhone = DesensitizedUtil.mobilePhone(phoneNo); + String encryptIdCard = DesensitizedUtil.idCardNum(idCard, DriverConstant.ID_CARD_DESENSITIZED_FRONT, DriverConstant.ID_CARD_DESENSITIZED_END); + resVo.setPhoneNo(encryptPhone); + resVo.setIdCard(encryptIdCard); + resVo.setCreateTime(r.getCreateOn()); + resVo.setTrainingRegistrationType(TrainingRegistrationTypeEnum.valueOf(r.getRegistrationType())); + return resVo; + }).collect(Collectors.toList()); + pageVo.setRecords(returnVoList); + return pageVo; + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildDriverTrainingRegistrationUnDealQuery(LambdaQueryWrapper wrapper, ReqDriverTrainingRegistrationListPO request) { + String companyName = request.getCompanyName(); + String driverName = request.getDriverName(); + MetaApplyTypeEnum metaApplyType = request.getMetaApplyType(); + TrainingRegistrationTypeEnum trainingRegistrationType = request.getTrainingRegistrationType(); + List metaApplyStatusList = request.getMetaApplyStatusList(); + String metaApplyTypeStr = Objects.nonNull(metaApplyType) ? metaApplyType.name() : null; + String trainingRegistrationTypeStr = Objects.nonNull(trainingRegistrationType) ? trainingRegistrationType.name() : null; + wrapper.like(StringUtils.isNotBlank(companyName), TrainingRegistrationReview::getCompanyName, companyName) + .like(StringUtils.isNotBlank(driverName), TrainingRegistrationReview::getDriverName, driverName) + .eq(StringUtils.isNotBlank(metaApplyTypeStr), TrainingRegistrationReview::getMetaApplyType, metaApplyTypeStr) + .eq(StringUtils.isNotBlank(trainingRegistrationTypeStr), TrainingRegistrationReview::getRegistrationType, trainingRegistrationTypeStr) + .in(CollectionUtil.isNotEmpty(metaApplyStatusList), TrainingRegistrationReview::getApprovalStatus, metaApplyStatusList) + .orderByDesc(TrainingRegistrationReview::getUpdateOn); + } + + /** + * 获取唯一的登陆username + * + * @param driverName + * @return + */ + private String generateNotDuplicateLoginIdentifier(String driverName) { + String pinYinUserName = PinyinUtils.toPinyin(driverName); + int count = 1; + String returnUserName = pinYinUserName; + while (true) { + List ndUserAuthList = iNdUserAuthService.list(Wrappers.lambdaQuery(NdUserAuth.class) + .eq(NdUserAuth::getIdentifier, returnUserName) + .eq(NdUserAuth::getAuthType, AuthTypeEnum.ACCOUNT_PASSWORD.name())); + + if (CollectionUtils.isEmpty(ndUserAuthList)) { + return returnUserName; + } else { + returnUserName = pinYinUserName + count++; + } + } + } + + /** + * 生产密码 + * + * @param phoneNo + * @param driverName + * @return + */ + private String generateCredential(String phoneNo, String driverName) { + String driverNamePinYin = PinyinUtils.toPinyin(driverName); + String password = driverNamePinYin + phoneNo.substring(phoneNo.length() - 4); + LOG.error("-------password : " + password); + return passwordEncoder.encode(password); + } + + private void continuingEducation(ReqDriverTrainingRegistrationPO request) { + // 获取当前登陆账户id + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + // 校验驾驶员当前是否有继续教育审核的资格 + // 查询驾驶员信息 + String idCard = request.getIdCard(); + DriverInfo driverInfo = iDriverInfoService.getOne(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getIdCard, idCard)); + if (Objects.isNull(driverInfo)) { + throw new BizException("该驾驶员信息不存在"); + } + // 校验驾驶员当前是否有继续教育的权限,只有取证报名完成状态下才能继续另外两种培训报名 + registrationAvailableCheckHelper.continuingEducationRegistrationValidCheck(request, driverInfo); + + Long driverId = request.getDriverId(); + if (Objects.nonNull(driverId)) { + // 如果 driverId不为空则为修改信息(重新提交),必须审核状态为初审/复审阶段(驳回状态)时才能修改 + DriverInfo driver = validateGetDriverInfoBySerializableId(driverId); + String continuingEducationStatus = driver.getContinuingEducationStatus(); + boolean modifyAvailable = + DriverRegistrationStatusEnum.review_stage.name().equals(continuingEducationStatus); + if (!modifyAvailable) { + // 只有驾驶员取证报名状态 为初审/复核阶段时 才能修改信息 + throw new BizException("当前状态不能修改驾驶员信息"); + } + // 根据驾驶员id获取审核表信息及审核id,重新提交并更新审核状态 + updateApprovalStatus(request, driverId); + // 校验 获取公司信息是否存在 获取当前登陆用户信息公司 + Long companyId = userInfoHelper.getUserCompanyId(); + DriverInfo newDriverInfo = assemblerSaveRecord(request); + // 重新提交后,获取系统用户ID,装配驾驶员信息,更新驾驶员信息 + newDriverInfo.setContinuingEducationStatus(continuingEducationStatus); + Long userId = iDriverInfoService.selectUserIdById(driverId); + newDriverInfo.setUserId(userId); + newDriverInfo.setId(driverInfo.getId()); + iDriverInfoService.updateById(newDriverInfo); + } else { + Company company = companyService.getById(driverInfo.getCompanyId()); + // 提交审核申请 + MetaApply metaApply = new MetaApply(); + metaApply.setCreateOn(LocalDateTime.now()); + metaApply.setUpdateOn(LocalDateTime.now()); + metaApply.setUserId(driverInfo.getUserId()); + metaApply.setApplyType(MetaApplyTypeEnum.PRELIMINARY_REVIEW.name()); + metaApply.setApplyStatus(MetaApplyStatusEnum.FIRST_TRIAL_UNDER_REVIEW.name()); + metaApply.setApplyTime(LocalDateTime.now()); + metaApply.setApplicantId(loginUser.getUserId()); + metaApply.setApplicant(loginUser.getNickName()); + metaApply.setRegionId(loginUser.getRegionId()); + metaApply.setCompanyId(loginUser.getCompanyId()); + JSONObject extraMaterial = new JSONObject(); + extraMaterial.put("driverInfoId", driverInfo.getId()); + metaApply.setExtraMaterial(NdJsonUtil.toJson(extraMaterial)); + metaApply.setDisplayEnable(BooleanDisplayEnum.Y.name()); + metaApply.setApplicantType(ApplicantTypeEnum.MATERIAL_APPLICANT.getCode()); + iMetaApplyService.save(metaApply); + + // 补充驾驶员报名审核表信息 + TrainingRegistrationReview trainingRegistrationReviewSaveRecord = new TrainingRegistrationReview(); + trainingRegistrationReviewSaveRecord.setMetaApplyId(metaApply.getId()); + trainingRegistrationReviewSaveRecord.setMetaApplyType(metaApply.getApplyType()); + trainingRegistrationReviewSaveRecord.setApprovalStatus(MetaApplyStatusEnum.FIRST_TRIAL_UNDER_REVIEW.name()); + trainingRegistrationReviewSaveRecord.setCompanyId(company.getId()); + trainingRegistrationReviewSaveRecord.setCompanyName(company.getName()); + trainingRegistrationReviewSaveRecord.setRegionId(company.getRegionId()); + trainingRegistrationReviewSaveRecord.setDriverUserId(driverInfo.getUserId()); + trainingRegistrationReviewSaveRecord.setDriverId(driverInfo.getId()); + trainingRegistrationReviewSaveRecord.setDriverIdCard(request.getIdCard()); + trainingRegistrationReviewSaveRecord.setDriverName(request.getDriverName()); + trainingRegistrationReviewSaveRecord.setDriverPhoneNo(request.getPhoneNo()); + trainingRegistrationReviewSaveRecord.setCreateBy(loginUser.getUserId()); + trainingRegistrationReviewSaveRecord.setCreateOn(LocalDateTime.now()); + trainingRegistrationReviewSaveRecord.setUpdateOn(LocalDateTime.now()); + trainingRegistrationReviewSaveRecord + .setRegistrationType(TrainingRegistrationTypeEnum.CONTINUING_EDUCATION.name()); + List appendixList = request.getAppendixList(); + if (CollectionUtil.isNotEmpty(appendixList)) { + trainingRegistrationReviewSaveRecord.setAppendixListJson(JSONObject.toJSONString(appendixList)); + } + iTrainingRegistrationReviewService.save(trainingRegistrationReviewSaveRecord); + + // 更新驾驶员状态 + driverInfo.setContinuingEducationStatus(DriverContinuingEducationRegistrationStatusEnum.review_stage.name()); + iDriverInfoService.updateById(driverInfo); + } + } + + private void replacementRegistration(ReqDriverTrainingRegistrationPO request) { + // 获取当前登陆账户id + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + + // 查询驾驶员信息 + String idCard = request.getIdCard(); + DriverInfo driverInfo = iDriverInfoService.getOne(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getIdCard, idCard)); + if (Objects.isNull(driverInfo)) { + throw new BizException("该驾驶员信息不存在"); + } + // 校验驾驶员是否能参加换证报名培训 + registrationAvailableCheckHelper.replacementRegistrationValidCheck(request, driverInfo); + Long driverId = request.getDriverId(); + if (Objects.nonNull(driverId)) { + // 如果 driverId不为空则为修改信息(重新提交),必须审核状态为初审/复审阶段(驳回状态)时才能修改 + DriverInfo driver = validateGetDriverInfoBySerializableId(driverId); + String replacementRegistrationStatus = driver.getReplacementRegistrationStatus(); + boolean modifyAvailable = DriverRegistrationStatusEnum.review_stage.name().equals(replacementRegistrationStatus); + if (!modifyAvailable) { + // 只有驾驶员换证报名状态 为初审/复核阶段时 才能修改信息 + throw new BizException("当前状态不能修改驾驶员信息"); + } + //根据驾驶员id获取审核表信息及审核id,重新提交并更新审核状态 + updateApprovalStatus(request, driverId); + // 校验 获取公司信息是否存在 获取当前登陆用户信息公司 + Long companyId = userInfoHelper.getUserCompanyId(); + DriverInfo newDriverInfo = assemblerSaveRecord(request); + // 重新提交后,获取系统用户ID,装配驾驶员信息,更新驾驶员信息 + newDriverInfo.setReplacementRegistrationStatus(replacementRegistrationStatus); + Long userId = iDriverInfoService.selectUserIdById(driverId); + newDriverInfo.setUserId(userId); + newDriverInfo.setId(driverInfo.getId()); + iDriverInfoService.updateById(newDriverInfo); + } else { + // 装配审核信息 + Company company = companyService.getById(driverInfo.getCompanyId()); + + // 提交审核申请 + MetaApply metaApply = new MetaApply(); + metaApply.setCreateOn(LocalDateTime.now()); + metaApply.setUpdateOn(LocalDateTime.now()); + metaApply.setUserId(driverInfo.getUserId()); + metaApply.setApplyType(MetaApplyTypeEnum.PRELIMINARY_REVIEW.name()); + metaApply.setApplyStatus(MetaApplyStatusEnum.FIRST_TRIAL_UNDER_REVIEW.name()); + metaApply.setApplyTime(LocalDateTime.now()); + metaApply.setApplicantId(loginUser.getUserId()); + metaApply.setApplicant(loginUser.getNickName()); + metaApply.setRegionId(loginUser.getRegionId()); + metaApply.setCompanyId(loginUser.getCompanyId()); + JSONObject extraMaterial = new JSONObject(); + extraMaterial.put("driverInfoId", driverInfo.getId()); + metaApply.setExtraMaterial(NdJsonUtil.toJson(extraMaterial)); + metaApply.setDisplayEnable(BooleanDisplayEnum.Y.name()); + metaApply.setApplicantType(ApplicantTypeEnum.MATERIAL_APPLICANT.getCode()); + iMetaApplyService.save(metaApply); + + // 补充驾驶员报名审核表信息 + TrainingRegistrationReview trainingRegistrationReviewSaveRecord = new TrainingRegistrationReview(); + trainingRegistrationReviewSaveRecord.setMetaApplyId(metaApply.getId()); + trainingRegistrationReviewSaveRecord.setMetaApplyType(metaApply.getApplyType()); + trainingRegistrationReviewSaveRecord.setApprovalStatus(MetaApplyStatusEnum.FIRST_TRIAL_UNDER_REVIEW.name()); + trainingRegistrationReviewSaveRecord.setCompanyId(company.getId()); + trainingRegistrationReviewSaveRecord.setCompanyName(company.getName()); + trainingRegistrationReviewSaveRecord.setRegionId(company.getRegionId()); + trainingRegistrationReviewSaveRecord.setDriverUserId(driverInfo.getUserId()); + trainingRegistrationReviewSaveRecord.setDriverId(driverInfo.getId()); + trainingRegistrationReviewSaveRecord.setDriverIdCard(request.getIdCard()); + trainingRegistrationReviewSaveRecord.setDriverName(request.getDriverName()); + trainingRegistrationReviewSaveRecord.setDriverPhoneNo(request.getPhoneNo()); + trainingRegistrationReviewSaveRecord.setCreateBy(loginUser.getUserId()); + trainingRegistrationReviewSaveRecord.setCreateOn(LocalDateTime.now()); + trainingRegistrationReviewSaveRecord.setUpdateOn(LocalDateTime.now()); + trainingRegistrationReviewSaveRecord.setRegistrationType(TrainingRegistrationTypeEnum.REPLACEMENT_REGISTRATION.name()); + List appendixList = request.getAppendixList(); + if (CollectionUtil.isNotEmpty(appendixList)) { + trainingRegistrationReviewSaveRecord.setAppendixListJson(JSONObject.toJSONString(appendixList)); + } + iTrainingRegistrationReviewService.save(trainingRegistrationReviewSaveRecord); + + // 更新驾驶员状态 + driverInfo.setReplacementRegistrationStatus(DriverReplacementRegistrationStatusEnum.review_stage.name()); + iDriverInfoService.updateById(driverInfo); + } + } + + /** + * 驾驶员培训报名(取证培训报名) + * + * @return + */ + private void forensicRegistration(ReqDriverTrainingRegistrationPO request) { + // 获取录入用户信息 + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + + Long driverId = request.getDriverId(); + if (Objects.nonNull(driverId)) { + // 如果 driverId不为空则为修改信息(重新提交),必须审核状态为初审/复审阶段(驳回状态)时才能修改 + DriverInfo driverInfo = validateGetDriverInfoBySerializableId(driverId); + String driverRegistrationStatus = driverInfo.getDriverRegistrationStatus(); + boolean modifyAvailable = DriverRegistrationStatusEnum.review_stage.name().equals(driverRegistrationStatus); + if (!modifyAvailable) { + // 只有驾驶员取证报名状态 为初审/复核阶段时 才能修改信息 + throw new BizException("当前状态不能修改驾驶员信息"); + } + //根据驾驶员id获取审核表信息及审核id,重新提交并更新审核状态 + updateApprovalStatus(request, driverId); + // 校验 获取公司信息是否存在 获取当前登陆用户信息公司 + Long companyId = userInfoHelper.getUserCompanyId(); + DriverInfo newDriverInfo = assemblerSaveRecord(request); + // 重新提交后,获取系统用户ID,装配驾驶员信息,更新驾驶员信息 + newDriverInfo.setDriverRegistrationStatus(driverRegistrationStatus); + Long userId = iDriverInfoService.selectUserIdById(driverId); + newDriverInfo.setUserId(userId); + newDriverInfo.setId(driverInfo.getId()); + iDriverInfoService.updateById(newDriverInfo); + } else { + // 创建驾驶员信息 + // 校验驾驶员 手机号/身份证号是否可用 + String idCard = request.getIdCard(); + String phoneNo = request.getPhoneNo(); + validateDriverInfoIdCardAvailable(null, idCard); + validateDriverInfoPhoneNoAvailable(null, phoneNo); + // 校验 获取公司信息是否存在 + Long companyId = userInfoHelper.getUserCompanyId(); + CompanyDTO company = companiesCacheHelper.getById(companyId); + + // 创建唯一标识用户不可登陆用户账号 并获取用户id + Long driverUserId = createUniqAccountAndGetUserId(request, loginUser.getUserId()); + + // 装配驾驶员信息 保存驾驶员信息 + DriverInfo saveDriverInfoRecord = assemblerSaveRecord(request); + saveDriverInfoRecord.setCreateOn(LocalDateTime.now()); + saveDriverInfoRecord.setUserId(driverUserId); + saveDriverInfoRecord.setDriverRegistrationStatus(DriverRegistrationStatusEnum.review_stage.name()); + iDriverInfoService.save(saveDriverInfoRecord); + + driverId = saveDriverInfoRecord.getId(); + + // 提交审核申请 + MetaApply metaApply = new MetaApply(); + metaApply.setCreateOn(LocalDateTime.now()); + metaApply.setUpdateOn(LocalDateTime.now()); + metaApply.setUserId(driverUserId); + metaApply.setApplyType(MetaApplyTypeEnum.PRELIMINARY_REVIEW.name()); + metaApply.setApplyStatus(MetaApplyStatusEnum.FIRST_TRIAL_UNDER_REVIEW.name()); + metaApply.setApplyTime(LocalDateTime.now()); + metaApply.setApplicantId(loginUser.getUserId()); + metaApply.setApplicant(loginUser.getNickName()); + metaApply.setRegionId(loginUser.getRegionId()); + metaApply.setCompanyId(loginUser.getCompanyId()); + JSONObject extraMaterial = new JSONObject(); + extraMaterial.put("driverInfoId", driverId); + metaApply.setExtraMaterial(NdJsonUtil.toJson(extraMaterial)); + metaApply.setDisplayEnable(BooleanDisplayEnum.Y.name()); + metaApply.setApplicantType(ApplicantTypeEnum.MATERIAL_APPLICANT.getCode()); + iMetaApplyService.save(metaApply); + + // 补充驾驶员报名审核表信息 + TrainingRegistrationReview trainingRegistrationReviewSaveRecord = new TrainingRegistrationReview(); + trainingRegistrationReviewSaveRecord.setMetaApplyId(metaApply.getId()); + trainingRegistrationReviewSaveRecord.setMetaApplyType(metaApply.getApplyType()); + trainingRegistrationReviewSaveRecord.setApprovalStatus(MetaApplyStatusEnum.FIRST_TRIAL_UNDER_REVIEW.name()); + trainingRegistrationReviewSaveRecord.setCompanyId(companyId); + trainingRegistrationReviewSaveRecord.setCompanyName(company.getName()); + trainingRegistrationReviewSaveRecord.setRegionId(company.getRegionId()); + trainingRegistrationReviewSaveRecord.setDriverUserId(driverUserId); + trainingRegistrationReviewSaveRecord.setDriverId(driverId); + trainingRegistrationReviewSaveRecord.setDriverIdCard(request.getIdCard()); + trainingRegistrationReviewSaveRecord.setDriverName(request.getDriverName()); + trainingRegistrationReviewSaveRecord.setDriverPhoneNo(request.getPhoneNo()); + trainingRegistrationReviewSaveRecord.setCreateBy(loginUser.getUserId()); + trainingRegistrationReviewSaveRecord.setCreateOn(LocalDateTime.now()); + trainingRegistrationReviewSaveRecord.setUpdateOn(LocalDateTime.now()); + trainingRegistrationReviewSaveRecord.setRegistrationType(TrainingRegistrationTypeEnum.FORENSIC_REGISTRATION.name()); + List appendixList = request.getAppendixList(); + if (CollectionUtil.isNotEmpty(appendixList)) { + trainingRegistrationReviewSaveRecord.setAppendixListJson(JSONObject.toJSONString(appendixList)); + } + iTrainingRegistrationReviewService.save(trainingRegistrationReviewSaveRecord); + } + + } + + private void updateApprovalStatus(ReqDriverTrainingRegistrationPO request, Long driverId) { + TrainingRegistrationReview firstTrailReview = iTrainingRegistrationReviewService.getOne(Wrappers.lambdaQuery(TrainingRegistrationReview.class) + .eq(TrainingRegistrationReview::getDriverId, driverId) + .eq(TrainingRegistrationReview::getId, request.getTrainingRegistrationReviewId()) + .eq(TrainingRegistrationReview::getApprovalStatus, MetaApplyStatusEnum.FIRST_TRIAL_APPROVAL_REJECTION.name())); + + TrainingRegistrationReview reexaminationReview = iTrainingRegistrationReviewService.getOne(Wrappers.lambdaQuery(TrainingRegistrationReview.class) + .eq(TrainingRegistrationReview::getDriverId, driverId) + .eq(TrainingRegistrationReview::getId, request.getTrainingRegistrationReviewId()) + .eq(TrainingRegistrationReview::getApprovalStatus, MetaApplyStatusEnum.REEXAMINATION_APPROVAL_REJECTION.name())); + if (Objects.nonNull(firstTrailReview)) { + Long firstTrailMetaApplyId = firstTrailReview.getMetaApplyId(); + //根据审核id获取审核状态 + MetaApply firstTrailMetaApply = iMetaApplyService.getOne(Wrappers.lambdaQuery(MetaApply.class) + .eq(MetaApply::getId, firstTrailMetaApplyId)); + //更新培训审核表信息,及审核意见表信息 + if (Objects.nonNull(firstTrailMetaApply) && + MetaApplyStatusEnum.FIRST_TRIAL_APPROVAL_REJECTION.name().equals(firstTrailMetaApply.getApplyStatus())) { + firstTrailMetaApply.setApplyStatus(MetaApplyStatusEnum.FIRST_TRIAL_UNDER_REVIEW.name()); + firstTrailReview.setDriverIdCard(request.getIdCard()); + firstTrailReview.setDriverId(request.getDriverId()); + firstTrailReview.setDriverName(request.getDriverName()); + firstTrailReview.setDriverPhoneNo(request.getPhoneNo()); + firstTrailReview.setRegistrationType(request.getTrainingRegistrationType().name()); + firstTrailReview.setApprovalStatus(MetaApplyStatusEnum.FIRST_TRIAL_UNDER_REVIEW.name()); + firstTrailReview.setCreateOn(LocalDateTime.now()); + firstTrailReview.setUpdateOn(LocalDateTime.now()); + List appendixList = request.getAppendixList(); + if (CollectionUtil.isNotEmpty(appendixList)) { + firstTrailReview.setAppendixListJson(JSONObject.toJSONString(appendixList)); + } + iTrainingRegistrationReviewService.updateById(firstTrailReview); + iMetaApplyService.updateById(firstTrailMetaApply); + } + } + if (Objects.nonNull(reexaminationReview)) { + Long reexaminationMetaApplyId = reexaminationReview.getMetaApplyId(); + MetaApply reexaminationMetaApply = iMetaApplyService.getOne(Wrappers.lambdaQuery(MetaApply.class) + .eq(MetaApply::getId, reexaminationMetaApplyId)); + if (Objects.nonNull(reexaminationMetaApply) && + MetaApplyStatusEnum.REEXAMINATION_APPROVAL_REJECTION.name().equals(reexaminationMetaApply.getApplyStatus())) { + reexaminationMetaApply.setApplyStatus(MetaApplyStatusEnum.REEXAMINATION_UNDER_REVIEW.name()); + reexaminationReview.setDriverIdCard(request.getIdCard()); + reexaminationReview.setDriverId(request.getDriverId()); + reexaminationReview.setDriverName(request.getDriverName()); + reexaminationReview.setDriverPhoneNo(request.getPhoneNo()); + reexaminationReview.setRegistrationType(request.getTrainingRegistrationType().name()); + reexaminationReview.setApprovalStatus(MetaApplyStatusEnum.REEXAMINATION_UNDER_REVIEW.name()); + reexaminationReview.setCreateOn(LocalDateTime.now()); + reexaminationReview.setUpdateOn(LocalDateTime.now()); + List appendixList = request.getAppendixList(); + if (CollectionUtil.isNotEmpty(appendixList)) { + reexaminationReview.setAppendixListJson(JSONObject.toJSONString(appendixList)); + } + iTrainingRegistrationReviewService.updateById(reexaminationReview); + iMetaApplyService.updateById(reexaminationMetaApply); + } + } + } + + /** + * 校验驾驶员身份证信息是否可用 + */ + private void validateDriverInfoIdCardAvailable(Long driverId, String idCard) { + DriverInfo currentIdCardDriverInfo = iDriverInfoService.getOne(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getIdCard, idCard) + .ne(Objects.nonNull(driverId), DriverInfo::getId, driverId)); + if (Objects.nonNull(currentIdCardDriverInfo)) { + throw new BizException("该驾驶员身份信息已录入"); + } + } + + /** + * 校验驾驶员手机号信息是否可用 + */ + private void validateDriverInfoPhoneNoAvailable(Long driverId, String phoneNo) { + DriverInfo currentPhoneNoDriverInfo = iDriverInfoService.getOne(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getPhoneNo, phoneNo) + .ne(Objects.nonNull(driverId), DriverInfo::getId, driverId)); + if (Objects.nonNull(currentPhoneNoDriverInfo)) { + throw new BizException("该驾驶员手机号信息已录入"); + } + } + + /** + * 根据公司id 校验获取公司信息 + * + * @param companyId + * @return + */ + private Company validateGetCompanyBySerializableId(Long companyId) { + Company company = companyService.getById(companyId); + if (Objects.isNull(company)) { + throw new BizException("公司信息不存在"); + } + return company; + } + + /** + * 根据驾驶员id 校验获取驾驶员信息 + * + * @return + */ + private DriverInfo validateGetDriverInfoBySerializableId(Long driverId) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DriverInfo.class); + DriverArchivesManage context = (DriverArchivesManage) AopContext.currentProxy(); + context.buildQuery(wrapper, driverId); + DriverInfo driverInfo = iDriverInfoService.getOne(wrapper); + //DriverInfo driverInfo = iDriverInfoService.getById(driverId); + if (Objects.isNull(driverInfo)) { + throw new BizException("该驾驶员信息不存在"); + } + return driverInfo; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long driverId) { + wrapper.eq(DriverInfo::getId,driverId); + } + + /** + * 根据驾驶员id 校验获取审核信息 + * + * @return + */ + private MetaApply validateGetMetaApplyBySerializableId(Long metaApplyId) { + MetaApply metaApply = iMetaApplyService.getById(metaApplyId); + if (Objects.isNull(metaApply)) { + throw new BizException("该审核信息不存在"); + } + return metaApply; + } + + /** + * 根据驾驶员id 校验获取审核信息 + * + * @return iTrainingRegistrationReviewService + */ + private TrainingRegistrationReview validateGetTrainingRegistrationReviewByMetaApplyId(Long metaApplyId) { + TrainingRegistrationReview trainingRegistrationReview = iTrainingRegistrationReviewService + .getOne(Wrappers.lambdaQuery(TrainingRegistrationReview.class) + .eq(TrainingRegistrationReview::getMetaApplyId, metaApplyId)); + if (Objects.isNull(trainingRegistrationReview)) { + throw new BizException("该培训报名审核信息不存在"); + } + return trainingRegistrationReview; + } + + + /** + * 创建唯一标识用户不可登陆用户账号 并获取用户id + * + * @return + */ + private Long createUniqAccountAndGetUserId(ReqDriverTrainingRegistrationPO request, Long createByUserId) { + NdUserInfo driver = new NdUserInfo(); + driver.setCompanyId(userInfoHelper.getUserCompanyId()); + + String phoneNo = request.getPhoneNo(); + NdUserInfo ndUserInfo = iNdUserInfoService.getOne(Wrappers.lambdaQuery(NdUserInfo.class) + .eq(NdUserInfo::getMobile, phoneNo)); + if (Objects.nonNull(ndUserInfo)) { + log.error("该手机号已有对应驾驶员{}", ndUserInfo.getUsername()); + throw new BizException("该手机号已有对应驾驶员,请更换手机号重新输入!"); + } + driver.setMobile(request.getPhoneNo()); + driver.setNickName(request.getDriverName()); + driver.setUsername(request.getDriverName()); + driver.setCreateOn(LocalDateTime.now()); + driver.setUpdateOn(driver.getCreateOn()); + driver.setCreateBy(createByUserId); + driver.setCanLogin(UserCanLoginEnum.CAN_NOT_LOGIN.getCode()); + iNdUserInfoService.save(driver); + return driver.getId(); + } + + + /** + * 装配驾驶员信息saveRecord + * + * @param request + * @return + */ + private DriverInfo assemblerSaveRecord(ReqDriverTrainingRegistrationPO request) { + DriverInfo saveRecord = new DriverInfo(); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setDriverName(request.getDriverName()); + saveRecord.setGender(request.getGender()); + saveRecord.setIdCard(request.getIdCard()); + saveRecord.setBirth(request.getBirth()); + saveRecord.setNativePlace(request.getNativePlace()); + saveRecord.setPhoneNo(request.getPhoneNo()); + saveRecord.setHealth(request.getHealth()); + saveRecord.setAddress(request.getAddress()); + saveRecord.setDriverLicenseNo(request.getDriverLicenseNo()); + saveRecord.setDriverLicenseType(request.getDriverLicenseType().name()); + saveRecord.setCompanyId(userInfoHelper.getUserCompanyId()); + CompanyDTO company = companiesCacheHelper.getById(userInfoHelper.getUserCompanyId()); + saveRecord.setCompanyName(userInfoHelper.getUserCompanyName()); + if (Objects.nonNull(company)) { + saveRecord.setRegionId(company.getRegionId()); + } + saveRecord.setNativePlaceRegionCode(request.getNativePlaceRegionCode()); + saveRecord.setInitialLicenseTime(request.getInitialLicenseTime()); + if (CollectionUtil.isNotEmpty(request.getMotorcycleTypeList())) { + saveRecord.setMotorcycleTypeList(JSONObject.toJSONString(request.getMotorcycleTypeList())); + } + FileBasicInfo avatarFile = request.getAvatarFile(); + if (Objects.nonNull(avatarFile)) { + saveRecord.setAvatarFile(JSONObject.toJSONString(avatarFile)); + } + saveRecord.setIllegalAndIllegalInfo(request.getIllegalAndIllegalInfo()); + CodeUtil.searchCompanyName(saveRecord); + return saveRecord; + } + + + @Transactional(rollbackFor = Exception.class) + public void driverTrainingPreliminaryTrial(ReqDriverTrainingPreliminaryTrialPO request) { + // 获取当前账号信息 + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + // 获取入参信息 + Long driverId = request.getDriverId(); + // 获取驾驶员信息 + DriverInfo driverInfo = validateGetDriverInfoBySerializableId(driverId); + Long metaApplyId = request.getMetaApplyId(); + List appendixList = request.getAppendixList(); + Boolean result = request.getResult(); + // 获取审核表信息 培训审核表信息 + TrainingRegistrationReview trainingRegistrationReview = iTrainingRegistrationReviewService.getOne(Wrappers.lambdaQuery(TrainingRegistrationReview.class) + .eq(TrainingRegistrationReview::getMetaApplyId, metaApplyId)); + VUtils.isTrue(Objects.isNull(trainingRegistrationReview)).throwMessage("审核信息不存在!"); + MetaApply metaApply = iMetaApplyService.getOne(Wrappers.lambdaQuery(MetaApply.class) + .eq(MetaApply::getId, metaApplyId)); + VUtils.isTrue(Objects.isNull(metaApply)).throwMessage("审核记录不存在!"); + String applyStatus; + if (result) { + applyStatus = MetaApplyStatusEnum.FIRST_TRIAL_APPROVED.name(); + } else { + applyStatus = MetaApplyStatusEnum.FIRST_TRIAL_APPROVAL_REJECTION.name(); + } + // 初审核结果处理 + metaApply.setApplyStatus(applyStatus); + metaApply.setApproverUserId(loginUser.getUserId()); + metaApply.setApprover(loginUser.getNickName()); + metaApply.setAuditOpinion(request.getOpinion()); + metaApply.setReviewTime(LocalDateTime.now()); + metaApply.setUpdateOn(LocalDateTime.now()); + metaApply.setRegionId(loginUser.getRegionId()); + metaApply.setCompanyId(loginUser.getCompanyId()); + iMetaApplyService.saveOrUpdate(metaApply); + + // 更新 培训审核表信息 + trainingRegistrationReview.setApprovalStatus(applyStatus); + if (CollectionUtil.isNotEmpty(appendixList)) { + trainingRegistrationReview.setAuditAppendixListJson(JSONObject.toJSONString(appendixList)); + } + iTrainingRegistrationReviewService.saveOrUpdate(trainingRegistrationReview); + + // 根据初审结果创建 复核审核 + if (result) { + // 创建复审信息 + MetaApply inReviewMetaApply = new MetaApply(); + inReviewMetaApply.setCreateOn(LocalDateTime.now()); + inReviewMetaApply.setUpdateOn(LocalDateTime.now()); + inReviewMetaApply.setUserId(driverInfo.getUserId()); + inReviewMetaApply.setApplyType(MetaApplyTypeEnum.IN_REVIEW.name()); + inReviewMetaApply.setApplyStatus(MetaApplyStatusEnum.REEXAMINATION_UNDER_REVIEW.name()); + inReviewMetaApply.setApplyTime(LocalDateTime.now()); + inReviewMetaApply.setApplicantId(loginUser.getUserId()); + inReviewMetaApply.setApplicant(loginUser.getNickName()); + inReviewMetaApply.setRegionId(loginUser.getRegionId()); + inReviewMetaApply.setCompanyId(loginUser.getCompanyId()); + JSONObject inReviewExtraMaterial = new JSONObject(); + inReviewExtraMaterial.put("driverInfoId", driverId); + inReviewMetaApply.setExtraMaterial(NdJsonUtil.toJson(inReviewExtraMaterial)); + inReviewMetaApply.setDisplayEnable(BooleanDisplayEnum.Y.name()); + if (ApplicantTypeEnum.MATERIAL_APPLICANT.getCode().equals(metaApply.getApplicantType())) { + inReviewMetaApply.setApplicantType(ApplicantTypeEnum.MATERIAL_APPLICANT.getCode()); + }else if (ApplicantTypeEnum.JOB_CHANGE_APPLICANT.getCode().equals(metaApply.getApplicantType())){ + inReviewMetaApply.setApplicantType(ApplicantTypeEnum.JOB_CHANGE_APPLICANT.getCode()); + inReviewMetaApply.setJobChangeCompanyId(metaApply.getJobChangeCompanyId()); + } + + iMetaApplyService.save(inReviewMetaApply); + + // 创建复审 + // 补充驾驶员报名审核表信息 + + Long jobChangeCompanyId = metaApply.getJobChangeCompanyId(); + String jobChangeCompanyName = null; + Long jobChangeCompanyRegionId = null; + if (Objects.nonNull(jobChangeCompanyId)) { + CompanyDTO jobChangeCompany = companiesCacheHelper.getById(jobChangeCompanyId); + jobChangeCompanyName = jobChangeCompany.getName(); + jobChangeCompanyRegionId = jobChangeCompany.getRegionId(); + } + Integer applicantType = metaApply.getApplicantType(); + + Long companyId = driverInfo.getCompanyId(); + CompanyDTO company = companiesCacheHelper.getById(companyId); + + TrainingRegistrationReview trainingRegistrationReviewSaveRecord = new TrainingRegistrationReview(); + trainingRegistrationReviewSaveRecord.setMetaApplyId(inReviewMetaApply.getId()); + trainingRegistrationReviewSaveRecord.setPreliminaryReviewAssociatedId(trainingRegistrationReview.getId()); + trainingRegistrationReviewSaveRecord.setMetaApplyType(MetaApplyTypeEnum.IN_REVIEW.name()); + trainingRegistrationReviewSaveRecord.setApprovalStatus(MetaApplyStatusEnum.REEXAMINATION_UNDER_REVIEW.name()); + + // 如果是正常的驾驶员材料审核,培训审核表企业填写驾驶员所属企业 + if (ApplicantTypeEnum.MATERIAL_APPLICANT.getCode().equals(applicantType)) { + trainingRegistrationReviewSaveRecord.setCompanyId(companyId); + trainingRegistrationReviewSaveRecord.setCompanyName(company.getName()); + trainingRegistrationReviewSaveRecord.setRegionId(company.getRegionId()); + } + // 如果是跳槽审核申请,培训审核表企业填写驾驶员意向跳槽企业 + else if (ApplicantTypeEnum.JOB_CHANGE_APPLICANT.getCode().equals(applicantType)) { + trainingRegistrationReviewSaveRecord.setCompanyId(jobChangeCompanyId); + trainingRegistrationReviewSaveRecord.setCompanyName(jobChangeCompanyName); + trainingRegistrationReviewSaveRecord.setRegionId(jobChangeCompanyRegionId); + } + + trainingRegistrationReviewSaveRecord.setDriverUserId(driverInfo.getUserId()); + trainingRegistrationReviewSaveRecord.setDriverId(driverId); + trainingRegistrationReviewSaveRecord.setDriverIdCard(driverInfo.getIdCard()); + trainingRegistrationReviewSaveRecord.setDriverName(driverInfo.getDriverName()); + trainingRegistrationReviewSaveRecord.setDriverPhoneNo(driverInfo.getPhoneNo()); + trainingRegistrationReviewSaveRecord.setCreateBy(loginUser.getUserId()); + trainingRegistrationReviewSaveRecord.setCreateOn(LocalDateTime.now()); + trainingRegistrationReviewSaveRecord.setUpdateOn(LocalDateTime.now()); + trainingRegistrationReviewSaveRecord.setRegistrationType(request.getTrainingRegistrationType().name()); + trainingRegistrationReviewSaveRecord.setAppendixListJson(trainingRegistrationReview.getAppendixListJson()); + iTrainingRegistrationReviewService.save(trainingRegistrationReviewSaveRecord); + } + } + + public void driverTrainingInReview(ReqDriverInReviewingPO request) { + // 获取当前账号信息 + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + + // 获取入参信息 + Long driverId = request.getDriverId(); + // 获取驾驶员信息 + DriverInfo driverInfo = validateGetDriverInfoBySerializableId(driverId); + Long metaApplyId = request.getMetaApplyId(); + List appendixList = request.getAppendixList(); + Boolean result = request.getResult(); + + // 获取审核表信息 培训审核表信息 + TrainingRegistrationReview trainingRegistrationReview = iTrainingRegistrationReviewService.getOne(Wrappers.lambdaQuery(TrainingRegistrationReview.class) + .eq(TrainingRegistrationReview::getMetaApplyId, metaApplyId)); + VUtils.isTrue(Objects.isNull(trainingRegistrationReview)).throwMessage("审核信息不存在!"); + MetaApply metaApply = iMetaApplyService.getOne(Wrappers.lambdaQuery(MetaApply.class) + .eq(MetaApply::getId, metaApplyId)); + VUtils.isTrue(Objects.isNull(metaApply)).throwMessage("审核记录不存在!"); + String applyStatus; + if (result) { + applyStatus = MetaApplyStatusEnum.REEXAMINATION_APPROVED.name(); + } else { + applyStatus = MetaApplyStatusEnum.REEXAMINATION_APPROVAL_REJECTION.name(); + } + + // 初复核结果处理 + metaApply.setApplyStatus(applyStatus); + metaApply.setApproverUserId(loginUser.getUserId()); + metaApply.setApprover(loginUser.getNickName()); + metaApply.setAuditOpinion(request.getOpinion()); + metaApply.setReviewTime(LocalDateTime.now()); + metaApply.setUpdateOn(LocalDateTime.now()); + metaApply.setRegionId(loginUser.getRegionId()); + metaApply.setCompanyId(loginUser.getCompanyId()); + iMetaApplyService.saveOrUpdate(metaApply); + + // 更新 培训审核表信息 + trainingRegistrationReview.setApprovalStatus(applyStatus); + if (CollectionUtil.isNotEmpty(appendixList)) { + trainingRegistrationReview.setAuditAppendixListJson(JSONObject.toJSONString(appendixList)); + } + iTrainingRegistrationReviewService.saveOrUpdate(trainingRegistrationReview); + + + // 如果是材料审核 + if (ApplicantTypeEnum.MATERIAL_APPLICANT.getCode().equals(metaApply.getApplicantType())) { + // 根据复核结果 创建驾驶员账号 更新驾驶员信息 + if (result) { + Long userId = driverInfo.getUserId(); + String phoneNo = driverInfo.getPhoneNo(); + String driverName = driverInfo.getDriverName(); + NdUserAuth userAuth = iNdUserAuthService.getOne(Wrappers.lambdaQuery(NdUserAuth.class).eq(NdUserAuth::getUserId, userId)); + NdUserAuth ndUserAuth = new NdUserAuth(); + if (Objects.nonNull(userAuth)) { + ndUserAuth.setId(userAuth.getId()); + } + ndUserAuth.setCreateOn(LocalDateTime.now()); + ndUserAuth.setUpdateOn(LocalDateTime.now()); + ndUserAuth.setAuthType(AuthTypeEnum.ACCOUNT_PASSWORD.name()); + ndUserAuth.setIdentifier(phoneNo); + //ndUserAuth.setCredential(generateCredential(phoneNo, driverName)); + ndUserAuth.setCredential(passwordEncoder.encode(UserLoginConstant.LOGIN_PASSWORD)); + ndUserAuth.setUserId(userId); + iNdUserAuthService.saveOrUpdate(ndUserAuth); + + //将角色和驾驶员账号关联 + UserRole userRole = new UserRole(); + UserRole role = userRoleService.getOne(Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getUserId, userId)); + if (Objects.nonNull(role)) { + userRole.setId(role.getId()); + } + userRole.setUserId(userId); + userRole.setRoleId(UserRoleTypeEnum.DRIVER_ROLE_ID.getId()); + userRoleService.saveOrUpdate(userRole); + + // 更新驾驶员信息 + if (TrainingRegistrationTypeEnum.FORENSIC_REGISTRATION.name().equals(request.getTrainingRegistrationType().name())) { + driverInfo.setDriverRegistrationStatus(DriverRegistrationStatusEnum.exam_training_stage.name()); + driverInfo.setDriverRegistrationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } else if (TrainingRegistrationTypeEnum.CONTINUING_EDUCATION.name().equals(request.getTrainingRegistrationType().name())) { + driverInfo.setContinuingEducationStatus(DriverRegistrationStatusEnum.exam_training_stage.name()); + driverInfo.setContinuingEducationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } else if (TrainingRegistrationTypeEnum.REPLACEMENT_REGISTRATION.name().equals(request.getTrainingRegistrationType().name())) { + driverInfo.setReplacementRegistrationStatus(DriverRegistrationStatusEnum.exam_training_stage.name()); + driverInfo.setReplacementRegistrationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } + iDriverInfoService.saveOrUpdate(driverInfo); + + // 更新用户信息为可登录状态 + NdUserInfo userInfo = iNdUserInfoService.getById(userId); + userInfo.setCanLogin(UserCanLoginEnum.CAN_LOGIN.getCode()); + userInfo.setUpdateOn(LocalDateTime.now()); + iNdUserInfoService.updateById(userInfo); + } + } else if (ApplicantTypeEnum.JOB_CHANGE_APPLICANT.getCode().equals(metaApply.getApplicantType())) { + // 根据复核结果 更新驾驶员所属企业、所属区域、用户信息所属企业 + if (result){ + Long jobChangeCompanyId = metaApply.getJobChangeCompanyId(); + driverInfo.setCompanyId(jobChangeCompanyId); + CompanyDTO companyDto = companiesCacheHelper.getById(jobChangeCompanyId); + driverInfo.setCompanyName(companyDto.getName()); + driverInfo.setJobChangeStatus(DriverJobChangeStatusEnum.available.name()); + driverInfo.setRegionId(companyDto.getRegionId()); + driverInfoService.updateById(driverInfo); + + Long userId = driverInfo.getUserId(); + NdUserInfo userInfo = iNdUserInfoService.getById(userId); + userInfo.setCompanyId(jobChangeCompanyId); + iNdUserInfoService.updateById(userInfo); + } + } + + } + + + public ResArchivalInfoDetailVO getDriverArchivalInfoByIdCard(String idCard) { + // 查询驾驶员信息 + DriverInfo driverInfo = iDriverInfoService.getOne(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getIdCard, idCard)); + if (Objects.isNull(driverInfo)) { + throw new BizException("该驾驶员信息不存在"); + } + return getDriverArchivalInfo(driverInfo.getId()); + } + + + public List getViolation(Long driverId, Integer violationType) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleViolation.class); + wrapper.eq(NdVehicleViolation::getDriverId, driverId); + wrapper.eq(NdVehicleViolation::getViolationType, violationType); + List list = vehicleViolationService.list(wrapper); + + if (CollUtil.isEmpty(list)) { + return Collections.emptyList(); + } + + return list.stream().map(w -> { + NdVehicleViolationVO vo = BeanUtil.copyProperties(w, NdVehicleViolationVO.class); + if (Objects.nonNull(vo.getViolationType())) { + vo.setViolationTypeName(ViolationTypeEnum.getDescByCode(vo.getViolationType())); + } + if (Objects.nonNull(vo.getMissingCertificateType())) { + vo.setMissingCertificateTypeName(MissCertEnum.getDescByCode(vo.getMissingCertificateType())); + } + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }).collect(Collectors.toList()); + } + + public List getAccidentVehicle(Long driverId) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleGetOn.class); + DriverArchivesManage context = (DriverArchivesManage) AopContext.currentProxy(); + context.buildGetOnQuery(wrapper, driverId); + NdVehicleGetOn getOn = vehicleGetOnService.getOne(wrapper); + if (Objects.isNull(getOn)) { + return Collections.emptyList(); + } + AccidentPageQuery param = new AccidentPageQuery(); + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + param.setCarPlate(getOn.getCarPlate()); + PageVo page = vehicleAccidentManage.queryVehicleAccident(param); + if (0L == page.getTotal()) { + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(), w -> { + NdVehicleAccidentVO vo = BeanUtil.copyProperties(w, NdVehicleAccidentVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildGetOnQuery(LambdaQueryWrapper wrapper, Long driverId) { + wrapper.eq(NdVehicleGetOn::getDriverId, driverId) + .orderBy(Boolean.TRUE, Boolean.TRUE, NdVehicleGetOn::getUpdateOn) + .last(" limit 1"); + } + + public List getAccidentVehicleOpen(Long driverId) { + NdVehicleGetOn getOn = vehicleGetOnService.getOne(Wrappers.lambdaQuery(NdVehicleGetOn.class) + .eq(NdVehicleGetOn::getDriverId, driverId) + .orderBy(Boolean.TRUE, Boolean.TRUE, NdVehicleGetOn::getUpdateOn) + .last(" limit 1")); + if (Objects.isNull(getOn)) { + return Collections.emptyList(); + } + AccidentPageQuery param = new AccidentPageQuery(); + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + param.setCarPlate(getOn.getCarPlate()); + PageVo page = vehicleAccidentManage.queryVehicleAccidentOpen(param); + if (0L == page.getTotal()) { + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(), w -> { + NdVehicleAccidentVO vo = BeanUtil.copyProperties(w, NdVehicleAccidentVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public List getAccidentDead(Long driverId) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleGetOn.class); + DriverArchivesManage context = (DriverArchivesManage) AopContext.currentProxy(); + context.buildGetOnQuery(wrapper, driverId); + NdVehicleGetOn getOn = vehicleGetOnService.getOne(wrapper); + if (Objects.isNull(getOn)) { + return Collections.emptyList(); + } + AccidentPageQuery param = new AccidentPageQuery(); + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + param.setCarPlate(getOn.getCarPlate()); + PageVo page = vehicleAccidentManage.queryDead(param); + if (0L == page.getTotal()) { + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(), w -> { + NdVehicleAccidentDeadVO vo = BeanUtil.copyProperties(w, NdVehicleAccidentDeadVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public List getAccidentDeadOpen(Long driverId) { + NdVehicleGetOn getOn = vehicleGetOnService.getOne(Wrappers.lambdaQuery(NdVehicleGetOn.class) + .eq(NdVehicleGetOn::getDriverId, driverId) + .orderBy(Boolean.TRUE, Boolean.TRUE, NdVehicleGetOn::getUpdateOn) + .last(" limit 1")); + if (Objects.isNull(getOn)) { + return Collections.emptyList(); + } + AccidentPageQuery param = new AccidentPageQuery(); + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + param.setCarPlate(getOn.getCarPlate()); + PageVo page = vehicleAccidentManage.queryDeadOpen(param); + if (0L == page.getTotal()) { + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(), w -> { + NdVehicleAccidentDeadVO vo = BeanUtil.copyProperties(w, NdVehicleAccidentDeadVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public List getAccidentAnalysis(Long driverId) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleGetOn.class); + DriverArchivesManage context = (DriverArchivesManage) AopContext.currentProxy(); + context.buildGetOnQuery(wrapper, driverId); + NdVehicleGetOn getOn = vehicleGetOnService.getOne(wrapper); + if (Objects.isNull(getOn)) { + return Collections.emptyList(); + } + AccidentPageQuery param = new AccidentPageQuery(); + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + param.setCarPlate(getOn.getCarPlate()); + PageVo page = vehicleAccidentManage.queryAccidentAnalysis(param); + if (0L == page.getTotal()) { + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(), w -> { + NdVehicleAccidentAnalysisVO vo = BeanUtil.copyProperties(w, NdVehicleAccidentAnalysisVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + public List getAccidentAnalysisOpen(Long driverId) { + NdVehicleGetOn getOn = vehicleGetOnService.getOne(Wrappers.lambdaQuery(NdVehicleGetOn.class) + .eq(NdVehicleGetOn::getDriverId, driverId) + .orderBy(Boolean.TRUE, Boolean.TRUE, NdVehicleGetOn::getUpdateOn) + .last(" limit 1")); + if (Objects.isNull(getOn)) { + return Collections.emptyList(); + } + AccidentPageQuery param = new AccidentPageQuery(); + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + param.setCarPlate(getOn.getCarPlate()); + PageVo page = vehicleAccidentManage.queryAccidentAnalysisOpen(param); + if (0L == page.getTotal()) { + return Collections.emptyList(); + } + return CollUtils.convert(page.getRecords(), w -> { + NdVehicleAccidentAnalysisVO vo = BeanUtil.copyProperties(w, NdVehicleAccidentAnalysisVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + } + + @Transactional(rollbackFor = Exception.class) + public String importDriverArchivesData(ImportTemplateEnum template, MultipartFile file, HttpServletResponse response) { + try (InputStream inputStream = file.getInputStream(); + ExcelReader reader = ExcelUtil.getReader(inputStream)) { + Map alias; + List title = ImportTemplateConstant.getTemplateTitle(template); + alias = new HashMap<>(title.size()); + alias.put(title.get(0), "driverName"); + alias.put(title.get(1), "gender"); + alias.put(title.get(2), "idCard"); + alias.put(title.get(3), "birth"); + alias.put(title.get(4), "nativePlace"); + alias.put(title.get(5), "phoneNo"); + alias.put(title.get(6), "health"); + alias.put(title.get(7), "address"); + alias.put(title.get(8), "driverLicenseNo"); + alias.put(title.get(9), "driverLicenseType"); + alias.put(title.get(10), "initialLicenseTime"); + alias.put(title.get(11), "motorcycleTypeList"); + alias.put(title.get(12), "illegalAndIllegalInfo"); + reader.setHeaderAlias(alias); + return importAndUpdateDriverArchivesData(response, reader.readAll(DriverArchivesDataImportDTO.class)); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private String importAndUpdateDriverArchivesData(HttpServletResponse response, List importDataList) { + AtomicBoolean flag = new AtomicBoolean(true); + StringBuffer stringBuffer = new StringBuffer(); + if (CollectionUtils.isEmpty(importDataList)) { + return "导入数据为空,请重新导入!"; + } + List driverArchivesDataList = new ArrayList<>(); + List idCards = CollUtils.fieldList(importDataList, DriverArchivesDataImportDTO::getIdCard); + Assert.isTrue(idCards.size() == importDataList.size(), "身份证号不可重复"); + Map driverInfoMap = iDriverInfoService.listByIdCard(idCards); + Assert.isTrue(idCards.size() == driverInfoMap.size(), "请确保所有身份证号存在"); + LocalDateTime now = LocalDateTime.now(); + importDataList.forEach(w -> { + String idCard = w.getIdCard(); + if (idCard == null) { + throw new BizException("身份证号未填写,请填写后重新导入!"); + } + DriverInfo driverInfo = driverInfoMap.get(w.getIdCard()); + + if (driverInfo.getDriverRegistrationStatus().equals(DriverRegistrationStatusEnum.available.name()) || + driverInfo.getReplacementRegistrationStatus().equals(DriverRegistrationStatusEnum.available.name()) || + driverInfo.getContinuingEducationStatus().equals(DriverRegistrationStatusEnum.available.name())) { + driverInfo.setDriverStatus(DriverStatusEnum.induction.name()); + //将导入驾驶员中完成培训的驾驶员导入结果标记为成功 + stringBuffer.append(driverInfo.getDriverName()).append("-").append(driverInfo.getIdCard()).append("-").append("导入成功").append("\n"); + } else { + //将标志位设置为false提醒导入驾驶员中有未完成培训的驾驶员,并将导入结果标记为失败 + stringBuffer.append(driverInfo.getDriverName()).append("-").append(driverInfo.getIdCard()).append("-").append("导入失败!").append("\n"); + flag.set(false); + return; + } + driverInfo.setCreateOn(now); + driverInfo.setUpdateOn(now); + driverInfo.setDriverName(w.getDriverName()); + + driverInfo.setGender(GenderEnum.getByValue(w.getGender()).getCode()); + driverInfo.setIdCard(w.getIdCard()); + driverInfo.setBirth(w.getBirth()); + driverInfo.setNativePlace(w.getNativePlace()); + driverInfo.setPhoneNo(w.getPhoneNo()); + driverInfo.setHealth(w.getHealth()); + driverInfo.setAddress(w.getAddress()); + driverInfo.setDriverLicenseNo(w.getDriverLicenseNo()); + driverInfo.setDriverLicenseType(w.getDriverLicenseType()); + driverInfo.setIllegalAndIllegalInfo(w.getIllegalAndIllegalInfo()); + driverInfo.setInitialLicenseTime(w.getInitialLicenseTime()); + driverInfo.setMotorcycleTypeList(w.getMotorcycleTypeList()); + + DriverInfo driverArchivesinfo = driverInfoMap.get(w.getIdCard()); + driverInfo.setId(driverArchivesinfo.getId()); + // 将现有驾驶员数据更新到导入企业下 + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + driverInfo.setCompanyId(loginUser.getCompanyId()); + driverInfo.setCompanyName(loginUser.getCompanyName()); + driverInfo.setRegionId(loginUser.getRegionId()); + driverArchivesDataList.add(driverInfo); + }); + iDriverInfoService.updateBatchById(driverArchivesDataList); + + //将导入结果字符串写入流中,供前端下载 + String importResult = stringBuffer.toString(); + byte[] bytes = importResult.getBytes(); + if (bytes.length > 0) { + try { + response.setContentType("application/octet-stream"); + response.setHeader("Content-disposition", "attachment;filename=导入结果.txt"); + response.setHeader("Content-Length", String.valueOf(bytes.length)); + response.getOutputStream().write(bytes); + response.flushBuffer(); + } catch (IOException e) { + log.error("流错误!"); + } + } + + if (flag.get()) { + return "全部导入成功!"; + } else { + return "部分导入失败,详情请查看导入结果!"; + } + } + + public void exportDriverArchives(HttpServletResponse response, ReqArchivalInfoSearchPO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo pageVo = archivalInfoSearch(param); + List collect = pageVo.getRecords().stream().map(c -> { + DriverArchivesExportDTO exportDTO = new DriverArchivesExportDTO(); + BeanUtils.copyProperties(c, exportDTO); + String createTimeStr = NdDateUtils.format(c.getCreateTime(), NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + exportDTO.setCreateTime(createTimeStr); + if (DriverStatusEnum.induction.name().equals(exportDTO.getDriverStatus())) { + exportDTO.setDriverStatus("正常"); + } else if (DriverStatusEnum.quit.name().equals(exportDTO.getDriverStatus())) { + exportDTO.setDriverStatus("离职"); + } + return exportDTO; + }).collect(Collectors.toList()); + + String fileName = "驾驶员档案信息列表"; + ExcelDownUtil.setFileName(fileName, response); + //数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), DriverArchivesExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * 各市散办通过系统直接录入驾驶员相关信息 + * + * @param param + */ + public Boolean addDriverArchives(ReqAddDriverArchivesPO param) { + //获取登录用户 + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + + // 校验驾驶员 手机号/身份证号是否可用 + String idCard = param.getIdCard(); + String phoneNo = param.getPhoneNo(); + validateDriverInfoIdCardAvailable(null, idCard); + validateDriverInfoPhoneNoAvailable(null, phoneNo); + // 校验 获取公司信息是否存在 + Long companyId = userInfoHelper.getUserCompanyId(); + // 创建唯一标识用户不可登陆用户账号 并获取用户id + Long driverUserId = newCreateUniqAccountAndGetUserId(param, loginUser.getUserId()); + // 创建驾驶员可登录账号 + String driverName = param.getDriverName(); + NdUserAuth ndUserAuth = new NdUserAuth(); + ndUserAuth.setCreateOn(LocalDateTime.now()); + ndUserAuth.setUpdateOn(LocalDateTime.now()); + ndUserAuth.setAuthType(AuthTypeEnum.ACCOUNT_PASSWORD.name()); + ndUserAuth.setIdentifier(phoneNo); + //ndUserAuth.setCredential(generateCredential(phoneNo, driverName)); + ndUserAuth.setCredential(passwordEncoder.encode(UserLoginConstant.LOGIN_PASSWORD)); + ndUserAuth.setUserId(driverUserId); + iNdUserAuthService.save(ndUserAuth); + + //将角色和驾驶员账号关联 + UserRole userRole = new UserRole(); + userRole.setUserId(driverUserId); + userRole.setRoleId(UserRoleTypeEnum.DRIVER_ROLE_ID.getId()); + userRoleService.save(userRole); + + // 装配驾驶员信息 保存驾驶员信息 + DriverInfo saveDriverInfoRecord = newAssemblerSaveRecord(param, companyId); + if (param.getTrainingRegistrationType().name().equals(TrainingRegistrationTypeEnum.FORENSIC_REGISTRATION.name())) { + saveDriverInfoRecord.setDriverRegistrationStatus(DriverRegistrationStatusEnum.available.name()); + } + if (param.getTrainingRegistrationType().name().equals(TrainingRegistrationTypeEnum.REPLACEMENT_REGISTRATION.name())) { + saveDriverInfoRecord.setDriverRegistrationStatus(DriverRegistrationStatusEnum.available.name()); + saveDriverInfoRecord.setReplacementRegistrationStatus(DriverRegistrationStatusEnum.available.name()); + } + if (param.getTrainingRegistrationType().name().equals(TrainingRegistrationTypeEnum.CONTINUING_EDUCATION.name())) { + saveDriverInfoRecord.setDriverRegistrationStatus(DriverRegistrationStatusEnum.available.name()); + saveDriverInfoRecord.setContinuingEducationStatus(DriverRegistrationStatusEnum.available.name()); + } + saveDriverInfoRecord.setCreateOn(LocalDateTime.now()); + saveDriverInfoRecord.setUserId(driverUserId); + saveDriverInfoRecord.setDriverStatus(DriverStatusEnum.induction.name()); + iDriverInfoService.save(saveDriverInfoRecord); + + Long driverId = saveDriverInfoRecord.getId(); + //生成合格证信息 + Certificate certificate = new Certificate(); + + certificate.setDriverId(driverId); + certificate.setUserId(driverUserId); + certificate.setDriverName(driverName); + certificate.setBirth(param.getBirth()); + certificate.setGender(param.getGender()); + certificate.setNativePlace(param.getNativePlace()); + certificate.setHealth(param.getHealth()); + certificate.setPhoneNo(param.getPhoneNo()); + certificate.setAddress(param.getAddress()); + certificate.setDriverLicenseType(param.getDriverLicenseType().name()); + certificate.setDriverLicenseNo(param.getDriverLicenseNo()); + certificate.setCertificateNo(param.getCertificateNo()); + certificate.setIssuedBy(param.getIssueBy()); + certificate.setIssueDate(param.getIssueDate()); + certificate.setExpiryDate(param.getExpiryDate()); + certificate.setRemark(param.getCertificateRemark()); + certificate.setRegionId(loginUser.getRegionId()); + certificate.setRegionName(loginUser.getRegionName()); + certificate.setCompanyId(loginUser.getCompanyId()); + certificate.setCompanyName(loginUser.getCompanyName()); + certificate.setCreateOn(LocalDateTime.now()); + certificate.setUpdateOn(LocalDateTime.now()); + certificate.setCreateBy(loginUser.getUserId()); + certificateService.save(certificate); + //生成上车分数信息 + DriverScoreInfo driverScoreInfo = new DriverScoreInfo(); + driverScoreInfo.setCreateOn(LocalDateTime.now()); + driverScoreInfo.setCreateBy(loginUser.getUserId()); + driverScoreInfo.setUserId(driverUserId); + driverScoreInfo.setDriverId(driverId); + driverScoreInfo.setDriverScore(60); + iDriverScoreInfoService.save(driverScoreInfo); + return Boolean.TRUE; + } + + /** + * 装配驾驶员信息saveRecord + * + * @param request + * @param request companyRegionId + * @return newAssemblerSaveRecord + */ + private DriverInfo newAssemblerSaveRecord(ReqAddDriverArchivesPO request, Long companyRegionId) { + DriverInfo saveRecord = new DriverInfo(); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setDriverName(request.getDriverName()); + saveRecord.setGender(request.getGender()); + saveRecord.setIdCard(request.getIdCard()); + saveRecord.setBirth(request.getBirth()); + saveRecord.setNativePlace(request.getNativePlace()); + saveRecord.setPhoneNo(request.getPhoneNo()); + saveRecord.setHealth(request.getHealth()); + saveRecord.setAddress(request.getAddress()); + saveRecord.setDriverLicenseNo(request.getDriverLicenseNo()); + saveRecord.setDriverLicenseType(request.getDriverLicenseType().name()); + saveRecord.setCompanyId(userInfoHelper.getUserCompanyId()); + saveRecord.setCompanyName(userInfoHelper.getUserCompanyName()); + saveRecord.setRegionId(companyRegionId); + saveRecord.setNativePlaceRegionCode(request.getNativePlaceRegionCode()); + saveRecord.setInitialLicenseTime(request.getInitialLicenseTime()); + if (CollectionUtil.isNotEmpty(request.getMotorcycleTypeList())) { + saveRecord.setMotorcycleTypeList(JSONObject.toJSONString(request.getMotorcycleTypeList())); + } + FileBasicInfo avatarFile = request.getAvatarFile(); + if (Objects.nonNull(avatarFile)) { + saveRecord.setAvatarFile(JSONObject.toJSONString(avatarFile)); + } + saveRecord.setIllegalAndIllegalInfo(request.getIllegalAndIllegalInfo()); + return saveRecord; + } + + /** + * 创建唯一标识用户不可登陆用户账号 并获取用户id + * + * @return newCreateUniqAccountAndGetUserId + */ + private Long newCreateUniqAccountAndGetUserId(ReqAddDriverArchivesPO request, Long createByUserId) { + NdUserInfo driverUserInfo = new NdUserInfo(); + driverUserInfo.setCompanyId(userInfoHelper.getUserCompanyId()); + driverUserInfo.setMobile(request.getPhoneNo()); + driverUserInfo.setNickName(request.getDriverName()); + driverUserInfo.setUsername(request.getDriverName()); + driverUserInfo.setCreateOn(LocalDateTime.now()); + driverUserInfo.setUpdateOn(LocalDateTime.now()); + driverUserInfo.setCreateBy(createByUserId); + iNdUserInfoService.save(driverUserInfo); + return driverUserInfo.getId(); + } + + public ResArchivalInfoDetailVO modifyDriverBasicInfo(DriverBasicInfoDTO data) { + + Long driverId = data.getDriverId(); + // 获取驾驶员信息 + DriverInfo driverInfo = validateGetDriverInfoBySerializableId(driverId); + + // 装配返回信息,更新编辑信息 + ResArchivalInfoDetailVO resVo = new ResArchivalInfoDetailVO(); + + // 更新编辑信息 + driverInfo.setDriverName(data.getDriverName()); + driverInfo.setGender(data.getGender()); + driverInfo.setBirth(data.getBirth()); + String idCard = data.getIdCard(); + // 身份证号经过编辑 + if (!idCard.contains(StrPool.ASTERISK)){ + // 校验身份证号 + boolean isValid = IdcardUtil.isValidCard(idCard); + if (isValid) { + driverInfo.setIdCard(idCard); + }else { + throw new BizException("身份证号输入错误,请重新输入!"); + } + } + driverInfo.setIdCard(data.getIdCard()); + driverInfo.setNativePlace(data.getNativePlace()); + driverInfo.setNativePlaceRegionCode(data.getNativePlaceRegionCode()); + FileBasicInfo file = data.getAvatarFile(); + if (Objects.nonNull(file)) { + resVo.setAvatarFile(file); + driverInfo.setAvatarFile(JSONObject.toJSONString(file)); + } + driverInfo.setHealth(data.getHealth()); + driverInfo.setDriverLicenseNo(data.getDriverLicenseNo()); + driverInfo.setPhoneNo(data.getDriverPhoneNo()); + + // 更新用户信息表中的驾驶员手机号 + Long userId = driverInfo.getUserId(); + if (Objects.nonNull(userId)) { + NdUserInfo userInfo = iNdUserInfoService.getById(userId); + String driverPhoneNo = data.getDriverPhoneNo(); + if (!driverPhoneNo.contains(StrPool.ASTERISK)) { + // 校验手机号 + boolean isValid = Validator.isMobile(driverPhoneNo); + if (isValid) { + userInfo.setMobile(driverPhoneNo); + iNdUserInfoService.updateById(userInfo); + }else { + throw new BizException("手机号输入错误,请重新输入!"); + } + } + } + driverInfo.setAddress(data.getDriverAddress()); + driverInfo.setDriverLicenseNo(data.getDriverLicenseNo()); + if (StringUtils.isNotBlank(data.getDriverLicenseType().name())) { + resVo.setDriverLicenseType(data.getDriverLicenseType()); + driverInfo.setDriverLicenseType(data.getDriverLicenseType().name()); + } + driverInfo.setInitialLicenseTime(data.getInitialLicenseTime()); + if (CollUtil.isNotEmpty(data.getMotorcycleTypeList())) { + resVo.setMotorcycleTypeList(data.getMotorcycleTypeList()); + driverInfo.setMotorcycleTypeList(JSONObject.toJSONString(data.getMotorcycleTypeList())); + } + driverInfo.setIllegalAndIllegalInfo(data.getIllegalAndIllegalInfo()); + if (Objects.nonNull(data.getCompanyId())){ + CompanyDTO companyDto = companiesCacheHelper.getById(data.getCompanyId()); + if (Objects.isNull(companyDto)){ + throw new BizException("所属企业不存在!"); + } + driverInfo.setCompanyId(companyDto.getId()); + driverInfo.setCompanyName(companyDto.getName()); + driverInfo.setRegionId(companyDto.getRegionId()); + } + driverInfoService.updateById(driverInfo); + + return getResArchivalInfoDetailVO(data, driverId, resVo); + } + + private ResArchivalInfoDetailVO getResArchivalInfoDetailVO(DriverBasicInfoDTO data, Long driverId, ResArchivalInfoDetailVO resVo) { + resVo.setDriverId(driverId); + resVo.setDriverName(data.getDriverName()); + + resVo.setDriverAddress(data.getDriverAddress()); + + // 对手机号和身份证号进行脱敏处理 + String phoneNo = data.getDriverPhoneNo(); + String idCard = data.getIdCard(); + String companyContactPhone = data.getCompanyContactPhone(); + String encryptPhone = DesensitizedUtil.mobilePhone(phoneNo); + String encryptCompanyContactPhone = DesensitizedUtil.mobilePhone(companyContactPhone); + String encryptIdCard = DesensitizedUtil.idCardNum(idCard, DriverConstant.ID_CARD_DESENSITIZED_FRONT, DriverConstant.ID_CARD_DESENSITIZED_END); + resVo.setDriverPhoneNo(encryptPhone); + resVo.setIdCard(encryptIdCard); + resVo.setCompanyContactPhone(encryptCompanyContactPhone); + + resVo.setDriverLicenseNo(data.getDriverLicenseNo()); + resVo.setBirth(data.getBirth()); + resVo.setNativePlace(data.getNativePlace()); + resVo.setDriverAddress(data.getDriverAddress()); + resVo.setIllegalAndIllegalInfo(data.getIllegalAndIllegalInfo()); + resVo.setInitialLicenseTime(data.getInitialLicenseTime()); + resVo.setDriverPhoneNo(data.getDriverPhoneNo()); + resVo.setHealth(data.getHealth()); + resVo.setNativePlaceRegionCode(data.getNativePlaceRegionCode()); + resVo.setGender(data.getGender()); + resVo.setCompanyId(data.getCompanyId()); + if (Objects.nonNull(data.getCompanyId())) { + CompanyDTO dto = companiesCacheHelper.getById(data.getCompanyId()); + if (Objects.nonNull(dto)) { + resVo.setCompanyName(dto.getName()); + } + } + resVo.setCompanyAddress(data.getCompanyAddress()); + resVo.setCompanyContactPerson(data.getCompanyContactPerson()); + // 取证报名的信息作为驾驶员档案基本信息 + resVo.setTrainingRegistrationType(TrainingRegistrationTypeEnum.FORENSIC_REGISTRATION); + return resVo; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverBlackListManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverBlackListManage.java new file mode 100644 index 0000000..2301cee --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverBlackListManage.java @@ -0,0 +1,169 @@ +package com.ningdatech.carapi.driver.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +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.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.driver.entity.DriverBlackList; +import com.ningdatech.carapi.driver.model.po.ReqDriverBlackListSearchPO; +import com.ningdatech.carapi.driver.model.vo.ResDriverBlackListVO; +import com.ningdatech.carapi.driver.service.IDriverBlackListService; +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.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/10/9 下午1:57 + */ +@Component +@RequiredArgsConstructor +public class DriverBlackListManage { + + private final IDriverBlackListService iDriverBlackListService; + + public PageVo driverBlackListSearch(ReqDriverBlackListSearchPO po) { + PageVo pageVo = new PageVo<>(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DriverBlackList.class); + DriverBlackListManage context = (DriverBlackListManage) AopContext.currentProxy(); + context.buildDriverBlackListQuery(wrapper,po); + Page page = iDriverBlackListService.page(po.page(), wrapper); + long total = page.getTotal(); + pageVo.setTotal(total); + if (total == 0){ + return pageVo; + } + pageVo.setRecords(page.getRecords().stream().map(r -> { + ResDriverBlackListVO resVo = BeanUtil.copyProperties(r,ResDriverBlackListVO.class); + CodeUtil.searchCompanyNameAndRegionName(resVo); + return resVo; + }).collect(Collectors.toList())); + return pageVo; + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildDriverBlackListQuery(LambdaQueryWrapper wrapper, ReqDriverBlackListSearchPO request) { + wrapper.eq(StringUtils.isNotBlank(request.getYear()),DriverBlackList::getYear,request.getYear()) + .like(StringUtils.isNotBlank(request.getCompanyName()),DriverBlackList::getCompanyName,request.getCompanyName()) + .like(StringUtils.isNotBlank(request.getDriverName()),DriverBlackList::getDriverName,request.getDriverName()); + } +// String driverName = reqDriverBlackListSearchPO.getDriverName(); +// RegionInfo regionInfo = reqDriverBlackListSearchPO.getRegionInfo(); +// String year = reqDriverBlackListSearchPO.getYear(); +// +// List companyList = new ArrayList<>(); +// if (StringUtils.isNotBlank(driverName) || +// (Objects.nonNull(regionInfo) && StringUtils.isNotBlank(regionInfo.getRegionCode()))) { +// LambdaQueryWrapper companyLambdaQueryWrapper = Wrappers.lambdaQuery(Company.class); +// DriverBlackListManage context = (DriverBlackListManage) AopContext.currentProxy(); +// context.build(companyLambdaQueryWrapper, reqDriverBlackListSearchPO); +// if (Objects.nonNull(regionInfo) +// && StringUtils.isNotBlank(regionInfo.getRegionCode()) +// && Objects.nonNull(regionInfo.getRegionLevel())) { +// RegionContainsBO containsRegionBo = regionSearchWrapperAssemblerHelper.getContainsRegionBo( +// regionInfo.getRegionLevel(), regionInfo.getRegionCode()); +// regionSearchWrapperAssemblerHelper.expertMetaApplyRegionContainsWrapperAssembler(companyLambdaQueryWrapper, CollUtil.toList(containsRegionBo)); +// } +// companyList = companyService.list(companyLambdaQueryWrapper); +// if (CollectionUtils.isEmpty(companyList)) { +// pageVo.setTotal(0L); +// pageVo.setRecords(new ArrayList<>()); +// return pageVo; +// } +// } +// List companyIdList = companyList.stream().map(Company::getId).collect(Collectors.toList()); +// +// // 获取符合条件的driverId List +// List driverIdList = new ArrayList<>(); +// if (StringUtils.isNotBlank(driverName) && CollectionUtils.isNotEmpty(companyIdList)) { +// LambdaQueryWrapper driverInfoLambdaQueryWrapper = Wrappers.lambdaQuery(DriverInfo.class); +// DriverBlackListManage context2 = (DriverBlackListManage) AopContext.currentProxy(); +// context2.build2(driverInfoLambdaQueryWrapper, driverName, companyIdList); +// List driverInfoList = iDriverInfoService.list(driverInfoLambdaQueryWrapper); +// driverIdList = driverInfoList.stream().map(DriverInfo::getId).collect(Collectors.toList()); +// } +// LambdaQueryWrapper driverBlackListLambdaQueryWrapper = Wrappers.lambdaQuery(DriverBlackList.class); +// DriverBlackListManage context3 = (DriverBlackListManage) AopContext.currentProxy(); +// context3.build3(driverBlackListLambdaQueryWrapper, year, driverIdList); +// Page page = iDriverBlackListService.page(new Page<>(pageNumber, pageSize),driverBlackListLambdaQueryWrapper); +// +// long total = page.getTotal(); +// pageVo.setTotal(total); +// if (total == 0) { +// return pageVo; +// } +// List records = page.getRecords(); +// +// // 黑名单驾驶员信息列表 +// List driverBlackDriverIdList = records.stream().map(DriverBlackList::getDriverId).distinct().collect(Collectors.toList()); +// LambdaQueryWrapper driverInfoLambdaQueryWrapper = Wrappers.lambdaQuery(DriverInfo.class); +// driverInfoLambdaQueryWrapper.in(CollectionUtils.isNotEmpty(driverBlackDriverIdList), DriverInfo::getId, driverBlackDriverIdList); +// List driverInfoList = iDriverInfoService.list(driverInfoLambdaQueryWrapper); +// Map driverIdNameMap = driverInfoList.stream().collect(Collectors.toMap(DriverInfo::getId, DriverInfo::getDriverName)); +// +// // 黑名单驾驶员公司信息列表 +// List blackListDriverCompanyIdList = driverInfoList.stream() +// .filter(r -> Objects.nonNull(r.getCompanyId())) +// .map(DriverInfo::getCompanyId) +// .collect(Collectors.toList()); +// LambdaQueryWrapper companyLambdaQueryWrapper = Wrappers.lambdaQuery(Company.class); +// companyLambdaQueryWrapper.eq(Company::getId, blackListDriverCompanyIdList); +// companyList = companyService.list(companyLambdaQueryWrapper); +// Map companyIdInfoMap = companyList.stream() +// .collect(Collectors.toMap(Company::getId, Function.identity())); +// +// // 装配黑名单列表展示VO +// List resDriverBlackListVOList = records.stream().map(r -> { +// ResDriverBlackListVO resDriverBlackListVO = new ResDriverBlackListVO(); +// Long driverId = r.getDriverId(); +// resDriverBlackListVO.setYear(r.getYear()); +// resDriverBlackListVO.setDriverId(r.getDriverId()); +// // 装配公司信息 驾驶员信息 +// resDriverBlackListVO.setDriverName(driverIdNameMap.get(driverId)); +// Company company = companyIdInfoMap.get(driverId); +// if (Objects.nonNull(company)) { +// RegionInfo companyRegionInfo = new RegionInfo(); +//// companyRegionInfo.setRegionCode(company.getRegionCode()); +//// companyRegionInfo.setRegionLevel(company.getRegionLevel()); +// resDriverBlackListVO.setRegionInfo(companyRegionInfo); +// resDriverBlackListVO.setCompanyName(company.getName()); +// } +// +// resDriverBlackListVO.setAccumulatedAccidentsCnt(r.getAccumulatedAccidentsCnt()); +// resDriverBlackListVO.setAccumulatedOverspeedCnt(r.getAccumulatedOverspeedCnt()); +// resDriverBlackListVO.setAccumulatedViolationsCnt(r.getAccumulatedViolationsCnt()); +// return resDriverBlackListVO; +// }).collect(Collectors.toList()); +// +// pageVo.setRecords(resDriverBlackListVOList); +// return pageVo; +// } + + //@LambdaDataScope + //public void build3(LambdaQueryWrapper driverBlackListLambdaQueryWrapper, String year, List driverIdList) { + // driverBlackListLambdaQueryWrapper.eq(DriverBlackList::getYear, year) + // .in(CollUtil.isNotEmpty(driverIdList), DriverBlackList::getDriverId, driverIdList); + //} + // + //@LambdaDataScope + //public void build2(LambdaQueryWrapper driverInfoLambdaQueryWrapper, String driverName, List companyIdList) { + // driverInfoLambdaQueryWrapper.in(CollectionUtils.isNotEmpty(companyIdList), DriverInfo::getCompanyId, companyIdList) + // .like(StringUtils.isNotBlank(driverName), DriverInfo::getDriverName, driverName); + //} + // + //@LambdaDataScope + //public void build(LambdaQueryWrapper companyLambdaQueryWrapper, ReqDriverBlackListSearchPO reqDriverBlackListSearchPO) { + // String companyName = reqDriverBlackListSearchPO.getCompanyName(); + // companyLambdaQueryWrapper.like(StringUtils.isNotBlank(companyName), Company::getName, companyName); + //} +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverManageDataViewManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverManageDataViewManage.java new file mode 100644 index 0000000..84df776 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverManageDataViewManage.java @@ -0,0 +1,125 @@ +package com.ningdatech.carapi.driver.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.map.MapUtil; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.common.model.DataChartVo; +import com.ningdatech.carapi.common.model.MapDataVO; +import com.ningdatech.carapi.common.model.po.MapDataPO; +import com.ningdatech.carapi.driver.constant.DriverAgeRangeEnum; +import com.ningdatech.carapi.driver.constant.DrivingExperienceRangeEnum; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * DriverManageDataViewManage + *

+ * + * @author WendyYang + * @since 15:31 2022/10/26 + */ +@Component +@AllArgsConstructor +public class DriverManageDataViewManage { + + private final RegionsCacheHelper regionsCacheHelper; + + private final IDriverInfoService driverInfoService; + + public List driverStatisticsByRegion(Long regionId) { + DataScreenParam param = new DataScreenParam(); + param.setRegionId(regionId); + List mapDatas = driverInfoService.diverCountByRegion(param); + if(CollUtil.isEmpty(mapDatas)){ + return Collections.emptyList(); + } + int sum = mapDatas.stream().mapToInt(MapDataPO::getValue).sum(); + return mapDatas.stream().map(mapData -> { + MapDataVO vo = BeanUtil.copyProperties(mapData, MapDataVO.class); + String percent = BigDecimal.valueOf(mapData.getValue() * 100) + .divide(BigDecimal.valueOf(sum), BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP) + .stripTrailingZeros().toPlainString(); + vo.setPercent(percent); + return vo; + }).collect(Collectors.toList()); + } + + public List driverAgeStatisticsByRegion(Long regionId) { + DataScreenParam param = new DataScreenParam(); + param.setRegionId(regionId); + String caseSql = Arrays.stream(DriverAgeRangeEnum.values()).map(w -> { + StringBuilder builder = new StringBuilder(" when @age "); + if (w.getStart() == DriverAgeRangeEnum.UNDEFINED) { + builder.append(" <= ").append(w.getEnd()); + } else if (w.getEnd() == DriverAgeRangeEnum.UNDEFINED) { + builder.append(" >= ").append(w.getStart()); + } else { + builder.append(" >= ").append(w.getStart()).append(" and @age <= ").append(w.getEnd()); + } + return builder.append(" then ").append(w.getKey()); + }).collect(Collectors.joining()) + .concat(" else " + DriverAgeRangeEnum.UNDEFINED); + Map ageMap = driverInfoService.driverAgeStatistics(caseSql, DriverAgeRangeEnum.UNDEFINED, param); + return Arrays.stream(DriverAgeRangeEnum.values()) + .sorted(Comparator.comparing(DriverAgeRangeEnum::getKey).reversed()) + .map(w -> { + DataChartVo vo = new DataChartVo(); + vo.setLabel(w.getLabel()); + vo.setValue(ageMap.getOrDefault(w.getKey(), 0)); + return vo; + }).collect(Collectors.toList()); + } + + public List drivingExperienceStatisticsByRegion(Long regionId) { + DataScreenParam param = new DataScreenParam(); + param.setRegionId(regionId); + String caseSql = Arrays.stream(DrivingExperienceRangeEnum.values()).map(w -> { + StringBuilder builder = new StringBuilder(" when @age "); + if (w.getStart() == DrivingExperienceRangeEnum.UNDEFINED) { + builder.append(" <= ").append(w.getEnd()); + } else if (w.getEnd() == DriverAgeRangeEnum.UNDEFINED) { + builder.append(" >= ").append(w.getStart()); + } else { + builder.append(" >= ").append(w.getStart()).append(" and @age <= ").append(w.getEnd()); + } + return builder.append(" then ").append(w.getKey()); + }).collect(Collectors.joining()) + .concat(" else " + DrivingExperienceRangeEnum.UNDEFINED); + Map ageMap = driverInfoService.drivingExperienceStatistics(caseSql, DrivingExperienceRangeEnum.UNDEFINED, param); + return Arrays.stream(DrivingExperienceRangeEnum.values()) + .sorted(Comparator.comparing(DrivingExperienceRangeEnum::getKey).reversed()) + .map(w -> { + DataChartVo vo = new DataChartVo(); + vo.setLabel(w.getLabel()); + vo.setValue(ageMap.getOrDefault(w.getKey(), 0)); + return vo; + }).collect(Collectors.toList()); + } + + public List driverNativePlaceStatisticsByRegion(Long regionId) { + List result = new ArrayList<>(); + DataScreenParam param = new DataScreenParam(); + param.setRegionId(regionId); + List> maps = driverInfoService.nativePlaceStatisticsByRegion(param); + Map>> groupByProvince = maps.stream() + .collect(Collectors.groupingBy(w -> String.valueOf(w.get("nativePlace")))); + groupByProvince.forEach((k, v) -> { + MapDataVO mapData = MapDataVO.builder() + .regionCode(MapUtil.getStr(v.get(0), "nativePlaceRegionCode")) + .regionName(k) + .build(); + result.add(mapData); + }); + return result; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverScoreRecordManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverScoreRecordManage.java new file mode 100644 index 0000000..0ceb7e9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverScoreRecordManage.java @@ -0,0 +1,161 @@ +package com.ningdatech.carapi.driver.manage; + +import cn.hutool.core.bean.BeanUtil; +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.carapi.driver.constant.ScoreOperateType; +import com.ningdatech.carapi.driver.constant.TrainingStatusEnum; +import com.ningdatech.carapi.driver.constant.TrainingTypeEnum; +import com.ningdatech.carapi.driver.entity.*; +import com.ningdatech.carapi.driver.helper.DriverBehaviorScoreHelper; +import com.ningdatech.carapi.driver.model.bo.CodingRuleBO; +import com.ningdatech.carapi.driver.model.po.ReqScoreBonusPO; +import com.ningdatech.carapi.driver.model.po.ReqScoreListPO; +import com.ningdatech.carapi.driver.model.vo.ResDriverScoreRecordListVO; +import com.ningdatech.carapi.driver.service.*; +import com.ningdatech.carapi.sys.entity.enumeration.CodingRuleBehaviorTypeEnum; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/11/3 下午4:56 + */ +@Component +@RequiredArgsConstructor +public class DriverScoreRecordManage { + + private final IDriverScoreRecordService iDriverScoreRecordService; + private final IDriverScoreInfoService iDriverScoreInfoService; + private final ITrainingBonusRecordService iTrainingBonusRecordService; + private final IDriverInfoService iDriverInfoService; + private final ITrainingOrganizationTrainerService iTrainingOrganizationTrainerService; + private final ITrainingOrganizationService iTrainingOrganizationService; + private final DriverBehaviorScoreHelper driverBehaviorScoreHelper; + + public List list() { + Long userId = LoginUserUtil.getUserId(); + List driverScoreRecordList = iDriverScoreRecordService.list(Wrappers + .lambdaQuery(DriverScoreRecord.class).eq(DriverScoreRecord::getUserId, userId).orderByDesc(DriverScoreRecord::getCreateOn)); + return driverScoreRecordList.stream().map(r -> { + ResDriverScoreRecordListVO resVO = new ResDriverScoreRecordListVO(); + BeanUtil.copyProperties(r, resVO); + return resVO; + }).collect(Collectors.toList()); + } + + + public PageVo pageList(ReqScoreListPO request) { + @NotBlank Long driverId = request.getDriverId(); + Integer pageNumber = request.getPageNumber(); + Integer pageSize = request.getPageSize(); + + Page page = iDriverScoreRecordService.page(new Page<>(pageNumber, pageSize), Wrappers + .lambdaQuery(DriverScoreRecord.class) + .eq(DriverScoreRecord::getDriverId, driverId) + .orderByDesc(DriverScoreRecord::getCreateOn)); + + PageVo pageVo = new PageVo<>(); + long total = page.getTotal(); + if (total > 0) { + List resVOList = page.getRecords().stream().map(r -> { + ResDriverScoreRecordListVO resVO = new ResDriverScoreRecordListVO(); + BeanUtil.copyProperties(r, resVO); + return resVO; + }).collect(Collectors.toList()); + pageVo.setRecords(resVOList); + } + return pageVo; + } + + public Integer getScore(Long driverId) { + DriverScoreInfo driverScoreInfo = iDriverScoreInfoService.getOne(Wrappers.lambdaQuery(DriverScoreInfo.class) + .eq(DriverScoreInfo::getDriverId, driverId)); + + if (Objects.nonNull(driverScoreInfo)) { + return driverScoreInfo.getDriverScore(); + } + return 0; + } + + @Transactional(rollbackFor = Exception.class) + public void bonus(ReqScoreBonusPO request) { + Long driverId = request.getDriverId(); + String materialType = request.getMaterialType(); + String behaviorType = request.getBehaviorType(); + Long trainingOrganizationId = request.getTrainingOrganizationId(); + Long trainingMaterialId = request.getTrainingMaterialId(); + + DriverInfo driverInfo = iDriverInfoService.getById(driverId); + if (Objects.isNull(driverInfo)) { + throw new BizException("该驾驶员信息不存在"); + } + + TrainingOrganization trainingOrganization = iTrainingOrganizationService.getOne(Wrappers.lambdaQuery(TrainingOrganization.class) + .eq(TrainingOrganization::getId, trainingOrganizationId) + .eq(TrainingOrganization::getTrainingType, TrainingTypeEnum.transcoding_training.name()) + .eq(TrainingOrganization::getTrainingStatus, TrainingStatusEnum.enable.name()) + ); + if (Objects.isNull(trainingOrganization)) { + return; + } + TrainingBonusRecord one = iTrainingBonusRecordService.getOne(Wrappers.lambdaQuery(TrainingBonusRecord.class) + .eq(TrainingBonusRecord::getDriverId, driverId) + .eq(TrainingBonusRecord::getMaterialType, materialType) + .eq(TrainingBonusRecord::getTrainingMaterialId, trainingMaterialId) + .eq(TrainingBonusRecord::getTrainingOrganizationId, trainingOrganizationId) + .eq(TrainingBonusRecord::getBehaviorType, behaviorType)); + + if (Objects.isNull(one)) { + // 获取行为分数 + CodingRuleBO codingRuleBehaviorScore = driverBehaviorScoreHelper.getCodingRuleBehaviorScore(CodingRuleBehaviorTypeEnum.valueOf(behaviorType),null); + int score = codingRuleBehaviorScore.getOperationScore(); + + DriverScoreInfo driverScoreInfo = iDriverScoreInfoService.getOne(Wrappers.lambdaQuery(DriverScoreInfo.class).eq(DriverScoreInfo::getDriverId, driverInfo.getId())); + if (driverScoreInfo == null) { + driverScoreInfo = new DriverScoreInfo(); + driverScoreInfo.setDriverId(driverInfo.getId()); + driverScoreInfo.setUserId(driverInfo.getUserId()); + driverScoreInfo.setCreateOn(LocalDateTime.now()); + driverScoreInfo.setDriverScore(score); + } else { + driverScoreInfo.setDriverScore(driverScoreInfo.getDriverScore() + score); + } + driverScoreInfo.setUpdateOn(LocalDateTime.now()); + iDriverScoreInfoService.saveOrUpdate(driverScoreInfo); + + DriverScoreRecord saveRecord = new DriverScoreRecord(); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setDriverId(driverInfo.getId()); + saveRecord.setOperateReason("参加转码培训并查看了材料"); + saveRecord.setOperateScore(score); + saveRecord.setOperateType(ScoreOperateType.add.name()); + saveRecord.setUserId(driverInfo.getUserId()); + iDriverScoreRecordService.save(saveRecord); + + TrainingBonusRecord record = new TrainingBonusRecord(); + record.setUserId(driverInfo.getUserId()); + record.setCreateOn(LocalDateTime.now()); + record.setUpdateOn(LocalDateTime.now()); + record.setBehaviorType(behaviorType); + record.setDriverId(driverId); + record.setMaterialType(materialType); + record.setTrainingMaterialId(trainingMaterialId); + record.setTrainingOrganizationId(trainingOrganizationId); + record.setCompanyId(driverInfo.getCompanyId()); + record.setRegionId(driverInfo.getRegionId()); + iTrainingBonusRecordService.save(record); + } + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverStarManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverStarManage.java new file mode 100644 index 0000000..fb455f3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/DriverStarManage.java @@ -0,0 +1,269 @@ +package com.ningdatech.carapi.driver.manage; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +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.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.driver.constant.StarManageDisplayTypeEnum; +import com.ningdatech.carapi.driver.entity.RegionStarDTO; +import com.ningdatech.carapi.driver.entity.StarManage; +import com.ningdatech.carapi.driver.model.StarManageDisplayInfo; +import com.ningdatech.carapi.driver.model.po.ReqCompanyStarPO; +import com.ningdatech.carapi.driver.model.po.ReqDriverStarListPO; +import com.ningdatech.carapi.driver.model.po.ReqRegionStarPO; +import com.ningdatech.carapi.driver.model.vo.ResCompanyStarListVO; +import com.ningdatech.carapi.driver.model.vo.ResDriverStarListVO; +import com.ningdatech.carapi.driver.model.vo.ResRegionStarVO; +import com.ningdatech.carapi.driver.model.vo.StarManageDisplay; +import com.ningdatech.carapi.driver.service.IStarManageService; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import lombok.RequiredArgsConstructor; + +/** + * @author liuxinxin + * @date 2022/11/15 上午9:45 + */ +@Component +@RequiredArgsConstructor +public class DriverStarManage { + + private final IStarManageService iStarManageService; + private final RegionsCacheHelper regionsCacheHelper; + private final IStarManageService starManageService; + private final CompanyService companyService; + + public PageVo driverStarList(ReqDriverStarListPO request) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(StarManage.class); + DriverStarManage context = (DriverStarManage) AopContext.currentProxy(); + List containsRegionIdList = regionsCacheHelper.listChildRegionId(request.getRegionId()); + request.setChildRegionIds(containsRegionIdList); + context.buildDriverStarQuery(wrapper, request); + Page page = iStarManageService.page(request.page(),wrapper); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List records = page.getRecords(); + List resVOList = records.stream().map(r -> { + ResDriverStarListVO resVO = new ResDriverStarListVO(); + BeanUtils.copyProperties(r,resVO); + CodeUtil.searchCompanyNameAndRegionName(resVO); + return resVO; + }).collect(Collectors.toList()); + return PageVo.of(resVOList,page.getTotal()); + } + + @LambdaDataScope + public void buildDriverStarQuery(LambdaQueryWrapper wrapper, ReqDriverStarListPO request) { + wrapper.like(StringUtils.isNotBlank(request.getCompanyName()), StarManage::getCompanyName, request.getCompanyName()) + .like(StringUtils.isNotBlank(request.getDriverName()), StarManage::getDriverName, request.getDriverName()) + .in(Objects.nonNull(request.getChildRegionIds()),StarManage::getRegionId,request.getChildRegionIds()); + } + + public PageVo regionStarList(ReqRegionStarPO request) { + Integer pageNumber = request.getPageNumber(); + Integer pageSize = request.getPageSize(); + Long regionId = request.getRegionId(); + List regionList = regionsCacheHelper.listChild(regionId); + List regionStars = new ArrayList<>(); + long total = 0; + // 如果为空最后一级统计公司 + if (CollectionUtil.isEmpty(regionList)) { + List regionIdList = CollectionUtil.toList(regionId); + RegionStarDTO regionStarDTO = new RegionStarDTO(); + regionStarDTO.setRegionIdList(regionIdList); + Double avgStars = starManageService.getAvgStar(regionStarDTO); + avgStars = avgStars == null ? 0 : avgStars; + BigDecimal avgStarTemp = BigDecimal.valueOf(avgStars); + double avgStar = avgStarTemp.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue(); + Double totalStar = starManageService.countTotalStar(regionStarDTO); + + LambdaQueryWrapper query = Wrappers.lambdaQuery(Company.class); + DriverStarManage context2 = (DriverStarManage) AopContext.currentProxy(); + context2.buildCompanyQuery(query, request); + + Page page = companyService.page(request.page(),query); + + if (page.getTotal() == 0){ + return PageVo.empty(); + } + List companyRecords = page.getRecords(); + + for (Company company : companyRecords) { + ResRegionStarVO resVO = new ResRegionStarVO(); + resVO.setTotalAvgStar(avgStar); + resVO.setTotalStar(totalStar); + StarManageDisplayInfo starManageDisplayInfo = new StarManageDisplayInfo(); + + StarManageDisplay firstDisplayInfo = new StarManageDisplay(); + firstDisplayInfo.setId(regionId); + RegionDTO regionDTO = regionsCacheHelper.getByRegionId(regionId); + if (Objects.nonNull(regionDTO)) { + firstDisplayInfo.setDisplayName(regionDTO.getRegionName()); + } + firstDisplayInfo.setType(StarManageDisplayTypeEnum.region_id); + + StarManageDisplay secondDisplayInfo = new StarManageDisplay(); + secondDisplayInfo.setId(company.getId()); + secondDisplayInfo.setDisplayName(company.getName()); + secondDisplayInfo.setType(StarManageDisplayTypeEnum.company_id); + + starManageDisplayInfo.setFirstDisplayInfo(firstDisplayInfo); + starManageDisplayInfo.setSecondDisplayInfo(secondDisplayInfo); + RegionStarDTO regionStarDto2 = new RegionStarDTO(); + regionStarDto2.setCompanyId(company.getId()); + Double companyAvgStars = starManageService.getCompanyAvgStar(regionStarDto2); + companyAvgStars = companyAvgStars == null ? 0 : companyAvgStars; + BigDecimal companyAvgStarTemp = BigDecimal.valueOf(companyAvgStars); + double companyAvgStar = companyAvgStarTemp.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue(); + starManageDisplayInfo.setAvgStar(companyAvgStar); + resVO.setRecord(starManageDisplayInfo); + regionStars.add(resVO); + } + total = page.getTotal(); + } else { + // 如果不为空下一级则为地区 + List containsRegionIdList = regionsCacheHelper.listChildRegionId(regionId); + RegionStarDTO regionStarDTO = new RegionStarDTO(); + regionStarDTO.setRegionIdList(containsRegionIdList); + Double avgStars = starManageService.getAvgStar(regionStarDTO); + avgStars = avgStars == null ? 0 : avgStars; + BigDecimal avgStarTemp = BigDecimal.valueOf(avgStars); + double avgStar = avgStarTemp.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue(); + Double totalStar = starManageService.countTotalStar(regionStarDTO); + + if (CollUtil.isEmpty(regionList)){ + return PageVo.empty(); + } + + int currIdx = (pageNumber > 1 ? (pageNumber - 1) * pageSize : 0); + int endIdx = Math.min(regionList.size(),currIdx + pageSize); + List regionSubList; + regionSubList = regionList.subList(currIdx, endIdx); + + for (Long childrenRegionId : regionSubList) { + ResRegionStarVO resVO = new ResRegionStarVO(); + resVO.setTotalAvgStar(avgStar); + resVO.setTotalStar(totalStar); + List listChildRegionIdList = regionsCacheHelper.listChildRegionId(childrenRegionId); + + StarManageDisplayInfo starManageDisplayInfo = new StarManageDisplayInfo(); + StarManageDisplay firstDisplayInfo = new StarManageDisplay(); + firstDisplayInfo.setId(regionId); + RegionDTO regionDTO = regionsCacheHelper.getByRegionId(regionId); + if (Objects.nonNull(regionDTO)) { + firstDisplayInfo.setDisplayName(regionDTO.getRegionName()); + } + firstDisplayInfo.setType(StarManageDisplayTypeEnum.region_id); + + StarManageDisplay secondDisplayInfo = new StarManageDisplay(); + secondDisplayInfo.setId(childrenRegionId); + RegionDTO childrenRegionDTO = regionsCacheHelper.getByRegionId(childrenRegionId); + if (Objects.nonNull(childrenRegionDTO)) { + secondDisplayInfo.setDisplayName(childrenRegionDTO.getRegionName()); + } + secondDisplayInfo.setType(StarManageDisplayTypeEnum.region_id); + + starManageDisplayInfo.setFirstDisplayInfo(firstDisplayInfo); + starManageDisplayInfo.setSecondDisplayInfo(secondDisplayInfo); + RegionStarDTO regionStarDto2 = new RegionStarDTO(); + regionStarDto2.setRegionIdList(listChildRegionIdList); + Double listAvgStars = starManageService.getAvgStar(regionStarDto2); + listAvgStars = listAvgStars == null ? 0 : listAvgStars; + BigDecimal listAvgStarTemp = BigDecimal.valueOf(listAvgStars); + double listAvgStar = listAvgStarTemp.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue(); + starManageDisplayInfo.setAvgStar(listAvgStar); + resVO.setRecord(starManageDisplayInfo); + regionStars.add(resVO); + } + total = regionList.size(); + } + return PageVo.of(regionStars,total); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.COMPANY_TABLE) + public void buildCompanyQuery(LambdaQueryWrapper query, ReqRegionStarPO request) { + query.eq(Company::getRegionId, request.getRegionId()) + .orderByDesc(Company::getId); + } + + public PageVo companyStarList(ReqCompanyStarPO request) { + List companyStarLists = new ArrayList<>(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(StarManage.class); + Long regionId = request.getRegionId(); + DriverStarManage context = (DriverStarManage) AopContext.currentProxy(); + context.buildCompanyStarQuery(wrapper, request); + Page page = iStarManageService.page(request.page(),wrapper); + + long total = page.getTotal(); + if (0L == total){ + return PageVo.empty(); + } + List records = page.getRecords(); + + List containsRegionIdList = regionsCacheHelper.listChildRegionId(regionId); + RegionStarDTO regionStarDTO = new RegionStarDTO(); + regionStarDTO.setRegionIdList(containsRegionIdList); + Double avgStars = starManageService.getAvgStar(regionStarDTO); + avgStars = avgStars == null ? 0 : avgStars; + BigDecimal avgStarTemp = BigDecimal.valueOf(avgStars); + double avgStar = avgStarTemp.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue(); + Double totalStar = starManageService.countTotalStar(regionStarDTO); + + + for (StarManage starManage : records) { + ResCompanyStarListVO resCompanyStarListVO = new ResCompanyStarListVO(); + StarManageDisplayInfo starManageDisplayInfo = new StarManageDisplayInfo(); + StarManageDisplay firstDisplayInfo = new StarManageDisplay(); + firstDisplayInfo.setId(starManage.getCompanyId()); + firstDisplayInfo.setDisplayName(starManage.getCompanyName()); + firstDisplayInfo.setType(StarManageDisplayTypeEnum.company_id); + + StarManageDisplay secondDisplayInfo = new StarManageDisplay(); + secondDisplayInfo.setId(starManage.getDriverId()); + secondDisplayInfo.setDisplayName(starManage.getDriverName()); + secondDisplayInfo.setType(StarManageDisplayTypeEnum.driver_id); + + starManageDisplayInfo.setFirstDisplayInfo(firstDisplayInfo); + starManageDisplayInfo.setSecondDisplayInfo(secondDisplayInfo); + + if (Objects.nonNull(starManage.getCurrentStar())) { + starManageDisplayInfo.setAvgStar(Double.parseDouble(starManage.getCurrentStar() + "")); + } + resCompanyStarListVO.setTotalAvgStar(avgStar); + resCompanyStarListVO.setTotalStar(totalStar); + resCompanyStarListVO.setRecord(starManageDisplayInfo); + companyStarLists.add(resCompanyStarListVO); + } + return PageVo.of(companyStarLists,page.getTotal()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildCompanyStarQuery(LambdaQueryWrapper wrapper, ReqCompanyStarPO request) { + wrapper.like(StringUtils.isNotBlank(request.getCompanyName()), StarManage::getCompanyName, request.getCompanyName()) + .like(StringUtils.isNotBlank(request.getDriverName()), StarManage::getDriverName, request.getDriverName()); + //.eq(Objects.nonNull(request.getRegionId()), StarManage::getRegionId, request.getRegionId()); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/ExamRecordManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/ExamRecordManage.java new file mode 100644 index 0000000..9cc21f1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/ExamRecordManage.java @@ -0,0 +1,101 @@ +package com.ningdatech.carapi.driver.manage; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +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.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.driver.constant.ExamQualifiedEnum; +import com.ningdatech.carapi.driver.entity.Certificate; +import com.ningdatech.carapi.driver.entity.ExamRecordDetail; +import com.ningdatech.carapi.driver.model.po.ReqListExamRecordPO; +import com.ningdatech.carapi.driver.model.vo.ResListExamRecordVO; +import com.ningdatech.carapi.driver.service.ICertificateService; +import com.ningdatech.carapi.driver.service.IExamRecordDetailService; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import lombok.RequiredArgsConstructor; + +/** + * @author liuxinxin + * @date 2022/10/26 下午5:13 + */ +@Component +@RequiredArgsConstructor +public class ExamRecordManage { + + private final IExamRecordDetailService iExamRecordDetailService; + private final ICertificateService iCertificateService; + + + public PageVo listExamRecord(ReqListExamRecordPO request) { + + // 按照登录用户,如果是驾驶员登录,只展示该驾驶员信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + + Integer pageNumber = request.getPageNumber(); + Integer pageSize = request.getPageSize(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ExamRecordDetail.class); + ExamRecordManage context = (ExamRecordManage) AopContext.currentProxy(); + context.buildExamRecordQuery(wrapper, request); + + if (UserRoleTypeEnum.DRIVER_ROLE_ID.getId().equals(roleId)) { + Long userId = userDetail.getUserId(); + wrapper.eq(ExamRecordDetail::getDriverUserId,userId); + } + Page page = iExamRecordDetailService.page(new Page<>(pageNumber, pageSize),wrapper); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List records = page.getRecords(); + List driverUserIdList = records.stream().map(ExamRecordDetail::getDriverUserId).collect(Collectors.toList()); + List certificateList = iCertificateService.list(Wrappers.lambdaQuery(Certificate.class) + .in(Certificate::getUserId, driverUserIdList)); + Map userIdCertificateNoMap = certificateList.stream().collect(Collectors.toMap(Certificate::getDriverId, Certificate::getCertificateNo)); + + List resVoList = records.stream().map(r -> { + ResListExamRecordVO resVO = BeanUtil.copyProperties(r,ResListExamRecordVO.class); + resVO.setIsQualified(ExamQualifiedEnum.valueOf(r.getExamResult())); + resVO.setCertificateNo(userIdCertificateNoMap.get(r.getDriverId())); + resVO.setExamType(r.getExamType()); + CodeUtil.searchCompanyNameAndRegionName(resVO); + return resVO; + }).collect(Collectors.toList()); + return PageVo.of(resVoList,page.getTotal()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildExamRecordQuery(LambdaQueryWrapper wrapper, ReqListExamRecordPO request) { + String companyName = request.getCompanyName(); + String driverName = request.getDriverName(); + ExamQualifiedEnum isQualified = request.getIsQualified(); + LocalDateTime startTime = request.getStartTime(); + LocalDateTime endTime = request.getEndTime(); + String isQualifiedStr = Objects.nonNull(isQualified) ? isQualified.name() : null; + + wrapper .like(StringUtils.isNotBlank(companyName), ExamRecordDetail::getCompanyName, companyName) + .like(StringUtils.isNotBlank(driverName), ExamRecordDetail::getDriverName, driverName) + .eq(StringUtils.isNotBlank(isQualifiedStr), ExamRecordDetail::getExamResult, isQualifiedStr) + .gt(Objects.nonNull(startTime), ExamRecordDetail::getExamTime, startTime) + .lt(Objects.nonNull(endTime), ExamRecordDetail::getExamTime, endTime) + .orderByDesc(ExamRecordDetail::getExamTime); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/TrainingBonusRecordManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/TrainingBonusRecordManage.java new file mode 100644 index 0000000..da8eae1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/TrainingBonusRecordManage.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.manage; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * @author liuxinxin + * @date 2022/10/31 上午10:25 + */ +@Component +@RequiredArgsConstructor +public class TrainingBonusRecordManage { + + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/TrainingMaterialManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/TrainingMaterialManage.java new file mode 100644 index 0000000..06e1222 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/TrainingMaterialManage.java @@ -0,0 +1,241 @@ +package com.ningdatech.carapi.driver.manage; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.driver.constant.MaterialStatusEnum; +import com.ningdatech.carapi.driver.constant.MaterialTypeEnum; +import com.ningdatech.carapi.driver.constants.DriverConstant; +import com.ningdatech.carapi.driver.entity.TrainingMaterial; +import com.ningdatech.carapi.driver.entity.TrainingOrganizationMaterial; +import com.ningdatech.carapi.driver.model.po.ReqSaveTrainingMaterialPO; +import com.ningdatech.carapi.driver.model.po.ReqTrainingMaterialListPO; +import com.ningdatech.carapi.driver.model.vo.ResSaveTrainingMaterialVO; +import com.ningdatech.carapi.driver.model.vo.ResTrainingMaterialListVO; +import com.ningdatech.carapi.driver.model.vo.ResTrainingMaterialVO; +import com.ningdatech.carapi.driver.service.ITrainingMaterialService; +import com.ningdatech.carapi.driver.service.ITrainingOrganizationMaterialService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import lombok.RequiredArgsConstructor; + +/** + * @author liuxinxin + * @date 2022/10/9 下午3:32 + */ +@Component +@RequiredArgsConstructor +public class TrainingMaterialManage { + + private final ITrainingMaterialService iTrainingMaterialService; + private final RegionsCacheHelper regionsCacheHelper; + private final ITrainingOrganizationMaterialService iTrainingOrganizationMaterialService; + + public PageVo trainingMaterialsList(ReqTrainingMaterialListPO request) { + Integer pageNumber = request.getPageNumber(); + Integer pageSize = request.getPageSize(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(TrainingMaterial.class); + + buildTrainingMaterialsQuery(wrapper, request); + Page page = iTrainingMaterialService.page(new Page<>(pageNumber, pageSize),wrapper); + + PageVo pageVo = new PageVo<>(); + long total = page.getTotal(); + pageVo.setTotal(total); + if (total == 0) { + return pageVo; + } + // 装配培训材料列表VO 下载文件通过文件id 下载 + List records = page.getRecords(); + List resVOList = records.stream().map(r -> { + ResTrainingMaterialListVO resVO = new ResTrainingMaterialListVO(); + resVO.setTrainingMaterialId(r.getId()); + resVO.setTitle(r.getTitle()); + resVO.setMaterialType(MaterialTypeEnum.valueOf(r.getMaterialType())); + if (Objects.nonNull(r.getRegionId())) { + resVO.setRegionId(r.getRegionId()); + resVO.setRegionName(regionsCacheHelper.getDisplayName(r.getRegionId())); + }else { + resVO.setRegionId(DefValConstants.ZJREGION_ID); + resVO.setRegionName(regionsCacheHelper.getDisplayName(DefValConstants.ZJREGION_ID)); + } + resVO.setMaterialStatus(MaterialStatusEnum.valueOf(r.getMaterialStatus())); + resVO.setCreateTime(r.getCreateOn()); + resVO.setContent(r.getContent()); + List appendixList = Lists.newArrayList(); + String appendix = r.getAppendixListJson(); + if (StringUtils.isNotBlank(appendix)) { + List array = JSON.parseArray(appendix, String.class); + if (CollUtil.isNotEmpty(array)) { + for (String fileInfo : array) { + JSONObject jsonObject = JSON.parseObject(fileInfo, JSONObject.class); + FileBasicInfo basicInfo = new FileBasicInfo(); + Long fileId = jsonObject.getLong(DriverConstant.FILE_ID); + String fileName = jsonObject.getString(DriverConstant.FILE_NAME); + basicInfo.setFileId(fileId); + basicInfo.setFileName(fileName); + appendixList.add(basicInfo); + } + resVO.setAppendixList(appendixList); + } + } + return resVO; + }).collect(Collectors.toList()); + pageVo.setRecords(resVOList); + return pageVo; + } + + //@LambdaDataScope + private void buildTrainingMaterialsQuery(LambdaQueryWrapper wrapper, ReqTrainingMaterialListPO request) { + // 获取入参 + String title = request.getTitle(); + MaterialTypeEnum materialType = request.getMaterialType(); + Long regionId = request.getRegionId(); + // 入参转换查询参数 + List regionIdList = new ArrayList<>(); + if (Objects.nonNull(regionId)) { + regionIdList = regionsCacheHelper.listChildRegionId(regionId); + } + String materialTypeStr = null; + if (Objects.nonNull(materialType)) { + materialTypeStr = materialType.name(); + } + wrapper.like(StringUtils.isNotBlank(title), TrainingMaterial::getTitle, title) + .in(CollectionUtil.isNotEmpty(regionIdList), TrainingMaterial::getRegionId, regionId) + .eq(StringUtils.isNotBlank(materialTypeStr), TrainingMaterial::getMaterialType, materialTypeStr) + .orderByDesc(TrainingMaterial::getUpdateOn); + } + + public ResSaveTrainingMaterialVO createTrainingMaterial(ReqSaveTrainingMaterialPO request) { + // 获取入参 + List appendixList = request.getAppendixList(); + String title = request.getTitle(); + MaterialStatusEnum materialStatus = request.getMaterialStatus(); + MaterialTypeEnum materialType = request.getMaterialType(); + String content = request.getContent(); + + // 获取登陆者信息 + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + + // 装配培训材料 + TrainingMaterial saveRecord = new TrainingMaterial(); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setCreateBy(loginUser.getUserId()); + saveRecord.setTitle(title); + saveRecord.setContent(content); + saveRecord.setMaterialType(materialType.name()); + saveRecord.setMaterialStatus(materialStatus.name()); + saveRecord.setAppendixListJson(JSONObject.toJSONString(appendixList)); + saveRecord.setRegionId(loginUser.getRegionId()); + saveRecord.setCompanyId(loginUser.getCompanyId()); + iTrainingMaterialService.save(saveRecord); + + ResSaveTrainingMaterialVO resSaveTrainingMaterialVO = new ResSaveTrainingMaterialVO(); + resSaveTrainingMaterialVO.setTrainingMaterialId(saveRecord.getId()); + return resSaveTrainingMaterialVO; + } + + public ResSaveTrainingMaterialVO saveTrainingMaterial(ReqSaveTrainingMaterialPO request) { + // 获取入参 + List appendixList = request.getAppendixList(); + String title = request.getTitle(); + MaterialStatusEnum materialStatus = request.getMaterialStatus(); + MaterialTypeEnum materialType = request.getMaterialType(); + String content = request.getContent(); + Long trainingMaterialId = request.getId(); + + if (Objects.isNull(trainingMaterialId)) { + // 获取登陆者信息 + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + + // 装配培训材料 + TrainingMaterial saveRecord = new TrainingMaterial(); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setCreateBy(loginUser.getUserId()); + saveRecord.setTitle(title); + saveRecord.setContent(content); + saveRecord.setMaterialType(materialType.name()); + saveRecord.setMaterialStatus(materialStatus.name()); + saveRecord.setAppendixListJson(JSONObject.toJSONString(appendixList)); + saveRecord.setRegionId(loginUser.getRegionId()); + saveRecord.setCompanyId(loginUser.getCompanyId()); + iTrainingMaterialService.save(saveRecord); + + trainingMaterialId = saveRecord.getId(); + } else { + TrainingMaterial trainingMaterial = iTrainingMaterialService.getById(trainingMaterialId); + if (Objects.isNull(trainingMaterial)) { + throw new BizException("培训材料不存在"); + } + + trainingMaterial.setUpdateOn(LocalDateTime.now()); + trainingMaterial.setTitle(title); + trainingMaterial.setContent(content); + trainingMaterial.setMaterialType(materialType.name()); + trainingMaterial.setMaterialStatus(materialStatus.name()); + trainingMaterial.setAppendixListJson(JSONObject.toJSONString(appendixList)); + iTrainingMaterialService.saveOrUpdate(trainingMaterial); + } + + ResSaveTrainingMaterialVO resSaveTrainingMaterialVO = new ResSaveTrainingMaterialVO(); + resSaveTrainingMaterialVO.setTrainingMaterialId(trainingMaterialId); + return resSaveTrainingMaterialVO; + } + + public ResTrainingMaterialVO getTrainingMaterialDetail(Long trainingMaterialId) { + TrainingMaterial trainingMaterial = iTrainingMaterialService.getById(trainingMaterialId); + if (Objects.isNull(trainingMaterial)) { + throw new BizException("培训材料不存在"); + } + + ResTrainingMaterialVO resTrainingMaterialVO = new ResTrainingMaterialVO(); + resTrainingMaterialVO.setId(trainingMaterial.getId()); + resTrainingMaterialVO.setTitle(trainingMaterial.getTitle()); + resTrainingMaterialVO.setContent(trainingMaterial.getContent()); + if (StringUtils.isNotBlank(trainingMaterial.getMaterialStatus())) { + resTrainingMaterialVO.setMaterialStatus(MaterialStatusEnum.valueOf(trainingMaterial.getMaterialStatus())); + } + if (StringUtils.isNotBlank(trainingMaterial.getMaterialType())) { + resTrainingMaterialVO.setMaterialType(MaterialTypeEnum.valueOf(trainingMaterial.getMaterialType())); + } + if (StringUtils.isNotBlank(trainingMaterial.getAppendixListJson())) { + resTrainingMaterialVO.setAppendixList(JSONObject.parseArray(trainingMaterial.getAppendixListJson(), FileBasicInfo.class)); + } + return resTrainingMaterialVO; + } + + @Transactional(rollbackFor = Exception.class) + public void removeTrainingMaterial(Long trainingMaterialId) { + List trainingOrganizationMaterialList = iTrainingOrganizationMaterialService.list( + Wrappers.lambdaQuery(TrainingOrganizationMaterial.class) + .eq(TrainingOrganizationMaterial::getTrainingMaterialId, trainingMaterialId)); + if (CollectionUtil.isEmpty(trainingOrganizationMaterialList)) { + iTrainingMaterialService.removeById(trainingMaterialId); + } else { + throw new BizException("当前材料有培训组织正在使用,无法删除"); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/TrainingOrganizationManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/TrainingOrganizationManage.java new file mode 100644 index 0000000..3d4072d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/manage/TrainingOrganizationManage.java @@ -0,0 +1,1582 @@ +package com.ningdatech.carapi.driver.manage; + +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.Month; +import java.util.*; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.fastjson.JSONObject; +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.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.archives.entity.ExamPaper; +import com.ningdatech.carapi.archives.entity.ExamPaperQuestion; +import com.ningdatech.carapi.archives.entity.PaperQuestion; +import com.ningdatech.carapi.archives.enums.DriverRelationConstant; +import com.ningdatech.carapi.archives.enums.ExamPaperQualifiedScoreConstant; +import com.ningdatech.carapi.archives.enums.IsRandomEnum; +import com.ningdatech.carapi.archives.enums.PaperQuestionStatusEnum; +import com.ningdatech.carapi.archives.manage.ExaminationPaperManage; +import com.ningdatech.carapi.archives.model.ExamRuleInfo; +import com.ningdatech.carapi.archives.model.po.ReqExamRulePO; +import com.ningdatech.carapi.archives.model.po.ReqSaveExamPaperPO; +import com.ningdatech.carapi.archives.model.vo.ResExamRuleVO; +import com.ningdatech.carapi.archives.service.IExamPaperQuestionService; +import com.ningdatech.carapi.archives.service.IExamPaperService; +import com.ningdatech.carapi.archives.service.IPaperQuestionService; +import com.ningdatech.carapi.common.constant.GenderEnum; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.common.helper.UserInfoHelper; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.driver.assembler.TrainingAssembler; +import com.ningdatech.carapi.driver.constant.*; +import com.ningdatech.carapi.driver.constants.DriverConstant; +import com.ningdatech.carapi.driver.entity.*; +import com.ningdatech.carapi.driver.helper.DriverBehaviorScoreHelper; +import com.ningdatech.carapi.driver.helper.DriverInfoHelper; +import com.ningdatech.carapi.driver.model.*; +import com.ningdatech.carapi.driver.model.bo.CodingRuleBO; +import com.ningdatech.carapi.driver.model.dto.TrainerInfoExportDTO; +import com.ningdatech.carapi.driver.model.po.*; +import com.ningdatech.carapi.driver.model.query.TrainingOrgTrainersQuery; +import com.ningdatech.carapi.driver.model.vo.*; +import com.ningdatech.carapi.driver.service.*; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.entity.enumeration.CodingRuleBehaviorTypeEnum; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.user.model.vo.UserBasicInfoVO; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.RandomUtil; +import lombok.RequiredArgsConstructor; + +/** + * @author liuxinxin + * @date 2022/10/10 上午10:00 + */ +@Component +@RequiredArgsConstructor +public class TrainingOrganizationManage { + private final ITrainingOrganizationService iTrainingOrganizationService; + private final RegionsCacheHelper regionsCacheHelper; + private final ITrainingOrganizationMaterialService iTrainingOrganizationMaterialService; + private final ITrainingOrganizationTrainerService iTrainingOrganizationTrainerService; + private final CompanyService companyService; + private final IDriverInfoService driverInfoService; + private final UserInfoHelper userInfoHelper; + private final ITrainingMaterialService iTrainingMaterialService; + private final IExamRecordService iExamRecordService; + private final IExamRecordDetailService iExamRecordDetailService; + private final IDriverScoreInfoService iDriverScoreInfoService; + private final IDriverScoreRecordService iDriverScoreRecordService; + private final DriverBehaviorScoreHelper driverBehaviorScoreHelper; + private final DriverInfoHelper driverInfoHelper; + private final IStarManageService starManageService; + private final ITrainingOrganizationTrainerService trainingOrganizationTrainerService; + private final IDriverInfoService iDriverInfoService; + private final ExaminationPaperManage examinationPaperManage; + private final IPaperQuestionService iPaperQuestionService; + private final IExamPaperQuestionService iExamPaperQuestionService; + private final IExamPaperService iExamPaperService; + private final ICertificateService certificateService; + + + public PageVo trainingOrganizationList(ReqTrainingOrganizationListPO request) { + Integer pageNumber = request.getPageNumber(); + Integer pageSize = request.getPageSize(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(TrainingOrganization.class); + TrainingOrganizationManage context = (TrainingOrganizationManage) AopContext.currentProxy(); + context.buildQuery(wrapper, request); + Page page = iTrainingOrganizationService.page(new Page<>(pageNumber, pageSize), wrapper); + + PageVo pageVo = new PageVo<>(); + long total = page.getTotal(); + pageVo.setTotal(total); + if (total == 0) { + return pageVo; + } + List records = page.getRecords(); + // 获取培训组织关联的试卷信息 + List examPaperIds = records.stream().map(TrainingOrganization::getExamPaperId).collect(Collectors.toList()); + Map examPaperMap = iExamPaperService.list(Wrappers.lambdaQuery(ExamPaper.class) + .in(ExamPaper::getId, examPaperIds)).stream() + .collect(Collectors.toMap(ExamPaper::getId, e -> e)); + + List resVoList = records.stream().map(r -> { + ResTrainingOrganizationListVO resVO = new ResTrainingOrganizationListVO(); + Long trainingOrganizationId = r.getId(); + resVO.setTrainingOrganizationId(trainingOrganizationId); + resVO.setTrainingTopic(r.getTrainingTopic()); + resVO.setAddress(r.getAddress()); + resVO.setTrainingStartTime(r.getTrainingStartTime()); + resVO.setTrainingEndTime(r.getTrainingEndTime()); + Long trainingOrganizationRegionId = r.getRegionId(); + if (Objects.nonNull(trainingOrganizationRegionId)) { + resVO.setRegionId(trainingOrganizationRegionId); + resVO.setRegionName(regionsCacheHelper.getDisplayName(trainingOrganizationRegionId)); + } + resVO.setCreateTime(r.getCreateOn()); + if (Objects.nonNull(r.getTrainingMode())) { + resVO.setTrainingMode(TrainingModeEnum.valueOf(r.getTrainingMode())); + } + if (Objects.nonNull(r.getTrainingStatus())) { + resVO.setTrainingStatus(TrainingStatusEnum.valueOf(r.getTrainingStatus())); + } + List examPaperIdList = Lists.newArrayList(); + List examPaperNameList = Lists.newArrayList(); + // 判断培训组织关联的试卷信息是否是随机试卷 + if (DefValConstants.RANDOM_EXAM_PAPER_ID.equals(r.getExamPaperId()) && + StringUtils.isNotBlank(r.getRandomExamPaperId())){ + // 是随机试卷,返回随机试卷信息 + List idList = Arrays.stream(r.getRandomExamPaperId().split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + examPaperIdList.addAll(idList); + List nameList = Arrays.stream(r.getExamPaperName().split(StrPool.COMMA)).collect(Collectors.toList()); + examPaperNameList.addAll(nameList); + }else { + examPaperIdList.add(r.getExamPaperId()); + examPaperNameList.add(r.getExamPaperName()); + } + resVO.setExamPaperId(examPaperIdList); + resVO.setExamPaperName(examPaperNameList); + // 是线上考试且考试未开始要可以设置考试时间 + String trainingMode = r.getTrainingMode(); + if (TrainingModeEnum.online.name().equals(trainingMode)){ + LocalDateTime examStartTime = r.getExamStartTime(); + if (Objects.isNull(examStartTime) || LocalDateTime.now().compareTo(examStartTime) < 0){ + resVO.setCanSetExamTime(Boolean.TRUE); + } + } + resVO.setExamStartTime(r.getExamStartTime()); + resVO.setExamEndTime(r.getExamEndTime()); + return resVO; + }).collect(Collectors.toList()); + pageVo.setRecords(resVoList); + return pageVo; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ONLY_REGION) + public void buildQuery(LambdaQueryWrapper wrapper, ReqTrainingOrganizationListPO request) { + // 获取入参 + String address = request.getAddress(); + String trainingTopic = request.getTrainingTopic(); + Long regionId = request.getRegionId(); + TrainingModeEnum trainingMode = request.getTrainingMode(); + // 转换参数 + String trainingModeStr = Objects.nonNull(trainingMode) ? trainingMode.name() : null; + List regionIdList = new ArrayList<>(); + if (Objects.nonNull(regionId)) { + regionIdList = regionsCacheHelper.listChildRegionId(regionId); + } + List trainingTypeList = request.getTrainingTypeList(); + wrapper.in(CollectionUtil.isNotEmpty(regionIdList), TrainingOrganization::getRegionId, regionIdList) + .eq(StringUtils.isNotBlank(trainingModeStr), TrainingOrganization::getTrainingMode, trainingModeStr) + .like(StringUtils.isNotBlank(address), TrainingOrganization::getAddress, address) + .eq(StringUtils.isNotBlank(trainingTopic), TrainingOrganization::getTrainingTopic, trainingTopic) + .in(CollectionUtil.isNotEmpty(trainingTypeList), TrainingOrganization::getTrainingType, trainingTypeList) + .orderByDesc(TrainingOrganization::getCreateOn); + } + + public ResTrainingOrganizationDetailVO trainingOrganizationDetail(Long organizationId) { + + UserBasicInfoVO userFullInfo = userInfoHelper.getUserFullInfo(); + Long roleId = userFullInfo.getRoleId(); + Long userId = userFullInfo.getUserId(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(TrainingOrganization.class); + TrainingOrganizationManage context = (TrainingOrganizationManage) AopContext.currentProxy(); + context.buildTrainingOrganizationQuery(wrapper, organizationId); + TrainingOrganization trainingOrganization = iTrainingOrganizationService.getOne(wrapper); + //TrainingOrganization trainingOrganization = iTrainingOrganizationService.getById(organizationId); + if (Objects.isNull(trainingOrganization)) { + throw new BizException("培训组织不存在"); + } + // 装配培训基本信息 + TrainingBasicInfo trainingBasicInfo = TrainingAssembler.buildTrainingBasicInfo(trainingOrganization); + + // 装配培训资料 + List trainingOrganizationMaterialList = iTrainingOrganizationMaterialService + .list(Wrappers.lambdaQuery(TrainingOrganizationMaterial.class) + .eq(TrainingOrganizationMaterial::getTrainingOrganizationId, organizationId)); + List materialIdList = trainingOrganizationMaterialList.stream() + .map(TrainingOrganizationMaterial::getTrainingMaterialId).collect(Collectors.toList()); + List materialList = iTrainingMaterialService.list(Wrappers.lambdaQuery(TrainingMaterial.class) + .in(TrainingMaterial::getId, materialIdList)); + TrainingMaterialOverviewInfo trainingMaterialOverviewInfo = TrainingAssembler.buildTrainingMaterialOverviewInfo(materialList); + + // 装配试卷 + TrainingExamPaperInfo trainingExamPaperInfo = new TrainingExamPaperInfo(); + Long examPaperId = trainingOrganization.getExamPaperId(); + trainingExamPaperInfo.setExamPaperId(examPaperId); + // 如果是随机试卷且登录用户是驾驶员 + if (DefValConstants.RANDOM_EXAM_PAPER_ID.equals(examPaperId)){ + // 随机试卷 + trainingExamPaperInfo.setExamPaperName(DefValConstants.RANDOM_PAPER); + if (UserRoleTypeEnum.DRIVER_ROLE_ID.getId().equals(roleId)){ + ExamPaper examPaper = iExamPaperService.getOne(Wrappers.lambdaQuery(ExamPaper.class) + .eq(ExamPaper::getTrainingOrganizationId, organizationId) + .eq(ExamPaper::getDriverUserId, userId)); + if (Objects.isNull(examPaper)){ + throw new BizException("未获取到随机试卷!"); + } + trainingExamPaperInfo.setExamPaperName(examPaper.getExamPaperName()); + trainingExamPaperInfo.setExamPaperId(examPaper.getId()); + } + } else { + trainingExamPaperInfo.setExamPaperName(trainingOrganization.getExamPaperName()); + } + + // 装配培训人员信息 + List trainerList = iTrainingOrganizationTrainerService + .list(Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(TrainingOrganizationTrainer::getTrainingOrganizationId, organizationId)); + + List trainersInfoList = trainerList.stream() + .map(TrainingAssembler::buildOrganizationTrainingTrainersInfo).collect(Collectors.toList()); + + ResTrainingOrganizationDetailVO resVO = new ResTrainingOrganizationDetailVO(); + resVO.setTrainingBasicInfo(trainingBasicInfo); + resVO.setTrainingExamPaperInfo(trainingExamPaperInfo); + resVO.setTrainingMaterialOverviewInfo(trainingMaterialOverviewInfo); + resVO.setTrainingTrainersInfoList(trainersInfoList); + return resVO; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ONLY_REGION) + public void buildTrainingOrganizationQuery(LambdaQueryWrapper wrapper, Long organizationId) { + wrapper.eq(TrainingOrganization::getId,organizationId); + } + + /** + * 新建培训组织(新接口) + * + * @param request + * @return + */ + @Transactional(rollbackFor = Exception.class) + public ResCreateTrainingOrgVO createTrainingOrganization(ReqCreateTrainingOrgPO request) { + // 获取入参信息 + TrainingBasicInfo trainingBasicInfo = request.getTrainingBasicInfo(); + String trainingType = trainingBasicInfo.getTrainingType().name(); + TrainingExamPaperInfo trainingExamPaperInfo = request.getTrainingExamPaperInfo(); + List trainingTrainersInfoList = request.getTrainingTrainersInfoList(); + TrainingMaterialOverviewInfo trainingMaterialOverviewInfo = request.getTrainingMaterialOverviewInfo(); + + // 获取登陆账号信息 + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + Long loginUserId = loginUser.getUserId(); + // 获取登陆者的 regionId + Long regionId = userInfoHelper.getUserRegionId(); + + // 保存培训基础信息 考试试卷 + TrainingOrganization saveRecord = assemblerTrainingOrganization(trainingBasicInfo, trainingExamPaperInfo, trainingTrainersInfoList, null); + saveRecord.setCreateBy(loginUserId); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setRegionId(regionId); + iTrainingOrganizationService.save(saveRecord); + ResCreateTrainingOrgVO resCreateTrainingOrgVO = new ResCreateTrainingOrgVO(); + resCreateTrainingOrgVO.setTrainingOrganizationId(saveRecord.getId()); + + // 如果是随机试卷 保存生成的随机试卷与培训组织的关联 + if (DefValConstants.RANDOM_EXAM_PAPER_ID.equals(saveRecord.getExamPaperId()) && + StringUtils.isNotBlank(saveRecord.getRandomExamPaperId())){ + List idList = Arrays.stream(saveRecord.getRandomExamPaperId().split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + List examPapers = iExamPaperService.list(Wrappers.lambdaQuery(ExamPaper.class).in(ExamPaper::getId, idList)); + List examPaperList = examPapers.stream().peek(e -> e.setTrainingOrganizationId(saveRecord.getId())).collect(Collectors.toList()); + iExamPaperService.updateBatchById(examPaperList); + } + + // 保存培训资料 + // TODO 校验材料列表 + List allList = trainingMaterialOverviewInfo.getAllList(); + List materialSaveRecordList = new ArrayList<>(); + for (TrainingMaterialInfo trainingMaterialInfo : allList) { + TrainingOrganizationMaterial materialSaveRecord = new TrainingOrganizationMaterial(); + materialSaveRecord.setCreateBy(loginUserId); + materialSaveRecord.setCreateOn(LocalDateTime.now()); + materialSaveRecord.setUpdateOn(LocalDateTime.now()); + materialSaveRecord.setMaterialType(trainingMaterialInfo.getMaterialType().name()); + materialSaveRecord.setTrainingMaterialId(trainingMaterialInfo.getTrainingMaterialId()); + materialSaveRecord.setTrainingOrganizationId(saveRecord.getId()); + materialSaveRecordList.add(materialSaveRecord); + } + iTrainingOrganizationMaterialService.saveBatch(materialSaveRecordList); + + if (CollectionUtil.isNotEmpty(trainingTrainersInfoList)) { + + // 根据培训类型,将选择的培训人员设置为不能参加该类型的培训,直至上传合格证培训完成,再次更新 + List driverIds = trainingTrainersInfoList.stream().map(TrainingTrainersInfo::getDriverId).collect(Collectors.toList()); + List driverInfos = driverInfoService.listByIds(driverIds); + for (DriverInfo driverInfo : driverInfos) { + if (TrainingTypeEnum.forensic_registration_training.name().equals(trainingType)){ + driverInfo.setDriverRegistrationFlag(TrainingRegistrationFlagEnum.CAN_NOT_TAKE.getCode()); + } else if (TrainingTypeEnum.continuing_education_training.name().equals(trainingType)) { + driverInfo.setContinuingEducationFlag(TrainingRegistrationFlagEnum.CAN_NOT_TAKE.getCode()); + } else if (TrainingTypeEnum.replacement_registration_training.name().equals(trainingType)) { + driverInfo.setReplacementRegistrationFlag(TrainingRegistrationFlagEnum.CAN_NOT_TAKE.getCode()); + } + // 更新驾驶员是否可以参见培训报名标志 + driverInfo.setUpdateOn(LocalDateTime.now()); + driverInfoService.updateById(driverInfo); + } + List distinctTrainingTrainersInfoList = new ArrayList<>(); + HashSet driverIdSet = new HashSet<>(); + for (TrainingTrainersInfo trainingTrainersInfo : trainingTrainersInfoList) { + if (driverIdSet.add(trainingTrainersInfo.getDriverId())) { + distinctTrainingTrainersInfoList.add(trainingTrainersInfo); + } + } + + // 保存培训人员 + List companyIdList = distinctTrainingTrainersInfoList.stream().map(TrainingTrainersInfo::getCompanyId).collect(Collectors.toList()); + List driverIdList = distinctTrainingTrainersInfoList.stream().map(TrainingTrainersInfo::getDriverId).collect(Collectors.toList()); + + Map companyMap = companyService.listCompanyByIds(companyIdList); + Map driverInfoMap = driverInfoService.listDriverInfoByIds(driverIdList); + List trainerSaveRecordList = + assemblerTrainingOrganizationTrainerList(distinctTrainingTrainersInfoList, driverInfoMap, companyMap, saveRecord.getId() + , trainingExamPaperInfo.getExamPaperId(), trainingExamPaperInfo.getExamPaperName(),trainingBasicInfo,saveRecord); + iTrainingOrganizationTrainerService.saveBatch(trainerSaveRecordList); + } + + // 新建考试记录 + ExamRecord examRecordSaveRecord = assemblerSaveExamRecord(LoginUserUtil.getUserId() + , request.getTrainingExamPaperInfo().getExamPaperId(), saveRecord.getId() + , trainingBasicInfo.getTrainingType().name()); + iExamRecordService.save(examRecordSaveRecord); + return resCreateTrainingOrgVO; + } + + /** + * 装配考试记录列表 + * + * @return + */ + private ExamRecord assemblerSaveExamRecord(Long createBy, Long examPaperId + , Long trainingOrganizationId, String examType) { + ExamRecord saveRecord = new ExamRecord(); + saveRecord.setCreateBy(createBy); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setExamPaperId(examPaperId); + saveRecord.setTrainingOrganizationId(trainingOrganizationId); + saveRecord.setExamType(examType); + return saveRecord; + } + + + /** + * 装配新的培训组织驾驶员列表 SaveRecordList + */ + private List assemblerTrainingOrganizationTrainerList(List trainingTrainersInfoList + , Map driverInfoMap, Map companyMap + , Long trainingOrganizationId, Long examPaperId, String examPaperName, TrainingBasicInfo trainingBasicInfo, TrainingOrganization saveRecord) { + List trainerSaveRecordList = new ArrayList<>(); + Map examPaperMap = iExamPaperService.list(Wrappers.lambdaQuery(ExamPaper.class) + .eq(ExamPaper::getTrainingOrganizationId,saveRecord.getId()) + .select(ExamPaper::getId, ExamPaper::getExamPaperName)) + .stream().collect(Collectors.toMap(ExamPaper::getExamPaperName, e -> e)); + for (TrainingTrainersInfo trainersInfo : trainingTrainersInfoList) { + DriverInfo driverInfo = driverInfoMap.get(trainersInfo.getDriverId()); + Company company = companyMap.get(driverInfo.getCompanyId()); + + TrainingOrganizationTrainer trainerSaveRecord = new TrainingOrganizationTrainer(); + trainerSaveRecord.setCreateOn(LocalDateTime.now()); + trainerSaveRecord.setUpdateOn(LocalDateTime.now()); + trainerSaveRecord.setTrainingOrganizationId(trainingOrganizationId); + trainerSaveRecord.setDriverName(driverInfo.getDriverName()); + trainerSaveRecord.setDriverUserId(driverInfo.getUserId()); + trainerSaveRecord.setDriverId(driverInfo.getId()); + // 如果是随机试卷 + String trainingTopic = trainingBasicInfo.getTrainingTopic(); + if (DefValConstants.RANDOM_PAPER.equals(examPaperName)){ + String randomExamPaperName = trainingTopic + StrPool.DASH + trainersInfo.getDriverName() + + StrPool.DASH + DefValConstants.RANDOM_PAPER; + trainerSaveRecord.setExamPaperName(randomExamPaperName); + ExamPaper examPaper = examPaperMap.get(randomExamPaperName); + if (Objects.nonNull(examPaper)) { + trainerSaveRecord.setExamPaperId(examPaper.getId()); + } + }else { + trainerSaveRecord.setExamPaperId(examPaperId); + trainerSaveRecord.setExamPaperName(examPaperName); + } + trainerSaveRecord.setExamRegistrationNo(generateExamRegistrationNo()); + trainerSaveRecord.setExaminationStatus(ExaminationStatusEnum.waiting_examination.name()); + trainerSaveRecord.setCompanyId(company.getId()); + trainerSaveRecord.setCompanyName(company.getName()); + trainerSaveRecordList.add(trainerSaveRecord); + } + return trainerSaveRecordList; + } + + /** + * 保存培训组织(新接口) + * + * @param request + * @return + */ + @Transactional(rollbackFor = Exception.class) + public ResCreateTrainingOrgVO saveTrainingOrganization(ReqCreateTrainingOrgPO request) { + Long organizationId = request.getOrganizationId(); + TrainingExamPaperInfo trainingExamPaperInfo = request.getTrainingExamPaperInfo(); + if (Objects.isNull( trainingExamPaperInfo.getExamPaperName())){ + throw new BizException("请选择考试试卷!"); + } + + if (Objects.isNull(organizationId)) { + return createTrainingOrganization(request); + } else { + return updateTrainingOrganization(request); + } + } + + @Transactional(rollbackFor = Exception.class) + public ResCreateTrainingOrgVO updateTrainingOrganization(ReqCreateTrainingOrgPO request) { + // 获取入参信息 + Long organizationId = request.getOrganizationId(); + TrainingBasicInfo trainingBasicInfo = request.getTrainingBasicInfo(); + String trainingType = trainingBasicInfo.getTrainingType().name(); + TrainingExamPaperInfo trainingExamPaperInfo = request.getTrainingExamPaperInfo(); + List trainingTrainersInfoList = request.getTrainingTrainersInfoList(); + TrainingMaterialOverviewInfo trainingMaterialOverviewInfo = request.getTrainingMaterialOverviewInfo(); + + // 获取登陆账号信息 + Long loginUserId = LoginUserUtil.getUserId(); + // 获取登陆者的 regionId + Long regionId = userInfoHelper.getUserRegionId(); + + TrainingOrganization currentTrainingOrganization = iTrainingOrganizationService.getById(organizationId); + if (Objects.isNull(currentTrainingOrganization)) { + throw new BizException("培训组织不存在"); + } + + // 保存培训基础信息 考试试卷 + TrainingOrganization updateRecord = assemblerTrainingOrganization(trainingBasicInfo, trainingExamPaperInfo, trainingTrainersInfoList,organizationId); + updateRecord.setId(organizationId); + iTrainingOrganizationService.updateById(updateRecord); + ResCreateTrainingOrgVO resCreateTrainingOrgVO = new ResCreateTrainingOrgVO(); + resCreateTrainingOrgVO.setTrainingOrganizationId(updateRecord.getId()); + + // 如果是随机试卷 保存生成的随机试卷与培训组织的关联 + if (DefValConstants.RANDOM_EXAM_PAPER_ID.equals(updateRecord.getExamPaperId()) && + StringUtils.isNotBlank(updateRecord.getRandomExamPaperId())){ + List idList = Arrays.stream(updateRecord.getRandomExamPaperId().split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + List examPapers = iExamPaperService.list(Wrappers.lambdaQuery(ExamPaper.class).in(ExamPaper::getId, idList)); + List examPaperList = examPapers.stream().peek(e -> e.setTrainingOrganizationId(updateRecord.getId())).collect(Collectors.toList()); + iExamPaperService.updateBatchById(examPaperList); + } + + // 保存培训资料 先删除后新增 + // TODO 校验材料列表 + iTrainingOrganizationMaterialService.remove(Wrappers.lambdaQuery(TrainingOrganizationMaterial.class) + .eq(TrainingOrganizationMaterial::getTrainingOrganizationId, organizationId)); + List allList = trainingMaterialOverviewInfo.getAllList(); + List materialSaveRecordList = new ArrayList<>(); + for (TrainingMaterialInfo trainingMaterialInfo : allList) { + TrainingOrganizationMaterial materialSaveRecord = new TrainingOrganizationMaterial(); + materialSaveRecord.setCreateBy(loginUserId); + materialSaveRecord.setCreateOn(LocalDateTime.now()); + materialSaveRecord.setUpdateOn(LocalDateTime.now()); + materialSaveRecord.setMaterialType(trainingMaterialInfo.getMaterialType().name()); + materialSaveRecord.setTrainingMaterialId(trainingMaterialInfo.getTrainingMaterialId()); + materialSaveRecord.setTrainingOrganizationId(organizationId); + materialSaveRecordList.add(materialSaveRecord); + } + iTrainingOrganizationMaterialService.saveBatch(materialSaveRecordList); + + + // 获取原来培训组织选择的驾驶员 + List currentTrainingOrganizationTrainerList = iTrainingOrganizationTrainerService + .list(Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(TrainingOrganizationTrainer::getTrainingOrganizationId, organizationId)); + List currentDriverIdList = currentTrainingOrganizationTrainerList.stream() + .map(TrainingOrganizationTrainer::getDriverId) + .collect(Collectors.toList()); + + + if (CollectionUtil.isNotEmpty(trainingTrainersInfoList)) { + List distinctTrainingTrainersInfoList = new ArrayList<>(); + HashSet driverIdSet = new HashSet<>(); + for (TrainingTrainersInfo trainingTrainersInfo : trainingTrainersInfoList) { + if (driverIdSet.add(trainingTrainersInfo.getDriverId())) { + distinctTrainingTrainersInfoList.add(trainingTrainersInfo); + } + } + // 保存培训人员 先删除再新增 + List companyIdList = distinctTrainingTrainersInfoList.stream() + .map(TrainingTrainersInfo::getCompanyId) + .collect(Collectors.toList()); + List driverIdList = distinctTrainingTrainersInfoList.stream() + .map(TrainingTrainersInfo::getDriverId) + .collect(Collectors.toList()); + + List addList = new ArrayList<>(); + List removeList = new ArrayList<>(); + + // 新增列表 + for (Long driverId : driverIdList) { + if (!currentDriverIdList.contains(driverId)) { + addList.add(driverId); + } + } + + // 删除列表 + for (Long driverId : currentDriverIdList) { + if (!driverIdList.contains(driverId)) { + removeList.add(driverId); + } + } + + // 删除培训人员,并将其培训标志更新为可参加对应的培训报名 + if (CollectionUtil.isNotEmpty(removeList)) { + // 移除掉该培训组织删除掉的培训人员 + iTrainingOrganizationTrainerService.remove(Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(TrainingOrganizationTrainer::getTrainingOrganizationId,organizationId) + .in(TrainingOrganizationTrainer::getDriverId, removeList)); + List removeDriverInfos = driverInfoService.listByIds(removeList); + for (DriverInfo driverInfo : removeDriverInfos) { + if (TrainingTypeEnum.forensic_registration_training.name().equals(trainingType)){ + driverInfo.setDriverRegistrationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } else if (TrainingTypeEnum.continuing_education_training.name().equals(trainingType)) { + driverInfo.setContinuingEducationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } else if (TrainingTypeEnum.replacement_registration_training.name().equals(trainingType)) { + driverInfo.setReplacementRegistrationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } + // 更新驾驶员是否可以参见培训报名标志 + driverInfo.setUpdateOn(LocalDateTime.now()); + driverInfoService.updateById(driverInfo); + } + } + + // 新增培训人员 + if (CollectionUtil.isNotEmpty(addList)) { + // 根据培训类型,将新选择的培训人员设置为不能参加该类型的培训,直至上传合格证培训完成,再次更新 + List driverInfos = driverInfoService.listByIds(addList); + for (DriverInfo driverInfo : driverInfos) { + if (TrainingTypeEnum.forensic_registration_training.name().equals(trainingType)){ + driverInfo.setDriverRegistrationFlag(TrainingRegistrationFlagEnum.CAN_NOT_TAKE.getCode()); + } else if (TrainingTypeEnum.continuing_education_training.name().equals(trainingType)) { + driverInfo.setContinuingEducationFlag(TrainingRegistrationFlagEnum.CAN_NOT_TAKE.getCode()); + } else if (TrainingTypeEnum.replacement_registration_training.name().equals(trainingType)) { + driverInfo.setReplacementRegistrationFlag(TrainingRegistrationFlagEnum.CAN_NOT_TAKE.getCode()); + } + // 更新驾驶员是否可以参见培训报名标志 + driverInfo.setUpdateOn(LocalDateTime.now()); + driverInfoService.updateById(driverInfo); + } + + distinctTrainingTrainersInfoList = distinctTrainingTrainersInfoList.stream().filter(r -> addList.contains(r.getDriverId())).collect(Collectors.toList()); + Map idCompanyMap = companyService.listCompanyByIds(companyIdList); + Map idDriverInfoMap = driverInfoService.listDriverInfoByIds(driverIdList); + + List trainerSaveRecordList = new ArrayList<>(); + Long examPaperId = trainingExamPaperInfo.getExamPaperId(); + String examPaperName = trainingExamPaperInfo.getExamPaperName(); + Map examPaperMap = iExamPaperService.list(Wrappers.lambdaQuery(ExamPaper.class) + .eq(ExamPaper::getTrainingOrganizationId,organizationId) + .select(ExamPaper::getId, ExamPaper::getExamPaperName)) + .stream().collect(Collectors.toMap(ExamPaper::getExamPaperName, e -> e)); + for (TrainingTrainersInfo trainersInfo : distinctTrainingTrainersInfoList) { + DriverInfo driverInfo = idDriverInfoMap.get(trainersInfo.getDriverId()); + if (Objects.nonNull(driverInfo)) { + Company company = idCompanyMap.get(driverInfo.getCompanyId()); + TrainingOrganizationTrainer trainerSaveRecord = new TrainingOrganizationTrainer(); + trainerSaveRecord.setCreateOn(LocalDateTime.now()); + trainerSaveRecord.setUpdateOn(LocalDateTime.now()); + trainerSaveRecord.setTrainingOrganizationId(organizationId); + trainerSaveRecord.setDriverName(driverInfo.getDriverName()); + trainerSaveRecord.setDriverUserId(driverInfo.getUserId()); + trainerSaveRecord.setDriverId(driverInfo.getId()); + + // 如果是随机试卷 + String trainingTopic = trainingBasicInfo.getTrainingTopic(); + if (DefValConstants.RANDOM_PAPER.equals(examPaperName)){ + String randomExamPaperName = trainingTopic + StrPool.DASH + trainersInfo.getDriverName() + + StrPool.DASH + DefValConstants.RANDOM_PAPER; + trainerSaveRecord.setExamPaperName(randomExamPaperName); + ExamPaper examPaper = examPaperMap.get(randomExamPaperName); + if (Objects.nonNull(examPaper)) { + trainerSaveRecord.setExamPaperId(examPaper.getId()); + } + }else { + trainerSaveRecord.setExamPaperId(examPaperId); + trainerSaveRecord.setExamPaperName(examPaperName); + } + trainerSaveRecord.setExamRegistrationNo(generateExamRegistrationNo()); + trainerSaveRecord.setExaminationStatus(ExaminationStatusEnum.waiting_examination.name()); + trainerSaveRecord.setCompanyId(company.getId()); + trainerSaveRecord.setCompanyName(company.getName()); + trainerSaveRecordList.add(trainerSaveRecord); + } + } + if (CollectionUtil.isNotEmpty(trainerSaveRecordList)) { + iTrainingOrganizationTrainerService.saveBatch(trainerSaveRecordList); + } + } + // TODO 向所有驾驶员发送短信通知: + // {驾驶员姓名}您好:{散办名称}组织了关于{培训主题}的{培训模式}培训, + // 培训时间为{培训开始 至 结束时间},培训地点为{培训地点:线下培训时显示}, + // 培训链接{生成培训链接,点击后跳转培训页面},请准时参加培训。 + // 联系人:{联系人},联系电话:{联系电话},考证号:{准考证号}。 + for (TrainingTrainersInfo trainingTrainersInfo : trainingTrainersInfoList) { + // 若是线下培训 + String offlineMessage = String.format(DefValConstants.OFFLINE_MESSAGE_TEMPLATE,trainingTrainersInfo.getDriverName() ,"散办名称", "培训主题","培训模式","培训开始时间","培训结束时间","培训地点","培训链接","联系人","联系电话","准考证号"); + // 若是线上培训 + String onlineMessage = String.format(DefValConstants.ONLINE_MESSAGE_TEMPLATE,trainingTrainersInfo.getDriverName() ,"散办名称", "培训主题","培训模式","培训开始时间","培训结束时间","培训链接","联系人","联系电话","准考证号"); + // TODO 调用发短信接口发送短信 + } + } + return resCreateTrainingOrgVO; + } + + + private TrainingOrganization assemblerTrainingOrganization(TrainingBasicInfo trainingBasicInfo, TrainingExamPaperInfo trainingExamPaperInfo, List trainingTrainersInfoList, Long organizationId) { + TrainingOrganization saveRecord = new TrainingOrganization(); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setTrainingTopic(trainingBasicInfo.getTrainingTopic()); + saveRecord.setTrainingStartTime(trainingBasicInfo.getTrainingStartTime()); + saveRecord.setTrainingEndTime(trainingBasicInfo.getTrainingEndTime()); + saveRecord.setAddress(trainingBasicInfo.getAddress()); + if (Objects.nonNull(trainingBasicInfo.getTrainingMode())) { + saveRecord.setTrainingMode(trainingBasicInfo.getTrainingMode().name()); + } + saveRecord.setTrainingType(trainingBasicInfo.getTrainingType().name()); + saveRecord.setContacts(trainingBasicInfo.getContacts()); + saveRecord.setContactNumber(trainingBasicInfo.getContactNumber()); + + String trainingStatus = Objects.nonNull(trainingBasicInfo.getTrainingStatus()) ? trainingBasicInfo.getTrainingStatus().name() : TrainingStatusEnum.enable.name(); + saveRecord.setTrainingStatus(trainingStatus); + saveRecord.setRemark(trainingBasicInfo.getRemark()); + Long examPaperId = trainingExamPaperInfo.getExamPaperId(); + String examPaperName = trainingExamPaperInfo.getExamPaperName(); + // 判断是否为随机试卷 + if (Objects.isNull(examPaperId) && DefValConstants.RANDOM_PAPER.equals(examPaperName)){ + List randomExamPaperList = createRandomPaper(trainingBasicInfo.getTrainingTopic(),trainingTrainersInfoList,organizationId); + String idStr = randomExamPaperList.stream().map(r -> String.valueOf(r.getId())).collect(Collectors.joining(StrPool.COMMA)); + saveRecord.setRandomExamPaperId(idStr); + saveRecord.setExamPaperId(DefValConstants.RANDOM_EXAM_PAPER_ID); + String examNameList = randomExamPaperList.stream().map(ExamPaper::getExamPaperName).collect(Collectors.joining(StrPool.COMMA)); + saveRecord.setExamPaperName(examNameList); + }else { + saveRecord.setExamPaperId(examPaperId); + saveRecord.setExamPaperName(examPaperName); + } + return saveRecord; + } + private List createRandomPaper(String trainTopic, List trainingTrainersInfoList, Long organizationId) { + // 获取当前登录用户所在区域的考试试卷规则 + UserBasicInfoVO userFullInfo = userInfoHelper.getUserFullInfo(); + Long regionId = userFullInfo.getRegionId(); + ReqExamRulePO request = new ReqExamRulePO(); + request.setRegionId(regionId); + ResExamRuleVO examRule = examinationPaperManage.getExamRule(request); + + // 对在当前培训组织内的每个培训人员 + // 根据试卷规则从题库中抽取对应的题目,组成一套试卷 + List resList = Lists.newArrayList(); + List driverUserIdList = trainingTrainersInfoList.stream().map(TrainingTrainersInfo::getDriverUserId).collect(Collectors.toList()); + // 如果培训组织ID不为null 说明为编辑,先删除选择的培训人员所在培训组织已经生成的随机的试卷 + if (Objects.nonNull(organizationId) && CollUtil.isNotEmpty(driverUserIdList)){ + iExamPaperService.remove(Wrappers.lambdaQuery(ExamPaper.class) + .eq(ExamPaper::getTrainingOrganizationId, organizationId) + .eq(ExamPaper::getIsRandom, IsRandomEnum.RANDOM_PAPER.getCode()) + .in(ExamPaper::getDriverUserId, driverUserIdList)); + } + + for (TrainingTrainersInfo trainingTrainersInfo : trainingTrainersInfoList) { + ExamRuleInfo singleChoiceQuestionRule = examRule.getSingleChoiceQuestionRule(); + ExamRuleInfo multipleChoiceQuestionRule = examRule.getMultipleChoiceQuestionRule(); + ExamRuleInfo judgmentalQuestionRule = examRule.getJudgmentalQuestionRule(); + // 单选题 + Integer singleChoiceQuestionCnt = singleChoiceQuestionRule.getQuestionCnt(); + // 从题库中获取所有在使用的单选题 + List singleList = iPaperQuestionService.list(Wrappers.lambdaQuery(PaperQuestion.class) + .eq(PaperQuestion::getQuestionStatus, PaperQuestionStatusEnum.IN_USE.name()) + .eq(PaperQuestion::getQuestionType, QuestionTypeEnum.SINGLE_CHOICE.name())); + // 使用 Collections.synchronizedList() 方法确保多线程安全 + List singleSynchronizedList = Collections.synchronizedList(singleList); + // 从列表中随机抽取指定数量的单选题 + List singleElements = getRandomElements(singleSynchronizedList, singleChoiceQuestionCnt); + + // 多选题 + Integer multipleChoiceQuestionCnt = multipleChoiceQuestionRule.getQuestionCnt(); + // 从题库中获取所有在使用的多选题 + List multipleList = iPaperQuestionService.list(Wrappers.lambdaQuery(PaperQuestion.class) + .eq(PaperQuestion::getQuestionStatus, PaperQuestionStatusEnum.IN_USE.name()) + .eq(PaperQuestion::getQuestionType, QuestionTypeEnum.MULTIPLE_CHOICE.name())); + // 使用 Collections.synchronizedList() 方法确保多线程安全 + List multipleSynchronizedList = Collections.synchronizedList(multipleList); + // 从列表中随机抽取指定数量的多选题 + List multipleElements = getRandomElements(multipleSynchronizedList, multipleChoiceQuestionCnt); + + // 判断题 + Integer judgmentalQuestionCnt = judgmentalQuestionRule.getQuestionCnt(); + // 从题库中获取所有在使用的判断题 + List judgmentalList = iPaperQuestionService.list(Wrappers.lambdaQuery(PaperQuestion.class) + .eq(PaperQuestion::getQuestionStatus, PaperQuestionStatusEnum.IN_USE.name()) + .eq(PaperQuestion::getQuestionType, QuestionTypeEnum.JUDGMENTAL.name())); + // 使用 Collections.synchronizedList() 方法确保多线程安全 + List judgementalSynchronizedList = Collections.synchronizedList(judgmentalList); + // 从列表中随机抽取指定数量的单选题 + List judgmentalElements = getRandomElements(judgementalSynchronizedList, judgmentalQuestionCnt); + + + List examPaperQuestionIdList = new ArrayList<>(); + examPaperQuestionIdList.addAll(singleElements); + examPaperQuestionIdList.addAll(multipleElements); + examPaperQuestionIdList.addAll(judgmentalElements); + + List questionIdList = examPaperQuestionIdList.stream() + .map(ReqSaveExamPaperPO.ExamPaperQuestionIdPO::getPaperQuestionId).collect(Collectors.toList()); + + List paperQuestionList = iPaperQuestionService + .list(Wrappers.lambdaQuery(PaperQuestion.class).in(PaperQuestion::getId, questionIdList)); + Map paperQuestionIdTypeMap = paperQuestionList.stream().collect(Collectors.toMap(PaperQuestion::getId, PaperQuestion::getQuestionType)); + // 保存随机试卷基本信息 + ExamPaper examPaper = new ExamPaper(); + examPaper.setCreateOn(LocalDateTime.now()); + examPaper.setUpdateOn(LocalDateTime.now()); + examPaper.setExamPaperName(trainTopic + StrPool.DASH + trainingTrainersInfo.getDriverName() + + StrPool.DASH + DefValConstants.RANDOM_PAPER); + examPaper.setFullScore(ExamPaperQualifiedScoreConstant.EXAM_PAPER_FULL_SCORE); + examPaper.setQualifiedScore(ExamPaperQualifiedScoreConstant.EXAM_PAPER_QUALIFIED_SCORE); + examPaper.setRegionId(regionId); + examPaper.setExamRuleJson(JSONObject.toJSONString(examRule)); + examPaper.setIsRandom(IsRandomEnum.RANDOM_PAPER.getCode()); + examPaper.setDriverUserId(trainingTrainersInfo.getDriverUserId()); + iExamPaperService.save(examPaper); + + // 保存试卷题目关联关系 + List saveRecordList = new ArrayList<>(); + for (ReqSaveExamPaperPO.ExamPaperQuestionIdPO idPo : examPaperQuestionIdList) { + ExamPaperQuestion examPaperQuestion = new ExamPaperQuestion(); + examPaperQuestion.setExamPaperId(examPaper.getId()); + examPaperQuestion.setPaperQuestionId(idPo.getPaperQuestionId()); + examPaperQuestion.setCreateOn(LocalDateTime.now()); + examPaperQuestion.setUpdateOn(LocalDateTime.now()); + examPaperQuestion.setSortValue(idPo.getSortValue()); + examPaperQuestion.setQuestionType(paperQuestionIdTypeMap.get(idPo.getPaperQuestionId())); + examPaperQuestion.setIsRandom(IsRandomEnum.RANDOM_PAPER.getCode()); + saveRecordList.add(examPaperQuestion); + } + iExamPaperQuestionService.saveBatch(saveRecordList); + + List questionUsageCntUpdateList = examPaperQuestionIdList.stream().map(ReqSaveExamPaperPO.ExamPaperQuestionIdPO::getPaperQuestionId).collect(Collectors.toList()); + for (Long questionId : questionUsageCntUpdateList) { + questionUsageCntUpdate(questionId); + } + resList.add(examPaper); + } + return resList; + } + + public void questionUsageCntUpdate(Long questionId) { + PaperQuestion paperQuestion = iPaperQuestionService.getById(questionId); + if (Objects.isNull(paperQuestion)) { + return; + } else { + long usage = iExamPaperQuestionService.count(Wrappers.lambdaQuery(ExamPaperQuestion.class) + .eq(ExamPaperQuestion::getPaperQuestionId, questionId)); + paperQuestion.setUsageCnt(usage); + iPaperQuestionService.updateById(paperQuestion); + } + } + + private List getRandomElements(List list, Integer count) { + // 使用 Random 对象生成随机索引 + Random random = new Random(); + List randomList = Lists.newArrayList(); + for (int i = 0; i < count; i++) { + int index = random.nextInt(list.size()); + randomList.add(list.get(index)); + } + AtomicLong i = new AtomicLong(1L); + return randomList.stream().map(r -> { + ReqSaveExamPaperPO.ExamPaperQuestionIdPO po = new ReqSaveExamPaperPO.ExamPaperQuestionIdPO(); + po.setPaperQuestionId(r.getId()); + po.setSortValue(i.longValue()); + i.incrementAndGet(); + return po; + }).collect(Collectors.toList()); + } + + private String generateExamRegistrationNo() { + String examRegistrationNo = RandomUtil.randomString(16); + return examRegistrationNo; + } + + @Transactional(rollbackFor = Exception.class) + public void uploadExamResult(ReqUploadExamResultPO request) { + // 获取入参参数 + Long driverId = request.getDriverId(); + Long trainingOrganizationId = request.getTrainingOrganizationId(); + Integer score = request.getScore(); + + // 获取驾驶员详情 + DriverInfo driverInfo = driverInfoService.getById(driverId); + // 获取培训组织详情 + TrainingOrganization trainingOrganization = iTrainingOrganizationService.getById(trainingOrganizationId); + + String isQualified = score >= ExamPaperQualifiedScoreConstant.EXAM_PAPER_QUALIFIED_SCORE ? ExamQualifiedEnum.qualified.name() : ExamQualifiedEnum.unqualified.name(); + if (!TrainingTypeEnum.transcoding_training.name().equals(trainingOrganization.getTrainingType())) { + // 获取培训驾驶员信息 更新驾驶员培训人员信息 + TrainingOrganizationTrainer trainingOrganizationTrainer = iTrainingOrganizationTrainerService.getOne(Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(TrainingOrganizationTrainer::getDriverId, driverId) + .eq(TrainingOrganizationTrainer::getTrainingOrganizationId, trainingOrganizationId)); + trainingOrganizationTrainer.setScore(score); + trainingOrganizationTrainer.setIsQualified(isQualified); + trainingOrganizationTrainer.setExaminationStatus(ExaminationStatusEnum.examined.name()); + iTrainingOrganizationTrainerService.saveOrUpdate(trainingOrganizationTrainer); + } + + ExamRecord examRecord = iExamRecordService.getOne(Wrappers.lambdaQuery(ExamRecord.class) + .eq(ExamRecord::getTrainingOrganizationId, trainingOrganizationId)); + // 新建考试记录 + ExamRecordDetail examRecordDetailSaveRecord = new ExamRecordDetail(); + examRecordDetailSaveRecord.setExamRecordId(examRecord.getId()); + examRecordDetailSaveRecord.setCompanyId(driverInfo.getCompanyId()); + examRecordDetailSaveRecord.setCompanyName(driverInfo.getCompanyName()); + examRecordDetailSaveRecord.setCreateBy(LoginUserUtil.getUserId()); + examRecordDetailSaveRecord.setCreateOn(LocalDateTime.now()); + examRecordDetailSaveRecord.setUpdateOn(LocalDateTime.now()); + examRecordDetailSaveRecord.setDriverId(driverInfo.getId()); + examRecordDetailSaveRecord.setDriverUserId(driverInfo.getUserId()); + examRecordDetailSaveRecord.setDriverName(driverInfo.getDriverName()); + examRecordDetailSaveRecord.setExamResult(isQualified); + examRecordDetailSaveRecord.setExamTime(LocalDateTime.now()); + examRecordDetailSaveRecord.setExamType(examRecord.getExamType()); + examRecordDetailSaveRecord.setScore(score); + examRecordDetailSaveRecord.setRegionId(driverInfo.getRegionId()); + iExamRecordDetailService.save(examRecordDetailSaveRecord); + + // 如果为培训报名考试 并且考试成绩合格 进入下一阶段 + if (TrainingTypeEnum.forensic_registration_training.name().equals(trainingOrganization.getTrainingType()) + && ExamQualifiedEnum.qualified.name().equals(isQualified)) { + driverInfo.setDriverRegistrationStatus(DriverRegistrationStatusEnum.upload_training_certificate_stage.name()); + driverInfo.setUpdateOn(LocalDateTime.now()); + driverInfoService.updateById(driverInfo); + // 更新驾驶员分数为 100分 + DriverScoreInfo driverScoreInfo = iDriverScoreInfoService.getOne(Wrappers.lambdaQuery(DriverScoreInfo.class).eq(DriverScoreInfo::getDriverId, driverInfo.getId())); + if (driverScoreInfo == null) { + driverScoreInfo = new DriverScoreInfo(); + driverScoreInfo.setDriverId(driverInfo.getId()); + driverScoreInfo.setUserId(driverInfo.getUserId()); + driverScoreInfo.setCreateOn(LocalDateTime.now()); + } + driverScoreInfo.setDriverScore(DriverRelationConstant.DRIVER_FULL_SCORE); + driverScoreInfo.setUpdateOn(LocalDateTime.now()); + iDriverScoreInfoService.saveOrUpdate(driverScoreInfo); + + DriverScoreRecord saveRecord = new DriverScoreRecord(); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setDriverId(driverInfo.getId()); + saveRecord.setOperateReason("通过驾驶员报名培训并完成了考试"); + saveRecord.setOperateScore(DriverRelationConstant.DRIVER_FULL_SCORE); + saveRecord.setOperateType(ScoreOperateType.add.name()); + saveRecord.setUserId(driverInfo.getUserId()); + iDriverScoreRecordService.save(saveRecord); + + //初始化驾驶员星级及分数 + StarManage starManage = new StarManage(); + starManage.setCurrentScore(DriverRelationConstant.DRIVER_FULL_SCORE); + starManage.setCurrentStar(TaskConstant.Star.FIVE_STAR); + starManage.setRegionId(driverInfo.getRegionId()); + starManage.setCompanyId(driverInfo.getCompanyId()); + starManage.setCompanyName(driverInfo.getCompanyName()); + starManage.setDriverName(driverInfo.getDriverName()); + starManage.setDriverId(driverId); + starManage.setCreateOn(LocalDateTime.now()); + starManage.setUpdateOn(LocalDateTime.now()); + starManageService.save(starManage); + + } + // 如果为继续教育考试 并且考试成绩合格 更新阶段和可参加继续教育培训报名标志 加分 + if (TrainingTypeEnum.continuing_education_training.name().equals(trainingOrganization.getTrainingType()) + && ExamQualifiedEnum.qualified.name().equals(isQualified)) { + driverInfo.setContinuingEducationStatus(DriverReplacementRegistrationStatusEnum.available.name()); + driverInfo.setContinuingEducationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + driverInfo.setUpdateOn(LocalDateTime.now()); + driverInfoService.updateById(driverInfo); + } + // 如果为换证培训 并且考试成绩合格 加分 + if (TrainingTypeEnum.replacement_registration_training.name().equals(trainingOrganization.getTrainingType()) + && ExamQualifiedEnum.qualified.name().equals(isQualified)) { + driverInfo.setReplacementRegistrationStatus(DriverReplacementRegistrationStatusEnum.upload_training_certificate_stage.name()); + driverInfo.setUpdateOn(LocalDateTime.now()); + driverInfoService.updateById(driverInfo); + } + // 如果为转码培训 并且考试成绩合格 加40分 + if (TrainingTypeEnum.transcoding_training.name().equals(trainingOrganization.getTrainingType()) + && ExamQualifiedEnum.qualified.name().equals(isQualified)) { + DriverScoreInfo driverScoreInfo = iDriverScoreInfoService.getOne(Wrappers.lambdaQuery(DriverScoreInfo.class).eq(DriverScoreInfo::getDriverId, driverInfo.getId())); + CodingRuleBO codingRuleBehaviorScore = driverBehaviorScoreHelper.getCodingRuleBehaviorScore(CodingRuleBehaviorTypeEnum.complete_the_exam,null); + Integer operationScore = codingRuleBehaviorScore.getOperationScore(); + if (driverScoreInfo == null) { + driverScoreInfo = new DriverScoreInfo(); + driverScoreInfo.setDriverId(driverInfo.getId()); + driverScoreInfo.setUserId(driverInfo.getUserId()); + driverScoreInfo.setCreateOn(LocalDateTime.now()); + driverScoreInfo.setDriverScore(operationScore); + } else { + driverScoreInfo.setDriverScore(driverScoreInfo.getDriverScore() + operationScore); + } + driverScoreInfo.setUpdateOn(LocalDateTime.now()); + iDriverScoreInfoService.saveOrUpdate(driverScoreInfo); + + DriverScoreRecord saveRecord = new DriverScoreRecord(); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setDriverId(driverInfo.getId()); + saveRecord.setOperateReason("驾驶员参加转码培训并完成了考试"); + saveRecord.setOperateScore(operationScore); + saveRecord.setOperateType(ScoreOperateType.add.name()); + saveRecord.setUserId(driverInfo.getUserId()); + iDriverScoreRecordService.save(saveRecord); + } + } + + public void deleteTrainingOrganization(Long organizationId) { + // TODO 补充校验逻辑 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(TrainingOrganization.class); + TrainingOrganizationManage context = (TrainingOrganizationManage) AopContext.currentProxy(); + context.buildTrainingOrganizationQuery(wrapper, organizationId); + TrainingOrganization organization = iTrainingOrganizationService.getOne(wrapper); + if (Objects.isNull(organization)) { + throw new BizException("培训组织不存在"); + } + //TrainingOrganization organization = iTrainingOrganizationService.getById(organizationId); + + String trainingType = organization.getTrainingType(); + + if(iTrainingOrganizationService.removeById(organizationId)) { + // 删除培训组织中的培训人员 + // 移除掉该培训组织删除掉的培训人员 + List removeList = iTrainingOrganizationTrainerService.list(Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(TrainingOrganizationTrainer::getTrainingOrganizationId, organizationId)); + iTrainingOrganizationTrainerService.removeBatchByIds(removeList); + List driverIds = removeList.stream().map(TrainingOrganizationTrainer::getDriverId).collect(Collectors.toList()); + List removeDriverInfos = driverInfoService.list(Wrappers.lambdaQuery(DriverInfo.class).in(DriverInfo::getId, driverIds)); + for (DriverInfo driverInfo : removeDriverInfos) { + if (TrainingTypeEnum.forensic_registration_training.name().equals(trainingType)) { + driverInfo.setDriverRegistrationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } else if (TrainingTypeEnum.continuing_education_training.name().equals(trainingType)) { + driverInfo.setContinuingEducationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } else if (TrainingTypeEnum.replacement_registration_training.name().equals(trainingType)) { + driverInfo.setReplacementRegistrationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } + // 更新驾驶员是否可以参见培训报名标志 + driverInfo.setUpdateOn(LocalDateTime.now()); + driverInfoService.updateById(driverInfo); + } + } + } + + @Transactional(rollbackFor = Exception.class) + public void trainingOrganizationStatusModify(ReqTrainingOrganizationStatusModifyPO request) { + Long organizationId = request.getOrganizationId(); + TrainingStatusEnum trainingStatus = request.getTrainingStatus(); + + + TrainingOrganization trainingOrganization = iTrainingOrganizationService.getById(organizationId); + if (Objects.isNull(trainingOrganization)) { + throw new BizException("该培训组织不存在"); + } + + trainingOrganization.setTrainingStatus(trainingStatus.name()); + trainingOrganization.setUpdateOn(LocalDateTime.now()); + iTrainingOrganizationService.updateById(trainingOrganization); + + // 转码培训只能有一个是生效状态 + if (TrainingStatusEnum.enable.equals(trainingStatus) + && TrainingTypeEnum.transcoding_training.name().equals(trainingOrganization.getTrainingType())) { + iTrainingOrganizationService.update(Wrappers.lambdaUpdate(TrainingOrganization.class) + .eq(TrainingOrganization::getTrainingType, TrainingTypeEnum.transcoding_training.name()) + .ne(TrainingOrganization::getId, organizationId) + .set(TrainingOrganization::getTrainingStatus, TrainingStatusEnum.disable.name())); + } + + } + + public ResCurrentUserOrganizationVO getCurrentUserOrganization(ReqCurrentUserOrganizationPO request) { + Long userId = LoginUserUtil.getUserId(); + TrainingTypeEnum trainingType = request.getTrainingType(); + + List trainingOrganizationList = iTrainingOrganizationService.list(Wrappers.lambdaQuery(TrainingOrganization.class) + .eq(TrainingOrganization::getTrainingType, trainingType)); + + ResCurrentUserOrganizationVO resVO = new ResCurrentUserOrganizationVO(); + resVO.setStatus(CurrentUserOrganizationEnum.uncommitted); + + if (TrainingTypeEnum.transcoding_training.equals(trainingType)) { + if (driverInfoHelper.hasDriverAvailableCertificate(userId)) { + trainingOrganizationList = trainingOrganizationList.stream() + .filter(r -> TrainingStatusEnum.enable.name().equals(r.getTrainingStatus())).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(trainingOrganizationList)) { + resVO.setTrainingOrganizationId(trainingOrganizationList.get(0).getId()); + resVO.setStatus(CurrentUserOrganizationEnum.incomplete); + return resVO; + } + } else { + return resVO; + } + } + List trainingOrganizationIdList = trainingOrganizationList.stream().map(TrainingOrganization::getId).collect(Collectors.toList()); + + if (CollectionUtil.isNotEmpty(trainingOrganizationIdList)) { + List trainingOrganizationTrainers = iTrainingOrganizationTrainerService.list(Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(TrainingOrganizationTrainer::getDriverUserId, userId) + .in(TrainingOrganizationTrainer::getTrainingOrganizationId, trainingOrganizationIdList) + .orderByDesc(TrainingOrganizationTrainer::getCreateOn) + .last("limit 1")); + + if (CollectionUtil.isNotEmpty(trainingOrganizationTrainers)) { + TrainingOrganizationTrainer trainingOrganizationTrainer = trainingOrganizationTrainers.get(0); + resVO.setTrainingOrganizationId(trainingOrganizationTrainer.getTrainingOrganizationId()); + if (ExaminationStatusEnum.examined.name().equals(trainingOrganizationTrainer.getExaminationStatus())) { + resVO.setStatus(CurrentUserOrganizationEnum.completed); + } else { + resVO.setStatus(CurrentUserOrganizationEnum.incomplete); + } + } + } + return resVO; + } + + public void organizationSign(Long organizationId) { + Long userId = LoginUserUtil.getUserId(); + + DriverInfo driverInfo = driverInfoService.getOne(Wrappers.lambdaQuery(DriverInfo.class).eq(DriverInfo::getUserId, userId)); + if (Objects.isNull(driverInfo)){ + throw new BizException("您未参加该培训!"); + } + TrainingOrganizationTrainer one = iTrainingOrganizationTrainerService.getOne(Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(TrainingOrganizationTrainer::getTrainingOrganizationId, organizationId) + .eq(TrainingOrganizationTrainer::getDriverUserId, userId) + .eq(TrainingOrganizationTrainer::getDriverId,driverInfo.getId())); + if (Objects.isNull(one)){ + throw new BizException("您未参加该培训!"); + } + one.setSignTime(LocalDateTime.now()); + iTrainingOrganizationTrainerService.updateById(one); + } + + public Boolean organizationSignCheck(Long organizationId) { + Long userId = LoginUserUtil.getUserId(); + TrainingOrganizationTrainer one = iTrainingOrganizationTrainerService.getOne(Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(TrainingOrganizationTrainer::getTrainingOrganizationId, organizationId) + .eq(TrainingOrganizationTrainer::getDriverUserId, userId)); + + if (Objects.isNull(one)) { + return false; + } + return Objects.nonNull(one.getSignTime()); + } + + public PageVo driverTrainingList(ReqDriverTrainingListPO request) { + Integer pageNumber = request.getPageNumber(); + Integer pageSize = request.getPageSize(); + Long driverId = request.getDriverId(); + + Page page = iTrainingOrganizationTrainerService.page(new Page<>(pageNumber, pageSize) + , Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(TrainingOrganizationTrainer::getDriverId, driverId)); + + PageVo pageVo = new PageVo<>(); + Long total = page.getTotal(); + if (total > 0) { + List records = page.getRecords(); + List trainingOrganizationIdList = records.stream().map(TrainingOrganizationTrainer::getTrainingOrganizationId).distinct().collect(Collectors.toList()); + // 过滤掉培训组织不存在的数据 + List traIds = iTrainingOrganizationService.list(Wrappers.lambdaQuery(TrainingOrganization.class).select(TrainingOrganization::getId)).stream() + .map(TrainingOrganization::getId).collect(Collectors.toList()); + List ids = trainingOrganizationIdList.stream().filter(traIds::contains).collect(Collectors.toList()); + List results = records.stream().filter(r -> ids.contains(r.getTrainingOrganizationId())).collect(Collectors.toList()); + List trainingOrganizationList = iTrainingOrganizationService.list(Wrappers.lambdaQuery(TrainingOrganization.class) + .in(TrainingOrganization::getId, ids)); + + Map trainingOrganizationMap = trainingOrganizationList.stream().collect(Collectors.toMap(TrainingOrganization::getId, Function.identity())); + + List resVOList = results.stream().map(r -> { + String isQualified = r.getIsQualified(); + Long trainingOrganizationId = r.getTrainingOrganizationId(); + TrainingOrganization trainingOrganization = trainingOrganizationMap.get(trainingOrganizationId); + if (Objects.nonNull(trainingOrganization)) { + ResDriverTrainingListVO resVO = new ResDriverTrainingListVO(); + resVO.setOrganizationId(trainingOrganization.getId()); + resVO.setTrainingTopic(trainingOrganization.getTrainingTopic()); + resVO.setTrainingType(TrainingTypeEnum.valueOf(trainingOrganization.getTrainingType())); + resVO.setTrainingMode(TrainingModeEnum.valueOf(trainingOrganization.getTrainingMode())); + resVO.setTrainingStartTime(trainingOrganization.getTrainingStartTime()); + resVO.setTrainingEndTime(trainingOrganization.getTrainingEndTime()); + resVO.setAddress(trainingOrganization.getAddress()); + resVO.setIsQualified(isQualified); + return resVO; + }else { + return null; + } + }).collect(Collectors.toList()); + pageVo.setRecords(resVOList); + pageVo.setTotal((long) resVOList.size()); + } + return pageVo; + } + + /** + * 补考 + * + * @param request + */ + public void makeUpExam(ReqMakeUpExamPO request) { + // 获取入参参数 + Long driverId = request.getDriverId(); + Long trainingOrganizationId = request.getTrainingOrganizationId(); + + // 获取驾驶员详情 + DriverInfo driverInfo = driverInfoService.getById(driverId); + // 获取培训组织详情 + TrainingOrganization trainingOrganization = iTrainingOrganizationService.getById(trainingOrganizationId); + + if (!TrainingTypeEnum.transcoding_training.name().equals(trainingOrganization.getTrainingType())) { + // 获取培训驾驶员信息 更新驾驶员培训人员信息 + TrainingOrganizationTrainer trainingOrganizationTrainer = iTrainingOrganizationTrainerService.getOne(Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(TrainingOrganizationTrainer::getDriverId, driverId) + .eq(TrainingOrganizationTrainer::getTrainingOrganizationId, trainingOrganizationId)); + trainingOrganizationTrainer.setScore(null); + trainingOrganizationTrainer.setIsQualified(""); + trainingOrganizationTrainer.setExaminationStatus(ExaminationStatusEnum.waiting_examination.name()); + iTrainingOrganizationTrainerService.saveOrUpdate(trainingOrganizationTrainer); + } + + } + + /** + * 获取培训组织关联的培训人员信息 + * @param request + * @return + */ + public PageVo trainerList(TrainingOrgTrainersQuery request) { + + List organizationTrainers; + List resVos = Lists.newArrayList(); + // 如果培训组织ID不为空说明是编辑培训组织,要查询出相关联的培训人员 + if (Objects.nonNull(request.getTrainingOrganizationId())) { + organizationTrainers = trainingOrganizationTrainerService.list(Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(TrainingOrganizationTrainer::getTrainingOrganizationId, request.getTrainingOrganizationId())); + List driverIds = organizationTrainers.stream() + .map(TrainingOrganizationTrainer::getDriverId) + .collect(Collectors.toList()); + Map driverInfoMap = iDriverInfoService.listByIds(driverIds).stream() + .collect(Collectors.toMap(DriverInfo::getId, v -> v)); + for (TrainingOrganizationTrainer trainer : organizationTrainers) { + ResTrainingOrgTrainerVO vo = new ResTrainingOrgTrainerVO(); + BeanUtils.copyProperties(trainer, vo); + DriverInfo driverInfo = driverInfoMap.get(trainer.getDriverId()); + LocalDateTime now = LocalDateTime.now(); + int compare = now.compareTo(driverInfo.getInitialLicenseTime()); + // 当前时间大于驾驶证初次申领时间 -> 驾驶证过期 + if (compare > 0 || compare == 0) { + vo.setCertificateExpireFlag(false); + } else { + vo.setCertificateExpireFlag(true); + } + resVos.add(vo); + } + } + + ReqArchivalInfoSearchPO po = new ReqArchivalInfoSearchPO(); + BeanUtils.copyProperties(request, po); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DriverInfo.class); + wrapper.like(StringUtils.isNotBlank(request.getCompanyName()), DriverInfo::getCompanyName, request.getCompanyName()) + .like(StringUtils.isNotBlank(request.getDriverName()), DriverInfo::getDriverName, request.getDriverName()) + .orderByDesc(DriverInfo::getCreateOn); + if (request.getTrainingRegistrationType().equals(TrainingRegistrationTypeEnum.FORENSIC_REGISTRATION.name())) { + wrapper.eq(DriverInfo::getDriverRegistrationStatus,DriverRegistrationStatusEnum.exam_training_stage.name()); + wrapper.eq(DriverInfo::getDriverRegistrationFlag,TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } else if (request.getTrainingRegistrationType().equals(TrainingRegistrationTypeEnum.CONTINUING_EDUCATION.name())) { + wrapper.eq(DriverInfo::getContinuingEducationStatus,DriverRegistrationStatusEnum.exam_training_stage.name()); + wrapper.eq(DriverInfo::getContinuingEducationFlag,TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } else if (request.getTrainingRegistrationType().equals(TrainingRegistrationTypeEnum.REPLACEMENT_REGISTRATION.name())) { + wrapper.eq(DriverInfo::getReplacementRegistrationStatus,DriverRegistrationStatusEnum.exam_training_stage.name()); + wrapper.eq(DriverInfo::getReplacementRegistrationFlag,TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + } + List driverInfos = iDriverInfoService.list(wrapper); + + for (DriverInfo driverInfo : driverInfos) { + ResTrainingOrgTrainerVO vo = new ResTrainingOrgTrainerVO(); + BeanUtils.copyProperties(driverInfo,vo); + vo.setDriverUserId(driverInfo.getUserId()); + vo.setDriverId(driverInfo.getId()); + LocalDateTime now = LocalDateTime.now(); + int compare = now.compareTo(driverInfo.getInitialLicenseTime()); + // 当前时间大于驾驶证初次申领时间 -> 驾驶证到期 + if (compare > 0 || compare == 0 ){ + vo.setCertificateExpireFlag(false); + } else { + vo.setCertificateExpireFlag(true); + } + resVos.add(vo); + } + + // 获取传入的分页参数 + Integer pageNumber = request.getPageNumber(); + Integer pageSize = request.getPageSize(); + List records = resVos.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + + return PageVo.of(records,resVos.size()); + } + + public String setExamTime(ReqSetExamTimePO request) { + Long trainingOrganizationId = request.getTrainingOrganizationId(); + List randomExamPaperIdList = request.getRandomExamPaperId(); + LocalDateTime examStartTime = request.getExamStartTime(); + LocalDateTime examEndTime = request.getExamEndTime(); + if (CollUtil.isNotEmpty(randomExamPaperIdList)) { + Map examPaperMap = iExamPaperService.list(Wrappers.lambdaQuery(ExamPaper.class).in(ExamPaper::getId, randomExamPaperIdList)) + .stream().collect(Collectors.toMap(ExamPaper::getId, e -> e)); + List examPapers = Lists.newArrayList(); + for (Long id : randomExamPaperIdList) { + ExamPaper examPaper = examPaperMap.get(id); + examPaper.setExamStartTime(examStartTime); + examPaper.setExamEndTime(examEndTime); + examPaper.setUpdateOn(LocalDateTime.now()); + examPapers.add(examPaper); + } + if(iExamPaperService.updateBatchById(examPapers)) { + // 保存考试时间到培训组织ID + TrainingOrganization trainingOrganization = iTrainingOrganizationService.getById(trainingOrganizationId); + trainingOrganization.setExamStartTime(examStartTime); + trainingOrganization.setExamEndTime(examEndTime); + trainingOrganization.setUpdateOn(LocalDateTime.now()); + iTrainingOrganizationService.updateById(trainingOrganization); + return "设置成功!"; + }else { + return "设置失败!"; + } + }else { + throw new BizException("请传入随机试卷ID!"); + } + } + + public void exportTrainer(HttpServletResponse response, ReqTrainerExportPO req) { + Long trainingOrganizationId = req.getTrainingOrganizationId(); + // 获取培训人员信息 + List trainerList = iTrainingOrganizationTrainerService + .list(Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(TrainingOrganizationTrainer::getTrainingOrganizationId, trainingOrganizationId)); + List driverIdList = trainerList.stream().map(TrainingOrganizationTrainer::getDriverId).collect(Collectors.toList()); + Map driverInfoMap = driverInfoService.list(Wrappers.lambdaQuery(DriverInfo.class).in(DriverInfo::getId, driverIdList)) + .stream().collect(Collectors.toMap(DriverInfo::getId, d -> d)); + + List collect = trainerList.stream().map(r -> { + TrainerInfoExportDTO exportDTO = new TrainerInfoExportDTO(); + Long driverId = r.getDriverId(); + DriverInfo driverInfo = driverInfoMap.get(driverId); + if (Objects.nonNull(driverInfo)){ + exportDTO.setAddress(driverInfo.getAddress()); + exportDTO.setBirth(NdDateUtils.format(driverInfo.getBirth(),NdDateUtils.DEFAULT_DATE_FORMAT)); + exportDTO.setDriverName(driverInfo.getDriverName()); + exportDTO.setDriverLicenseNo(driverInfo.getDriverLicenseNo()); + exportDTO.setDriverLicenseType(driverInfo.getDriverLicenseType()); + Integer gender = driverInfo.getGender(); + if (Objects.nonNull(gender)) { + exportDTO.setGender(GenderEnum.getDescByCode(gender)); + } + exportDTO.setHealth(driverInfo.getHealth()); + exportDTO.setIdCard(driverInfo.getIdCard()); + exportDTO.setPhoneNo(driverInfo.getPhoneNo()); + exportDTO.setIllegalAndIllegalInfo(driverInfo.getIllegalAndIllegalInfo()); + exportDTO.setNativePlace(driverInfo.getNativePlace()); + exportDTO.setNativePlaceRegionCode(driverInfo.getNativePlaceRegionCode()); + String motorcycleTypeList = driverInfo.getMotorcycleTypeList(); + String substring = motorcycleTypeList.substring(1, motorcycleTypeList.length() - 1); + String motorcycleTypeListStr = Arrays.stream(substring.split(StrPool.COMMA)).map(VehicleTypeEnum::getDescByEnum).collect(Collectors.joining(StrPool.COMMA)); + exportDTO.setMotorcycleTypeList(motorcycleTypeListStr); + exportDTO.setInitialLicenseTime(NdDateUtils.format(driverInfo.getInitialLicenseTime(),NdDateUtils.DEFAULT_DATE_FORMAT)); + // 获取培训组织信息 + TrainingOrganization trainingOrganization = iTrainingOrganizationService.getById(trainingOrganizationId); + exportDTO.setTrainingTopic(trainingOrganization.getTrainingTopic()); + String trainingType = trainingOrganization.getTrainingType(); + if (StringUtils.isNotBlank(trainingType)) { + if (TrainingTypeEnum.forensic_registration_training.name().equals(trainingType)){ + exportDTO.setTrainingType(DefValConstants.FORENSIC_REGISTRATION_TRAINING); + } else if (TrainingTypeEnum.replacement_registration_training.name().equals(trainingType)) { + exportDTO.setTrainingType(DefValConstants.REPLACEMENT_REGISTRATION_TRAINING); + } else if (TrainingTypeEnum.continuing_education_training.name().equals(trainingType)) { + exportDTO.setTrainingType(DefValConstants.CONTINUING_EDUCATION_TRAINING); + }else if (TrainingTypeEnum.transcoding_training.name().equals(trainingType)){ + exportDTO.setTrainingType(DefValConstants.TRANSCODING_TRAINING); + } + } + exportDTO.setTrainAddress(trainingOrganization.getAddress()); + String trainingMode = trainingOrganization.getTrainingMode(); + if (StringUtils.isNotBlank(trainingMode) && TrainingModeEnum.online.name().equals(trainingMode)){ + exportDTO.setTrainingMode(DefValConstants.ONLINE); + } else if (StringUtils.isNotBlank(trainingMode) && TrainingModeEnum.offline.name().equals(trainingMode)) { + exportDTO.setTrainingMode(DefValConstants.OFFLINE); + } + exportDTO.setTrainingStartTime(NdDateUtils.format(trainingOrganization.getTrainingStartTime(),NdDateUtils.DEFAULT_DATE_FORMAT)); + exportDTO.setTrainingEndTime(NdDateUtils.format(trainingOrganization.getTrainingEndTime(),NdDateUtils.DEFAULT_DATE_FORMAT)); + exportDTO.setRemark(trainingOrganization.getRemark()); + exportDTO.setExamStartTime(NdDateUtils.format(trainingOrganization.getExamStartTime(),NdDateUtils.DEFAULT_DATE_FORMAT)); + exportDTO.setExamEndTime(NdDateUtils.format(trainingOrganization.getExamEndTime(),NdDateUtils.DEFAULT_DATE_FORMAT)); + // 获取培训合格证信息 + Certificate certificate = certificateService.getOne(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getDriverId, r.getDriverId()) + .last(DefValConstants.LIMIT_1)); + if (Objects.nonNull(certificate)) { + exportDTO.setCertificateNo(certificate.getCertificateNo()); + exportDTO.setIssuedBy(certificate.getIssuedBy()); + exportDTO.setIssueDate(NdDateUtils.format(certificate.getIssueDate(), NdDateUtils.DEFAULT_DATE_FORMAT)); + exportDTO.setExpiryDate(NdDateUtils.format(certificate.getExpiryDate(), NdDateUtils.DEFAULT_DATE_FORMAT)); + } + } + return exportDTO; + }).collect(Collectors.toList()); + String fileName = "培训人员信息列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), TrainerInfoExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void uploadExamResultAndGenerateCertificate(ReqUploadExamResultPO request) { + + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + // 获取登录用户所在区域编码 + Long regionId = user.getRegionId(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + // 获取入参参数 + Long driverId = request.getDriverId(); + Long trainingOrganizationId = request.getTrainingOrganizationId(); + Integer score = request.getScore(); + + // 获取驾驶员详情 + DriverInfo driverInfo = driverInfoService.getById(driverId); + // 获取培训组织详情 + TrainingOrganization trainingOrganization = iTrainingOrganizationService.getById(trainingOrganizationId); + + String isQualified = score >= ExamPaperQualifiedScoreConstant.EXAM_PAPER_QUALIFIED_SCORE ? ExamQualifiedEnum.qualified.name() : ExamQualifiedEnum.unqualified.name(); + if (!TrainingTypeEnum.transcoding_training.name().equals(trainingOrganization.getTrainingType())) { + // 获取培训驾驶员信息 更新驾驶员培训人员信息 + TrainingOrganizationTrainer trainingOrganizationTrainer = iTrainingOrganizationTrainerService.getOne(Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(TrainingOrganizationTrainer::getDriverId, driverId) + .eq(TrainingOrganizationTrainer::getTrainingOrganizationId, trainingOrganizationId)); + trainingOrganizationTrainer.setScore(score); + trainingOrganizationTrainer.setIsQualified(isQualified); + trainingOrganizationTrainer.setExaminationStatus(ExaminationStatusEnum.examined.name()); + iTrainingOrganizationTrainerService.saveOrUpdate(trainingOrganizationTrainer); + } + + ExamRecord examRecord = iExamRecordService.getOne(Wrappers.lambdaQuery(ExamRecord.class) + .eq(ExamRecord::getTrainingOrganizationId, trainingOrganizationId)); + // 新建考试记录 + ExamRecordDetail examRecordDetailSaveRecord = new ExamRecordDetail(); + examRecordDetailSaveRecord.setExamRecordId(examRecord.getId()); + examRecordDetailSaveRecord.setCompanyId(driverInfo.getCompanyId()); + examRecordDetailSaveRecord.setCompanyName(driverInfo.getCompanyName()); + examRecordDetailSaveRecord.setCreateBy(LoginUserUtil.getUserId()); + examRecordDetailSaveRecord.setCreateOn(LocalDateTime.now()); + examRecordDetailSaveRecord.setUpdateOn(LocalDateTime.now()); + examRecordDetailSaveRecord.setDriverId(driverInfo.getId()); + examRecordDetailSaveRecord.setDriverUserId(driverInfo.getUserId()); + examRecordDetailSaveRecord.setDriverName(driverInfo.getDriverName()); + examRecordDetailSaveRecord.setExamResult(isQualified); + examRecordDetailSaveRecord.setExamTime(LocalDateTime.now()); + examRecordDetailSaveRecord.setExamType(examRecord.getExamType()); + examRecordDetailSaveRecord.setScore(score); + examRecordDetailSaveRecord.setRegionId(driverInfo.getRegionId()); + iExamRecordDetailService.save(examRecordDetailSaveRecord); + + String examType = trainingOrganization.getTrainingType(); + // 获取已经存在的所有合格证信息 + Long max; + OptionalLong maxId = certificateService.list().stream().mapToLong(Certificate::getId).max(); + if (maxId.isPresent()){ + max = maxId.getAsLong(); + }else { + max = 0L; + } + // 如果考试成绩合格,生成证书信息 + if (ExamQualifiedEnum.qualified.name().equals(isQualified)) { + // 保存合格证信息 + Certificate saveRecord = new Certificate(); + // 生成证书编号 + String certificateNo = generateCertificateNo(regionDto,max); + saveRecord.setCertificateNo(certificateNo); + saveRecord.setDriverId(driverId); + saveRecord.setDriverName(driverInfo.getDriverName()); + // 发证日期为当前时间、有效期加3年 + saveRecord.setIssueDate(LocalDateTime.now()); + saveRecord.setExpiryDate(LocalDateTime.now().plusYears(DriverConstant.YEAR_3)); + // 发证单位为所属区域散装中心 + String regionName = regionDto.getRegionName(); + saveRecord.setIssuedBy(regionName + DriverConstant.MANAGE_UNIT); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setCreateBy(user.getUserId()); + saveRecord.setUserId(driverInfo.getUserId()); + saveRecord.setBirth(driverInfo.getBirth()); + saveRecord.setGender(driverInfo.getGender()); + saveRecord.setNativePlace(driverInfo.getNativePlace()); + saveRecord.setHealth(driverInfo.getHealth()); + saveRecord.setPhoneNo(driverInfo.getPhoneNo()); + saveRecord.setAddress(driverInfo.getAddress()); + saveRecord.setDriverLicenseType(driverInfo.getDriverLicenseType()); + saveRecord.setDriverLicenseNo(driverInfo.getDriverLicenseNo()); + saveRecord.setRegionId(user.getRegionId()); + saveRecord.setRegionName(user.getRegionName()); + saveRecord.setCompanyId(user.getCompanyId()); + saveRecord.setCompanyName(user.getCompanyName()); + // 如果是换证培训,替换原来过期的取证培训合格证信息 + if (TrainingTypeEnum.replacement_registration_training.name().equals(examType)) { + Certificate certificate = certificateService.getOne(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getUserId, driverInfo.getUserId()).last(DefValConstants.LIMIT_1)); + saveRecord.setId(certificate.getId()); + } + certificateService.saveOrUpdate(saveRecord); + // 生成电子合格证图片,并上传到OSS上 + + + }else { + throw new BizException("考试成绩不满60分!"); + } + + // 如果为培训报名考试 并且考试成绩合格 更新阶段和可参加取证培训报名标志 + if (TrainingTypeEnum.forensic_registration_training.name().equals(examType)) { + driverInfo.setDriverRegistrationStatus(DriverRegistrationStatusEnum.available.name()); + driverInfo.setDriverRegistrationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + driverInfo.setUpdateOn(LocalDateTime.now()); + driverInfoService.updateById(driverInfo); + // 更新驾驶员分数为 100分 + DriverScoreInfo driverScoreInfo = iDriverScoreInfoService.getOne(Wrappers.lambdaQuery(DriverScoreInfo.class).eq(DriverScoreInfo::getDriverId, driverInfo.getId())); + if (driverScoreInfo == null) { + driverScoreInfo = new DriverScoreInfo(); + driverScoreInfo.setDriverId(driverInfo.getId()); + driverScoreInfo.setUserId(driverInfo.getUserId()); + driverScoreInfo.setCreateOn(LocalDateTime.now()); + } + driverScoreInfo.setDriverScore(DriverRelationConstant.DRIVER_FULL_SCORE); + driverScoreInfo.setUpdateOn(LocalDateTime.now()); + iDriverScoreInfoService.saveOrUpdate(driverScoreInfo); + + DriverScoreRecord saveRecord = new DriverScoreRecord(); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setDriverId(driverInfo.getId()); + saveRecord.setOperateReason("通过驾驶员报名培训并完成了考试"); + saveRecord.setOperateScore(DriverRelationConstant.DRIVER_FULL_SCORE); + saveRecord.setOperateType(ScoreOperateType.add.name()); + saveRecord.setUserId(driverInfo.getUserId()); + iDriverScoreRecordService.save(saveRecord); + + //初始化驾驶员星级及分数 + StarManage starManage = new StarManage(); + starManage.setCurrentScore(DriverRelationConstant.DRIVER_FULL_SCORE); + starManage.setCurrentStar(TaskConstant.Star.FIVE_STAR); + starManage.setRegionId(driverInfo.getRegionId()); + starManage.setCompanyId(driverInfo.getCompanyId()); + starManage.setCompanyName(driverInfo.getCompanyName()); + starManage.setDriverName(driverInfo.getDriverName()); + starManage.setDriverId(driverId); + starManage.setCreateOn(LocalDateTime.now()); + starManage.setUpdateOn(LocalDateTime.now()); + starManageService.save(starManage); + + } + // 如果为继续教育考试 并且考试成绩合格 更新阶段和可参加继续教育培训报名标志 加分 + if (TrainingTypeEnum.continuing_education_training.name().equals(trainingOrganization.getTrainingType())) { + driverInfo.setContinuingEducationStatus(DriverReplacementRegistrationStatusEnum.available.name()); + driverInfo.setContinuingEducationFlag(TrainingRegistrationFlagEnum.CAN_TAKE.getCode()); + driverInfo.setUpdateOn(LocalDateTime.now()); + driverInfoService.updateById(driverInfo); + } + // 如果为换证培训 并且考试成绩合格 加分 + if (TrainingTypeEnum.replacement_registration_training.name().equals(trainingOrganization.getTrainingType())) { + driverInfo.setReplacementRegistrationStatus(DriverReplacementRegistrationStatusEnum.upload_training_certificate_stage.name()); + driverInfo.setUpdateOn(LocalDateTime.now()); + driverInfoService.updateById(driverInfo); + } + // 如果为转码培训 并且考试成绩合格 加40分 + if (TrainingTypeEnum.transcoding_training.name().equals(trainingOrganization.getTrainingType())) { + DriverScoreInfo driverScoreInfo = iDriverScoreInfoService.getOne(Wrappers.lambdaQuery(DriverScoreInfo.class).eq(DriverScoreInfo::getDriverId, driverInfo.getId())); + CodingRuleBO codingRuleBehaviorScore = driverBehaviorScoreHelper.getCodingRuleBehaviorScore(CodingRuleBehaviorTypeEnum.complete_the_exam,null); + Integer operationScore = codingRuleBehaviorScore.getOperationScore(); + if (driverScoreInfo == null) { + driverScoreInfo = new DriverScoreInfo(); + driverScoreInfo.setDriverId(driverInfo.getId()); + driverScoreInfo.setUserId(driverInfo.getUserId()); + driverScoreInfo.setCreateOn(LocalDateTime.now()); + driverScoreInfo.setDriverScore(operationScore); + } else { + driverScoreInfo.setDriverScore(driverScoreInfo.getDriverScore() + operationScore); + } + driverScoreInfo.setUpdateOn(LocalDateTime.now()); + iDriverScoreInfoService.saveOrUpdate(driverScoreInfo); + + DriverScoreRecord saveRecord = new DriverScoreRecord(); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setDriverId(driverInfo.getId()); + saveRecord.setOperateReason("驾驶员参加转码培训并完成了考试"); + saveRecord.setOperateScore(operationScore); + saveRecord.setOperateType(ScoreOperateType.add.name()); + saveRecord.setUserId(driverInfo.getUserId()); + iDriverScoreRecordService.save(saveRecord); + } + } + + private String generateCertificateNo(RegionDTO regionDto, Long max) { + String regionCode = regionDto.getRegionCode(); + // 获取当前时间所在年份 + LocalDateTime now = LocalDateTime.now(); + int year = now.getYear(); + // 获取当前时间所在月份 + Month month = now.getMonth(); + // 获取当前时间所在天数 + int day = now.getDayOfMonth(); + // 证书序号加一 + Long maxCurrent = max + 1; + String serialNumber = String.format(DriverConstant.NO_5,maxCurrent); + return regionCode + year + month + day + serialNumber; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ArticleInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ArticleInfoMapper.java new file mode 100644 index 0000000..4e270c6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ArticleInfoMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.ningdatech.carapi.driver.entity.ArticleInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +public interface ArticleInfoMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ArticleInfoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ArticleInfoMapper.xml new file mode 100644 index 0000000..9182ba8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ArticleInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/BehaviorAnalysisProcessingModeMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/BehaviorAnalysisProcessingModeMapper.java new file mode 100644 index 0000000..615b916 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/BehaviorAnalysisProcessingModeMapper.java @@ -0,0 +1,7 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.driver.entity.BehaviorAnalysisProcessingMode; + +public interface BehaviorAnalysisProcessingModeMapper extends BaseMapper { +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/BehaviorAnalysisProcessingModeMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/BehaviorAnalysisProcessingModeMapper.xml new file mode 100644 index 0000000..c5f22ae --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/BehaviorAnalysisProcessingModeMapper.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/BehaviourAnalysisMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/BehaviourAnalysisMapper.java new file mode 100644 index 0000000..ae5cbf6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/BehaviourAnalysisMapper.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.driver.entity.DriverAbnormalBehaviorAnalysis; +import com.ningdatech.carapi.driver.model.po.AlarmWarnFilePO; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +public interface BehaviourAnalysisMapper extends BaseMapper { + + String QUERY_SQL = "SELECT " + + " (case when p.alarm_id is not null then p.alarm_id else v.alarm_id end) alarm_id, " + + " (case when p.plate_no is not null then p.plate_no else v.plate_no end) car_plate, " + + " c.name company_name,c.region_id,b.vehicle_type, " + + " (case when p.alarm_type is not null then p.alarm_type else v.alarm_type end) alarm_type, " + + " (case when p.capture_time is not null then p.capture_time else v.alarm_time end) alarm_time," + + " (case when p.region_name is not null then p.region_name else v.region_name end) alarm_address, " + + " p.url picture_url,v.url video_url,g.driver_id,g.driver_name " + + " from nd_vehicle_base_info b " + + " left join nd_company_info c on b.company_id = c.id " + + " right join nd_alarm_data_picture p on b.car_plate = p.plate_no " + + " right join nd_alarm_data_video v on p.alarm_id = v.alarm_id " + + " left join nd_vehicle_get_on g on p.plate_no = g.car_plate or v.plate_no = g.car_plate " + + " group by " + + " (case when p.alarm_id is not null then p.alarm_id else v.alarm_id end), " + + " (case when p.plate_no is not null then p.plate_no else v.plate_no end), " + + " c.name,c.region_id,b.vehicle_type, " + + " (case when p.alarm_type is not null then p.alarm_type else v.alarm_type end), " + + " (case when p.capture_time is not null then p.capture_time else v.alarm_time end), " + + " (case when p.region_name is not null then p.region_name else v.region_name end),p.url,v.url,g.driver_id,g.driver_name "; + String WRAPPER_SQL = "SELECT * from ( " + QUERY_SQL + " ) AS q ${ew.customSqlSegment}"; + + @Select(WRAPPER_SQL) + Page pageBehiviour(Page page, @Param("ew") LambdaQueryWrapper wrapper); + + @Select(WRAPPER_SQL) + DriverAbnormalBehaviorAnalysis getOneBehiviour(@Param("ew") LambdaQueryWrapper wrapper); + + List selectDriverAbnormalBehaviorAnalysisByCarPlate(@Param("index") long index); + + List selectDriverAbnormalBehaviorAnalysisAppendixData(@Param("alarmMsgSnList") List alarmMsgSnList); + + Long selectOneByAlarmMsgSn(@Param("alarmMsgSn") Integer alarmMsgSn); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/BehaviourAnalysisMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/BehaviourAnalysisMapper.xml new file mode 100644 index 0000000..b68919c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/BehaviourAnalysisMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/CertificateMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/CertificateMapper.java new file mode 100644 index 0000000..4d6332a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/CertificateMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.ningdatech.carapi.driver.entity.Certificate; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-24 + */ +public interface CertificateMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/CertificateMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/CertificateMapper.xml new file mode 100644 index 0000000..18bfc7e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/CertificateMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverBlackListMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverBlackListMapper.java new file mode 100644 index 0000000..41ca7f6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverBlackListMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.ningdatech.carapi.driver.entity.DriverBlackList; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +public interface DriverBlackListMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverBlackListMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverBlackListMapper.xml new file mode 100644 index 0000000..cac4933 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverBlackListMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverInfoMapper.java new file mode 100644 index 0000000..285152f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverInfoMapper.java @@ -0,0 +1,52 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.common.model.KeyValueDTO; +import com.ningdatech.carapi.common.model.po.MapDataPO; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * Mapper 接口 + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +public interface DriverInfoMapper extends BaseMapper { + + /** + * 驾驶员年龄分布计算 + * + * @param caseSql 年龄区间计算SQL + * @param undefinedAge 不参与统计的年龄 + * @param param + * @return key 年龄、value 驾驶员数量 + * @author WendyYang + **/ + List> driverAgeStatistics(@Param("caseSql") String caseSql, + @Param("undefinedAge") int undefinedAge, + @Param("param") DataScreenParam param); + + /** + * 驾驶员驾龄分布计算 + * + * @param caseSql 驾龄区间计算SQL + * @param undefinedAge 不参与统计的驾龄 + * @param param + * @return key 驾龄、value 驾驶员数量 + * @author WendyYang + **/ + List> drivingExperienceStatistics(@Param("caseSql") String caseSql, + @Param("undefinedAge") int undefinedAge, + @Param("param") DataScreenParam param); + + List diverCountByRegion(@Param("param") DataScreenParam param); + + List> nativePlaceStatisticsByRegion(@Param("param") DataScreenParam param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverInfoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverInfoMapper.xml new file mode 100644 index 0000000..e57c690 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverInfoMapper.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverScoreInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverScoreInfoMapper.java new file mode 100644 index 0000000..5b3a1e9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverScoreInfoMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.ningdatech.carapi.driver.entity.DriverScoreInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-27 + */ +public interface DriverScoreInfoMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverScoreInfoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverScoreInfoMapper.xml new file mode 100644 index 0000000..c2d5df0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverScoreInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverScoreRecordMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverScoreRecordMapper.java new file mode 100644 index 0000000..3cc5b04 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverScoreRecordMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.ningdatech.carapi.driver.entity.DriverScoreRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-27 + */ +public interface DriverScoreRecordMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverScoreRecordMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverScoreRecordMapper.xml new file mode 100644 index 0000000..d3f684f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverScoreRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverWorkRecordInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverWorkRecordInfoMapper.java new file mode 100644 index 0000000..947fa88 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/DriverWorkRecordInfoMapper.java @@ -0,0 +1,7 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.driver.entity.DriverWorkRecordInfo; + +public interface DriverWorkRecordInfoMapper extends BaseMapper { +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ExamRecordDetailMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ExamRecordDetailMapper.java new file mode 100644 index 0000000..6e8a412 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ExamRecordDetailMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.ningdatech.carapi.driver.entity.ExamRecordDetail; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-26 + */ +public interface ExamRecordDetailMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ExamRecordDetailMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ExamRecordDetailMapper.xml new file mode 100644 index 0000000..d622631 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ExamRecordDetailMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ExamRecordMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ExamRecordMapper.java new file mode 100644 index 0000000..e3bb3f9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ExamRecordMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.ningdatech.carapi.driver.entity.ExamRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-26 + */ +public interface ExamRecordMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ExamRecordMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ExamRecordMapper.xml new file mode 100644 index 0000000..6970c5b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/ExamRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/NdTrainingOrganizationMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/NdTrainingOrganizationMapper.java new file mode 100644 index 0000000..431da52 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/NdTrainingOrganizationMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.ningdatech.carapi.driver.entity.TrainingOrganization; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author LiuXinXin + * @since 2022-10-10 + */ +public interface NdTrainingOrganizationMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/NdTrainingOrganizationMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/NdTrainingOrganizationMapper.xml new file mode 100644 index 0000000..c421243 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/NdTrainingOrganizationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/StarManageMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/StarManageMapper.java new file mode 100644 index 0000000..d3babba --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/StarManageMapper.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.driver.entity.RegionStarDTO; +import com.ningdatech.carapi.driver.entity.StarManage; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-11-15 + */ +public interface StarManageMapper extends BaseMapper { + + Double getAvgStar(@Param("param") RegionStarDTO param); + + Double getCompanyAvgStar(@Param("param") RegionStarDTO param); + + Double countTotalStar(@Param("param") RegionStarDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/StarManageMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/StarManageMapper.xml new file mode 100644 index 0000000..bd7a998 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/StarManageMapper.xml @@ -0,0 +1,62 @@ + + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingBonusRecordMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingBonusRecordMapper.java new file mode 100644 index 0000000..7e0890a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingBonusRecordMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.ningdatech.carapi.driver.entity.TrainingBonusRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-31 + */ +public interface TrainingBonusRecordMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingBonusRecordMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingBonusRecordMapper.xml new file mode 100644 index 0000000..bd752ff --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingBonusRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingMaterialMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingMaterialMapper.java new file mode 100644 index 0000000..bc793c2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingMaterialMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.ningdatech.carapi.driver.entity.TrainingMaterial; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-21 + */ +public interface TrainingMaterialMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingMaterialMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingMaterialMapper.xml new file mode 100644 index 0000000..e7eb5b3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingMaterialMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingOrganizationMaterialMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingOrganizationMaterialMapper.java new file mode 100644 index 0000000..b35796c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingOrganizationMaterialMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.ningdatech.carapi.driver.entity.TrainingOrganizationMaterial; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-22 + */ +public interface TrainingOrganizationMaterialMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingOrganizationMaterialMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingOrganizationMaterialMapper.xml new file mode 100644 index 0000000..82929d5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingOrganizationMaterialMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingOrganizationTrainerMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingOrganizationTrainerMapper.java new file mode 100644 index 0000000..c4dff3b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingOrganizationTrainerMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.ningdatech.carapi.driver.entity.TrainingOrganizationTrainer; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-22 + */ +public interface TrainingOrganizationTrainerMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingOrganizationTrainerMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingOrganizationTrainerMapper.xml new file mode 100644 index 0000000..38719c3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingOrganizationTrainerMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingRegistrationReviewMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingRegistrationReviewMapper.java new file mode 100644 index 0000000..3861cce --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingRegistrationReviewMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.driver.entity.TrainingRegistrationReview; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-20 + */ +public interface TrainingRegistrationReviewMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingRegistrationReviewMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingRegistrationReviewMapper.xml new file mode 100644 index 0000000..bbbfa91 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/mapper/TrainingRegistrationReviewMapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/DriverArchivesExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/DriverArchivesExportDTO.java new file mode 100644 index 0000000..b77e7bd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/DriverArchivesExportDTO.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.driver.model; + +import java.io.Serializable; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 驾驶员档案导出实体 + * + * @author CMM + * @since 2023/05/15 14:06 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class DriverArchivesExportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ExcelProperty("姓名") + private String driverName; + + @ExcelProperty("所属企业") + private String companyName; + + @ExcelProperty("身份证号") + private String idCard; + + @ExcelProperty("所属区域") + private String regionName; + + @ExcelProperty("手机号码") + private String phoneNo; + + @ExcelProperty("创建时间") + private String createTime; + + @ExcelProperty("状态") + private String driverStatus; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/JudgmentalQuestionInfoTextContent.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/JudgmentalQuestionInfoTextContent.java new file mode 100644 index 0000000..d19c7ad --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/JudgmentalQuestionInfoTextContent.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.driver.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/11 下午3:58 + */ +@Data +@ApiModel("判断题题目") +public class JudgmentalQuestionInfoTextContent { + + @ApiModelProperty("题干") + private String stem; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/MultipleChoiceQuestionInfoTextContent.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/MultipleChoiceQuestionInfoTextContent.java new file mode 100644 index 0000000..d5128f1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/MultipleChoiceQuestionInfoTextContent.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.driver.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/11 下午3:58 + */ +@Data +@ApiModel("多选题题目") +public class MultipleChoiceQuestionInfoTextContent { + + @ApiModelProperty("题干") + private String stem; + + @ApiModelProperty("选项") + private List options; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/SingleChoiceQuestionInfoTextContent.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/SingleChoiceQuestionInfoTextContent.java new file mode 100644 index 0000000..9c27333 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/SingleChoiceQuestionInfoTextContent.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.driver.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/11 下午3:58 + */ +@Data +@ApiModel("单选题题目") +public class SingleChoiceQuestionInfoTextContent { + + @ApiModelProperty("题干") + private String stem; + + @ApiModelProperty("选项") + private List options; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/StarManageDisplayInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/StarManageDisplayInfo.java new file mode 100644 index 0000000..f5001e7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/StarManageDisplayInfo.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.driver.model; + +import com.ningdatech.carapi.driver.model.vo.StarManageDisplay; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/11/15 下午3:39 + */ + +@Data +@ApiModel("星级管理列表展示列表字段") +public class StarManageDisplayInfo { + + @ApiModelProperty("第一列展示信息") + private StarManageDisplay firstDisplayInfo; + + @ApiModelProperty("第二列展示信息") + private StarManageDisplay secondDisplayInfo; + + @ApiModelProperty("平均分数") + private Double avgStar; +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingBasicInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingBasicInfo.java new file mode 100644 index 0000000..0e999ef --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingBasicInfo.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.driver.model; + +import com.ningdatech.carapi.driver.constant.TrainingModeEnum; +import com.ningdatech.carapi.driver.constant.TrainingStatusEnum; +import com.ningdatech.carapi.driver.constant.TrainingTypeEnum; +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; + +/** + * @author liuxinxin + * @date 2022/10/21 下午3:05 + */ +@Data +@ApiModel("培训基础信息") +public class TrainingBasicInfo { + + @NotBlank(message = "培训主题不能为空") + @ApiModelProperty("培训主题") + private String trainingTopic; + + @ApiModelProperty("培训开始时间") + private LocalDateTime trainingStartTime; + + @ApiModelProperty("培训结束时间") + private LocalDateTime trainingEndTime; + + @ApiModelProperty("培训地点") + private String address; + + /** + * 培训模式 线上/线下 + * {@link TrainingModeEnum} + */ + @NotNull(message = "培训模式不能为空") + @ApiModelProperty(value = "培训模式 线上/线下", allowableValues = "online,offline") + private TrainingModeEnum trainingMode; + + /** + * 培训类型 取证培训/继续教育/换证培训/转码培训 + * {@link TrainingTypeEnum} + */ + @NotNull(message = "培训类型不能为空") + @ApiModelProperty(value = "培训类型 取证培训/继续教育/换证培训/转码培训", allowableValues = "forensic_registration_training 取证报名,replacement_registration_training 换证报名 ,continuing_education_training 继续教育,transcoding_training 转码培训") + private TrainingTypeEnum trainingType; + + @NotBlank(message = "联系人不能为空") + @ApiModelProperty("联系人") + private String contacts; + + /** + * 联系电话 + */ + @NotBlank(message = "联系电话不能为空") + @ApiModelProperty("联系电话") + private String contactNumber; + + /** + * 培训状态 启用/禁用 + * {@link TrainingStatusEnum} + */ + @NotNull(message = "培训状态不能为空") + @ApiModelProperty(value = "培训状态", allowableValues = "enable 启用,disable 禁用") + private TrainingStatusEnum trainingStatus; + + /** + * 备注 + */ + @NotBlank(message = "备注不能为空") + @ApiModelProperty("备注") + private String remark; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingExamPaperInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingExamPaperInfo.java new file mode 100644 index 0000000..3af643c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingExamPaperInfo.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.driver.model; + +import javax.validation.constraints.NotBlank; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/21 下午3:07 + */ + +@Data +@ApiModel("培训考试试卷") +public class TrainingExamPaperInfo { + /** + * 考试试卷名称id + */ + @ApiModelProperty("考试试卷名称id") + private Long examPaperId; + + /** + * 考试试卷名称 + */ + @NotBlank(message = "考试试卷名称不能为空") + @ApiModelProperty("考试试卷名称") + private String examPaperName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingMaterialInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingMaterialInfo.java new file mode 100644 index 0000000..0598cc2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingMaterialInfo.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.driver.model; + +import java.util.List; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.driver.constant.MaterialTypeEnum; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/22 上午9:29 + */ +@Data +@ApiModel("培训材料信息") +public class TrainingMaterialInfo { + + @NotNull(message = "培训材料id 不能为空") + @ApiModelProperty("培训材料id") + private Long trainingMaterialId; + + @NotBlank(message = "标题不能为空") + @ApiModelProperty("标题") + private String title; + + @NotNull(message = "培训材料附件 不能为空") + @ApiModelProperty("培训材料附件") + private List appendixList; + + @NotNull(message = "材料类型 不能为空") + @ApiModelProperty("材料类型") + private MaterialTypeEnum materialType; + + @NotBlank(message = "内容 不能为空") + @ApiModelProperty("内容") + private String content; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingMaterialOverviewInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingMaterialOverviewInfo.java new file mode 100644 index 0000000..f51ae47 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingMaterialOverviewInfo.java @@ -0,0 +1,69 @@ +package com.ningdatech.carapi.driver.model; + +import cn.hutool.core.collection.CollectionUtil; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/22 上午9:34 + */ + +@ApiModel("培训材料总揽列表") +@Data +public class TrainingMaterialOverviewInfo { + + @Size(min = 1, max = 6) + @ApiModelProperty("规则制度材料列表") + private List ruleSystemMaterialList; + + @Size(min = 1, max = 6) + @ApiModelProperty("政策文件材料列表") + private List policyDocumentsMaterialInfoList; + + @Size(min = 1, max = 6) + @ApiModelProperty("安全知识材料列表") + private List safetyKnowledgeMaterialInfoList; + + @Size(min = 1, max = 6) + @ApiModelProperty("事故案例材料列表") + private List accidentCaseMaterialInfoList; + + @Size(min = 1, max = 6) + @ApiModelProperty("培训视频材料列表") + private List trainingVideoMaterialInfoList; + + @Size(min = 1, max = 6) + @ApiModelProperty("其他材料列表") + private List otherMaterialInfoList; + + + public List getAllList() { + List trainingMaterialInfoList = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(this.ruleSystemMaterialList)) { + trainingMaterialInfoList.addAll(this.ruleSystemMaterialList); + } + if (CollectionUtil.isNotEmpty(this.policyDocumentsMaterialInfoList)) { + trainingMaterialInfoList.addAll(this.policyDocumentsMaterialInfoList); + } + if (CollectionUtil.isNotEmpty(this.safetyKnowledgeMaterialInfoList)) { + trainingMaterialInfoList.addAll(this.safetyKnowledgeMaterialInfoList); + } + if (CollectionUtil.isNotEmpty(this.accidentCaseMaterialInfoList)) { + trainingMaterialInfoList.addAll(this.accidentCaseMaterialInfoList); + } + if (CollectionUtil.isNotEmpty(this.trainingVideoMaterialInfoList)) { + trainingMaterialInfoList.addAll(this.trainingVideoMaterialInfoList); + } + if (CollectionUtil.isNotEmpty(this.otherMaterialInfoList)) { + trainingMaterialInfoList.addAll(this.otherMaterialInfoList); + } + return trainingMaterialInfoList; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingTrainersInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingTrainersInfo.java new file mode 100644 index 0000000..ef73214 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/TrainingTrainersInfo.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.driver.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/10/21 下午4:08 + */ +@Data +@ApiModel("培训人员信息") +public class TrainingTrainersInfo { + + @NotNull(message = "驾驶员id 不能为空") + @ApiModelProperty("驾驶员id") + private Long driverId; + + @NotNull(message = "驾驶员用户id 不能为空") + @ApiModelProperty("驾驶员用户id") + private Long driverUserId; + + @NotBlank(message = "驾驶员姓名 不能为空") + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @NotBlank(message = "驾驶员所属企业id 不能为空") + @ApiModelProperty("驾驶员所属企业id") + private Long companyId; + + @NotBlank(message = "驾驶员所属企业 不能为空") + @ApiModelProperty("驾驶员所属企业") + private String companyName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/bo/CodingRuleBO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/bo/CodingRuleBO.java new file mode 100644 index 0000000..ed77acf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/bo/CodingRuleBO.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.driver.model.bo; + +import com.ningdatech.carapi.sys.entity.enumeration.RuleOperationTypeEnum; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/11/14 上午11:33 + */ +@Data +public class CodingRuleBO { + + @ApiModelProperty("加分减分") + private RuleOperationTypeEnum ruleOperationType; + + @ApiModelProperty("操作分数") + private Integer operationScore; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/dto/DriverBasicInfoDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/dto/DriverBasicInfoDTO.java new file mode 100644 index 0000000..5376414 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/dto/DriverBasicInfoDTO.java @@ -0,0 +1,114 @@ +package com.ningdatech.carapi.driver.model.dto; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +import com.ningdatech.carapi.common.constant.DriverLicenseTypeEnum; +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.driver.constant.TrainingRegistrationTypeEnum; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 驾驶员基本信息实体类 + * + * @author CMM + * @since 2023/06/08 10:13 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class DriverBasicInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("驾驶员id") + @NotNull(message = "驾驶员ID不能为空") + private Long driverId; + + @ApiModelProperty("驾驶员姓名") + @NotBlank(message = "驾驶员姓名不能为空") + private String driverName; + + @ApiModelProperty("性别 0:女 ,1:男 ") + @NotNull(message = "性别不能为空") + private Integer gender; + + @ApiModelProperty("身份证号") + @NotBlank(message = "身份证号不能为空") + private String idCard; + + @ApiModelProperty("出生年月") + @NotNull(message = "出生年月不能为空") + private LocalDateTime birth; + + @ApiModelProperty("籍贯") + @NotBlank(message = "籍贯不能为空") + private String nativePlace; + + @ApiModelProperty(value = "免冠照图片文件") + private FileBasicInfo avatarFile; + + @ApiModelProperty(value = "健康状况") + private String health; + + @ApiModelProperty("手机号码") + @NotBlank(message = "手机号码不能为空") + private String driverPhoneNo; + + @ApiModelProperty("住址") + @NotBlank(message = "住址不能为空") + private String driverAddress; + + @ApiModelProperty("驾驶员证号") + private String driverLicenseNo; + + @ApiModelProperty("驾驶证类型/准驾车型") + private DriverLicenseTypeEnum driverLicenseType; + + @ApiModelProperty("所属服务企业唯一标识id") + @NotNull(message = "公司id不能为空") + private Long companyId; + + @ApiModelProperty(value = "企业名称") + private String companyName; + + @ApiModelProperty(value = "企业地址") + private String companyAddress; + + @ApiModelProperty(value = "企业联系人") + private String companyContactPerson; + + @ApiModelProperty(value = "企业电话") + private String companyContactPhone; + + @ApiModelProperty("附件") + private List appendixList; + + @ApiModelProperty(value = "培训报名类型", allowableValues = "FORENSIC_REGISTRATION 取证报名,REPLACEMENT_REGISTRATION 换证报名,CONTINUING_EDUCATION 继续教育") + @NotNull(message = "培训报名类型不能为空") + private TrainingRegistrationTypeEnum trainingRegistrationType; + + + @ApiModelProperty("初次领证时间") + @NotNull(message = "初次领证时间不能为空") + private LocalDateTime initialLicenseTime; + + @ApiModelProperty("违规违法信息") + private String illegalAndIllegalInfo; + + @ApiModelProperty("籍贯") + @NotBlank(message = "籍贯编码") + private String nativePlaceRegionCode; + + @ApiModelProperty(value = "驾驶员拟驾车型列表", allowableValues = "MIXER 搅拌车,PUMP_TRUCK 泵车,BULK_CEMENT_TRUCK 散装水泥车" + + ",MORTAR_TRUCK 砂浆车,OTHER 其他") + private List motorcycleTypeList; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/dto/TrainerInfoExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/dto/TrainerInfoExportDTO.java new file mode 100644 index 0000000..6b9cb87 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/dto/TrainerInfoExportDTO.java @@ -0,0 +1,132 @@ +package com.ningdatech.carapi.driver.model.dto; + +import java.io.Serializable; + +import com.alibaba.excel.annotation.ExcelProperty; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 培训驾驶员信息实体类 + * + * @author CMM + * @since 2023/06/08 10:13 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class TrainerInfoExportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("身份证号") + @ExcelProperty("身份证号") + private String idCard; + + @ApiModelProperty("出生年月") + @ExcelProperty("出生年月") + private String birth; + + @ApiModelProperty("驾驶员姓名") + @ExcelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("性别 0:女 ,1:男 ") + @ExcelProperty("性别") + private String gender; + + @ApiModelProperty("籍贯") + @ExcelProperty("籍贯") + private String nativePlace; + + @ApiModelProperty("邮政编码") + @ExcelProperty("邮政编码") + private String nativePlaceRegionCode; + + @ApiModelProperty(value = "健康状况") + @ExcelProperty("健康状况") + private String health; + + @ApiModelProperty("手机号码") + @ExcelProperty("手机号码") + private String phoneNo; + + @ApiModelProperty("住址") + @ExcelProperty("住址") + private String address; + + @ApiModelProperty("驾驶员证档案编号") + @ExcelProperty("驾驶员证档案编号") + private String driverLicenseNo; + + @ApiModelProperty("准驾车型") + @ExcelProperty("准驾车型") + private String driverLicenseType; + + @ApiModelProperty("驾驶证初次申领时间") + @ExcelProperty("驾驶证初次申领时间") + private String initialLicenseTime; + + @ApiModelProperty("拟驾车型") + @ExcelProperty("拟驾车型") + private String motorcycleTypeList; + + @ApiModelProperty("违规违法信息") + @ExcelProperty("违规违法信息") + private String illegalAndIllegalInfo; + + @ApiModelProperty("培训主题") + @ExcelProperty("培训主题") + private String trainingTopic; + + @ApiModelProperty("培训开始时间") + @ExcelProperty("培训开始时间") + private String trainingStartTime; + + @ApiModelProperty("培训结束时间") + @ExcelProperty("培训结束时间") + private String trainingEndTime; + + @ApiModelProperty("培训地点") + @ExcelProperty("培训地点") + private String trainAddress; + + @ApiModelProperty("培训模式") + @ExcelProperty("培训模式") + private String trainingMode; + + @ApiModelProperty(value = "培训类型") + @ExcelProperty("培训类型") + private String trainingType; + + @ApiModelProperty("备注") + @ExcelProperty("备注") + private String remark; + + @ApiModelProperty("考试开始时间") + @ExcelProperty("考试开始时间") + private String examStartTime; + + @ApiModelProperty("考试结束时间") + @ExcelProperty("考试结束时间") + private String examEndTime; + + @ApiModelProperty("证书编号") + @ExcelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("发证单位") + @ExcelProperty("发证单位") + private String issuedBy; + + @ApiModelProperty("发证日期") + @ExcelProperty("发证日期") + private String issueDate; + + @ApiModelProperty("有效期") + @ExcelProperty("有效期") + private String expiryDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/AlarmWarnFilePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/AlarmWarnFilePO.java new file mode 100644 index 0000000..89185dd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/AlarmWarnFilePO.java @@ -0,0 +1,26 @@ +package com.ningdatech.carapi.driver.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @description + * @since 2022/12/07 14:49 + */ +@Data +@ApiModel("驾驶员异常行为分析附件") +public class AlarmWarnFilePO { + @ApiModelProperty("供应商告警唯一序号") + private Integer alarmMsgSn; + + @ApiModelProperty(value = "告警附件类型",allowableValues = "0 图片,1 视频") + private Integer fileType; + + @ApiModelProperty(value = "告警附件格式",allowableValues = "0 jpg,1 mp4") + private Integer fileFormat; + + @ApiModelProperty("告警附件路径") + private String filePath; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/AuditInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/AuditInfo.java new file mode 100644 index 0000000..6e2521e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/AuditInfo.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.carapi.common.model.FileBasicInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/15 上午10:42 + */ +@Data +@ApiModel(description = "审核信息") +public class AuditInfo { + + @ApiModelProperty("审核员Id") + private Long auditorId; + + @ApiModelProperty("审核员姓名") + private String auditorName; + + @ApiModelProperty("审核意见") + private String reviewComments; + + @ApiModelProperty("审核时间") + private LocalDateTime auditTime; + + @ApiModelProperty("附件") + private List appendixList; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqAddDriverArchivesPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqAddDriverArchivesPO.java new file mode 100644 index 0000000..a68d500 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqAddDriverArchivesPO.java @@ -0,0 +1,103 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.carapi.common.constant.DriverLicenseTypeEnum; +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.driver.constant.TrainingRegistrationTypeEnum; +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; +import java.util.List; + + +@Data +@ApiModel(description = "录入特殊驾驶员") +public class ReqAddDriverArchivesPO { + + @ApiModelProperty("驾驶员id 驾驶员培训报名首次信息填入无需传入") + private Long driverId; + + @ApiModelProperty(value = "培训报名类型", allowableValues = "FORENSIC_REGISTRATION 取证报名,REPLACEMENT_REGISTRATION 换证报名,CONTINUING_EDUCATION 继续教育") + @NotNull(message = "培训报名类型不能为空") + private TrainingRegistrationTypeEnum trainingRegistrationType; + + @ApiModelProperty("驾驶员姓名") + @NotBlank(message = "驾驶员姓名不能为空") + private String driverName; + + @ApiModelProperty("性别 0:女 ,1:男 ") + @NotNull(message = "性别不能为空") + private Integer gender; + + @ApiModelProperty("身份证号") + @NotBlank(message = "身份证号不能为空") + private String idCard; + + @ApiModelProperty("出生年月") + @NotNull(message = "出生年月不能为空") + private LocalDateTime birth; + + @ApiModelProperty("籍贯") + @NotBlank(message = "籍贯不能为空") + private String nativePlace; + + @ApiModelProperty("籍贯") + @NotBlank(message = "籍贯编码") + private String nativePlaceRegionCode; + + @ApiModelProperty(value = "免冠照图片文件") + private FileBasicInfo avatarFile; + + @ApiModelProperty(value = "健康状况") + private String health; + + @ApiModelProperty("手机号码") + @NotBlank(message = "手机号码不能为空") + private String phoneNo; + + @ApiModelProperty("住址") + @NotBlank(message = "住址不能为空") + private String address; + + @ApiModelProperty("驾驶证号") + private String driverLicenseNo; + + @ApiModelProperty(value = "驾驶证类型/准驾车型", allowableValues = "A1, A2, B1, B2, C1, OTHER") + private DriverLicenseTypeEnum driverLicenseType; + + @ApiModelProperty("初次领证时间") + @NotNull(message = "初次领证时间不能为空") + private LocalDateTime initialLicenseTime; + + @ApiModelProperty("附件") + private List appendixList; + + @ApiModelProperty("违规违法信息") + private String illegalAndIllegalInfo; + + @ApiModelProperty(value = "驾驶员拟驾车型列表", allowableValues = "MIXER 搅拌车,PUMP_TRUCK 泵车,BULK_CEMENT_TRUCK 散装水泥车" + + ",MORTAR_TRUCK 砂浆车,OTHER 其他") + private List motorcycleTypeList; + + @ApiModelProperty("合格证编号") + @NotBlank(message = "合格证编号不能为空") + private String certificateNo; + + @ApiModelProperty("发证单位") + @NotBlank(message = "发证单位不能为空") + private String issueBy; + + @ApiModelProperty("发证日期") + @NotNull(message = "发证日期不能为空") + private LocalDateTime issueDate; + + @ApiModelProperty("合格证有效期至") + @NotNull(message = "合格证有效期不能为空") + private LocalDateTime expiryDate; + + @ApiModelProperty("合格证备注") + private String certificateRemark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqArchivalInfoSearchPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqArchivalInfoSearchPO.java new file mode 100644 index 0000000..e3b0c46 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqArchivalInfoSearchPO.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.carapi.driver.constant.DriverStatusEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/10/9 上午10:43 + */ +@Data +@ApiModel(description = "驾驶员信息档案查询请求") +public class ReqArchivalInfoSearchPO extends PagePo { + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("企业") + private String companyName; + + @ApiModelProperty("区域信息id") + private Long regionId; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("驾驶员状态:入职/离职") + private DriverStatusEnum driverStatus; + + @ApiModelProperty("公司id") + private Long companyId; + + @ApiModelProperty("创建开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("创建结束时间") + private LocalDateTime endTime; + + @ApiModelProperty("培训类型") + private String trainingRegistrationType; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqArticleInfoListPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqArticleInfoListPO.java new file mode 100644 index 0000000..645000e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqArticleInfoListPO.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.carapi.driver.constant.ArticleTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/10/9 下午4:54 + */ +@Data +@ApiModel(description = "文章列表查询") +public class ReqArticleInfoListPO extends PagePo { + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("截止时间") + private LocalDateTime endTime; + + @ApiModelProperty("文章类型") + private ArticleTypeEnum articleType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqChangedJobPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqChangedJobPO.java new file mode 100644 index 0000000..76f3528 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqChangedJobPO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.driver.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/11/3 下午2:32 + */ +@Data +@ApiModel("驾驶员跳槽申请PO") +public class ReqChangedJobPO { + + @NotNull + @ApiModelProperty("跳槽目标公司id") + private Long newCompanyId; + + @NotNull + @ApiModelProperty("驾驶员id") + private Long driverId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqCompanyStarPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqCompanyStarPO.java new file mode 100644 index 0000000..ced0d88 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqCompanyStarPO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/26 下午5:20 + */ +@ApiModel("公司星级筛选列表") +@Data +public class ReqCompanyStarPO extends PagePo { + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("所属区域id") + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqCreateTrainingOrgPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqCreateTrainingOrgPO.java new file mode 100644 index 0000000..75b0a79 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqCreateTrainingOrgPO.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.carapi.driver.model.TrainingBasicInfo; +import com.ningdatech.carapi.driver.model.TrainingExamPaperInfo; +import com.ningdatech.carapi.driver.model.TrainingMaterialOverviewInfo; +import com.ningdatech.carapi.driver.model.TrainingTrainersInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/21 下午2:52 + */ +@Data +@ApiModel("创建培训组织请求PO") +public class ReqCreateTrainingOrgPO { + + @ApiModelProperty("培训组织id") + private Long organizationId; + + @ApiModelProperty("培训基础信息") + @NotNull + private TrainingBasicInfo trainingBasicInfo; + + @ApiModelProperty("培训资料") + @NotNull + private TrainingMaterialOverviewInfo trainingMaterialOverviewInfo; + + @ApiModelProperty("培训人员") + @Size(min = 1) + private List trainingTrainersInfoList; + + @ApiModelProperty("培训考试试卷") + @NotNull + private TrainingExamPaperInfo trainingExamPaperInfo; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqCurrentUserOrganizationPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqCurrentUserOrganizationPO.java new file mode 100644 index 0000000..8c4f19a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqCurrentUserOrganizationPO.java @@ -0,0 +1,26 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.carapi.driver.constant.TrainingTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/11/3 下午3:11 + */ +@Data +@ApiModel(value = "获取当前培训组织PO") +public class ReqCurrentUserOrganizationPO { + + /** + * 培训类型 取证培训/继续教育/换证培训/转码培训 + * {@link TrainingTypeEnum} + */ + @NotNull(message = "培训类型不能为空") + @ApiModelProperty(value = "培训类型 取证培训/继续教育/换证培训/转码培训", allowableValues = "forensic_registration_training 取证报名,replacement_registration_training 换证报名 ,continuing_education_training 继续教育,transcoding_training 转码培训") + private TrainingTypeEnum trainingType; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverBlackListSearchPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverBlackListSearchPO.java new file mode 100644 index 0000000..5361fcf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverBlackListSearchPO.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/10/9 下午1:53 + */ +@Data +@ApiModel(description = "黑名单查询请求") +public class ReqDriverBlackListSearchPO extends PagePo { + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业") + private String companyName; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("年度") + @NotBlank(message = "年度不能为空") + private String year; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverInReviewingPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverInReviewingPO.java new file mode 100644 index 0000000..ac949cc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverInReviewingPO.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.driver.constant.TrainingRegistrationTypeEnum; +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.util.List; + +/** + * @author liuxinxin + * @date 2022/10/15 上午9:28 + */ +@Data +@ApiModel("驾驶员复审结果") +public class ReqDriverInReviewingPO { + + @NotNull(message = "审核id 不能为空") + @ApiModelProperty("审核id") + private Long metaApplyId; + + @NotNull(message = "驾驶员id 不能为空") + @ApiModelProperty("驾驶员id") + private Long driverId; + + @NotNull(message = "培训类型 不能为空") + @ApiModelProperty("培训类型") + private TrainingRegistrationTypeEnum trainingRegistrationType; + + @NotNull(message = "审核结果不能为空") + @ApiModelProperty("审核结果") + private Boolean result; + + @NotBlank(message = "审核意见不能为空") + @ApiModelProperty("审核意见") + private String opinion; + + @ApiModelProperty("附件") + private List appendixList; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverInductionPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverInductionPO.java new file mode 100644 index 0000000..1f30d26 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverInductionPO.java @@ -0,0 +1,82 @@ +package com.ningdatech.carapi.driver.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/10/9 下午5:50 + */ +@Data +@ApiModel("驾驶员入职请求入参") +public class ReqDriverInductionPO { + + @ApiModelProperty("驾驶员ID") + @NotNull(message = "驾驶员ID不能为空") + private Long driverId; + + @ApiModelProperty("要入职的新公司的ID") + @NotNull + private Long newCompanyId; + + //@ApiModelProperty("驾驶员姓名") + //@NotBlank(message = "驾驶员姓名不能为空") + //private String driverName; + // + //@ApiModelProperty("性别") + //@NotNull(message = "性别不能为空") + //private Integer gender; + // + //@ApiModelProperty("身份证号") + //@NotBlank(message = "身份证号不能为空") + //private String idCard; + // + //@ApiModelProperty("出生年月") + //@NotNull(message = "出生年月不能为空") + //private LocalDateTime birth; + // + //@ApiModelProperty("籍贯") + //@NotBlank(message = "籍贯不能为空") + //private String nativePlace; + // + //@ApiModelProperty("手机号码") + //@NotBlank(message = "手机号码不能为空") + //private String phoneNo; + // + //@ApiModelProperty("文化程度") + //@NotBlank(message = "文化程度不能为空") + //private String edu; + // + //@ApiModelProperty("违章次数") + //private Integer violationsCount; + // + //@ApiModelProperty("驾驶员证号") + //private String driverLicenseNo; + // + //@ApiModelProperty("驾驶证类型") + //private String driverLicenseType; + // + //@ApiModelProperty("驾驶证号生效日期") + //private LocalDateTime driverLicenseEffectiveDate; + // + //@ApiModelProperty("驾驶证号失效日期") + //private LocalDateTime driverLicenseExpiryDate; + // + //@ApiModelProperty("从业资格证号") + //private String qualificationCertificateNo; + // + //@ApiModelProperty("从业资格证生效日期") + //private LocalDateTime qualificationCertificateNoEffectiveDate; + // + //@ApiModelProperty("从业资格证失效日期") + //private LocalDateTime qualificationCertificateNoExpiryDate; + // + //@ApiModelProperty("服务企业唯一标识id") + //private Long companyId; + // + //@ApiModelProperty("企业名称") + //private String companyName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverStarListPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverStarListPO.java new file mode 100644 index 0000000..f4dbb2a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverStarListPO.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/26 下午5:20 + */ +@ApiModel("驾驶员星级筛选列表") +@Data +public class ReqDriverStarListPO extends PagePo { + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("所属区域id") + private Long regionId; + + @ApiModelProperty("子区域id列表") + private List childRegionIds; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverTrainingListPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverTrainingListPO.java new file mode 100644 index 0000000..abf378e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverTrainingListPO.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/11/9 上午9:09 + */ +@Data +@ApiModel("驾驶员培训记录列表PO") +public class ReqDriverTrainingListPO extends PagePo { + + @ApiModelProperty("驾驶员id") + private Long driverId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverTrainingPreliminaryTrialPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverTrainingPreliminaryTrialPO.java new file mode 100644 index 0000000..3022562 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverTrainingPreliminaryTrialPO.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.driver.model.po; + +import java.util.List; + +import javax.validation.constraints.NotNull; + +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.driver.constant.TrainingRegistrationTypeEnum; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/15 上午9:11 + */ +@ApiModel(description = "驾驶员培训初审结果请求PO") +@Data +public class ReqDriverTrainingPreliminaryTrialPO { + + @NotNull(message = "审核id 不能为空") + @ApiModelProperty("审核id") + private Long metaApplyId; + + @NotNull(message = "驾驶员id 不能为空") + @ApiModelProperty("驾驶员id") + private Long driverId; + + @NotNull(message = "培训类型 不能为空") + @ApiModelProperty("培训类型") + private TrainingRegistrationTypeEnum trainingRegistrationType; + + @NotNull(message = "审核结果不能为空") + @ApiModelProperty("审核结果") + private Boolean result; + + @ApiModelProperty("审核意见") + private String opinion; + + @ApiModelProperty("附件") + private List appendixList; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverTrainingRegistrationListPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverTrainingRegistrationListPO.java new file mode 100644 index 0000000..ee921f8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverTrainingRegistrationListPO.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.carapi.driver.constant.TrainingRegistrationTypeEnum; +import com.ningdatech.carapi.sys.entity.enumeration.MetaApplyTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/12 下午5:19 + */ + +@ApiModel(description = "驾驶员培训列表请求") +@Data +public class ReqDriverTrainingRegistrationListPO extends PagePo { + + @ApiModelProperty("驾驶员名称") + private String driverName; + + @ApiModelProperty("公司姓名") + private String companyName; + + @ApiModelProperty(value = "审核类型", allowableValues = "PRELIMINARY_REVIEW 初审,IN_REVIEW 复核") + private MetaApplyTypeEnum metaApplyType; + + @ApiModelProperty(value = "meta审核状态", + allowableValues = "FIRST_TRIAL_UNDER_REVIEW 材料初审中," + + "REEXAMINATION_UNDER_REVIEW 材料复核中," + + "FIRST_TRIAL_APPROVED 材料初审通过," + + "REEXAMINATION_APPROVED 材料复核通过," + + "FIRST_TRIAL_APPROVAL_REJECTION 材料初审驳回," + + "REEXAMINATION_APPROVAL_REJECTION 材料复核驳回") + private List metaApplyStatusList; + + @ApiModelProperty(value = "培训报名类型", allowableValues = "FORENSIC_REGISTRATION 取证报名,JOB_APPLICATION 跳槽申请,REPLACEMENT_REGISTRATION 换证报名,CONTINUING_EDUCATION 继续教育") + private TrainingRegistrationTypeEnum trainingRegistrationType; + + @ApiModelProperty("区域信息 regionId") + private Long regionId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverTrainingRegistrationPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverTrainingRegistrationPO.java new file mode 100644 index 0000000..703c582 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqDriverTrainingRegistrationPO.java @@ -0,0 +1,93 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.carapi.common.constant.DriverLicenseTypeEnum; +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.driver.constant.TrainingRegistrationTypeEnum; +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; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/9 下午5:50 + */ +@Data +@ApiModel(description = "驾驶员培训报名") +public class ReqDriverTrainingRegistrationPO { + + @ApiModelProperty("驾驶员id 驾驶员培训报名首次信息填入无需传入") + private Long driverId; + + @ApiModelProperty(value = "培训报名类型", allowableValues = "FORENSIC_REGISTRATION 取证报名,JOB_APPLICATION 申请跳槽,REPLACEMENT_REGISTRATION 换证报名,CONTINUING_EDUCATION 继续教育") + @NotNull(message = "培训报名类型不能为空") + private TrainingRegistrationTypeEnum trainingRegistrationType; + + @ApiModelProperty("驾驶员姓名") + @NotBlank(message = "驾驶员姓名不能为空") + private String driverName; + + @ApiModelProperty("性别 0:女 ,1:男 ") + @NotNull(message = "性别不能为空") + private Integer gender; + + @ApiModelProperty("身份证号") + @NotBlank(message = "身份证号不能为空") + private String idCard; + + @ApiModelProperty("出生年月") + @NotNull(message = "出生年月不能为空") + private LocalDateTime birth; + + @ApiModelProperty("籍贯") + @NotBlank(message = "籍贯不能为空") + private String nativePlace; + + @ApiModelProperty("籍贯") + @NotBlank(message = "籍贯编码") + private String nativePlaceRegionCode; + + @ApiModelProperty(value = "免冠照图片文件") + private FileBasicInfo avatarFile; + + @ApiModelProperty(value = "健康状况") + private String health; + + @ApiModelProperty("手机号码") + @NotBlank(message = "手机号码不能为空") + private String phoneNo; + + @ApiModelProperty("住址") + @NotBlank(message = "住址不能为空") + private String address; + + @ApiModelProperty("驾驶员证号") + private String driverLicenseNo; + + @ApiModelProperty(value = "驾驶证类型/准驾车型", allowableValues = "A1, A2, B1, B2, C1, OTHER") + private DriverLicenseTypeEnum driverLicenseType; + + @ApiModelProperty("初次领证时间") + @NotNull(message = "初次领证时间不能为空") + private LocalDateTime initialLicenseTime; + + @ApiModelProperty("附件") + private List appendixList; + + @ApiModelProperty("违规违法信息") + private String illegalAndIllegalInfo; + + @ApiModelProperty(value = "驾驶员拟驾车型列表", allowableValues = "MIXER 搅拌车,PUMP_TRUCK 泵车,BULK_CEMENT_TRUCK 散装水泥车" + + ",MORTAR_TRUCK 砂浆车,OTHER 其他") + private List motorcycleTypeList; + + @ApiModelProperty("培训报名id") + private Long trainingRegistrationReviewId; + + @ApiModelProperty("驾驶员用户ID") + private Long driverUserId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqGetArchivalInfoReviewDetailPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqGetArchivalInfoReviewDetailPO.java new file mode 100644 index 0000000..502be97 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqGetArchivalInfoReviewDetailPO.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.driver.model.po; + +import javax.validation.constraints.NotNull; + +import com.ningdatech.carapi.driver.constant.TrainingRegistrationTypeEnum; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/20 下午5:52 + */ + +@Data +@ApiModel(description = "获取驾驶员档案审核详情PO") +public class ReqGetArchivalInfoReviewDetailPO { + + @ApiModelProperty("驾驶员id") + @NotNull(message = "驾驶员id不能为空") + private Long driverId; + + @NotNull(message = "培训报名类型不能为空") + @ApiModelProperty(value = "培训报名类型", allowableValues = "FORENSIC_REGISTRATION 取证报名,JOB_APPLICATION 跳槽申请,REPLACEMENT_REGISTRATION 换证报名,CONTINUING_EDUCATION 继续教育") + private TrainingRegistrationTypeEnum trainingRegistrationType; + + @ApiModelProperty("培训报名id") + private Long trainingRegistrationReviewId; + + @ApiModelProperty("审核ID") + private Long metaApplyId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqListExamRecordPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqListExamRecordPO.java new file mode 100644 index 0000000..2929644 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqListExamRecordPO.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.carapi.driver.constant.ExamQualifiedEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/10/26 下午5:20 + */ +@ApiModel("培训考试记录筛选") +@Data +public class ReqListExamRecordPO extends PagePo { + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("所属企业") + private String companyName; + + @ApiModelProperty("考试结果") + private ExamQualifiedEnum isQualified; + + @ApiModelProperty("考试开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("考试结束时间") + private LocalDateTime endTime; + + @ApiModelProperty("所属区域id") + private Long regionId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqMakeUpExamPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqMakeUpExamPO.java new file mode 100644 index 0000000..df7172b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqMakeUpExamPO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.driver.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/10/24 上午11:01 + */ +@ApiModel("补考") +@Data +public class ReqMakeUpExamPO { + + @NotNull(message = "培训组织id 不能为空") + @ApiModelProperty("培训组织id") + private Long trainingOrganizationId; + + @NotNull(message = "驾驶员id 不能为空") + @ApiModelProperty("驾驶员id") + private Long driverId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqRegionStarPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqRegionStarPO.java new file mode 100644 index 0000000..ce7376f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqRegionStarPO.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/26 下午5:20 + */ +@ApiModel("省/市/区级星级筛选列表") +@Data +public class ReqRegionStarPO extends PagePo { + @ApiModelProperty("所属区域id") + private Long regionId; + private String dataScopeSql; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqSaveTrainingMaterialPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqSaveTrainingMaterialPO.java new file mode 100644 index 0000000..31225f5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqSaveTrainingMaterialPO.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.driver.constant.MaterialStatusEnum; +import com.ningdatech.carapi.driver.constant.MaterialTypeEnum; +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.util.List; + +/** + * @author liuxinxin + * @date 2022/10/21 下午5:01 + */ +@Data +@ApiModel(description = "创建培训材料入参PO") +public class ReqSaveTrainingMaterialPO { + + @ApiModelProperty("材料id 更新材料时传入") + private Long id; + + @NotBlank(message = "标题不能为空") + @ApiModelProperty("标题") + private String title; + + @NotNull(message = "材料类型 不能为空") + @ApiModelProperty("材料类型") + private MaterialTypeEnum materialType; + + @NotNull(message = "材料状态 不能为空") + @ApiModelProperty(value = "材料状态", allowableValues = "enable 启用,disable 禁用") + private MaterialStatusEnum materialStatus; + + @NotBlank(message = "内容 不能为空") + @ApiModelProperty("内容") + private String content; + + @ApiModelProperty("附件") + private List appendixList; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqScoreBonusPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqScoreBonusPO.java new file mode 100644 index 0000000..daa14d3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqScoreBonusPO.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.driver.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/11/4 上午9:49 + */ +@Data +@ApiModel("驾驶员奖励分数") +public class ReqScoreBonusPO { + + @NotNull + @ApiModelProperty("驾驶员id") + private Long driverId; + + @NotBlank + @ApiModelProperty("材料类型") + private String materialType; + + @NotNull + @ApiModelProperty("培训材料id") + private Long trainingMaterialId; + + @NotNull + @ApiModelProperty("培训组织id") + private Long trainingOrganizationId; + + @NotBlank + @ApiModelProperty(value = "行为类型", allowableValues = "watch_video 观看视频,watch_profile 观看材料") + private String behaviorType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqScoreListPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqScoreListPO.java new file mode 100644 index 0000000..733f7f2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqScoreListPO.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/11/9 上午9:28 + */ +@Data +@ApiModel("驾驶员分数列表请求PO") +public class ReqScoreListPO extends PagePo { + + @NotNull + @ApiModelProperty("驾驶员id") + private Long driverId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqSetExamTimePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqSetExamTimePO.java new file mode 100644 index 0000000..dca61af --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqSetExamTimePO.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.driver.model.po; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +import javax.validation.constraints.NotNull; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/26 下午4:22 + */ +@Data +@ApiModel("设置考试时间") +public class ReqSetExamTimePO implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull + @ApiModelProperty("培训组织ID") + private Long trainingOrganizationId; + + @NotNull + @ApiModelProperty("随机试卷ID集合") + private List randomExamPaperId; + + @NotNull + @ApiModelProperty("考试开始日期") + private LocalDateTime examStartTime; + + @NotNull + @ApiModelProperty("考试结束时间") + private LocalDateTime examEndTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqTrainerExportPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqTrainerExportPO.java new file mode 100644 index 0000000..5e11cfe --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqTrainerExportPO.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.driver.model.po; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/26 下午4:22 + */ +@Data +@ApiModel("导出培训人员信息") +public class ReqTrainerExportPO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("培训组织ID") + private Long trainingOrganizationId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqTrainingMaterialListPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqTrainingMaterialListPO.java new file mode 100644 index 0000000..6c85bb9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqTrainingMaterialListPO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.carapi.driver.constant.MaterialTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/9 下午3:36 + */ +@Data +@ApiModel(description = "驾驶员培训材料分页查询入参") +public class ReqTrainingMaterialListPO extends PagePo { + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("材料类型") + private MaterialTypeEnum materialType; + + @ApiModelProperty("所属区域") + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqTrainingOrganizationListPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqTrainingOrganizationListPO.java new file mode 100644 index 0000000..3889337 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqTrainingOrganizationListPO.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.carapi.driver.constant.TrainingModeEnum; +import com.ningdatech.carapi.driver.constant.TrainingTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/11 上午10:25 + */ +@Data +@ApiModel(description = "培训组织列表查询PO") +public class ReqTrainingOrganizationListPO extends PagePo { + + @ApiModelProperty("培训主题") + private String trainingTopic; + + @ApiModelProperty("培训地点") + private String address; + + /** + * 培训模式 线上/线下 + * {@link TrainingModeEnum} + */ + @ApiModelProperty(value = "培训模式 线上/线下", allowableValues = "online,offline") + private TrainingModeEnum trainingMode; + + @ApiModelProperty("培训区域id") + private Long regionId; + + /** + * 培训类型 取证培训/继续教育/换证培训/转码培训 + * {@link TrainingTypeEnum} + */ + @ApiModelProperty(value = "培训类型 取证培训/继续教育/换证培训/转码培训", allowableValues = "forensic_registration_training 取证报名,replacement_registration_training 换证报名 ,continuing_education_training 继续教育,transcoding_training 转码培训") + private List trainingTypeList; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqTrainingOrganizationStatusModifyPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqTrainingOrganizationStatusModifyPO.java new file mode 100644 index 0000000..83a9db6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqTrainingOrganizationStatusModifyPO.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.carapi.driver.constant.TrainingStatusEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/10/31 下午2:44 + */ +@Data +@ApiModel("培训组织") +public class ReqTrainingOrganizationStatusModifyPO { + /** + * 培训状态 启用/禁用 + * {@link TrainingStatusEnum} + */ + @NotNull(message = "培训状态不能为空") + @ApiModelProperty(value = "培训状态", allowableValues = "enable 启用,disable 禁用") + private TrainingStatusEnum trainingStatus; + + @NotNull(message = "培训状态不能为空") + @ApiModelProperty(value = "培训组织id") + private Long organizationId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqUploadCertificatePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqUploadCertificatePO.java new file mode 100644 index 0000000..e358123 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqUploadCertificatePO.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.driver.model.po; + +import com.ningdatech.carapi.driver.constant.TrainingTypeEnum; +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; + +/** + * @author liuxinxin + * @date 2022/10/26 下午4:22 + */ +@Data +@ApiModel("上传合格证") +public class ReqUploadCertificatePO { + + private static final long serialVersionUID = 1L; + + @NotNull + @ApiModelProperty("驾驶员id") + private Long driverId; + + @NotBlank + @ApiModelProperty("合格证编号") + private String certificateNo; + + @NotBlank + @ApiModelProperty("发证单位") + private String issuedBy; + + @NotNull + @ApiModelProperty("发证日期") + private LocalDateTime issueDate; + + @NotNull + @ApiModelProperty("有效期至") + private LocalDateTime expiryDate; + + @ApiModelProperty("备注") + private String remark; + + /** + * 培训类型 取证培训/继续教育/换证培训/转码培训 + * {@link TrainingTypeEnum} + */ + @NotNull(message = "培训类型不能为空") + @ApiModelProperty(value = "考试类型 取证培训/继续教育/换证培训/转码培训", + allowableValues = "forensic_registration_training 取证报名," + + "replacement_registration_training 换证报名 ," + + "continuing_education_training 继续教育," + + "transcoding_training 转码培训") + private String examType; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqUploadExamResultPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqUploadExamResultPO.java new file mode 100644 index 0000000..1038156 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/po/ReqUploadExamResultPO.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.driver.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/10/24 上午11:01 + */ +@ApiModel("上传考试结果PO") +@Data +public class ReqUploadExamResultPO { + + @NotNull(message = "培训组织id 不能为空") + @ApiModelProperty("培训组织id") + private Long trainingOrganizationId; + + @NotNull(message = "驾驶员id 不能为空") + @ApiModelProperty("驾驶员id") + private Long driverId; + + @NotNull(message = "考试分数 不能为空") + @ApiModelProperty("考试分数") + private Integer score; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/query/ArchivalInfoListQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/query/ArchivalInfoListQuery.java new file mode 100644 index 0000000..74a2d38 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/query/ArchivalInfoListQuery.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.driver.model.query; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/9 上午11:14 + */ +@Data +public class ArchivalInfoListQuery { + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/query/TrainingOrgTrainersQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/query/TrainingOrgTrainersQuery.java new file mode 100644 index 0000000..897a0b8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/query/TrainingOrgTrainersQuery.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.driver.model.query; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * 培训组织培训人员查询参数 + * + * @author CMM + * @since 2023/02/21 17:17 + */ +@Data +public class TrainingOrgTrainersQuery extends PagePo { + + @ApiModelProperty("培训组织id") + private Long trainingOrganizationId; + + @ApiModelProperty("培训类型") + @NotNull(message = "请选择培训类型!") + private String trainingRegistrationType; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("企业") + private String companyName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/BehaviourAnalysisVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/BehaviourAnalysisVO.java new file mode 100644 index 0000000..24ad921 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/BehaviourAnalysisVO.java @@ -0,0 +1,82 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.constant.BgTypeEnum; +import com.ningdatech.carapi.common.model.FileBasicInfo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author CMM + * @Classname SecurityMonitorJoin + * @Description + * @Date 2022/11/6 20:59 + */ +@Data +public class BehaviourAnalysisVO implements Serializable { + + private static final long serialVersionUID = 4403907708033803066L; + + @ApiModelProperty("告警事件id") + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("驾驶员ID") + private Long driverId; + + /** + * {@link BgTypeEnum} + */ + @ApiModelProperty("告警类型") + private Integer alarmType; + + @ApiModelProperty("告警类型名称") + private String alarmTypeName; + + @ApiModelProperty(value = "告警级别",allowableValues = "1 预警,2 报警") + private Integer alarmLevel; + + @ApiModelProperty("告警级别名称") + private String alarmLevelName; + + @ApiModelProperty("车辆速度") + private BigDecimal speed; + + @ApiModelProperty("告警时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime alarmTime; + + @ApiModelProperty("告警地址") + private String alarmAddress; + + @ApiModelProperty("告警图片|视频附件") + private List alarmAppendix; + + @ApiModelProperty(value = "处理状态",allowableValues = "0 待处理,1 已处理") + private Integer processingStatus; + + @ApiModelProperty(value = "督办状态",allowableValues = "0 待督办,1 已督办") + private Integer overseeStatus; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/DriverAbnormalBehaviorAnalysisDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/DriverAbnormalBehaviorAnalysisDetailVO.java new file mode 100644 index 0000000..6656e60 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/DriverAbnormalBehaviorAnalysisDetailVO.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.driver.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author CMM + * @description + * @since 2022/12/07 10:58 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DriverAbnormalBehaviorAnalysisDetailVO { + + @ApiModelProperty("异常行为数据ID") + private Long id; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("告警类型名称") + private String alarmTypeName; + + @ApiModelProperty("告警类型") + private Integer alarmType; + + @ApiModelProperty("告警级别") + private String alarmLevel; + + @ApiModelProperty("车速") + private Integer speed; + + @ApiModelProperty("告警时间") + private LocalDateTime alarmTime; + + @ApiModelProperty("告警地址") + private String alarmAddress; + + @ApiModelProperty("告警图片附件") + private String alarmPictureAppendix; + + @ApiModelProperty("告警视频附件") + private String alarmVideoAppendix; + + @ApiModelProperty("驾驶员当日告警事件列表") + private List alarmEventList; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/DriverDailyAlarmEvent.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/DriverDailyAlarmEvent.java new file mode 100644 index 0000000..a494573 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/DriverDailyAlarmEvent.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.model.FileBasicInfo; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author CMM + * @description + * @since 2022/12/07 11:09 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DriverDailyAlarmEvent { + + @ApiModelProperty("告警ID") + private Integer id; + + @ApiModelProperty("告警类型") + private Integer alarmType; + + @ApiModelProperty("告警类型名称") + private String alarmTypeName; + + @ApiModelProperty("告警时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime alarmTime; + + @ApiModelProperty("告警附件") + private List alarmAppendix; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/OrganizationTrainingTrainersInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/OrganizationTrainingTrainersInfo.java new file mode 100644 index 0000000..a0c0d00 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/OrganizationTrainingTrainersInfo.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.ningdatech.carapi.driver.constant.ExaminationStatusEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/22 下午4:22 + */ +@Data +@ApiModel("培训人员 包含培训记录") +public class OrganizationTrainingTrainersInfo { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("驾驶员用户id") + private Long driverUserId; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("分数") + private Integer score; + + @ApiModelProperty("是否合格") + private String isQualified; + + @ApiModelProperty("试卷id") + private Long examPaperId; + + @ApiModelProperty("试卷名称") + private String examPaperName; + + @ApiModelProperty("准考证号") + private String examRegistrationNo; + + /** + * {@link ExaminationStatusEnum} + */ + @ApiModelProperty("考试状态") + private ExaminationStatusEnum examinationStatus; + + @ApiModelProperty("公司id") + private Long companyId; + + @ApiModelProperty("公司名称") + private String companyName; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResArchivalInfoDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResArchivalInfoDetailVO.java new file mode 100644 index 0000000..3e24e31 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResArchivalInfoDetailVO.java @@ -0,0 +1,126 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.constant.DriverLicenseTypeEnum; +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.driver.constant.TrainingRegistrationTypeEnum; +import com.ningdatech.carapi.driver.model.po.AuditInfo; +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; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/9 上午10:51 + */ +@Data +@ApiModel("驾驶员信息档案查询详情VO") +public class ResArchivalInfoDetailVO { + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("驾驶员姓名") + @NotBlank(message = "驾驶员姓名不能为空") + private String driverName; + + @ApiModelProperty("性别 0:女 ,1:男 ") + @NotNull(message = "性别不能为空") + private Integer gender; + + @ApiModelProperty("身份证号") + @NotBlank(message = "身份证号不能为空") + private String idCard; + + @ApiModelProperty("出生年月") + @NotNull(message = "出生年月不能为空") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime birth; + + @ApiModelProperty("籍贯") + @NotBlank(message = "籍贯不能为空") + private String nativePlace; + + @ApiModelProperty(value = "免冠照图片文件") + private FileBasicInfo avatarFile; + + @ApiModelProperty(value = "健康状况") + private String health; + + @ApiModelProperty("手机号码") + @NotBlank(message = "手机号码不能为空") + private String driverPhoneNo; + + @ApiModelProperty("住址") + @NotBlank(message = "住址不能为空") + private String driverAddress; + + @ApiModelProperty("驾驶员证号") + private String driverLicenseNo; + + @ApiModelProperty("驾驶证类型/准驾车型") + private DriverLicenseTypeEnum driverLicenseType; + + @NotBlank(message = "公司id不能为空") + @ApiModelProperty("所属服务企业唯一标识id") + private Long companyId; + + @ApiModelProperty(value = "企业名称") + private String companyName; + + @ApiModelProperty(value = "企业地址") + private String companyAddress; + + @ApiModelProperty(value = "企业联系人") + private String companyContactPerson; + + @ApiModelProperty(value = "企业电话") + private String companyContactPhone; + + @ApiModelProperty("附件") + private List appendixList; + + @ApiModelProperty(value = "初审信息") + private AuditInfo preliminaryReviewInfo; + + @ApiModelProperty(value = "复审信息") + private AuditInfo reviewInfo; + + @ApiModelProperty(value = "培训报名类型", allowableValues = "FORENSIC_REGISTRATION 取证报名,REPLACEMENT_REGISTRATION 换证报名,CONTINUING_EDUCATION 继续教育") + @NotNull(message = "培训报名类型不能为空") + private TrainingRegistrationTypeEnum trainingRegistrationType; + + + @ApiModelProperty("初次领证时间") + @NotNull(message = "初次领证时间不能为空") + private LocalDateTime initialLicenseTime; + + @ApiModelProperty("违规违法信息") + private String illegalAndIllegalInfo; + + @ApiModelProperty("籍贯") + @NotBlank(message = "籍贯编码") + private String nativePlaceRegionCode; + + @ApiModelProperty(value = "驾驶员拟驾车型列表", allowableValues = "MIXER 搅拌车,PUMP_TRUCK 泵车,BULK_CEMENT_TRUCK 散装水泥车" + + ",MORTAR_TRUCK 砂浆车,OTHER 其他") + private List motorcycleTypeList; + + @ApiModelProperty("意向跳槽企业ID") + private Long jobChangeCompanyId; + + @ApiModelProperty("意向跳槽企业名称") + private String jobChangeCompanyName; + + @ApiModelProperty("培训合格证编号") + private String certificateNo; + + @ApiModelProperty("驾驶员用户ID") + private Long driverUserId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResArchivalInfoSearchListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResArchivalInfoSearchListVO.java new file mode 100644 index 0000000..c4122f7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResArchivalInfoSearchListVO.java @@ -0,0 +1,68 @@ +package com.ningdatech.carapi.driver.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/9 上午10:51 + */ +@Data +@ApiModel("驾驶员信息档案查询返回列表VO") +public class ResArchivalInfoSearchListVO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("服务企业唯一标识id") + private Long companyId; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("手机号码") + private String phoneNo; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + @ApiModelProperty(value = "驾驶员状态", + allowableValues = " induction 入职,quit 离职") + private String driverStatus; + + @ApiModelProperty("系统用户ID") + private Long driverUserId; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("离职时间") + private LocalDateTime quitTime; + + @ApiModelProperty("入职时间") + private LocalDateTime inductionTime; + + @ApiModelProperty("驾驶员合格证") + private String certificateNo; + + @ApiModelProperty("驾驶证号") + private String driverLicenseNo; + + @ApiModelProperty("驾驶证类型") + private String driverLicenseType; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResArticleInfoListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResArticleInfoListVO.java new file mode 100644 index 0000000..13831b2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResArticleInfoListVO.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.ningdatech.carapi.driver.constant.ArticleTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/10/9 下午4:54 + */ +@Data +@ApiModel(description = "文章列表查询") +public class ResArticleInfoListVO { + + @ApiModelProperty("文章id") + private Long articleId; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("文章类型") + private ArticleTypeEnum articleType; + + @ApiModelProperty("制定时间") + private LocalDateTime formulationTime; + + @ApiModelProperty("文章状态") + private String articleStatus; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResCertificateVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResCertificateVO.java new file mode 100644 index 0000000..d6f89f2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResCertificateVO.java @@ -0,0 +1,79 @@ +package com.ningdatech.carapi.driver.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/11/3 上午11:38 + */ +@Data +@ApiModel("合格证详情VO") +public class ResCertificateVO { + + @ApiModelProperty("驾驶员合格证表id") + private Long id; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("驾驶员用户id") + private Long userId; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("出生年月") + private LocalDateTime birth; + + @ApiModelProperty("性别") + private Integer gender; + + @ApiModelProperty("籍贯") + private String nativePlace; + + @ApiModelProperty("健康状况") + private String health; + + @ApiModelProperty("手机号码") + private String phoneNo; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("住址") + private String address; + + @ApiModelProperty("驾驶证类型") + private String driverLicenseType; + + @ApiModelProperty("驾驶证号") + private String driverLicenseNo; + + @ApiModelProperty("合格证编号") + private String certificateNo; + + @ApiModelProperty("发证单位") + private String issuedBy; + + @ApiModelProperty("发证日期") + private LocalDateTime issueDate; + + @ApiModelProperty("有效期至") + private LocalDateTime expiryDate; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("公司id") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResCompanyStarListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResCompanyStarListVO.java new file mode 100644 index 0000000..7b8a903 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResCompanyStarListVO.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.ningdatech.carapi.driver.model.StarManageDisplayInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/26 下午5:20 + */ +@ApiModel("公司星级筛选VO") +@Data +public class ResCompanyStarListVO { + + @ApiModelProperty("平均分数") + private Double totalAvgStar; + + @ApiModelProperty("总分数") + private Double totalStar; + + @ApiModelProperty("展示行列表") + private StarManageDisplayInfo record; + + //@ApiModelProperty("总数") + //private Long total; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResCreateTrainingOrgVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResCreateTrainingOrgVO.java new file mode 100644 index 0000000..da1bcc5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResCreateTrainingOrgVO.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.ningdatech.carapi.driver.model.TrainingBasicInfo; +import com.ningdatech.carapi.driver.model.TrainingExamPaperInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/21 下午2:52 + */ +@Data +@ApiModel("创建培训组织请求返回VO") +public class ResCreateTrainingOrgVO { + + @ApiModelProperty("培训组织id") + private Long trainingOrganizationId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResCurrentUserOrganizationVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResCurrentUserOrganizationVO.java new file mode 100644 index 0000000..a2f4a59 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResCurrentUserOrganizationVO.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.ningdatech.carapi.driver.constant.CurrentUserOrganizationEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/11/3 下午6:25 + */ +@Data +@ApiModel +public class ResCurrentUserOrganizationVO { + + @ApiModelProperty("培训组织id") + private Long trainingOrganizationId; + + @ApiModelProperty("参与状态") + private CurrentUserOrganizationEnum status; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverBlackListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverBlackListVO.java new file mode 100644 index 0000000..6cfce76 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverBlackListVO.java @@ -0,0 +1,52 @@ +package com.ningdatech.carapi.driver.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/9 下午1:59 + */ + +@Data +@ApiModel(description = "驾驶员黑名单列表展示VO") +public class ResDriverBlackListVO { + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("所属企业id") + private Long companyId; + + @ApiModelProperty("所属企业") + private String companyName; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("年度") + private String year; + + @ApiModelProperty("超速累计次数") + private Long accumulatedOverspeedCnt; + + @ApiModelProperty("出险累计次数") + private Long accumulatedAccidentsCnt; + + @ApiModelProperty("违章累计次数") + private Long accumulatedViolationsCnt; + + @ApiModelProperty("累计伤人次数") + private Long accumulatedHurtCnt; + + @ApiModelProperty("累计亡人次数") + private Long accumulatedDeathCnt; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverScoreRecordListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverScoreRecordListVO.java new file mode 100644 index 0000000..30358e4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverScoreRecordListVO.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/11/3 下午4:53 + */ +@Data +@ApiModel("驾驶员分数记录") +public class ResDriverScoreRecordListVO { + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + @ApiModelProperty("用户id") + private Long userId; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("操作分数") + private Integer operateScore; + + @ApiModelProperty("操作类型 加分减分") + private String operateType; + + @ApiModelProperty("加分减分原因") + private String operateReason; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverStarListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverStarListVO.java new file mode 100644 index 0000000..d6e0489 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverStarListVO.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.driver.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/26 下午5:20 + */ +@ApiModel("驾驶员星级列表VO") +@Data +public class ResDriverStarListVO { + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("区域") + private String regionName; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("公司id") + private Long companyId; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("受伤人数") + private Integer injuredCnt; + + @ApiModelProperty("事故次数") + private Integer accidentsCnt; + + @ApiModelProperty("出险次数") + private Integer insuranceCnt; + + @ApiModelProperty("死亡人数") + private Integer deathCnt; + + @ApiModelProperty("当前星级") + private Double currentStar; + + @ApiModelProperty("扣除星级") + private Double deductStar; + + @ApiModelProperty("当前分值") + private Integer currentScore; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverTrainingListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverTrainingListVO.java new file mode 100644 index 0000000..123f4aa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverTrainingListVO.java @@ -0,0 +1,51 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.ningdatech.carapi.driver.constant.TrainingModeEnum; +import com.ningdatech.carapi.driver.constant.TrainingTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/11/9 上午9:09 + */ +@Data +@ApiModel("驾驶员培训记录列表VO") +public class ResDriverTrainingListVO { + + @ApiModelProperty("培训组织id") + private Long organizationId; + + @ApiModelProperty("培训主题") + private String trainingTopic; + + @ApiModelProperty("培训开始时间") + private LocalDateTime trainingStartTime; + + @ApiModelProperty("培训结束时间") + private LocalDateTime trainingEndTime; + + @ApiModelProperty("培训地点") + private String address; + + /** + * 培训模式 线上/线下 + * {@link TrainingModeEnum} + */ + @ApiModelProperty(value = "培训模式 线上/线下", allowableValues = "online,offline") + private TrainingModeEnum trainingMode; + + /** + * 培训类型 取证培训/继续教育/换证培训/转码培训 + * {@link TrainingTypeEnum} + */ + @ApiModelProperty(value = "培训类型 取证培训/继续教育/换证培训/转码培训", allowableValues = "forensic_registration_training 取证报名,replacement_registration_training 换证报名 ,continuing_education_training 继续教育,transcoding_training 转码培训") + private TrainingTypeEnum trainingType; + + @ApiModelProperty("是否合格") + private String isQualified; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverTrainingRegistrationListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverTrainingRegistrationListVO.java new file mode 100644 index 0000000..b21d163 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResDriverTrainingRegistrationListVO.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.ningdatech.carapi.driver.constant.TrainingRegistrationTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/10/12 下午5:19 + */ + +@Data +@ApiModel(description = "培训报名列表筛选") +public class ResDriverTrainingRegistrationListVO { + + @ApiModelProperty("培训报名id") + private Long trainingRegistrationReviewId; + + @ApiModelProperty("初审复审关联id") + private Long preliminaryReviewAssociatedId; + + @ApiModelProperty("meta审核id") + private Long metaApplyId; + + @ApiModelProperty(value = "meta审核状态", + allowableValues = "FIRST_TRIAL_UNDER_REVIEW 材料初审中," + + "REEXAMINATION_UNDER_REVIEW 材料复核中," + + "FIRST_TRIAL_APPROVED 材料初审通过," + + "REEXAMINATION_APPROVED 材料复核通过," + + "FIRST_TRIAL_APPROVAL_REJECTION 材料初审驳回," + + "REEXAMINATION_APPROVAL_REJECTION 材料复核驳回") + private String metaApplyStatus; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("手机号码") + private String phoneNo; + + @ApiModelProperty("所属企业id") + private Long companyId; + + @ApiModelProperty("所属企业名称") + private String companyName; + + @ApiModelProperty("所属区域id") + private Long regionId; + + @ApiModelProperty("所属区域展示名称") + private String regionName; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + @ApiModelProperty(value = "培训报名类型", allowableValues = "FORENSIC_REGISTRATION 取证报名,REPLACEMENT_REGISTRATION 换证报名,CONTINUING_EDUCATION 继续教育") + @NotNull(message = "培训报名类型不能为空") + private TrainingRegistrationTypeEnum trainingRegistrationType; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResListExamRecordVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResListExamRecordVO.java new file mode 100644 index 0000000..fe586ca --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResListExamRecordVO.java @@ -0,0 +1,60 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.ningdatech.carapi.driver.constant.ExamQualifiedEnum; +import com.ningdatech.carapi.driver.constant.TrainingTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2022/10/26 下午5:20 + */ +@ApiModel("培训考试记录筛选VO") +@Data +public class ResListExamRecordVO { + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("驾驶员用户id") + private String driverUserId; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("所属企业id") + private Long companyId; + + @ApiModelProperty("所属企业") + private String companyName; + + @ApiModelProperty("考试结果") + private ExamQualifiedEnum isQualified; + + @ApiModelProperty("考试分") + private Integer score; + + @ApiModelProperty("考试时间") + private LocalDateTime examTime; + + @ApiModelProperty("所属区域id") + private Long regionId; + + @ApiModelProperty("所属区域") + private String regionName; + + /** + * 培训类型 取证培训/继续教育/换证培训/转码培训 + * {@link TrainingTypeEnum} + */ + @NotNull(message = "培训类型不能为空") + @ApiModelProperty(value = "考试类型 取证培训/继续教育/换证培训/转码培训", allowableValues = "forensic_registration_training 取证报名,replacement_registration_training 换证报名 ,continuing_education_training 继续教育,transcoding_training 转码培训") + private String examType; + + @ApiModelProperty("驾驶员合格证编号") + private String certificateNo; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResRegionStarVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResRegionStarVO.java new file mode 100644 index 0000000..efaab0a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResRegionStarVO.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.ningdatech.carapi.driver.model.StarManageDisplayInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/26 下午5:20 + */ +@ApiModel("驾驶员星级筛选列表") +@Data +public class ResRegionStarVO { + + @ApiModelProperty("平均分数") + private Double totalAvgStar; + + @ApiModelProperty("总分数") + private Double totalStar; + + @ApiModelProperty("展示记录") + private StarManageDisplayInfo record; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResSaveTrainingMaterialVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResSaveTrainingMaterialVO.java new file mode 100644 index 0000000..6f66e87 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResSaveTrainingMaterialVO.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.driver.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/21 下午5:01 + */ +@Data +@ApiModel(description = "创建培训材料返回参数VO") +public class ResSaveTrainingMaterialVO { + + @ApiModelProperty("培训材料id") + private Long trainingMaterialId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingMaterialListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingMaterialListVO.java new file mode 100644 index 0000000..230b3f7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingMaterialListVO.java @@ -0,0 +1,51 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.driver.constant.MaterialStatusEnum; +import com.ningdatech.carapi.driver.constant.MaterialTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/9 下午3:47 + */ + +@Data +@ApiModel(description = "驾驶员培训材料分页查询列表VO") +public class ResTrainingMaterialListVO { + + @ApiModelProperty("培训材料id") + private Long trainingMaterialId; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("材料类型") + private MaterialTypeEnum materialType; + + @ApiModelProperty(value = "材料状态", allowableValues = "enable 启用,disable 禁用") + private MaterialStatusEnum materialStatus; + + @ApiModelProperty(value = "所属区域") + private String regionName; + + @ApiModelProperty(value = "regionId") + private Long regionId; + + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; + + @NotBlank(message = "内容 不能为空") + @ApiModelProperty("内容") + private String content; + + @ApiModelProperty("附件") + private List appendixList; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingMaterialVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingMaterialVO.java new file mode 100644 index 0000000..42ccf2b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingMaterialVO.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.ningdatech.carapi.common.model.FileBasicInfo; +import com.ningdatech.carapi.driver.constant.MaterialStatusEnum; +import com.ningdatech.carapi.driver.constant.MaterialTypeEnum; +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.util.List; + +/** + * @author liuxinxin + * @date 2022/10/21 下午5:01 + */ +@Data +@ApiModel(description = "培训材料详情VO") +public class ResTrainingMaterialVO { + + @ApiModelProperty("id") + private Long id; + + @NotBlank(message = "标题不能为空") + @ApiModelProperty("标题") + private String title; + + @NotNull(message = "材料类型 不能为空") + @ApiModelProperty("材料类型") + private MaterialTypeEnum materialType; + + @NotNull(message = "材料状态 不能为空") + @ApiModelProperty(value = "材料状态", allowableValues = "enable 启用,disable 禁用") + private MaterialStatusEnum materialStatus; + + @NotBlank(message = "内容 不能为空") + @ApiModelProperty("内容") + private String content; + + @ApiModelProperty("附件") + private List appendixList; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingOrgTrainerVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingOrgTrainerVO.java new file mode 100644 index 0000000..ddd7ea5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingOrgTrainerVO.java @@ -0,0 +1,41 @@ +package com.ningdatech.carapi.driver.model.vo; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 培训组织培训人员实体类 + * + * @author CMM + * @since 2023/02/21 16:46 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ResTrainingOrgTrainerVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("驾驶员id") + private Long driverId; + + @ApiModelProperty("驾驶员姓名") + private String driverName; + + @ApiModelProperty("驾驶员用户id") + private Long driverUserId; + + @ApiModelProperty("公司id") + private Long companyId; + + @ApiModelProperty("公司名称") + private String companyName; + + @ApiModelProperty("证件是否到期") + private Boolean certificateExpireFlag; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingOrganizationDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingOrganizationDetailVO.java new file mode 100644 index 0000000..a82e976 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingOrganizationDetailVO.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.ningdatech.carapi.driver.model.TrainingBasicInfo; +import com.ningdatech.carapi.driver.model.TrainingExamPaperInfo; +import com.ningdatech.carapi.driver.model.TrainingMaterialOverviewInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/11 上午10:53 + */ + +@Data +@ApiModel(description = "培训组织详情VO") +public class ResTrainingOrganizationDetailVO { + @ApiModelProperty("培训基础信息") + private TrainingBasicInfo trainingBasicInfo; + + @ApiModelProperty("培训资料") + private TrainingMaterialOverviewInfo trainingMaterialOverviewInfo; + + @ApiModelProperty("培训考试试卷") + private TrainingExamPaperInfo trainingExamPaperInfo; + + @ApiModelProperty("培训人员") + private List trainingTrainersInfoList; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingOrganizationListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingOrganizationListVO.java new file mode 100644 index 0000000..df7a9cd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/ResTrainingOrganizationListVO.java @@ -0,0 +1,91 @@ +package com.ningdatech.carapi.driver.model.vo; + +import java.time.LocalDateTime; +import java.util.List; + +import javax.validation.constraints.NotNull; + +import com.ningdatech.carapi.driver.constant.TrainingModeEnum; +import com.ningdatech.carapi.driver.constant.TrainingStatusEnum; +import com.ningdatech.carapi.driver.constant.TrainingTypeEnum; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/11 上午10:25 + */ +@Data +@ApiModel(description = "培训组织列表查询展示VO") +public class ResTrainingOrganizationListVO { + + @ApiModelProperty("培训组织id") + private Long trainingOrganizationId; + + @ApiModelProperty("培训主题") + private String trainingTopic; + + @ApiModelProperty("培训地点") + private String address; + + @ApiModelProperty("培训开始时间") + private LocalDateTime trainingStartTime; + + @ApiModelProperty("培训结束时间") + private LocalDateTime trainingEndTime; + + @ApiModelProperty("区域id") + private Long regionId; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + /** + * 培训模式 线上/线下 + * {@link TrainingModeEnum} + */ + @ApiModelProperty(value = "培训模式 线上/线下", allowableValues = "online,offline") + private TrainingModeEnum trainingMode; + + /** + * 培训类型 取证培训/继续教育/换证培训/转码培训 + * {@link TrainingTypeEnum} + */ + @ApiModelProperty(value = "培训类型 取证培训/继续教育/换证培训/转码培训", allowableValues = "forensic_registration_training 取证报名,replacement_registration_training 换证报名 ,continuing_education_training 继续教育,transcoding_training 转码培训") + private TrainingTypeEnum trainingType; + + /** + * 培训状态 启用/禁用 + * {@link TrainingStatusEnum} + */ + @NotNull(message = "培训状态不能为空") + @ApiModelProperty(value = "培训状态", allowableValues = "enable 启用,disable 禁用") + private TrainingStatusEnum trainingStatus; + + /** + * 是否可以设置考试时间 + */ + private Boolean canSetExamTime = Boolean.FALSE; + + /** + * 考试试卷ID + */ + private List examPaperId; + + /** + * 考试试卷名称 + */ + private List examPaperName; + + @ApiModelProperty("考试开始时间") + private LocalDateTime examStartTime; + + @ApiModelProperty("考试结束时间") + private LocalDateTime examEndTime; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/StarManageDisplay.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/StarManageDisplay.java new file mode 100644 index 0000000..3da06df --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/model/vo/StarManageDisplay.java @@ -0,0 +1,26 @@ +package com.ningdatech.carapi.driver.model.vo; + +import com.ningdatech.carapi.driver.constant.StarManageDisplayTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/11/15 下午2:18 + */ + +@Data +@ApiModel("星级管理展示类") +public class StarManageDisplay { + + @ApiModelProperty("展示名称") + private String displayName; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("展示字段类型") + private StarManageDisplayTypeEnum type; +} + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IArticleInfoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IArticleInfoService.java new file mode 100644 index 0000000..296db54 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IArticleInfoService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.service; + +import com.ningdatech.carapi.driver.entity.ArticleInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +public interface IArticleInfoService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IBehaviorAnalysisProcessingModeService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IBehaviorAnalysisProcessingModeService.java new file mode 100644 index 0000000..9387014 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IBehaviorAnalysisProcessingModeService.java @@ -0,0 +1,11 @@ +package com.ningdatech.carapi.driver.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.driver.entity.BehaviorAnalysisProcessingMode; + +/** + * @author CMM + * @since 2022/12/14 17:56 + */ +public interface IBehaviorAnalysisProcessingModeService extends IService { +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IBehaviourAnalysisService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IBehaviourAnalysisService.java new file mode 100644 index 0000000..7f571f9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IBehaviourAnalysisService.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.driver.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.driver.entity.DriverAbnormalBehaviorAnalysis; +import com.ningdatech.carapi.driver.entity.DriverAbnormalBehaviorAnalysisOverseeDTO; +import com.ningdatech.carapi.driver.model.po.AlarmWarnFilePO; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +public interface IBehaviourAnalysisService extends IService { + + Page pageBehaviour(Page page, LambdaQueryWrapper wrapper); + + DriverAbnormalBehaviorAnalysis getOneBehaviour(LambdaQueryWrapper wrapper); + + List selectDriverAbnormalBehaviorAnalysisData(long index); + + Boolean oversee(DriverAbnormalBehaviorAnalysisOverseeDTO param, Long userId); + + List selectDriverAbnormalBehaviorAnalysisAppendixData(List alarmMsgSnList); + + Long selectOneByAlarmMsgSn(Integer alarmMsgSn); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ICertificateService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ICertificateService.java new file mode 100644 index 0000000..dc479e1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ICertificateService.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.driver.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ningdatech.carapi.driver.entity.Certificate; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-24 + */ +public interface ICertificateService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverBlackListService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverBlackListService.java new file mode 100644 index 0000000..bc3c937 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverBlackListService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.service; + +import com.ningdatech.carapi.driver.entity.DriverBlackList; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +public interface IDriverBlackListService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverInfoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverInfoService.java new file mode 100644 index 0000000..302789c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverInfoService.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.driver.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.common.model.po.MapDataPO; +import com.ningdatech.carapi.driver.entity.DriverInfo; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + *

+ * 服务类 + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +public interface IDriverInfoService extends IService { + + Map listDriverInfoByIds(Collection ids); + + /** + * 驾驶员年龄分布计算 + * + * @param caseSql 年龄区间计算SQL + * @param undefinedAge 不参与统计的年龄 + * @param param + * @return key 年龄、value 驾驶员数量 + * @author WendyYang + **/ + Map driverAgeStatistics(String caseSql, Integer undefinedAge, DataScreenParam param); + + /** + * 驾驶员驾龄分布计算 + * + * @param caseSql 驾龄区间计算SQL + * @param undefinedAge 不参与统计的驾龄 + * @param param + * @return key 驾龄、value 驾驶员数量 + * @author WendyYang + **/ + Map drivingExperienceStatistics(String caseSql, Integer undefinedAge,DataScreenParam param); + + Long selectUserIdById(Long driverId); + + Map listByIdCard(List idCards); + + List diverCountByRegion(DataScreenParam param); + + List> nativePlaceStatisticsByRegion(DataScreenParam param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverScoreInfoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverScoreInfoService.java new file mode 100644 index 0000000..e47a283 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverScoreInfoService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.service; + +import com.ningdatech.carapi.driver.entity.DriverScoreInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-27 + */ +public interface IDriverScoreInfoService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverScoreRecordService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverScoreRecordService.java new file mode 100644 index 0000000..2c7c452 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverScoreRecordService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.service; + +import com.ningdatech.carapi.driver.entity.DriverScoreRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-27 + */ +public interface IDriverScoreRecordService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverWorkRecordService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverWorkRecordService.java new file mode 100644 index 0000000..4d56e80 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IDriverWorkRecordService.java @@ -0,0 +1,8 @@ +package com.ningdatech.carapi.driver.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.driver.entity.DriverWorkRecordInfo; + +public interface IDriverWorkRecordService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IExamRecordDetailService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IExamRecordDetailService.java new file mode 100644 index 0000000..90fa749 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IExamRecordDetailService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.service; + +import com.ningdatech.carapi.driver.entity.ExamRecordDetail; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-26 + */ +public interface IExamRecordDetailService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IExamRecordService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IExamRecordService.java new file mode 100644 index 0000000..b1dc671 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IExamRecordService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.service; + +import com.ningdatech.carapi.driver.entity.ExamRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-26 + */ +public interface IExamRecordService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IStarManageService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IStarManageService.java new file mode 100644 index 0000000..3fd7f5a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/IStarManageService.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.driver.service; + +import com.ningdatech.carapi.driver.entity.RegionStarDTO; +import com.ningdatech.carapi.driver.entity.StarManage; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-11-15 + */ +public interface IStarManageService extends IService { + + Double getAvgStar(RegionStarDTO param); + + Double countTotalStar(RegionStarDTO param); + + Double getCompanyAvgStar(RegionStarDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingBonusRecordService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingBonusRecordService.java new file mode 100644 index 0000000..0269ff0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingBonusRecordService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.service; + +import com.ningdatech.carapi.driver.entity.TrainingBonusRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-31 + */ +public interface ITrainingBonusRecordService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingMaterialService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingMaterialService.java new file mode 100644 index 0000000..0a425be --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingMaterialService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.service; + +import com.ningdatech.carapi.driver.entity.TrainingMaterial; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-21 + */ +public interface ITrainingMaterialService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingOrganizationMaterialService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingOrganizationMaterialService.java new file mode 100644 index 0000000..ccf30e6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingOrganizationMaterialService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.service; + +import com.ningdatech.carapi.driver.entity.TrainingOrganizationMaterial; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-22 + */ +public interface ITrainingOrganizationMaterialService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingOrganizationService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingOrganizationService.java new file mode 100644 index 0000000..6cdcf1c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingOrganizationService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.service; + +import com.ningdatech.carapi.driver.entity.TrainingOrganization; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author LiuXinXin + * @since 2022-10-10 + */ +public interface ITrainingOrganizationService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingOrganizationTrainerService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingOrganizationTrainerService.java new file mode 100644 index 0000000..21de7c7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingOrganizationTrainerService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.service; + +import com.ningdatech.carapi.driver.entity.TrainingOrganizationTrainer; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-22 + */ +public interface ITrainingOrganizationTrainerService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingRegistrationReviewService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingRegistrationReviewService.java new file mode 100644 index 0000000..caa8b71 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/ITrainingRegistrationReviewService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.driver.entity.TrainingRegistrationReview; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-20 + */ +public interface ITrainingRegistrationReviewService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/ArticleInfoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/ArticleInfoServiceImpl.java new file mode 100644 index 0000000..785fb5e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/ArticleInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.ningdatech.carapi.driver.entity.ArticleInfo; +import com.ningdatech.carapi.driver.mapper.ArticleInfoMapper; +import com.ningdatech.carapi.driver.service.IArticleInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +@Service +public class ArticleInfoServiceImpl extends ServiceImpl implements IArticleInfoService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/BehaviorAnalysisProcessingModeServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/BehaviorAnalysisProcessingModeServiceImpl.java new file mode 100644 index 0000000..431a417 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/BehaviorAnalysisProcessingModeServiceImpl.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.driver.service.impl; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.driver.entity.BehaviorAnalysisProcessingMode; +import com.ningdatech.carapi.driver.mapper.BehaviorAnalysisProcessingModeMapper; +import com.ningdatech.carapi.driver.service.IBehaviorAnalysisProcessingModeService; + +/** + * @author CMM + * @description + * @since 2022/12/14 17:51 + */ +@Service +public class BehaviorAnalysisProcessingModeServiceImpl extends ServiceImpl implements IBehaviorAnalysisProcessingModeService { +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/BehaviourAnalysisServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/BehaviourAnalysisServiceImpl.java new file mode 100644 index 0000000..6e3fa32 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/BehaviourAnalysisServiceImpl.java @@ -0,0 +1,113 @@ +package com.ningdatech.carapi.driver.service.impl; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.exception.code.ExceptionCode; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.driver.call.RestTemplateToInterface; +import com.ningdatech.carapi.driver.constant.DriverAbnormalBehaviorOverseeEnum; +import com.ningdatech.carapi.driver.entity.DriverAbnormalBehaviorAnalysis; +import com.ningdatech.carapi.driver.entity.DriverAbnormalBehaviorAnalysisOverseeDTO; +import com.ningdatech.carapi.driver.entity.OverseeInterfaceCallDTO; +import com.ningdatech.carapi.driver.mapper.BehaviourAnalysisMapper; +import com.ningdatech.carapi.driver.model.po.AlarmWarnFilePO; +import com.ningdatech.carapi.driver.service.IBehaviourAnalysisService; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import lombok.RequiredArgsConstructor; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Service +@RequiredArgsConstructor +public class BehaviourAnalysisServiceImpl extends ServiceImpl + implements IBehaviourAnalysisService { + + private final BehaviourAnalysisMapper behaviourAnalysisMapper; + private final RestTemplateToInterface restTemplateToInterface; + + @Value("${send-urge-warn.url}") + private String sendUrgeWarnUrl; + + @Override + public Page pageBehaviour(Page page, LambdaQueryWrapper wrapper) { + return behaviourAnalysisMapper.pageBehiviour(page, wrapper); + } + + @Override + public DriverAbnormalBehaviorAnalysis getOneBehaviour(LambdaQueryWrapper wrapper) { + return behaviourAnalysisMapper.getOneBehiviour(wrapper); + } + + @Override + public List selectDriverAbnormalBehaviorAnalysisData(long index) { + return behaviourAnalysisMapper.selectDriverAbnormalBehaviorAnalysisByCarPlate(index); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean oversee(DriverAbnormalBehaviorAnalysisOverseeDTO param, Long userId) { + //校验传入的审核码 + if (!DriverAbnormalBehaviorOverseeEnum.OVERSEE.getCode().equals(param.getOverseeStatus())) { + throw new BizException("请检查传入的督办code!"); + } + DriverAbnormalBehaviorAnalysis driverAbnormalBehaviorAnalysis = behaviourAnalysisMapper.selectById(param.getId()); + if (Objects.isNull(driverAbnormalBehaviorAnalysis)) { + throw new BizException(ExceptionCode.OPERATION_EX.getCode(), "驾驶员异常行为 {}为空", param.getId()); + } + if (driverAbnormalBehaviorAnalysis.getOverseeStatus().equals(DriverAbnormalBehaviorOverseeEnum.OVERSEE.getCode())) { + throw new BizException(ExceptionCode.OPERATION_EX.getCode(), "只能督办待督办的驾驶员异常行为 {}", param.getId()); + } + //调用外部接口下发督办请求 + //装配请求参数 + OverseeInterfaceCallDTO req = new OverseeInterfaceCallDTO(); + req.setGnssCenterId(driverAbnormalBehaviorAnalysis.getGnssCenterId()); + req.setMSgSn(driverAbnormalBehaviorAnalysis.getAlarmMsgSn()); + req.setSupervisor(LoginUserUtil.getUsername()); + //String resultJson = restTemplateToInterface.doPostWith2(sendUrgeWarnUrl, req); + //保存督办处理结果 + //driverAbnormalBehaviorAnalysis.setOverseeResult(resultJson); + //JSONObject result = JSON.parseObject(resultJson); + //String status = result.getString(CommonConstant.CALL_STATUS); + String status = "ok"; + if (CommonConstant.CALL_STATUS_OK_VALUE.equals(status)) { + //设置告警异常行为状态为已督办 + driverAbnormalBehaviorAnalysis.setOverseeStatus(param.getOverseeStatus()); + driverAbnormalBehaviorAnalysis.setOverseeTime(LocalDateTime.now()); + driverAbnormalBehaviorAnalysis.setUpdateBy(userId); + driverAbnormalBehaviorAnalysis.setUpdateOn(LocalDateTime.now()); + behaviourAnalysisMapper.updateById(driverAbnormalBehaviorAnalysis); + return Boolean.TRUE; + } + return Boolean.FALSE; + } + + @Override + public List selectDriverAbnormalBehaviorAnalysisAppendixData(List alarmMsgSnList) { + return behaviourAnalysisMapper.selectDriverAbnormalBehaviorAnalysisAppendixData(alarmMsgSnList); + } + + @Override + public Long selectOneByAlarmMsgSn(Integer alarmMsgSn) { + return behaviourAnalysisMapper.selectOneByAlarmMsgSn(alarmMsgSn); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/CertificateServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/CertificateServiceImpl.java new file mode 100644 index 0000000..2a65750 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/CertificateServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.ningdatech.carapi.driver.entity.Certificate; +import com.ningdatech.carapi.driver.mapper.CertificateMapper; +import com.ningdatech.carapi.driver.service.ICertificateService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-24 + */ +@Service +public class CertificateServiceImpl extends ServiceImpl implements ICertificateService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverBlackListServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverBlackListServiceImpl.java new file mode 100644 index 0000000..3ea962a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverBlackListServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.ningdatech.carapi.driver.entity.DriverBlackList; +import com.ningdatech.carapi.driver.mapper.DriverBlackListMapper; +import com.ningdatech.carapi.driver.service.IDriverBlackListService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +@Service +public class DriverBlackListServiceImpl extends ServiceImpl implements IDriverBlackListService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverInfoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverInfoServiceImpl.java new file mode 100644 index 0000000..9b110f6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverInfoServiceImpl.java @@ -0,0 +1,93 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.common.model.KeyValueDTO; +import com.ningdatech.carapi.common.model.po.MapDataPO; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.mapper.DriverInfoMapper; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import lombok.RequiredArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + *

+ * 服务实现类 + *

+ * + * @author LiuXinXin + * @since 2022-10-09 + */ +@Service +@RequiredArgsConstructor +public class DriverInfoServiceImpl extends ServiceImpl implements IDriverInfoService { + + @Override + public Map listDriverInfoByIds(Collection ids) { + if (CollectionUtils.isEmpty(ids)) { + return Collections.emptyMap(); + } + List driverInfoList = list(Wrappers.lambdaQuery(DriverInfo.class) + .in(DriverInfo::getId, ids)); + return CollUtils.listToMap(driverInfoList, DriverInfo::getId); + } + + @Override + @XmlDataScope(entityIndex = 2) + @BuildChildrenRegionEntity(entityIndex = 2) + public Map driverAgeStatistics(String caseSql, Integer undefinedAge, DataScreenParam param) { + List> countList = baseMapper.driverAgeStatistics(caseSql, undefinedAge, param); + return CollUtils.listToMap(countList, KeyValueDTO::getKey, w -> w.getValue().intValue()); + } + + @Override + @XmlDataScope(entityIndex = 2) + @BuildChildrenRegionEntity(entityIndex = 2) + public Map drivingExperienceStatistics(String caseSql, Integer undefinedAge, DataScreenParam param) { + List> countList = baseMapper.drivingExperienceStatistics(caseSql, undefinedAge, param); + return CollUtils.listToMap(countList, KeyValueDTO::getKey, w -> w.getValue().intValue()); + } + + @Override + public Long selectUserIdById(Long driverId) { + DriverInfo driverInfo = baseMapper.selectById(driverId); + return driverInfo.getUserId(); + } + + @Override + public Map listByIdCard(List idCards) { + if (CollectionUtils.isEmpty(idCards)) { + return Collections.emptyMap(); + } + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DriverInfo.class); + wrapper.in(DriverInfo::getIdCard, idCards); + return CollUtils.listToMap(this.list(wrapper), DriverInfo::getIdCard); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List diverCountByRegion(DataScreenParam param) { + CodeUtil.buildRegionLevel(param); + return baseMapper.diverCountByRegion(param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List> nativePlaceStatisticsByRegion(DataScreenParam param) { + return baseMapper.nativePlaceStatisticsByRegion(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverScoreInfoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverScoreInfoServiceImpl.java new file mode 100644 index 0000000..9d6d64a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverScoreInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.ningdatech.carapi.driver.entity.DriverScoreInfo; +import com.ningdatech.carapi.driver.mapper.DriverScoreInfoMapper; +import com.ningdatech.carapi.driver.service.IDriverScoreInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-27 + */ +@Service +public class DriverScoreInfoServiceImpl extends ServiceImpl implements IDriverScoreInfoService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverScoreRecordServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverScoreRecordServiceImpl.java new file mode 100644 index 0000000..a6aca90 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverScoreRecordServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.ningdatech.carapi.driver.entity.DriverScoreRecord; +import com.ningdatech.carapi.driver.mapper.DriverScoreRecordMapper; +import com.ningdatech.carapi.driver.service.IDriverScoreRecordService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-27 + */ +@Service +public class DriverScoreRecordServiceImpl extends ServiceImpl implements IDriverScoreRecordService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverWorkRecordServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverWorkRecordServiceImpl.java new file mode 100644 index 0000000..92cf891 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/DriverWorkRecordServiceImpl.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.driver.entity.DriverWorkRecordInfo; +import com.ningdatech.carapi.driver.mapper.DriverWorkRecordInfoMapper; +import com.ningdatech.carapi.driver.service.IDriverWorkRecordService; +import org.springframework.stereotype.Service; + +/** + * @author CMM + * @description + * @since 2022/11/25 14:44 + */ +@Service +public class DriverWorkRecordServiceImpl extends ServiceImpl implements IDriverWorkRecordService { +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/ExamRecordDetailServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/ExamRecordDetailServiceImpl.java new file mode 100644 index 0000000..369f1a2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/ExamRecordDetailServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.ningdatech.carapi.driver.entity.ExamRecordDetail; +import com.ningdatech.carapi.driver.mapper.ExamRecordDetailMapper; +import com.ningdatech.carapi.driver.service.IExamRecordDetailService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-26 + */ +@Service +public class ExamRecordDetailServiceImpl extends ServiceImpl implements IExamRecordDetailService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/ExamRecordServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/ExamRecordServiceImpl.java new file mode 100644 index 0000000..b12288f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/ExamRecordServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.ningdatech.carapi.driver.entity.ExamRecord; +import com.ningdatech.carapi.driver.mapper.ExamRecordMapper; +import com.ningdatech.carapi.driver.service.IExamRecordService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-26 + */ +@Service +public class ExamRecordServiceImpl extends ServiceImpl implements IExamRecordService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/StarManageServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/StarManageServiceImpl.java new file mode 100644 index 0000000..6c12f4e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/StarManageServiceImpl.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.driver.service.impl; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.driver.entity.RegionStarDTO; +import com.ningdatech.carapi.driver.entity.StarManage; +import com.ningdatech.carapi.driver.mapper.StarManageMapper; +import com.ningdatech.carapi.driver.service.IStarManageService; + +import lombok.RequiredArgsConstructor; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-11-15 + */ +@Service +@RequiredArgsConstructor +public class StarManageServiceImpl extends ServiceImpl implements IStarManageService { + + private final StarManageMapper starManageMapper; + + @Override + @XmlDataScope + public Double getAvgStar(RegionStarDTO param) { + return starManageMapper.getAvgStar(param); + } + + @Override + @XmlDataScope + public Double countTotalStar(RegionStarDTO param) { + return starManageMapper.countTotalStar(param); + } + + @Override + @XmlDataScope + public Double getCompanyAvgStar(RegionStarDTO param) { + return starManageMapper.getCompanyAvgStar(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingBonusRecordServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingBonusRecordServiceImpl.java new file mode 100644 index 0000000..9d4a8e1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingBonusRecordServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.ningdatech.carapi.driver.entity.TrainingBonusRecord; +import com.ningdatech.carapi.driver.mapper.TrainingBonusRecordMapper; +import com.ningdatech.carapi.driver.service.ITrainingBonusRecordService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-31 + */ +@Service +public class TrainingBonusRecordServiceImpl extends ServiceImpl implements ITrainingBonusRecordService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingMaterialServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingMaterialServiceImpl.java new file mode 100644 index 0000000..0c031cd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingMaterialServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.ningdatech.carapi.driver.entity.TrainingMaterial; +import com.ningdatech.carapi.driver.mapper.TrainingMaterialMapper; +import com.ningdatech.carapi.driver.service.ITrainingMaterialService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-21 + */ +@Service +public class TrainingMaterialServiceImpl extends ServiceImpl implements ITrainingMaterialService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingOrganizationMaterialServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingOrganizationMaterialServiceImpl.java new file mode 100644 index 0000000..d0a1916 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingOrganizationMaterialServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.ningdatech.carapi.driver.entity.TrainingOrganizationMaterial; +import com.ningdatech.carapi.driver.mapper.TrainingOrganizationMaterialMapper; +import com.ningdatech.carapi.driver.service.ITrainingOrganizationMaterialService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-22 + */ +@Service +public class TrainingOrganizationMaterialServiceImpl extends ServiceImpl implements ITrainingOrganizationMaterialService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingOrganizationServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingOrganizationServiceImpl.java new file mode 100644 index 0000000..a3f8466 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingOrganizationServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.ningdatech.carapi.driver.entity.TrainingOrganization; +import com.ningdatech.carapi.driver.mapper.NdTrainingOrganizationMapper; +import com.ningdatech.carapi.driver.service.ITrainingOrganizationService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author LiuXinXin + * @since 2022-10-10 + */ +@Service +public class TrainingOrganizationServiceImpl extends ServiceImpl implements ITrainingOrganizationService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingOrganizationTrainerServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingOrganizationTrainerServiceImpl.java new file mode 100644 index 0000000..46515b9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingOrganizationTrainerServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.ningdatech.carapi.driver.entity.TrainingOrganizationTrainer; +import com.ningdatech.carapi.driver.mapper.TrainingOrganizationTrainerMapper; +import com.ningdatech.carapi.driver.service.ITrainingOrganizationTrainerService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-22 + */ +@Service +public class TrainingOrganizationTrainerServiceImpl extends ServiceImpl implements ITrainingOrganizationTrainerService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingRegistrationReviewServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingRegistrationReviewServiceImpl.java new file mode 100644 index 0000000..9c1b4d6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/driver/service/impl/TrainingRegistrationReviewServiceImpl.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.driver.service.impl; + +import com.ningdatech.carapi.driver.entity.TrainingRegistrationReview; +import com.ningdatech.carapi.driver.mapper.TrainingRegistrationReviewMapper; +import com.ningdatech.carapi.driver.service.ITrainingRegistrationReviewService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-20 + */ +@Service +@RequiredArgsConstructor +public class TrainingRegistrationReviewServiceImpl extends ServiceImpl implements ITrainingRegistrationReviewService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/controller/GpsDataPullController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/controller/GpsDataPullController.java new file mode 100644 index 0000000..cc3dfac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/controller/GpsDataPullController.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.gps.controller; + +import com.ningdatech.carapi.gps.manage.GpsDataPullManage; +import com.ningdatech.carapi.gps.model.GpsDataVO; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/gps") +@RequiredArgsConstructor +public class GpsDataPullController { + + private final GpsDataPullManage gpsDataPullManage; + + @ApiOperation(value = "GPS数据拉取测试", notes = "GPS数据拉取测试") + @GetMapping("/get-gps-data") + public String getGpsData() { + return gpsDataPullManage.getGpsData(); + } + + @ApiOperation(value = "GPS数据增量拉取测试", notes = "GPS数据增量拉取测试") + @GetMapping("/get-add-gps-data") + public String getAddGpsData() { + return gpsDataPullManage.getAddGpsData(); + } + + @ApiOperation(value = "GPS数据增量拉取缓存ID设置", notes = "GPS数据增量拉取缓存ID设置") + @GetMapping("/update-redis-id") + public String updateRedisId() { + return gpsDataPullManage.updateRedisId(); + } + + @ApiOperation(value = "数据驾驶舱算法分析数据获取", notes = "数据驾驶舱算法分析数据获取") + @GetMapping("/get-redis-data") + public String getRedisData() { + return gpsDataPullManage.getRedisData(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/manage/GpsDataPullManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/manage/GpsDataPullManage.java new file mode 100644 index 0000000..9bc0f2c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/manage/GpsDataPullManage.java @@ -0,0 +1,648 @@ +package com.ningdatech.carapi.gps.manage; + + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.cert.X509Certificate; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.Statement; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.homepage.entity.model.NdDataAccessGps; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import com.alibaba.fastjson.JSON; +import com.ningdatech.carapi.gps.model.entity.DataAccessGpsRealTimeData; +import com.ningdatech.carapi.gps.service.IDataAccessGpsRealTimeDataService; +import com.ningdatech.carapi.homepage.service.IDataAccessGpsService; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.date.StopWatch; +import cn.hutool.json.JSONObject; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import redis.clients.jedis.Jedis; + +/** + * 车辆位置信息 + * + * @author CMM + * @since 2023/11/17 09:35 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class GpsDataPullManage { + + private final IDataAccessGpsService dataAccessGpsService; + private final IDataAccessGpsRealTimeDataService dataAccessGpsRealTimeDataService; + private final CachePlusOps cachePlusOps; + + private static final ObjectMapper objectMapper = new ObjectMapper(); + private static final Jedis jedis = new Jedis("localhost",6379); + + @Value("${spring.datasource.url}") + private String dataBaseUrl; + @Value("${spring.datasource.username}") + private String username; + @Value("${spring.datasource.password}") + private String password; + + public String getGpsData() { + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + String url = "https://jtjdhcweb.z1l1.com:7443"; + + // 获取当前表中的最大更新时间 + Long maxUpdateTime = null; + Optional max = dataAccessGpsRealTimeDataService.list(Wrappers.lambdaQuery(DataAccessGpsRealTimeData.class) + .select(DataAccessGpsRealTimeData::getUpdateTime)).stream().max(Comparator.comparing(DataAccessGpsRealTimeData::getUpdateTime)); + if (max.isPresent()){ + maxUpdateTime = max.get().getUpdateTime().atZone(ZoneId.of("Asia/Shanghai")).toInstant().toEpochMilli(); + log.info("当前表中最大更新时间:{}", Instant.ofEpochMilli(maxUpdateTime).atZone(ZoneId.of("Asia/Shanghai")).toLocalDateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + } + try { + trustAllCertificates(); + Map requestParams = assemblyParams(); + String requestUrl = url + "/talent/gps/datalist"; + String response = sendPostRequest(requestUrl, requestParams); + if (response == null) { + return "下载路径请求失败!"; + } + com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(response); + System.out.println("Response from server: " + response); + String downloadUrl = object.getString("data"); + if (downloadUrl == null){ + return "下载路径请求失败!"; + } + + String downloadPath = url + downloadUrl; + String result = sendDownloadRequest(downloadPath); + if (result == null){ + return "文件下载失败!"; + } + List dataList = JSON.parseArray(result, com.alibaba.fastjson.JSONObject.class).stream().map(jsonObject -> { + String vehicleNo = jsonObject.getString("vehicle_no"); + Integer color = jsonObject.getInteger("color"); + // 纬度 + String longitude = jsonObject.getString("lon"); + // 经度 + String latitude = jsonObject.getString("lat"); + String direction = jsonObject.getString("direction"); + String gpsSpeed = jsonObject.getString("gps_speed"); + Long gpsTime = jsonObject.getLong("gps_time"); + DataAccessGpsRealTimeData dataAccessGpsRealTimeData = new DataAccessGpsRealTimeData(); + dataAccessGpsRealTimeData.setCarPlate(vehicleNo); + dataAccessGpsRealTimeData.setPlateColor(color.toString()); + dataAccessGpsRealTimeData.setCarLongitude(latitude); + dataAccessGpsRealTimeData.setCarLatitude(longitude); + dataAccessGpsRealTimeData.setCarDirection(direction); + dataAccessGpsRealTimeData.setCarVelocity(gpsSpeed); + // 将毫秒时间戳转换为Instant对象 + Instant instant = Instant.ofEpochMilli(gpsTime); + // 使用北京时间时区转换为LocalDateTime + LocalDateTime localDateTime = instant.atZone(ZoneId.of("Asia/Shanghai")).toLocalDateTime(); + dataAccessGpsRealTimeData.setUpdateTime(localDateTime); + dataAccessGpsRealTimeData.setCreateTime(LocalDateTime.now()); + return dataAccessGpsRealTimeData; + }).collect(Collectors.toList()); + if (CollUtil.isEmpty(dataList)){ + return "数据为空!"; + } + + // 表中有数据 获取此次拉取到的数据中上传时间大于上次拉取数据的最大上报时间的数据 + if (Objects.nonNull(maxUpdateTime)) { + long finalMaxUpdateTime = maxUpdateTime; + dataList = dataList.stream().filter(e -> e.getUpdateTime().atZone(ZoneId.of("Asia/Shanghai")).toInstant().toEpochMilli() > finalMaxUpdateTime).collect(Collectors.toList()); + // 将数据库中的数据根据更新时间排序 按更新时间 从小到大 根据对应id删除此次拉取到的数据量 + List dataAccessGpsRealTimeDataList = dataAccessGpsRealTimeDataService.list(Wrappers.lambdaQuery(DataAccessGpsRealTimeData.class) + .select(DataAccessGpsRealTimeData::getUpdateTime, DataAccessGpsRealTimeData::getRecordId)) + .stream().sorted(Comparator.comparing(DataAccessGpsRealTimeData::getUpdateTime)).collect(Collectors.toList()); + // 截取dataList.size()条数据 + dataAccessGpsRealTimeDataList = dataAccessGpsRealTimeDataList.subList(0, dataList.size()); + // 从旧数据中删除这些数据 + List recordIdList = dataAccessGpsRealTimeDataList.stream().map(DataAccessGpsRealTimeData::getRecordId).collect(Collectors.toList()); + String tableName = "nd_data_access_gps_real_time_data"; + dataAccessGpsRealTimeDataService.removeByRecordIds(tableName,recordIdList); + } + // 如果没有 说明没有新上报的数据 不更新 + if (CollUtil.isEmpty(dataList)){ + log.info("没有新上报的数据!"); + return "没有新上报的数据!"; + } + log.info("本次拉取到{}条数据", dataList.size()); + + // 先清空表中的数据 + //truncateTable(); + // 设置表的自增序号从1开始 + //resetAutoIncrement(); + + // 批量保存数据 每批保存1万条 + // 分批 + List> batchList = new ArrayList<>(ListUtil.partition(new ArrayList<>(dataList), 10000)); + // 创建线程池 线程数是 分批的数量 + ExecutorService executorService = Executors.newFixedThreadPool(batchList.size()); + // 线程计数器,就是 分批的数 + CountDownLatch countDownLatch = new CountDownLatch(batchList.size()); + batchList.forEach(e -> { + // 每个分批用一个线程执行 + executorService.execute(() -> dataAccessGpsRealTimeDataService.saveBatch(e, 10000)); + countDownLatch.countDown(); + }); + // 等待所有线程执行完成 + countDownLatch.await(); + executorService.shutdown(); + executorService.awaitTermination(5, TimeUnit.MINUTES); + if (executorService.isTerminated()) { + log.info("子线程执行完毕"); + log.info("主线程开始"); + } + stopWatch.stop(); + log.info("=========== GPS数据拉取 ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); + return "拉取完成!"; + } catch (Exception e) { + log.error("Error sending POST request: {}", e.getMessage()); + } + stopWatch.stop(); + log.info("=========== GPS数据拉取 ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); + return "数据拉取失败!"; + } + + private void truncateTable() { + // SQL 语句清空表 + String truncateTableSQL = "TRUNCATE TABLE nd_data_access_gps_real_time_data"; + + Connection conn = null; + Statement stmt = null; + + try { + // 加载数据库驱动 + Class.forName("com.mysql.cj.jdbc.Driver"); + // 建立连接 + conn = DriverManager.getConnection(dataBaseUrl, username, password); + // 创建 Statement 对象 + stmt = conn.createStatement(); + // 执行 SQL 语句 + stmt.executeUpdate(truncateTableSQL); + log.info("表已被清空,自增主键已重置。"); + System.out.println("表已被清空,自增主键已重置。"); + } catch (Exception e) { + log.info("Error truncating table: {}", e.getMessage()); + } finally { + // 关闭资源 + try { + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (Exception e) { + log.error("Error closing resources: {}", e.getMessage()); + } + } + } + + private void resetAutoIncrement() { + + // SQL 语句重置自增主键 + String resetAutoIncrementSQL = "ALTER TABLE nd_data_access_gps_real_time_data AUTO_INCREMENT = 1"; + + Connection conn = null; + Statement stmt = null; + + try { + // 加载数据库驱动 + Class.forName("com.mysql.cj.jdbc.Driver"); + // 建立连接 + conn = DriverManager.getConnection(dataBaseUrl, username, password); + // 创建 Statement 对象 + stmt = conn.createStatement(); + // 执行 SQL 语句 + stmt.executeUpdate(resetAutoIncrementSQL); + log.info("自增主键已重置为1。"); + } catch (Exception e) { + log.error("重置自增主键失败。{}", e.getMessage()); + } finally { + // 关闭资源 + try { + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (Exception e) { + log.error("关闭资源失败。{}", e.getMessage()); + } + } + } + + public String sendDownloadRequest(String downloadPath) { + try { + // 创建URL对象 + URL url = new URL(downloadPath); + // 打开连接 + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + // 设置请求方法为GET + connection.setRequestMethod("GET"); + // 设置连接超时时间(单位:毫秒) + connection.setConnectTimeout(60000); + // 设置读取超时时间(单位:毫秒) + connection.setReadTimeout(60000); + + // 获取响应码 + int responseCode = connection.getResponseCode(); + System.out.println("GET Response Code :: " + responseCode); + + if (responseCode == HttpURLConnection.HTTP_OK) { + // 使用BufferedReader读取响应内容 + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String inputLine; + StringBuilder response = new StringBuilder(); + + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + // 打印响应内容 + System.out.println("Response :: " + response); + in.close(); + connection.disconnect(); + return response.toString(); + } else { + System.out.println("GET请求未成功"); + } + } catch (Exception e) { + log.error("Error sending GET request: {}", e.getMessage()); + } + return null; + } + + public Map assemblyParams(){ + String key = "Gps@!@163."; + long timeNow = System.currentTimeMillis() / 1000; + String token = generateMD5Token(timeNow, key); + Map params = new HashMap<>(); + params.put("timeNow", String.valueOf(timeNow)); + params.put("token", token); + + //params.put("Slat", "120.0167"); + //params.put("Elat", "120.2337"); + // + //params.put("Slon", "29.1078"); + //params.put("Elon", "29.4697"); + + return params; + } + + public Map assemblyParams(Long maxUpdateTime){ + String key = "Gps@!@163."; + long timeNow = System.currentTimeMillis() / 1000; + String token = generateMD5Token(timeNow, key); + Map params = new HashMap<>(); + params.put("timeNow", String.valueOf(timeNow)); + params.put("token", token); + params.put("timeLine", String.valueOf(maxUpdateTime / 1000)); + + //params.put("Slat", "120.0167"); + //params.put("Elat", "120.2337"); + // + //params.put("Slon", "29.1078"); + //params.put("Elon", "29.4697"); + + return params; + } + + public Map assemblyParams(String id){ + String key = "Gps@!@163."; + long timeNow = System.currentTimeMillis() / 1000; + String token = generateMD5Token(timeNow, key); + Map params = new HashMap<>(); + params.put("timeNow", String.valueOf(timeNow)); + params.put("token", token); + params.put("id", id); + + //params.put("Slat", "120.0167"); + //params.put("Elat", "120.2337"); + // + //params.put("Slon", "29.1078"); + //params.put("Elon", "29.4697"); + + return params; + } + + public String generateMD5Token(long timeNow, String key) { + try { + String data = key + timeNow; + MessageDigest md = MessageDigest.getInstance("MD5"); + byte[] hash = md.digest(data.getBytes(StandardCharsets.UTF_8)); + StringBuilder hexString = new StringBuilder(); + for (byte b : hash) { + String hex = Integer.toHexString(0xff & b); + if (hex.length() == 1) { + hexString.append('0'); + } + hexString.append(hex); + } + return hexString.toString(); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException("MD5 algorithm not found", e); + } + } + + public String sendPostRequest(String requestUrl, Map params) throws Exception { + URL url = new URL(requestUrl); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + + // 设置请求方法为POST + connection.setRequestMethod("POST"); + // 设置请求头信息 + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + connection.setDoOutput(true); + + // 构建请求参数 + StringBuilder postData = new StringBuilder(); + for (Map.Entry param : params.entrySet()) { + if (postData.length() != 0) postData.append('&'); + postData.append(param.getKey()); + postData.append('='); + postData.append(param.getValue()); + } + System.out.println("Post Data: " + postData); + // 发送请求参数 + try (OutputStream outputStream = connection.getOutputStream()) { + byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8); + outputStream.write(postDataBytes); + } + + // 获取响应 + int responseCode = connection.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK) { + // 读取响应 + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + StringBuilder response = new StringBuilder(); + + String inputLine; + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); + connection.disconnect(); + + // 尝试将响应转换成JSONObject + try { + return new JSONObject(response.toString()).toString(); + } catch (Exception e) { + System.err.println("Error parsing JSON: " + e.getMessage()); + return null; + } + } else { + // 读取错误信息 + try (java.io.InputStream inputStream = connection.getErrorStream()) { + java.util.Scanner scanner = new java.util.Scanner(inputStream, StandardCharsets.UTF_8.name()); + scanner.useDelimiter("\\A"); + return scanner.hasNext() ? scanner.next() : ""; + } + } + } + + public void trustAllCertificates() throws Exception { + // 创建一个信任所有证书的信任管理器 + TrustManager[] trustAllCerts = new TrustManager[]{ + new X509TrustManager() { + public X509Certificate[] getAcceptedIssuers() { + return null; + } + public void checkClientTrusted(X509Certificate[] certs, String authType) { + } + public void checkServerTrusted(X509Certificate[] certs, String authType) { + } + } + }; + + // 安装信任所有证书的信任管理器 + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, trustAllCerts, new java.security.SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + + // 创建一个信任所有主机名的验证器 + HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true); + } + + public String getAddGpsData() { + log.info("=========== GPS增量数据拉取 ======== 任务开始"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + String url = "https://jtjdhcweb.z1l1.com:7443"; + try { + trustAllCertificates(); + String requestUrl = url + "/talent/gps/datalist"; + // 从缓存中获取业务数据最大id + CacheKey key = new CacheKey(TaskConstant.RedisKey.GPS_DATA_PULL_MAX_BIZ_ID); + String id = cachePlusOps.get(key); + log.info("缓存中已存在id:{}", id); + // 如果不存在 从表中数据中获取 + if (StringUtils.isBlank(id)){ + Long maxBizId = dataAccessGpsService.getMaxBizId(); + if (maxBizId != null) { + id = maxBizId.toString(); + }else { + return "未获取到id!"; + } + } + Map requestAddParams = assemblyParams(id); + String addResponse = sendPostRequest(requestUrl, requestAddParams); + + if (addResponse == null) { + return "下载路径请求失败!"; + } + com.alibaba.fastjson.JSONObject addObject = com.alibaba.fastjson.JSONObject.parseObject(addResponse); + System.out.println("Response from server: " + addResponse); + String addDownloadUrl = addObject.getString("data"); + if (addDownloadUrl == null){ + return "下载路径请求失败!"; + } + + String addDownloadPath = url + addDownloadUrl; + String addResult = sendDownloadRequest(addDownloadPath); + if (addResult == null){ + return "文件下载失败!"; + } + List addDataList = getNdDataAccessGps(addResult); + if (CollUtil.isEmpty(addDataList)){ + return "数据为空!"; + } + log.info("此次拉取到的数据条数:{}",addDataList.size()); + // 获取业务数据最大id + String maxBizId = addDataList.stream().map(d -> { + String bizId = d.getBizId(); + return Long.parseLong(bizId); + }).collect(Collectors.toList()).stream().max(Long::compare).get().toString(); + // 保存到缓存中 + cachePlusOps.set(key,maxBizId,false); + String value = cachePlusOps.get(key); + System.out.println("已存入缓存中的id: " + value); + + // 批量保存数据 每批保存1万条 + // 分批 + List> batchList = new ArrayList<>(ListUtil.partition(new ArrayList<>(addDataList), 10000)); + // 创建线程池 线程数是 分批的数量 + ExecutorService executorService = Executors.newFixedThreadPool(batchList.size()); + // 线程计数器,就是 分批的数 + CountDownLatch countDownLatch = new CountDownLatch(batchList.size()); + batchList.forEach(e -> { + // 每个分批用一个线程执行 + executorService.execute(() -> dataAccessGpsService.saveBatch(e, 10000)); + countDownLatch.countDown(); + }); + // 等待所有线程执行完成 + countDownLatch.await(); + executorService.shutdown(); + executorService.awaitTermination(5, TimeUnit.MINUTES); + if (executorService.isTerminated()) { + log.info("子线程执行完毕"); + log.info("主线程开始"); + } + stopWatch.stop(); + log.info("=========== GPS数据拉取 ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); + return "拉取完成!"; + } catch (Exception e) { + log.error("Error sending POST request: {}", e.getMessage()); + } + stopWatch.stop(); + log.info("=========== GPS数据拉取 ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); + return "数据拉取失败!"; + } + + public List getNdDataAccessGps(String result) { + List dataList = JSON.parseArray(result, com.alibaba.fastjson.JSONObject.class).stream().map(jsonObject -> { + String vehicleNo = jsonObject.getString("vehicle_no"); + Integer color = jsonObject.getInteger("color"); + // 纬度 + String longitude = jsonObject.getString("lon"); + // 经度 + String latitude = jsonObject.getString("lat"); + String direction = jsonObject.getString("direction"); + String gpsSpeed = jsonObject.getString("gps_speed"); + Long gpsTime = jsonObject.getLong("gps_time"); + String bizId = jsonObject.getString("id"); + NdDataAccessGps dataAccessGps = new NdDataAccessGps(); + dataAccessGps.setCarPlate(vehicleNo); + dataAccessGps.setPlateColor(color.toString()); + dataAccessGps.setCarLongitude(BigDecimal.valueOf(Double.parseDouble(latitude))); + dataAccessGps.setCarLatitude(BigDecimal.valueOf(Double.parseDouble(longitude))); + dataAccessGps.setCarDirection(BigDecimal.valueOf(Double.parseDouble(direction))); + dataAccessGps.setCarVelocity(BigDecimal.valueOf(Double.parseDouble(gpsSpeed))); + // 将毫秒时间戳转换为Instant对象 + Instant instant = Instant.ofEpochMilli(gpsTime); + // 使用北京时间时区转换为LocalDateTime + LocalDateTime localDateTime = instant.atZone(ZoneId.of("Asia/Shanghai")).toLocalDateTime(); + dataAccessGps.setUpdateTime(localDateTime); + dataAccessGps.setCreateTime(LocalDateTime.now()); + dataAccessGps.setBizId(bizId); + return dataAccessGps; + }).collect(Collectors.toList()); + return dataList; + } + + public String updateRedisId() { + log.info("=========== 更新Redis缓存数据Id ======== 任务开始"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + // 从缓存中获取业务数据最大id + CacheKey key = new CacheKey(TaskConstant.RedisKey.GPS_DATA_PULL_MAX_BIZ_ID); + Long id = cachePlusOps.get(key); + log.info("缓存中已存在id: {}", id); + // 缓存中已存在 + if (Objects.nonNull(id)){ + return "缓存中已存在id: " + id; + } + + String url = "https://jtjdhcweb.z1l1.com:7443"; + try { + // 先查询最新的50万数据 + trustAllCertificates(); + Map requestParams = assemblyParams(); + String requestUrl = url + "/talent/gps/datalist"; + String response = sendPostRequest(requestUrl, requestParams); + if (response == null) { + return "下载路径请求失败!"; + } + com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(response); + System.out.println("Response from server: " + response); + String downloadUrl = object.getString("data"); + if (downloadUrl == null){ + return "下载路径请求失败!"; + } + + String downloadPath = url + downloadUrl; + String result = sendDownloadRequest(downloadPath); + if (result == null){ + return "文件下载失败!"; + } + List dataList = getNdDataAccessGps(result); + if (CollUtil.isEmpty(dataList)){ + return "数据为空!"; + } + // 获取最新的50万条数据中最大的id + // 如果不存在 从新查询的数据中获取 + id = dataList.stream().map(d -> { + String bizId = d.getBizId(); + return Long.parseLong(bizId); + }).collect(Collectors.toList()).stream().max(Long::compare).get(); + + // 保存到缓存中 + cachePlusOps.set(key,id,false); + Long value = cachePlusOps.get(key); + log.info("已存入缓存中的id: {}", value); + stopWatch.stop(); + log.info("=========== 更新Redis缓存数据Id ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); + return "数据Id更新完成!"; + } catch (Exception e) { + log.error("Error sending POST request: {}", e.getMessage()); + } + stopWatch.stop(); + log.info("=========== 更新Redis缓存数据Id ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); + return "数据Id更新失败!"; + } + + public String getRedisData() { + // 拼接数据 + jedis.auth("Ndkj1234"); + String allData = jedis.get(TaskConstant.RedisKey.HS_YW_COME_REDIS_ALL_DATA_KEY); + //String allData = cachePlusOps.get(new CacheKey(TaskContant.RedisKey.HS_DY_GO_REDIS_ALL_DATA_KEY)); + log.info("allData:{}", allData); + return "allData:" + allData; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/mapper/DataAccessGpsRealTimeDataMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/mapper/DataAccessGpsRealTimeDataMapper.java new file mode 100644 index 0000000..d1c4c71 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/mapper/DataAccessGpsRealTimeDataMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.gps.mapper; + +import com.ningdatech.carapi.gps.model.entity.DataAccessGpsRealTimeData; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2024-10-11 + */ +public interface DataAccessGpsRealTimeDataMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/mapper/DataAccessGpsRealTimeDataMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/mapper/DataAccessGpsRealTimeDataMapper.xml new file mode 100644 index 0000000..1c59198 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/mapper/DataAccessGpsRealTimeDataMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/model/GpsDataVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/model/GpsDataVO.java new file mode 100644 index 0000000..cc51ebe --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/model/GpsDataVO.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.gps.model; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author CMM + * @since 2024/10/10 22:43 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class GpsDataVO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String vehicleNo; + private Integer color; + private String longitude; + private String latitude; + private String direction; + private String gpsSpeed; + private Long gpsTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/model/entity/DataAccessGpsRealTimeData.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/model/entity/DataAccessGpsRealTimeData.java new file mode 100644 index 0000000..be41ca5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/model/entity/DataAccessGpsRealTimeData.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.gps.model.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; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2024-10-11 + */ +@TableName("nd_data_access_gps_real_time_data") +@ApiModel(value = "DataAccessGpsRealTimeData对象", description = "") +@Data +public class DataAccessGpsRealTimeData implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "record_id", type = IdType.AUTO) + private Long recordId; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆颜色") + private String plateColor; + + @ApiModelProperty("车辆经度") + private String carLongitude; + + @ApiModelProperty("车辆纬度") + private String carLatitude; + + @ApiModelProperty("车辆高度") + private String carAltitude; + + @ApiModelProperty("车辆速度") + private String carVelocity; + + @ApiModelProperty("车辆方向") + private String carDirection; + + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/service/IDataAccessGpsRealTimeDataService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/service/IDataAccessGpsRealTimeDataService.java new file mode 100644 index 0000000..518395d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/service/IDataAccessGpsRealTimeDataService.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.gps.service; + +import com.ningdatech.carapi.gps.model.entity.DataAccessGpsRealTimeData; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2024-10-11 + */ +public interface IDataAccessGpsRealTimeDataService extends IService { + + Boolean removeByRecordIds(String tableName,List recordIdList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/service/impl/DataAccessGpsRealTimeDataServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/service/impl/DataAccessGpsRealTimeDataServiceImpl.java new file mode 100644 index 0000000..e342ed4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/service/impl/DataAccessGpsRealTimeDataServiceImpl.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.gps.service.impl; + +import cn.hutool.core.collection.ListUtil; +import com.ningdatech.carapi.gps.model.entity.DataAccessGpsRealTimeData; +import com.ningdatech.carapi.gps.mapper.DataAccessGpsRealTimeDataMapper; +import com.ningdatech.carapi.gps.service.IDataAccessGpsRealTimeDataService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.scheduler.mapper.VehicleOnlineStatusDayMapper; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2024-10-11 + */ +@Service +@AllArgsConstructor +public class DataAccessGpsRealTimeDataServiceImpl extends ServiceImpl implements IDataAccessGpsRealTimeDataService { + + private final VehicleOnlineStatusDayMapper mapper; + @Override + public Boolean removeByRecordIds(String tableName,List recordIdList) { + // 根据recordIdList分批删除 每批5000 + // 分批 + List> batchList = new ArrayList<>(ListUtil.partition(new ArrayList<>(recordIdList), 5000)); + for (List idList : batchList) { + mapper.batchDelete(tableName,idList); + } + return true; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/task/GpsFullDataPullTask.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/task/GpsFullDataPullTask.java new file mode 100644 index 0000000..0f2c7a2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/task/GpsFullDataPullTask.java @@ -0,0 +1,185 @@ +package com.ningdatech.carapi.gps.task; + +import java.math.BigDecimal; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.homepage.entity.model.NdDataAccessGps; +import com.ningdatech.carapi.homepage.service.IDataAccessGpsService; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.carapi.gps.manage.GpsDataPullManage; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.date.StopWatch; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * GPS增量数据拉取定时任务 + * @since 2024/10/12 10:39 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class GpsFullDataPullTask { + + @Value("${task.switch.is-open}") + private boolean flag; + + @Value("${task.gps-data-pull.domain}") + private String domain; + + @Value("${task.gps-data-pull.real-time-data-url}") + private String realTimeDataUrl; + + @Value("${task.gps-data-pull.key}") + private String gpsDataPullKey; + + private final GpsDataPullManage gpsDataPullManage; + private final IDataAccessGpsService dataAccessGpsService; + private final CachePlusOps cachePlusOps; + + // 定时增量更新车辆GPS数据 每1分钟一次 + @Scheduled(cron = "0 */1 * * * ?") + public void doTask() throws Exception { + if (!flag){ + log.info("GPS增量数据拉取定时任务未开启!"); + return; + } + log.info("=========== GPS增量数据拉取 ======== 任务开始"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + gpsDataPullManage.trustAllCertificates(); + + // 从缓存中获取业务数据最大id + CacheKey key = new CacheKey(TaskConstant.RedisKey.GPS_DATA_PULL_MAX_BIZ_ID); + Long id = cachePlusOps.get(key); + log.info("从缓存中获取业务数据最大id:{}",id); + // 如果不存在 从表中获取 + if (Objects.isNull(id)){ + id = dataAccessGpsService.getMaxBizId(); + } + if (Objects.isNull(id)){ + log.error("业务数据最大id为空!"); + return; + } + Map requestParams = assemblyParams(gpsDataPullKey, id); + String requestUrl = domain + realTimeDataUrl; + String response = gpsDataPullManage.sendPostRequest(requestUrl, requestParams); + if (response == null) { + log.error("下载路径请求失败!"); + return; + } + log.info("Response from server: {}", response); + JSONObject object = null; + try { + object = JSONObject.parseObject(response); + } catch (Exception e) { + log.error("数据拉取失败! {}",e.getMessage()); + return; + } + log.info("Response from server: {}", object); + String downloadUrl = object.getString("data"); + if (StringUtils.isBlank(downloadUrl)){ + log.error("下载路径请求失败!"); + return; + } + String downloadPath = domain + downloadUrl; + String result = gpsDataPullManage.sendDownloadRequest(downloadPath); + if (result == null){ + log.error("文件下载失败!"); + return; + } + List dataList = JSON.parseArray(result, JSONObject.class).stream().map(jsonObject -> { + String vehicleNo = jsonObject.getString("vehicle_no"); + Integer color = jsonObject.getInteger("color"); + // 纬度 + String longitude = jsonObject.getString("lon"); + // 经度 + String latitude = jsonObject.getString("lat"); + String direction = jsonObject.getString("direction"); + String gpsSpeed = jsonObject.getString("gps_speed"); + Long gpsTime = jsonObject.getLong("gps_time"); + String bizId = jsonObject.getString("id"); + NdDataAccessGps dataAccessGps = new NdDataAccessGps(); + dataAccessGps.setCarPlate(vehicleNo); + dataAccessGps.setPlateColor(color.toString()); + dataAccessGps.setCarLongitude(BigDecimal.valueOf(Double.parseDouble(latitude))); + dataAccessGps.setCarLatitude(BigDecimal.valueOf(Double.parseDouble(longitude))); + dataAccessGps.setCarDirection(BigDecimal.valueOf(Double.parseDouble(direction))); + dataAccessGps.setCarVelocity(BigDecimal.valueOf(Double.parseDouble(gpsSpeed))); + // 将毫秒时间戳转换为Instant对象 + Instant instant = Instant.ofEpochMilli(gpsTime); + // 使用北京时间时区转换为LocalDateTime + LocalDateTime localDateTime = instant.atZone(ZoneId.of("Asia/Shanghai")).toLocalDateTime(); + dataAccessGps.setUpdateTime(localDateTime); + dataAccessGps.setCreateTime(LocalDateTime.now()); + dataAccessGps.setBizId(bizId); + return dataAccessGps; + }).collect(Collectors.toList()); + if (CollUtil.isEmpty(dataList)){ + log.info("数据为空!"); + return; + } + log.info("此次拉取到的数据条数:{}",dataList.size()); + // 获取业务数据最大id + Long maxBizId = dataList.stream().map(d -> { + String bizId = d.getBizId(); + return Long.parseLong(bizId); + }).collect(Collectors.toList()).stream().max(Long::compare).get(); + // 保存到缓存中 + cachePlusOps.set(key,maxBizId,false); + // 批量保存数据 每批保存1万条 + // 分批 + List> batchList = new ArrayList<>(ListUtil.partition(new ArrayList<>(dataList), 10000)); + // 创建线程池 线程数是 分批的数量 + ExecutorService executorService = Executors.newFixedThreadPool(batchList.size()); + // 线程计数器,就是 分批的数 + CountDownLatch countDownLatch = new CountDownLatch(batchList.size()); + batchList.forEach(e -> { + // 每个分批用一个线程执行 + executorService.execute(() -> dataAccessGpsService.saveBatch(e, 10000)); + countDownLatch.countDown(); + }); + // 等待所有线程执行完成 + countDownLatch.await(); + executorService.shutdown(); + executorService.awaitTermination(5, TimeUnit.MINUTES); + if (executorService.isTerminated()) { + log.info("子线程执行完毕"); + log.info("主线程开始"); + } + stopWatch.stop(); + log.info("=========== GPS增量数据拉取 ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); + } + + private Map assemblyParams(String key, Long id) { + long timeNow = System.currentTimeMillis() / 1000; + String token = gpsDataPullManage.generateMD5Token(timeNow, key); + + Map params = new HashMap<>(); + params.put("timeNow", String.valueOf(timeNow)); + params.put("token", token); + params.put("id", String.valueOf(id)); + return params; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/task/GpsRealTimeDataPullTask.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/task/GpsRealTimeDataPullTask.java new file mode 100644 index 0000000..0805f39 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/gps/task/GpsRealTimeDataPullTask.java @@ -0,0 +1,257 @@ +package com.ningdatech.carapi.gps.task; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.date.StopWatch; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.carapi.gps.manage.GpsDataPullManage; +import com.ningdatech.carapi.gps.model.entity.DataAccessGpsRealTimeData; +import com.ningdatech.carapi.gps.service.IDataAccessGpsRealTimeDataService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.Statement; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + * @author CMM + * GPS实时数据拉取定时任务 + * @since 2024/10/12 10:39 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class GpsRealTimeDataPullTask { + + @Value("${task.switch.is-open}") + private boolean flag; + + @Value("${task.gps-data-pull.domain}") + private String domain; + + @Value("${task.gps-data-pull.real-time-data-url}") + private String realTimeDataUrl; + + @Value("${task.gps-data-pull.key}") + private String key; + + private final GpsDataPullManage gpsDataPullManage; + private final IDataAccessGpsRealTimeDataService dataAccessGpsRealTimeDataService; + + @Value("${spring.datasource.url}") + private String dataBaseUrl; + @Value("${spring.datasource.username}") + private String username; + @Value("${spring.datasource.password}") + private String password; + + // 定时更新车辆实时GPS数据 每5分钟一次 每次覆盖更新50万条数据 + @Scheduled(cron = "0 */5 * * * ?") + public void doTask() throws Exception { + if (!flag){ + log.info("GPS实时数据拉取定时任务未开启!"); + return; + } + log.info("=========== GPS实时数据拉取 ======== 任务开始"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + gpsDataPullManage.trustAllCertificates(); + + // 经纬度范围 + // 最小纬度 + String sLon = null; + // 最大纬度 + String eLon = null; + // 最小经度 + String sLat = null; + // 最大经度 + String eLat = null; + + // 获取当前表中的最大更新时间 + Long maxUpdateTime = null; + Optional max = dataAccessGpsRealTimeDataService.list(Wrappers.lambdaQuery(DataAccessGpsRealTimeData.class) + .select(DataAccessGpsRealTimeData::getUpdateTime)).stream().max(Comparator.comparing(DataAccessGpsRealTimeData::getUpdateTime)); + if (max.isPresent()){ + maxUpdateTime = max.get().getUpdateTime().atZone(ZoneId.of("Asia/Shanghai")).toInstant().toEpochMilli(); + log.info("当前表中最大更新时间:{}", Instant.ofEpochMilli(maxUpdateTime).atZone(ZoneId.of("Asia/Shanghai")).toLocalDateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + } + Map requestParams = assemblyParams(key,sLon, eLon, sLat, eLat); + String requestUrl = domain + realTimeDataUrl; + String response = gpsDataPullManage.sendPostRequest(requestUrl, requestParams); + if (response == null) { + log.error("下载路径请求失败!"); + return; + } + log.info("Response from server: {}", response); + JSONObject object = null; + try { + object = JSONObject.parseObject(response); + } catch (Exception e) { + log.error("数据拉取失败! {}",e.getMessage()); + return; + } + log.info("Response from server: {}", object); + String downloadUrl = object.getString("data"); + if (downloadUrl == null){ + log.error("下载路径请求失败!"); + return; + } + + String downloadPath = domain + downloadUrl; + String result = gpsDataPullManage.sendDownloadRequest(downloadPath); + if (result == null){ + log.error("文件下载失败!"); + return; + } + List dataList = JSON.parseArray(result, com.alibaba.fastjson.JSONObject.class).stream().map(jsonObject -> { + String vehicleNo = jsonObject.getString("vehicle_no"); + Integer color = jsonObject.getInteger("color"); + // 纬度 + String longitude = jsonObject.getString("lon"); + // 经度 + String latitude = jsonObject.getString("lat"); + String direction = jsonObject.getString("direction"); + String gpsSpeed = jsonObject.getString("gps_speed"); + Long gpsTime = jsonObject.getLong("gps_time"); + DataAccessGpsRealTimeData dataAccessGpsRealTimeData = new DataAccessGpsRealTimeData(); + dataAccessGpsRealTimeData.setCarPlate(vehicleNo); + dataAccessGpsRealTimeData.setPlateColor(color.toString()); + dataAccessGpsRealTimeData.setCarLongitude(latitude); + dataAccessGpsRealTimeData.setCarLatitude(longitude); + dataAccessGpsRealTimeData.setCarDirection(direction); + dataAccessGpsRealTimeData.setCarVelocity(gpsSpeed); + // 将毫秒时间戳转换为Instant对象 + Instant instant = Instant.ofEpochMilli(gpsTime); + // 使用北京时间时区转换为LocalDateTime + LocalDateTime localDateTime = instant.atZone(ZoneId.of("Asia/Shanghai")).toLocalDateTime(); + dataAccessGpsRealTimeData.setUpdateTime(localDateTime); + dataAccessGpsRealTimeData.setCreateTime(LocalDateTime.now()); + return dataAccessGpsRealTimeData; + }).collect(Collectors.toList()); + if (CollUtil.isEmpty(dataList)){ + log.info("数据为空!"); + return; + } + + // 表中有数据 获取此次拉取到的数据中上传时间大于上次拉取数据的最大上报时间的数据 + if (Objects.nonNull(maxUpdateTime)) { + long finalMaxUpdateTime = maxUpdateTime; + dataList = dataList.stream().filter(e -> e.getUpdateTime().atZone(ZoneId.of("Asia/Shanghai")).toInstant().toEpochMilli() > finalMaxUpdateTime).collect(Collectors.toList()); + // 将数据库中的数据根据更新时间排序 按更新时间 从小到大 根据对应id删除此次拉取到的数据量 + List dataAccessGpsRealTimeDataList = dataAccessGpsRealTimeDataService.list(Wrappers.lambdaQuery(DataAccessGpsRealTimeData.class) + .select(DataAccessGpsRealTimeData::getUpdateTime, DataAccessGpsRealTimeData::getRecordId)) + .stream().sorted(Comparator.comparing(DataAccessGpsRealTimeData::getUpdateTime)).collect(Collectors.toList()); + // 截取dataList.size()条数据 + dataAccessGpsRealTimeDataList = dataAccessGpsRealTimeDataList.subList(0, dataList.size()); + // 从旧数据中删除这些数据 + List recordIdList = dataAccessGpsRealTimeDataList.stream().map(DataAccessGpsRealTimeData::getRecordId).collect(Collectors.toList()); + String tableName = "nd_data_access_gps_real_time_data"; + dataAccessGpsRealTimeDataService.removeByRecordIds(tableName,recordIdList); + } + // 如果没有 说明没有新上报的数据 不更新 + if (CollUtil.isEmpty(dataList)){ + log.info("没有新上报的数据!"); + return; + } + log.info("本次拉取到{}条数据", dataList.size()); + // 先清空表中的数据 + //truncateTable(); + + // 批量保存数据 每批保存1万条 + // 分批 + List> batchList = new ArrayList<>(ListUtil.partition(new ArrayList<>(dataList), 10000)); + // 创建线程池 线程数是 分批的数量 + ExecutorService executorService = Executors.newFixedThreadPool(batchList.size()); + // 线程计数器,就是 分批的数 + CountDownLatch countDownLatch = new CountDownLatch(batchList.size()); + batchList.forEach(e -> { + // 每个分批用一个线程执行 + executorService.execute(() -> dataAccessGpsRealTimeDataService.saveBatch(e, 10000)); + countDownLatch.countDown(); + }); + // 等待所有线程执行完成 + countDownLatch.await(); + executorService.shutdown(); + executorService.awaitTermination(5, TimeUnit.MINUTES); + if (executorService.isTerminated()) { + log.info("子线程执行完毕"); + log.info("主线程开始"); + } + stopWatch.stop(); + log.info("=========== GPS实时数据拉取 ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); + } + + private void truncateTable() { + // SQL 语句清空表 + String truncateTableSQL = "TRUNCATE TABLE nd_data_access_gps_real_time_data"; + + Connection conn = null; + Statement stmt = null; + + try { + // 加载数据库驱动 + Class.forName("com.mysql.cj.jdbc.Driver"); + // 建立连接 + conn = DriverManager.getConnection(dataBaseUrl, username, password); + // 创建 Statement 对象 + stmt = conn.createStatement(); + // 执行 SQL 语句 + stmt.executeUpdate(truncateTableSQL); + log.info("表已被清空,自增主键已重置。"); + } catch (Exception e) { + log.error("Error truncating table: {}", e.getMessage()); + } finally { + // 关闭资源 + try { + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (Exception e) { + log.error("Error closing resources: {}", e.getMessage()); + } + } + } + + private Map assemblyParams(String key, String sLon, String eLon, String sLat, String eLat) { + long timeNow = System.currentTimeMillis() / 1000; + String token = gpsDataPullManage.generateMD5Token(timeNow, key); + + Map params = new HashMap<>(); + params.put("timeNow", String.valueOf(timeNow)); + params.put("token", token); + if (StringUtils.isNotBlank(sLon)) { + params.put("Slon", sLon); + } + if (StringUtils.isNotBlank(eLon)) { + params.put("Elon", eLon); + } + if (StringUtils.isNotBlank(sLat)) { + params.put("Slat", sLat); + } + if (StringUtils.isNotBlank(eLat)) { + params.put("Elat", eLat); + } + return params; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/constant/HomepageConstant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/constant/HomepageConstant.java new file mode 100644 index 0000000..03a7073 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/constant/HomepageConstant.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.homepage.constant; + +/** + * @author CMM + * @description + * @since 2022/11/11 17:17 + */ + +public class HomepageConstant { + private HomepageConstant(){} + //首页选择本年按钮时,携带的标志参数 + public static final String YEAR_FLAG = "1"; + //首页选择本月按钮时,携带的标志参数 + public static final String MONTH_FLAG = "2"; + //首页选择本日按钮时,携带的标志参数 + public static final String DAY_FLAG = "3"; + + public static final String REDIS_ONLINE_INDEX = "online_index"; + public static final Integer TIME_INTERVAL = 5; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/controller/AiWorkbenchController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/controller/AiWorkbenchController.java new file mode 100644 index 0000000..cc64ad4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/controller/AiWorkbenchController.java @@ -0,0 +1,79 @@ +package com.ningdatech.carapi.homepage.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.car.vehicle.model.dto.VehicleAuditPageQuery; +import com.ningdatech.carapi.car.vehicle.manage.VehicleManage; +import com.ningdatech.carapi.car.vehicle.model.vo.VehicleBaseVO; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.position.manage.PositionMonitorManage; +import com.ningdatech.carapi.car.position.model.vo.ResRealTimeMonitorVehicleGisListVO; +import com.ningdatech.carapi.driver.manage.DriverArchivesManage; +import com.ningdatech.carapi.driver.model.po.ReqDriverTrainingRegistrationListPO; +import com.ningdatech.carapi.driver.model.vo.ResDriverTrainingRegistrationListVO; +import com.ningdatech.carapi.homepage.entity.dto.HomepageAbnormalBehaviorPageParamDTO; +import com.ningdatech.carapi.homepage.entity.vo.HomepageDriverAbnormalBehaviorVo; +import com.ningdatech.carapi.homepage.entity.vo.HomepageVo; +import com.ningdatech.carapi.homepage.manage.HomepageManage; +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.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * @author CMM + * @description 首页AI工作台 + * @since 2022/11/10 10:05 + */ +@RestController +@Api(tags = "首页AI工作台") +@RequestMapping("/api/homepage/workbench") +@RequiredArgsConstructor +public class AiWorkbenchController { + + private final HomepageManage homepageManage; + private final PositionMonitorManage positionMonitorManage; + private final VehicleManage vehicleManage; + private final DriverArchivesManage driverArchivesManage; + + @ApiOperation("首页数据显示") + @GetMapping + public HomepageVo onlineVehicleStatistics(@Valid @ModelAttribute DataScreenParam param) { + return homepageManage.queryVehicleStatistics(param); + } + + @GetMapping("/monitorVehicleGisList") + @ApiOperation("首页GPS地图车辆分布显示") + public List queryMonitorVehicleGisList(@Valid @ModelAttribute DataScreenParam param) { + return positionMonitorManage.realTimeMonitorVehicleGisList(param); + } + + @GetMapping("/toBeAuditList") + @ApiOperation("首页工作台车辆待审核列表") + public PageVo queryToBeAudit(@Valid @ModelAttribute VehicleAuditPageQuery vehicleAuditPageQuery) { + return vehicleManage.queryToBeAudit(vehicleAuditPageQuery); + } + + @GetMapping("/training/registration/un-deal/list") + @ApiOperation("首页工作台驾驶员待审核列表") + public PageVo queryDriverTrainingRegistrationUnDealList + (@Valid @ModelAttribute ReqDriverTrainingRegistrationListPO po) { + List metaApplyStatusList = new ArrayList<>(); + metaApplyStatusList.add("FIRST_TRIAL_UNDER_REVIEW"); + metaApplyStatusList.add("REEXAMINATION_UNDER_REVIEW"); + po.setMetaApplyStatusList(metaApplyStatusList); + return driverArchivesManage.driverTrainingRegistrationUnDealList(po); + } + + @GetMapping("/abnormalBehavior") + @ApiOperation("首页工作台驾驶员异常行为数据及列表") + public HomepageDriverAbnormalBehaviorVo abnormalBehaviorList(@Valid @ModelAttribute HomepageAbnormalBehaviorPageParamDTO param) { + return homepageManage.abnormalBehaviorList(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/dto/HomepageAbnormalBehaviorPageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/dto/HomepageAbnormalBehaviorPageParamDTO.java new file mode 100644 index 0000000..2a5185a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/dto/HomepageAbnormalBehaviorPageParamDTO.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.homepage.entity.dto; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +import com.ningdatech.carapi.driver.entity.DriverAbnormalBehaviorAnalysisPageParamDTO; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author CMM + * @description + * @since 2022/11/11 11:48 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("首页驾驶员异常行为分页参数DTO") +public class HomepageAbnormalBehaviorPageParamDTO extends DriverAbnormalBehaviorAnalysisPageParamDTO implements Serializable { + + private static final long serialVersionUID = -7248039494876621922L; + @ApiModelProperty("区域ID") + private Long regionId; + private List regionIds; + + @ApiModelProperty("时间筛选条件") + private String timeFlag; + + @ApiModelProperty("筛选当前数据开始时间") + private LocalDateTime queryStartTime; + + @ApiModelProperty("筛选当前数据结束时间") + private LocalDateTime queryEndTime; + + private String dataScopeSql; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/dto/HomepageVehicleAuditPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/dto/HomepageVehicleAuditPageQuery.java new file mode 100644 index 0000000..e3ad892 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/dto/HomepageVehicleAuditPageQuery.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.homepage.entity.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author CMM + * @description + * @since 2022/11/11 09:00 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("首页车辆审核") +public class HomepageVehicleAuditPageQuery extends PagePo implements Serializable { + private static final long serialVersionUID = 255142541885848486L; + + @ApiModelProperty(value = "车牌号") + private String carPlate; + + @ApiModelProperty(value = "所属企业名") + private String companyName; + + @ApiModelProperty(value = "所属区域id") + private Long regionId; + + @ApiModelProperty(value = "企业联系人") + private String driverName; + + @ApiModelProperty(value = "企业联系人电话") + private String mobileNum; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/model/MyCacheHashKey.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/model/MyCacheHashKey.java new file mode 100644 index 0000000..d26683b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/model/MyCacheHashKey.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.homepage.entity.model; + +import com.ningdatech.cache.model.cache.CacheHashKey; +import com.ningdatech.cache.model.cache.CacheKeyBuilder; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * @author CMM + * @since 2023/07/06 10:47 + */ +@Component +@Slf4j +@Data +@AllArgsConstructor +@NoArgsConstructor +public class MyCacheHashKey implements CacheKeyBuilder { + + private String prefix; + + @Override + public String getPrefix() { + return this.prefix; + } + + @Override + public CacheHashKey hashKey(Object... suffix) { + return CacheKeyBuilder.super.hashKey(suffix); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/model/NdDataAccessGps.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/model/NdDataAccessGps.java new file mode 100644 index 0000000..3903a28 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/model/NdDataAccessGps.java @@ -0,0 +1,103 @@ +package com.ningdatech.carapi.homepage.entity.model; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/07/06 10:47 + */ +@Component +@Slf4j +@Data +@RequiredArgsConstructor +@TableName("nd_data_access_gps") +@ApiModel(value = "NdDataAccessGps", description = "车辆GPS") +public class NdDataAccessGps implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @TableId(value = "record_id", type = IdType.AUTO) + private Long recordId; + + @ApiModelProperty("车牌号") + @TableField(value = "car_plate") + private String carPlate; + + @ApiModelProperty("颜色") + @TableField(value = "plate_color") + private String plateColor; + + @ApiModelProperty("坐标") + @TableField(value = "car_longitude") + private BigDecimal carLongitude; + + @ApiModelProperty("坐标") + @TableField(value = "car_latitude") + private BigDecimal carLatitude; + + @ApiModelProperty("坐标") + @TableField(value = "car_altitude") + private BigDecimal carAltitude; + + @ApiModelProperty("坐标") + @TableField(value = "car_velocity") + private BigDecimal carVelocity; + + @ApiModelProperty("坐标") + @TableField(value = "car_direction") + private BigDecimal carDirection; + + @ApiModelProperty("时间") + @TableField(value = "update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("名") + @TableField(value = "operator_name") + private String operatorName; + + @ApiModelProperty("操作ID") + @TableField(value = "operator_id") + private String operatorId; + + @TableField(value = "alarm_flag") + private Long alarmFlag; + + @ApiModelProperty("状态") + @TableField(value = "status") + private Long status; + + @ApiModelProperty("看板那啥") + @TableField(value = "dashboard_mileage") + private Long dashboardMileage; + + @ApiModelProperty("看板速度") + @TableField(value = "dashboard_speed") + private Long dashboardSpeed; + + @TableField(value = "abnormal_causes") + private Integer abnormalCauses; + + @ApiModelProperty("时间") + @TableField(value = "create_time") + private LocalDateTime createTime; + + @ApiModelProperty("业务数据ID") + @TableField(value = "biz_id") + private String bizId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/model/OnlineNumCnt.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/model/OnlineNumCnt.java new file mode 100644 index 0000000..48ddd1b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/model/OnlineNumCnt.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.homepage.entity.model; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author CMM + * @since 2023/07/06 15:42 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OnlineNumCnt { + private Integer cnt; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/po/DriverAbnormalBehaviorNumPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/po/DriverAbnormalBehaviorNumPO.java new file mode 100644 index 0000000..8d63d9a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/po/DriverAbnormalBehaviorNumPO.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.homepage.entity.po; + +import lombok.Data; + +/** + * @author CMM + * @description + * @since 2022/12/09 10:35 + */ +@Data +public class DriverAbnormalBehaviorNumPO { + /** + * 已督办总数 + */ + private Long overSeedCount; + + /** + * 已处理总数 + */ + private Long processedCount; + + /** + * 驾驶员异常行为总数 + */ + private Long total; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/po/VehicleNumPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/po/VehicleNumPO.java new file mode 100644 index 0000000..d283486 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/po/VehicleNumPO.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.homepage.entity.po; + +import lombok.Data; + +/** + * @author PoffyZhang + * @Classname VehicleNumPO + * @Description + * @Date 2022/12/6 9:10 + */ +@Data +public class VehicleNumPO { + + private Integer totalNum; + + private Integer totalOnlineNum; + + private Integer totalOfflineNum; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/vo/HomepageDriverAbnormalBehaviorVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/vo/HomepageDriverAbnormalBehaviorVo.java new file mode 100644 index 0000000..27b89e2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/vo/HomepageDriverAbnormalBehaviorVo.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.homepage.entity.vo; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.driver.model.vo.BehaviourAnalysisVO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author CMM + * @description + * @since 2022/11/11 14:48 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class HomepageDriverAbnormalBehaviorVo { + + @ApiModelProperty("异常行为列表") + private PageVo of; + + @ApiModelProperty("异常行为总数") + private Long abnormalBehaviorTotalNum; + + @ApiModelProperty("已督办总数") + private Long overSeedTotalNum; + + @ApiModelProperty("已处理总数") + private Long processedTotalNum; + + @ApiModelProperty("同比增长率") + private String growthRate; + + @ApiModelProperty("督办率") + private String overSeedRate; + + @ApiModelProperty("处理率") + private String processedRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/vo/HomepageVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/vo/HomepageVo.java new file mode 100644 index 0000000..6c693ab --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/entity/vo/HomepageVo.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.homepage.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @description 首页在线车辆统计Vo + * @since 2022/11/10 15:40 + */ +@Data +public class HomepageVo { + @ApiModelProperty("车辆总数") + private Integer vehicleNum; + + @ApiModelProperty("车辆在线数") + private Integer onlineVehicleNum; + + @ApiModelProperty("车辆离线数") + private Integer offlineVehicleNum; + + @ApiModelProperty("今日累计在线数") + private Integer accumulativeOnlineNumber; + + @ApiModelProperty("车辆上线率") + private String vehicleOnlineRate; + + @ApiModelProperty("车辆离线率") + private String vehicleOfflineRate; + + @ApiModelProperty("车辆累积在线率") + private String accumulativeOnlineRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/manage/HomepageManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/manage/HomepageManage.java new file mode 100644 index 0000000..9a50efd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/manage/HomepageManage.java @@ -0,0 +1,278 @@ +package com.ningdatech.carapi.homepage.manage; + +import java.text.NumberFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.temporal.TemporalAdjusters; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; + +import org.springframework.aop.framework.AopContext; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.archives.enums.AuditStateEnum; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +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.constant.DeletedEnum; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.util.BizUtils; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.driver.entity.DriverAbnormalBehaviorAnalysis; +import com.ningdatech.carapi.driver.entity.DriverAbnormalBehaviorAnalysisPageParamDTO; +import com.ningdatech.carapi.driver.manage.BehaviourAnalysisManage; +import com.ningdatech.carapi.driver.model.vo.BehaviourAnalysisVO; +import com.ningdatech.carapi.homepage.constant.HomepageConstant; +import com.ningdatech.carapi.homepage.entity.dto.HomepageAbnormalBehaviorPageParamDTO; +import com.ningdatech.carapi.homepage.entity.model.OnlineNumCnt; +import com.ningdatech.carapi.homepage.entity.po.DriverAbnormalBehaviorNumPO; +import com.ningdatech.carapi.homepage.entity.po.VehicleNumPO; +import com.ningdatech.carapi.homepage.entity.vo.HomepageDriverAbnormalBehaviorVo; +import com.ningdatech.carapi.homepage.entity.vo.HomepageVo; +import com.ningdatech.carapi.homepage.service.IHomepageService; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @description + * @since 2022/12/08 17:10 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class HomepageManage { + + private final BehaviourAnalysisManage behaviourAnalysisManage; + private final IHomepageService homepageService; + private final OperatorsCacheHelper operatorsCacheHelper; + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final StringRedisTemplate stringRedisTemplate; + /** + * 驾驶员异常行为列表及数据统计 + * @param param + * @return + */ + public HomepageDriverAbnormalBehaviorVo abnormalBehaviorList(HomepageAbnormalBehaviorPageParamDTO param) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DriverAbnormalBehaviorAnalysis.class); + HomepageManage context = (HomepageManage) AopContext.currentProxy(); + + // 装配今年查询时间 + LocalDate year = LocalDate.now(); + HomepageAbnormalBehaviorPageParamDTO paramDTO = getAbnormalBehaviorQueryTimeParamDTO(year, param); + // 根据传入的筛选时间参数和当前时间,从告警表中查出今年的告警异常行为总数、已督办的总数、已处理的总数 + HomepageDriverAbnormalBehaviorVo currentYearResult = context.search(wrapper, paramDTO); + + // 装配去年查询时间 + LocalDate lastYear = LocalDate.now().minusYears(1); + HomepageAbnormalBehaviorPageParamDTO lastYearParamDTO = getAbnormalBehaviorQueryTimeParamDTO(lastYear, param); + // 根据传入的筛选时间参数和当前时间,从告警表中查出上一年同期的告警异常行为总数 + HomepageDriverAbnormalBehaviorVo lastYearResult = context.search(wrapper, lastYearParamDTO); + Long samePeriodTotalNum = lastYearResult.getAbnormalBehaviorTotalNum(); + + log.info("同期告警事件总数为:" + samePeriodTotalNum); + + Long total = currentYearResult.getAbnormalBehaviorTotalNum(); + Long overSeedCount = currentYearResult.getOverSeedTotalNum(); + Long processedCount = currentYearResult.getProcessedTotalNum(); + log.info("告警事件的总数为:" + total); + log.info("告警事件已督办的总数为:" + overSeedCount); + log.info("告警事件已处理的总数为:" + processedCount); + + // 计算督办率 + String overSeedRate = BizUtils.percent(overSeedCount, total); + log.info("督办率为:" + overSeedRate); + currentYearResult.setOverSeedRate(overSeedRate); + // 计算处理率 + String processedRate = BizUtils.percent(processedCount, total); + log.info("处理率为:" + processedRate); + currentYearResult.setProcessedRate(processedRate); + + // 计算同比增长率 + if (Objects.isNull(total)){ + total = 0L; + } + if (Objects.isNull(samePeriodTotalNum)){ + samePeriodTotalNum = 0L; + } + String growthRate = BizUtils.percent(total - samePeriodTotalNum, total); + log.info("同期增长率为:" + growthRate); + currentYearResult.setGrowthRate(growthRate); + + return currentYearResult; + } + + /** + * 获取去年同期查询时间 + * @param param + * @return + */ + private HomepageAbnormalBehaviorPageParamDTO getAbnormalBehaviorQueryTimeParamDTO(LocalDate year, HomepageAbnormalBehaviorPageParamDTO param) { + HomepageAbnormalBehaviorPageParamDTO paramDTO = new HomepageAbnormalBehaviorPageParamDTO(); + LocalDateTime queryStartTime = null; + LocalDateTime queryEndTime = null; + String time = param.getTimeFlag(); + + if (HomepageConstant.YEAR_FLAG.equals(time)) { + // 获取传入年份的第一天及最后一天 + queryStartTime = + LocalDateTime.of(LocalDate.from(year.with(TemporalAdjusters.firstDayOfYear())), LocalTime.MIN); + queryEndTime = + LocalDateTime.of(LocalDate.from(year.with(TemporalAdjusters.lastDayOfYear())), LocalTime.MAX); + } else if (HomepageConstant.MONTH_FLAG.equals(time)) { + // 获取传入年份当前月第一天及最后一天 + queryStartTime = + LocalDateTime.of(LocalDate.from(year.with(TemporalAdjusters.firstDayOfMonth())), LocalTime.MIN); + queryEndTime = + LocalDateTime.of(LocalDate.from(year.with(TemporalAdjusters.lastDayOfMonth())), LocalTime.MAX); + } else if (HomepageConstant.DAY_FLAG.equals(time)) { + // 获取传入年份当天的起始时间 + queryStartTime = LocalDateTime.of(year, LocalTime.MIN); + queryEndTime = LocalDateTime.of(year, LocalTime.MAX); + } + + paramDTO.setQueryStartTime(queryStartTime); + paramDTO.setQueryEndTime(queryEndTime); + paramDTO.setTimeFlag(param.getTimeFlag()); + return paramDTO; + } + + /** + * 驾驶员异常行为按时间标志查询 + * @param wrapper + * @param param + * @return + */ + @LambdaDataScope + public HomepageDriverAbnormalBehaviorVo search(LambdaQueryWrapper wrapper, HomepageAbnormalBehaviorPageParamDTO param) { + HomepageDriverAbnormalBehaviorVo resVo = new HomepageDriverAbnormalBehaviorVo(); + wrapper.orderByDesc(DriverAbnormalBehaviorAnalysis::getAlarmTime); + + // 获取异常行为列表请求实体 + DriverAbnormalBehaviorAnalysisPageParamDTO paramDTO = new DriverAbnormalBehaviorAnalysisPageParamDTO(); + //获取统计数据请求实体 + HomepageAbnormalBehaviorPageParamDTO po = new HomepageAbnormalBehaviorPageParamDTO(); + // 异常行为列表 + PageVo of = null; + + LocalDateTime queryStartTime = param.getQueryStartTime(); + LocalDateTime queryEndTime = param.getQueryEndTime(); + po.setQueryStartTime(queryStartTime); + po.setQueryEndTime(queryEndTime); + if (Objects.nonNull(param.getTimeFlag())) { + paramDTO.setStartTime(queryStartTime); + paramDTO.setEndTime(queryEndTime); + paramDTO.setRegionId(param.getRegionId()); + } + of = behaviourAnalysisManage.behaviorAnalysisList(paramDTO); + + resVo.setOf(of); + // 根据传入的时间标志查询出告警事件的总数以及已督办、已处理事件的总数. + DriverAbnormalBehaviorNumPO driverAbnormalBehaviorNum = homepageService.driverAbnormalBehaviorNum(po); + if (Objects.nonNull(driverAbnormalBehaviorNum)) { + resVo.setAbnormalBehaviorTotalNum(Objects.isNull(driverAbnormalBehaviorNum.getTotal()) ? 0L : driverAbnormalBehaviorNum.getTotal()); + resVo.setOverSeedTotalNum(Objects.isNull(driverAbnormalBehaviorNum.getOverSeedCount()) ? 0L : driverAbnormalBehaviorNum.getOverSeedCount()); + resVo.setProcessedTotalNum(Objects.isNull(driverAbnormalBehaviorNum.getProcessedCount()) ? 0L : driverAbnormalBehaviorNum.getProcessedCount()); + } + return resVo; + } + + /** + * 根据传入的区域id查询车辆状态信息 + * + * @param param + * @return + */ + public HomepageVo queryVehicleStatistics(DataScreenParam param) { + HomepageVo result = new HomepageVo(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商id + Long operatorId = operatorQueryDTO.getId(); + param.setOperatorId(operatorId); + } + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + HomepageManage context = (HomepageManage) AopContext.currentProxy(); + context.buildSearchQuery(wrapper, param); + List vehicleBaseInfos = vehicleBaseInfoService.list(wrapper); + + VehicleNumPO vehicleNumPo = homepageService.vehicleNum(param); + Integer vehicleNum = vehicleNumPo.getTotalNum(); + Integer onlineVehicleNum = 0; + Integer offlineVehicleNum = 0; + + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + Long cnt = vehicleBaseInfos.stream().filter(o -> Objects.nonNull(o) && + Objects.nonNull(o.getStatus()) && o.getStatus() == 1).count(); + stopWatch.stop(); + log.info("共耗时 {}s", stopWatch.getTotalTimeSeconds()); + log.info("缓存中车辆在线数为:" + cnt); + onlineVehicleNum = cnt.intValue(); + offlineVehicleNum = vehicleNum - onlineVehicleNum; + Integer accumulativeOnlineNumber = onlineVehicleNum; + log.info("车辆总数为:" + vehicleNum); + log.info("车辆在线数为:" + onlineVehicleNum); + log.info("车辆离线数为:" + offlineVehicleNum); + log.info("车辆累积在线数为:" + accumulativeOnlineNumber); + + result.setVehicleNum(vehicleNum); + + result.setOnlineVehicleNum(onlineVehicleNum); + result.setOfflineVehicleNum(offlineVehicleNum); + result.setAccumulativeOnlineNumber(accumulativeOnlineNumber); + try { + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(2); + String vehicleOnlineRate = vehicleNum.equals(0) ? "0%" + : numberFormat.format((float)onlineVehicleNum / (float)vehicleNum * 100) + "%"; + log.info("车辆上线率为:" + vehicleOnlineRate); + result.setVehicleOnlineRate(vehicleOnlineRate); + + String vehicleOfflineRate = vehicleNum.equals(0) ? "0%" + : numberFormat.format((float)offlineVehicleNum / (float)vehicleNum * 100) + "%"; + log.info("车辆离线率为:" + vehicleOfflineRate); + result.setVehicleOfflineRate(vehicleOfflineRate); + + String accumulativeOnlineRate = vehicleNum.equals(0) ? "0%" + : numberFormat.format((float)accumulativeOnlineNumber / (float)vehicleNum * 100) + "%"; + log.info("车辆累积在线率为:" + accumulativeOnlineRate); + result.setAccumulativeOnlineRate(accumulativeOnlineRate); + } catch (Exception e) { + log.error("AI工作台异常{}", e.getMessage()); + } + return result; + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildSearchQuery(LambdaQueryWrapper wrapper, DataScreenParam param) { + wrapper.eq(NdVehicleBaseInfo::getDeleted, DeletedEnum.NO_DELETED.getCode()) + .eq(NdVehicleBaseInfo::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()) + .eq(Objects.nonNull(param.getOperatorId()),NdVehicleBaseInfo::getOperatorId,param.getOperatorId()) + .in(Objects.nonNull(param.getCompanyIds()),NdVehicleBaseInfo::getCompanyId,param.getCompanyIds()); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/mapper/DataAccessGpsMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/mapper/DataAccessGpsMapper.java new file mode 100644 index 0000000..82f97be --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/mapper/DataAccessGpsMapper.java @@ -0,0 +1,8 @@ +package com.ningdatech.carapi.homepage.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.homepage.entity.model.NdDataAccessGps; + +public interface DataAccessGpsMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/mapper/HomepageMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/mapper/HomepageMapper.java new file mode 100644 index 0000000..4ae36b8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/mapper/HomepageMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.homepage.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.homepage.entity.dto.HomepageAbnormalBehaviorPageParamDTO; +import com.ningdatech.carapi.homepage.entity.po.DriverAbnormalBehaviorNumPO; +import org.apache.ibatis.annotations.Param; + +public interface HomepageMapper extends BaseMapper { + + Integer searchAccumulativeOnlineNumByTable(@Param("tableName") String tableName, @Param("param") DataScreenParam param); + + Integer searchAccumulativeOnlineNum(@Param("param") DataScreenParam param); + DriverAbnormalBehaviorNumPO selectDriverAbnormalBehaviorNum(@Param("param") HomepageAbnormalBehaviorPageParamDTO param); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/mapper/HomepageMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/mapper/HomepageMapper.xml new file mode 100644 index 0000000..80b17f2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/mapper/HomepageMapper.xml @@ -0,0 +1,88 @@ + + + + + + + + + \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/service/IDataAccessGpsService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/service/IDataAccessGpsService.java new file mode 100644 index 0000000..30de99e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/service/IDataAccessGpsService.java @@ -0,0 +1,13 @@ +package com.ningdatech.carapi.homepage.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.homepage.entity.model.NdDataAccessGps; + +/** + * @author ZPF + * @since 2024/09/20 15:55 + */ +public interface IDataAccessGpsService extends IService { + + Long getMaxBizId(); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/service/IHomepageService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/service/IHomepageService.java new file mode 100644 index 0000000..47e31df --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/service/IHomepageService.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.homepage.service; + +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.homepage.entity.dto.HomepageAbnormalBehaviorPageParamDTO; +import com.ningdatech.carapi.homepage.entity.model.OnlineNumCnt; +import com.ningdatech.carapi.homepage.entity.po.DriverAbnormalBehaviorNumPO; +import com.ningdatech.carapi.homepage.entity.po.VehicleNumPO; + +import java.util.List; + +/** + * @author CMM + * @since 2022/12/08 15:55 + */ +public interface IHomepageService { + + VehicleNumPO vehicleNum(DataScreenParam param); + + Integer searchAccumulativeOnlineNum(DataScreenParam param) ; + + DriverAbnormalBehaviorNumPO driverAbnormalBehaviorNum(HomepageAbnormalBehaviorPageParamDTO param); + + List getOnlineNumCnt(List vehicleBaseInfos); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/service/impl/DataAccessGpsServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/service/impl/DataAccessGpsServiceImpl.java new file mode 100644 index 0000000..84a4bfd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/service/impl/DataAccessGpsServiceImpl.java @@ -0,0 +1,68 @@ +package com.ningdatech.carapi.homepage.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.vehicle.mapper.VehicleBaseInfoJoinMapper; +import com.ningdatech.carapi.car.vehicle.mapper.VehicleBaseInfoMapper; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfoJoin; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.homepage.constant.HomepageConstant; +import com.ningdatech.carapi.homepage.entity.dto.HomepageAbnormalBehaviorPageParamDTO; +import com.ningdatech.carapi.homepage.entity.model.NdDataAccessGps; +import com.ningdatech.carapi.homepage.entity.model.OnlineNumCnt; +import com.ningdatech.carapi.homepage.entity.po.DriverAbnormalBehaviorNumPO; +import com.ningdatech.carapi.homepage.entity.po.VehicleNumPO; +import com.ningdatech.carapi.homepage.mapper.DataAccessGpsMapper; +import com.ningdatech.carapi.homepage.mapper.HomepageMapper; +import com.ningdatech.carapi.homepage.service.IDataAccessGpsService; +import com.ningdatech.carapi.homepage.service.IHomepageService; +import com.ningdatech.carapi.scheduler.mapper.VehicleOnlineStatusDayMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; + +import java.time.Duration; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +/** + * @author zpf + * @description + * @since 2024/09/20 17:10 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class DataAccessGpsServiceImpl extends ServiceImpl implements IDataAccessGpsService { + + @Override + public Long getMaxBizId() { + List list = baseMapper.selectList(Wrappers.lambdaQuery(NdDataAccessGps.class).select(NdDataAccessGps::getBizId)) + .stream().map(d -> { + String bizId = d.getBizId(); + return Long.parseLong(bizId); + }).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(list)){ + return list.stream().max(Long::compare).get(); + } + return null; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/service/impl/HomepageServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/service/impl/HomepageServiceImpl.java new file mode 100644 index 0000000..405d5ae --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/homepage/service/impl/HomepageServiceImpl.java @@ -0,0 +1,145 @@ +package com.ningdatech.carapi.homepage.service.impl; + +import java.time.Duration; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; + +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.vehicle.mapper.VehicleBaseInfoMapper; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.homepage.constant.HomepageConstant; +import com.ningdatech.carapi.homepage.entity.dto.HomepageAbnormalBehaviorPageParamDTO; +import com.ningdatech.carapi.homepage.entity.model.OnlineNumCnt; +import com.ningdatech.carapi.homepage.entity.po.DriverAbnormalBehaviorNumPO; +import com.ningdatech.carapi.homepage.entity.po.VehicleNumPO; +import com.ningdatech.carapi.homepage.mapper.HomepageMapper; +import com.ningdatech.carapi.homepage.service.IHomepageService; +import com.ningdatech.carapi.scheduler.mapper.VehicleOnlineStatusDayMapper; + +import cn.hutool.core.collection.ListUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @description 首页查询车辆信息 + * @since 2022/11/10 17:10 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class HomepageServiceImpl implements IHomepageService { + private final HomepageMapper homepageMapper; + private final VehicleBaseInfoMapper vehicleBaseInfoMapper; + private final VehicleOnlineStatusDayMapper statusDayMapper; + private final StringRedisTemplate stringRedisTemplate; + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public VehicleNumPO vehicleNum(DataScreenParam param) { + return vehicleBaseInfoMapper.searchVehicleNum(param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public Integer searchAccumulativeOnlineNum(DataScreenParam param) { + String tableName = "nd_vehicle_online_status_day_" + NdDateUtils.format(new Date(),"yyyy_MM"); + if(statusDayMapper.countTable(tableName) == 0){ + return homepageMapper.searchAccumulativeOnlineNum(param); + } + return homepageMapper.searchAccumulativeOnlineNumByTable(tableName,param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public DriverAbnormalBehaviorNumPO driverAbnormalBehaviorNum(HomepageAbnormalBehaviorPageParamDTO param) { + return homepageMapper.selectDriverAbnormalBehaviorNum(param); + } + + @Override + public List getOnlineNumCnt(List vehicleBaseInfos) { + Map onlineMap = stringRedisTemplate.opsForHash().entries("online_index"); + + // 分批 + List> batchList = new ArrayList<>(ListUtil.partition(new ArrayList<>(vehicleBaseInfos), 5000)); + // 创建线程池 线程数是 分批的数量 + ExecutorService executorService = Executors.newFixedThreadPool(batchList.size()); + // 线程计数器,就是 分批的数 + CountDownLatch countDownLatch = new CountDownLatch(batchList.size()); + List cntList = Lists.newArrayList(); + batchList.forEach(e -> { + // 创建一个变量 + AtomicInteger value = new AtomicInteger(); + //每个分批用一个线程执行 + executorService.execute(()->{ + List resultList = e.stream().filter(v -> { + // 取到每个数据进行业务执行 + String carPlate = v.getCarPlate(); + LocalDateTime startTime = LocalDateTime.now(); + String timeStamp = (String) onlineMap.get(carPlate); + if (Objects.nonNull(timeStamp)) { + // 将时间戳转换为Instant对象 + Instant instant = Instant.ofEpochSecond(Long.parseLong(timeStamp)); + // 将Instant对象转换为LocalDateTime对象 + LocalDateTime endTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + Duration minuteDuration = Duration.between(endTime,startTime); + long minute = minuteDuration.toMinutes(); + // 判断最后一次上传时间距离当前时间是否大于5分钟 + if (minute <= HomepageConstant.TIME_INTERVAL) { + return true; + } + } + return false; + }).collect(Collectors.toList()); + log.info("当前线程单组在线数为{}",resultList.size()); + // 创建一个 Lambda 表达式,使用闭包给变量赋值 + Consumer consumer = (newValue) -> { + value.set(newValue); + log.info("Value updated to " + value); + }; + consumer.accept(resultList.size()); + OnlineNumCnt onlineNumCnt = new OnlineNumCnt(); + onlineNumCnt.setCnt(value.get()); + cntList.add(onlineNumCnt); + }); + countDownLatch.countDown(); + }); + try { + // 等待所有线程执行完成 + countDownLatch.await(); + } catch (InterruptedException e) { + throw new BizException(e.getMessage()); + } + executorService.shutdown(); + try { + executorService.awaitTermination(5, TimeUnit.MINUTES); + } catch (InterruptedException e) { + throw new BizException(e.getMessage()); + } + if (executorService.isTerminated()) { + log.info("子线程执行完毕"); + log.info("主线程开始"); + } + return cntList; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/contants/CertificateContant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/contants/CertificateContant.java new file mode 100644 index 0000000..7bc5c2e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/contants/CertificateContant.java @@ -0,0 +1,52 @@ +package com.ningdatech.carapi.industry.contants; + +public interface CertificateContant { + + public final static Integer OPERATION_TYPE_APPCATION = 1; + + public final static String OPERATION_TYPE_APPCATION_NAME = "申请"; + + public final static Integer OPERATION_TYPE_REISSUE = 2; + + public final static String OPERATION_TYPE_REISSUE_NAME = "补换"; + + public final static Integer AUDIT_FLAG = 0; + public final static Integer AUDIT_PASS_FLAG = 1; + + + + class ScoringRubric{ + /** + * 上传资质评分细则 + */ + public final static String UPLOAD_QUALIFICATION_SCORING_RUBRIC = "服务商只能上传散装水泥专用车辆,且授权服务的车辆的卫星定位数据,不得违规上传。判定标准: 不满足要求的上传数据为不合格数据"; + /** + * 上传频率数量评分细则 + */ + public final static String UPLOAD_FREQUENCY_QUANTITY_SCORING_RUBRIC = "卫星定位数据上传间隔: 在点火状态下,车辆上传间隔为每15~20秒1条;在熄火状态下,车辆上传间隔为每14~16分钟1条。车辆熄火后终端至少需要传输2小时熄火定位数据。判定标准: 计算不满足要求的程度,超过一定程度,则认为当天数据不合格。若当天上传数据总量少于60条或大于10000条,也认为当天数据不合格。〔缺失的定义: 点火状态下30秒以上未上传,熄火状态下16分钟以上未上传. 冗余的定义: 点火状态下15秒以内上传,熄火状态下14分钟以内上传〕"; + /** + * 字段完整性评分细则 + */ + public final static String FIELD_INTEGRITY_SCORING_RUBRIC = "上传的卫星定位数据中速度、经度、纬度、高度、方向、时间,仪表盘速度、里程计读数,状态码、警报码、营运商编号字段不能为空。判定标准: 存在以上重要字段缺失,则认为该数据不合格"; + /** + * 时效性评分细则 + */ + public final static String TIME_SENSITIVE_SCORING_RUBRIC = "上传的卫星定位数据的观测时间不得晚于监管平台服务端的接收时间,监管平台服务端数据接收时间不能延迟1分钟以上。判定标准: 不满足以上任一要求,则认为该数据不合格"; + /** + * 位置及方向的正确性、一致性评分细则 + */ + public final static String POSITION_DIRECTION_CORRECTNESS_CONSISTENCY_SCORING_RUBRIC = "上传的卫星定位数据的经纬度在中国范围内;位置必须真实有效;不能遗漏必要数据;熄火状态或定位速度为0时,前后距离变化在5公里内;海拔要求在-200米至6000米; 方向要求0度至359度且数值取整。判定标准:不满足以上任一要求,则认为该数据不合格"; + /** + * 速度的正确性、一致性评分细则 + */ + public final static String SPEED_CORRECTNESS_CONSISTENCY_SCORING_RUBRIC = "上传的卫星定位数据的速度、仪表盘速度要求符合0千米/小时至160千米/小时,必须上传真实有效的仪表盘速度。判定标准: 不满足以上任一要求,则认为该数据不合格"; + /** + * 时间一致性评分细则 + */ + public final static String TIME_CONSISTENCY_SCORING_RUBRIC = "定位数据上传时间小于保存时间。判定标准:不满足以上任一要求,将认为该数据不合格。上传的卫星定位数据的观测时间晚于监管平台服务端的接收时间的记录超过5条,则判定车辆当日不合格"; + /** + * 位置一致性评分细则 + */ + public final static String POSITION_CONSISTENCY_SCORING_RUBRIC = "相邻“两点定位”直线距离不能超过25km。判定标准:不满足以上任一要求,将认为该数据不合格。如果两条相邻记录的距离超过25km则判定车辆当日不合格"; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/DataQualityMonitorController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/DataQualityMonitorController.java new file mode 100644 index 0000000..c2621e2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/DataQualityMonitorController.java @@ -0,0 +1,95 @@ +package com.ningdatech.carapi.industry.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.car.trips.model.dto.VehicleTripsParamDTO; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.industry.manage.DataQualityMonitorManage; +import com.ningdatech.carapi.industry.model.dto.DataQualityMonitorDynamicsPageParamDTO; +import com.ningdatech.carapi.industry.model.dto.DataQualityMonitorGpsPageParamDTO; +import com.ningdatech.carapi.industry.model.dto.DataQualityMonitorStaticPageParamDTO; +import com.ningdatech.carapi.industry.model.vo.DataQualityMonitorDynamicsVO; +import com.ningdatech.carapi.industry.model.vo.DataQualityMonitorGpsVO; +import com.ningdatech.carapi.industry.model.vo.DataQualityMonitorStaticVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +/** + *

+ * 数据质量监控 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@RequestMapping("/api/industry/data-quality-monitor") +@Slf4j +@Validated +@RestController +@Api(value = "DataQualityMonitor", tags = "行业服务-数据质量监控") +@RequiredArgsConstructor +public class DataQualityMonitorController { + + private final DataQualityMonitorManage dataQualityMonitorManage; + + @ApiOperation(value = "静态数据采集监控", notes = "静态数据采集监控") + @GetMapping("/list-static") + public PageVo staticList(@Valid @ModelAttribute DataQualityMonitorStaticPageParamDTO param) { + return dataQualityMonitorManage.staticList(param); + } + + @ApiOperation(value = "静态数据采集监控详情", notes = "静态数据采集监控详情") + @GetMapping("/details-static/{id}") + public DataQualityMonitorStaticVO staticDeatils(@Valid @PathVariable Long id) { + return dataQualityMonitorManage.staticDetails(id); + } + + @ApiOperation(value = "静态数据采集监控导出", notes = "静态数据采集监控导出") + @GetMapping("/export-static") + public void exportStatic(DataQualityMonitorStaticPageParamDTO param, HttpServletResponse response) { + ExcelDownUtil.downXls(response, param, dataQualityMonitorManage::exportStatic); + } + + @ApiOperation(value = "动态数据采集监控", notes = "动态数据采集监控") + @GetMapping("/list-dynamics") + public PageVo dynamicsList(@Valid @ModelAttribute DataQualityMonitorDynamicsPageParamDTO param) { + return dataQualityMonitorManage.dynamicsList(param); + } + + @ApiOperation(value = "动态数据采集监控详情", notes = "动态数据采集监控详情") + @GetMapping("/details-dynamics/{id}") + public DataQualityMonitorDynamicsVO dynamicsDetails(@Valid @PathVariable Long id) { + return dataQualityMonitorManage.dynamicsDetails(id); + } + + @ApiOperation(value = "动态数据采集监控导出", notes = "动态数据采集监控导出") + @GetMapping("/export-dynamics") + public void exportDynamics(DataQualityMonitorDynamicsPageParamDTO param, HttpServletResponse response) { + ExcelDownUtil.downXls(response, param, dataQualityMonitorManage::exportDynamics); + } + + @ApiOperation(value = "异常GPS数据查询报警", notes = "异常GPS数据查询报警") + @GetMapping("/list-gps") + public PageVo gpsList(@Valid @ModelAttribute DataQualityMonitorGpsPageParamDTO param) { + return dataQualityMonitorManage.gpsList(param); + } + + @ApiOperation(value = "异常GPS数据查询报警详情", notes = "异常GPS数据查询报警详情") + @GetMapping("/details-gps/{id}") + public DataQualityMonitorGpsVO gpsDetails(@Valid @PathVariable Long id) { + return dataQualityMonitorManage.gpsDetails(id); + } + + @ApiOperation(value = "异常GPS数据查询报警导出", notes = "异常GPS数据查询报警导出") + @GetMapping("/export-gps") + public void exportGps(DataQualityMonitorGpsPageParamDTO param, HttpServletResponse response) { + ExcelDownUtil.downXls(response, param, dataQualityMonitorManage::exportGps); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/DataScreenController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/DataScreenController.java new file mode 100644 index 0000000..3ae33c6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/DataScreenController.java @@ -0,0 +1,74 @@ +package com.ningdatech.carapi.industry.controller; + +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.vo.*; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.industry.manage.DataScreenManage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; +import java.util.*; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-22 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/industry/data-screen") +@Api(value = "industry", tags = "行业服务-大屏") +@RequiredArgsConstructor +public class DataScreenController { + + private final DataScreenManage dataScreenManage; + + + @ApiOperation(value = "各区域车辆分布", notes = "各区域车辆分布") + @GetMapping("/region") + public List regionDistribution(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return dataScreenManage.regionDistribution(param); + } + + @ApiOperation(value = "全省当前驾驶员合格证数", notes = "全省当前驾驶员合格证数") + @GetMapping("/tain-certificate") + public Map tainCertificate(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return dataScreenManage.tainCertificate(param); + } + + @ApiOperation(value = "实验室从业资格证", notes = "实验室从业资格证") + @GetMapping("/laboratory-qualification-certificate") + public JSONObject laboratoryQualificationCertificate(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return dataScreenManage.laboratoryQualificationCertificate(param); + } + + @ApiOperation(value = "实验室验收合格证", notes = "实验室验收合格证") + @GetMapping("/laboratory-acceptance-certificate") + public JSONObject laboratoryAcceptanceCertificate(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return dataScreenManage.laboratoryAcceptanceCertificate(param); + } + + @ApiOperation(value = "砂浆企业备案证", notes = "砂浆企业备案证") + @GetMapping("/record-certificate-mortar-enterprise") + public JSONObject recordCertificateMortarEnterprise(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return dataScreenManage.recordCertificateMortarEnterprise(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/DriverTrainingCertificateController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/DriverTrainingCertificateController.java new file mode 100644 index 0000000..29a14c0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/DriverTrainingCertificateController.java @@ -0,0 +1,96 @@ +package com.ningdatech.carapi.industry.controller; + + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.industry.contants.CertificateContant; +import com.ningdatech.carapi.industry.manage.DriverTrainingCertificateManage; +import com.ningdatech.carapi.industry.model.dto.DriverTrainingCertificatePageParamDTO; +import com.ningdatech.carapi.industry.model.dto.DriverTrainingCertificateUpdateDTO; +import com.ningdatech.carapi.industry.model.vo.DriverTrainingCertificateOperVO; +import com.ningdatech.carapi.industry.model.vo.DriverTrainingCertificateVO; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * 驾驶员合格证 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-11-03 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/industry/driver-training-certificate") +@Api(value = "DriverTrainingCertificate", tags = "行业服务-驾驶员培训合格证") +@RequiredArgsConstructor +public class DriverTrainingCertificateController { + + private final DriverTrainingCertificateManage driverTrainingCertificateManage; + + @ApiOperation(value = "合格证信息列表", notes = "合格证信息列表") + @GetMapping("/info-list") + public PageVo infoList(@Valid @ModelAttribute DriverTrainingCertificatePageParamDTO param) { + return driverTrainingCertificateManage.infoList(param); + } + + @ApiOperation(value = "合格证信息详情", notes = "合格证信息详情") + @GetMapping("/info-details/{id}") + public DriverTrainingCertificateVO infoDetails(@Valid @PathVariable Long id) { + return driverTrainingCertificateManage.infoDetails(id); + } + + @ApiOperation(value = "新增", notes = "新增") + @PostMapping("/save") + public Long save(@Valid @RequestBody DriverTrainingCertificateUpdateDTO data) { + return driverTrainingCertificateManage.save(data, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "编辑", notes = "编辑") + @PostMapping("/modify") + public DriverTrainingCertificateVO modify(@Valid @RequestBody DriverTrainingCertificateUpdateDTO data) { + return driverTrainingCertificateManage.modify(data, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "合格证申请列表", notes = "合格证申请列表") + @GetMapping("/application-list") + public PageVo applicationList(@Valid @ModelAttribute DriverTrainingCertificatePageParamDTO param) { + return driverTrainingCertificateManage.operationList(param, CertificateContant.OPERATION_TYPE_APPCATION); + } + + @ApiOperation(value = "合格证补发列表", notes = "合格证补发列表") + @GetMapping("/reissue-list") + public PageVo reissueList(@Valid @ModelAttribute DriverTrainingCertificatePageParamDTO param) { + return driverTrainingCertificateManage.operationList(param, CertificateContant.OPERATION_TYPE_REISSUE); + } + + @ApiOperation(value = "审核", notes = "审核") + @RequestMapping("/approve/{id}") + public DriverTrainingCertificateOperVO approve(@Valid @PathVariable Long id) { + return driverTrainingCertificateManage.approve(id, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "取消审核", notes = "取消审核") + @RequestMapping("/unapprove/{id}") + public DriverTrainingCertificateOperVO unapprove(@Valid @PathVariable Long id) { + return driverTrainingCertificateManage.unapprove(id, LoginUserUtil.getUserId()); + } + + @ApiOperation("驾驶员培训合格证书信息列表导出") + @GetMapping("/infoListExport") + public void infoListExport(DriverTrainingCertificatePageParamDTO param,HttpServletResponse response){ + ExcelDownUtil.downXls(response, param, driverTrainingCertificateManage::infoListExport); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/LabAcceptanceCertificateController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/LabAcceptanceCertificateController.java new file mode 100644 index 0000000..394a036 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/LabAcceptanceCertificateController.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.industry.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.industry.manage.LabAcceptanceCertificateManage; +import com.ningdatech.carapi.industry.model.req.LabAcceptanceCertificateListReq; +import com.ningdatech.carapi.industry.model.req.LabAcceptanceCertificateReq; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateAuditReq; +import com.ningdatech.carapi.industry.model.vo.LabAcceptanceCertificateChangeListVo; +import com.ningdatech.carapi.industry.model.vo.LabAcceptanceCertificateListVo; +import com.ningdatech.carapi.industry.service.ILabAcceptanceCertificateService; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import com.ningdatech.log.annotation.WebLog; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +/** + *

+ * 实验室验收合格证 前端控制器 + *

+ * + * @author WendyYang + * @since 2022-11-08 + */ +@RestController +@Api(tags = "行业服务-实验室验收合格证") +@AllArgsConstructor +@RequestMapping("/api/v1/industry/lab-acceptance-certificate") +public class LabAcceptanceCertificateController { + + private final LabAcceptanceCertificateManage labAcceptanceCertificateManage; + private final ILabAcceptanceCertificateService labAcceptanceCertificateService; + + @GetMapping("/list") + @ApiOperation("列表查询") + public PageVo list(LabAcceptanceCertificateListReq req) { + return labAcceptanceCertificateManage.labAcceptanceCertificateList(req); + } + + @GetMapping("/changeList") + @ApiOperation("变更列表查询") + public PageVo changeList(LabAcceptanceCertificateListReq req) { + return labAcceptanceCertificateManage.changeList(req); + } + + @GetMapping("/export") + @ApiOperation("导出") + public void export(LabAcceptanceCertificateListReq req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, labAcceptanceCertificateManage::exportLabAcceptanceCertificate); + } + + @DeleteMapping("/del/{id}") + @ApiOperation("删除") + @WebLog(value = "删除") + public void delete(@PathVariable Long id) { + labAcceptanceCertificateManage.delete(id); + } + + @PostMapping("/saveOrUpdate") + @ApiOperation("新增/修改") + @WebLog(value = "新增/修改") + public void saveOrUpdate(@Valid @RequestBody LabAcceptanceCertificateReq req) { + labAcceptanceCertificateManage.saveOrUpdate(req); + } + + @ApiOperation("审核验收合格证换证申请]") + @PostMapping("/audit") + public Boolean audit(@Valid @RequestBody LabWorkerCertificateAuditReq req){ + return labAcceptanceCertificateManage.audit(req, LoginUserUtil.getUserId()); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/LabWorkerCertificateController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/LabWorkerCertificateController.java new file mode 100644 index 0000000..2281fff --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/LabWorkerCertificateController.java @@ -0,0 +1,86 @@ +package com.ningdatech.carapi.industry.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.industry.enums.LabWorkerCertificateTypeEnum; +import com.ningdatech.carapi.industry.manage.LabWorkerCertificateManage; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateAuditReq; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateListReq; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateReq; +import com.ningdatech.carapi.industry.model.vo.LabWorkerCertificateChangeListVo; +import com.ningdatech.carapi.industry.model.vo.LabWorkerCertificateListVo; +import com.ningdatech.carapi.industry.service.ILabWorkerCertificateService; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import com.ningdatech.log.annotation.WebLog; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +/** + *

+ * 实验室人员从业资格证 前端控制器 + *

+ * + * @author WendyYang + * @since 2022-11-04 + */ +@Api(tags = "行业服务-实验室人员从业资格证") +@RestController +@AllArgsConstructor +@RequestMapping("/api/v1/industry/lab-worker-certificate") +public class LabWorkerCertificateController { + + private final LabWorkerCertificateManage labWorkerCertificateManage; + private final ILabWorkerCertificateService labWorkerCertificateService; + + @GetMapping("/list") + @ApiOperation("实验室人员[从业资格证|继续教育合格证]列表") + public PageVo labWorkerCertificateList(@Valid LabWorkerCertificateListReq req) { + return labWorkerCertificateManage.labWorkerCertificateList(req); + } + + @DeleteMapping("/del/{id}/{type}") + @ApiOperation("删除[从业资格证|继续教育合格证]") + @WebLog(value = "删除[从业资格证|继续教育合格证]", modular = "行业服务") + public void delLabWorkerCertificate(@PathVariable Long id, @PathVariable Integer type) { + // 验证类型合法性 + LabWorkerCertificateTypeEnum.getByCode(type); + labWorkerCertificateManage.delete(id); + } + + @GetMapping("/export") + @ApiOperation("导出实验室人员[从业资格证|继续教育合格证]") + public void exportLabWorkerCertificate(@Valid LabWorkerCertificateListReq req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, labWorkerCertificateManage::labWorkerCertificateExport); + } + + @PostMapping("/saveOrUpdate") + @ApiOperation("保存/修改[从业资格证|继续教育合格证]") + @WebLog(value = "保存/修改[从业资格证|继续教育合格证]", modular = "行业服务") + public void saveLabWorkerCertificate(@Valid @RequestBody LabWorkerCertificateReq req) { + labWorkerCertificateManage.saveOrUpdate(req); + } + + @ApiOperation("实验室人员[从业资格证|继续教育合格证]换证列表") + @GetMapping("/changeList") + public PageVo changeList(@Valid LabWorkerCertificateListReq req) { + return labWorkerCertificateManage.changeCertificate(req); + } + + @ApiOperation("审核[从业资格证|继续教育合格证换证申请]") + @PostMapping("/audit") + public Boolean audit(@Valid @RequestBody LabWorkerCertificateAuditReq req){ + return labWorkerCertificateManage.audit(req, LoginUserUtil.getUserId()); + } + + @ApiOperation("从业资格证取消审核") + @PostMapping("/cancelAudit") + public Boolean cancelAudit(@Valid @RequestBody LabWorkerCertificateAuditReq req){ + return labWorkerCertificateManage.cancelAudit(req, LoginUserUtil.getUserId()); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/MortarEnterpriseFilingCertificateController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/MortarEnterpriseFilingCertificateController.java new file mode 100644 index 0000000..2e8bab0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/MortarEnterpriseFilingCertificateController.java @@ -0,0 +1,80 @@ +package com.ningdatech.carapi.industry.controller; + + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.industry.manage.MortarEnterpriseFilingCertificateManage; +import com.ningdatech.carapi.industry.model.dto.MortarEnterpriseFilingCertificateDTO; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateAuditReq; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateListReq; +import com.ningdatech.carapi.industry.model.vo.MortarEnterpriseFilingCertificateChangeVO; +import com.ningdatech.carapi.industry.model.vo.MortarEnterpriseFilingCertificateVO; +import com.ningdatech.carapi.industry.service.IMortarEnterpriseFilingCertificateService; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; + +/** + *

+ * 砂浆企业备案证 前端控制器 + *

+ * + * @author WendyYang + * @since 2022-11-08 + */ +@Api(tags = "行业服务-砂浆企业备案证") +@RestController +@AllArgsConstructor +@RequestMapping("/api/v1/industry/mortar-enterprise-filing-certificate") +public class MortarEnterpriseFilingCertificateController { + + private final MortarEnterpriseFilingCertificateManage mortarEnterpriseFilingCertificateManage; + private final IMortarEnterpriseFilingCertificateService mortarEnterpriseFilingCertificateService; + + @GetMapping("/list") + @ApiOperation("列表") + public PageVo list(LabWorkerCertificateListReq req) { + return mortarEnterpriseFilingCertificateManage.mortarEnterpriseFilingCertificateList(req); + } + + @GetMapping("/export") + @ApiOperation("导出") + public void export(LabWorkerCertificateListReq req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, mortarEnterpriseFilingCertificateManage::mortarEnterpriseFilingCertificateExport); + } + + @GetMapping("/changeList") + @ApiOperation("换证列表") + public PageVo changeList(LabWorkerCertificateListReq req) { + return mortarEnterpriseFilingCertificateManage.changeList(req); + } + + @DeleteMapping("/del/{id}") + @ApiOperation("删除") + @WebLog(value = "删除") + public void delete(@PathVariable Long id) { + mortarEnterpriseFilingCertificateManage.delete(id); + } + + @PostMapping("/saveOrUpdate") + @ApiOperation("保存/修改") + @WebLog(value = "保存/修改") + public void saveOrUpdate(@Valid @RequestBody MortarEnterpriseFilingCertificateDTO mortarEnterprise) { + mortarEnterpriseFilingCertificateManage.saveOrUpdate(mortarEnterprise); + } + + @ApiOperation("审核砂浆企业备案证换证申请]") + @PostMapping("/audit") + public Boolean audit(@Valid @RequestBody LabWorkerCertificateAuditReq req){ + return mortarEnterpriseFilingCertificateManage.audit(req, LoginUserUtil.getUserId()); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/OperatorAssessmentSystemController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/OperatorAssessmentSystemController.java new file mode 100644 index 0000000..64c3463 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/OperatorAssessmentSystemController.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.industry.controller; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.carapi.industry.manage.OperatorAssessmentManage; +import com.ningdatech.carapi.industry.model.dto.OperatorAssessmentDTO; +import com.ningdatech.carapi.industry.model.vo.OperatorScoreDetailVO; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * 运营商考核系统前端控制器 + * + * @author CMM + * @since 2023/01/05 09:13 + */ +@RequestMapping("/api/industry/operator-assessment-system") +@Slf4j +@Validated +@RestController +@Api(value = "OperatorAssessmentSystem", tags = "行业管理-运营商考核系统") +@RequiredArgsConstructor +public class OperatorAssessmentSystemController { + + private final OperatorAssessmentManage operatorAssessmentManage; + + @ApiOperation(value = "运营商考核详情",notes = "运营商考核详情") + @PostMapping("/detail") + public OperatorScoreDetailVO getOperatorScore(@RequestBody @Valid OperatorAssessmentDTO data){ + return operatorAssessmentManage.getOperatorScore(data); + } + + @GetMapping("/download") + @ApiOperation("下载表格") + public void export(OperatorAssessmentDTO data, HttpServletResponse response) { + operatorAssessmentManage.exportDocx(response,data); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PassportManageController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PassportManageController.java new file mode 100644 index 0000000..bd0f3dc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PassportManageController.java @@ -0,0 +1,93 @@ +package com.ningdatech.carapi.industry.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.industry.manage.PassportManage; +import com.ningdatech.carapi.industry.model.dto.PassportPageParamDTO; +import com.ningdatech.carapi.industry.model.dto.PassportSaveDTO; +import com.ningdatech.carapi.industry.model.dto.PassportUpdateDTO; +import com.ningdatech.carapi.industry.model.vo.PassportVO; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +/** + *

+ * 通行证管理 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/industry/passport") +@Api(value = "PassportManage", tags = "行业服务-通行证管理") +@RequiredArgsConstructor +public class PassportManageController { + + private final PassportManage passportManage; + + @ApiOperation(value = "通行证证书信息", notes = "通行证证书信息") + @GetMapping("/info-list") + public PageVo infoList(@Valid @ModelAttribute PassportPageParamDTO param) { + return passportManage.infoList(param); + } + + @ApiOperation(value = "通行证证书详情", notes = "通行证证书详情") + @GetMapping("/details/{id}") + public PassportVO details(@Valid @PathVariable Long id) { + return passportManage.details(id); + } + + @ApiOperation(value = "通行证申请列表", notes = "通行证申请列表") + @GetMapping("/application-list") + public PageVo applicationList(@Valid @ModelAttribute PassportPageParamDTO param) { + return passportManage.infoList(param); + } + + @ApiOperation(value = "通行证审核列表", notes = "通行证审核列表") + @GetMapping("/approve-list") + public PageVo approveList(@Valid @ModelAttribute PassportPageParamDTO param) { + return passportManage.infoList(param); + } + + @ApiOperation(value = "通行证补发列表", notes = "通行证补发列表") + @GetMapping("/reissue-list") + public PageVo reissueList(@Valid @ModelAttribute PassportPageParamDTO param) { + return passportManage.infoList(param); + } + + @ApiOperation(value = "新增", notes = "新增") + @PostMapping("/save") + public PassportVO save(@Valid @RequestBody PassportSaveDTO passportSave) { + return passportManage.save(passportSave, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "编辑", notes = "编辑") + @PostMapping("/modify") + public PassportVO modify(@Valid @RequestBody PassportUpdateDTO passportUpdate) { + return passportManage.modify(passportUpdate, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "删除", notes = "删除") + @DeleteMapping("/remove/{id}") + public Boolean remove(@Valid @PathVariable Long id) { + return passportManage.remove(id, LoginUserUtil.getUserId()); + } + + @ApiOperation("通行证证书信息列表导出") + @GetMapping("/infoListExport") + public void infoListExport(PassportPageParamDTO param, HttpServletResponse response){ + ExcelDownUtil.downXls(response, param, passportManage::infoListExport); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PurchaseOilController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PurchaseOilController.java new file mode 100644 index 0000000..7716d03 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PurchaseOilController.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.industry.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.industry.manage.PurchaseOilManage; +import com.ningdatech.carapi.industry.model.req.PurchaseOilListReq; +import com.ningdatech.carapi.industry.model.vo.PurchaseOilListVo; +import com.ningdatech.carapi.industry.service.IPurchaseOilService; +import com.ningdatech.log.annotation.WebLog; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + *

+ * 油品采购信息表 前端控制器 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Api(tags = "行业服务-采购信息-油品采购信息") +@RestController +@AllArgsConstructor +@RequestMapping("/api/v1/industry/purchase-oil") +public class PurchaseOilController { + + private final IPurchaseOilService purchaseOilService; + private final PurchaseOilManage purchaseOilManage; + + + @GetMapping("/list") + @ApiOperation("列表") + public PageVo list(PurchaseOilListReq req) { + return purchaseOilManage.purchaseOilList(req); + } + + @DeleteMapping("/del/{id}") + @ApiOperation("删除") + @WebLog(value = "删除") + public void delete(@PathVariable Long id) { + purchaseOilService.removeById(id); + } + + @PostMapping("/saveOrUpdate") + @ApiOperation("保存/修改") + @WebLog(value = "保存/修改") + public void saveOrUpdate(@Valid @RequestBody PurchaseOilListVo req) { + purchaseOilManage.saveOrUpdate(req); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PurchaseRawMaterialController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PurchaseRawMaterialController.java new file mode 100644 index 0000000..daea66e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PurchaseRawMaterialController.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.industry.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.industry.manage.PurchaseRawMaterialManage; +import com.ningdatech.carapi.industry.model.req.PurchaseRawMaterialListReq; +import com.ningdatech.carapi.industry.model.vo.PurchaseRawMaterialListVo; +import com.ningdatech.carapi.industry.service.IPurchaseRawMaterialService; +import com.ningdatech.log.annotation.WebLog; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + *

+ * 原材料采购信息表 前端控制器 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Validated +@Api(tags = "行业服务-采购服务-原材料信息") +@RestController +@AllArgsConstructor +@RequestMapping("/api/v1/industry/purchase-raw-material") +public class PurchaseRawMaterialController { + + private final PurchaseRawMaterialManage purchaseRawMaterialManage; + private final IPurchaseRawMaterialService purchaseRawMaterialService; + + @ApiOperation("列表查询") + @GetMapping("/list") + public PageVo list(PurchaseRawMaterialListReq req) { + return purchaseRawMaterialManage.list(req); + } + + @ApiOperation("保存/修改") + @PostMapping("/saveOrUpdate") + @WebLog(value = "保存/修改") + public void saveOrUpdate(@Valid @RequestBody PurchaseRawMaterialListVo req) { + purchaseRawMaterialManage.saveOrUpdate(req); + } + + @ApiOperation("删除") + @DeleteMapping("/del/{id}") + @WebLog(value = "删除") + public void delete(@PathVariable Long id) { + purchaseRawMaterialService.removeById(id); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PurchaseVehicleController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PurchaseVehicleController.java new file mode 100644 index 0000000..5391c71 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PurchaseVehicleController.java @@ -0,0 +1,54 @@ +package com.ningdatech.carapi.industry.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.industry.manage.PurchaseVehicleManage; +import com.ningdatech.carapi.industry.model.req.PurchaseVehicleListReq; +import com.ningdatech.carapi.industry.model.vo.PurchaseVehicleListVo; +import com.ningdatech.carapi.industry.service.IPurchaseVehicleService; +import com.ningdatech.log.annotation.WebLog; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + *

+ * 车辆采购信息表 前端控制器 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@RestController +@Api(tags = "行业服务-采购服务-车辆采购信息") +@AllArgsConstructor +@RequestMapping("/api/v1/industry/purchase-vehicle") +public class PurchaseVehicleController { + + private final IPurchaseVehicleService purchaseVehicleService; + private final PurchaseVehicleManage purchaseVehicleManage; + + @DeleteMapping("/del/{id}") + @ApiOperation("删除") + @WebLog(value = "删除") + public void delete(@PathVariable Long id) { + purchaseVehicleService.removeById(id); + } + + @GetMapping("/list") + @ApiOperation("列表") + public PageVo list(PurchaseVehicleListReq req) { + return purchaseVehicleManage.purchaseWheelList(req); + } + + @PostMapping("/saveOrUpdate") + @ApiOperation("保存/修改") + @WebLog(value = "保存/修改") + public void saveOrUpdate(@Valid @RequestBody PurchaseVehicleListVo req) { + purchaseVehicleManage.saveOrUpdate(req); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PurchaseWheelController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PurchaseWheelController.java new file mode 100644 index 0000000..ef3cafd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/PurchaseWheelController.java @@ -0,0 +1,59 @@ +package com.ningdatech.carapi.industry.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.industry.manage.PurchaseWheelManage; +import com.ningdatech.carapi.industry.model.req.PurchaseOilListReq; +import com.ningdatech.carapi.industry.model.req.PurchaseWheelListReq; +import com.ningdatech.carapi.industry.model.vo.PurchaseOilListVo; +import com.ningdatech.carapi.industry.model.vo.PurchaseWheelListVo; +import com.ningdatech.carapi.industry.service.IPurchaseWheelService; +import com.ningdatech.log.annotation.WebLog; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import org.springframework.stereotype.Controller; + +import javax.validation.Valid; + +/** + *

+ * 轮胎采购信息表 前端控制器 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@RestController +@Api(tags = "行业服务-采购服务-轮胎采购信息") +@AllArgsConstructor +@RequestMapping("/api/v1/industry/purchase-wheel") +public class PurchaseWheelController { + + private final IPurchaseWheelService purchaseWheelService; + private final PurchaseWheelManage purchaseWheelManage; + + @DeleteMapping("/del/{id}") + @ApiOperation("删除") + @WebLog(value = "删除") + public void delete(@PathVariable Long id) { + purchaseWheelService.removeById(id); + } + + @GetMapping("/list") + @ApiOperation("列表") + public PageVo list(PurchaseWheelListReq req) { + return purchaseWheelManage.purchaseWheelList(req); + } + + @PostMapping("/saveOrUpdate") + @ApiOperation("保存/修改") + @WebLog(value = "保存/修改") + public void saveOrUpdate(@Valid @RequestBody PurchaseWheelListVo req) { + purchaseWheelManage.saveOrUpdate(req); + } + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/ReadyMixedMortarIndustryManageController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/ReadyMixedMortarIndustryManageController.java new file mode 100644 index 0000000..1e73832 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/ReadyMixedMortarIndustryManageController.java @@ -0,0 +1,75 @@ +package com.ningdatech.carapi.industry.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.industry.manage.ReadyMixedMortarManage; +import com.ningdatech.carapi.industry.model.dto.ReadyMixedMortarIndustryManageSaveDTO; +import com.ningdatech.carapi.industry.model.dto.ReadyMixedMortarIndustryManageUpdateDTO; +import com.ningdatech.carapi.industry.model.dto.ReadyMixedPageParamDTO; +import com.ningdatech.carapi.industry.model.vo.ReadyMixedMortarIndustryManageVO; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +/** + *

+ * 预拌砂浆行业管理 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-11-18 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/industry/ready-mixed-mortar") +@Api(value = "PassportManage", tags = "行业服务-通行证管理") +@RequiredArgsConstructor +public class ReadyMixedMortarIndustryManageController { + + private final ReadyMixedMortarManage readyMixedMortarManage; + + @ApiOperation(value = "列表查询", notes = "列表查询") + @GetMapping("/list") + public PageVo list(@Valid @ModelAttribute ReadyMixedPageParamDTO param) { + return readyMixedMortarManage.list(param); + } + + @ApiOperation(value = "通行证证书详情", notes = "通行证证书详情") + @GetMapping("/details/{id}") + public ReadyMixedMortarIndustryManageVO details(@Valid @PathVariable Long id) { + return readyMixedMortarManage.details(id); + } + + @ApiOperation(value = "新增", notes = "新增") + @PostMapping("/save") + public ReadyMixedMortarIndustryManageVO save(@Valid @RequestBody ReadyMixedMortarIndustryManageSaveDTO data) { + return readyMixedMortarManage.save(data, LoginUserUtil.loginUserDetail()); + } + + @ApiOperation(value = "编辑", notes = "编辑") + @PostMapping("/modify") + public ReadyMixedMortarIndustryManageVO modify(@Valid @RequestBody ReadyMixedMortarIndustryManageUpdateDTO data) { + return readyMixedMortarManage.modify(data, LoginUserUtil.loginUserDetail()); + } + + @ApiOperation(value = "删除", notes = "删除") + @DeleteMapping("/remove/{id}") + public Boolean remove(@Valid @PathVariable Long id) { + return readyMixedMortarManage.remove(id, LoginUserUtil.loginUserDetail()); + } + + @ApiOperation("导出") + @GetMapping("/export") + public void export(ReadyMixedPageParamDTO param, HttpServletResponse response) { + ExcelDownUtil.downXls(response, param, readyMixedMortarManage::export); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/RegistrationRecordController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/RegistrationRecordController.java new file mode 100644 index 0000000..bcd69fd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/RegistrationRecordController.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.industry.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.industry.manage.RegistrationRecordManage; +import com.ningdatech.carapi.industry.model.dto.*; +import com.ningdatech.carapi.industry.model.vo.RegistrationRecordVO; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import org.springframework.stereotype.Controller; + +import javax.validation.Valid; + +/** + *

+ * 新车上牌记录 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-11-06 + */ +@Controller +@RequestMapping("/api/industry/registration-record") +@Slf4j +@Validated +@RestController +@Api(value = "RegistrationRecord", tags = "行业服务-新车上牌记录") +@RequiredArgsConstructor +public class RegistrationRecordController { + private final RegistrationRecordManage registrationRecordManage; + + @ApiOperation(value = "上牌信息列表", notes = "上牌信息列表") + @GetMapping("/info-list") + public PageVo infoList(@Valid @ModelAttribute RegistrationRecordPageParamDTO param) { + return registrationRecordManage.infoList(param); + } + + @ApiOperation(value = "上牌信息详情", notes = "上牌信息详情") + @GetMapping("/details/{id}") + public RegistrationRecordVO details(@Valid @PathVariable Long id) { + return registrationRecordManage.details(id); + } + + @ApiOperation(value = "上牌信息申请列表", notes = "上牌信息申请列表") + @GetMapping("/application-list") + public PageVo applicationList(@Valid @ModelAttribute RegistrationRecordPageParamDTO param) { + return registrationRecordManage.infoList(param); + } + + @ApiOperation(value = "新增", notes = "新增") + @PostMapping("/save") + public RegistrationRecordVO save(@Valid @RequestBody RegistrationRecordSaveDTO data) { + return registrationRecordManage.save(data, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "编辑", notes = "编辑") + @PostMapping("/modify") + public RegistrationRecordVO modify(@Valid @RequestBody RegistrationRecordUpdateDTO data) { + return registrationRecordManage.modify(data, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "删除", notes = "删除") + @DeleteMapping("/remove/{id}") + public Boolean remove(@Valid @PathVariable Long id) { + return registrationRecordManage.remove(id, LoginUserUtil.getUserId()); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/SafetyEquipmentInstallUseCertificateController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/SafetyEquipmentInstallUseCertificateController.java new file mode 100644 index 0000000..8f3c951 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/SafetyEquipmentInstallUseCertificateController.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.industry.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.industry.manage.SafetyEquipmentIntallUserCertificateManage; +import com.ningdatech.carapi.industry.model.dto.UseCertPageParamDTO; +import com.ningdatech.carapi.industry.model.dto.UseCertSaveDTO; +import com.ningdatech.carapi.industry.model.dto.UseCertUpdateDTO; +import com.ningdatech.carapi.industry.model.vo.SafetyEquipmentInstallUseCertificateVO; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +/** + *

+ * 安全设备安装使用证书信息 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Controller +@RequestMapping("/api/industry/safety-equipment-install-use-certificate") +@Slf4j +@Validated +@RestController +@Api(value = "SafetyEquipmentInstallUseCertificate", tags = "行业服务-安全设备安装使用证书") +@RequiredArgsConstructor +public class SafetyEquipmentInstallUseCertificateController { + + private final SafetyEquipmentIntallUserCertificateManage safetyEquipmentIntallUserCertificateManage; + + @ApiOperation(value = "证书信息列表", notes = "证书信息列表") + @GetMapping("/list") + public PageVo list(@Valid @ModelAttribute UseCertPageParamDTO param) { + return safetyEquipmentIntallUserCertificateManage.list(param); + } + + @ApiOperation(value = "证书信息详情", notes = "证书信息详情") + @GetMapping("/details/{id}") + public SafetyEquipmentInstallUseCertificateVO details(@Valid @PathVariable Long id) { + return safetyEquipmentIntallUserCertificateManage.details(id); + } + + @ApiOperation(value = "新增", notes = "新增") + @PostMapping("/save") + public SafetyEquipmentInstallUseCertificateVO save(@Valid @RequestBody UseCertSaveDTO data) { + return safetyEquipmentIntallUserCertificateManage.save(data, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "编辑", notes = "编辑") + @PostMapping("/modify") + public SafetyEquipmentInstallUseCertificateVO modify(@Valid @RequestBody UseCertUpdateDTO data) { + return safetyEquipmentIntallUserCertificateManage.modify(data, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "删除", notes = "删除") + @DeleteMapping("/remove/{id}") + public Boolean remove(@Valid @PathVariable Long id) { + return safetyEquipmentIntallUserCertificateManage.remove(id, LoginUserUtil.getUserId()); + } + + @ApiOperation("信息列表导出") + @GetMapping("/infoListExport") + public void infoListExport(UseCertPageParamDTO param, HttpServletResponse response){ + ExcelDownUtil.downXls(response, param, safetyEquipmentIntallUserCertificateManage::infoListExport); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/SafetyEquipmentInstallUseCertificateOperationController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/SafetyEquipmentInstallUseCertificateOperationController.java new file mode 100644 index 0000000..23685fb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/SafetyEquipmentInstallUseCertificateOperationController.java @@ -0,0 +1,68 @@ +package com.ningdatech.carapi.industry.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.industry.manage.SafetyEquipmentInstallUseCertificateOperationManage; +import com.ningdatech.carapi.industry.model.dto.UseCertOperatePageParamDTO; +import com.ningdatech.carapi.industry.model.dto.UseCertOperateUpdateDTO; +import com.ningdatech.carapi.industry.model.vo.SafetyEquipmentInstallUseCertificateOperationVO; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +/** + *

+ * 安全设备安装使用证书操作信息 前端控制器 + *

+ * + * @author CMM + * @since 2022-11-26 + */ +@RestController +@RequestMapping("/api/industry/safety-equipment-install-use-certificate-operation") +@Slf4j +@Validated +@Api(value = "SafetyEquipmentInstallUseCertificateOperation",tags = "行业服务-安全设备安装使用证书") +@RequiredArgsConstructor +public class SafetyEquipmentInstallUseCertificateOperationController { + private final SafetyEquipmentInstallUseCertificateOperationManage safetyEquipmentInstallUseCertificateOperationManage; + + @ApiOperation(value = "证书操作信息列表", notes = "证书操作信息列表") + @GetMapping("/list") + public PageVo list(@Valid @ModelAttribute UseCertOperatePageParamDTO param){ + return safetyEquipmentInstallUseCertificateOperationManage.list(param); + } + + @ApiModelProperty("证书操作信息详情") + @GetMapping("/detail/{id}") + public SafetyEquipmentInstallUseCertificateOperationVO details(@Valid @PathVariable Long id){ + return safetyEquipmentInstallUseCertificateOperationManage.details(id); + } + + @ApiOperation(value = "编辑", notes = "编辑") + @PostMapping("/modify") + public SafetyEquipmentInstallUseCertificateOperationVO modify(@Valid @RequestBody UseCertOperateUpdateDTO data) { + return safetyEquipmentInstallUseCertificateOperationManage.modify(data, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "删除", notes = "删除") + @DeleteMapping("/remove/{id}") + public Boolean remove(@Valid @PathVariable Long id) { + return safetyEquipmentInstallUseCertificateOperationManage.remove(id, LoginUserUtil.getUserId()); + } + + @ApiOperation("安全设备安装使用证书信息列表导出") + @GetMapping("/infoListExport") + public void infoListExport(UseCertOperatePageParamDTO param, HttpServletResponse response){ + ExcelDownUtil.downXls(response, param, safetyEquipmentInstallUseCertificateOperationManage::infoListExport); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/VehicleAnnualInspectionReviewController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/VehicleAnnualInspectionReviewController.java new file mode 100644 index 0000000..e99109a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/controller/VehicleAnnualInspectionReviewController.java @@ -0,0 +1,84 @@ +package com.ningdatech.carapi.industry.controller; + + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.industry.manage.AnnualInspectionReviewManage; +import com.ningdatech.carapi.industry.model.dto.InspectionReviewSaveDTO; +import com.ningdatech.carapi.industry.model.dto.InspectionReviewUpdateDTO; +import com.ningdatech.carapi.industry.model.dto.ReviewPageParamDTO; +import com.ningdatech.carapi.industry.model.vo.VehicleAnnualInspectionReviewApplicationVO; +import com.ningdatech.carapi.industry.model.vo.VehicleAnnualInspectionReviewVO; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +/** + *

+ * 车辆年检年审 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +@Controller +@RequestMapping("/api/industry/vehicle-annual-inspection-review") +@Slf4j +@Validated +@RestController +@Api(value = "VehicleAnnualInspectionReview", tags = "行业服务-车辆年检年审") +@RequiredArgsConstructor +public class VehicleAnnualInspectionReviewController { + + private final AnnualInspectionReviewManage annualInspectionReviewManage; + + @ApiOperation(value = "年检年审记录", notes = "年检年审记录") + @GetMapping("/info-list") + public PageVo infoList(@Valid @ModelAttribute ReviewPageParamDTO param) { + return annualInspectionReviewManage.infoList(param); + } + + @ApiOperation(value = "年检年审记录详情", notes = "年检年审记录详情") + @GetMapping("/details/{id}") + public VehicleAnnualInspectionReviewVO details(@Valid @PathVariable Long id) { + return annualInspectionReviewManage.details(id); + } + + @ApiOperation(value = "年检年审记录申请", notes = "年检年审记录申请") + @GetMapping("/application-list") + public PageVo applicationList(@Valid @ModelAttribute ReviewPageParamDTO param) { + return annualInspectionReviewManage.applicationList(param); + } + + @ApiOperation(value = "新增", notes = "新增") + @PostMapping("/save") + public VehicleAnnualInspectionReviewVO save(@Valid @RequestBody InspectionReviewSaveDTO data) { + return annualInspectionReviewManage.save(data, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "编辑", notes = "编辑") + @PostMapping("/modify") + public VehicleAnnualInspectionReviewVO modify(@Valid @RequestBody InspectionReviewUpdateDTO data) { + return annualInspectionReviewManage.modify(data, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "删除", notes = "删除") + @DeleteMapping("/remove/{id}") + public Boolean remove(@Valid @PathVariable Long id) { + return annualInspectionReviewManage.remove(id, LoginUserUtil.getUserId()); + } + + @ApiOperation("车辆年检年审记录列表导出") + @GetMapping("/infoListExport") + public void infoListExport(ReviewPageParamDTO param, HttpServletResponse response){ + ExcelDownUtil.downXls(response, param, annualInspectionReviewManage::infoListExport); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DataQualityMonitorDynamics.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DataQualityMonitorDynamics.java new file mode 100644 index 0000000..51267c9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DataQualityMonitorDynamics.java @@ -0,0 +1,59 @@ +package com.ningdatech.carapi.industry.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 com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 异常GPS数据监控 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@TableName("nd_data_quality_monitor_dynamics") +@Data +@ApiModel(value = "DataQualityMonitorDynamics对象", description = "动态数据监控") +public class DataQualityMonitorDynamics extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("0正常 1异常") + private Integer state; + + @ApiModelProperty("驾驶员ID") + private Long driverId; + + @ApiModelProperty("驾驶员名字") + private String driverName; + + @ApiModelProperty("数据时间") + private LocalDateTime dataTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DataQualityMonitorGps.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DataQualityMonitorGps.java new file mode 100644 index 0000000..9f028e7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DataQualityMonitorGps.java @@ -0,0 +1,106 @@ +package com.ningdatech.carapi.industry.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * GPS数据质量监控 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@TableName("nd_data_quality_monitor_gps") +@Data +@ApiModel(value = "DataQualityMonitorGps对象", description = "GPS数据质量监控") +public class DataQualityMonitorGps extends BaseEntity 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; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆颜色") + private String plateColor; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("经度") + private BigDecimal longitude; + + @ApiModelProperty("纬度") + private BigDecimal latitude; + + @ApiModelProperty("速度") + private BigDecimal velocity; + + @ApiModelProperty("方向") + private BigDecimal direction; + + @ApiModelProperty("0离线 1在线") + private Integer state; + + @ApiModelProperty("告警级别") + private Integer alarm; + + @ApiModelProperty("告警级别名称") + private String alarmName; + + @ApiModelProperty("异常原因") + private Integer abnormalCauses; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("数据采集时间") + private LocalDateTime dataTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DataQualityMonitorStatic.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DataQualityMonitorStatic.java new file mode 100644 index 0000000..f20612a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DataQualityMonitorStatic.java @@ -0,0 +1,66 @@ +package com.ningdatech.carapi.industry.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 静态数据质量监控 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@TableName("nd_data_quality_monitor_static") +@Data +@ApiModel(value = "DataQualityMonitorStatic对象", description = "静态数据质量监控") +public class DataQualityMonitorStatic extends BaseEntity 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; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("数据类型") + private Integer dataType; + + @ApiModelProperty("数据类型名") + private String dataTypeName; + + @ApiModelProperty("数据异常状态 0正常 1不正常") + private Integer state; + + @ApiModelProperty("批次号") + private String batchNo; + + @ApiModelProperty("数据采集时间") + private LocalDateTime dataTime; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DriverTrainingCertificateJoin.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DriverTrainingCertificateJoin.java new file mode 100644 index 0000000..e9646ec --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DriverTrainingCertificateJoin.java @@ -0,0 +1,60 @@ +package com.ningdatech.carapi.industry.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 com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +/** + *

+ * 驾驶员合格证 + *

+ * + * @author PoffyZhang + * @since 2022-11-03 + */ +@TableName("nd_certificate") +@Data +@ApiModel(value = "DriverTrainingCertificate Join对象", description = "驾驶员合格证") +public class DriverTrainingCertificateJoin extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("驾驶员名") + private String driverName; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("培训时间") + private LocalDateTime trainingTime; + + @ApiModelProperty("培训结果 合格") + private String trainingResult; + + @ApiModelProperty("有效时间") + private LocalDateTime effectiveTime; + + @ApiModelProperty("培训项目") + private String trainingProgram; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DriverTrainingCertificateOper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DriverTrainingCertificateOper.java new file mode 100644 index 0000000..7076915 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DriverTrainingCertificateOper.java @@ -0,0 +1,84 @@ +package com.ningdatech.carapi.industry.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * 驾驶员合格证操作 + *

+ * + * @author PoffyZhang + * @since 2022-11-04 + */ +@TableName("nd_driver_training_certificate_oper") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "DriverTrainingCertificateOper", description = "驾驶员合格证操作") +public class DriverTrainingCertificateOper extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("发证单位") + private String issuedBy; + + @ApiModelProperty("发证日期") + private LocalDateTime issueDate; + + @ApiModelProperty("有效期至") + private LocalDateTime expiryDate; + + @ApiModelProperty("操作类型 1.申请 2.补发") + private Integer operationTypeId; + + @ApiModelProperty("操作类型") + private String operationTypeName; + + @ApiModelProperty("审核状态 0待审核 1已审核") + private Integer auditState; + + @ApiModelProperty("已通过") + private String auditStateName; + + @ApiModelProperty("申请时间") + private LocalDateTime operationTime; + + @ApiModelProperty("申请事项") + private String application; + + @ApiModelProperty("申请原因") + private String applicationReason; + + @ApiModelProperty("驾驶员ID") + private Long driverId; + + @ApiModelProperty("证书ID") + private Long certificateId; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("公司ID") + private Long companyId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DriverTrainingCertificateOperJoin.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DriverTrainingCertificateOperJoin.java new file mode 100644 index 0000000..2fc3ab5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/DriverTrainingCertificateOperJoin.java @@ -0,0 +1,84 @@ +package com.ningdatech.carapi.industry.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 驾驶员合格证操作 + *

+ * + * @author PoffyZhang + * @since 2022-11-04 + */ +@TableName("nd_driver_training_certificate_oper") +@Data +@ApiModel(value = "DriverTrainingCertificateOperJoin", description = "驾驶员合格证操作") +public class DriverTrainingCertificateOperJoin extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("驾驶员名") + private String driverName; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("培训时间") + private LocalDateTime trainingTime; + + @ApiModelProperty("培训结果 合格") + private String trainingResult; + + @ApiModelProperty("有效时间") + private LocalDateTime effectiveTime; + + @ApiModelProperty("培训项目") + private String trainingProgram; + + @ApiModelProperty("合格证id") + private Long certificateId; + + @ApiModelProperty("操作类型 1.申请 2.补发") + private Integer operationTypeId; + + @ApiModelProperty("操作类型") + private String operationTypeName; + + @ApiModelProperty("审核状态 0待审核 1已审核") + private Integer auditState; + + @ApiModelProperty("已通过") + private String auditStateName; + + @ApiModelProperty("申请时间") + private LocalDateTime operationTime; + + @ApiModelProperty("申请事项") + private String application; + + @ApiModelProperty("申请原因") + private String applicationReason; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/LabAcceptanceCertificate.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/LabAcceptanceCertificate.java new file mode 100644 index 0000000..19fc4f1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/LabAcceptanceCertificate.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.industry.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; + +/** + *

+ * 实验室验收合格证 + *

+ * + * @author WendyYang + * @since 2022-11-08 + */ +@Data +@TableName("nd_lab_acceptance_certificate") +@ApiModel(value = "LabAcceptanceCertificate对象", description = "实验室验收合格证") +public class LabAcceptanceCertificate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long 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 String recordItem; + + @ApiModelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("发证时间") + private LocalDate conferDate; + + @ApiModelProperty("有效时间") + private LocalDate validDate; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("发证机关") + private String conferOrg; + + @ApiModelProperty("执行标准") + private String standard; + + @ApiModelProperty("检测项目") + private String testItem; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/LabAcceptanceCertificateChange.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/LabAcceptanceCertificateChange.java new file mode 100644 index 0000000..1fd7fbb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/LabAcceptanceCertificateChange.java @@ -0,0 +1,87 @@ +package com.ningdatech.carapi.industry.entity; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 实验室验收合格证换证 + *

+ * + * @author CMM + * @since 2022-12-16 + */ +@TableName("nd_lab_acceptance_certificate_change") +@Data +@ApiModel(value = "LabAcceptanceCertificateChange对象", description = "实验室验收合格证换证") +public class LabAcceptanceCertificateChange implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long 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 String recordItem; + + @ApiModelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("发证时间") + private LocalDate conferDate; + + @ApiModelProperty("有效时间") + private LocalDate validDate; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("发证机关") + private String conferOrg; + + @ApiModelProperty("检测项目") + private String testItem; + + @ApiModelProperty("执行标准") + private String standard; + + @ApiModelProperty("换证时间(审核通过)") + private LocalDate replacementTime; + + @ApiModelProperty("申请事项") + private String applicationItem; + + @ApiModelProperty("申请原因") + private String applicationReason; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/LabWorkerCertificate.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/LabWorkerCertificate.java new file mode 100644 index 0000000..01b6de7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/LabWorkerCertificate.java @@ -0,0 +1,84 @@ +package com.ningdatech.carapi.industry.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.industry.enums.LabWorkerCertificateTypeEnum; +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; + +/** + *

+ * 实验室人员证书 + *

+ * + * @author WendyYang + * @since 2022-11-04 + */ +@Data +@TableName("nd_lab_worker_certificate") +@ApiModel(value = "LabWorkerCertificate对象", description = "实验室人员证书") +public class LabWorkerCertificate 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 String userName; + + @ApiModelProperty("性别:1 男、2 女") + private Integer gender; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("发证时间") + private LocalDate conferDate; + + @ApiModelProperty("发证机关") + private String conferOrg; + + @ApiModelProperty("有效时间/更换时间") + private LocalDate validDate; + + @ApiModelProperty("备注") + private String remark; + + /** + * @see LabWorkerCertificateTypeEnum + */ + @ApiModelProperty("证书类型") + private Integer certificateType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/LabWorkerCertificateChange.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/LabWorkerCertificateChange.java new file mode 100644 index 0000000..cc67342 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/LabWorkerCertificateChange.java @@ -0,0 +1,90 @@ +package com.ningdatech.carapi.industry.entity; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 实验室人员从业资格证更换 + *

+ * + * @author CMM + * @since 2022-12-16 + */ +@TableName("nd_lab_worker_certificate_change") +@Data +@ApiModel(value = "LabWorkerCertificateChange对象", description = "实验室人员从业资格证更换") +public class LabWorkerCertificateChange 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 String userName; + + @ApiModelProperty("性别:1 男、2 女") + private Integer gender; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("发证时间") + private LocalDate conferDate; + + @ApiModelProperty("发证机关") + private String conferOrg; + + @ApiModelProperty("有效时间") + private LocalDate validDate; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("证书类型:1 从业资格证、2 继续教育合格证") + private Integer certificateType; + + @ApiModelProperty("换证申请事项") + private String applicationItem; + + @ApiModelProperty("换证申请原因") + private String applicationReason; + + @ApiModelProperty("换证时间(审核通过)") + private LocalDate replacementTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/MortarEnterpriseFilingCertificate.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/MortarEnterpriseFilingCertificate.java new file mode 100644 index 0000000..357979f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/MortarEnterpriseFilingCertificate.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.industry.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; + +/** + *

+ * 砂浆企业备案证 + *

+ * + * @author WendyYang + * @since 2022-11-08 + */ +@TableName("nd_mortar_enterprise_filing_certificate") +@ApiModel(value = "MortarEnterpriseFilingCertificate对象", description = "砂浆企业备案证") +@Data +public class MortarEnterpriseFilingCertificate 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 String throughput; + + @ApiModelProperty("备案项目") + private String recordItem; + + @ApiModelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("发证时间") + private LocalDate conferDate; + + @ApiModelProperty("发证机关") + private String conferOrg; + + @ApiModelProperty("有效时间") + private LocalDate validDate; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("执行标准") + private String standards; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/MortarEnterpriseFilingCertificateChange.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/MortarEnterpriseFilingCertificateChange.java new file mode 100644 index 0000000..01c9011 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/MortarEnterpriseFilingCertificateChange.java @@ -0,0 +1,88 @@ +package com.ningdatech.carapi.industry.entity; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 砂浆企业备案证换证 + *

+ * + * @author CMM + * @since 2022-12-15 + */ +@TableName("nd_mortar_enterprise_filing_certificate_change") +@Data +@ApiModel(value = "MortarEnterpriseFilingCertificateChange对象", description = "砂浆企业备案证换证") +public class MortarEnterpriseFilingCertificateChange 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 String throughput; + + @ApiModelProperty("备案项目") + private String recordItem; + + @ApiModelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("发证时间") + private LocalDate conferDate; + + @ApiModelProperty("发证机关") + private String conferOrg; + + @ApiModelProperty("有效时间") + private LocalDate validDate; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("执行标准") + private String standards; + + @ApiModelProperty("换证时间") + private LocalDate replacementTime; + + @ApiModelProperty("申请事项") + private String applicationItem; + + @ApiModelProperty("申请原因") + private String applicationReason; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/OperatorIndexScoreInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/OperatorIndexScoreInfo.java new file mode 100644 index 0000000..b08d0ad --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/OperatorIndexScoreInfo.java @@ -0,0 +1,41 @@ +package com.ningdatech.carapi.industry.entity; + +import java.io.Serializable; + +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; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-01-04 + */ +@TableName("nd_operator_index_score_info") +@Data +@ApiModel(value = "OperatorIndexScoreInfo对象", description = "") +public class OperatorIndexScoreInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("运营商考核指标") + private Integer operatorScoreIndex; + + @ApiModelProperty("运营商考核指标名称") + private String operatorScoreIndexName; + + @ApiModelProperty("运营商考核指标分数") + private Integer operatorScoreIndexScore; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/OperatorScoreInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/OperatorScoreInfo.java new file mode 100644 index 0000000..351db6b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/OperatorScoreInfo.java @@ -0,0 +1,78 @@ +package com.ningdatech.carapi.industry.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-01-04 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@TableName("nd_operator_score_info") +@ApiModel(value = "运营商考核分数对象", description = "") +public class OperatorScoreInfo 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 LocalDateTime updateOn; + + @ApiModelProperty("运营商id") + private Long operatorId; + + @ApiModelProperty("运营商名称") + private String operatorName; + + @ApiModelProperty("上传资质分数") + private Integer uploadQualification; + + @ApiModelProperty("上传频率、数量分数") + private Integer uploadFrequencyQuantity; + + @ApiModelProperty("字段完整性分数") + private Integer fieldIntegrity; + + @ApiModelProperty("时效性分数") + private Integer timeSensitive; + + @ApiModelProperty("位置及方向的正确性、一致性分数") + private Integer positionDirectionCorrectnessConsistency; + + @ApiModelProperty("速度的正确性、一致性分数") + private Integer speedCorrectnessConsistency; + + @ApiModelProperty("时间一致性分数") + private Integer timeConsistency; + + @ApiModelProperty("位置一致性分数") + private Integer positionConsistency; + + @ApiModelProperty("所属季度") + private Integer quarter; + + @ApiModelProperty("所属年份") + private String year; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PassportInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PassportInfo.java new file mode 100644 index 0000000..976c92e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PassportInfo.java @@ -0,0 +1,65 @@ +package com.ningdatech.carapi.industry.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 com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 通行证信息 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +@TableName("nd_passport_info") +@Data +@ApiModel(value = "PassportInfo对象", description = "通行证信息") +public class PassportInfo extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆所有人") + private String vehicleOwner; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("可通行区域") + private String accessibleArea; + + @ApiModelProperty("有效期") + private LocalDateTime expirationDate; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PurchaseOil.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PurchaseOil.java new file mode 100644 index 0000000..c561faa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PurchaseOil.java @@ -0,0 +1,74 @@ +package com.ningdatech.carapi.industry.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.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * 油品采购信息表 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Data +@TableName("nd_purchase_oil") +@ApiModel(value = "PurchaseOil对象", description = "油品采购信息表") +public class PurchaseOil implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("油品名称") + private String oilName; + + @ApiModelProperty("质量等级") + private String qualityLevel; + + @ApiModelProperty("数量") + private Integer number; + + @ApiModelProperty("单价") + private BigDecimal unitPrice; + + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + @ApiModelProperty("采购日期") + private LocalDate purchaseDate; + + @ApiModelProperty("采购单位") + private String purchaseOrg; + + @ApiModelProperty("采购企业ID") + private Long purchaseOrgId; + + @ApiModelProperty("批准部门") + private String approvalDept; + + private Long createBy; + + private LocalDateTime createOn; + + private Long updateBy; + + private LocalDateTime updateOn; + + @ApiModelProperty("公司ID") + private Long companyId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PurchaseRawMaterial.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PurchaseRawMaterial.java new file mode 100644 index 0000000..7c5d8e6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PurchaseRawMaterial.java @@ -0,0 +1,82 @@ +package com.ningdatech.carapi.industry.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 javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * 原材料采购信息表 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Data +@TableName("nd_purchase_raw_material") +@ApiModel(value = "PurchaseRawMaterial对象", description = "原材料采购信息表") +public class PurchaseRawMaterial implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("原材料名称") + private String rawMaterialName; + + @ApiModelProperty("规格型号") + private String model; + + @ApiModelProperty("数量") + private Integer number; + + @ApiModelProperty("计量单位") + private String unit; + + @ApiModelProperty("单价") + private BigDecimal unitPrice; + + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + @ApiModelProperty("采购日期") + private LocalDate purchaseDate; + + @ApiModelProperty("采购单位") + private String purchaseOrg; + + @ApiModelProperty("采购单位ID") + private Long purchaseOrgId; + + private Long createBy; + + private LocalDateTime createOn; + + private Long updateBy; + + private LocalDateTime updateOn; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("批准部门") + private String approvalDept; + + @ApiModelProperty("备注") + private String remark; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PurchaseVehicle.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PurchaseVehicle.java new file mode 100644 index 0000000..f89f998 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PurchaseVehicle.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.industry.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.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 车辆采购信息表 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Data +@TableName("nd_purchase_vehicle") +@ApiModel(value = "PurchaseVehicle对象", description = "车辆采购信息表") +public class PurchaseVehicle implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("车辆品牌") + private String vehicleBrand; + + @ApiModelProperty("车辆类型") + private String vehicleType; + + @ApiModelProperty("数量") + private Integer number; + + @ApiModelProperty("单价") + private BigDecimal unitPrice; + + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + @ApiModelProperty("采购日期") + private LocalDate purchaseDate; + + @ApiModelProperty("采购单位") + private String purchaseOrg; + + @ApiModelProperty("采购企业ID") + private Long purchaseOrgId; + + @ApiModelProperty("批准部门") + private String approvalDept; + + private Long createBy; + + private LocalDateTime createOn; + + private Long updateBy; + + private LocalDateTime updateOn; + + @ApiModelProperty("企业ID") + private Long companyId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PurchaseWheel.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PurchaseWheel.java new file mode 100644 index 0000000..9b9eb6c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/PurchaseWheel.java @@ -0,0 +1,74 @@ +package com.ningdatech.carapi.industry.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.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * 轮胎采购信息表 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Data +@TableName("nd_purchase_wheel") +@ApiModel(value = "PurchaseWheel对象", description = "轮胎采购信息表") +public class PurchaseWheel implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("轮胎品牌") + private String wheelBrand; + + @ApiModelProperty("轮胎类型") + private String wheelType; + + @ApiModelProperty("数量") + private Integer number; + + @ApiModelProperty("单价") + private BigDecimal unitPrice; + + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + @ApiModelProperty("采购日期") + private LocalDate purchaseDate; + + @ApiModelProperty("采购单位") + private String purchaseOrg; + + @ApiModelProperty("采购企业ID") + private Long purchaseOrgId; + + @ApiModelProperty("批准部门") + private String approvalDept; + + private Long createBy; + + private LocalDateTime createOn; + + private Long updateBy; + + private LocalDateTime updateOn; + + @ApiModelProperty("企业ID") + private Long companyId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/ReadyMixedMortarIndustryManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/ReadyMixedMortarIndustryManage.java new file mode 100644 index 0000000..c25c44f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/ReadyMixedMortarIndustryManage.java @@ -0,0 +1,72 @@ +package com.ningdatech.carapi.industry.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; + +/** + *

+ * 预拌砂浆行业管理 + *

+ * + * @author PoffyZhang + * @since 2022-11-18 + */ +@TableName("nd_ready_mixed_mortar_industry_manage") +@Data +@ApiModel(value = "ReadyMixedMortarIndustryManage对象", description = "预拌砂浆行业管理") +public class ReadyMixedMortarIndustryManage 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; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("修改人") + private Long updateBy; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("0启用 1禁用") + private Integer state; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司id") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("file id") + private Long fileId; + + @ApiModelProperty("文件名") + private String fileName; + + @ApiModelProperty("下载次数") + private Integer downTimes; + + @ApiModelProperty("内容") + private String content; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/RegistrationRecord.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/RegistrationRecord.java new file mode 100644 index 0000000..fac863c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/RegistrationRecord.java @@ -0,0 +1,75 @@ +package com.ningdatech.carapi.industry.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.math.BigDecimal; +import java.time.LocalDateTime; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 新车上牌记录 + *

+ * + * @author PoffyZhang + * @since 2022-11-06 + */ +@TableName("nd_registration_record") +@Data +@ApiModel(value = "RegistrationRecord对象", description = "新车上牌记录") +public class RegistrationRecord extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车架号") + private String vin; + + @ApiModelProperty("引擎号") + private String engineNo; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("已上牌 未上牌") + private String registrationRecord; + + @ApiModelProperty("车辆品牌") + private String vehicleBrand; + + @ApiModelProperty("车辆型号") + private String vehicleModels; + + @ApiModelProperty("购买价格") + private BigDecimal purchasePrice; + + @ApiModelProperty("购买日期") + private LocalDateTime purchaseDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/SafetyEquipmentInstallUseCertificate.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/SafetyEquipmentInstallUseCertificate.java new file mode 100644 index 0000000..d4ea838 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/SafetyEquipmentInstallUseCertificate.java @@ -0,0 +1,75 @@ +package com.ningdatech.carapi.industry.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; + +/** + *

+ * 安全设备安装使用证书信息 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@TableName("nd_safety_equipment_install_use_certificate") +@Data +@ApiModel(value = "SafetyEquipmentInstallUseCertificate对象", description = "安全设备安装使用证书信息") +public class SafetyEquipmentInstallUseCertificate 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; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("终端运营商") + private String endOperator; + + @ApiModelProperty("年检记录") + private String annualInspectionRecords; + + @ApiModelProperty("安装凭证") + private String installCertificate; + + @ApiModelProperty("发证日期") + private LocalDateTime issueDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/SafetyEquipmentInstallUseCertificateOperation.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/SafetyEquipmentInstallUseCertificateOperation.java new file mode 100644 index 0000000..aabd5b4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/SafetyEquipmentInstallUseCertificateOperation.java @@ -0,0 +1,95 @@ +package com.ningdatech.carapi.industry.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; + +/** + *

+ * 安全设备安装使用证书操作信息 + *

+ * + * @author CMM + * @since 2022-11-26 + */ +@Data +@TableName("nd_safety_equipment_install_use_certificate_operation") +@ApiModel(value = "SafetyEquipmentInstallUseCertificateOperation对象", description = "安全设备安装使用证书操作信息") +public class SafetyEquipmentInstallUseCertificateOperation 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; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("终端运营商") + private String endOperator; + + @ApiModelProperty("年检记录") + private String annualInspectionRecords; + + @ApiModelProperty("安装凭证") + private String installCertificate; + + @ApiModelProperty("发证日期") + private LocalDateTime issueDate; + + @ApiModelProperty("申请状态") + private String applicationStatus; + + @ApiModelProperty("申请事项") + private String applicationItem; + + @ApiModelProperty("年检状态") + private String yearCheckStatus; + + @ApiModelProperty("补换状态") + private String replacementStatus; + + @ApiModelProperty("视频运营商") + private String videoOperator; + + @ApiModelProperty("证书编号") + private Long certificateNumber; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/VehicleAnnualInspectionReview.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/VehicleAnnualInspectionReview.java new file mode 100644 index 0000000..758145a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/entity/VehicleAnnualInspectionReview.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.industry.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 com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 车辆年检年审 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +@TableName("nd_vehicle_annual_inspection_review") +@Data +@ApiModel(value = "VehicleAnnualInspectionReview对象", description = "车辆年检年审") +public class VehicleAnnualInspectionReview extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("年检记录") + private String inspectionRecords; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型") + private String vehicleTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/AbnormalDataTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/AbnormalDataTypeEnum.java new file mode 100644 index 0000000..19200c3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/AbnormalDataTypeEnum.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.industry.enums; + +import com.ningdatech.carapi.common.constant.GenderEnum; +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * 异常数据类型 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "AbnormalDataTypeEnum", description = "异常数据类型-枚举") +public enum AbnormalDataTypeEnum { + /** + * 运政 + */ + TRANSPORT_ADMINISTRATION(1, "运政"), + + /** + *运营商 + */ + OPERATOR(2, "运营商"), + + /** + * 电子路单 + */ + ELECTRONIC_WAYBILL(3, "电子路单"); + + + private Integer code; + private String desc; + + public String getDesc() { + return desc; + } + + public static String getDescByCode(Integer code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (AbnormalDataTypeEnum t : AbnormalDataTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/AddTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/AddTypeEnum.java new file mode 100644 index 0000000..7f69209 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/AddTypeEnum.java @@ -0,0 +1,51 @@ +package com.ningdatech.carapi.industry.enums; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2023/01/04 11:03 + */ + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "AddTypeEnum", description = "证书添加类型-枚举") +public enum AddTypeEnum { + /** + * 证书新增类型 + */ + NEW(1,"新增"), + REPLACE(2,"换证"); + + private Integer code; + private String desc; + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(Integer code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (AddTypeEnum t : AddTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/DataQualityMonitorGpsEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/DataQualityMonitorGpsEnum.java new file mode 100644 index 0000000..3381d2b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/DataQualityMonitorGpsEnum.java @@ -0,0 +1,107 @@ +package com.ningdatech.carapi.industry.enums; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2023/01/04 14:18 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "DataQualityMonitorGpsEnum", description = "数据质量监控Gps异常原因-枚举") +public enum DataQualityMonitorGpsEnum { + /** + * 上传资质异常 + */ + UPLOAD_QUALIFICATION_ANOMALY(1,"上传资质异常"), + + /** + *上传频率异常 + */ + UPLOAD_FREQUENCY_ANOMALY(2,"上传频率异常"), + + /** + *上传数量异常 + */ + UPLOAD_QUANTITY_ANOMALY(4,"上传数量异常"), + + /** + * 字段完整性异常 + */ + FIELD_INTEGRITY_ANOMALY(8,"字段完整性异常"), + + /** + * 时效性异常 + */ + TIME_SENSITIVE_ANOMALY(16,"时效性异常"), + + /** + * 位置及方向的正确性、一致性异常 + */ + POSITION_DIRECTION_CORRECTNESS_CONSISTENCY_ANOMALY(32,"位置及方向的正确性、一致性异常"), + + /** + * 速度的正确性、一致性异常 + */ + SPEED_CORRECTNESS_CONSISTENCY_ANOMALY(64,"速度的正确性、一致性异常"), + + /** + * 时间一致性异常 + */ + TIME_CONSISTENCY_ANOMALY(128,"时间一致性异常"), + + /** + * 位置一致性异常 + */ + POSITION_CONSISTENCY_ANOMALY(256,"位置一致性异常"); + + + private Integer code; + private String desc; + + public String getDesc() { + return desc; + } + + public Integer getCode() { + return code; + } + + public static String getDescByCode(Integer code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (DataQualityMonitorGpsEnum t : DataQualityMonitorGpsEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static DataQualityMonitorGpsEnum getEnumByValue(Integer code) { + if(Objects.isNull(code)){ + return null; + } + for (DataQualityMonitorGpsEnum t : DataQualityMonitorGpsEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } + + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/LabWorkerCertificateTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/LabWorkerCertificateTypeEnum.java new file mode 100644 index 0000000..01ff0ce --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/LabWorkerCertificateTypeEnum.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.industry.enums; + +import lombok.Getter; + +import java.util.Arrays; + +/** + *

+ * LabWorkerCertificateTypeEnum + *

+ * + * @author WendyYang + * @since 11:26 2022/11/8 + */ +@Getter +public enum LabWorkerCertificateTypeEnum { + + /** + * 实验室人员从业资格证 + */ + QUALIFICATION(1, "实验室人员从业资格证"), + EDUCATION(2, "实验室从业人员继续教育合格证"); + + private final int code; + + private final String value; + + LabWorkerCertificateTypeEnum(int code, String value) { + this.code = code; + this.value = value; + } + + public static LabWorkerCertificateTypeEnum getByCode(int code) { + return Arrays.stream(values()) + .filter(w -> w.getCode() == code) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("无效的证书类型编码")); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/OperatorAssessmentIndexEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/OperatorAssessmentIndexEnum.java new file mode 100644 index 0000000..aca8c58 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/OperatorAssessmentIndexEnum.java @@ -0,0 +1,100 @@ +package com.ningdatech.carapi.industry.enums; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * 运营商考核指标枚举 + * + * @author CMM + * @since 2023/01/05 09:37 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "OperatorAssessmentIndexEnum", description = "运营商考核指标-枚举") +public enum OperatorAssessmentIndexEnum { + /** + * 上传资质 + */ + UPLOAD_QUALIFICATION(1,"上传资质"), + + /** + *上传频率、数量 + */ + UPLOAD_FREQUENCY_QUANTITY(2,"上传频率、数量"), + + /** + * 字段完整性 + */ + FIELD_INTEGRITY(3,"字段完整性"), + + /** + * 时效性 + */ + TIME_SENSITIVE(4,"时效性"), + + /** + * 位置及方向的正确性、一致性 + */ + POSITION_DIRECTION_CORRECTNESS_CONSISTENCY(5,"位置及方向的正确性、一致性"), + + /** + * 速度的正确性、一致性 + */ + SPEED_CORRECTNESS_CONSISTENCY(6,"速度的正确性、一致性"), + + /** + * 时间一致性 + */ + TIME_CONSISTENCY(7,"时间一致性"), + + /** + * 位置一致性 + */ + POSITION_CONSISTENCY(8,"位置一致性"); + + + private Integer code; + private String desc; + + public String getDesc() { + return desc; + } + + public Integer getCode() { + return code; + } + + public static String getDescByCode(Integer code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (OperatorAssessmentIndexEnum t : OperatorAssessmentIndexEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static OperatorAssessmentIndexEnum getEnumByValue(Integer code) { + if(Objects.isNull(code)){ + return null; + } + for (OperatorAssessmentIndexEnum t : OperatorAssessmentIndexEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/QuarterEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/QuarterEnum.java new file mode 100644 index 0000000..f199f09 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/enums/QuarterEnum.java @@ -0,0 +1,50 @@ +package com.ningdatech.carapi.industry.enums; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.Objects; + +/** + * @return + * @author CMM + * @since 2023/01/04 11:03 + */ + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "QuarterEnum", description = "季度-枚举") +public enum QuarterEnum { + FIRST_QUARTER(1,"第一季度"), + SECOND_QUARTER(2,"第二季度"), + THIRD_QUARTER(3,"第三季度"), + FOURTH_QUARTER(4,"第四季度"); + + private Integer code; + private String desc; + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(Integer code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (QuarterEnum t : QuarterEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/AnnualInspectionReviewManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/AnnualInspectionReviewManage.java new file mode 100644 index 0000000..0527996 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/AnnualInspectionReviewManage.java @@ -0,0 +1,240 @@ +package com.ningdatech.carapi.industry.manage; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import com.alibaba.excel.EasyExcel; +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.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.constant.CommonConstant; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.industry.entity.VehicleAnnualInspectionReview; +import com.ningdatech.carapi.industry.model.dto.InspectionReviewSaveDTO; +import com.ningdatech.carapi.industry.model.dto.InspectionReviewUpdateDTO; +import com.ningdatech.carapi.industry.model.dto.ReviewPageParamDTO; +import com.ningdatech.carapi.industry.model.dto.VehicleAnnualInspectionExportDTO; +import com.ningdatech.carapi.industry.model.vo.VehicleAnnualInspectionReviewApplicationVO; +import com.ningdatech.carapi.industry.model.vo.VehicleAnnualInspectionReviewVO; +import com.ningdatech.carapi.industry.service.IVehicleAnnualInspectionReviewService; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +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 lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname AnnualInspectionReviewManage + * @Description + * @Date 2022/11/3 17:57 + * @Created by PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class AnnualInspectionReviewManage { + + private final IVehicleAnnualInspectionReviewService vehicleAnnualInspectionReviewService; + private final OperatorsCacheHelper operatorsCacheHelper; + private final IVehicleBaseInfoService vehicleBaseInfoService; + + public PageVo infoList(ReviewPageParamDTO param) { + Page page = param.page(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 查询出该运营商下所有车辆 + List baseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)); + List carPlateList = baseInfoList.stream().map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + param.setCarPlateList(carPlateList); + } + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(VehicleAnnualInspectionReview.class); + AnnualInspectionReviewManage context = (AnnualInspectionReviewManage) AopContext.currentProxy(); + context.search(page,wrapper,param); + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.of(Collections.emptyList(), page.getTotal()); + } + List data = page.getRecords().stream().map(w -> convert(w)).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + public VehicleAnnualInspectionReviewVO details(Long id) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(VehicleAnnualInspectionReview.class); + AnnualInspectionReviewManage context = (AnnualInspectionReviewManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + VehicleAnnualInspectionReview record = vehicleAnnualInspectionReviewService.getOne(wrapper); + if (Objects.isNull(record)){ + return null; + } + + //VehicleAnnualInspectionReview record = vehicleAnnualInspectionReviewService.getById(id); + return convert(record); + } + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(VehicleAnnualInspectionReview::getId,id); + } + + public PageVo applicationList(ReviewPageParamDTO param) { + Page page = param.page(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 查询出该运营商下所有车辆 + List baseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)); + List carPlateList = baseInfoList.stream().map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + param.setCarPlateList(carPlateList); + } + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(VehicleAnnualInspectionReview.class); + AnnualInspectionReviewManage context = (AnnualInspectionReviewManage) AopContext.currentProxy(); + context.search(page,wrapper,param); + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.of(Collections.emptyList(), page.getTotal()); + } + List data = page.getRecords().stream().map(w -> convertApplication(w)).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + + /** + * 查询 + * @param page + * @param param + */ + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(wrapperIndex = 1,entityIndex = 2) + public void search(Page page, LambdaQueryWrapper wrapper,ReviewPageParamDTO param) { + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()), VehicleAnnualInspectionReview::getCompanyName, param.getCompanyName()) + .like(StringUtils.isNotBlank(param.getCarPlate()), VehicleAnnualInspectionReview::getCarPlate, param.getCarPlate()) + .eq(Objects.nonNull(param.getVehicleType()), VehicleAnnualInspectionReview::getVehicleType, param.getVehicleType()) + .eq(StringUtils.isNoneBlank(param.getInspectionRecords()), VehicleAnnualInspectionReview::getInspectionRecords, param.getInspectionRecords()) + .in(CollUtil.isNotEmpty(param.getCarPlateList()),VehicleAnnualInspectionReview::getCarPlate,param.getCarPlateList()) + .orderBy(Boolean.TRUE,Boolean.FALSE, VehicleAnnualInspectionReview::getUpdateOn); + vehicleAnnualInspectionReviewService.page(page, wrapper); + } + + private VehicleAnnualInspectionReviewVO convert(VehicleAnnualInspectionReview review) { + if(Objects.isNull(review)){ + return null; + } + VehicleAnnualInspectionReviewVO vo = BeanUtil.copyProperties(review, VehicleAnnualInspectionReviewVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + } + + private VehicleAnnualInspectionReviewApplicationVO convertApplication(VehicleAnnualInspectionReview review) { + VehicleAnnualInspectionReviewApplicationVO vo = BeanUtil.copyProperties(review, VehicleAnnualInspectionReviewApplicationVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + vo.setStatus("首次申请"); + vo.setOperation("无"); + return vo; + } + + + public VehicleAnnualInspectionReviewVO save(InspectionReviewSaveDTO data, Long userId) { + VehicleAnnualInspectionReview review = BeanUtil.copyProperties(data, VehicleAnnualInspectionReview.class); + review.setRegionId(LoginUserUtil.loginUserDetail().getRegionId()); + CodeUtil.searchCompanyNameAndRegionName(review); + if(Objects.nonNull(data.getVehicleType())){ + Optional.ofNullable(VehicleTypeEnum.getDescByCode(data.getVehicleType())).ifPresent(vehicleTypeName -> + review.setVehicleTypeName(vehicleTypeName)); + } + review.setCreateBy(userId); + review.setUpdateBy(userId); + vehicleAnnualInspectionReviewService.save(review); + return BeanUtil.copyProperties(review, VehicleAnnualInspectionReviewVO.class); + } + + public VehicleAnnualInspectionReviewVO modify(InspectionReviewUpdateDTO data, Long userId) { + VehicleAnnualInspectionReview review = BeanUtil.copyProperties(data, VehicleAnnualInspectionReview.class); + CodeUtil.searchCompanyNameAndRegionName(review); + if(Objects.nonNull(data.getVehicleType())){ + Optional.ofNullable(VehicleTypeEnum.getDescByCode(data.getVehicleType())).ifPresent(vehicleTypeName -> + review.setVehicleTypeName(vehicleTypeName)); + } + review.setUpdateBy(userId); + vehicleAnnualInspectionReviewService.updateById(review); + return BeanUtil.copyProperties(review, VehicleAnnualInspectionReviewVO.class); + } + + public Boolean remove(Long id, Long userId) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(VehicleAnnualInspectionReview.class); + AnnualInspectionReviewManage context = (AnnualInspectionReviewManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + VehicleAnnualInspectionReview record = vehicleAnnualInspectionReviewService.getOne(wrapper); + if (Objects.isNull(record)){ + throw new BizException("无法撤销!"); + } + + vehicleAnnualInspectionReviewService.removeById(id); + return Boolean.TRUE; + } + + public void infoListExport(HttpServletResponse response, ReviewPageParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = infoList(param); + List collect = page.getRecords().stream().map(r -> { + VehicleAnnualInspectionExportDTO exportDTO = new VehicleAnnualInspectionExportDTO(); + BeanUtils.copyProperties(r, exportDTO); + return exportDTO; + }).collect(Collectors.toList()); + String fileName = "车辆年检年审记录列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), VehicleAnnualInspectionExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/DataQualityMonitorManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/DataQualityMonitorManage.java new file mode 100644 index 0000000..fa9f2dd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/DataQualityMonitorManage.java @@ -0,0 +1,304 @@ +package com.ningdatech.carapi.industry.manage; + +import java.io.IOException; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import com.alibaba.excel.EasyExcel; +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.basic.util.NdDateUtils; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.constant.VehicleStatusEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.industry.entity.DataQualityMonitorDynamics; +import com.ningdatech.carapi.industry.entity.DataQualityMonitorGps; +import com.ningdatech.carapi.industry.entity.DataQualityMonitorStatic; +import com.ningdatech.carapi.industry.enums.DataQualityMonitorGpsEnum; +import com.ningdatech.carapi.industry.model.dto.*; +import com.ningdatech.carapi.industry.model.vo.DataQualityMonitorDynamicsVO; +import com.ningdatech.carapi.industry.model.vo.DataQualityMonitorGpsVO; +import com.ningdatech.carapi.industry.model.vo.DataQualityMonitorStaticVO; +import com.ningdatech.carapi.industry.service.IDataQualityMonitorDynamicsService; +import com.ningdatech.carapi.industry.service.IDataQualityMonitorGpsService; +import com.ningdatech.carapi.industry.service.IDataQualityMonitorStaticService; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +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 lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname DataQualityMonitorManage + * @Description + * @Date 2022/11/07 17:57 + * @Created by PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class DataQualityMonitorManage { + + private final IDataQualityMonitorStaticService dataQualityMonitorStaticService; + private final IDataQualityMonitorDynamicsService dataQualityMonitorDynamicsService; + private final IDataQualityMonitorGpsService dataQualityMonitorGpsService; + + private final RegionsCacheHelper regionsCacheHelper; + private final OperatorsCacheHelper operatorsCacheHelper; + private final IVehicleBaseInfoService vehicleBaseInfoService; + + public PageVo staticList(DataQualityMonitorStaticPageParamDTO param) { + Page page = param.page(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 查询出该运营商下所有车辆所在的所有企业 + List companyIds = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)) + .stream().map(NdVehicleBaseInfo::getCompanyId).collect(Collectors.toList()); + HashSet set = new HashSet<>(); + List companyIdList = companyIds.stream().filter(c -> set.add(c)).collect(Collectors.toList()); + // 过滤掉不在这些企业下的数据 + param.setCompanyIds(companyIdList); + } + + searchStatic(page,param); + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.of(Collections.emptyList(), page.getTotal()); + } + List data = page.getRecords().stream().map(w -> convertStatic(w)).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + public DataQualityMonitorStaticVO staticDetails(Long id) { + DataQualityMonitorStatic record = dataQualityMonitorStaticService.getById(id); + + return convertStatic(record); + } + + public PageVo dynamicsList(DataQualityMonitorDynamicsPageParamDTO param) { + Page page = param.page(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 查询出该运营商下所有车辆所在的所有企业 + List baseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)); + List carPlateList = baseInfoList.stream() + .map(NdVehicleBaseInfo::getCarPlate) + .collect(Collectors.toList()); + // 过滤掉不在这些企业下的数据 + param.setCarPlateList(carPlateList); + } + + searchDynamics(page,param); + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.of(Collections.emptyList(), page.getTotal()); + } + List data = page.getRecords().stream().map(w -> convertDynamics(w)).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + public DataQualityMonitorDynamicsVO dynamicsDetails(Long id) { + DataQualityMonitorDynamics record = dataQualityMonitorDynamicsService.getById(id); + + return convertDynamics(record); + } + + public PageVo gpsList(DataQualityMonitorGpsPageParamDTO param) { + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DataQualityMonitorGps.class); + searchGps(page, param,wrapper); + + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商id + Long operatorId = operatorQueryDTO.getId(); + wrapper.eq(DataQualityMonitorGps::getOperatorId,operatorId); + } + + dataQualityMonitorGpsService.page(page, wrapper); + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.of(Collections.emptyList(), page.getTotal()); + } + List data = page.getRecords().stream().map(this::convertGps).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + + } + + public DataQualityMonitorGpsVO gpsDetails(Long id) { + DataQualityMonitorGps record = dataQualityMonitorGpsService.getById(id); + + return convertGps(record); + } + + /** + * 查询 + * @param page + * @param param + */ + private void searchStatic(Page page, DataQualityMonitorStaticPageParamDTO param) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DataQualityMonitorStatic.class); + wrapper.like(StringUtils.isNotBlank(param.getBatchNo()), DataQualityMonitorStatic::getBatchNo, param.getBatchNo()) + .like(Objects.nonNull(param.getState()), DataQualityMonitorStatic::getState, param.getState()) + .ge(Objects.nonNull(param.getStartTime()), DataQualityMonitorStatic::getDataTime, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), DataQualityMonitorStatic::getDataTime, param.getEndTime()) + .in(CollUtil.isNotEmpty(param.getCompanyIds()),DataQualityMonitorStatic::getCompanyId,param.getCompanyIds()) + .orderBy(Boolean.TRUE,Boolean.FALSE, DataQualityMonitorStatic::getDataTime); + dataQualityMonitorStaticService.page(page, wrapper); + } + + private void searchDynamics(Page page, DataQualityMonitorDynamicsPageParamDTO param) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DataQualityMonitorDynamics.class); + wrapper.like(StringUtils.isNotBlank(param.getCarPlate()), DataQualityMonitorDynamics::getCarPlate, param.getCarPlate()) + .like(Objects.nonNull(param.getState()), DataQualityMonitorDynamics::getState, param.getState()) + .ge(Objects.nonNull(param.getStartTime()), DataQualityMonitorDynamics::getDataTime, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), DataQualityMonitorDynamics::getDataTime, param.getEndTime()) + .in(CollUtil.isNotEmpty(param.getCarPlateList()),DataQualityMonitorDynamics::getCarPlate,param.getCarPlateList()) + .orderBy(Boolean.TRUE,Boolean.FALSE, DataQualityMonitorDynamics::getDataTime); + dataQualityMonitorDynamicsService.page(page, wrapper); + } + + private void searchGps(Page page, DataQualityMonitorGpsPageParamDTO param, LambdaQueryWrapper wrapper) { + if(Objects.nonNull(param.getRegionId())){ + List regionIds = regionsCacheHelper.listChildRegionId(param.getRegionId()); + wrapper.in(CollUtil.isNotEmpty(regionIds), DataQualityMonitorGps::getRegionId,regionIds); + } + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()), DataQualityMonitorGps::getCompanyName, param.getCompanyName()) + .like(Objects.nonNull(param.getVehicleType()), DataQualityMonitorGps::getVehicleType, param.getVehicleType()) + .like(StringUtils.isNotBlank(param.getCarPlate()), DataQualityMonitorGps::getCarPlate, param.getCarPlate()) + .like(StringUtils.isNotBlank(param.getPlateColor()), DataQualityMonitorGps::getPlateColor, param.getPlateColor()) + .like(StringUtils.isNotBlank(param.getOperatorName()), DataQualityMonitorGps::getOperatorName, param.getOperatorName()) + .ge(Objects.nonNull(param.getStartTime()), DataQualityMonitorGps::getDataTime, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), DataQualityMonitorGps::getDataTime, param.getEndTime()) + .orderBy(Boolean.TRUE,Boolean.FALSE, DataQualityMonitorGps::getDataTime); + } + + private DataQualityMonitorStaticVO convertStatic(DataQualityMonitorStatic data) { + return BeanUtil.copyProperties(data, DataQualityMonitorStaticVO.class); + } + + private DataQualityMonitorDynamicsVO convertDynamics(DataQualityMonitorDynamics data) { + if(Objects.isNull(data)){ + return null; + } + DataQualityMonitorDynamicsVO vo = BeanUtil.copyProperties(data, DataQualityMonitorDynamicsVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + } + + private DataQualityMonitorGpsVO convertGps(DataQualityMonitorGps data) { + if(Objects.isNull(data)){ + return null; + } + DataQualityMonitorGpsVO vo = BeanUtil.copyProperties(data, DataQualityMonitorGpsVO.class); + vo.setAbnormalCausesName(DataQualityMonitorGpsEnum.getDescByCode(vo.getAbnormalCauses())); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + } + + public void exportStatic(HttpServletResponse response, DataQualityMonitorStaticPageParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = staticList(param); + List collect = page.getRecords().stream().map(w -> BeanUtil.copyProperties(w, DataQualityMonitorStaticVO.class)).collect(Collectors.toList()); + String fileName = "静态监控采集列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), DataQualityMonitorStaticExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void exportDynamics(HttpServletResponse response, DataQualityMonitorDynamicsPageParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = dynamicsList(param); + List collect = page.getRecords().stream().map(w -> + BeanUtil.copyProperties(w, DataQualityMonitorDynamicsVO.class)).collect(Collectors.toList()); + String fileName = "动态监控采集列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), DataQualityMonitorDynamicsExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void exportGps(HttpServletResponse response, DataQualityMonitorGpsPageParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = gpsList(param); + List collect = page.getRecords().stream().map(w -> { + DataQualityMonitorGpsExportDTO gpsExportDTO = new DataQualityMonitorGpsExportDTO(); + BeanUtils.copyProperties(w,gpsExportDTO); + String timeStr = NdDateUtils.format(w.getDataTime(), NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + gpsExportDTO.setDataTime(timeStr); + gpsExportDTO.setState(VehicleStatusEnum.getDescByCode(w.getState())); + return gpsExportDTO; + }).collect(Collectors.toList()); + String fileName = "GPS监控采集列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), DataQualityMonitorGpsExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/DataScreenManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/DataScreenManage.java new file mode 100644 index 0000000..ecf4a6c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/DataScreenManage.java @@ -0,0 +1,98 @@ +package com.ningdatech.carapi.industry.manage; + +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.vo.RegionDistributionStatisticsVO; +import com.ningdatech.carapi.car.datascreen.service.VehicleStatisticsService; +import com.ningdatech.carapi.industry.model.po.CeriticatePO; +import com.ningdatech.carapi.industry.service.DataScreenService; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @author PoffyZhang + * @Classname DataScreenManage + * @Description + * @Date 2022/12/15 19:06 + */ +@Component +@RequiredArgsConstructor +public class DataScreenManage { + + private final VehicleStatisticsService vehicleStatisticsService; + + private final DataScreenService dataScreenService; + + private final RegionsCacheHelper regionsCacheHelper; + + public List regionDistribution(DataScreenParam param) { + return vehicleStatisticsService.getRegionDistribution(param); + } + + public Map tainCertificate(DataScreenParam param) { + Map res = new LinkedHashMap<>(); + List list = dataScreenService.tainCertificate(param); + complementaryRegion(list, param.getRegionId()); + for (CeriticatePO ceriticate : list) { + res.put(ceriticate.getRegionName(), ceriticate.getCount()); + } + + return res; + } + + public JSONObject laboratoryQualificationCertificate(DataScreenParam param) { + JSONObject res = new JSONObject(true); + List list = dataScreenService.laboratoryQualificationCertificate(param); + complementaryRegion(list, param.getRegionId()); + for (CeriticatePO ceriticate : list) { + res.put(ceriticate.getRegionName(), ceriticate.getCount()); + } + return res; + } + + public JSONObject laboratoryAcceptanceCertificate(DataScreenParam param) { + JSONObject res = new JSONObject(true); + List list = dataScreenService.laboratoryAcceptanceCertificate(param); + complementaryRegion(list, param.getRegionId()); + for (CeriticatePO ceriticate : list) { + res.put(ceriticate.getRegionName(), ceriticate.getCount()); + } + return res; + } + + public JSONObject recordCertificateMortarEnterprise(DataScreenParam param) { + JSONObject res = new JSONObject(true); + List list = dataScreenService.recordCertificateMortarEnterprise(param); + complementaryRegion(list, param.getRegionId()); + for (CeriticatePO ceriticate : list) { + res.put(ceriticate.getRegionName(), ceriticate.getCount()); + } + return res; + } + + private void complementaryRegion(List list, Long regionId) { + List regions = regionsCacheHelper.listChildOnly(regionId, true); + Map regionMap = CollUtils.listToMap(list, CeriticatePO::getRegionName); + List tmpList = new ArrayList<>(); + regions.forEach(w -> { + CeriticatePO ceriticate = regionMap.get(w.getRegionName()); + if (ceriticate == null) { + ceriticate = new CeriticatePO(); + ceriticate.setRegionId(w.getId()); + ceriticate.setRegionName(w.getRegionName()); + ceriticate.setCount(0); + } + tmpList.add(ceriticate); + }); + list.clear(); + list.addAll(tmpList); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/DriverTrainingCertificateManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/DriverTrainingCertificateManage.java new file mode 100644 index 0000000..7f04cc2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/DriverTrainingCertificateManage.java @@ -0,0 +1,359 @@ +package com.ningdatech.carapi.industry.manage; + +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import com.alibaba.excel.EasyExcel; +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.exception.code.ExceptionCode; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.archives.enums.ApproveStateEnum; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.driver.entity.Certificate; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.service.ICertificateService; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.industry.contants.CertificateContant; +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateJoin; +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateOper; +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateOperJoin; +import com.ningdatech.carapi.industry.model.dto.DriverTrainingCertificateExportDTO; +import com.ningdatech.carapi.industry.model.dto.DriverTrainingCertificatePageParamDTO; +import com.ningdatech.carapi.industry.model.dto.DriverTrainingCertificateUpdateDTO; +import com.ningdatech.carapi.industry.model.vo.DriverTrainingCertificateOperVO; +import com.ningdatech.carapi.industry.model.vo.DriverTrainingCertificateVO; +import com.ningdatech.carapi.industry.service.IDriverTrainingCertificateJoinService; +import com.ningdatech.carapi.industry.service.IDriverTrainingCertificateOperJoinService; +import com.ningdatech.carapi.industry.service.IDriverTrainingCertificateOperService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname DriverTrainingCertificateManage + * @Description + * @Date 2022/11/3 17:57 + * @Created by PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class DriverTrainingCertificateManage { + + private final IDriverTrainingCertificateJoinService driverTrainingCertificateJoinService; + private final IDriverTrainingCertificateOperService driverTrainingCertificateOperService; + private final IDriverTrainingCertificateOperJoinService driverTrainingCertificateOperJoinService; + + private final ICertificateService certificateService; + private final IDriverInfoService driverInfoService; + private final RegionsCacheHelper regionCacheHelper; + + /** + * 合格证信息列表 + */ + public PageVo infoList(DriverTrainingCertificatePageParamDTO param) { + Page page = param.page(); + LambdaQueryWrapper query + = Wrappers.lambdaQuery(DriverTrainingCertificateJoin.class); + DriverTrainingCertificateManage context = (DriverTrainingCertificateManage) AopContext.currentProxy(); + context.search(page,query,param); + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + List data = page.getRecords().stream().map(w -> convert(w)).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + public DriverTrainingCertificateVO infoDetails(Long id) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Certificate.class); + DriverTrainingCertificateManage context = (DriverTrainingCertificateManage) AopContext.currentProxy(); + context.buildCertificateQuery(wrapper, id); + Certificate certificate = certificateService.getOne(wrapper); + if (Objects.isNull(certificate)){ + return null; + } + //Certificate certificate = certificateService.getById(id); + DriverTrainingCertificateOper oper = driverTrainingCertificateOperService + .getOne(Wrappers.lambdaQuery(DriverTrainingCertificateOper.class) + .eq(DriverTrainingCertificateOper::getCertificateId, id) + .last("limit 1")); + + DriverInfo driverInfo = driverInfoService.getById(certificate.getDriverId()); + + DriverTrainingCertificateVO vo = new DriverTrainingCertificateVO(); + vo.setId(id); + vo.setDriverId(certificate.getDriverId()); + vo.setDriverName(certificate.getDriverName()); + vo.setIdCard(driverInfo.getIdCard()); + vo.setCertificateNo(certificate.getCertificateNo()); + if(Objects.nonNull(oper)){ + vo.setCertificateType(oper.getOperationTypeId()); + vo.setCertificateTypeName(oper.getOperationTypeName()); + } + + vo.setIssuedBy(certificate.getIssuedBy()); + vo.setIssueDate(certificate.getIssueDate()); + vo.setDriverLicenseNo(certificate.getDriverLicenseNo()); + vo.setExpiryDate(certificate.getExpiryDate()); + vo.setCompanyId(certificate.getCompanyId()); + vo.setCompanyName(certificate.getCompanyName()); + vo.setRemark(certificate.getRemark()); + return vo; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildCertificateQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(Certificate::getId,id); + } + + /** + * 合格证申请列表 + */ + public PageVo operationList(DriverTrainingCertificatePageParamDTO param, Integer operationTypeAppcation) { + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DriverTrainingCertificateOperJoin.class); + DriverTrainingCertificateManage context = (DriverTrainingCertificateManage) AopContext.currentProxy(); + context.searchJoin(page,wrapper,param,operationTypeAppcation); + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + List data = page.getRecords().stream().map(w -> convertOper(w)).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + public DriverTrainingCertificateOperVO approve(Long id, Long userId) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DriverTrainingCertificateOper.class); + DriverTrainingCertificateManage context = (DriverTrainingCertificateManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + DriverTrainingCertificateOper oper = driverTrainingCertificateOperService.getOne(wrapper); + if(Objects.isNull(oper)){ + throw new BizException(ExceptionCode.OPERATION_EX.getCode(), "此id证书操作不存在"); + } + oper.setUpdateBy(userId); + oper.setAuditState(ApproveStateEnum.AUDIT_SUCESS.getCode()); + oper.setAuditStateName(ApproveStateEnum.AUDIT_SUCESS.getDesc()); + driverTrainingCertificateOperService.updateById(oper); + // 将审核通过的证书信息保存到证书表中 + // 如果是新增证书,审核后先判断合格证列表中是否已经存在该驾驶员的合格证信息 + Long driverId = oper.getDriverId(); + if (oper.getOperationTypeId().equals(CertificateContant.OPERATION_TYPE_APPCATION)){ + List certificateList = certificateService.list(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getDriverId, driverId) + .gt(Certificate::getExpiryDate, LocalDateTime.now())); + if (CollectionUtil.isNotEmpty(certificateList)) { + throw new BizException("该驾驶员证书已上传"); + } + } + DriverInfo driverInfo = driverInfoService.getById(driverId); + Certificate certificate = new Certificate(); + BeanUtils.copyProperties(oper,certificate); + certificate.setUserId(driverInfo.getUserId()); + certificate.setBirth(driverInfo.getBirth()); + certificate.setGender(driverInfo.getGender()); + certificate.setNativePlace(driverInfo.getNativePlace()); + certificate.setHealth(driverInfo.getHealth()); + certificate.setPhoneNo(driverInfo.getPhoneNo()); + certificate.setAddress(driverInfo.getAddress()); + certificate.setDriverLicenseType(driverInfo.getDriverLicenseType()); + certificate.setRegionId(driverInfo.getRegionId()); + certificate.setRegionName(regionCacheHelper.getDisplayName(driverInfo.getRegionId())); + certificate.setCompanyId(driverInfo.getCompanyId()); + certificate.setCompanyName(driverInfo.getCompanyName()); + // 如果是补换证书,更新原来存在的证书信息 + if (oper.getOperationTypeId().equals(CertificateContant.OPERATION_TYPE_REISSUE)){ + certificate.setId(oper.getCertificateId()); + } + certificateService.saveOrUpdate(certificate); + return BeanUtil.copyProperties(oper,DriverTrainingCertificateOperVO.class); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(DriverTrainingCertificateOper::getId,id); + } + + public DriverTrainingCertificateOperVO unapprove(Long id, Long userId) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DriverTrainingCertificateOper.class); + DriverTrainingCertificateManage context = (DriverTrainingCertificateManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + DriverTrainingCertificateOper oper = driverTrainingCertificateOperService.getOne(wrapper); + if(Objects.isNull(oper)){ + throw new BizException(ExceptionCode.OPERATION_EX.getCode(), "此id证书操作不存在"); + } + oper.setUpdateBy(userId); + oper.setAuditState(ApproveStateEnum.AUDIT.getCode()); + oper.setAuditStateName(ApproveStateEnum.AUDIT.getDesc()); + driverTrainingCertificateOperService.updateById(oper); + return BeanUtil.copyProperties(oper,DriverTrainingCertificateOperVO.class); + } + + /** + * 查询 + * @param page + * @param param + */ + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(wrapperIndex = 1,entityIndex = 2) + public void search(Page page,LambdaQueryWrapper wrapper,DriverTrainingCertificatePageParamDTO param) { + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()), DriverTrainingCertificateJoin::getCompanyName, param.getCompanyName()) + .like(StringUtils.isNotBlank(param.getIdCard()), DriverTrainingCertificateJoin::getIdCard, param.getIdCard()) + .like(StringUtils.isNotBlank(param.getDriverName()), DriverTrainingCertificateJoin::getDriverName, param.getDriverName()) + .eq(StringUtils.isNotBlank(param.getTrainingResult()), DriverTrainingCertificateJoin::getTrainingResult, param.getTrainingResult()) + .ge(Objects.nonNull(param.getStartTime()), DriverTrainingCertificateJoin::getTrainingTime, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), DriverTrainingCertificateJoin::getTrainingTime, param.getEndTime()) + .orderByDesc(DriverTrainingCertificateJoin::getUpdateOn); + driverTrainingCertificateJoinService.pageJoin(page, wrapper); + } + + /** + * 查询 + * @param page + * @param param + */ + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public void searchJoin(Page page,LambdaQueryWrapper wrapper,DriverTrainingCertificatePageParamDTO param,Integer operationTypeAppcation) { + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()),DriverTrainingCertificateOperJoin::getCompanyName, param.getCompanyName()) + .like(StringUtils.isNotBlank(param.getIdCard()),DriverTrainingCertificateOperJoin::getIdCard, param.getIdCard()) + .like(StringUtils.isNotBlank(param.getDriverName()),DriverTrainingCertificateOperJoin::getDriverName, param.getDriverName()) + .eq(StringUtils.isNotBlank(param.getTrainingResult()),DriverTrainingCertificateOperJoin::getTrainingResult, param.getTrainingResult()) + .ge(Objects.nonNull(param.getStartTime()),DriverTrainingCertificateOperJoin::getTrainingTime, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()),DriverTrainingCertificateOperJoin::getTrainingTime, param.getEndTime()) + .eq(DriverTrainingCertificateOperJoin::getOperationTypeId,operationTypeAppcation) + .orderByDesc(DriverTrainingCertificateOperJoin::getUpdateOn); + driverTrainingCertificateOperJoinService.pageJoin(page, wrapper); + } + + private DriverTrainingCertificateVO convert(DriverTrainingCertificateJoin driver) { + if(Objects.isNull(driver)){ + return null; + } + DriverTrainingCertificateVO vo = BeanUtil.copyProperties(driver, DriverTrainingCertificateVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + } + + private DriverTrainingCertificateOperVO convertOper(DriverTrainingCertificateOperJoin driver) { + DriverTrainingCertificateOperVO vo = BeanUtil.copyProperties(driver, DriverTrainingCertificateOperVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + } + + public void infoListExport(HttpServletResponse response, DriverTrainingCertificatePageParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = infoList(param); + + List collect = page.getRecords().stream().map(r -> { + DriverTrainingCertificateExportDTO exportDTO = new DriverTrainingCertificateExportDTO(); + BeanUtils.copyProperties(r, exportDTO); + String trainingTimeStr = NdDateUtils.format(r.getTrainingTime(), NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + exportDTO.setTrainingTime(trainingTimeStr); + String effectiveTimeStr = NdDateUtils.format(r.getTrainingTime(), NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + exportDTO.setEffectiveTime(effectiveTimeStr); + return exportDTO; + }).collect(Collectors.toList()); + String fileName = "驾驶员培训合格证书信息列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), DriverTrainingCertificateExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public DriverTrainingCertificateVO modify(DriverTrainingCertificateUpdateDTO data, Long userId) { + DriverTrainingCertificateVO certificateVO = new DriverTrainingCertificateVO(); + BeanUtils.copyProperties(data,certificateVO); + Long certificateId = data.getId(); + Certificate certificate = certificateService.getById(certificateId); + BeanUtils.copyProperties(data,certificate); + certificate.setUpdateOn(LocalDateTime.now()); + certificateService.updateById(certificate); + return certificateVO; + } + + public Long save(DriverTrainingCertificateUpdateDTO data, Long userId) { + + Long driverId = data.getDriverId(); + String certificateNo = data.getCertificateNo(); + + // 校验合格证号是否可用 + Certificate check = certificateService.getOne(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getCertificateNo, certificateNo) + .ne(Certificate::getId,data.getId())); + + if (Objects.nonNull(check)) { + throw new BizException("证书编号重复!"); + } + + Certificate oldCertificate = certificateService.getOne(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getCertificateNo, certificateNo)); + + DriverTrainingCertificateOper certificateOper = new DriverTrainingCertificateOper(); + BeanUtils.copyProperties(data,certificateOper); + Integer certificateType = data.getCertificateType(); + if (certificateType.equals(CertificateContant.OPERATION_TYPE_APPCATION)){ + certificateOper.setOperationTypeId(CertificateContant.OPERATION_TYPE_APPCATION); + certificateOper.setOperationTypeName(CertificateContant.OPERATION_TYPE_APPCATION_NAME); + } else if (certificateType.equals(CertificateContant.OPERATION_TYPE_REISSUE)){ + certificateOper.setOperationTypeId(CertificateContant.OPERATION_TYPE_REISSUE); + // 从证书列表中查出要补换的证书ID + DriverInfo driverInfo = driverInfoService.getById(driverId); + Certificate certificate = certificateService.getOne(Wrappers.lambdaQuery(Certificate.class) + .eq(Certificate::getUserId, driverInfo.getUserId())); + if (Objects.nonNull(certificate)){ + certificateOper.setCertificateId(certificate.getId()); + } + certificateOper.setOperationTypeName(CertificateContant.OPERATION_TYPE_REISSUE_NAME); + } + certificateOper.setOperationTime(LocalDateTime.now()); + certificateOper.setApplication(data.getApplication()); + certificateOper.setApplicationReason(data.getApplicationReason()); + if(Objects.isNull(data.getId())){ + certificateOper.setAuditState(ApproveStateEnum.AUDIT.getCode()); + certificateOper.setAuditStateName(ApproveStateEnum.AUDIT.getDesc()); + certificateOper.setCreateOn(LocalDateTime.now()); + certificateOper.setCreateBy(userId); + } + driverTrainingCertificateOperService.saveOrUpdate(certificateOper); + + if (Objects.nonNull(oldCertificate)) { + oldCertificate.setDriverLicenseNo(data.getDriverLicenseNo()); + oldCertificate.setRemark(data.getRemark()); + certificateService.updateById(oldCertificate); + } + + return certificateOper.getId(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/LabAcceptanceCertificateManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/LabAcceptanceCertificateManage.java new file mode 100644 index 0000000..e5f959d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/LabAcceptanceCertificateManage.java @@ -0,0 +1,298 @@ +package com.ningdatech.carapi.industry.manage; + +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.read.listener.ReadListener; +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.basic.util.NdDateUtils; +import com.ningdatech.basic.util.ValidUtil; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.helper.UserInfoHelper; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.industry.entity.LabAcceptanceCertificate; +import com.ningdatech.carapi.industry.entity.LabAcceptanceCertificateChange; +import com.ningdatech.carapi.industry.enums.AddTypeEnum; +import com.ningdatech.carapi.industry.model.dto.LabAcceptanceCertificateExportDto; +import com.ningdatech.carapi.industry.model.dto.LabAcceptanceCertificateImportDto; +import com.ningdatech.carapi.industry.model.req.LabAcceptanceCertificateListReq; +import com.ningdatech.carapi.industry.model.req.LabAcceptanceCertificateReq; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateAuditReq; +import com.ningdatech.carapi.industry.model.vo.LabAcceptanceCertificateChangeListVo; +import com.ningdatech.carapi.industry.model.vo.LabAcceptanceCertificateListVo; +import com.ningdatech.carapi.industry.service.ILabAcceptanceCertificateChangeService; +import com.ningdatech.carapi.industry.service.ILabAcceptanceCertificateService; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.event.ImportDataEvent; +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.lang.Assert; +import cn.hutool.core.util.StrUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * LabAcceptanceCertificateManage + *

+ * + * @author WendyYang + * @since 14:35 2022/11/8 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class LabAcceptanceCertificateManage { + + private final ILabAcceptanceCertificateService labAcceptanceCertificateService; + + private final ILabAcceptanceCertificateChangeService labAcceptanceCertificateChangeService; + private final RegionsCacheHelper regionsCacheHelper; + private final CompanyService companyService; + private final UserInfoHelper userInfoHelper; + + public PageVo labAcceptanceCertificateList(LabAcceptanceCertificateListReq req) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(LabAcceptanceCertificate.class); + LabAcceptanceCertificateManage context = (LabAcceptanceCertificateManage) AopContext.currentProxy(); + context.build(wrapper,req); + Page page = labAcceptanceCertificateService.page(req.page(),wrapper); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List result = page.getRecords().stream().map(w -> { + LabAcceptanceCertificateListVo vo = BeanUtil.copyProperties(w, LabAcceptanceCertificateListVo.class); + vo.setRegionName(regionsCacheHelper.getDisplayName(w.getRegionId())); + vo.setValidDate(w.getValidDate()); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(result, page.getTotal()); + } + @LambdaDataScope + @BuildChildrenRegionWrapper + public void build(LambdaQueryWrapper wrapper,LabAcceptanceCertificateListReq req) { + wrapper.ge(Objects.nonNull(req.getStartDate()),LabAcceptanceCertificate::getConferDate,req.getStartDate()) + .le(Objects.nonNull(req.getEndDate()),LabAcceptanceCertificate::getConferDate,req.getEndDate()) + .like(StringUtils.isNotBlank(req.getCompanyName()),LabAcceptanceCertificate::getCompanyName,req.getCompanyName()) + .orderByDesc(LabAcceptanceCertificate::getConferDate); + } + + //=======================================================导出======================================================== + + @EventListener(condition = "event.getTemplate() == T(com.ningdatech.carapi.sys.entity.enumeration.ImportTemplateEnum).LAB_ACCEPTANCE_CERTIFICATE") + public void importDataListener(ImportDataEvent event) throws IOException { + MultipartFile file = (MultipartFile) event.getSource(); + EasyExcel.read(file.getInputStream(), LabAcceptanceCertificateImportDto.class, + new ReadListener() { + + final List insert = new ArrayList<>(); + + @Override + public void invoke(LabAcceptanceCertificateImportDto data, AnalysisContext context) { + String s = ValidUtil.validFast(data); + Assert.isTrue(StrUtil.isBlank(s), s); + insert.add(data); + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + log.info("所有数据读取完成:{}", insert.size()); + importDataSave(insert); + } + }).sheet(0).doRead(); + } + + private void importDataSave(List records) { + Long userId = LoginUserUtil.getUserId(); + LocalDateTime now = LocalDateTime.now(); + List companyNames = CollUtils.fieldList(records, LabAcceptanceCertificateImportDto::getCompanyName); + List companies = companyService.listCompanyByCompanyNames(companyNames); + Map companyMap = CollUtils.listToMap(companies, Company::getName); + List list = new ArrayList<>(); + records.forEach(w -> { + Company company = companyMap.get(w.getCompanyName()); + if (company == null) { + return; + } + LabAcceptanceCertificate certificate = new LabAcceptanceCertificate(); + certificate.setCertificateNo(w.getCertificateNo()); + certificate.setRemark(w.getRemark()); + certificate.setRegionId(company.getRegionId()); + certificate.setValidDate(NdDateUtils.date2LocalDate(w.getValidDate())); + certificate.setConferDate(NdDateUtils.date2LocalDate(w.getConferDate())); + certificate.setConferOrg(w.getConferOrg()); + certificate.setCompanyName(company.getName()); + certificate.setCompanyId(company.getId()); + certificate.setCreateBy(userId); + certificate.setCreateOn(now); + certificate.setUpdateBy(userId); + certificate.setUpdateOn(now); + list.add(certificate); + }); + labAcceptanceCertificateService.saveBatch(list); + } + + //================================================================================================================== + + public void exportLabAcceptanceCertificate(HttpServletResponse response, LabAcceptanceCertificateListReq req) { + req.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = labAcceptanceCertificateList(req); + List collect = page.getRecords().stream().map(w -> { + LabAcceptanceCertificateExportDto dto = BeanUtil.copyProperties(w, LabAcceptanceCertificateExportDto.class); + dto.setStandard(w.getStandard()); + dto.setTestItem(w.getTestItem()); + String conferDateStr = NdDateUtils.format(w.getConferDate(), NdDateUtils.DEFAULT_DATE_FORMAT); + dto.setConferDate(conferDateStr); + String validDateStr= NdDateUtils.format(w.getValidDate(), NdDateUtils.DEFAULT_DATE_FORMAT); + dto.setValidDate(validDateStr); + return dto; + }).collect(Collectors.toList()); + String fileName = "实验室验收合格证"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), LabAcceptanceCertificateExportDto.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void saveOrUpdate(LabAcceptanceCertificateReq req) { + Long userId = LoginUserUtil.getUserId(); + Integer addType = req.getAddType(); + // 说明是新增证书 + if (AddTypeEnum.NEW.getCode().equals(addType)) { + LabAcceptanceCertificate labAcceptanceCertificate = new LabAcceptanceCertificate(); + if (Objects.nonNull(req.getId())){ + // 说明为编辑 + labAcceptanceCertificate.setId(req.getId()); + } + labAcceptanceCertificate.setRegionId(req.getRegionId()); + labAcceptanceCertificate.setCompanyId(req.getCompanyId()); + labAcceptanceCertificate.setCompanyName(req.getCompanyName()); + labAcceptanceCertificate.setRecordItem(req.getRecordItem()); + labAcceptanceCertificate.setCertificateNo(req.getCertificateNo()); + labAcceptanceCertificate.setConferDate(req.getConferDate()); + labAcceptanceCertificate.setStandard(req.getStandard()); + labAcceptanceCertificate.setTestItem(req.getTestItem()); + labAcceptanceCertificate.setRemark(req.getRemark()); + labAcceptanceCertificate.setConferOrg(req.getConferOrg()); + + labAcceptanceCertificate.setCreateOn(LocalDateTime.now()); + labAcceptanceCertificate.setCreateBy(userId); + labAcceptanceCertificate.setUpdateOn(LocalDateTime.now()); + labAcceptanceCertificate.setUpdateBy(userId); + + labAcceptanceCertificateService.saveOrUpdate(labAcceptanceCertificate); + } else if (AddTypeEnum.REPLACE.getCode().equals(req.getAddType())) { + // 说明为换证 + LabAcceptanceCertificateChange labAcceptanceCertificateChange = new LabAcceptanceCertificateChange(); + if (Objects.nonNull(req.getId())){ + // 说明为编辑 + labAcceptanceCertificateChange.setId(req.getId()); + } + String applicationItem = req.getApplicationItem(); + String applicationReason = req.getApplicationReason(); + if (Objects.isNull(applicationItem) || Objects.isNull(applicationReason)){ + throw new BizException("申请事项和申请原因不能为空!"); + } + labAcceptanceCertificateChange.setCompanyName(req.getCompanyName()); + labAcceptanceCertificateChange.setRegionId(req.getRegionId()); + labAcceptanceCertificateChange.setCompanyId(req.getCompanyId()); + labAcceptanceCertificateChange.setCertificateNo(req.getCertificateNo()); + labAcceptanceCertificateChange.setRecordItem(req.getRecordItem()); + labAcceptanceCertificateChange.setReplacementTime(req.getReplaceDate()); + labAcceptanceCertificateChange.setConferOrg(req.getConferOrg()); + labAcceptanceCertificateChange.setRemark(req.getRemark()); + labAcceptanceCertificateChange.setApplicationItem(req.getApplicationItem()); + labAcceptanceCertificateChange.setApplicationReason(req.getApplicationReason()); + labAcceptanceCertificateChange.setTestItem(req.getTestItem()); + labAcceptanceCertificateChange.setValidDate(req.getValidDate()); + labAcceptanceCertificateChange.setStandard(req.getStandard()); + + labAcceptanceCertificateChange.setCreateOn(LocalDateTime.now()); + labAcceptanceCertificateChange.setCreateBy(userId); + labAcceptanceCertificateChange.setUpdateOn(LocalDateTime.now()); + labAcceptanceCertificateChange.setUpdateBy(userId); + labAcceptanceCertificateChangeService.saveOrUpdate(labAcceptanceCertificateChange); + } + } + + public PageVo changeList(LabAcceptanceCertificateListReq req) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(LabAcceptanceCertificateChange.class); + LabAcceptanceCertificateManage context = (LabAcceptanceCertificateManage) AopContext.currentProxy(); + context.buildChangeListQuery(wrapper,req); + Page page = labAcceptanceCertificateChangeService.page(req.page(), wrapper); + if (CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + List data = CollUtils.convert(page.getRecords(), w -> { + LabAcceptanceCertificateChangeListVo resVo = BeanUtil.copyProperties(w, LabAcceptanceCertificateChangeListVo.class); + resVo.setRegionName(regionsCacheHelper.getDisplayName(w.getRegionId())); + resVo.setReplaceDate(w.getReplacementTime()); + return resVo; + }); + + return PageVo.of(data,page.getTotal()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildChangeListQuery(LambdaQueryWrapper wrapper, LabAcceptanceCertificateListReq req) { + wrapper.like(StrUtil.isNotBlank(req.getCompanyName()), LabAcceptanceCertificateChange::getCompanyName, req.getCompanyName()) + .ge(Objects.nonNull(req.getStartDate()),LabAcceptanceCertificateChange::getReplacementTime,req.getStartDate()) + .le(Objects.nonNull(req.getEndDate()),LabAcceptanceCertificateChange::getReplacementTime,req.getEndDate()) + .orderByDesc(LabAcceptanceCertificateChange::getUpdateOn); + } + + public Boolean audit(LabWorkerCertificateAuditReq req, Long userId) { + return labAcceptanceCertificateService.audit(req,userId); + } + + public void delete(Long id) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(LabAcceptanceCertificate.class); + LabAcceptanceCertificateManage context = (LabAcceptanceCertificateManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + LabAcceptanceCertificate record = labAcceptanceCertificateService.getOne(wrapper); + if (Objects.isNull(record)){ + throw new BizException("无法删除!"); + } + labAcceptanceCertificateService.removeById(id); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(LabAcceptanceCertificate::getId,id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/LabWorkerCertificateManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/LabWorkerCertificateManage.java new file mode 100644 index 0000000..2e0b196 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/LabWorkerCertificateManage.java @@ -0,0 +1,309 @@ +package com.ningdatech.carapi.industry.manage; + +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.springframework.aop.framework.AopContext; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.read.listener.ReadListener; +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.basic.util.NdDateUtils; +import com.ningdatech.basic.util.ValidUtil; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.constant.GenderEnum; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.industry.entity.LabWorkerCertificate; +import com.ningdatech.carapi.industry.entity.LabWorkerCertificateChange; +import com.ningdatech.carapi.industry.enums.AddTypeEnum; +import com.ningdatech.carapi.industry.enums.LabWorkerCertificateTypeEnum; +import com.ningdatech.carapi.industry.model.dto.LabWorkerCertificateExportDto; +import com.ningdatech.carapi.industry.model.dto.LabWorkerCertificateImportDto; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateAuditReq; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateListReq; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateReq; +import com.ningdatech.carapi.industry.model.vo.LabWorkerCertificateChangeListVo; +import com.ningdatech.carapi.industry.model.vo.LabWorkerCertificateListVo; +import com.ningdatech.carapi.industry.service.ILabWorkerCertificateChangeService; +import com.ningdatech.carapi.industry.service.ILabWorkerCertificateService; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.event.ImportDataEvent; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +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.lang.Assert; +import cn.hutool.core.util.StrUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * LabWorkerCertificateManage + *

+ * + * @author WendyYang + * @since 14:57 2022/11/4 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class LabWorkerCertificateManage { + + private final CompaniesCacheHelper companiesCacheHelper; + private final CompanyService companyService; + private final RegionsCacheHelper regionsCacheHelper; + private final ILabWorkerCertificateService labWorkerCertificateService; + + private final ILabWorkerCertificateChangeService labWorkerCertificateChangeService; + + public PageVo labWorkerCertificateList(LabWorkerCertificateListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(LabWorkerCertificate.class); + LabWorkerCertificateManage context = (LabWorkerCertificateManage) AopContext.currentProxy(); + context.buildLabWorkerCertificateQuery(query, req); + Page page = labWorkerCertificateService.page(req.page(), query); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List data = CollUtils.convert(page.getRecords(), w -> { + LabWorkerCertificateListVo vo = BeanUtil.copyProperties(w, LabWorkerCertificateListVo.class); + vo.setRegionName(regionsCacheHelper.getDisplayName(w.getRegionId())); + vo.setGenderName(GenderEnum.getDescByCode(w.getGender())); + vo.setUserName(w.getUserName()); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildLabWorkerCertificateQuery(LambdaQueryWrapper query, LabWorkerCertificateListReq req) { + query.like(StrUtil.isNotBlank(req.getCompanyName()), LabWorkerCertificate::getCompanyName, req.getCompanyName()) + .ge(Objects.nonNull(req.getStartDate()), LabWorkerCertificate::getConferDate, req.getStartDate()) + .le(Objects.nonNull(req.getEndDate()), LabWorkerCertificate::getConferDate, req.getEndDate()) + .eq(Objects.nonNull(req.getCertificateType()), LabWorkerCertificate::getCertificateType, req.getCertificateType()) + .orderByDesc(LabWorkerCertificate::getUpdateOn); + } + + public void labWorkerCertificateExport(HttpServletResponse response, LabWorkerCertificateListReq req) { + req.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = this.labWorkerCertificateList(req); + List collect = page.getRecords().stream().map(w -> { + LabWorkerCertificateExportDto dto = BeanUtil.copyProperties(w, LabWorkerCertificateExportDto.class); + String conferDateStr= NdDateUtils.format(w.getConferDate(), NdDateUtils.DEFAULT_DATE_FORMAT); + dto.setConferDate(conferDateStr); + String validDateStr= NdDateUtils.format(w.getValidDate(), NdDateUtils.DEFAULT_DATE_FORMAT); + dto.setValidDate(validDateStr); + dto.setGender(GenderEnum.getDescByCode(w.getGender())); + return dto; + }).collect(Collectors.toList()); + String fileName; + if (req.getCertificateType() == LabWorkerCertificateTypeEnum.QUALIFICATION.getCode()) { + fileName = "试验室人员从业资格证-证书信息"; + } else { + fileName = "实验室人员继续教育合格证-证书信息"; + } + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), LabWorkerCertificateExportDto.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @EventListener(condition = "event.getTemplate() == T(com.ningdatech.carapi.sys.entity.enumeration.ImportTemplateEnum).LAB_WORKER_CERTIFICATE_QUA") + public void importDataListener(ImportDataEvent event) throws IOException { + MultipartFile file = (MultipartFile) event.getSource(); + EasyExcel.read(file.getInputStream(), LabWorkerCertificateImportDto.class, + new ReadListener() { + + final List insert = new ArrayList<>(); + + @Override + public void invoke(LabWorkerCertificateImportDto data, AnalysisContext context) { + String s = ValidUtil.validFast(data); + Assert.isTrue(StrUtil.isBlank(s), s); + insert.add(data); + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + log.info("所有数据读取完成:{}", insert.size()); + importDataSave(insert); + } + }).sheet(0).doRead(); + } + + private void importDataSave(List records) { + Long userId = LoginUserUtil.getUserId(); + LocalDateTime now = LocalDateTime.now(); + List companyNames = CollUtils.fieldList(records, LabWorkerCertificateImportDto::getCompanyName); + List companies = companyService.listCompanyByCompanyNames(companyNames); + Map companyMap = CollUtils.listToMap(companies, Company::getName); + List list = new ArrayList<>(); + records.forEach(w -> { + Company company = companyMap.get(w.getCompanyName()); + if (company == null) { + return; + } + LabWorkerCertificate certificate = new LabWorkerCertificate(); + certificate.setCertificateNo(w.getCertificateNo()); + certificate.setIdCard(w.getIdCard()); + certificate.setRemark(w.getRemark()); + certificate.setGender(GenderEnum.getByValue(w.getGender()).getCode()); + certificate.setRegionId(company.getRegionId()); + certificate.setUserName(w.getUsername()); + certificate.setValidDate(NdDateUtils.date2LocalDate(w.getEndDate())); + certificate.setConferDate(NdDateUtils.date2LocalDate(w.getStartDate())); + certificate.setCompanyName(company.getName()); + certificate.setCompanyId(company.getId()); + certificate.setCreateBy(userId); + certificate.setCreateOn(now); + certificate.setUpdateBy(userId); + certificate.setUpdateOn(now); + list.add(certificate); + labWorkerCertificateService.saveBatch(list); + }); + } + + public void saveOrUpdate(LabWorkerCertificateReq req) { + Integer addType = req.getAddType(); + //说明是新增证书 + LabWorkerCertificate labWorkerCertificate = new LabWorkerCertificate(); + if (AddTypeEnum.NEW.getCode().equals(addType)) { + if (Objects.nonNull(req.getId())){ + // 说明为编辑 + labWorkerCertificate.setId(req.getId()); + } + labWorkerCertificate.setRegionId(req.getRegionId()); + labWorkerCertificate.setCompanyId(req.getCompanyId()); + labWorkerCertificate.setCompanyName(req.getCompanyName()); + labWorkerCertificate.setCreateOn(LocalDateTime.now()); + labWorkerCertificate.setCreateBy(LoginUserUtil.getUserId()); + labWorkerCertificate.setUpdateOn(LocalDateTime.now()); + labWorkerCertificate.setUpdateOn(LocalDateTime.now()); + labWorkerCertificate.setGender(req.getGender()); + labWorkerCertificate.setIdCard(req.getIdCard()); + labWorkerCertificate.setCertificateNo(req.getCertificateNo()); + labWorkerCertificate.setConferDate(req.getConferDate()); + labWorkerCertificate.setValidDate(req.getValidDate()); + labWorkerCertificate.setRemark(req.getRemark()); + labWorkerCertificate.setCertificateType(req.getCertificateType()); + labWorkerCertificate.setConferOrg(req.getConferOrg()); + labWorkerCertificateService.saveOrUpdate(labWorkerCertificate); + } else if (AddTypeEnum.REPLACE.getCode().equals(req.getAddType())) { + // 说明是换证 + //创建新的证书实体,并装配证书信息,保存到换证列表中 + String applicationItem = req.getApplicationItem(); + String applicationReason = req.getApplicationReason(); + if (Objects.isNull(applicationItem) || Objects.isNull(applicationReason)){ + throw new BizException("申请事项和申请原因不能为空!"); + } + LabWorkerCertificateChange labWorkerCertificateChange = new LabWorkerCertificateChange(); + if (Objects.nonNull(req.getId())){ + // 说明为编辑 + labWorkerCertificateChange.setId(req.getId()); + } + labWorkerCertificateChange.setCompanyName(req.getCompanyName()); + labWorkerCertificateChange.setCompanyId(req.getCompanyId()); + labWorkerCertificateChange.setRegionId(req.getRegionId()); + labWorkerCertificateChange.setUserName(req.getUserName()); + labWorkerCertificateChange.setGender(req.getGender()); + labWorkerCertificateChange.setIdCard(req.getIdCard()); + labWorkerCertificateChange.setCertificateNo(req.getCertificateNo()); + labWorkerCertificateChange.setReplacementTime(req.getReplaceDate()); + labWorkerCertificateChange.setValidDate(req.getValidDate()); + labWorkerCertificateChange.setRemark(req.getRemark()); + labWorkerCertificateChange.setCertificateType(req.getCertificateType()); + labWorkerCertificateChange.setApplicationItem(req.getApplicationItem()); + labWorkerCertificateChange.setApplicationReason(req.getApplicationReason()); + labWorkerCertificateChange.setConferOrg(req.getConferOrg()); + + labWorkerCertificateChange.setCreateOn(LocalDateTime.now()); + labWorkerCertificateChange.setCreateBy(LoginUserUtil.getUserId()); + labWorkerCertificateChange.setUpdateOn(LocalDateTime.now()); + labWorkerCertificateChange.setUpdateOn(LocalDateTime.now()); + + labWorkerCertificateChangeService.saveOrUpdate(labWorkerCertificateChange); + } + } + + public PageVo changeCertificate(LabWorkerCertificateListReq req) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(LabWorkerCertificateChange.class); + LabWorkerCertificateManage context = (LabWorkerCertificateManage) AopContext.currentProxy(); + context.buildLabWorkerCertificateChangeQuery(wrapper, req); + Page page = labWorkerCertificateChangeService.page(req.page(), wrapper); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + List records = CollUtils.convert(page.getRecords(), w -> { + LabWorkerCertificateChangeListVo resVo = BeanUtil.copyProperties(w, LabWorkerCertificateChangeListVo.class); + resVo.setReplaceDate(w.getReplacementTime()); + resVo.setRegionName(regionsCacheHelper.getDisplayName(w.getRegionId())); + resVo.setGenderName(GenderEnum.getDescByCode(w.getGender())); + return resVo; + }); + return PageVo.of(records, page.getTotal()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildLabWorkerCertificateChangeQuery(LambdaQueryWrapper wrapper, LabWorkerCertificateListReq req) { + wrapper.like(StrUtil.isNotBlank(req.getCompanyName()), LabWorkerCertificateChange::getCompanyName, req.getCompanyName()) + .ge(Objects.nonNull(req.getStartDate()), LabWorkerCertificateChange::getReplacementTime, req.getStartDate()) + .le(Objects.nonNull(req.getEndDate()), LabWorkerCertificateChange::getReplacementTime, req.getEndDate()) + .eq(Objects.nonNull(req.getCertificateType()), LabWorkerCertificateChange::getCertificateType, req.getCertificateType()) + .orderByDesc(LabWorkerCertificateChange::getUpdateOn); + } + + public Boolean audit(LabWorkerCertificateAuditReq req, Long userId) { + return labWorkerCertificateService.audit(req, userId); + } + + public Boolean cancelAudit(LabWorkerCertificateAuditReq req, Long userId) { + return labWorkerCertificateService.cancelAudit(req, userId); + } + + public void delete(Long id) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(LabWorkerCertificate.class); + LabWorkerCertificateManage context = (LabWorkerCertificateManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + LabWorkerCertificate record = labWorkerCertificateService.getOne(wrapper); + if (Objects.isNull(record)){ + throw new BizException("无法删除!"); + } + labWorkerCertificateService.removeById(id); + } + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(LabWorkerCertificate::getId,id); + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/MortarEnterpriseFilingCertificateManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/MortarEnterpriseFilingCertificateManage.java new file mode 100644 index 0000000..76b5073 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/MortarEnterpriseFilingCertificateManage.java @@ -0,0 +1,225 @@ +package com.ningdatech.carapi.industry.manage; + +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import com.alibaba.excel.EasyExcel; +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.basic.util.NdDateUtils; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.industry.entity.MortarEnterpriseFilingCertificate; +import com.ningdatech.carapi.industry.entity.MortarEnterpriseFilingCertificateChange; +import com.ningdatech.carapi.industry.enums.AddTypeEnum; +import com.ningdatech.carapi.industry.model.dto.MortarEnterpriseFilingCertificateDTO; +import com.ningdatech.carapi.industry.model.dto.MortarEnterpriseFilingCertificateExportDto; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateAuditReq; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateListReq; +import com.ningdatech.carapi.industry.model.vo.MortarEnterpriseFilingCertificateChangeVO; +import com.ningdatech.carapi.industry.model.vo.MortarEnterpriseFilingCertificateVO; +import com.ningdatech.carapi.industry.service.IMortarEnterpriseFilingCertificateChangeService; +import com.ningdatech.carapi.industry.service.IMortarEnterpriseFilingCertificateService; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; +import lombok.AllArgsConstructor; + +/** + *

+ * MortarCompanyFilingCertificateManage + *

+ * + * @author WendyYang + * @since 21:16 2022/11/8 + */ +@Component +@AllArgsConstructor +public class MortarEnterpriseFilingCertificateManage { + + private final IMortarEnterpriseFilingCertificateService mortarEnterpriseFilingCertificateService; + + private final RegionsCacheHelper regionsCacheHelper; + private final CompaniesCacheHelper companiesCacheHelper; + + private final IMortarEnterpriseFilingCertificateChangeService mortarEnterpriseFilingCertificateChangeService; + + public PageVo mortarEnterpriseFilingCertificateList(LabWorkerCertificateListReq req) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(MortarEnterpriseFilingCertificate.class); + MortarEnterpriseFilingCertificateManage context = (MortarEnterpriseFilingCertificateManage) AopContext.currentProxy(); + context.buildQuery(wrapper,req); + Page page = mortarEnterpriseFilingCertificateService.page(req.page(), wrapper); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + List result = page.getRecords().stream().map(w -> { + MortarEnterpriseFilingCertificateVO vo = BeanUtil.copyProperties(w, MortarEnterpriseFilingCertificateVO.class); + vo.setProductionCapacity(w.getThroughput()); + vo.setRegionName(regionsCacheHelper.getDisplayName(w.getRegionId())); + vo.setValidDate(w.getValidDate()); + vo.setStandards(w.getStandards()); + CodeUtil.searchCompanyName(vo); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(result, page.getTotal()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildQuery(LambdaQueryWrapper wrapper,LabWorkerCertificateListReq req) { + wrapper.ge(Objects.nonNull(req.getStartDate()), MortarEnterpriseFilingCertificate::getConferDate,req.getStartDate()) + .le(Objects.nonNull(req.getEndDate()),MortarEnterpriseFilingCertificate::getConferDate,req.getEndDate()) + .like(StringUtils.isNotBlank(req.getCompanyName()),MortarEnterpriseFilingCertificate::getCompanyName,req.getCompanyName()) + .orderByDesc(MortarEnterpriseFilingCertificate::getUpdateOn); + } + + public void saveOrUpdate(MortarEnterpriseFilingCertificateDTO req) { + Long userId = LoginUserUtil.getUserId(); + Integer addType = req.getAddType(); + // 说明是新增证书 + if (AddTypeEnum.NEW.getCode().equals(addType)) { + MortarEnterpriseFilingCertificate mortarEnterpriseFilingCertificate = new MortarEnterpriseFilingCertificate(); + if (Objects.nonNull(req.getId())){ + // 说明为编辑 + mortarEnterpriseFilingCertificate.setId(req.getId()); + } + mortarEnterpriseFilingCertificate.setRegionId(req.getRegionId()); + mortarEnterpriseFilingCertificate.setCompanyId(req.getCompanyId()); + mortarEnterpriseFilingCertificate.setCompanyName(req.getCompanyName()); + mortarEnterpriseFilingCertificate.setRecordItem(req.getRecordItem()); + mortarEnterpriseFilingCertificate.setCertificateNo(req.getCertificateNo()); + mortarEnterpriseFilingCertificate.setConferDate(req.getConferDate()); + mortarEnterpriseFilingCertificate.setThroughput(req.getProductionCapacity()); + mortarEnterpriseFilingCertificate.setStandards(req.getStandards()); + mortarEnterpriseFilingCertificate.setRemark(req.getRemark()); + mortarEnterpriseFilingCertificate.setConferOrg(req.getConferOrg()); + + mortarEnterpriseFilingCertificate.setCreateOn(LocalDateTime.now()); + mortarEnterpriseFilingCertificate.setCreateBy(userId); + mortarEnterpriseFilingCertificate.setUpdateOn(LocalDateTime.now()); + mortarEnterpriseFilingCertificate.setUpdateBy(userId); + + mortarEnterpriseFilingCertificateService.saveOrUpdate(mortarEnterpriseFilingCertificate); + } else if (AddTypeEnum.REPLACE.getCode().equals(req.getAddType())) { + // 说明为换证 + MortarEnterpriseFilingCertificateChange mortarEnterpriseFilingCertificateChange = new MortarEnterpriseFilingCertificateChange(); + if (Objects.nonNull(req.getId())){ + // 说明为编辑 + mortarEnterpriseFilingCertificateChange.setId(req.getId()); + } + mortarEnterpriseFilingCertificateChange.setCompanyName(req.getCompanyName()); + mortarEnterpriseFilingCertificateChange.setRegionId(req.getRegionId()); + mortarEnterpriseFilingCertificateChange.setCompanyId(req.getCompanyId()); + mortarEnterpriseFilingCertificateChange.setCertificateNo(req.getCertificateNo()); + mortarEnterpriseFilingCertificateChange.setRecordItem(req.getRecordItem()); + mortarEnterpriseFilingCertificateChange.setReplacementTime(req.getReplaceDate()); + mortarEnterpriseFilingCertificateChange.setConferOrg(req.getConferOrg()); + mortarEnterpriseFilingCertificateChange.setRemark(req.getRemark()); + mortarEnterpriseFilingCertificateChange.setApplicationItem(req.getApplicationItem()); + mortarEnterpriseFilingCertificateChange.setApplicationReason(req.getApplicationReason()); + mortarEnterpriseFilingCertificateChange.setValidDate(req.getValidDate()); + mortarEnterpriseFilingCertificateChange.setStandards(req.getStandards()); + + mortarEnterpriseFilingCertificateChange.setCreateOn(LocalDateTime.now()); + mortarEnterpriseFilingCertificateChange.setCreateBy(userId); + mortarEnterpriseFilingCertificateChange.setUpdateOn(LocalDateTime.now()); + mortarEnterpriseFilingCertificateChange.setUpdateBy(userId); + mortarEnterpriseFilingCertificateChangeService.saveOrUpdate(mortarEnterpriseFilingCertificateChange); + } + } + + public void mortarEnterpriseFilingCertificateExport(HttpServletResponse response, LabWorkerCertificateListReq req) { + req.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = mortarEnterpriseFilingCertificateList(req); + List collect = page.getRecords().stream().map(w -> { + MortarEnterpriseFilingCertificateExportDto exportDto = new MortarEnterpriseFilingCertificateExportDto(); + BeanUtils.copyProperties(w, exportDto); + String conferDateStr = NdDateUtils.format(w.getConferDate(), NdDateUtils.DEFAULT_DATE_FORMAT); + exportDto.setConferDate(conferDateStr); + String validDateStr = NdDateUtils.format(w.getValidDate(), NdDateUtils.DEFAULT_DATE_FORMAT); + exportDto.setValidDate(validDateStr); + exportDto.setStandard(w.getStandards()); + return exportDto; + }).collect(Collectors.toList()); + String fileName = "砂浆企业备案证列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), MortarEnterpriseFilingCertificateExportDto.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public PageVo changeList(LabWorkerCertificateListReq req) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(MortarEnterpriseFilingCertificateChange.class); + MortarEnterpriseFilingCertificateManage context = (MortarEnterpriseFilingCertificateManage) AopContext.currentProxy(); + context.buildMortarEnterpriseFilingCertificateChangeListQuery(wrapper,req); + Page page = mortarEnterpriseFilingCertificateChangeService.page(req.page(), wrapper); + if (page.getTotal() == 0){ + return PageVo.empty(); + } + List data = CollUtils.convert(page.getRecords(), w -> { + MortarEnterpriseFilingCertificateChangeVO resVo = BeanUtil.copyProperties(w, MortarEnterpriseFilingCertificateChangeVO.class); + resVo.setRegionName(regionsCacheHelper.getDisplayName(w.getRegionId())); + resVo.setReplaceDate(w.getReplacementTime()); + return resVo; + }); + return PageVo.of(data,page.getTotal()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildMortarEnterpriseFilingCertificateChangeListQuery(LambdaQueryWrapper wrapper, LabWorkerCertificateListReq req) { + wrapper.like(StrUtil.isNotBlank(req.getCompanyName()), MortarEnterpriseFilingCertificateChange::getCompanyName, req.getCompanyName()) + .ge(Objects.nonNull(req.getStartDate()),MortarEnterpriseFilingCertificateChange::getReplacementTime,req.getStartDate()) + .le(Objects.nonNull(req.getEndDate()),MortarEnterpriseFilingCertificateChange::getReplacementTime,req.getEndDate()) + .orderByDesc(MortarEnterpriseFilingCertificateChange::getUpdateOn); + } + + public Boolean audit(LabWorkerCertificateAuditReq req, Long userId) { + return mortarEnterpriseFilingCertificateService.audit(req,userId); + } + + public void delete(Long id) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(MortarEnterpriseFilingCertificate.class); + MortarEnterpriseFilingCertificateManage context = (MortarEnterpriseFilingCertificateManage) AopContext.currentProxy(); + context.buildMortarQuery(wrapper, id); + MortarEnterpriseFilingCertificate record = mortarEnterpriseFilingCertificateService.getOne(wrapper); + if (Objects.isNull(record)){ + throw new BizException("无法删除!"); + } + mortarEnterpriseFilingCertificateService.removeById(id); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildMortarQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(MortarEnterpriseFilingCertificate::getId,id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/OperatorAssessmentManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/OperatorAssessmentManage.java new file mode 100644 index 0000000..8116dee --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/OperatorAssessmentManage.java @@ -0,0 +1,246 @@ +package com.ningdatech.carapi.industry.manage; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +import javax.servlet.http.HttpServletResponse; + +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.carapi.industry.contants.CertificateContant; +import com.ningdatech.carapi.industry.entity.OperatorIndexScoreInfo; +import com.ningdatech.carapi.industry.entity.OperatorScoreInfo; +import com.ningdatech.carapi.industry.enums.OperatorAssessmentIndexEnum; +import com.ningdatech.carapi.industry.enums.QuarterEnum; +import com.ningdatech.carapi.industry.model.dto.OperatorAssessmentDTO; +import com.ningdatech.carapi.industry.model.dto.OperatorsAssessmentDetailsExportDTO; +import com.ningdatech.carapi.industry.model.vo.OperatorScoreDetailVO; +import com.ningdatech.carapi.industry.service.IOperatorIndexScoreInfoService; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; +import com.ningdatech.carapi.sys.entity.Operator; +import com.ningdatech.carapi.sys.service.IOperatorScoreInfoService; +import com.ningdatech.carapi.sys.service.OperatorService; + +import fr.opensagres.xdocreport.core.XDocReportException; +import fr.opensagres.xdocreport.document.IXDocReport; +import fr.opensagres.xdocreport.document.registry.XDocReportRegistry; +import fr.opensagres.xdocreport.template.IContext; +import fr.opensagres.xdocreport.template.TemplateEngineKind; +import fr.opensagres.xdocreport.template.formatter.FieldsMetadata; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/01/05 09:18 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class OperatorAssessmentManage { + + private final IOperatorScoreInfoService operatorScoreInfoService; + + private final IOperatorIndexScoreInfoService operatorIndexScoreInfoService; + + private final OperatorService operatorService; + + public OperatorScoreDetailVO getOperatorScore(OperatorAssessmentDTO data) { + OperatorScoreDetailVO operatorScoreDetailVO = new OperatorScoreDetailVO(); + Integer quarter = data.getQuarter(); + Long operatorId = data.getId(); + String year = data.getYear(); + LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate(OperatorScoreInfo.class); + wrapper.eq(OperatorScoreInfo::getQuarter, quarter) + .eq(OperatorScoreInfo::getOperatorId, operatorId) + .eq(OperatorScoreInfo::getYear,year); + List operatorIndexScoreInfos = operatorIndexScoreInfoService.list(); + OperatorScoreInfo operatorScoreInfo = operatorScoreInfoService.getOne(wrapper); + assemblyOperatorIndexScore(operatorScoreDetailVO, operatorIndexScoreInfos); + if (Objects.isNull(operatorScoreInfo)){ + // 查询条件下没有该运营商的考核分数信息,各项分数默认显示满分 + log.info("未查询到运营商考核分数信息!"); + assemblyOperatorInitialScore(operatorScoreDetailVO,operatorIndexScoreInfos); + operatorScoreDetailVO.setTotalScore(TaskConstant.Data.OPERATOR_ASSESSMENT_SCORE_HUNDRED); + return operatorScoreDetailVO; + } + assemblyOperatorScore(operatorScoreDetailVO, operatorScoreInfo); + return operatorScoreDetailVO; + } + + private void assemblyOperatorInitialScore(OperatorScoreDetailVO operatorScoreDetailVO,List operatorIndexScoreInfos) { + for (OperatorIndexScoreInfo operatorIndexScoreInfo : operatorIndexScoreInfos) { + switch (OperatorAssessmentIndexEnum.getEnumByValue(operatorIndexScoreInfo.getOperatorScoreIndex())) { + case UPLOAD_QUALIFICATION: + operatorScoreDetailVO.setUploadQualification(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + break; + case UPLOAD_FREQUENCY_QUANTITY: + operatorScoreDetailVO.setUploadFrequencyQuantity(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + break; + case FIELD_INTEGRITY: + operatorScoreDetailVO.setFieldIntegrity(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + break; + case TIME_SENSITIVE: + operatorScoreDetailVO.setTimeSensitive(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + break; + case POSITION_DIRECTION_CORRECTNESS_CONSISTENCY: + operatorScoreDetailVO.setPositionDirectionCorrectnessConsistency(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + break; + case SPEED_CORRECTNESS_CONSISTENCY: + operatorScoreDetailVO.setSpeedCorrectnessConsistency(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + break; + case TIME_CONSISTENCY: + operatorScoreDetailVO.setTimeConsistency(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + break; + case POSITION_CONSISTENCY: + operatorScoreDetailVO.setPositionConsistency(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + break; + default: + throw new BizException("Unexpected value: " + operatorIndexScoreInfo.getOperatorScoreIndex()); + } + } + } + + private void assemblyOperatorIndexScore(OperatorScoreDetailVO operatorScoreDetailVO, List operatorIndexScoreInfos) { + for (OperatorIndexScoreInfo operatorIndexScoreInfo : operatorIndexScoreInfos) { + switch (OperatorAssessmentIndexEnum.getEnumByValue(operatorIndexScoreInfo.getOperatorScoreIndex())){ + case UPLOAD_QUALIFICATION: + operatorScoreDetailVO.setUploadQualificationIndex(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + operatorScoreDetailVO.setUploadQualificationName(operatorIndexScoreInfo.getOperatorScoreIndexName()); + break; + case UPLOAD_FREQUENCY_QUANTITY: + operatorScoreDetailVO.setUploadFrequencyQuantityIndex(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + operatorScoreDetailVO.setUploadFrequencyQuantityName(operatorIndexScoreInfo.getOperatorScoreIndexName()); + break; + case FIELD_INTEGRITY: + operatorScoreDetailVO.setFieldIntegrityIndex(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + operatorScoreDetailVO.setFieldIntegrityName(operatorIndexScoreInfo.getOperatorScoreIndexName()); + break; + case TIME_SENSITIVE: + operatorScoreDetailVO.setTimeSensitiveIndex(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + operatorScoreDetailVO.setTimeSensitiveName(operatorIndexScoreInfo.getOperatorScoreIndexName()); + break; + case POSITION_DIRECTION_CORRECTNESS_CONSISTENCY: + operatorScoreDetailVO.setPositionDirectionCorrectnessConsistencyIndex(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + operatorScoreDetailVO.setPositionDirectionCorrectnessConsistencyName(operatorIndexScoreInfo.getOperatorScoreIndexName()); + break; + case SPEED_CORRECTNESS_CONSISTENCY: + operatorScoreDetailVO.setSpeedCorrectnessConsistencyIndex(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + operatorScoreDetailVO.setSpeedCorrectnessConsistencyName(operatorIndexScoreInfo.getOperatorScoreIndexName()); + break; + case TIME_CONSISTENCY: + operatorScoreDetailVO.setTimeConsistencyIndex(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + operatorScoreDetailVO.setTimeConsistencyName(operatorIndexScoreInfo.getOperatorScoreIndexName()); + break; + case POSITION_CONSISTENCY: + operatorScoreDetailVO.setPositionConsistencyIndex(operatorIndexScoreInfo.getOperatorScoreIndexScore()); + operatorScoreDetailVO.setPositionConsistencyName(operatorIndexScoreInfo.getOperatorScoreIndexName()); + break; + default: + throw new BizException("Unexpected value: " + operatorIndexScoreInfo.getOperatorScoreIndex()); + } + } + } + + private void assemblyOperatorScore(OperatorScoreDetailVO operatorScoreDetailVO, OperatorScoreInfo operatorScoreInfo) { + Integer score = operatorScoreInfo.getUploadQualification(); + operatorScoreDetailVO.setUploadQualification(score); + Integer score2 = operatorScoreInfo.getUploadFrequencyQuantity(); + operatorScoreDetailVO.setUploadFrequencyQuantity(score2); + Integer score3 = operatorScoreInfo.getFieldIntegrity(); + operatorScoreDetailVO.setFieldIntegrity(score3); + Integer score4 = operatorScoreInfo.getTimeSensitive(); + operatorScoreDetailVO.setTimeSensitive(score4); + Integer score5 = operatorScoreInfo.getPositionDirectionCorrectnessConsistency(); + operatorScoreDetailVO.setPositionDirectionCorrectnessConsistency(score5); + Integer score6 = operatorScoreInfo.getSpeedCorrectnessConsistency(); + operatorScoreDetailVO.setSpeedCorrectnessConsistency(score6); + Integer score7 = operatorScoreInfo.getTimeConsistency(); + operatorScoreDetailVO.setTimeConsistency(score7); + Integer score8 = operatorScoreInfo.getPositionConsistency(); + operatorScoreDetailVO.setPositionConsistency(score8); + int totalScore = score + score2 + score3 + score4 + score5 + score6 + score7 + score8; + operatorScoreDetailVO.setTotalScore(totalScore); + } + + public void exportDocx(HttpServletResponse response, OperatorAssessmentDTO data) { + OperatorScoreDetailVO operatorScore = getOperatorScore(data); + Operator operator = operatorService.getById(data.getId()); + InputStream in = null; + String fileName = "运营商考核详情"; + try { + //获取本地目录的word模板 + in = this.getClass().getClassLoader().getResourceAsStream("template/" + fileName + ".docx"); + //注册xdocreport实例并加载FreeMarker模板引擎 + IXDocReport report = XDocReportRegistry.getRegistry().loadReport(in, TemplateEngineKind.Freemarker); + //创建xdocreport上下文对象 + IContext context = report.createContext(); + + List oadList = new ArrayList<>(); + oadList.add(new OperatorsAssessmentDetailsExportDTO("1",OperatorAssessmentIndexEnum.UPLOAD_QUALIFICATION.getDesc(),CertificateContant.ScoringRubric.UPLOAD_QUALIFICATION_SCORING_RUBRIC,String.valueOf(operatorScore.getUploadQualificationIndex()),String.valueOf(operatorScore.getUploadQualification()))); + oadList.add(new OperatorsAssessmentDetailsExportDTO("2",OperatorAssessmentIndexEnum.UPLOAD_FREQUENCY_QUANTITY.getDesc(),CertificateContant.ScoringRubric.UPLOAD_FREQUENCY_QUANTITY_SCORING_RUBRIC,String.valueOf(operatorScore.getUploadFrequencyQuantityIndex()),String.valueOf(operatorScore.getUploadFrequencyQuantity()))); + oadList.add(new OperatorsAssessmentDetailsExportDTO("3",OperatorAssessmentIndexEnum.FIELD_INTEGRITY.getDesc(),CertificateContant.ScoringRubric.FIELD_INTEGRITY_SCORING_RUBRIC,String.valueOf(operatorScore.getFieldIntegrityIndex()),String.valueOf(operatorScore.getFieldIntegrity()))); + oadList.add(new OperatorsAssessmentDetailsExportDTO("4",OperatorAssessmentIndexEnum.TIME_SENSITIVE.getDesc(),CertificateContant.ScoringRubric.TIME_SENSITIVE_SCORING_RUBRIC,String.valueOf(operatorScore.getTimeSensitiveIndex()),String.valueOf(operatorScore.getTimeSensitive()))); + oadList.add(new OperatorsAssessmentDetailsExportDTO("5",OperatorAssessmentIndexEnum.POSITION_DIRECTION_CORRECTNESS_CONSISTENCY.getDesc(),CertificateContant.ScoringRubric.POSITION_DIRECTION_CORRECTNESS_CONSISTENCY_SCORING_RUBRIC,String.valueOf(operatorScore.getPositionDirectionCorrectnessConsistencyIndex()),String.valueOf(operatorScore.getPositionDirectionCorrectnessConsistency()))); + oadList.add(new OperatorsAssessmentDetailsExportDTO("6",OperatorAssessmentIndexEnum.SPEED_CORRECTNESS_CONSISTENCY.getDesc(),CertificateContant.ScoringRubric.SPEED_CORRECTNESS_CONSISTENCY_SCORING_RUBRIC,String.valueOf(operatorScore.getSpeedCorrectnessConsistencyIndex()),String.valueOf(operatorScore.getSpeedCorrectnessConsistency()))); + oadList.add(new OperatorsAssessmentDetailsExportDTO("7",OperatorAssessmentIndexEnum.TIME_CONSISTENCY.getDesc(),CertificateContant.ScoringRubric.TIME_CONSISTENCY_SCORING_RUBRIC,String.valueOf(operatorScore.getTimeConsistencyIndex()),String.valueOf(operatorScore.getTimeConsistency()))); + oadList.add(new OperatorsAssessmentDetailsExportDTO("8",OperatorAssessmentIndexEnum.POSITION_CONSISTENCY.getDesc(),CertificateContant.ScoringRubric.POSITION_CONSISTENCY_SCORING_RUBRIC,String.valueOf(operatorScore.getPositionConsistencyIndex()),String.valueOf(operatorScore.getPositionConsistency()))); + //将需要替换的数据数据添加到上下文中 + //其中key为word模板中的域名,value是需要替换的值 + context.put("operatorName",operator.getName()); + context.put("date", data.getYear() + "-" + QuarterEnum.getDescByCode(data.getQuarter())); + context.put("oadList",oadList); + context.put("totalScore",operatorScore.getTotalScore()); + + //创建字段元数据,需要表格才加下面这两行,否则不用 + FieldsMetadata fm = report.createFieldsMetadata(); + //Word模板中的表格数据对应的集合类型 + fm.load("oadList", OperatorsAssessmentDetailsExportDTO.class, true); + + // 将结果写入流中,供前端下载 + try { + response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".docx"); + OutputStream out = response.getOutputStream(); + //处理word文档并输出 + report.process(context, out); + response.flushBuffer(); + } catch (IOException e) { + log.error("流错误!"); + } + } catch (IOException e) { + log.error("读取Word模板异常",e); + } catch (XDocReportException e) { + log.error("word模板生成失败",e); + } finally { + if(in!=null){ + try { + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + private static String encodeName(String name) { + String fileName; + try { + fileName = URLEncoder.encode(name, "UTF-8"); + } catch (UnsupportedEncodingException e) { + log.error("文件名编码异常:", e); + fileName = UUID.randomUUID().toString().replace("-", ""); + } + return fileName; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PassportManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PassportManage.java new file mode 100644 index 0000000..f98d947 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PassportManage.java @@ -0,0 +1,181 @@ +package com.ningdatech.carapi.industry.manage; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import com.alibaba.excel.EasyExcel; +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.NdDateUtils; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.industry.entity.PassportInfo; +import com.ningdatech.carapi.industry.model.dto.PassportExportDTO; +import com.ningdatech.carapi.industry.model.dto.PassportPageParamDTO; +import com.ningdatech.carapi.industry.model.dto.PassportSaveDTO; +import com.ningdatech.carapi.industry.model.dto.PassportUpdateDTO; +import com.ningdatech.carapi.industry.model.vo.PassportVO; +import com.ningdatech.carapi.industry.service.IPassportInfoService; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname PassportManage + * @Description + * @Date 2022/11/3 17:57 + * @Created by PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class PassportManage { + + private final IPassportInfoService passportInfoService; + private final RegionsCacheHelper regionsCacheHelper; + private final CompaniesCacheHelper companiesCacheHelper; + + public PageVo infoList(PassportPageParamDTO param) { + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PassportInfo.class); + PassportManage context = (PassportManage) AopContext.currentProxy(); + context.search(page,wrapper,param); + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.of(Collections.emptyList(), page.getTotal()); + } + List data = page.getRecords().stream().map(w -> convert(w)).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + public PassportVO details(Long id) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PassportInfo.class); + PassportManage context = (PassportManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + PassportInfo record = passportInfoService.getOne(wrapper); + if (Objects.isNull(record)){ + return null; + } + //PassportInfo record = passportInfoService.getById(id); + + return convert(record); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(PassportInfo::getId,id); + } + + /** + * 查询 + * @param page + * @param param + */ + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(wrapperIndex = 1,entityIndex = 2) + public void search(Page page,LambdaQueryWrapper wrapper,PassportPageParamDTO param) { + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()), PassportInfo::getCompanyName, param.getCompanyName()) + .like(StringUtils.isNotBlank(param.getCarPlate()), PassportInfo::getCarPlate, param.getCarPlate()) + .eq(Objects.nonNull(param.getVehicleType()), PassportInfo::getVehicleType, param.getVehicleType()) + .ge(Objects.nonNull(param.getStartTime()), PassportInfo::getExpirationDate, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), PassportInfo::getExpirationDate, param.getEndTime()) + .orderBy(Boolean.TRUE,Boolean.FALSE, PassportInfo::getUpdateOn); + passportInfoService.page(page, wrapper); + } + + private PassportVO convert(PassportInfo passport) { + if(Objects.isNull(passport)){ + return null; + } + PassportVO vo = BeanUtil.copyProperties(passport, PassportVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + } + + + public PassportVO save(PassportSaveDTO passportSave, Long userId) { + PassportInfo passportInfo = BeanUtil.copyProperties(passportSave, PassportInfo.class); + CodeUtil.searchCompanyNameAndRegionName(passportInfo); + if(Objects.nonNull(passportSave.getVehicleType())){ + Optional.ofNullable(VehicleTypeEnum.getDescByCode(passportSave.getVehicleType())).ifPresent(v -> + passportInfo.setVehicleTypeName(v)); + + } + passportInfo.setCreateBy(userId); + passportInfo.setUpdateBy(userId); + passportInfoService.save(passportInfo); + return BeanUtil.copyProperties(passportInfo, PassportVO.class); + } + + public PassportVO modify(PassportUpdateDTO passportUpdate, Long userId) { + PassportInfo passportInfo = BeanUtil.copyProperties(passportUpdate, PassportInfo.class); + CodeUtil.searchCompanyNameAndRegionName(passportInfo); + if(Objects.nonNull(passportUpdate.getVehicleType())){ + Optional.ofNullable(VehicleTypeEnum.getDescByCode(passportUpdate.getVehicleType())).ifPresent(v -> + passportInfo.setVehicleTypeName(v)); + } + passportInfo.setUpdateBy(userId); + passportInfoService.updateById(passportInfo); + return BeanUtil.copyProperties(passportInfo, PassportVO.class); + } + + public Boolean remove(Long id, Long userId) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PassportInfo.class); + PassportManage context = (PassportManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + PassportInfo record = passportInfoService.getOne(wrapper); + if (Objects.isNull(record)){ + throw new BizException("无法删除!"); + } + passportInfoService.removeById(id); + return Boolean.TRUE; + } + + public void infoListExport(HttpServletResponse response, PassportPageParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = infoList(param); + List collect = page.getRecords().stream().map(r -> { + PassportExportDTO exportDTO = new PassportExportDTO(); + BeanUtils.copyProperties(r, exportDTO); + String expirationDateStr = NdDateUtils.format(r.getExpirationDate(), NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + exportDTO.setExpirationDate(expirationDateStr); + return exportDTO; + }).collect(Collectors.toList()); + String fileName = "通行证证书列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), PassportExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PurchaseOilManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PurchaseOilManage.java new file mode 100644 index 0000000..270f982 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PurchaseOilManage.java @@ -0,0 +1,75 @@ +package com.ningdatech.carapi.industry.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.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.industry.entity.PurchaseOil; +import com.ningdatech.carapi.industry.model.req.PurchaseOilListReq; +import com.ningdatech.carapi.industry.model.vo.PurchaseOilListVo; +import com.ningdatech.carapi.industry.service.IPurchaseOilService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + *

+ * PurchaseOilManage + *

+ * + * @author WendyYang + * @since 14:09 2022/11/9 + */ +@Component +@AllArgsConstructor +public class PurchaseOilManage { + + private final RegionsCacheHelper regionsCacheHelper; + private final IPurchaseOilService purchaseOilService; + + public PageVo purchaseOilList(PurchaseOilListReq req) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PurchaseOil.class); + PurchaseOilManage context = (PurchaseOilManage) AopContext.currentProxy(); + context.buildQuery(wrapper,req); + Page page = purchaseOilService.page(req.page(), wrapper); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List data = page.getRecords().stream().map(w -> { + PurchaseOilListVo vo = BeanUtil.copyProperties(w, PurchaseOilListVo.class); + vo.setRegions(regionsCacheHelper.listParents(w.getRegionId())); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + @LambdaDataScope + public void buildQuery(LambdaQueryWrapper wrapper,PurchaseOilListReq req) { + wrapper.in(Objects.nonNull(req.getRegionId()),PurchaseOil::getRegionId, regionsCacheHelper.listChildRegionId(req.getRegionId())) + .like(StrUtil.isNotBlank(req.getOilName()),PurchaseOil::getOilName, req.getOilName()) + .like(StrUtil.isNotBlank(req.getPurchaseOrg()),PurchaseOil::getPurchaseOrg, req.getPurchaseOrg()) + .ge(Objects.nonNull(req.getStartDate()),PurchaseOil::getPurchaseDate, req.getStartDate()) + .le(Objects.nonNull(req.getEndDate()),PurchaseOil::getPurchaseDate, req.getEndDate()) + .orderByDesc(PurchaseOil::getUpdateOn); + } + + public void saveOrUpdate(PurchaseOilListVo req) { + PurchaseOil oil = BeanUtil.copyProperties(req, PurchaseOil.class); + oil.setUpdateBy(LoginUserUtil.getUserId()); + if (Objects.isNull(oil.getId())) { + oil.setCompanyId(LoginUserUtil.loginUserDetail().getCompanyId()); + oil.setCreateBy(oil.getUpdateBy()); + } + purchaseOilService.saveOrUpdate(oil); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PurchaseRawMaterialManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PurchaseRawMaterialManage.java new file mode 100644 index 0000000..c4f469c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PurchaseRawMaterialManage.java @@ -0,0 +1,87 @@ +package com.ningdatech.carapi.industry.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.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.industry.entity.PurchaseRawMaterial; +import com.ningdatech.carapi.industry.model.req.PurchaseRawMaterialListReq; +import com.ningdatech.carapi.industry.model.vo.PurchaseRawMaterialListVo; +import com.ningdatech.carapi.industry.service.IPurchaseRawMaterialService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * PurchaseRawMaterialManage + *

+ * + * @author WendyYang + * @since 10:51 2022/11/9 + */ +@Component +@AllArgsConstructor +public class PurchaseRawMaterialManage { + + private final IPurchaseRawMaterialService purchaseRawMaterialService; + private final RegionsCacheHelper regionsCacheHelper; + + public PageVo list(PurchaseRawMaterialListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(PurchaseRawMaterial.class); + PurchaseRawMaterialManage context = (PurchaseRawMaterialManage) AopContext.currentProxy(); + context.buildQuery(query,req); + Page page = purchaseRawMaterialService.page(req.page(), query); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List data = page.getRecords().stream().map(w -> { + PurchaseRawMaterialListVo vo = BeanUtil.copyProperties(w, PurchaseRawMaterialListVo.class); + vo.setRegions(regionsCacheHelper.listParents(w.getRegionId())); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + @LambdaDataScope + public void buildQuery(LambdaQueryWrapper query,PurchaseRawMaterialListReq req) { + if (null != req.getRegionId()) { + query.in(PurchaseRawMaterial::getRegionId, regionsCacheHelper.listChildRegionId(req.getRegionId())); + } + if (StrUtil.isNotBlank(req.getRawMaterialName())) { + query.like(PurchaseRawMaterial::getRawMaterialName, req.getRawMaterialName()); + } + if (StrUtil.isNotBlank(req.getPurchaseOrg())) { + query.like(PurchaseRawMaterial::getPurchaseOrg, req.getPurchaseOrg()); + } + if (StrUtil.isNotBlank(req.getModel())) { + query.like(PurchaseRawMaterial::getModel, req.getModel()); + } + if (req.getStartDate() != null) { + query.ge(PurchaseRawMaterial::getPurchaseDate, req.getStartDate()); + } + if (req.getEndDate() != null) { + query.le(PurchaseRawMaterial::getPurchaseDate, req.getEndDate()); + } + query.orderByDesc(PurchaseRawMaterial::getUpdateOn); + } + + public void saveOrUpdate(PurchaseRawMaterialListVo req) { + PurchaseRawMaterial entity = BeanUtil.copyProperties(req, PurchaseRawMaterial.class); + entity.setUpdateBy(LoginUserUtil.getUserId()); + if (entity.getId() == null) { + entity.setCreateBy(entity.getUpdateBy()); + entity.setCompanyId(LoginUserUtil.loginUserDetail().getCompanyId()); + } + purchaseRawMaterialService.saveOrUpdate(entity); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PurchaseVehicleManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PurchaseVehicleManage.java new file mode 100644 index 0000000..e8dfc4f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PurchaseVehicleManage.java @@ -0,0 +1,83 @@ +package com.ningdatech.carapi.industry.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.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.industry.entity.PurchaseVehicle; +import com.ningdatech.carapi.industry.model.req.PurchaseVehicleListReq; +import com.ningdatech.carapi.industry.model.vo.PurchaseVehicleListVo; +import com.ningdatech.carapi.industry.service.IPurchaseVehicleService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * PurchaseVehicleManage + *

+ * + * @author WendyYang + * @since 14:09 2022/11/9 + */ +@Component +@AllArgsConstructor +public class PurchaseVehicleManage { + + private final RegionsCacheHelper regionsCacheHelper; + private final IPurchaseVehicleService purchaseVehicleService; + + public PageVo purchaseWheelList(PurchaseVehicleListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(PurchaseVehicle.class); + PurchaseVehicleManage context = (PurchaseVehicleManage) AopContext.currentProxy(); + context.buildQuery(query,req); + Page page = purchaseVehicleService.page(req.page(), query); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List data = page.getRecords().stream().map(w -> { + PurchaseVehicleListVo vo = BeanUtil.copyProperties(w, PurchaseVehicleListVo.class); + vo.setRegions(regionsCacheHelper.listParents(w.getRegionId())); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + @LambdaDataScope + public void buildQuery(LambdaQueryWrapper query,PurchaseVehicleListReq req) { + if (null != req.getRegionId()) { + query.in(PurchaseVehicle::getRegionId, regionsCacheHelper.listChildRegionId(req.getRegionId())); + } + if (StrUtil.isNotBlank(req.getVehicleType())) { + query.like(PurchaseVehicle::getVehicleType, req.getVehicleType()); + } + if (StrUtil.isNotBlank(req.getPurchaseOrg())) { + query.like(PurchaseVehicle::getPurchaseOrg, req.getPurchaseOrg()); + } + if (req.getStartDate() != null) { + query.ge(PurchaseVehicle::getPurchaseDate, req.getStartDate()); + } + if (req.getEndDate() != null) { + query.le(PurchaseVehicle::getPurchaseDate, req.getEndDate()); + } + query.orderByDesc(PurchaseVehicle::getUpdateOn); + } + + public void saveOrUpdate(PurchaseVehicleListVo req) { + PurchaseVehicle vehicle = BeanUtil.copyProperties(req, PurchaseVehicle.class); + vehicle.setUpdateBy(LoginUserUtil.getUserId()); + if (vehicle.getId() == null) { + vehicle.setCreateBy(vehicle.getUpdateBy()); + vehicle.setCompanyId(LoginUserUtil.loginUserDetail().getCompanyId()); + } + purchaseVehicleService.saveOrUpdate(vehicle); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PurchaseWheelManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PurchaseWheelManage.java new file mode 100644 index 0000000..8ab6869 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/PurchaseWheelManage.java @@ -0,0 +1,83 @@ +package com.ningdatech.carapi.industry.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.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.industry.entity.PurchaseWheel; +import com.ningdatech.carapi.industry.model.req.PurchaseWheelListReq; +import com.ningdatech.carapi.industry.model.vo.PurchaseWheelListVo; +import com.ningdatech.carapi.industry.service.IPurchaseWheelService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * PurchaseOilManage + *

+ * + * @author WendyYang + * @since 14:09 2022/11/9 + */ +@Component +@AllArgsConstructor +public class PurchaseWheelManage { + + private final RegionsCacheHelper regionsCacheHelper; + private final IPurchaseWheelService purchaseWheelService; + + public PageVo purchaseWheelList(PurchaseWheelListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(PurchaseWheel.class); + PurchaseWheelManage context = (PurchaseWheelManage) AopContext.currentProxy(); + context.buildQuery(query,req); + Page page = purchaseWheelService.page(req.page(), query); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + List data = page.getRecords().stream().map(w -> { + PurchaseWheelListVo vo = BeanUtil.copyProperties(w, PurchaseWheelListVo.class); + vo.setRegions(regionsCacheHelper.listParents(w.getRegionId())); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + @LambdaDataScope + public void buildQuery(LambdaQueryWrapper query,PurchaseWheelListReq req) { + if (null != req.getRegionId()) { + query.in(PurchaseWheel::getRegionId, regionsCacheHelper.listChildRegionId(req.getRegionId())); + } + if (StrUtil.isNotBlank(req.getWheelType())) { + query.like(PurchaseWheel::getWheelType, req.getWheelType()); + } + if (StrUtil.isNotBlank(req.getPurchaseOrg())) { + query.like(PurchaseWheel::getPurchaseOrg, req.getPurchaseOrg()); + } + if (req.getStartDate() != null) { + query.ge(PurchaseWheel::getPurchaseDate, req.getStartDate()); + } + if (req.getEndDate() != null) { + query.le(PurchaseWheel::getPurchaseDate, req.getEndDate()); + } + query.orderByDesc(PurchaseWheel::getUpdateOn); + } + + public void saveOrUpdate(PurchaseWheelListVo req) { + PurchaseWheel wheel = BeanUtil.copyProperties(req, PurchaseWheel.class); + wheel.setUpdateBy(LoginUserUtil.getUserId()); + if (wheel.getId() == null) { + wheel.setCreateBy(wheel.getUpdateBy()); + wheel.setCompanyId(LoginUserUtil.loginUserDetail().getCompanyId()); + } + purchaseWheelService.saveOrUpdate(wheel); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/ReadyMixedMortarManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/ReadyMixedMortarManage.java new file mode 100644 index 0000000..1be5c6d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/ReadyMixedMortarManage.java @@ -0,0 +1,189 @@ +package com.ningdatech.carapi.industry.manage; + +import java.io.IOException; +import java.util.Collection; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; + +import com.alibaba.excel.EasyExcel; +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.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.industry.entity.ReadyMixedMortarIndustryManage; +import com.ningdatech.carapi.industry.model.dto.ReadyMixedMortarIndustryManageSaveDTO; +import com.ningdatech.carapi.industry.model.dto.ReadyMixedMortarIndustryManageUpdateDTO; +import com.ningdatech.carapi.industry.model.dto.ReadyMixedPageParamDTO; +import com.ningdatech.carapi.industry.model.vo.ReadyMixedMortarIndustryManageVO; +import com.ningdatech.carapi.industry.service.IReadyMixedMortarIndustryManageService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname ReadyMixedMortarManage + * @Description + * @Date 2022/11/17 17:57 + * @Created by PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class ReadyMixedMortarManage { + + private final IReadyMixedMortarIndustryManageService readyMixedMortarIndustryManageService; + private final RegionsCacheHelper regionsCacheHelper; + + public PageVo list(ReadyMixedPageParamDTO param) { + + //Page page = param.page(); + + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ReadyMixedMortarIndustryManage.class); + //ReadyMixedMortarManage context = (ReadyMixedMortarManage) AopContext.currentProxy(); + //context.buildWrapper(wrapper,param); + + wrapper.like(StringUtils.isNotBlank(param.getTitle()), ReadyMixedMortarIndustryManage::getTitle, param.getTitle()) + .isNotNull(ReadyMixedMortarIndustryManage::getRegionId) + .orderBy(Boolean.TRUE, Boolean.FALSE, ReadyMixedMortarIndustryManage::getUpdateOn); + List resultList = readyMixedMortarIndustryManageService.dataScopeList(wrapper,param); + //List resultList = readyMixedMortarIndustryManageService.list(wrapper); + + // 省级部门上传的文件(所属区域为省级),下级账号也要能看到 + List list = readyMixedMortarIndustryManageService + .list(Wrappers.lambdaQuery(ReadyMixedMortarIndustryManage.class) + .eq(ReadyMixedMortarIndustryManage::getRegionId, DefValConstants.ZJREGION_ID)); + resultList.addAll(list); + + if (CollUtil.isEmpty(resultList)) { + return PageVo.empty(); + } + + List records = resultList.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + List data = records.stream().map(this::convert).collect(Collectors.toList()); + return PageVo.of(data, resultList.size()); + + //context.search(page, wrapper, param); + //if (CollUtil.isEmpty(page.getRecords())) { + // return PageVo.empty(); + //} + //List data = page.getRecords().stream().map(w -> convert(w)).collect(Collectors.toList()); + //return PageVo.of(data, page.getTotal()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + private void buildWrapper(LambdaQueryWrapper wrapper, ReadyMixedPageParamDTO param) { + wrapper.like(StringUtils.isNotBlank(param.getTitle()), ReadyMixedMortarIndustryManage::getTitle, param.getTitle()) + .isNotNull(ReadyMixedMortarIndustryManage::getRegionId) + .orderBy(Boolean.TRUE, Boolean.FALSE, ReadyMixedMortarIndustryManage::getUpdateOn); + } + + public ReadyMixedMortarIndustryManageVO details(Long id) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ReadyMixedMortarIndustryManage.class); + ReadyMixedMortarManage context = (ReadyMixedMortarManage) AopContext.currentProxy(); + context.buildStandardFileQuery(wrapper, id); + ReadyMixedMortarIndustryManage record = readyMixedMortarIndustryManageService.getOne(wrapper); + if (Objects.isNull(record)){ + return null; + } + // ReadyMixedMortarIndustryManage record = readyMixedMortarIndustryManageService.getById(id); + return convert(record); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildStandardFileQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(ReadyMixedMortarIndustryManage::getId,id); + } + + /** + * 查询 + * + * @param page + * @param param + */ + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(wrapperIndex = 1, entityIndex = 2) + public void search(Page page, LambdaQueryWrapper wrapper, ReadyMixedPageParamDTO param) { + wrapper.like(StringUtils.isNotBlank(param.getTitle()), ReadyMixedMortarIndustryManage::getTitle, param.getTitle()) + .orderBy(Boolean.TRUE, Boolean.FALSE, ReadyMixedMortarIndustryManage::getUpdateOn); + readyMixedMortarIndustryManageService.page(page, wrapper); + } + + private ReadyMixedMortarIndustryManageVO convert(ReadyMixedMortarIndustryManage data) { + if (Objects.isNull(data)) { + return null; + } + ReadyMixedMortarIndustryManageVO vo = BeanUtil.copyProperties(data, ReadyMixedMortarIndustryManageVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + } + + + public ReadyMixedMortarIndustryManageVO save(ReadyMixedMortarIndustryManageSaveDTO data, UserInfoDetails user) { + ReadyMixedMortarIndustryManage record = BeanUtil.copyProperties(data, ReadyMixedMortarIndustryManage.class); + Long regionId = user.getRegionId(); + Long companyId = user.getCompanyId(); + record.setRegionId(regionId); + record.setCompanyId(companyId); + CodeUtil.searchCompanyNameAndRegionName(record); + record.setCreateBy(user.getUserId()); + record.setUpdateBy(user.getUserId()); + readyMixedMortarIndustryManageService.save(record); + return BeanUtil.copyProperties(record, ReadyMixedMortarIndustryManageVO.class); + } + + public ReadyMixedMortarIndustryManageVO modify(ReadyMixedMortarIndustryManageUpdateDTO data, UserInfoDetails user) { + ReadyMixedMortarIndustryManage record = BeanUtil.copyProperties(data, ReadyMixedMortarIndustryManage.class); + CodeUtil.searchCompanyNameAndRegionName(record); + record.setUpdateBy(user.getUserId()); + readyMixedMortarIndustryManageService.updateById(record); + return BeanUtil.copyProperties(record, ReadyMixedMortarIndustryManageVO.class); + } + + public Boolean remove(Long id, UserInfoDetails user) { + readyMixedMortarIndustryManageService.removeById(id); + return Boolean.TRUE; + } + + public void export(HttpServletResponse response, ReadyMixedPageParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = list(param); + Collection collect = page.getRecords(); + String fileName = "预拌砂浆行业管理信息"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), ReadyMixedMortarIndustryManageVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/RegistrationRecordManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/RegistrationRecordManage.java new file mode 100644 index 0000000..43c5de5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/RegistrationRecordManage.java @@ -0,0 +1,169 @@ +package com.ningdatech.carapi.industry.manage; + +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +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.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.PageVo; +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.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +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.industry.entity.RegistrationRecord; +import com.ningdatech.carapi.industry.model.dto.RegistrationRecordPageParamDTO; +import com.ningdatech.carapi.industry.model.dto.RegistrationRecordSaveDTO; +import com.ningdatech.carapi.industry.model.dto.RegistrationRecordUpdateDTO; +import com.ningdatech.carapi.industry.model.vo.RegistrationRecordVO; +import com.ningdatech.carapi.industry.service.IRegistrationRecordService; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +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 lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname RegistrationRecordManage + * @Description + * @Date 2022/11/06 17:57 + * @Created by PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class RegistrationRecordManage { + + private final IRegistrationRecordService registrationRecordService; + private final OperatorsCacheHelper operatorsCacheHelper; + private final IVehicleBaseInfoService vehicleBaseInfoService; + + public PageVo infoList(RegistrationRecordPageParamDTO param) { + Page page = param.page(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 查询出该运营商下所有车辆 + List baseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)); + List carPlateList = baseInfoList.stream().map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + param.setCarPlateList(carPlateList); + } + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(RegistrationRecord.class); + RegistrationRecordManage context = (RegistrationRecordManage) AopContext.currentProxy(); + context.search(page,wrapper,param); + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + List data = page.getRecords().stream().map(w -> convert(w)).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + public RegistrationRecordVO details(Long id) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(RegistrationRecord.class); + RegistrationRecordManage context = (RegistrationRecordManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + RegistrationRecord record = registrationRecordService.getOne(wrapper); + if (Objects.isNull(record)){ + return null; + } + //RegistrationRecord record = registrationRecordService.getById(id); + return convert(record); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(RegistrationRecord::getId,id); + } + + + /** + * 查询 + * @param page + * @param param + */ + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(wrapperIndex = 1,entityIndex = 2) + public void search(Page page,LambdaQueryWrapper wrapper,RegistrationRecordPageParamDTO param) { + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()), RegistrationRecord::getCompanyName, param.getCompanyName()) + .like(StringUtils.isNotBlank(param.getCarPlate()), RegistrationRecord::getCarPlate, param.getCarPlate()) + .like(StringUtils.isNotBlank(param.getRegistrationRecord()), RegistrationRecord::getRegistrationRecord, param.getRegistrationRecord()) + .eq(Objects.nonNull(param.getVehicleType()), RegistrationRecord::getVehicleType, param.getVehicleType()) + .in(CollUtil.isNotEmpty(param.getCarPlateList()),RegistrationRecord::getCarPlate,param.getCarPlateList()) + .orderBy(Boolean.TRUE,Boolean.FALSE, RegistrationRecord::getUpdateOn); + registrationRecordService.page(page, wrapper); + } + + private RegistrationRecordVO convert(RegistrationRecord record) { + if(Objects.isNull(record)){ + return null; + } + RegistrationRecordVO vo = BeanUtil.copyProperties(record, RegistrationRecordVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + } + + + public RegistrationRecordVO save(RegistrationRecordSaveDTO data, Long userId) { + RegistrationRecord record = BeanUtil.copyProperties(data, RegistrationRecord.class); + CodeUtil.searchCompanyNameAndRegionName(record); + if(Objects.nonNull(data.getVehicleType())){ + Optional.ofNullable(VehicleTypeEnum.getDescByCode(data.getVehicleType())).ifPresent(v -> + record.setVehicleTypeName(v)); + } + record.setCreateBy(userId); + record.setUpdateBy(userId); + registrationRecordService.save(record); + return BeanUtil.copyProperties(record, RegistrationRecordVO.class); + } + + public RegistrationRecordVO modify(RegistrationRecordUpdateDTO data, Long userId) { + RegistrationRecord record = BeanUtil.copyProperties(data, RegistrationRecord.class); + CodeUtil.searchCompanyNameAndRegionName(record); + if(Objects.nonNull(data.getVehicleType())){ + Optional.ofNullable(VehicleTypeEnum.getDescByCode(data.getVehicleType())).ifPresent(v -> + record.setVehicleTypeName(v)); + } + record.setUpdateBy(userId); + registrationRecordService.updateById(record); + return BeanUtil.copyProperties(record, RegistrationRecordVO.class); + } + + public Boolean remove(Long id, Long userId) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(RegistrationRecord.class); + RegistrationRecordManage context = (RegistrationRecordManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + RegistrationRecord record = registrationRecordService.getOne(wrapper); + if (Objects.isNull(record)){ + throw new BizException("无法删除!"); + } + + registrationRecordService.removeById(id); + return Boolean.TRUE; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/SafetyEquipmentInstallUseCertificateOperationManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/SafetyEquipmentInstallUseCertificateOperationManage.java new file mode 100644 index 0000000..41679a4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/SafetyEquipmentInstallUseCertificateOperationManage.java @@ -0,0 +1,134 @@ +package com.ningdatech.carapi.industry.manage; + +import java.io.IOException; +import java.util.Collection; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; + +import com.alibaba.excel.EasyExcel; +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.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.industry.entity.SafetyEquipmentInstallUseCertificateOperation; +import com.ningdatech.carapi.industry.model.dto.UseCertOperatePageParamDTO; +import com.ningdatech.carapi.industry.model.dto.UseCertOperateUpdateDTO; +import com.ningdatech.carapi.industry.model.vo.DriverTrainingCertificateVO; +import com.ningdatech.carapi.industry.model.vo.SafetyEquipmentInstallUseCertificateOperationVO; +import com.ningdatech.carapi.industry.service.ISafetyEquipmentInstallUseCertificateOperationService; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @description + * @since 2022/11/26 17:02 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class SafetyEquipmentInstallUseCertificateOperationManage { + + private final ISafetyEquipmentInstallUseCertificateOperationService safetyEquipmentInstallUseCertificateOperationService; + + public PageVo list(UseCertOperatePageParamDTO param) { + Page page = param.page(); + LambdaQueryWrapper wrapper + = Wrappers.lambdaQuery(SafetyEquipmentInstallUseCertificateOperation.class); + SafetyEquipmentInstallUseCertificateOperationManage context + = (SafetyEquipmentInstallUseCertificateOperationManage) AopContext.currentProxy(); + context.buildQuery(page,wrapper,param); + if (CollectionUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + List data + = page.getRecords().stream().map(o -> convert(o)).collect(Collectors.toList()); + return PageVo.of(data,page.getTotal()); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(wrapperIndex = 1,entityIndex = 2) + public void buildQuery(Page page, LambdaQueryWrapper wrapper, UseCertOperatePageParamDTO param) { + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()),SafetyEquipmentInstallUseCertificateOperation::getCompanyName,param.getCompanyName()) + .like(StringUtils.isNotBlank(param.getCarPlate()),SafetyEquipmentInstallUseCertificateOperation::getCarPlate,param.getCarPlate()) + .eq(Objects.nonNull(param.getVehicleType()),SafetyEquipmentInstallUseCertificateOperation::getVehicleType,param.getVehicleType()) + .eq(Objects.nonNull(param.getAnnualStatus()),SafetyEquipmentInstallUseCertificateOperation::getYearCheckStatus,param.getAnnualStatus()) + .eq(Objects.nonNull(param.getApplicationItem()),SafetyEquipmentInstallUseCertificateOperation::getApplicationItem,param.getApplicationItem()); + safetyEquipmentInstallUseCertificateOperationService.page(page,wrapper); + } + + private SafetyEquipmentInstallUseCertificateOperationVO convert(SafetyEquipmentInstallUseCertificateOperation certificateOperation) { + SafetyEquipmentInstallUseCertificateOperationVO vo = BeanUtil.copyProperties(certificateOperation, SafetyEquipmentInstallUseCertificateOperationVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + } + + public SafetyEquipmentInstallUseCertificateOperationVO details(Long id) { + SafetyEquipmentInstallUseCertificateOperation resVo = safetyEquipmentInstallUseCertificateOperationService.getById(id); + return convert(resVo); + } + + public SafetyEquipmentInstallUseCertificateOperationVO modify(UseCertOperateUpdateDTO data, Long userId) { + SafetyEquipmentInstallUseCertificateOperation certificateOperation = BeanUtil.copyProperties(data, SafetyEquipmentInstallUseCertificateOperation.class); + CodeUtil.searchCompanyNameAndRegionName(certificateOperation); + if (Objects.nonNull(data.getVehicleType())){ + Optional.ofNullable(VehicleTypeEnum.getDescByCode(data.getVehicleType())).ifPresent(v -> + certificateOperation.setVehicleTypeName(v)); + } + if (Objects.nonNull(data.getYearCheckStatus())){ + Optional.ofNullable(data.getYearCheckStatus()).ifPresent(y -> + certificateOperation.setYearCheckStatus(y)); + + } + if (Objects.nonNull(data.getReplacementStatus())){ + Optional.ofNullable(data.getReplacementStatus()).ifPresent(r -> + certificateOperation.setReplacementStatus(r)); + + } + + certificateOperation.setUpdateBy(userId); + safetyEquipmentInstallUseCertificateOperationService.updateById(certificateOperation); + return BeanUtil.copyProperties(certificateOperation,SafetyEquipmentInstallUseCertificateOperationVO.class); + } + + public Boolean remove(Long id, Long userId) { + safetyEquipmentInstallUseCertificateOperationService.removeById(id); + return Boolean.TRUE; + } + + public void infoListExport(HttpServletResponse response, UseCertOperatePageParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = list(param); + Collection collect = page.getRecords(); + String fileName = "安全设备安装使用证书列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), SafetyEquipmentInstallUseCertificateOperationVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/SafetyEquipmentIntallUserCertificateManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/SafetyEquipmentIntallUserCertificateManage.java new file mode 100644 index 0000000..0064043 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/manage/SafetyEquipmentIntallUserCertificateManage.java @@ -0,0 +1,173 @@ +package com.ningdatech.carapi.industry.manage; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import com.alibaba.excel.EasyExcel; +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.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.industry.entity.SafetyEquipmentInstallUseCertificate; +import com.ningdatech.carapi.industry.model.dto.SafetyEqInsUseCertExportDTO; +import com.ningdatech.carapi.industry.model.dto.UseCertPageParamDTO; +import com.ningdatech.carapi.industry.model.dto.UseCertSaveDTO; +import com.ningdatech.carapi.industry.model.dto.UseCertUpdateDTO; +import com.ningdatech.carapi.industry.model.vo.SafetyEquipmentInstallUseCertificateVO; +import com.ningdatech.carapi.industry.service.ISafetyEquipmentInstallUseCertificateService; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname SafetyEquipmentIntallUserCertificateManage + * @Description + * @Date 2022/11/3 17:57 + * @Created by PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class SafetyEquipmentIntallUserCertificateManage { + + private final ISafetyEquipmentInstallUseCertificateService safetyEquipmentInstallUseCertificateService; + + public PageVo list(UseCertPageParamDTO param) { + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(SafetyEquipmentInstallUseCertificate.class); + SafetyEquipmentIntallUserCertificateManage context = (SafetyEquipmentIntallUserCertificateManage) AopContext.currentProxy(); + context.search(page,wrapper,param); + if(CollUtil.isEmpty(page.getRecords())){ + return PageVo.of(Collections.emptyList(), page.getTotal()); + } + List data = page.getRecords().stream().map(w -> convert(w)).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + public SafetyEquipmentInstallUseCertificateVO details(Long id) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(SafetyEquipmentInstallUseCertificate.class); + SafetyEquipmentIntallUserCertificateManage context = (SafetyEquipmentIntallUserCertificateManage) AopContext.currentProxy(); + context.buildStandardFileQuery(wrapper, id); + SafetyEquipmentInstallUseCertificate record = safetyEquipmentInstallUseCertificateService.getOne(wrapper); + if (Objects.isNull(record)){ + return null; + } + //SafetyEquipmentInstallUseCertificate record = safetyEquipmentInstallUseCertificateService.getById(id); + return convert(record); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildStandardFileQuery(LambdaQueryWrapper wrapper, Long id) { + + } + + /** + * 查询 + * @param page + * @param param + */ + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(wrapperIndex = 1,entityIndex = 2) + public void search(Page page,LambdaQueryWrapper wrapper,UseCertPageParamDTO param) { + wrapper.like(StringUtils.isNotBlank(param.getCompanyName()), SafetyEquipmentInstallUseCertificate::getCompanyName, param.getCompanyName()) + .like(StringUtils.isNotBlank(param.getCarPlate()), SafetyEquipmentInstallUseCertificate::getCarPlate, param.getCarPlate()) + .eq(Objects.nonNull(param.getVehicleType()), SafetyEquipmentInstallUseCertificate::getVehicleType, param.getVehicleType()) + .ge(Objects.nonNull(param.getStartTime()), SafetyEquipmentInstallUseCertificate::getIssueDate, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), SafetyEquipmentInstallUseCertificate::getIssueDate, param.getEndTime()) + .like(Objects.nonNull(param.getAnnualInspectionRecords()), SafetyEquipmentInstallUseCertificate::getAnnualInspectionRecords, param.getAnnualInspectionRecords()) + .orderBy(Boolean.TRUE,Boolean.FALSE, SafetyEquipmentInstallUseCertificate::getUpdateOn); + safetyEquipmentInstallUseCertificateService.page(page, wrapper); + } + + private SafetyEquipmentInstallUseCertificateVO convert(SafetyEquipmentInstallUseCertificate certificate) { + SafetyEquipmentInstallUseCertificateVO vo = BeanUtil.copyProperties(certificate, SafetyEquipmentInstallUseCertificateVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + } + + + public SafetyEquipmentInstallUseCertificateVO save(UseCertSaveDTO data, Long userId) { + SafetyEquipmentInstallUseCertificate certificate = BeanUtil.copyProperties(data, SafetyEquipmentInstallUseCertificate.class); + CodeUtil.searchCompanyNameAndRegionName(certificate); + if(Objects.nonNull(data.getVehicleType())){ + Optional.ofNullable(VehicleTypeEnum.getDescByCode(data.getVehicleType())).ifPresent(v -> + certificate.setVehicleTypeName(v)); + } + certificate.setCreateBy(userId); + certificate.setUpdateBy(userId); + safetyEquipmentInstallUseCertificateService.save(certificate); + return BeanUtil.copyProperties(certificate, SafetyEquipmentInstallUseCertificateVO.class); + } + + public SafetyEquipmentInstallUseCertificateVO modify(UseCertUpdateDTO data, Long userId) { + SafetyEquipmentInstallUseCertificate certificate = BeanUtil.copyProperties(data, SafetyEquipmentInstallUseCertificate.class); + CodeUtil.searchCompanyNameAndRegionName(certificate); + if(Objects.nonNull(data.getVehicleType())){ + Optional.ofNullable(VehicleTypeEnum.getDescByCode(data.getVehicleType())).ifPresent(v -> + certificate.setVehicleTypeName(v)); + } + certificate.setUpdateBy(userId); + safetyEquipmentInstallUseCertificateService.updateById(certificate); + return BeanUtil.copyProperties(certificate, SafetyEquipmentInstallUseCertificateVO.class); + } + + public Boolean remove(Long id, Long userId) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(SafetyEquipmentInstallUseCertificate.class); + SafetyEquipmentIntallUserCertificateManage context = (SafetyEquipmentIntallUserCertificateManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + SafetyEquipmentInstallUseCertificate record = safetyEquipmentInstallUseCertificateService.getOne(wrapper); + if (Objects.isNull(record)){ + throw new BizException("无法删除!"); + } + safetyEquipmentInstallUseCertificateService.removeById(id); + return Boolean.TRUE; + } + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(SafetyEquipmentInstallUseCertificate::getId,id); + } + + public void infoListExport(HttpServletResponse response, UseCertPageParamDTO param) { + param.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + PageVo page = list(param); + List collect = page.getRecords().stream().map(r -> { + SafetyEqInsUseCertExportDTO certExportDTO = new SafetyEqInsUseCertExportDTO(); + BeanUtils.copyProperties(r, certExportDTO); + return certExportDTO; + }).collect(Collectors.toList()); + String fileName = "安全设备安装使用证书信息列表"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), SafetyEqInsUseCertExportDTO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorDynamicsMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorDynamicsMapper.java new file mode 100644 index 0000000..e23382e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorDynamicsMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.DataQualityMonitorDynamics; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 异常GPS数据监控 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +public interface DataQualityMonitorDynamicsMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorDynamicsMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorDynamicsMapper.xml new file mode 100644 index 0000000..7b0ae41 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorDynamicsMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorGpsMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorGpsMapper.java new file mode 100644 index 0000000..b5e0566 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorGpsMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.DataQualityMonitorGps; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 动态数据质量监控 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +public interface DataQualityMonitorGpsMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorGpsMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorGpsMapper.xml new file mode 100644 index 0000000..17e9543 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorGpsMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorStaticMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorStaticMapper.java new file mode 100644 index 0000000..3d0a71b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorStaticMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.DataQualityMonitorStatic; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 静态数据质量监控 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +public interface DataQualityMonitorStaticMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorStaticMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorStaticMapper.xml new file mode 100644 index 0000000..1de41e0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataQualityMonitorStaticMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataScreenMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataScreenMapper.java new file mode 100644 index 0000000..806ec2a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataScreenMapper.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.industry.model.po.CeriticatePO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface DataScreenMapper { + + List tainCertificate(@Param("param") DataScreenParam param); + + List laboratoryQualificationCertificate(@Param("param") DataScreenParam param); + + List laboratoryAcceptanceCertificate(@Param("param") DataScreenParam param); + + List recordCertificateMortarEnterprise(@Param("param") DataScreenParam param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataScreenMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataScreenMapper.xml new file mode 100644 index 0000000..b6ca06d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DataScreenMapper.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateJoinMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateJoinMapper.java new file mode 100644 index 0000000..91bdc8b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateJoinMapper.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.industry.mapper; + +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateJoin; + +/** + *

+ * 驾驶员合格证 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-03 + */ +public interface DriverTrainingCertificateJoinMapper extends BaseMapper { + String QUERY_SQL = "SELECT cc.*, " + + " d.id_card,cc.issue_date training_time," + + " '合格' training_result,cc.expiry_date effective_time,'浙江省散装水泥、预拌混凝土、预拌砂浆专用车辆驾驶员业务技能和安全知识培训' training_program " + + " FROM nd_certificate cc " + + " LEFT JOIN nd_driver_info d ON cc.driver_id = d.id " + + " LEFT JOIN nd_company_info c ON d.company_id = c.id "; + String WRAPPER_SQL = "SELECT * from ( " + QUERY_SQL + " ) AS q ${ew.customSqlSegment}"; + + @Select(WRAPPER_SQL) + Page pageJoin(Page page, @Param("ew") LambdaQueryWrapper wrapper); + @Select(WRAPPER_SQL) + DriverTrainingCertificateJoin getOneJoin(@Param("ew") LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateJoinMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateJoinMapper.xml new file mode 100644 index 0000000..9945f71 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateJoinMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateOperJoinMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateOperJoinMapper.java new file mode 100644 index 0000000..266b6c5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateOperJoinMapper.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.industry.mapper; + +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateOperJoin; + +/** + *

+ * 驾驶员合格证操作 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-04 + */ +public interface DriverTrainingCertificateOperJoinMapper extends BaseMapper { + String QUERY_SQL = "SELECT cp.*, d.driver_name," + + " d.id_card,c.name company_name,cp.issue_date training_time," + + " '合格' training_result,cp.expiry_date effective_time,'浙江省散装水泥、预拌混凝土、预拌砂浆专用车辆驾驶员业务技能和安全知识培训' training_program " + + " FROM nd_driver_training_certificate_oper AS cp " + + //" LEFT JOIN nd_certificate AS cc ON cp.certificate_id = cc.id" + + " LEFT JOIN nd_driver_info d ON cp.driver_id = d.id " + + " LEFT JOIN nd_company_info c ON d.company_id = c.id "; + String WRAPPER_SQL = "SELECT * from ( " + QUERY_SQL + " ) AS q ${ew.customSqlSegment}"; + + @Select(WRAPPER_SQL) + Page pageJoin(Page page, @Param("ew") LambdaQueryWrapper wrapper); + @Select(WRAPPER_SQL) + DriverTrainingCertificateOperJoin getOneJoin(@Param("ew") LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateOperMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateOperMapper.java new file mode 100644 index 0000000..a691eda --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateOperMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateOper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 驾驶员合格证操作 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-04 + */ +public interface DriverTrainingCertificateOperMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateOperMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateOperMapper.xml new file mode 100644 index 0000000..31a2e28 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/DriverTrainingCertificateOperMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabAcceptanceCertificateChangeMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabAcceptanceCertificateChangeMapper.java new file mode 100644 index 0000000..637f529 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabAcceptanceCertificateChangeMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.LabAcceptanceCertificateChange; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 实验室验收合格证换证 Mapper 接口 + *

+ * + * @author CMM + * @since 2022-12-16 + */ +public interface LabAcceptanceCertificateChangeMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabAcceptanceCertificateChangeMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabAcceptanceCertificateChangeMapper.xml new file mode 100644 index 0000000..f3fd425 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabAcceptanceCertificateChangeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabAcceptanceCertificateMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabAcceptanceCertificateMapper.java new file mode 100644 index 0000000..363dfcc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabAcceptanceCertificateMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.LabAcceptanceCertificate; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 实验室验收合格证 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-11-08 + */ +public interface LabAcceptanceCertificateMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabAcceptanceCertificateMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabAcceptanceCertificateMapper.xml new file mode 100644 index 0000000..c94c5be --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabAcceptanceCertificateMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabWorkerCertificateChangeMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabWorkerCertificateChangeMapper.java new file mode 100644 index 0000000..0c6b39b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabWorkerCertificateChangeMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.LabWorkerCertificateChange; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 实验室人员从业资格证更换 Mapper 接口 + *

+ * + * @author CMM + * @since 2022-12-16 + */ +public interface LabWorkerCertificateChangeMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabWorkerCertificateChangeMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabWorkerCertificateChangeMapper.xml new file mode 100644 index 0000000..b939b05 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabWorkerCertificateChangeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabWorkerCertificateMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabWorkerCertificateMapper.java new file mode 100644 index 0000000..57d50d0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabWorkerCertificateMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.LabWorkerCertificate; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 实验室人员从业资格证 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-11-04 + */ +public interface LabWorkerCertificateMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabWorkerCertificateMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabWorkerCertificateMapper.xml new file mode 100644 index 0000000..6842b6c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/LabWorkerCertificateMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/MortarEnterpriseFilingCertificateChangeMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/MortarEnterpriseFilingCertificateChangeMapper.java new file mode 100644 index 0000000..bc44b18 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/MortarEnterpriseFilingCertificateChangeMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.MortarEnterpriseFilingCertificateChange; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 砂浆企业备案证换证 Mapper 接口 + *

+ * + * @author CMM + * @since 2022-12-15 + */ +public interface MortarEnterpriseFilingCertificateChangeMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/MortarEnterpriseFilingCertificateChangeMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/MortarEnterpriseFilingCertificateChangeMapper.xml new file mode 100644 index 0000000..aff52ea --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/MortarEnterpriseFilingCertificateChangeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/MortarEnterpriseFilingCertificateMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/MortarEnterpriseFilingCertificateMapper.java new file mode 100644 index 0000000..ceda75b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/MortarEnterpriseFilingCertificateMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.MortarEnterpriseFilingCertificate; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 砂浆企业备案证 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-11-08 + */ +public interface MortarEnterpriseFilingCertificateMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/MortarEnterpriseFilingCertificateMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/MortarEnterpriseFilingCertificateMapper.xml new file mode 100644 index 0000000..8f1e9f6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/MortarEnterpriseFilingCertificateMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/OperatorIndexScoreInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/OperatorIndexScoreInfoMapper.java new file mode 100644 index 0000000..7c91ddc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/OperatorIndexScoreInfoMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.OperatorIndexScoreInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-01-04 + */ +public interface OperatorIndexScoreInfoMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/OperatorIndexScoreInfoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/OperatorIndexScoreInfoMapper.xml new file mode 100644 index 0000000..c81bfbe --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/OperatorIndexScoreInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PassportInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PassportInfoMapper.java new file mode 100644 index 0000000..17d5bd8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PassportInfoMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.PassportInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 通行证信息 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +public interface PassportInfoMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PassportInfoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PassportInfoMapper.xml new file mode 100644 index 0000000..6ff0830 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PassportInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseOilMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseOilMapper.java new file mode 100644 index 0000000..eef6577 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseOilMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.PurchaseOil; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 油品采购信息表 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +public interface PurchaseOilMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseOilMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseOilMapper.xml new file mode 100644 index 0000000..fce3d2a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseOilMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseRawMaterialMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseRawMaterialMapper.java new file mode 100644 index 0000000..499c20f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseRawMaterialMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.PurchaseRawMaterial; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 原材料采购信息表 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +public interface PurchaseRawMaterialMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseRawMaterialMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseRawMaterialMapper.xml new file mode 100644 index 0000000..80a0ca9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseRawMaterialMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseVehicleMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseVehicleMapper.java new file mode 100644 index 0000000..0b11b6a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseVehicleMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.PurchaseVehicle; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 车辆采购信息表 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +public interface PurchaseVehicleMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseVehicleMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseVehicleMapper.xml new file mode 100644 index 0000000..c212d00 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseVehicleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseWheelMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseWheelMapper.java new file mode 100644 index 0000000..d77bc99 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseWheelMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.PurchaseWheel; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 轮胎采购信息表 Mapper 接口 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +public interface PurchaseWheelMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseWheelMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseWheelMapper.xml new file mode 100644 index 0000000..57f1dce --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/PurchaseWheelMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/ReadyMixedMortarIndustryManageMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/ReadyMixedMortarIndustryManageMapper.java new file mode 100644 index 0000000..7c72d29 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/ReadyMixedMortarIndustryManageMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.ReadyMixedMortarIndustryManage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 预拌砂浆行业管理 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-18 + */ +public interface ReadyMixedMortarIndustryManageMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/ReadyMixedMortarIndustryManageMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/ReadyMixedMortarIndustryManageMapper.xml new file mode 100644 index 0000000..bdac2ea --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/ReadyMixedMortarIndustryManageMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/RegistrationRecordMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/RegistrationRecordMapper.java new file mode 100644 index 0000000..391d322 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/RegistrationRecordMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.RegistrationRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 新车上牌记录 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-06 + */ +public interface RegistrationRecordMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/RegistrationRecordMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/RegistrationRecordMapper.xml new file mode 100644 index 0000000..cbf3cfb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/RegistrationRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/SafetyEquipmentInstallUseCertificateMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/SafetyEquipmentInstallUseCertificateMapper.java new file mode 100644 index 0000000..96c0047 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/SafetyEquipmentInstallUseCertificateMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.SafetyEquipmentInstallUseCertificate; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 安全设备安装使用证书信息 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface SafetyEquipmentInstallUseCertificateMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/SafetyEquipmentInstallUseCertificateMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/SafetyEquipmentInstallUseCertificateMapper.xml new file mode 100644 index 0000000..85db2a7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/SafetyEquipmentInstallUseCertificateMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/SafetyEquipmentInstallUseCertificateOperationMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/SafetyEquipmentInstallUseCertificateOperationMapper.java new file mode 100644 index 0000000..551203c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/SafetyEquipmentInstallUseCertificateOperationMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.SafetyEquipmentInstallUseCertificateOperation; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 安全设备安装使用证书操作信息 Mapper 接口 + *

+ * + * @author CMM + * @since 2022-11-26 + */ +public interface SafetyEquipmentInstallUseCertificateOperationMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/SafetyEquipmentInstallUseCertificateOperationMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/SafetyEquipmentInstallUseCertificateOperationMapper.xml new file mode 100644 index 0000000..6ca97d2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/SafetyEquipmentInstallUseCertificateOperationMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/VehicleAnnualInspectionReviewMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/VehicleAnnualInspectionReviewMapper.java new file mode 100644 index 0000000..34d0680 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/VehicleAnnualInspectionReviewMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.mapper; + +import com.ningdatech.carapi.industry.entity.VehicleAnnualInspectionReview; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 车辆年检年审 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +public interface VehicleAnnualInspectionReviewMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/VehicleAnnualInspectionReviewMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/VehicleAnnualInspectionReviewMapper.xml new file mode 100644 index 0000000..8d13480 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/mapper/VehicleAnnualInspectionReviewMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorDynamicsExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorDynamicsExportDTO.java new file mode 100644 index 0000000..4178cdc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorDynamicsExportDTO.java @@ -0,0 +1,65 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 动态数据监控 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Data +@ApiModel(value = "DataQualityMonitorDynamicsExportDTO", description = "动态数据监控") +public class DataQualityMonitorDynamicsExportDTO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("企业ID") + @ExcelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + @ExcelProperty("企业名") + private String companyName; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("0正常 1异常") + @ExcelProperty("0正常 1异常") + private Integer state; + + @ApiModelProperty("驾驶员ID") + @ExcelProperty("驾驶员ID") + private Long driverId; + + @ApiModelProperty("驾驶员名字") + @ExcelProperty("驾驶员名字") + private String driverName; + + @ApiModelProperty("数据时间") + @ExcelProperty("数据时间") + private LocalDateTime dataTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorDynamicsPageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorDynamicsPageParamDTO.java new file mode 100644 index 0000000..cd6001c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorDynamicsPageParamDTO.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.industry.model.dto; + +import java.io.Serializable; +import java.util.List; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +/** + *

+ * 动态数据质量分页传参 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Data +@Builder +@ApiModel(value = "DataQualityMonitorDynamicsPageParamDTO", description = "动态数据质量分页传参") +public class DataQualityMonitorDynamicsPageParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("开始时间") + private String startTime; + + @ApiModelProperty("结束时间") + private String endTime; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车牌号列表") + private List carPlateList; + + @ApiModelProperty("数据异常状态 0正常 1异常") + private Integer state; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorGpsExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorGpsExportDTO.java new file mode 100644 index 0000000..a8f2df4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorGpsExportDTO.java @@ -0,0 +1,67 @@ +package com.ningdatech.carapi.industry.model.dto; + +import java.io.Serializable; +import java.math.BigDecimal; + +import com.alibaba.excel.annotation.ExcelProperty; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + *

+ * GPS数据质量监控 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Data +@ApiModel(value = "DataQualityMonitorGpsExportDTO", description = "GPS数据质量监控") +public class DataQualityMonitorGpsExportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ExcelProperty("车牌号") + private String carPlate; + + @ExcelProperty("所属区域") + private String regionName; + + @ExcelProperty("所属企业") + private String companyName; + + @ExcelProperty("车辆类型") + private String vehicleTypeName; + + @ExcelProperty("运营商") + private String operatorName; + + @ExcelProperty("经度") + private BigDecimal longitude; + + @ExcelProperty("纬度") + private BigDecimal latitude; + + @ExcelProperty("速度") + private BigDecimal velocity; + + @ExcelProperty("方向角度") + private BigDecimal direction; + + @ExcelProperty("状态 0离线 1在线") + private String state; + + @ExcelProperty("时间") + private String dataTime; + + @ExcelProperty("报警") + private String alarmName; + + @ExcelProperty("异常原因") + private Integer abnormalCausesName; + + @ExcelProperty("备注") + private String remark; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorGpsPageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorGpsPageParamDTO.java new file mode 100644 index 0000000..31486ef --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorGpsPageParamDTO.java @@ -0,0 +1,49 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * GPS数据质量分页传参 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Data +@Builder +@ApiModel(value = "DataQualityMonitorDynamicsPageParamDTO", description = "GPS数据质量分页传参") +public class DataQualityMonitorGpsPageParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("开始时间") + private String startTime; + + @ApiModelProperty("结束时间") + private String endTime; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("运营商") + private String operatorName; + + @ApiModelProperty("车辆颜色") + private String plateColor; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorStaticExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorStaticExportDTO.java new file mode 100644 index 0000000..5fe236a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorStaticExportDTO.java @@ -0,0 +1,65 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 静态数据质量监控 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Data +@ApiModel(value = "DataQualityMonitorStaticExportDTO", description = "静态数据质量监控") +public class DataQualityMonitorStaticExportDTO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + @ExcelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + @ExcelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + @ExcelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("数据类型") + @ExcelProperty("数据类型") + private Integer dataType; + + @ApiModelProperty("数据类型名") + @ExcelProperty("数据类型名") + private String dataTypeName; + + @ApiModelProperty("数据异常状态 0正常 1不正常") + @ExcelProperty("数据异常状态 0正常 1不正常") + private Integer state; + + @ApiModelProperty("批次号") + @ExcelProperty("批次号") + private String batchNo; + + @ApiModelProperty("数据采集时间") + @ExcelProperty("数据采集时间") + private LocalDateTime dataTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorStaticPageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorStaticPageParamDTO.java new file mode 100644 index 0000000..412c5a1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DataQualityMonitorStaticPageParamDTO.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.industry.model.dto; + +import java.io.Serializable; +import java.util.List; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +/** + *

+ * 静态数据质量分页传参 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Data +@Builder +@ApiModel(value = "DataQualityMonitorDynamicsPageParamDTO", description = "静态数据质量分页传参") +public class DataQualityMonitorStaticPageParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("开始时间") + private String startTime; + + @ApiModelProperty("结束时间") + private String endTime; + + @ApiModelProperty("企业集合") + private List companyIds; + + @ApiModelProperty("批次号") + private String batchNo; + + @ApiModelProperty("数据异常状态 0正常 1异常") + private Integer state; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DriverTrainingCertificateExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DriverTrainingCertificateExportDTO.java new file mode 100644 index 0000000..221f93f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DriverTrainingCertificateExportDTO.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.industry.model.dto; + +import java.io.Serializable; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 驾驶员培训合格证导出实体 + * + * @author CMM + * @since 2023/02/20 15:27 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class DriverTrainingCertificateExportDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ExcelProperty("所属区域") + private String regionName; + + @ExcelProperty("驾驶员姓名") + private String driverName; + + @ExcelProperty("身份证号") + private String idCard; + + @ExcelProperty("所属企业") + private String companyName; + + @ExcelProperty("培训时间") + private String trainingTime; + + @ExcelProperty("培训结果") + private String trainingResult; + + @ExcelProperty("有效时间") + private String effectiveTime; + + @ExcelProperty("培训项目") + private String trainingProgram; +} + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DriverTrainingCertificatePageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DriverTrainingCertificatePageParamDTO.java new file mode 100644 index 0000000..d60a54c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DriverTrainingCertificatePageParamDTO.java @@ -0,0 +1,49 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 驾驶员合格证 + *

+ * + * @author PoffyZhang + * @since 2022-11-03 + */ +@Data +@Builder +@ApiModel(value = "DriverTrainingCertificatePageParamDTO", description = "驾驶员合格证分页传参") +public class DriverTrainingCertificatePageParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("开始时间") + private String startTime; + + @ApiModelProperty("结束时间") + private String endTime; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("驾驶员名") + private String driverName; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("培训结果 合格") + private String trainingResult; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DriverTrainingCertificateUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DriverTrainingCertificateUpdateDTO.java new file mode 100644 index 0000000..6cb0736 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/DriverTrainingCertificateUpdateDTO.java @@ -0,0 +1,72 @@ +package com.ningdatech.carapi.industry.model.dto; + +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 驾驶员培训合格证编辑信息 + * + * @author CMM + * @since 2023/03/02 11:12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "DriverTrainingCertificateUpdateDTO", description = "行业服务-驾驶员培训合格证") +public class DriverTrainingCertificateUpdateDTO { + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("驾驶员ID") + private Long driverId; + + @ApiModelProperty("驾驶员名") + private String driverName; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("发证单位") + private String issuedBy; + + @ApiModelProperty("发证日期") + private LocalDateTime issueDate; + + @ApiModelProperty("驾驶员证号") + private String driverLicenseNo; + + @ApiModelProperty("有效期至") + private LocalDateTime expiryDate; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("申请事项") + private String application; + + @ApiModelProperty("申请原因") + private String applicationReason; + + @ApiModelProperty("合格证类型") + private Integer certificateType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/InspectionReviewSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/InspectionReviewSaveDTO.java new file mode 100644 index 0000000..9f0b4cb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/InspectionReviewSaveDTO.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 车辆年检年审 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +@Data +@ApiModel(value = "InspectionReviewSaveDTO", description = "车辆年检年审") +public class InspectionReviewSaveDTO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("年检记录") + private String inspectionRecords; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型") + private String vehicleTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/InspectionReviewUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/InspectionReviewUpdateDTO.java new file mode 100644 index 0000000..508b436 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/InspectionReviewUpdateDTO.java @@ -0,0 +1,52 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 车辆年检年审 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +@Data +@ApiModel(value = "InspectionReviewSaveDTO", description = "车辆年检年审") +public class InspectionReviewUpdateDTO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @NotNull(message = "id不能为空") + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("年检记录") + private String inspectionRecords; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型") + private String vehicleTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/LabAcceptanceCertificateExportDto.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/LabAcceptanceCertificateExportDto.java new file mode 100644 index 0000000..64f5d70 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/LabAcceptanceCertificateExportDto.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.Data; + +/** + *

+ * LabAcceptanceCertificateImportDto + *

+ * + * @author WendyYang + * @since 21:34 2022/11/4 + */ +@Data +public class LabAcceptanceCertificateExportDto { + + @ExcelProperty("所属区域") + private String regionName; + + @ExcelProperty("所属企业") + private String companyName; + + @ExcelProperty("证书编号") + private String certificateNo; + + @ExcelProperty("备案项目") + private String recordItem; + + @ExcelProperty("执行标准") + private String standard; + + @ExcelProperty("检测项目") + private String testItem; + + @ExcelProperty("发证机关") + private String conferOrg; + + @ExcelProperty("发证日期") + private String conferDate; + + @ExcelProperty("有效日期") + private String validDate; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/LabAcceptanceCertificateImportDto.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/LabAcceptanceCertificateImportDto.java new file mode 100644 index 0000000..80e6e33 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/LabAcceptanceCertificateImportDto.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + *

+ * LabAcceptanceCertificateImportDto + *

+ * + * @author WendyYang + * @since 21:34 2022/11/4 + */ +@Data +public class LabAcceptanceCertificateImportDto { + + @ExcelProperty("企业完整名称") + @NotBlank(message = "企业完整名称不能为空") + private String companyName; + + @ExcelProperty("备案项目") + @NotBlank(message = "备案项目不能为空") + private String recordItem; + + @ExcelProperty("执行标准") + @NotBlank(message = "执行标准不能为空") + private String standard; + + @ExcelProperty("发证机关") + @NotBlank(message = "发证机关不能为空") + private String conferOrg; + + @ExcelProperty("证书编号") + @NotBlank(message = "证书编号不能为空") + private String certificateNo; + + @ExcelProperty(value = "发证日期") + @DateTimeFormat("yyyy-MM-dd") + @NotNull(message = "发证日期不能为空") + private Date conferDate; + + @ExcelProperty(value = "换证日期") + @DateTimeFormat("yyyy-MM-dd") + @NotNull(message = "换证日期不能为空") + private Date validDate; + + @ExcelProperty("备注") + @Length(max = 500, message = "备注最多500个字符") + private String remark; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/LabWorkerCertificateExportDto.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/LabWorkerCertificateExportDto.java new file mode 100644 index 0000000..c5e3f47 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/LabWorkerCertificateExportDto.java @@ -0,0 +1,49 @@ +package com.ningdatech.carapi.industry.model.dto; + +import java.io.Serializable; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.Data; + +/** + *

+ * LabWorkerCertificateImportDto + *

+ * + * @author WendyYang + * @since 21:34 2022/11/4 + */ +@Data +public class LabWorkerCertificateExportDto implements Serializable { + + private static final long serialVersionUID = 1L; + + @ExcelProperty("所属区域") + private String regionName; + + @ExcelProperty("姓名") + private String userName; + + @ExcelProperty("性别") + private String gender; + + @ExcelProperty("身份证号码") + private String idCard; + + @ExcelProperty("所属企业") + private String companyName; + + @ExcelProperty("证书编号") + private String certificateNo; + + @ExcelProperty("发证时间") + private String conferDate; + + @ExcelProperty("有效期") + private String validDate; + + @ExcelProperty("备注") + private String remark; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/LabWorkerCertificateImportDto.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/LabWorkerCertificateImportDto.java new file mode 100644 index 0000000..48f547c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/LabWorkerCertificateImportDto.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + *

+ * LabWorkerCertificateImportDto + *

+ * + * @author WendyYang + * @since 21:34 2022/11/4 + */ +@Data +public class LabWorkerCertificateImportDto { + + @ExcelProperty("企业完整名称") + @NotBlank(message = "企业名称不能为空") + private String companyName; + + @ExcelProperty("姓名") + @NotBlank(message = "姓名不能为空") + private String username; + + @ExcelProperty("性别") + @NotBlank(message = "性别不能为空") + private String gender; + + @ExcelProperty("身份证号码") + @NotBlank(message = "身份证号码不能为空") + private String idCard; + + @ExcelProperty("证照编号") + @NotBlank(message = "证照编号不能为空") + private String certificateNo; + + @ExcelProperty(value = "有效开始日期") + @DateTimeFormat("yyyy-MM-dd") + @NotNull(message = "有效开始日期不能为空") + private Date startDate; + + @ExcelProperty(value = "有效结束日期") + @DateTimeFormat("yyyy-MM-dd") + @NotNull(message = "有效结束日期不能为空") + private Date endDate; + + @ExcelProperty("备注") + @Length(max = 500, message = "备注最多500个字符") + private String remark; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/MortarEnterpriseFilingCertificateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/MortarEnterpriseFilingCertificateDTO.java new file mode 100644 index 0000000..f09b4be --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/MortarEnterpriseFilingCertificateDTO.java @@ -0,0 +1,82 @@ +package com.ningdatech.carapi.industry.model.dto; + +import java.time.LocalDate; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +import org.hibernate.validator.constraints.Length; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * LabWorkerCertificateListVo + *

+ * + * @author WendyYang + * @since 15:06 2022/11/4 + */ +@Data +public class MortarEnterpriseFilingCertificateDTO { + + @ApiModelProperty("ID") + private Integer id; + + @ApiModelProperty("证书编号") + @NotBlank(message = "证书编号不能为空") + private String certificateNo; + + @ApiModelProperty("企业") + @NotNull(message = "企业ID不能为空") + private Long companyId; + + @ApiModelProperty("企业名称") + @NotBlank(message = "企业名称不能为空") + private String companyName; + + @ApiModelProperty("区域ID") + @NotNull(message = "区域ID不能为空") + private Long regionId; + + @ApiModelProperty("备案项目") + @NotBlank(message = "备案项目不能为空") + private String recordItem; + + @ApiModelProperty("生产能力") + @NotBlank(message = "生产能力不能为空") + private String productionCapacity; + + @ApiModelProperty("执行标准") + @NotBlank(message = "执行标准不能为空") + private String standards; + + @ApiModelProperty("有效期") + @NotNull(message = "有效期不能为空") + private LocalDate validDate; + + @ApiModelProperty("发证机关") + @NotNull(message = "发证机关不能为空") + private String conferOrg; + + @ApiModelProperty("发证时间") + private LocalDate conferDate; + + @ApiModelProperty("换证时间") + private LocalDate replaceDate; + + @ApiModelProperty("申请事项") + private String applicationItem; + + @ApiModelProperty("申请原因") + private String applicationReason; + + @ApiModelProperty("备注") + @Length(max = 500, message = "备注最多500个字符") + private String remark; + + @ApiModelProperty("新增类型") + private Integer addType; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/MortarEnterpriseFilingCertificateExportDto.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/MortarEnterpriseFilingCertificateExportDto.java new file mode 100644 index 0000000..cb07f0c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/MortarEnterpriseFilingCertificateExportDto.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.Data; + +/** + *

+ * LabAcceptanceCertificateImportDto + *

+ * + * @author WendyYang + * @since 21:34 2022/11/4 + */ +@Data +public class MortarEnterpriseFilingCertificateExportDto { + + @ExcelProperty("所属区域") + private String regionName; + + @ExcelProperty("证书编号") + private String certificateNo; + + @ExcelProperty("所属企业") + private String companyName; + + @ExcelProperty("备案项目") + private String recordItem; + + @ExcelProperty("生产能力") + private String productionCapacity; + + @ExcelProperty("发证机关") + private String conferOrg; + + @ExcelProperty("发证日期") + private String conferDate; + + @ExcelProperty("有效日期") + private String validDate; + + @ExcelProperty("执行标准") + private String standard; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/OperatorAssessmentDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/OperatorAssessmentDTO.java new file mode 100644 index 0000000..cc194d8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/OperatorAssessmentDTO.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotNull; + +/** + * @author CMM + * @since 2023/01/04 10:14 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "OperatorAssessmentDTO", description = "运营商考核分数查询") +public class OperatorAssessmentDTO extends PagePo { + + @ApiModelProperty(value = "运营商id") + @NotNull(message = "运营商ID不能为空!") + private Long id; + + @ApiModelProperty(value = "季度") + @NotNull(message = "请选择季度!") + private Integer quarter; + + @ApiModelProperty(value = "年份") + @NotNull(message = "请选择年份!") + private String year; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/OperatorsAssessmentDetailsExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/OperatorsAssessmentDetailsExportDTO.java new file mode 100644 index 0000000..dcc5417 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/OperatorsAssessmentDetailsExportDTO.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 运营商考核详情导出实体类 + * + * @author CMM + * @since 2023/01/16 10:06 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class OperatorsAssessmentDetailsExportDTO { + + @ExcelProperty(value = "序号") + private String id; + + @ExcelProperty(value = "考核指标名称") + private String assessmentIndicators; + + @ExcelProperty(value = "评分细则") + private String scoringRubric; + + @ExcelProperty(value = "指标分值") + private String indexScore; + + @ExcelProperty(value = "实际得分") + private String actualScore; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/PassportExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/PassportExportDTO.java new file mode 100644 index 0000000..3f1f2c8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/PassportExportDTO.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.industry.model.dto; + +import java.io.Serializable; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 通行证导出实体 + * + * @author CMM + * @since 2023/02/20 15:53 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class PassportExportDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ExcelProperty("所属区域") + private String regionName; + + @ExcelProperty("车辆所有人") + private String vehicleOwner; + + @ExcelProperty("车牌号") + private String carPlate; + + @ExcelProperty("车辆类型") + private String vehicleTypeName; + + @ExcelProperty("所属企业") + private String companyName; + + @ExcelProperty("可同行区域") + private String accessibleArea; + + @ExcelProperty("有效期") + private String expirationDate; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/PassportPageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/PassportPageParamDTO.java new file mode 100644 index 0000000..09b1663 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/PassportPageParamDTO.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 驾驶员合格证 + *

+ * + * @author PoffyZhang + * @since 2022-11-03 + */ +@Data +@Builder +@ApiModel(value = "PassportPageParamDTO", description = "通行证分页传参") +public class PassportPageParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("开始时间") + private String startTime; + + @ApiModelProperty("结束时间") + private String endTime; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("企业名") + private String companyName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/PassportSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/PassportSaveDTO.java new file mode 100644 index 0000000..c2a56eb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/PassportSaveDTO.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.industry.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 通行证信息 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +@Data +@ApiModel(value = "PassportSaveDTO", description = "通行证信息save") +public class PassportSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆所有人") + private String vehicleOwner; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("可通行区域") + private String accessibleArea; + + @ApiModelProperty("有效期") + private LocalDateTime expirationDate; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/PassportUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/PassportUpdateDTO.java new file mode 100644 index 0000000..d78747e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/PassportUpdateDTO.java @@ -0,0 +1,61 @@ +package com.ningdatech.carapi.industry.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 通行证信息 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +@Data +@ApiModel(value = "PassportUpdateDTO", description = "通行证信息update") +public class PassportUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @NotNull(message = "id不能为空") + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆所有人") + private String vehicleOwner; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("可通行区域") + private String accessibleArea; + + @ApiModelProperty("有效期") + private LocalDateTime expirationDate; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/ReadyMixedMortarIndustryManageSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/ReadyMixedMortarIndustryManageSaveDTO.java new file mode 100644 index 0000000..60151f9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/ReadyMixedMortarIndustryManageSaveDTO.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.industry.model.dto; + +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; + +/** + *

+ * 预拌砂浆行业管理 + *

+ * + * @author PoffyZhang + * @since 2022-11-18 + */ +@Data +@ApiModel(value = "ReadyMixedMortarIndustryManageSaveDTO", description = "预拌砂浆行业管理") +public class ReadyMixedMortarIndustryManageSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("0启用 1禁用") + private Integer state; + + @ApiModelProperty("file id") + private Long fileId; + + @ApiModelProperty("文件名") + private String fileName; + + @ApiModelProperty("下载次数") + private Integer downTimes; + + @ApiModelProperty("内容") + private String content; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/ReadyMixedMortarIndustryManageUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/ReadyMixedMortarIndustryManageUpdateDTO.java new file mode 100644 index 0000000..a6b5dd5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/ReadyMixedMortarIndustryManageUpdateDTO.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 预拌砂浆行业管理 + *

+ * + * @author PoffyZhang + * @since 2022-11-18 + */ +@Data +@ApiModel(value = "ReadyMixedMortarIndustryManageSaveDTO", description = "预拌砂浆行业管理") +public class ReadyMixedMortarIndustryManageUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @NotNull(message = "请传id") + private Long id; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("0启用 1禁用") + private Integer state; + + @ApiModelProperty("file id") + private Long fileId; + + @ApiModelProperty("文件名") + private String fileName; + + @ApiModelProperty("下载次数") + private Integer downTimes; + + @ApiModelProperty("内容") + private String content; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/ReadyMixedPageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/ReadyMixedPageParamDTO.java new file mode 100644 index 0000000..626a329 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/ReadyMixedPageParamDTO.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 预拌砂浆行业管理分页传参 + *

+ * + * @author PoffyZhang + * @since 2022-11-17 + */ +@Data +@Builder +@ApiModel(value = "ReadyMixedPageParamDTO", description = "预拌砂浆行业管理分页传参") +public class ReadyMixedPageParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("区域ID") + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/RegistrationRecordPageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/RegistrationRecordPageParamDTO.java new file mode 100644 index 0000000..64936bf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/RegistrationRecordPageParamDTO.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.industry.model.dto; + +import java.io.Serializable; +import java.util.List; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +/** + *

+ * 新车上牌 + *

+ * + * @author PoffyZhang + * @since 2022-11-03 + */ +@Data +@Builder +@ApiModel(value = "RegistrationRecordPageParamDTO", description = "新车上牌") +public class RegistrationRecordPageParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("上牌记录") + private String registrationRecord; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车牌号列表") + private List carPlateList; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/RegistrationRecordSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/RegistrationRecordSaveDTO.java new file mode 100644 index 0000000..8efc7f0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/RegistrationRecordSaveDTO.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 新车上牌记录 + *

+ * + * @author PoffyZhang + * @since 2022-11-06 + */ +@Data +@ApiModel(value = "RegistrationRecordSaveDTO", description = "新车上牌记录") +public class RegistrationRecordSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车架号") + private String vin; + + @ApiModelProperty("引擎号") + private String engineNo; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("已上牌 未上牌") + private String registrationRecord; + + @ApiModelProperty("车辆品牌") + private String vehicleBrand; + + @ApiModelProperty("车辆型号") + private String vehicleModels; + + @ApiModelProperty("购买价格") + private BigDecimal purchasePrice; + + @ApiModelProperty("购买日期") + private LocalDateTime purchaseDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/RegistrationRecordUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/RegistrationRecordUpdateDTO.java new file mode 100644 index 0000000..3555570 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/RegistrationRecordUpdateDTO.java @@ -0,0 +1,71 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 新车上牌记录 + *

+ * + * @author PoffyZhang + * @since 2022-11-06 + */ +@Data +@ApiModel(value = "RegistrationRecordUpdateDTO", description = "新车上牌记录") +public class RegistrationRecordUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车架号") + private String vin; + + @ApiModelProperty("引擎号") + private String engineNo; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("已上牌 未上牌") + private String registrationRecord; + + @ApiModelProperty("车辆品牌") + private String vehicleBrand; + + @ApiModelProperty("车辆型号") + private String vehicleModels; + + @ApiModelProperty("购买价格") + private BigDecimal purchasePrice; + + @ApiModelProperty("购买日期") + private LocalDateTime purchaseDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/ReviewPageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/ReviewPageParamDTO.java new file mode 100644 index 0000000..69272c2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/ReviewPageParamDTO.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.industry.model.dto; + +import java.io.Serializable; +import java.util.List; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +/** + *

+ * 年检年审分页传参 + *

+ * + * @author PoffyZhang + * @since 2022-11-03 + */ +@Data +@Builder +@ApiModel(value = "ReviewPageParamDTO", description = "年检年审分页传参") +public class ReviewPageParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车牌号列表") + private List carPlateList; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("年检记录") + private String inspectionRecords; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/SafetyEqInsUseCertExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/SafetyEqInsUseCertExportDTO.java new file mode 100644 index 0000000..26c5b35 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/SafetyEqInsUseCertExportDTO.java @@ -0,0 +1,41 @@ +package com.ningdatech.carapi.industry.model.dto; + +import java.io.Serializable; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 安全设备安装使用证书导出实体 + * + * @author CMM + * @since 2023/02/20 15:42 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class SafetyEqInsUseCertExportDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ExcelProperty("所属区域") + private String regionName; + + @ExcelProperty("所属企业") + private String companyName; + + @ExcelProperty("车牌号") + private String carPlate; + + @ExcelProperty("车辆类型") + private String vehicleTypeName; + + @ExcelProperty("终端运营商") + private String endOperator; + + @ExcelProperty("年检记录") + private String annualInspectionRecords; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertOperatePageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertOperatePageParamDTO.java new file mode 100644 index 0000000..3919b11 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertOperatePageParamDTO.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author CMM + * @description + * @since 2022/11/26 17:10 + */ +@Data +@Builder +@ApiModel(value = "UseCertOperatePageParamDTO", description = "使用证书操作分页传参") +public class UseCertOperatePageParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 134356701632333300L; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("证书年检状态") + private String annualStatus; + + @ApiModelProperty("申请事项") + private String applicationItem; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertOperateUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertOperateUpdateDTO.java new file mode 100644 index 0000000..b8d573f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertOperateUpdateDTO.java @@ -0,0 +1,87 @@ +package com.ningdatech.carapi.industry.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @author CMM + * @description + * @since 2022/11/27 11:46 + */ +@Data +@ApiModel("安全设备安装使用证书操作信息") +public class UseCertOperateUpdateDTO implements Serializable { + private static final long serialVersionUID = -7585902492215261079L; + + @ApiModelProperty("id") + @NotNull(message = "id必传!") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("终端运营商") + private String endOperator; + + @ApiModelProperty("年检记录") + private String annualInspectionRecords; + + @ApiModelProperty("安装凭证") + private String installCertificate; + + @ApiModelProperty("发证日期") + private LocalDateTime issueDate; + + @ApiModelProperty("申请状态") + private String applicationStatus; + + @ApiModelProperty("申请事项") + private String applicationItem; + + @ApiModelProperty("年检状态") + private String yearCheckStatus; + + @ApiModelProperty("补换状态") + private String replacementStatus; + + @ApiModelProperty("视频运营商") + private String videoOperator; + + @ApiModelProperty("证书编号") + private Long certificateNumber; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertPageParamDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertPageParamDTO.java new file mode 100644 index 0000000..2c8cc29 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertPageParamDTO.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.industry.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 使用证书 + *

+ * + * @author PoffyZhang + * @since 2022-11-03 + */ +@Data +@Builder +@ApiModel(value = "UseCertPageParamDTO", description = "使用证书分页传参") +public class UseCertPageParamDTO extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("开始时间") + private String startTime; + + @ApiModelProperty("结束时间") + private String endTime; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("年检记录") + private String annualInspectionRecords; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertSaveDTO.java new file mode 100644 index 0000000..17e9409 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertSaveDTO.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.industry.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 安全设备安装使用证书信息 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "SafetyEquipmentInstallUseCertificateVO", description = "安全设备安装使用证书信息") +public class UseCertSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("终端运营商") + private String endOperator; + + @ApiModelProperty("年检记录") + private String annualInspectionRecords; + + @ApiModelProperty("安装凭证") + private String installCertificate; + + @ApiModelProperty("发证日期") + private LocalDateTime issueDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertUpdateDTO.java new file mode 100644 index 0000000..5a9d66a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/UseCertUpdateDTO.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.industry.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 安全设备安装使用证书信息 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "SafetyEquipmentInstallUseCertificateVO", description = "安全设备安装使用证书信息") +public class UseCertUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @NotNull(message = "id必传!") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("终端运营商") + private String endOperator; + + @ApiModelProperty("年检记录") + private String annualInspectionRecords; + + @ApiModelProperty("安装凭证") + private String installCertificate; + + @ApiModelProperty("发证日期") + private LocalDateTime issueDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/VehicleAnnualInspectionExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/VehicleAnnualInspectionExportDTO.java new file mode 100644 index 0000000..c8cd0d3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/dto/VehicleAnnualInspectionExportDTO.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.industry.model.dto; + +import java.io.Serializable; + +import com.alibaba.excel.annotation.ExcelProperty; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 车辆年检年审记录导出实体类 + * + * @author CMM + * @since 2023/02/20 14:54 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class VehicleAnnualInspectionExportDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ExcelProperty("所属区域") + private String regionName; + + @ExcelProperty("所属企业") + private String companyName; + + @ExcelProperty("车牌号") + private String carPlate; + + @ExcelProperty("车辆类型") + private String vehicleTypeName; + + @ExcelProperty("年检记录") + private String inspectionRecords; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/po/CeriticatePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/po/CeriticatePO.java new file mode 100644 index 0000000..d8e97c2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/po/CeriticatePO.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.industry.model.po; + +import lombok.Data; + +/** + * @author PoffyZhang + * @Classname TainCeriticatePO + * @Description + * @Date 2022/12/15 19:11 + */ +@Data +public class CeriticatePO { + + private Long regionId; + private String regionName; + private Integer count; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabAcceptanceCertificateListReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabAcceptanceCertificateListReq.java new file mode 100644 index 0000000..f56278c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabAcceptanceCertificateListReq.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.industry.model.req; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDate; + +/** + *

+ * LabAcceptanceCertificateListReq + *

+ * + * @author WendyYang + * @since 14:50 2022/11/4 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class LabAcceptanceCertificateListReq extends PagePo { + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("发证日期") + private LocalDate startDate; + + @ApiModelProperty("发证日期") + private LocalDate endDate; + + @ApiModelProperty("审核状态:0 待审核、1 已审核") + private Integer auditStatus; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabAcceptanceCertificateReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabAcceptanceCertificateReq.java new file mode 100644 index 0000000..ea07755 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabAcceptanceCertificateReq.java @@ -0,0 +1,91 @@ +package com.ningdatech.carapi.industry.model.req; + +import java.time.LocalDate; +import java.util.List; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +import org.hibernate.validator.constraints.Length; + +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * LabWorkerCertificateListVo + *

+ * + * @author WendyYang + * @since 15:06 2022/11/4 + */ +@Data +public class LabAcceptanceCertificateReq { + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("企业") + @NotNull(message = "企业ID不能为空") + private Long companyId; + + @ApiModelProperty("区域信息") + private List regions; + + @ApiModelProperty("区域ID") + @NotNull(message = "区域ID不能为空") + private Long regionId; + + @ApiModelProperty("备案项目") + @NotBlank(message = "备案项目不能为空") + private String recordItem; + + @ApiModelProperty("发证时间") + @DateTimeFormat("yyyy-MM-dd") + private LocalDate conferDate; + + @ApiModelProperty("换证时间") + @DateTimeFormat("yyyy-MM-dd") + private LocalDate replaceDate; + + @ApiModelProperty("证书编号") + @NotBlank(message = "证书编号不能为空") + private String certificateNo; + + @ApiModelProperty("发证机关") + @NotNull(message = "发证机关不能为空") + private String conferOrg; + + @ApiModelProperty("企业名称") + @NotBlank(message = "企业名称不能为空") + private String companyName; + + @ApiModelProperty("备注") + @Length(max = 500, message = "备注最多500个字符") + private String remark; + + @ApiModelProperty("执行标准") + @NotNull(message = "执行标准不能为空") + private String standard; + + @ApiModelProperty("申请事项") + private String applicationItem; + + @ApiModelProperty("申请原因") + private String applicationReason; + + @ApiModelProperty("检测项目") + @NotNull(message = "检测项目不能为空") + private String testItem; + + @ApiModelProperty("有效期限") + @NotNull(message = "有效期限不能为空") + @DateTimeFormat("yyyy-MM-dd") + private LocalDate validDate; + + @ApiModelProperty("新增类型") + private Integer addType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabWorkerCertificateAuditReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabWorkerCertificateAuditReq.java new file mode 100644 index 0000000..1e19be3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabWorkerCertificateAuditReq.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.industry.model.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @author CMM + * @description + * @since 2022/11/29 15:27 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("换证申请审核") +public class LabWorkerCertificateAuditReq implements Serializable { + private static final long serialVersionUID = -3678789250665879763L; + @ApiModelProperty(value = "ID",required = true) + @NotNull(message = "ID不能为空!") + private Integer id; + + @ApiModelProperty("审核状态 0 待审核 1 审核通过") + @NotNull(message = "审核状态不能为空!") + private Integer auditStatus; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabWorkerCertificateListReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabWorkerCertificateListReq.java new file mode 100644 index 0000000..5b030ca --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabWorkerCertificateListReq.java @@ -0,0 +1,66 @@ +package com.ningdatech.carapi.industry.model.req; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +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.LocalDate; + +/** + *

+ * LabWorkerCertificateListReq + *

+ * + * @author WendyYang + * @since 14:50 2022/11/4 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class LabWorkerCertificateListReq extends PagePo { + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("发证日期") + private LocalDate startDate; + + @ApiModelProperty("发证日期") + private LocalDate endDate; + + @ApiModelProperty("审核状态:0 待审核、1 已审核") + private Integer auditStatus; + + @ApiModelProperty("证书类型:1 从业资格证、2 继续教育合格证") + @NotNull(message = "证书类型不能为空") + private Integer certificateType; + + public QueryWrapper listQuery() { + QueryWrapper query = Wrappers.query(); + if (StrUtil.isNotBlank(this.companyName)) { + query.like("company_name", this.companyName); + } + if (this.startDate != null) { + query.ge("confer_date", this.startDate); + } + if (this.endDate != null) { + query.le("confer_date", this.endDate); + } + query.orderByDesc("update_on"); + return query; + } + + public QueryWrapper changeListQuery() { + QueryWrapper query = listQuery(); + query.eq(this.auditStatus != null, "audit_status", this.auditStatus); + return query; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabWorkerCertificateReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabWorkerCertificateReq.java new file mode 100644 index 0000000..808c473 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/LabWorkerCertificateReq.java @@ -0,0 +1,92 @@ +package com.ningdatech.carapi.industry.model.req; + +import java.time.LocalDate; +import java.util.List; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +import org.hibernate.validator.constraints.Length; + +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * LabWorkerCertificateListVo + *

+ * + * @author WendyYang + * @since 15:06 2022/11/4 + */ +@Data +public class LabWorkerCertificateReq { + + @ApiModelProperty("ID") + private Integer id; + + @ApiModelProperty("企业") + @NotNull(message = "企业ID不能为空") + private Long companyId; + + @ApiModelProperty("区域信息") + private List regions; + + @ApiModelProperty("区域ID") + @NotNull(message = "区域ID不能为空") + private Long regionId; + + @ApiModelProperty("姓名") + @NotBlank(message = "姓名不能为空") + private String userName; + + @ApiModelProperty("身份证号") + @NotBlank(message = "身份证号不能为空") + private String idCard; + + @ApiModelProperty("有效期") + @NotNull(message = "有效期不能为空") + private LocalDate validDate; + + @ApiModelProperty("发证时间") + private LocalDate conferDate; + + @ApiModelProperty("发证机关") + @NotBlank(message = "发证机关不能为空") + private String conferOrg; + + @ApiModelProperty("换证时间") + private LocalDate replaceDate; + + @ApiModelProperty("证书编号") + @NotBlank(message = "证书编号不能为空") + private String certificateNo; + + @ApiModelProperty("性别:0 女、1 男、2 未知、3 其他") + @NotNull(message = "性别不能为空") + private Integer gender; + + @ApiModelProperty("企业名称") + @NotBlank(message = "企业名称不能为空") + private String companyName; + + @ApiModelProperty("备注") + @Length(max = 500, message = "备注最多500个字符") + private String remark; + + @ApiModelProperty("证书类型") + @NotNull(message = "证书类型不能为空") + private Integer certificateType; + + @ApiModelProperty("申请事项") + private String applicationItem; + + @ApiModelProperty("申请原因") + private String applicationReason; + + @ApiModelProperty("新增类型") + @NotNull(message = "新增类型不能为空!") + private Integer addType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseListReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseListReq.java new file mode 100644 index 0000000..8797220 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseListReq.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.industry.model.req; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDate; + +/** + *

+ * PurchaseRawMaterialListReq + *

+ * + * @author WendyYang + * @since 10:56 2022/11/9 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class PurchaseListReq extends PagePo { + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("采购企业") + private String purchaseOrg; + + @ApiModelProperty("采购开始日期") + private LocalDate startDate; + + @ApiModelProperty("采购结束日期") + private LocalDate endDate; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseOilListReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseOilListReq.java new file mode 100644 index 0000000..ccc7bcf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseOilListReq.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.industry.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * PurchaseRawMaterialListReq + *

+ * + * @author WendyYang + * @since 10:56 2022/11/9 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class PurchaseOilListReq extends PurchaseListReq { + + @ApiModelProperty("油品名称") + private String oilName; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseRawMaterialListReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseRawMaterialListReq.java new file mode 100644 index 0000000..b75c1bd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseRawMaterialListReq.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.industry.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * PurchaseRawMaterialListReq + *

+ * + * @author WendyYang + * @since 10:56 2022/11/9 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class PurchaseRawMaterialListReq extends PurchaseListReq { + + @ApiModelProperty("原材料名称") + private String rawMaterialName; + + @ApiModelProperty("原材料型号") + private String model; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseVehicleListReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseVehicleListReq.java new file mode 100644 index 0000000..6f3c558 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseVehicleListReq.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.industry.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * PurchaseVehicleListReq + *

+ * + * @author WendyYang + * @since 10:56 2022/11/9 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class PurchaseVehicleListReq extends PurchaseListReq { + + @ApiModelProperty("车辆类型") + private String vehicleType; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseWheelListReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseWheelListReq.java new file mode 100644 index 0000000..420df99 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/req/PurchaseWheelListReq.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.industry.model.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * PurchaseWheelListReq + *

+ * + * @author WendyYang + * @since 10:56 2022/11/9 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class PurchaseWheelListReq extends PurchaseListReq { + + @ApiModelProperty("轮胎类型") + private String wheelType; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DataQualityMonitorDynamicsVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DataQualityMonitorDynamicsVO.java new file mode 100644 index 0000000..88ab180 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DataQualityMonitorDynamicsVO.java @@ -0,0 +1,54 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 动态数据监控 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Data +@ApiModel(value = "DataQualityMonitorDynamics对象", description = "动态数据监控") +public class DataQualityMonitorDynamicsVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("0正常 1异常") + private Integer state; + + @ApiModelProperty("驾驶员ID") + private Long driverId; + + @ApiModelProperty("驾驶员名字") + private String driverName; + + @ApiModelProperty("数据时间") + private LocalDateTime dataTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DataQualityMonitorGpsVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DataQualityMonitorGpsVO.java new file mode 100644 index 0000000..09d76b8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DataQualityMonitorGpsVO.java @@ -0,0 +1,101 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * GPS数据质量监控 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Data +@ApiModel(value = "DataQualityMonitorGps对象", description = "GPS数据质量监控") +public class DataQualityMonitorGpsVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆颜色") + private String plateColor; + + @ApiModelProperty("运营商ID") + private Long operatorId; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("经度") + private String longitude; + + @ApiModelProperty("纬度") + private String latitude; + + @ApiModelProperty("速度") + private String velocity; + + @ApiModelProperty("方向") + private String direction; + + @ApiModelProperty("0离线 1在线") + private Integer state; + + @ApiModelProperty("告警级别") + private Integer alarm; + + @ApiModelProperty("告警级别名称") + private String alarmName; + + @ApiModelProperty("异常原因") + private Integer abnormalCauses; + + @ApiModelProperty("异常原因名称") + private String abnormalCausesName; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("数据采集时间") + private LocalDateTime dataTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DataQualityMonitorStaticVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DataQualityMonitorStaticVO.java new file mode 100644 index 0000000..388c9b8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DataQualityMonitorStaticVO.java @@ -0,0 +1,54 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 静态数据质量监控 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Data +@ApiModel(value = "DataQualityMonitorStatic对象", description = "静态数据质量监控") +public class DataQualityMonitorStaticVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("数据类型") + private Integer dataType; + + @ApiModelProperty("数据类型名") + private String dataTypeName; + + @ApiModelProperty("数据异常状态 0正常 1不正常") + private Integer state; + + @ApiModelProperty("批次号") + private String batchNo; + + @ApiModelProperty("数据采集时间") + private LocalDateTime dataTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DriverTrainingCertificateOperVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DriverTrainingCertificateOperVO.java new file mode 100644 index 0000000..6844689 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DriverTrainingCertificateOperVO.java @@ -0,0 +1,84 @@ +package com.ningdatech.carapi.industry.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +/** + *

+ * 驾驶员合格证操作 + *

+ * + * @author PoffyZhang + * @since 2022-11-04 + */ +@Data +@Builder +@ApiModel(value = "DriverTrainingCertificateOper", description = "驾驶员合格证操作VO") +public class DriverTrainingCertificateOperVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("驾驶员名") + private String driverName; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("培训时间") + private LocalDateTime trainingTime; + + @ApiModelProperty("培训结果 合格") + private String trainingResult; + + @ApiModelProperty("有效时间") + private LocalDateTime effectiveTime; + + @ApiModelProperty("培训项目") + private String trainingProgram; + + @ApiModelProperty("合格证id") + private Long certificateId; + + @ApiModelProperty("操作类型 1.申请 2.补发") + private Integer operationTypeId; + + @ApiModelProperty("操作类型") + private String operationTypeName; + + @ApiModelProperty("审核状态 0待审核 1已审核") + private Integer auditState; + + @ApiModelProperty("已通过") + private String auditStateName; + + @ApiModelProperty("申请时间") + private LocalDateTime operationTime; + + @ApiModelProperty("申请事项") + private String application; + + @ApiModelProperty("申请原因") + private String applicationReason; + + protected LocalDateTime createOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DriverTrainingCertificateVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DriverTrainingCertificateVO.java new file mode 100644 index 0000000..c5576af --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/DriverTrainingCertificateVO.java @@ -0,0 +1,120 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 驾驶员合格证 + *

+ * + * @author PoffyZhang + * @since 2022-11-03 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "DriverTrainingCertificate", description = "驾驶员合格证VO") +public class DriverTrainingCertificateVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + @ExcelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + @ExcelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + @ExcelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("驾驶员ID") + @ExcelProperty("驾驶员ID") + private Long driverId; + + @ApiModelProperty("驾驶员名") + @ExcelProperty("驾驶员名") + private String driverName; + + @ApiModelProperty("身份证号") + @ExcelProperty("身份证号") + private String idCard; + + @ApiModelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("发证单位") + private String issuedBy; + + @ApiModelProperty("发证日期") + private LocalDateTime issueDate; + + @ApiModelProperty("驾驶员证号") + private String driverLicenseNo; + + @ApiModelProperty("有效期至") + private LocalDateTime expiryDate; + + @ApiModelProperty("企业ID") + @ExcelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + @ExcelProperty("企业名") + private String companyName; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("培训时间") + @ExcelProperty("培训时间") + private LocalDateTime trainingTime; + + @ApiModelProperty("培训结果 合格") + @ExcelProperty("培训结果 合格") + private String trainingResult; + + @ApiModelProperty("有效时间") + @ExcelProperty("有效时间") + private LocalDateTime effectiveTime; + + @ApiModelProperty("培训项目") + @ExcelProperty("培训项目") + private String trainingProgram; + + @ApiModelProperty("类型") + @ExcelProperty("类型") + private Integer certificateType; + + @ApiModelProperty("类型") + @ExcelProperty("类型") + private String certificateTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/LabAcceptanceCertificateChangeListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/LabAcceptanceCertificateChangeListVo.java new file mode 100644 index 0000000..22b8695 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/LabAcceptanceCertificateChangeListVo.java @@ -0,0 +1,89 @@ +package com.ningdatech.carapi.industry.model.vo; + +import java.time.LocalDate; +import java.util.List; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +import org.hibernate.validator.constraints.Length; + +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * LabWorkerCertificateListVo + *

+ * + * @author WendyYang + * @since 15:06 2022/11/4 + */ +@Data +public class LabAcceptanceCertificateChangeListVo { + + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("企业") + @NotNull(message = "企业ID不能为空") + private Long companyId; + + @ApiModelProperty("区域信息") + private List regions; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("备案项目") + @NotBlank(message = "备案项目不能为空") + private String recordItem; + + @ApiModelProperty("有效期") + @DateTimeFormat("yyyy-MM-dd") + @NotNull(message = "有效期不能为空") + private LocalDate validDate; + + @ApiModelProperty("发证时间") + @DateTimeFormat("yyyy-MM-dd") + @NotNull(message = "发证时间不能为空") + private LocalDate conferDate; + + @ApiModelProperty("证书编号") + @NotBlank(message = "证书编号不能为空") + private String certificateNo; + + @ApiModelProperty("发证机关") + @NotNull(message = "发证机关不能为空") + private String conferOrg; + + @ApiModelProperty("企业名称") + @NotBlank(message = "企业名称不能为空") + private String companyName; + + @ApiModelProperty("备注") + @Length(max = 500, message = "备注最多500个字符") + private String remark; + + @ApiModelProperty("执行标准") + private String standard; + + @ApiModelProperty("申请原因") + private String applicationReason; + + @ApiModelProperty("申请事项") + private String applicationItem; + + @ApiModelProperty("检测项目") + private String testItem; + + @ApiModelProperty("换证时间") + private LocalDate replaceDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/LabAcceptanceCertificateListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/LabAcceptanceCertificateListVo.java new file mode 100644 index 0000000..ed7a277 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/LabAcceptanceCertificateListVo.java @@ -0,0 +1,72 @@ +package com.ningdatech.carapi.industry.model.vo; + +import java.time.LocalDate; +import java.util.List; + +import javax.validation.constraints.NotNull; + +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * LabWorkerCertificateListVo + *

+ * + * @author WendyYang + * @since 15:06 2022/11/4 + */ +@Data +public class LabAcceptanceCertificateListVo { + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("企业") + @NotNull(message = "企业ID不能为空") + private Long companyId; + + @ApiModelProperty("区域信息") + private List regions; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("备案项目") + private String recordItem; + + @ApiModelProperty("检测项目") + private String testItem; + + @ApiModelProperty("有效期") + @DateTimeFormat("yyyy-MM-dd") + private LocalDate validDate; + + @ApiModelProperty("发证时间") + @DateTimeFormat("yyyy-MM-dd") + private LocalDate conferDate; + + @ApiModelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("发证机关") + private String conferOrg; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("换证时间") + private LocalDate replacementTime; + + @ApiModelProperty("执行标准") + private String standard; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/LabWorkerCertificateChangeListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/LabWorkerCertificateChangeListVo.java new file mode 100644 index 0000000..e0bbcda --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/LabWorkerCertificateChangeListVo.java @@ -0,0 +1,93 @@ +package com.ningdatech.carapi.industry.model.vo; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +import org.hibernate.validator.constraints.Length; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * LabWorkerCertificateListVo + *

+ * + * @author WendyYang + * @since 15:06 2022/11/4 + */ +@Data +public class LabWorkerCertificateChangeListVo { + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("企业") + private Long companyId; + + @ApiModelProperty("区域信息") + private List regions; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("姓名") + private String userName; + + @ApiModelProperty("身份证号") + private String idCard; + + @ApiModelProperty("有效期") + private LocalDate validDate; + + @ApiModelProperty("发证时间") + private LocalDate conferDate; + + @ApiModelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("性别:0 女、1 男、2 未知、3 其他") + private Integer gender; + + @ApiModelProperty("性别:0 女、1 男、2 未知、3 其他") + private String genderName; + + @ApiModelProperty("企业名称") + @NotBlank(message = "企业名称不能为空") + private String companyName; + + @ApiModelProperty("备注") + @Length(max = 500, message = "备注最多500个字符") + private String remark; + + @ApiModelProperty("证书类型") + @NotNull(message = "证书类型不能为空") + private Integer certificateType; + + @ApiModelProperty("审核状态:0 待审核、1 已审核") + private Integer auditStatus; + + @ApiModelProperty("申请时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime applicationTime; + + @ApiModelProperty("换证时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate replaceDate; + + @ApiModelProperty("申请原因") + private String applicationReason; + + @ApiModelProperty("申请事项") + private String applicationItem; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/LabWorkerCertificateListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/LabWorkerCertificateListVo.java new file mode 100644 index 0000000..b18e46b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/LabWorkerCertificateListVo.java @@ -0,0 +1,86 @@ +package com.ningdatech.carapi.industry.model.vo; + +import java.time.LocalDate; +import java.util.List; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +import org.hibernate.validator.constraints.Length; + +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * LabWorkerCertificateListVo + *

+ * + * @author WendyYang + * @since 15:06 2022/11/4 + */ +@Data +public class LabWorkerCertificateListVo { + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("企业") + @NotNull(message = "企业ID不能为空") + private Long companyId; + + @ApiModelProperty("区域信息") + private List regions; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("姓名") + @NotBlank(message = "姓名不能为空") + private String userName; + + @ApiModelProperty("身份证号") + @NotBlank(message = "身份证号不能为空") + private String idCard; + + @ApiModelProperty("有效期") + @NotNull(message = "有效期不能为空") + private LocalDate validDate; + + @ApiModelProperty("发证时间") + @NotNull(message = "发证时间不能为空") + private LocalDate conferDate; + + @ApiModelProperty("发证机关") + @NotNull(message = "发证机关不能为空") + private String conferOrg; + + @ApiModelProperty("证书编号") + @NotBlank(message = "证书编号不能为空") + private String certificateNo; + + @ApiModelProperty("性别:0 未知、1 男、2 女、3 其他") + @NotNull(message = "性别不能为空") + private Integer gender; + + @ApiModelProperty("性别:0 未知、1 男、2 女、3 其他") + @NotNull(message = "性别不能为空") + private String genderName; + + @ApiModelProperty("企业名称") + @NotBlank(message = "企业名称不能为空") + private String companyName; + + @ApiModelProperty("备注") + @Length(max = 500, message = "备注最多500个字符") + private String remark; + + @ApiModelProperty("证书类型") + @NotNull(message = "证书类型不能为空") + private Integer certificateType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/MortarEnterpriseFilingCertificateChangeVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/MortarEnterpriseFilingCertificateChangeVO.java new file mode 100644 index 0000000..d4c4a73 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/MortarEnterpriseFilingCertificateChangeVO.java @@ -0,0 +1,61 @@ +package com.ningdatech.carapi.industry.model.vo; + +import java.time.LocalDate; +import java.util.List; + +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * MortarEnterpriseFilingCertificateChangeVO + *

+ * + * @author WendyYang + * @since 21:34 2022/11/8 + */ +@Data +public class MortarEnterpriseFilingCertificateChangeVO { + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("企业") + private Long companyId; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("区域信息") + private List regions; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("备案项目") + private String recordItem; + + @ApiModelProperty("发证机关") + private String conferOrg; + + @ApiModelProperty("发证时间") + private LocalDate conferDate; + + @ApiModelProperty("申请事项") + private String applicationItem; + + @ApiModelProperty("申请原因") + private String applicationReason; + + @ApiModelProperty("换证时间") + private LocalDate replaceDate; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/MortarEnterpriseFilingCertificateVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/MortarEnterpriseFilingCertificateVO.java new file mode 100644 index 0000000..b3630aa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/MortarEnterpriseFilingCertificateVO.java @@ -0,0 +1,68 @@ +package com.ningdatech.carapi.industry.model.vo; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +import org.springframework.format.annotation.DateTimeFormat; + +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * MortarEnterpriseFilingCertificateVO + *

+ * + * @author WendyYang + * @since 21:34 2022/11/8 + */ +@Data +public class MortarEnterpriseFilingCertificateVO { + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("证书编号") + private String certificateNo; + + @ApiModelProperty("企业") + private Long companyId; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("区域信息") + private List regions; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("备案项目") + private String recordItem; + + @ApiModelProperty("换证时间") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDateTime replacementTime; + + @ApiModelProperty("发证机关") + private String conferOrg; + + @ApiModelProperty("发证时间") + private LocalDate conferDate; + + @ApiModelProperty("生产能力") + private String productionCapacity; + + @ApiModelProperty("有效时间") + private LocalDate validDate; + + @ApiModelProperty("执行标准") + private String standards; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/OperatorScoreDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/OperatorScoreDetailVO.java new file mode 100644 index 0000000..9547edd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/OperatorScoreDetailVO.java @@ -0,0 +1,89 @@ +package com.ningdatech.carapi.industry.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 运营商考核分数详情 + * + * @author CMM + * @since 2023/01/04 16:00 + */ +@Data +public class OperatorScoreDetailVO { + + @ApiModelProperty(value = "运营商考核总分") + private Integer totalScore; + + @ApiModelProperty(value = "上传资质指标分值") + private Integer uploadQualificationIndex; + + @ApiModelProperty(value = "上传资质实际分值") + private Integer uploadQualification; + + @ApiModelProperty(value = "上传资质指标名称") + private String uploadQualificationName; + + @ApiModelProperty(value = "上传频率、数量指标分值") + private Integer uploadFrequencyQuantityIndex; + + @ApiModelProperty(value = "上传频率、数量实际分值") + private Integer uploadFrequencyQuantity; + + @ApiModelProperty(value = "上传频率、数量指标名称") + private String uploadFrequencyQuantityName; + + @ApiModelProperty(value = "字段完整性指标分值") + private Integer fieldIntegrityIndex; + + @ApiModelProperty(value = "字段完整性实际分值") + private Integer fieldIntegrity; + + @ApiModelProperty(value = "字段完整性指标名称") + private String fieldIntegrityName; + + @ApiModelProperty(value = "时效性指标分值") + private Integer timeSensitiveIndex; + + @ApiModelProperty(value = "时效性实际分值") + private Integer timeSensitive; + + @ApiModelProperty(value = "时效性指标名称") + private String timeSensitiveName; + + @ApiModelProperty(value = "位置及方向的正确性、一致性指标分值") + private Integer positionDirectionCorrectnessConsistencyIndex; + + @ApiModelProperty(value = "位置及方向的正确性、一致性实际分值") + private Integer positionDirectionCorrectnessConsistency; + + @ApiModelProperty(value = "位置及方向的正确性、一致性指标名称") + private String positionDirectionCorrectnessConsistencyName; + + @ApiModelProperty(value = "速度的正确性、一致性指标分值") + private Integer speedCorrectnessConsistencyIndex; + + @ApiModelProperty(value = "速度的正确性、一致性实际分值") + private Integer speedCorrectnessConsistency; + + @ApiModelProperty(value = "速度的正确性、一致性指标名称") + private String speedCorrectnessConsistencyName; + + @ApiModelProperty(value = "时间一致性指标分值") + private Integer timeConsistencyIndex; + + @ApiModelProperty(value = "时间一致性实际分值") + private Integer timeConsistency; + + @ApiModelProperty(value = "时间一致性指标名称") + private String timeConsistencyName; + + @ApiModelProperty(value = "位置一致性指标分值") + private Integer positionConsistencyIndex; + + @ApiModelProperty(value = "位置一致性实际分值") + private Integer positionConsistency; + + @ApiModelProperty(value = "位置一致性指标名称") + private String positionConsistencyName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PassportVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PassportVO.java new file mode 100644 index 0000000..d889883 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PassportVO.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 通行证信息 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +@Data +@ApiModel(value = "PassportInfo对象", description = "通行证信息") +public class PassportVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("车辆所有人") + @ExcelProperty("车辆所有人") + private String vehicleOwner; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + @ExcelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + @ExcelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("企业ID") + @ExcelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名") + @ExcelProperty("企业名") + private String companyName; + + @ApiModelProperty("可通行区域") + @ExcelProperty("可同行区域") + private String accessibleArea; + + @ApiModelProperty("有效期") + @ExcelProperty("有效期") + private LocalDateTime expirationDate; + + @ApiModelProperty("备注") + @ExcelProperty("备注") + private String remark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PurchaseOilListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PurchaseOilListVo.java new file mode 100644 index 0000000..1214664 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PurchaseOilListVo.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +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.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; + +/** + *

+ * 油品采购信息列表视图 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Data +@ApiModel("油品采购信息列表视图") +public class PurchaseOilListVo { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("区域") + private List regions; + + @ApiModelProperty("区域ID") + @NotNull(message = "区域ID不能为空") + private Long regionId; + + @ApiModelProperty("油品名称") + @NotBlank(message = "油品名称不能为空") + private String oilName; + + @ApiModelProperty("质量等级") + @NotBlank(message = "质量等级不能为空") + private String qualityLevel; + + @ApiModelProperty("数量") + @NotNull(message = "数量不能为空") + private Integer number; + + @ApiModelProperty("单价") + @NotNull(message = "单价不能为空") + private BigDecimal unitPrice; + + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + @ApiModelProperty("采购日期") + @NotNull(message = "采购日期不能为空") + private LocalDate purchaseDate; + + @ApiModelProperty("采购单位") + @NotBlank(message = "采购单位不能为空") + private String purchaseOrg; + + @ApiModelProperty("采购单位ID") + @NotNull(message = "采购单位ID不能为空") + private Long purchaseOrgId; + + @ApiModelProperty("批准部门") + @NotBlank(message = "批准部门不能为空") + private String approvalDept; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PurchaseRawMaterialListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PurchaseRawMaterialListVo.java new file mode 100644 index 0000000..80ed8e4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PurchaseRawMaterialListVo.java @@ -0,0 +1,80 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +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.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; + +/** + *

+ * 原材料采购信息列表视图 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Data +@ApiModel("原材料采购信息列表视图") +public class PurchaseRawMaterialListVo { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("区域") + private List regions; + + @ApiModelProperty("区域ID") + @NotNull(message = "区域ID不能为空") + private Long regionId; + + @ApiModelProperty("原材料名称") + @NotBlank(message = "原材料名称不能为空") + private String rawMaterialName; + + @ApiModelProperty("规格型号") + @NotBlank(message = "规格型号不能为空") + private String model; + + @ApiModelProperty("数量") + @NotNull(message = "数量不能为空") + private Integer number; + + @ApiModelProperty("计量单位") + @NotBlank(message = "计量单位不能为空") + private String unit; + + @ApiModelProperty("单价") + @NotNull(message = "单价不能为空") + private BigDecimal unitPrice; + + @ApiModelProperty("总金额(保存/修改无需计算)") + private BigDecimal totalAmount; + + @ApiModelProperty("采购日期") + @NotNull(message = "采购日期不能为空") + private LocalDate purchaseDate; + + @ApiModelProperty("采购单位") + @NotBlank(message = "采购单位不能为空") + private String purchaseOrg; + + @ApiModelProperty("采购单位ID") + @NotNull(message = "采购单位ID不能为空") + private Long purchaseOrgId; + + @ApiModelProperty("批准部门") + @NotBlank(message = "批准部门不能为空") + private String approvalDept; + + @ApiModelProperty("备注") + private String remark; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PurchaseVehicleListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PurchaseVehicleListVo.java new file mode 100644 index 0000000..a3d9ea4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PurchaseVehicleListVo.java @@ -0,0 +1,71 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +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.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; + +/** + *

+ * 车辆采购信息列表视图 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Data +@ApiModel("车辆采购信息列表视图") +public class PurchaseVehicleListVo { + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("区域") + private List regions; + + @ApiModelProperty("区域ID") + @NotNull(message = "区域ID不能为空") + private Long regionId; + + @ApiModelProperty("车辆品牌") + @NotBlank(message = "车辆品牌不能为空") + private String vehicleBrand; + + @ApiModelProperty("车辆类型") + @NotBlank(message = "车辆类型不能为空") + private String vehicleType; + + @ApiModelProperty("数量") + @NotNull(message = "数量不能为空") + private Integer number; + + @ApiModelProperty("单价") + @NotNull(message = "单价不能为空") + private BigDecimal unitPrice; + + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + @ApiModelProperty("采购日期") + @NotNull(message = "采购日期不能为空") + private LocalDate purchaseDate; + + @ApiModelProperty("采购单位") + @NotBlank(message = "采购单位不能为空") + private String purchaseOrg; + + @ApiModelProperty("采购单位ID") + @NotNull(message = "采购单位ID不能为空") + private Long purchaseOrgId; + + @ApiModelProperty("批准部门") + @NotBlank(message = "批准部门不能为空") + private String approvalDept; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PurchaseWheelListVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PurchaseWheelListVo.java new file mode 100644 index 0000000..cbab194 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/PurchaseWheelListVo.java @@ -0,0 +1,71 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +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.math.BigDecimal; +import java.time.LocalDate; +import java.util.List; + +/** + *

+ * 轮胎采购信息列表视图 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Data +@ApiModel("轮胎采购信息列表视图") +public class PurchaseWheelListVo { + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("区域") + private List regions; + + @ApiModelProperty("区域ID") + @NotNull(message = "区域ID不能为空") + private Long regionId; + + @ApiModelProperty("轮胎品牌") + @NotBlank(message = "轮胎品牌不能为空") + private String wheelBrand; + + @ApiModelProperty("轮胎类型") + @NotBlank(message = "轮胎类型不能为空") + private String wheelType; + + @ApiModelProperty("数量") + @NotNull(message = "数量不能为空") + private Integer number; + + @ApiModelProperty("单价") + @NotNull(message = "单价不能为空") + private BigDecimal unitPrice; + + @ApiModelProperty("总金额") + private BigDecimal totalAmount; + + @ApiModelProperty("采购日期") + @NotNull(message = "采购日期不能为空") + private LocalDate purchaseDate; + + @ApiModelProperty("采购单位") + @NotBlank(message = "采购单位不能为空") + private String purchaseOrg; + + @ApiModelProperty("采购单位ID") + @NotNull(message = "采购单位ID不能为空") + private Long purchaseOrgId; + + @ApiModelProperty("批准部门") + @NotBlank(message = "批准部门不能为空") + private String approvalDept; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/ReadyMixedMortarIndustryManageVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/ReadyMixedMortarIndustryManageVO.java new file mode 100644 index 0000000..c84f328 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/ReadyMixedMortarIndustryManageVO.java @@ -0,0 +1,84 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 预拌砂浆行业管理 + *

+ * + * @author PoffyZhang + * @since 2022-11-18 + */ +@Data +@ApiModel(value = "ReadyMixedMortarIndustryManageVO", description = "预拌砂浆行业管理") +public class ReadyMixedMortarIndustryManageVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + @ExcelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + @ExcelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("修改人") + @ExcelProperty("修改人") + private Long updateBy; + + @ApiModelProperty("标题") + @ExcelProperty("标题") + private String title; + + @ApiModelProperty("0启用 1禁用") + @ExcelProperty("0启用 1禁用") + private Integer state; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司id") + @ExcelProperty("公司id") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("file id") + @ExcelProperty("file id") + private Long fileId; + + @ApiModelProperty("文件名") + @ExcelProperty("文件名") + private String fileName; + + @ApiModelProperty("下载次数") + @ExcelProperty("下载次数") + private Integer downTimes = 0; + + @ApiModelProperty("内容") + @ExcelProperty("内容") + private String content; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/RegistrationRecordVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/RegistrationRecordVO.java new file mode 100644 index 0000000..e2b4503 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/RegistrationRecordVO.java @@ -0,0 +1,72 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 新车上牌记录 + *

+ * + * @author PoffyZhang + * @since 2022-11-06 + */ +@ApiModel(value = "RegistrationRecordVO", description = "新车上牌记录") +@Data +public class RegistrationRecordVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车架号") + private String vin; + + @ApiModelProperty("引擎号") + private String engineNo; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("已上牌 未上牌") + private String registrationRecord; + + @ApiModelProperty("车辆品牌") + private String vehicleBrand; + + @ApiModelProperty("车辆型号") + private String vehicleModels; + + @ApiModelProperty("购买价格") + private BigDecimal purchasePrice; + + @ApiModelProperty("购买日期") + private LocalDateTime purchaseDate; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/SafetyEquipmentInstallUseCertificateOperationVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/SafetyEquipmentInstallUseCertificateOperationVO.java new file mode 100644 index 0000000..fd01d35 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/SafetyEquipmentInstallUseCertificateOperationVO.java @@ -0,0 +1,87 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @author CMM + * @description + * @since 2022/11/26 17:20 + */ +@Data +@ApiModel(value = "SafetyEquipmentInstallUseCertificateOperationVO", description = "安全设备安装使用证书操作信息") +public class SafetyEquipmentInstallUseCertificateOperationVO implements Serializable { + + private static final long serialVersionUID = -8673410031588377038L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + @ExcelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + @ExcelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + @ExcelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + @ExcelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + @ExcelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("终端运营商") + @ExcelProperty("终端运营商") + private String endOperator; + + @ApiModelProperty("年检记录") + @ExcelProperty("年检记录") + private String annualInspectionRecords; + + @ApiModelProperty("安装凭证") + @ExcelProperty("安装凭证") + private String installCertificate; + + @ApiModelProperty("发证日期") + @ExcelProperty("发证日期") + private LocalDateTime issueDate; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/SafetyEquipmentInstallUseCertificateVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/SafetyEquipmentInstallUseCertificateVO.java new file mode 100644 index 0000000..c472f84 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/SafetyEquipmentInstallUseCertificateVO.java @@ -0,0 +1,88 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 安全设备安装使用证书信息 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Data +@ApiModel(value = "SafetyEquipmentInstallUseCertificateVO", description = "安全设备安装使用证书信息") +public class SafetyEquipmentInstallUseCertificateVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + @ExcelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + @ExcelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + @ExcelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆类型") + @ExcelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + @ExcelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("终端运营商") + @ExcelProperty("终端运营商") + private String endOperator; + + @ApiModelProperty("年检记录") + @ExcelProperty("年检记录") + private String annualInspectionRecords; + + @ApiModelProperty("安装凭证") + @ExcelProperty("安装凭证") + private String installCertificate; + + @ApiModelProperty("发证日期") + @ExcelProperty("发证日期") + private LocalDateTime issueDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/VehicleAnnualInspectionReviewApplicationVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/VehicleAnnualInspectionReviewApplicationVO.java new file mode 100644 index 0000000..af09e22 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/VehicleAnnualInspectionReviewApplicationVO.java @@ -0,0 +1,69 @@ +package com.ningdatech.carapi.industry.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 车辆年检年审 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +@Data +@ApiModel(value = "VehicleAnnualInspectionReviewApplicationVO", description = "车辆年检年审申请") +public class VehicleAnnualInspectionReviewApplicationVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("年检记录") + private String inspectionRecords; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型") + private String vehicleTypeName; + + @ApiModelProperty("状态") + private String status; + + @ApiModelProperty("操作") + private String operation; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/VehicleAnnualInspectionReviewVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/VehicleAnnualInspectionReviewVO.java new file mode 100644 index 0000000..1d39682 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/model/vo/VehicleAnnualInspectionReviewVO.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.industry.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 车辆年检年审 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +@Data +@ApiModel(value = "VehicleAnnualInspectionReview对象", description = "车辆年检年审") +public class VehicleAnnualInspectionReviewVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + @ApiModelProperty("创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + @ExcelProperty("创建人") + private Long createBy; + + @ApiModelProperty("最后修改时间") + @ExcelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + @ExcelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + @ApiModelProperty("公司ID") + @ExcelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + @ExcelProperty("公司名") + private String companyName; + + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("年检记录") + @ExcelProperty("年检记录") + private String inspectionRecords; + + @ApiModelProperty("车辆类型") + @ExcelProperty("年车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + @ExcelProperty("车辆类型名") + private String vehicleTypeName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/DataScreenService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/DataScreenService.java new file mode 100644 index 0000000..94840a5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/DataScreenService.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.industry.model.po.CeriticatePO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface DataScreenService { + + List tainCertificate(DataScreenParam param); + + List laboratoryQualificationCertificate(DataScreenParam param); + + List laboratoryAcceptanceCertificate(DataScreenParam param); + + List recordCertificateMortarEnterprise(DataScreenParam param); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDataQualityMonitorDynamicsService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDataQualityMonitorDynamicsService.java new file mode 100644 index 0000000..19c7b65 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDataQualityMonitorDynamicsService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.DataQualityMonitorDynamics; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 异常GPS数据监控 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +public interface IDataQualityMonitorDynamicsService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDataQualityMonitorGpsService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDataQualityMonitorGpsService.java new file mode 100644 index 0000000..0585ed7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDataQualityMonitorGpsService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.DataQualityMonitorGps; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 动态数据质量监控 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +public interface IDataQualityMonitorGpsService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDataQualityMonitorStaticService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDataQualityMonitorStaticService.java new file mode 100644 index 0000000..817d233 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDataQualityMonitorStaticService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.DataQualityMonitorStatic; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 静态数据质量监控 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +public interface IDataQualityMonitorStaticService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDriverTrainingCertificateJoinService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDriverTrainingCertificateJoinService.java new file mode 100644 index 0000000..d633792 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDriverTrainingCertificateJoinService.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.industry.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateJoin; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateOperJoin; + +/** + *

+ * 驾驶员合格证 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-03 + */ +public interface IDriverTrainingCertificateJoinService extends IService { + + Page pageJoin(Page page, LambdaQueryWrapper wrapper); + + DriverTrainingCertificateJoin getOneJoin(LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDriverTrainingCertificateOperJoinService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDriverTrainingCertificateOperJoinService.java new file mode 100644 index 0000000..1a628a7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDriverTrainingCertificateOperJoinService.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.industry.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateOperJoin; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 驾驶员合格证操作 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-04 + */ +public interface IDriverTrainingCertificateOperJoinService extends IService { + + Page pageJoin(Page page,LambdaQueryWrapper wrapper); + + DriverTrainingCertificateOperJoin getOneJoin(LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDriverTrainingCertificateOperService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDriverTrainingCertificateOperService.java new file mode 100644 index 0000000..e1bd4b9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IDriverTrainingCertificateOperService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateOper; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 驾驶员合格证操作 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-04 + */ +public interface IDriverTrainingCertificateOperService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ILabAcceptanceCertificateChangeService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ILabAcceptanceCertificateChangeService.java new file mode 100644 index 0000000..f25540b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ILabAcceptanceCertificateChangeService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.LabAcceptanceCertificateChange; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 实验室验收合格证换证 服务类 + *

+ * + * @author CMM + * @since 2022-12-16 + */ +public interface ILabAcceptanceCertificateChangeService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ILabAcceptanceCertificateService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ILabAcceptanceCertificateService.java new file mode 100644 index 0000000..9cee7c6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ILabAcceptanceCertificateService.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.LabAcceptanceCertificate; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateAuditReq; + +/** + *

+ * 实验室验收合格证 服务类 + *

+ * + * @author WendyYang + * @since 2022-11-08 + */ +public interface ILabAcceptanceCertificateService extends IService { + + Boolean audit(LabWorkerCertificateAuditReq req, Long userId); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ILabWorkerCertificateChangeService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ILabWorkerCertificateChangeService.java new file mode 100644 index 0000000..be31da6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ILabWorkerCertificateChangeService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.LabWorkerCertificateChange; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 实验室人员从业资格证更换 服务类 + *

+ * + * @author CMM + * @since 2022-12-16 + */ +public interface ILabWorkerCertificateChangeService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ILabWorkerCertificateService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ILabWorkerCertificateService.java new file mode 100644 index 0000000..013fe86 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ILabWorkerCertificateService.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.LabWorkerCertificate; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateAuditReq; + +/** + *

+ * 实验室人员从业资格证 服务类 + *

+ * + * @author WendyYang + * @since 2022-11-04 + */ +public interface ILabWorkerCertificateService extends IService { + + Boolean audit(LabWorkerCertificateAuditReq req, Long userId); + + Boolean cancelAudit(LabWorkerCertificateAuditReq req, Long userId); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IMortarEnterpriseFilingCertificateChangeService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IMortarEnterpriseFilingCertificateChangeService.java new file mode 100644 index 0000000..7928e93 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IMortarEnterpriseFilingCertificateChangeService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.MortarEnterpriseFilingCertificateChange; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 砂浆企业备案证换证 服务类 + *

+ * + * @author CMM + * @since 2022-12-15 + */ +public interface IMortarEnterpriseFilingCertificateChangeService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IMortarEnterpriseFilingCertificateService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IMortarEnterpriseFilingCertificateService.java new file mode 100644 index 0000000..2a1d010 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IMortarEnterpriseFilingCertificateService.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.MortarEnterpriseFilingCertificate; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateAuditReq; + +/** + *

+ * 砂浆企业备案证 服务类 + *

+ * + * @author WendyYang + * @since 2022-11-08 + */ +public interface IMortarEnterpriseFilingCertificateService extends IService { + + Boolean audit(LabWorkerCertificateAuditReq req, Long userId); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IOperatorIndexScoreInfoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IOperatorIndexScoreInfoService.java new file mode 100644 index 0000000..5ddb09f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IOperatorIndexScoreInfoService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.OperatorIndexScoreInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-01-04 + */ +public interface IOperatorIndexScoreInfoService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPassportInfoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPassportInfoService.java new file mode 100644 index 0000000..9d5a4cd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPassportInfoService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.PassportInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 通行证信息 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +public interface IPassportInfoService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPurchaseOilService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPurchaseOilService.java new file mode 100644 index 0000000..ea92f81 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPurchaseOilService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.PurchaseOil; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 油品采购信息表 服务类 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +public interface IPurchaseOilService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPurchaseRawMaterialService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPurchaseRawMaterialService.java new file mode 100644 index 0000000..3989b60 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPurchaseRawMaterialService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.PurchaseRawMaterial; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 原材料采购信息表 服务类 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +public interface IPurchaseRawMaterialService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPurchaseVehicleService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPurchaseVehicleService.java new file mode 100644 index 0000000..0ea27c8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPurchaseVehicleService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.PurchaseVehicle; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 车辆采购信息表 服务类 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +public interface IPurchaseVehicleService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPurchaseWheelService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPurchaseWheelService.java new file mode 100644 index 0000000..53c721f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IPurchaseWheelService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.PurchaseWheel; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 轮胎采购信息表 服务类 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +public interface IPurchaseWheelService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IReadyMixedMortarIndustryManageService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IReadyMixedMortarIndustryManageService.java new file mode 100644 index 0000000..ee1960b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IReadyMixedMortarIndustryManageService.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.industry.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.industry.entity.ReadyMixedMortarIndustryManage; +import com.ningdatech.carapi.industry.model.dto.ReadyMixedPageParamDTO; + +import java.util.List; + +/** + *

+ * 预拌砂浆行业管理 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-18 + */ +public interface IReadyMixedMortarIndustryManageService extends IService { + + List dataScopeList(LambdaQueryWrapper wrapper, ReadyMixedPageParamDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IRegistrationRecordService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IRegistrationRecordService.java new file mode 100644 index 0000000..cfcc4ff --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IRegistrationRecordService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.RegistrationRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 新车上牌记录 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-06 + */ +public interface IRegistrationRecordService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ISafetyEquipmentInstallUseCertificateOperationService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ISafetyEquipmentInstallUseCertificateOperationService.java new file mode 100644 index 0000000..196e0b5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ISafetyEquipmentInstallUseCertificateOperationService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.SafetyEquipmentInstallUseCertificateOperation; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 安全设备安装使用证书操作信息 服务类 + *

+ * + * @author CMM + * @since 2022-11-26 + */ +public interface ISafetyEquipmentInstallUseCertificateOperationService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ISafetyEquipmentInstallUseCertificateService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ISafetyEquipmentInstallUseCertificateService.java new file mode 100644 index 0000000..4623069 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/ISafetyEquipmentInstallUseCertificateService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.SafetyEquipmentInstallUseCertificate; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 安全设备安装使用证书信息 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +public interface ISafetyEquipmentInstallUseCertificateService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IVehicleAnnualInspectionReviewService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IVehicleAnnualInspectionReviewService.java new file mode 100644 index 0000000..40683d9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/IVehicleAnnualInspectionReviewService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.industry.service; + +import com.ningdatech.carapi.industry.entity.VehicleAnnualInspectionReview; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 车辆年检年审 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +public interface IVehicleAnnualInspectionReviewService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DataQualityMonitorDynamicsServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DataQualityMonitorDynamicsServiceImpl.java new file mode 100644 index 0000000..13482cb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DataQualityMonitorDynamicsServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.DataQualityMonitorDynamics; +import com.ningdatech.carapi.industry.mapper.DataQualityMonitorDynamicsMapper; +import com.ningdatech.carapi.industry.service.IDataQualityMonitorDynamicsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 异常GPS数据监控 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Service +public class DataQualityMonitorDynamicsServiceImpl extends ServiceImpl implements IDataQualityMonitorDynamicsService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DataQualityMonitorGpsServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DataQualityMonitorGpsServiceImpl.java new file mode 100644 index 0000000..7924f3a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DataQualityMonitorGpsServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.DataQualityMonitorGps; +import com.ningdatech.carapi.industry.mapper.DataQualityMonitorGpsMapper; +import com.ningdatech.carapi.industry.service.IDataQualityMonitorGpsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态数据质量监控 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Service +public class DataQualityMonitorGpsServiceImpl extends ServiceImpl implements IDataQualityMonitorGpsService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DataQualityMonitorStaticServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DataQualityMonitorStaticServiceImpl.java new file mode 100644 index 0000000..c6a28da --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DataQualityMonitorStaticServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.DataQualityMonitorStatic; +import com.ningdatech.carapi.industry.mapper.DataQualityMonitorStaticMapper; +import com.ningdatech.carapi.industry.service.IDataQualityMonitorStaticService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 静态数据质量监控 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-07 + */ +@Service +public class DataQualityMonitorStaticServiceImpl extends ServiceImpl implements IDataQualityMonitorStaticService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DataScreenServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DataScreenServiceImpl.java new file mode 100644 index 0000000..7c45af5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DataScreenServiceImpl.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.industry.mapper.DataScreenMapper; +import com.ningdatech.carapi.industry.model.po.CeriticatePO; +import com.ningdatech.carapi.industry.service.DataScreenService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author PoffyZhang + * @Classname DataScreenServiceImpl + * @Description + * @Date 2022/12/15 19:09 + */ +@Service +@RequiredArgsConstructor +public class DataScreenServiceImpl implements DataScreenService { + + private final DataScreenMapper mapper; + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List tainCertificate(DataScreenParam param) { + CodeUtil.buildRegionLevel(param); + return mapper.tainCertificate(param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List laboratoryQualificationCertificate(DataScreenParam param) { + CodeUtil.buildRegionLevel(param); + return mapper.laboratoryQualificationCertificate(param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List laboratoryAcceptanceCertificate(DataScreenParam param) { + CodeUtil.buildRegionLevel(param); + return mapper.laboratoryAcceptanceCertificate(param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List recordCertificateMortarEnterprise(DataScreenParam param) { + CodeUtil.buildRegionLevel(param); + return mapper.recordCertificateMortarEnterprise(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DriverTrainingCertificateJoinServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DriverTrainingCertificateJoinServiceImpl.java new file mode 100644 index 0000000..95dd7c9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DriverTrainingCertificateJoinServiceImpl.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateJoin; +import com.ningdatech.carapi.industry.mapper.DriverTrainingCertificateJoinMapper; +import com.ningdatech.carapi.industry.service.IDriverTrainingCertificateJoinService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 驾驶员合格证 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-03 + */ +@Service +@RequiredArgsConstructor +public class DriverTrainingCertificateJoinServiceImpl extends ServiceImpl implements IDriverTrainingCertificateJoinService { + + private final DriverTrainingCertificateJoinMapper driverTrainingCertificateJoinMapper; + + @Override + public Page pageJoin(Page page, LambdaQueryWrapper wrapper) { + return driverTrainingCertificateJoinMapper.pageJoin(page,wrapper); + } + + @Override + public DriverTrainingCertificateJoin getOneJoin(LambdaQueryWrapper wrapper) { + return driverTrainingCertificateJoinMapper.getOneJoin(wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DriverTrainingCertificateOperJoinServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DriverTrainingCertificateOperJoinServiceImpl.java new file mode 100644 index 0000000..e08facb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DriverTrainingCertificateOperJoinServiceImpl.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateOper; +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateOperJoin; +import com.ningdatech.carapi.industry.mapper.DriverTrainingCertificateOperJoinMapper; +import com.ningdatech.carapi.industry.mapper.DriverTrainingCertificateOperMapper; +import com.ningdatech.carapi.industry.service.IDriverTrainingCertificateOperJoinService; +import com.ningdatech.carapi.industry.service.IDriverTrainingCertificateOperService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 驾驶员合格证操作 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-04 + */ +@Service +@RequiredArgsConstructor +public class DriverTrainingCertificateOperJoinServiceImpl extends ServiceImpl implements IDriverTrainingCertificateOperJoinService { + private final DriverTrainingCertificateOperJoinMapper driverTrainingCertificateOperJoinMapper; + + @Override + public Page pageJoin(Page page, LambdaQueryWrapper wrapper) { + return driverTrainingCertificateOperJoinMapper.pageJoin(page, wrapper); + } + + @Override + public DriverTrainingCertificateOperJoin getOneJoin(LambdaQueryWrapper wrapper) { + return driverTrainingCertificateOperJoinMapper.getOneJoin(wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DriverTrainingCertificateOperServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DriverTrainingCertificateOperServiceImpl.java new file mode 100644 index 0000000..4b30008 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/DriverTrainingCertificateOperServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.DriverTrainingCertificateOper; +import com.ningdatech.carapi.industry.mapper.DriverTrainingCertificateOperMapper; +import com.ningdatech.carapi.industry.service.IDriverTrainingCertificateOperService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 驾驶员合格证操作 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-04 + */ +@Service +public class DriverTrainingCertificateOperServiceImpl extends ServiceImpl implements IDriverTrainingCertificateOperService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/LabAcceptanceCertificateChangeServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/LabAcceptanceCertificateChangeServiceImpl.java new file mode 100644 index 0000000..d8043ae --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/LabAcceptanceCertificateChangeServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.LabAcceptanceCertificateChange; +import com.ningdatech.carapi.industry.mapper.LabAcceptanceCertificateChangeMapper; +import com.ningdatech.carapi.industry.service.ILabAcceptanceCertificateChangeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 实验室验收合格证换证 服务实现类 + *

+ * + * @author CMM + * @since 2022-12-16 + */ +@Service +public class LabAcceptanceCertificateChangeServiceImpl extends ServiceImpl implements ILabAcceptanceCertificateChangeService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/LabAcceptanceCertificateServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/LabAcceptanceCertificateServiceImpl.java new file mode 100644 index 0000000..4b6194c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/LabAcceptanceCertificateServiceImpl.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.industry.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.carapi.industry.entity.LabAcceptanceCertificate; +import com.ningdatech.carapi.industry.entity.LabAcceptanceCertificateChange; +import com.ningdatech.carapi.industry.mapper.LabAcceptanceCertificateChangeMapper; +import com.ningdatech.carapi.industry.mapper.LabAcceptanceCertificateMapper; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateAuditReq; +import com.ningdatech.carapi.industry.service.ILabAcceptanceCertificateService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + *

+ * 实验室验收合格证 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-11-08 + */ +@Service +@RequiredArgsConstructor +public class LabAcceptanceCertificateServiceImpl extends ServiceImpl implements ILabAcceptanceCertificateService { + + private final LabAcceptanceCertificateMapper labAcceptanceCertificateMapper; + private final LabAcceptanceCertificateChangeMapper labAcceptanceCertificateChangeMapper; + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean audit(LabWorkerCertificateAuditReq req, Long userId) { + LabAcceptanceCertificateChange labAcceptanceCertificateChange = labAcceptanceCertificateChangeMapper.selectById(req.getId()); + if (Objects.isNull(labAcceptanceCertificateChange)){ + throw new BizException("证书信息不存在!"); + } + // labAcceptanceCertificateChange.setAuditStatus(1); + labAcceptanceCertificateChange.setUpdateOn(LocalDateTime.now()); + labAcceptanceCertificateChange.setUpdateBy(userId); + labAcceptanceCertificateChange.setReplacementTime(LocalDate.now()); + labAcceptanceCertificateChangeMapper.updateById(labAcceptanceCertificateChange); + LabAcceptanceCertificate labAcceptanceCertificate = BeanUtil.copyProperties(labAcceptanceCertificateChange, LabAcceptanceCertificate.class); + labAcceptanceCertificate.setId(null); + labAcceptanceCertificate.setCreateOn(LocalDateTime.now()); + labAcceptanceCertificate.setCreateBy(userId); + labAcceptanceCertificateMapper.insert(labAcceptanceCertificate); + return Boolean.TRUE; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/LabWorkerCertificateChangeServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/LabWorkerCertificateChangeServiceImpl.java new file mode 100644 index 0000000..50a918f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/LabWorkerCertificateChangeServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.LabWorkerCertificateChange; +import com.ningdatech.carapi.industry.mapper.LabWorkerCertificateChangeMapper; +import com.ningdatech.carapi.industry.service.ILabWorkerCertificateChangeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 实验室人员从业资格证更换 服务实现类 + *

+ * + * @author CMM + * @since 2022-12-16 + */ +@Service +public class LabWorkerCertificateChangeServiceImpl extends ServiceImpl implements ILabWorkerCertificateChangeService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/LabWorkerCertificateServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/LabWorkerCertificateServiceImpl.java new file mode 100644 index 0000000..6dd4953 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/LabWorkerCertificateServiceImpl.java @@ -0,0 +1,83 @@ +package com.ningdatech.carapi.industry.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.carapi.industry.entity.LabWorkerCertificate; +import com.ningdatech.carapi.industry.entity.LabWorkerCertificateChange; +import com.ningdatech.carapi.industry.mapper.LabWorkerCertificateChangeMapper; +import com.ningdatech.carapi.industry.mapper.LabWorkerCertificateMapper; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateAuditReq; +import com.ningdatech.carapi.industry.service.ILabWorkerCertificateService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + *

+ * 实验室人员从业资格证 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-11-04 + */ +@Service +@RequiredArgsConstructor +public class LabWorkerCertificateServiceImpl extends ServiceImpl implements ILabWorkerCertificateService { + + private final LabWorkerCertificateMapper labWorkerCertificateMapper; + private final LabWorkerCertificateChangeMapper labWorkerCertificateChangeMapper; + + /** + * 从业资格证|继续教育合格证换证申请审核 + * @param req + * @param userId + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean audit(LabWorkerCertificateAuditReq req, Long userId) { + LabWorkerCertificateChange labWorkerCertificateChange = labWorkerCertificateChangeMapper.selectById(req.getId()); + if (Objects.isNull(labWorkerCertificateChange)){ + throw new BizException("证书信息不存在!"); + } + // labWorkerCertificateChange.setAuditStatus(1); + labWorkerCertificateChange.setUpdateBy(userId); + labWorkerCertificateChange.setUpdateOn(LocalDateTime.now()); + labWorkerCertificateChange.setReplacementTime(LocalDate.now()); + labWorkerCertificateChangeMapper.updateById(labWorkerCertificateChange); + LabWorkerCertificate labWorkerCertificate = BeanUtil.copyProperties(labWorkerCertificateChange, LabWorkerCertificate.class); + labWorkerCertificate.setId(null); + labWorkerCertificate.setCreateOn(LocalDateTime.now()); + labWorkerCertificate.setCreateBy(userId); + labWorkerCertificateMapper.insert(labWorkerCertificate); + return Boolean.TRUE; + } + + /** + * 从业资格证取消审核 + * @param req + * @param userId + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean cancelAudit(LabWorkerCertificateAuditReq req, Long userId) { + LabWorkerCertificateChange labWorkerCertificateChange = labWorkerCertificateChangeMapper.selectById(req.getId()); + if (Objects.isNull(labWorkerCertificateChange)){ + throw new BizException("证书信息不存在!"); + } + // labWorkerCertificateChange.setAuditStatus(0); + labWorkerCertificateChange.setUpdateBy(userId); + labWorkerCertificateChange.setUpdateOn(LocalDateTime.now()); + labWorkerCertificateChangeMapper.updateById(labWorkerCertificateChange); + labWorkerCertificateMapper.delete(Wrappers.lambdaQuery(LabWorkerCertificate.class) + .eq(Objects.nonNull(labWorkerCertificateChange.getCertificateNo()),LabWorkerCertificate::getCertificateNo,labWorkerCertificateChange.getCertificateNo())); + return Boolean.TRUE; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/MortarEnterpriseFilingCertificateChangeServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/MortarEnterpriseFilingCertificateChangeServiceImpl.java new file mode 100644 index 0000000..5493e98 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/MortarEnterpriseFilingCertificateChangeServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.MortarEnterpriseFilingCertificateChange; +import com.ningdatech.carapi.industry.mapper.MortarEnterpriseFilingCertificateChangeMapper; +import com.ningdatech.carapi.industry.service.IMortarEnterpriseFilingCertificateChangeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 砂浆企业备案证换证 服务实现类 + *

+ * + * @author CMM + * @since 2022-12-15 + */ +@Service +public class MortarEnterpriseFilingCertificateChangeServiceImpl extends ServiceImpl implements IMortarEnterpriseFilingCertificateChangeService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/MortarEnterpriseFilingCertificateServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/MortarEnterpriseFilingCertificateServiceImpl.java new file mode 100644 index 0000000..103c749 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/MortarEnterpriseFilingCertificateServiceImpl.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.industry.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.carapi.industry.entity.MortarEnterpriseFilingCertificate; +import com.ningdatech.carapi.industry.entity.MortarEnterpriseFilingCertificateChange; +import com.ningdatech.carapi.industry.mapper.MortarEnterpriseFilingCertificateChangeMapper; +import com.ningdatech.carapi.industry.mapper.MortarEnterpriseFilingCertificateMapper; +import com.ningdatech.carapi.industry.model.req.LabWorkerCertificateAuditReq; +import com.ningdatech.carapi.industry.service.IMortarEnterpriseFilingCertificateService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + *

+ * 砂浆企业备案证 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-11-08 + */ +@Service +@RequiredArgsConstructor +public class MortarEnterpriseFilingCertificateServiceImpl extends ServiceImpl implements IMortarEnterpriseFilingCertificateService { + + private final MortarEnterpriseFilingCertificateMapper mortarEnterpriseFilingCertificateMapper; + private final MortarEnterpriseFilingCertificateChangeMapper mortarEnterpriseFilingCertificateChangeMapper; + + @Override + public Boolean audit(LabWorkerCertificateAuditReq req, Long userId) { + MortarEnterpriseFilingCertificateChange mortarEnterpriseFilingCertificateChange = mortarEnterpriseFilingCertificateChangeMapper.selectById(req.getId()); + if (Objects.isNull(mortarEnterpriseFilingCertificateChange)){ + throw new BizException("证书信息不存在!"); + } + // mortarEnterpriseFilingCertificateChange.setAuditStatus(1); + mortarEnterpriseFilingCertificateChange.setUpdateOn(LocalDateTime.now()); + mortarEnterpriseFilingCertificateChange.setUpdateBy(userId); + mortarEnterpriseFilingCertificateChange.setReplacementTime(LocalDate.now()); + mortarEnterpriseFilingCertificateChangeMapper.updateById(mortarEnterpriseFilingCertificateChange); + MortarEnterpriseFilingCertificate mortarEnterpriseFilingCertificate + = BeanUtil.copyProperties(mortarEnterpriseFilingCertificateChange, MortarEnterpriseFilingCertificate.class); + mortarEnterpriseFilingCertificate.setId(null); + mortarEnterpriseFilingCertificate.setCreateOn(LocalDateTime.now()); + mortarEnterpriseFilingCertificate.setCreateBy(userId); + mortarEnterpriseFilingCertificateMapper.insert(mortarEnterpriseFilingCertificate); + return Boolean.TRUE; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/OperatorIndexScoreInfoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/OperatorIndexScoreInfoServiceImpl.java new file mode 100644 index 0000000..7d037c3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/OperatorIndexScoreInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.OperatorIndexScoreInfo; +import com.ningdatech.carapi.industry.mapper.OperatorIndexScoreInfoMapper; +import com.ningdatech.carapi.industry.service.IOperatorIndexScoreInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-01-04 + */ +@Service +public class OperatorIndexScoreInfoServiceImpl extends ServiceImpl implements IOperatorIndexScoreInfoService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PassportInfoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PassportInfoServiceImpl.java new file mode 100644 index 0000000..8fb8012 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PassportInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.PassportInfo; +import com.ningdatech.carapi.industry.mapper.PassportInfoMapper; +import com.ningdatech.carapi.industry.service.IPassportInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 通行证信息 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +@Service +public class PassportInfoServiceImpl extends ServiceImpl implements IPassportInfoService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PurchaseOilServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PurchaseOilServiceImpl.java new file mode 100644 index 0000000..8e27971 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PurchaseOilServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.PurchaseOil; +import com.ningdatech.carapi.industry.mapper.PurchaseOilMapper; +import com.ningdatech.carapi.industry.service.IPurchaseOilService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 油品采购信息表 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Service +public class PurchaseOilServiceImpl extends ServiceImpl implements IPurchaseOilService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PurchaseRawMaterialServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PurchaseRawMaterialServiceImpl.java new file mode 100644 index 0000000..1ae83a2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PurchaseRawMaterialServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.PurchaseRawMaterial; +import com.ningdatech.carapi.industry.mapper.PurchaseRawMaterialMapper; +import com.ningdatech.carapi.industry.service.IPurchaseRawMaterialService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 原材料采购信息表 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Service +public class PurchaseRawMaterialServiceImpl extends ServiceImpl implements IPurchaseRawMaterialService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PurchaseVehicleServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PurchaseVehicleServiceImpl.java new file mode 100644 index 0000000..fdd8bb3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PurchaseVehicleServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.PurchaseVehicle; +import com.ningdatech.carapi.industry.mapper.PurchaseVehicleMapper; +import com.ningdatech.carapi.industry.service.IPurchaseVehicleService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 车辆采购信息表 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Service +public class PurchaseVehicleServiceImpl extends ServiceImpl implements IPurchaseVehicleService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PurchaseWheelServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PurchaseWheelServiceImpl.java new file mode 100644 index 0000000..75e01b2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/PurchaseWheelServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.PurchaseWheel; +import com.ningdatech.carapi.industry.mapper.PurchaseWheelMapper; +import com.ningdatech.carapi.industry.service.IPurchaseWheelService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 轮胎采购信息表 服务实现类 + *

+ * + * @author WendyYang + * @since 2022-11-09 + */ +@Service +public class PurchaseWheelServiceImpl extends ServiceImpl implements IPurchaseWheelService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/ReadyMixedMortarIndustryManageServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/ReadyMixedMortarIndustryManageServiceImpl.java new file mode 100644 index 0000000..e7a321c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/ReadyMixedMortarIndustryManageServiceImpl.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.industry.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.industry.entity.ReadyMixedMortarIndustryManage; +import com.ningdatech.carapi.industry.mapper.ReadyMixedMortarIndustryManageMapper; +import com.ningdatech.carapi.industry.model.dto.ReadyMixedPageParamDTO; +import com.ningdatech.carapi.industry.service.IReadyMixedMortarIndustryManageService; + +/** + *

+ * 预拌砂浆行业管理 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-18 + */ +@Service +public class ReadyMixedMortarIndustryManageServiceImpl extends ServiceImpl implements IReadyMixedMortarIndustryManageService { + + @Override + @BuildChildrenRegionWrapper + @LambdaDataScope + public List dataScopeList(LambdaQueryWrapper wrapper, ReadyMixedPageParamDTO param) { + return baseMapper.selectList(wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/RegistrationRecordServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/RegistrationRecordServiceImpl.java new file mode 100644 index 0000000..bc5b587 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/RegistrationRecordServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.RegistrationRecord; +import com.ningdatech.carapi.industry.mapper.RegistrationRecordMapper; +import com.ningdatech.carapi.industry.service.IRegistrationRecordService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 新车上牌记录 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-06 + */ +@Service +public class RegistrationRecordServiceImpl extends ServiceImpl implements IRegistrationRecordService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/SafetyEquipmentInstallUseCertificateOperationServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/SafetyEquipmentInstallUseCertificateOperationServiceImpl.java new file mode 100644 index 0000000..5a58e57 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/SafetyEquipmentInstallUseCertificateOperationServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.SafetyEquipmentInstallUseCertificateOperation; +import com.ningdatech.carapi.industry.mapper.SafetyEquipmentInstallUseCertificateOperationMapper; +import com.ningdatech.carapi.industry.service.ISafetyEquipmentInstallUseCertificateOperationService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 安全设备安装使用证书操作信息 服务实现类 + *

+ * + * @author CMM + * @since 2022-11-26 + */ +@Service +public class SafetyEquipmentInstallUseCertificateOperationServiceImpl extends ServiceImpl implements ISafetyEquipmentInstallUseCertificateOperationService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/SafetyEquipmentInstallUseCertificateServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/SafetyEquipmentInstallUseCertificateServiceImpl.java new file mode 100644 index 0000000..54c0009 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/SafetyEquipmentInstallUseCertificateServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.SafetyEquipmentInstallUseCertificate; +import com.ningdatech.carapi.industry.mapper.SafetyEquipmentInstallUseCertificateMapper; +import com.ningdatech.carapi.industry.service.ISafetyEquipmentInstallUseCertificateService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 安全设备安装使用证书信息 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-09 + */ +@Service +public class SafetyEquipmentInstallUseCertificateServiceImpl extends ServiceImpl implements ISafetyEquipmentInstallUseCertificateService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/VehicleAnnualInspectionReviewServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/VehicleAnnualInspectionReviewServiceImpl.java new file mode 100644 index 0000000..9e2f004 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/industry/service/impl/VehicleAnnualInspectionReviewServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.industry.service.impl; + +import com.ningdatech.carapi.industry.entity.VehicleAnnualInspectionReview; +import com.ningdatech.carapi.industry.mapper.VehicleAnnualInspectionReviewMapper; +import com.ningdatech.carapi.industry.service.IVehicleAnnualInspectionReviewService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 车辆年检年审 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-05 + */ +@Service +public class VehicleAnnualInspectionReviewServiceImpl extends ServiceImpl implements IVehicleAnnualInspectionReviewService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/constant/SmsConstant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/constant/SmsConstant.java new file mode 100644 index 0000000..3b3fe19 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/constant/SmsConstant.java @@ -0,0 +1,12 @@ +package com.ningdatech.carapi.irs.constant; + +/** + * 短信验证常量 + * @return + * @author CMM + * @since 2023/06/02 11:31 + */ +public interface SmsConstant { + + public final String SMS_CONSTANT_TEMPLATE = "验证码:%s(有效期为10分钟),请勿泄露给他人,如非本人操作,请忽略此信息。"; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/AccidentController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/AccidentController.java new file mode 100644 index 0000000..91a0054 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/AccidentController.java @@ -0,0 +1,49 @@ +package com.ningdatech.carapi.irs.controller; + +import com.ningdatech.carapi.irs.service.AccidentService; +import com.ningdatech.carapi.irs.service.RefreshKeyService; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @Classname SmsService + * @Description + * @Date 2023/3/23 17:06 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/accident/") +@RequiredArgsConstructor +public class AccidentController { + + private final AccidentService accidentService; + + private final RefreshKeyService refreshKeyService; + + @ApiOperation(value = "刷新密钥 测试", notes = "刷新密钥 测试") + @GetMapping("/refresh") + public String refresh() { + return refreshKeyService.refresh(); + } + + @ApiOperation(value = "事故责任认定书 测试", notes = "事故责任认定书 测试") + @GetMapping("/test") + public List test() { + return accidentService.getAccident(); + } + + @ApiOperation(value = "更新事故责任认定书数据", notes = "更新事故责任认定书数据") + @GetMapping("/update") + public String update() { + return accidentService.updateAccident(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/AccidentQueryController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/AccidentQueryController.java new file mode 100644 index 0000000..1b84fd1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/AccidentQueryController.java @@ -0,0 +1,71 @@ +package com.ningdatech.carapi.irs.controller; + +import java.io.FileNotFoundException; +import java.util.List; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.carapi.irs.manage.DataInitManage; +import com.ningdatech.carapi.irs.service.AccidentService; + +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * 事故查询 + * + * @author CMM + * @since 2023/04/23 14:25 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/accident/query") +@RequiredArgsConstructor +public class AccidentQueryController { + + private final AccidentService accidentService; + + private final DataInitManage dataInitManage; + + @ApiOperation(value = "事故查询 测试", notes = "事故查询 测试") + @GetMapping("/test") + public List test() { + return accidentService.accidentQuery(); + } + + + @ApiOperation(value = "事故查询数据初始化", notes = "事故查询数据初始化") + @GetMapping("/accidentQueryDataInit") + public String dataInit() { + return dataInitManage.dataInit(); + } + + @ApiOperation(value = "事故查询数据批量保存", notes = "事故查询数据批量保存") + @GetMapping("/accidentQueryDataSave") + public void dataSave() throws InterruptedException { + dataInitManage.accidentQueryDataSave(); + } + + @ApiOperation(value = "事故查询数据逐个保存", notes = "事故查询数据逐个保存") + @GetMapping("/accidentQueryDataSingleSave") + public void dataSingleSave() { + dataInitManage.accidentQueryDataSingleSave(); + } + + @ApiOperation(value = "事故查询数据逐个保存", notes = "事故查询数据逐个保存") + @GetMapping("/dataSingleSave") + public void singleSave() throws FileNotFoundException { + dataInitManage.singleSave(); + } + + @ApiOperation(value = "事故查询数据更新", notes = "事故查询数据更新") + @GetMapping("/updateAccidentData") + public void updateAccidentData() throws FileNotFoundException { + dataInitManage.updateAccidentData(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/IrsController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/IrsController.java new file mode 100644 index 0000000..d4528aa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/IrsController.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.irs.controller; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.carapi.irs.manage.DataInitManage; + +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/05/16 00:01 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/irs") +@RequiredArgsConstructor +public class IrsController { + + private final DataInitManage dataInitManage; + + @ApiOperation(value = "车牌号初始化保存", notes = "车牌号初始化保存") + @GetMapping("/carPlate/save") + public void carPlateSave() { + dataInitManage.carPlateSave(); + } + + @ApiOperation(value = "日志分析保存", notes = "日志分析保存") + @GetMapping("/log/save") + public void logSave() { + dataInitManage.logSave(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/IrsDriversLicensePullController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/IrsDriversLicensePullController.java new file mode 100644 index 0000000..61e86ed --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/IrsDriversLicensePullController.java @@ -0,0 +1,59 @@ +package com.ningdatech.carapi.irs.controller; + +import java.util.List; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.carapi.irs.manage.IrsDriversLicenseManage; + +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 驾驶证信息查询 + *

+ * + * @author WendyYang + * @since 2023/5/16 + **/ +@RestController +@RequestMapping("/open/api/irs") +@RequiredArgsConstructor +public class IrsDriversLicensePullController { + + private final IrsDriversLicenseManage irsDriversLicenseManage; + + @ApiOperation("驾驶证信拉取") + @GetMapping("/driver-license/refresh") + public void driverLicenseRefresh() { + irsDriversLicenseManage.submitDriverLicensePullTask(); + } + + @ApiOperation("行驶证信息拉取") + @GetMapping("/driving-license/refresh") + public void drivingLicenseRefresh() { + irsDriversLicenseManage.submitDrivingLicensePullTask(); + } + + @ApiOperation(value = "行驶证查询数据逐个保存", notes = "行驶证查询数据逐个保存") + @GetMapping("/vehicleLicenseSingleSave") + public void vehicleLicenseSingleSave(){ + irsDriversLicenseManage.vehicleLicenseSingleSave(); + } + + @ApiOperation(value = "驾驶证查询数据逐个保存", notes = "驾驶证查询数据逐个保存") + @GetMapping("/drivingLicenseSingleSave") + public void drivingLicenseSingleSave(){ + irsDriversLicenseManage.drivingLicenseSingleSave(); + } + + @ApiOperation(value = "根据车架号查询行驶证数据", notes = "根据车架号查询行驶证数据") + @GetMapping("/vehicleLicenseTest") + public List vehicleLicenseTest(){ + return irsDriversLicenseManage.vehicleLicenseTest(); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/SmsController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/SmsController.java new file mode 100644 index 0000000..fc074a2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/SmsController.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.irs.controller; + +import com.ningdatech.carapi.irs.manage.SmsManage; +import com.ningdatech.carapi.irs.service.SmsService; +import com.ningdatech.carapi.open.model.dto.UserLoginDTO; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * @Classname SmsController + * @Description + * @Date 2023/3/1 17:06 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/sms/") +@RequiredArgsConstructor +public class SmsController { + + private final SmsService service; + + private final SmsManage smsManage; + + @ApiOperation(value = "sms send", notes = "sms") + @GetMapping("/send") + public String send(@RequestParam String content) { + String mobile = "15058187290"; + return service.sendMessage(mobile, content); + } + + @ApiOperation("获取验证码") + @PostMapping("/get-code") + public String getCode(@RequestBody UserLoginDTO param) { + return smsManage.getCode(param); + } + + @ApiOperation(value = "send sms code", notes = "get sms code") + @PostMapping("/send-sms-code") + public String sendSmsCode(@RequestBody UserLoginDTO param) { + return smsManage.sendSmsCode(param.getMobile(), param.getVerificationCode()); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/VehicleIllegalQueryController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/VehicleIllegalQueryController.java new file mode 100644 index 0000000..e92fc37 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/controller/VehicleIllegalQueryController.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.irs.controller; + +import com.ningdatech.carapi.irs.manage.DataInitManage; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.carapi.irs.service.CarService; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.io.FileNotFoundException; + +/** + * 车辆违法查询 + * + * @author CMM + * @since 2023/04/23 15:18 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/vehicle/illegal/query") +@RequiredArgsConstructor +public class VehicleIllegalQueryController { + + private final CarService carService; + + private final DataInitManage dataInitManage; + + @ApiOperation(value = "车辆违法查询 测试", notes = "车辆违法查询 测试") + @GetMapping("/test") + public String test() { + return carService.vehicleIllegalQuery(); + } + + @ApiOperation(value = "车辆违法数据初始化", notes = "车辆违法数据初始化") + @GetMapping("/vehicleIllegalDataInit") + public String dataInit() { + return dataInitManage.vehicleIllegaldataInit(); + } + + @ApiOperation(value = "车辆违法数据保存", notes = "车辆违法数据数据保存") + @GetMapping("/vehicleIllegalDataSave") + public void dataSave() throws InterruptedException { + dataInitManage.vehicleIllegalDataSave(); + } + + @ApiOperation(value = "车辆违法查询数据逐个保存", notes = "车辆违法查询数据逐个保存") + @GetMapping("/illegalDataSingleSave") + public void illegalDataSingleSave() throws FileNotFoundException { + dataInitManage.illegalDataSingleSave(); + } + + @ApiOperation(value = "车辆违章数据更新", notes = "车辆违章数据更新") + @GetMapping("/updateViolationData") + public void updateViolationData() throws FileNotFoundException { + dataInitManage.updateViolationData(); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/entity/DriversLicenseRaw.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/entity/DriversLicenseRaw.java new file mode 100644 index 0000000..640d920 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/entity/DriversLicenseRaw.java @@ -0,0 +1,51 @@ +package com.ningdatech.carapi.irs.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; + +/** + *

+ * + *

+ * + * @author WendyYang + * @since 2023-05-16 + */ +@Data +@TableName("nd_drivers_license_raw") +@ApiModel(value = "DriversLicense对象", description = "") +public class DriversLicenseRaw implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("身份证号") + private String idcard; + + @ApiModelProperty("驾驶证信息") + private String driverLicenseDetail; + + @ApiModelProperty("行驶证信息") + private String drivingLicenseDetail; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("车牌号") + private String carPlate; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/manage/DataInitManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/manage/DataInitManage.java new file mode 100644 index 0000000..e341206 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/manage/DataInitManage.java @@ -0,0 +1,1408 @@ +package com.ningdatech.carapi.irs.manage; + +import java.io.*; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.time.Duration; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Future; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Async; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.config.DefaultAsyncTaskConfig; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.cache.lock.DistributedLock; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.redis.RedisOps; +import com.ningdatech.carapi.car.position.entity.VehiclePositionInfo; +import com.ningdatech.carapi.car.position.service.IVehiclePositionInfoService; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.constant.MissCertEnum; +import com.ningdatech.carapi.common.constant.ViolationTypeEnum; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.irs.model.entity.IrsTempCarplate; +import com.ningdatech.carapi.irs.model.entity.VehicleAccidentIrsData; +import com.ningdatech.carapi.irs.model.entity.VehicleViolationIrsData; +import com.ningdatech.carapi.irs.service.*; +import com.ningdatech.carapi.qrcode.service.VehicleGetOnService; +import com.ningdatech.carapi.safe.constant.AccidentTypeEnum; +import com.ningdatech.carapi.safe.constant.VehicleAccidentReportStatusEnum; +import com.ningdatech.carapi.safe.entity.NdVehicleAccident; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentDead; +import com.ningdatech.carapi.safe.entity.NdVehicleViolation; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentDeadService; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentService; +import com.ningdatech.carapi.safe.service.INdVehicleViolationService; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.helper.VehiclesCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.file.utils.StrPool; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.util.StrUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/05/11 10:57 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class DataInitManage { + + @Value("${spring.redis.host}") + public String REDIS_HOST; + + @Value("${spring.redis.port}") + public String REDIS_PORT; + + private static final int GROUP_SIZE = 500; + private static final int QUERY_SIZE = 2000; + private static final long BIG_EXPIRE_TIME = 60 * 60 * 1000; + + private final DefaultAsyncTaskConfig defaultAsyncTaskConfig; + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final AccidentService accidentService; + private final RegionsCacheHelper regionsCacheHelper; + private final VehicleGetOnService vehicleGetOnService; + private final INdVehicleAccidentService vehicleAccidentService; + private final INdVehicleAccidentDeadService vehicleAccidentDeadService; + private final CarService carService; + private final VehiclesCacheHelper vehiclesCacheHelper; + private final INdVehicleViolationService vehicleViolationService; + private final IDriverInfoService driverInfoService; + private final CompanyService companyService; + private final DistributedLock distributedLock; + private final IVehicleAccidentIrsDataService accidentIrsDataService; + private final IVehicleViolationIrsDataService violationIrsDataService; + private final RedisOps redisOps; + private final IIrsTempCarplateService irsTempCarplateService; + private final IVehiclePositionInfoService iVehiclePositionInfoService; + + /** + * 无驾驶证违法行为code列表 + */ + private static final List NO_DRIVING_LICENSE_LIST = + Arrays.asList("5075", "5072", "5077", "5057", "10159", "1082", "70619", "6018", "7503", "7504", "7006", "70069", + "1015", "16444", "1644", "50411", "60182", "8005", "80059", "8605", "5603", "5703", "1610", "5041", "60541", + "1110", "7061", "10050", "10051", "10052", "10059", "1006", "1010", "10109", "1013", "1014", "6086", "5006", + "1005", "56031", "60181", "57021", "57031", "1704", "1701"); + + /** + * 无行驶证违法行为code列表 + */ + private static final List NO_VEHICLE_LICENSE_LIST = Arrays.asList("5071", "5069", "1088", "5702", "5705", + "7216", "7218", "1109", "6085", "5003", "57051", "50031", "57021", "5009", "5015"); + + /** + * 闯红灯(违反交通信号灯) + */ + private static final List VIOLATION_TRAFFIC_LIGHTS_LIST = Arrays.asList("13029", "1625", "16259", "1302"); + + /** + * 违规时段行驶 + */ + private static final List VIOLATION_TIME_LIST = Arrays.asList("8025"); + + /** + * 违规路段行驶 + */ + private static final List VIOLATION_ROAD_LIST = + Arrays.asList("1048", "10489", "40099", "8004", "8803", "11229", "8005J", "8002", "8048", "4009", "10393", + "10397", "1045", "10459", "1310", "13109", "1023", "10239", "8005", "8001C", "1122", "8014"); + + public String dataInit() { + LambdaQueryWrapper query = Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .select(NdVehicleBaseInfo::getCarPlate).isNotNull(NdVehicleBaseInfo::getCarPlate); + List list = vehicleBaseInfoService.list(query); + + // 获取此次任务要查询的车牌号 + List carPlates = list.stream().map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + + List vehicleBaseInfos = vehicleBaseInfoService + .list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class).in(NdVehicleBaseInfo::getCarPlate, carPlates)); + Map vehicleBaseInfoMap = + vehicleBaseInfos.stream().collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + Map companyMap = + companyService.list().stream().collect(Collectors.toMap(Company::getId, c -> c)); + + // 获取已经存在的事故数据 + List accidentTmpVas = vehicleAccidentService + .list(Wrappers.lambdaQuery(NdVehicleAccident.class).in(NdVehicleAccident::getCarPlate, carPlates)); + Map> accidentMap = + CollUtils.group(accidentTmpVas, NdVehicleAccident::getCarPlate); + + // 获取已经存在的死亡事故数据 + List deadAccidentTmpVas = vehicleAccidentDeadService + .list(Wrappers.lambdaQuery(NdVehicleAccidentDead.class).in(NdVehicleAccidentDead::getCarPlate, carPlates)); + Map> deadAccidentMap = + CollUtils.group(deadAccidentTmpVas, NdVehicleAccidentDead::getCarPlate); + + log.info("此次任务数据量为 {}", list.size()); + + List lists = Lists.newArrayList(); + lists.add("浙B1Q567"); + lists.add("浙B3R397"); + lists.add("浙BE5516"); + lists.add("浙B1E907"); + lists.add("浙B0J292"); + lists.add("浙A8Y637"); + lists.add("浙C52502"); + lists.add("浙CL0175"); + lists.add("浙FM8020"); + lists.add("浙J61963"); + + // 调用IRS接口,返回数据 + for (String carPlate : lists) { + if (StrUtil.isNotBlank(carPlate)) { + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoMap.get(carPlate); + Long companyId = vehicleBaseInfo.getCompanyId(); + Company company = companyMap.get(companyId); + String dataJsonStr = accidentService.accidentQuery(carPlate); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + List array = JSON.parseArray(data, String.class); + for (String datas : array) { + if (StrUtil.isNotBlank(datas)) { + List accidentArray = JSON.parseArray(datas, JSONObject.class); + if (CollUtil.isEmpty(accidentArray)) { + log.info("该车牌号没有事故信息!"); + continue; + } + for (JSONObject jsonObject : accidentArray) { + // 获取行政区划 + String xzqh = jsonObject.getString("XZQH"); + // 获取区域信息 + Long regionId = regionsCacheHelper.getIdByCode(xzqh); + String regionName = regionsCacheHelper.getDisplayName(regionId); + // 获取事故日期 + Timestamp sgfssj = jsonObject.getTimestamp("SGFSSJ"); + LocalDateTime accidentTime = LocalDateTimeUtil.of(sgfssj); + + // 获取事故地点 + String sgdd = jsonObject.getString("SGDD"); + + // 先查出对应车牌号关联的责任驾驶员 + String driverName = vehicleBaseInfo.getResponsibleDriverFirst(); + + if (Objects.isNull(driverName)) { + log.info("该车牌号没有责任驾驶员!"); + continue; + } + // 获取车辆类型 + Integer vehicleType = vehicleBaseInfo.getVehicleType(); + // 获取当场、24小时、3日内、7日内、30日内死亡人数 + Integer swrs = jsonObject.getInteger("SWRS"); + Integer swrs24 = jsonObject.getInteger("SWRS24"); + Integer swrs3 = jsonObject.getInteger("SWRS3"); + Integer swrs7 = jsonObject.getInteger("SWRS7"); + Integer swrs30 = jsonObject.getInteger("SWRS30"); + // 获取受伤人数 + Integer ssrs = jsonObject.getInteger("SSRS"); + // 没有死亡人数 + // 插入到事故表中 + if (swrs == 0 && swrs24 == 0 && swrs3 == 0 && swrs7 == 0 && swrs30 == 0) { + NdVehicleAccident accident = new NdVehicleAccident(); + // 判断当前事故对应的车牌号是否在在事故表中已存在事故数据 + List accidents = accidentMap.get(carPlate); + if (CollUtil.isNotEmpty(accidents)) { + List timeList = accidents.stream() + .map(NdVehicleAccident::getAccidentTime).collect(Collectors.toList()); + // 如果该数据已经录入,直接跳过 + if (timeList.contains(accidentTime)) { + log.info("该事故数据已录入!"); + continue; + } + } + accident.setInjuries(ssrs); + accident.setRegionId(regionId); + accident.setRegionName(regionName); + // 获取事故时间 + accident.setAccidentTime(accidentTime); + accident.setAccidentAddress(sgdd); + // 装配车牌号、事故驾驶员、车辆类型、企业名称 + accident.setCarPlate(carPlate); + accident.setAccidentDriver(driverName); + accident.setVehicleType(vehicleType); + accident.setCompanyId(companyId); + if (Objects.nonNull(company)) { + accident.setCompanyName(company.getName()); + } + // 是否上报默认为未上报 + accident.setReportStatus(VehicleAccidentReportStatusEnum.UNDER_REPORT.getCode()); + vehicleAccidentService.saveOrUpdate(accident); + } else { + // 插入数据到死亡事故表中 + NdVehicleAccidentDead accidentDead = new NdVehicleAccidentDead(); + // 判断当前事故对应的车牌号是否在在事故表中已存在事故数据 + List deadAccidents = deadAccidentMap.get(carPlate); + if (CollUtil.isNotEmpty(deadAccidents)) { + List timeList = deadAccidents.stream() + .map(NdVehicleAccidentDead::getAccidentTime).collect(Collectors.toList()); + // 如果该数据已经录入,直接跳过 + if (timeList.contains(accidentTime)) { + log.info("该死亡数据已录入!"); + continue; + } + } + if (swrs30 != 0) { + accidentDead.setDeathToll(swrs30); + } else if (swrs7 != 0) { + accidentDead.setDeathToll(swrs7); + } else if (swrs3 != 0) { + accidentDead.setDeathToll(swrs3); + } else if (swrs24 != 0) { + accidentDead.setDeathToll(swrs24); + } else { + accidentDead.setDeathToll(swrs); + } + accidentDead.setInjuries(ssrs); + accidentDead.setRegionId(regionId); + accidentDead.setRegionName(regionName); + // 获取事故时间 + accidentDead.setAccidentTime(accidentTime); + accidentDead.setAccidentAddress(sgdd); + // 装配车牌号、事故驾驶员、企业名称 + accidentDead.setCarPlate(carPlate); + accidentDead.setAccidentDriver(driverName); + accidentDead.setCompanyId(companyId); + if (Objects.nonNull(company)) { + accidentDead.setCompanyName(company.getName()); + } + // 是否上报默认为未上报 + accidentDead.setReportStatus(VehicleAccidentReportStatusEnum.UNDER_REPORT.getCode()); + vehicleAccidentDeadService.saveOrUpdate(accidentDead); + } + } + } + } + } + } + return "更新完成"; + } + + public String vehicleIllegaldataInit() { + LambdaQueryWrapper query = Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .select(NdVehicleBaseInfo::getCarPlate).isNotNull(NdVehicleBaseInfo::getCarPlate); + List list = vehicleBaseInfoService.list(query); + + List carPlates = CollUtils.fieldList(list, NdVehicleBaseInfo::getCarPlate); + + // 获取车辆违章时间信息 + List vioList = vehicleViolationService + .list(Wrappers.lambdaQuery(NdVehicleViolation.class).in(NdVehicleViolation::getCarPlate, carPlates)); + Map> listMap = CollUtils.group(vioList, NdVehicleViolation::getCarPlate); + log.info("此次任务数据量为 {}", list.size()); + + // 调用IRS接口,返回数据 + for (String hphm : carPlates) { + String dataJsonStr = carService.vehicleIllegalQuery(hphm); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String datas = object.getString("datas"); + List vehicleIllegalArray = JSON.parseArray(datas, JSONObject.class); + if (CollUtil.isEmpty(vehicleIllegalArray)) { + log.info("该车牌号没有违章信息!"); + continue; + } + // 获取当前车牌号已经存在的违章时间数据 + List violationList = listMap.get(hphm); + List vehicleIllegalInfo = null; + if (CollUtil.isNotEmpty(violationList)) { + List violationTimeList = violationList.stream() + .map(v -> LocalDateTimeUtil.of(v.getViolationDate()) + .format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN))) + .collect(Collectors.toList()); + // 筛选出不在车辆违法信息表中的数据 + vehicleIllegalInfo = vehicleIllegalArray.stream() + .filter(v -> !violationTimeList.contains(LocalDateTimeUtil.of(v.getTimestamp("wfsj")) + .format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)))) + .collect(Collectors.toList()); + if (CollUtil.isEmpty(vehicleIllegalInfo)) { + log.info("该车牌号没有新增的违章信息"); + continue; + } + } else { + vehicleIllegalInfo = vehicleIllegalArray; + } + for (JSONObject jsonObject : vehicleIllegalInfo) { + NdVehicleViolation vehicleViolation = new NdVehicleViolation(); + vehicleViolation.setCarPlate(hphm); + // 获取行政区划 + String xzqh = jsonObject.getString("xzqh"); + // 获取区域信息 + Long regionId = regionsCacheHelper.getIdByCode(xzqh); + String regionName = regionsCacheHelper.getDisplayName(regionId); + vehicleViolation.setRegionId(regionId); + vehicleViolation.setRegionName(regionName); + // 获取违法日期 + Timestamp wfsj = jsonObject.getTimestamp("wfsj"); + LocalDateTime vehicleIllegalTime = LocalDateTimeUtil.of(wfsj); + vehicleViolation.setViolationDate(vehicleIllegalTime); + // 获取违法地址 + String wfdz = jsonObject.getString("wfdz"); + + // 获取违法行为 + String wfxw = jsonObject.getString("wfxw"); + // 如果是闯红灯 + if (VIOLATION_TRAFFIC_LIGHTS_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.RED_LIGHT.getCode()); + vehicleViolation.setAddressRedLight(wfdz); + } else if (NO_DRIVING_LICENSE_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.MISS_CERT.getCode()); + vehicleViolation.setMissingCertificateType(MissCertEnum.DRIVER_LINCENSE.getCode()); + } else if (NO_VEHICLE_LICENSE_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.MISS_CERT.getCode()); + vehicleViolation.setMissingCertificateType(MissCertEnum.DRIVE_PERMIT.getCode()); + } else if (VIOLATION_TIME_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.PERIOD.getCode()); + int hour = vehicleIllegalTime.getHour(); + String period = null; + if (hour >= TaskConstant.Data.VIOLATION_TIME_SEVEN && hour <= TaskConstant.Data.VIOLATION_TIME_NINE) { + period = TaskConstant.Data.VIOLATION_TIME_AM_START + StrPool.DASH + + TaskConstant.Data.VIOLATION_TIME_AM_END; + vehicleViolation.setViolationPeriod(period); + } else if (hour >= TaskConstant.Data.VIOLATION_TIME_SIXTEEN + && hour <= TaskConstant.Data.VIOLATION_TIME_EIGHTEEN) { + period = TaskConstant.Data.VIOLATION_TIME_PM_START + StrPool.DASH + + TaskConstant.Data.VIOLATION_TIME_PM_END; + vehicleViolation.setViolationPeriod(period); + } + } else if (VIOLATION_ROAD_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.SECTION.getCode()); + vehicleViolation.setWaySection(wfdz); + } + // 获取当事人(驾驶员) + String driverName = jsonObject.getString("dsr"); + // 根据车牌号获取企业信息 + NdVehicleBaseInfo vehicleBaseInfo = vehiclesCacheHelper.getByCarPlate(hphm); + Long companyId = vehicleBaseInfo.getCompanyId(); + vehicleBaseInfo.setCompanyId(companyId); + // 驾驶员姓名和企业名称获取驾驶员信息 + List driverInfoList = driverInfoService.list(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getDriverName, driverName).eq(DriverInfo::getCompanyId, companyId)); + if (CollUtil.isEmpty(driverInfoList)) { + log.info("该车牌号对应的企业下没有该驾驶员信息"); + } else { + // 获取最后一个 + DriverInfo driverInfo = driverInfoList.get(driverInfoList.size() - 1); + vehicleViolation.setDriverId(driverInfo.getId()); + } + vehicleViolation.setDriverName(driverName); + vehicleViolationService.save(vehicleViolation); + } + } + return "更新完成"; + + } + + private ThreadPoolTaskExecutor getThreadPoolTaskExecutor() { + return (ThreadPoolTaskExecutor)defaultAsyncTaskConfig.getAsyncExecutor(); + } + + @Async + @Transactional + public void accidentQueryDataSave() throws InterruptedException { + String key = "ACCIDENT_QUERY_DATA_SAVE"; + if (!distributedLock.lock(key, BIG_EXPIRE_TIME)) { + log.warn("正在执行中:{}", key); + return; + } + try { + List carPlateList = getAccidentQueryCarPlateList(); + if (CollUtil.isEmpty(carPlateList)) { + log.info("本月事故数据已更新完成!"); + return; + } + // 调用IRS接口,返回数据 + ThreadPoolTaskExecutor executor = getThreadPoolTaskExecutor(); + List> partition = ListUtil.partition(carPlateList, GROUP_SIZE); + CountDownLatch cdl = new CountDownLatch(partition.size()); + List>> futures = partition.stream().map(w -> executor.submit(() -> { + List tmpList = new ArrayList<>(); + for (String carPlate : w) { + try { + tmpList.addAll(getVehicleAccidentByCarPlate(carPlate)); + } catch (Exception e) { + log.info("获取车辆违法信息异常:{}", carPlate); + } + } + cdl.countDown(); + return tmpList; + })).collect(Collectors.toList()); + cdl.await(); + List irsData = collectResultByFutureTasks(futures); + ListUtil.partition(irsData, GROUP_SIZE).forEach(accidentIrsDataService::saveBatch); + log.info("共插入了:{} {} 条数据", key, irsData.size()); + } finally { + distributedLock.releaseLock(key); + } + } + + private static List collectResultByFutureTasks(List>> futureTasks) { + List irsData = new ArrayList<>(); + futureTasks.forEach(w -> { + try { + irsData.addAll(w.get()); + } catch (Exception e) { + log.warn("本组数据为空"); + } + }); + return irsData; + } + + private List getAccidentQueryCarPlateList() { + // 获取此次任务要查询的车牌号 + List result = new ArrayList<>(); + List carPlateList; + String key = TaskConstant.RedisKey.ACCIDENT_QUERY_IRS; + List objectList = redisOps.get(key); + // 存储的车牌号为空 + if (CollUtil.isEmpty(objectList)) { + List carPlates = getCarPlates(); + // 将所有车牌号存入redis缓存中 + carPlates.stream().limit(QUERY_SIZE).forEach(result::add); + if (carPlates.size() > result.size()) { + carPlates.removeAll(result); + redisOps.lPush(key, carPlates); + } + } else { + // 每次获取缓存中的2000个车牌号 + List tmpCarPlates = redisOps.lRange(key, 0, (QUERY_SIZE - 1)); + if (CollUtil.isNotEmpty(tmpCarPlates)) { + result = CollUtils.convert(tmpCarPlates, Object::toString); + // 删除取出的数据 + redisOps.lRem(key, 0, result); + } + } + return result; + } + + private List getVehicleIllegalCarPlateList(List carPlates) { + // 获取此次任务要查询的车牌号 + List carPlateList = Lists.newArrayList(); + + CacheKey cacheKey = new CacheKey(TaskConstant.RedisKey.VEHICLE_ILLEGAL_QUERY_IRS, Duration.ofDays(20)); + Object object = redisOps.get(cacheKey, false); + // key不存在(过期) + if (Objects.isNull(object)) { + // 将所有车牌号存入redis缓存中 + redisOps.sAdd(cacheKey, carPlates); + } + + // 获取redis中的所有数据 + List objectList = redisOps.lRange(cacheKey.getKey(), 0, -1); + + // key未过期且车牌号已经查询完成 + if (Objects.nonNull(object) && CollUtil.isEmpty(objectList)) { + return Collections.emptyList(); + } else if (Objects.nonNull(object) && CollUtil.isNotEmpty(objectList)) { + // 每次获取缓存中的2000个车牌号 + List range = redisOps.lRange(cacheKey.getKey(), 0, (QUERY_SIZE - 1)); + carPlateList = range.stream().map(Object::toString).collect(Collectors.toList()); + // 去除已经取出的数据,仅保留第2000条之后的数据 + if (objectList.size() > QUERY_SIZE) { + redisOps.lTrim(cacheKey.getKey(), QUERY_SIZE, -1); + } else { + // 数据全部取出后,删除key + redisOps.del(cacheKey); + } + } + return carPlateList; + } + + private List getVehicleAccidentByCarPlate(String carPlate) { + String dataJsonStr = accidentService.accidentQuery(carPlate); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + List array = JSON.parseArray(data, String.class); + if (CollUtil.isEmpty(array)) { + log.info("该车牌号没有事故信息!"); + return Collections.emptyList(); + } + List irsData = new ArrayList<>(); + for (String datas : array) { + if (StrUtil.isNotBlank(datas)) { + List accidentArray = JSON.parseArray(datas, JSONObject.class); + if (CollUtil.isEmpty(accidentArray)) { + log.info("该车牌号没有事故信息!"); + continue; + } + for (JSONObject jsonObject : accidentArray) { + VehicleAccidentIrsData accidentIrsData = new VehicleAccidentIrsData(); + accidentIrsData.setCarPlate(carPlate); + accidentIrsData.setJsonStrData(datas); + // 获取事故日期 + Timestamp sgfssj = jsonObject.getTimestamp("SGFSSJ"); + LocalDateTime accidentTime = LocalDateTimeUtil.of(sgfssj); + accidentIrsData.setAccidentTime(accidentTime); + accidentIrsData.setCreateOn(LocalDateTime.now()); + accidentIrsData.setUpdateOn(LocalDateTime.now()); + irsData.add(accidentIrsData); + } + } + } + return irsData; + } + + @Async + @Transactional + public void vehicleIllegalDataSave() throws InterruptedException { + String key = "VEHICLE_ILLEGAL_DATA_SAVE"; + if (!distributedLock.lock(key, BIG_EXPIRE_TIME)) { + log.warn("正在执行中:{}", key); + return; + } + try { + // 获取此次任务要查询的车牌号 + List carPlateList = getVehicleIllegalCarPlateList(getCarPlates()); + if (CollUtil.isEmpty(carPlateList)) { + log.info("本月车辆违法数据已更新完成!"); + return; + } + // 调用IRS接口,返回数据 + ThreadPoolTaskExecutor executor = getThreadPoolTaskExecutor(); + List> partition = ListUtil.partition(carPlateList, GROUP_SIZE); + CountDownLatch cdl = new CountDownLatch(partition.size()); + List>> futures = partition.stream().map(w -> executor.submit(() -> { + List tmpList = new ArrayList<>(); + for (String carPlate : w) { + try { + tmpList.addAll(getVehicleIllegalByCarPlate(carPlate)); + } catch (Exception e) { + log.info("获取车辆违法信息异常:{}", carPlate); + } + } + cdl.countDown(); + return tmpList; + })).collect(Collectors.toList()); + cdl.await(); + List irsData = collectResultByFutureTasks(futures); + ListUtil.partition(irsData, GROUP_SIZE).forEach(violationIrsDataService::saveBatch); + log.info("共插入了:{} {} 条数据", key, irsData.size()); + } finally { + distributedLock.releaseLock(key); + } + } + + private List getCarPlates() { + LambdaQueryWrapper query = Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .select(NdVehicleBaseInfo::getCarPlate).isNotNull(NdVehicleBaseInfo::getCarPlate); + HashSet carPlateSet = new HashSet<>(); + // 获取去重后的车辆信息 + List list = vehicleBaseInfoService.list(query).stream() + .filter(v -> carPlateSet.add(v.getCarPlate())).collect(Collectors.toList()); + // 获取所有车牌号 + List carPlates = CollUtils.fieldList(list, NdVehicleBaseInfo::getCarPlate); + return carPlates; + } + + private List getVehicleIllegalByCarPlate(String carPlate) { + String dataJsonStr = carService.vehicleIllegalQuery(carPlate); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + List array = JSON.parseArray(data, JSONObject.class); + if (CollUtil.isEmpty(array)) { + log.info("该车牌号没有违法行为信息!"); + return Collections.emptyList(); + } + List irsData = new ArrayList<>(); + for (JSONObject jsonObject : array) { + if (Objects.nonNull(jsonObject)) { + VehicleViolationIrsData vid = new VehicleViolationIrsData(); + vid.setCarPlate(carPlate); + // 获取违法日期 + Timestamp wfsj = jsonObject.getTimestamp("wfsj"); + LocalDateTime vehicleIllegalTime = LocalDateTimeUtil.of(wfsj); + vid.setViolationTime(vehicleIllegalTime); + vid.setJsonStrData(data); + String wfxw = jsonObject.getString("wfxw"); + vid.setViolationType(wfxw); + String cfzl = jsonObject.getString("cfzl"); + vid.setViolationKind(cfzl); + vid.setCreateOn(LocalDateTime.now()); + vid.setUpdateOn(LocalDateTime.now()); + irsData.add(vid); + } + } + return irsData; + } + + public void accidentQueryDataSingleSave() { + List carPlateList = getAccidentQueryCarPlateList(); + if (CollUtil.isEmpty(carPlateList)) { + log.info("本月事故数据已更新完成!"); + return; + } + + // 调用IRS接口,返回数据 + // 访问计数 + int count = 0; + for (String carPlate : carPlateList) { + String dataJsonStr = accidentService.accidentQuery(carPlate); + count++; + log.info("已访问事故查询IRS接口 {} 次", count); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + List array = JSON.parseArray(data, String.class); + if (CollUtil.isEmpty(array)) { + log.info("该车牌号没有事故信息!"); + continue; + } + // 获取车牌号的所有事故信息 + Map> accidentIrsDataMap = accidentIrsDataService.list().stream() + .collect(Collectors.groupingBy(VehicleAccidentIrsData::getCarPlate)); + for (String datas : array) { + if (StrUtil.isNotBlank(datas)) { + List accidentArray = JSON.parseArray(datas, JSONObject.class); + if (CollUtil.isEmpty(accidentArray)) { + log.info("该车牌号没有事故信息!"); + continue; + } + + for (JSONObject jsonObject : accidentArray) { + VehicleAccidentIrsData accidentIrsData = new VehicleAccidentIrsData(); + accidentIrsData.setCarPlate(carPlate); + accidentIrsData.setJsonStrData(datas); + // 获取事故日期 + Timestamp sgfssj = jsonObject.getTimestamp("SGFSSJ"); + LocalDateTime accidentTime = LocalDateTimeUtil.of(sgfssj); + if (accidentIrsDataMap.containsKey(carPlate)) { + List dataList = accidentIrsDataMap.get(carPlate); + Map dataMap = dataList.stream() + .collect(Collectors.toMap(VehicleAccidentIrsData::getAccidentTime, v -> v)); + if (dataMap.containsKey(accidentTime)) { + VehicleAccidentIrsData irsData = dataMap.get(accidentTime); + // 数据已经存在 + accidentIrsData.setId(irsData.getId()); + } + } + accidentIrsData.setAccidentTime(accidentTime); + accidentIrsData.setCreateOn(LocalDateTime.now()); + accidentIrsData.setUpdateOn(LocalDateTime.now()); + accidentIrsDataService.saveOrUpdate(accidentIrsData); + } + } + } + } + } + + public void singleSave() throws FileNotFoundException { + + List list = new ArrayList<>(); + Set set = new HashSet<>(); + + File directory = new File(""); + //临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "irs"; + File f = new File( filePath + File.separator + "事故查询车牌号.xlsx"); + Workbook wb = readExcel(new FileInputStream(f), f.getName()); + Row row = null; + if (wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + //获取最大列数 + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + // 车牌号 + String carPlate = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + list.add(carPlate); + } + } + + // 去重 + List carPlateList = list.stream() + .filter(set::add) + .collect(Collectors.toList()); + + // 调用IRS接口,返回数据 + // 访问计数 + int count = 0; + for (String carPlate : carPlateList) { + String dataJsonStr = accidentService.accidentQuery(carPlate); + count++; + log.info("已访问事故查询IRS接口 {} 次", count); + log.info("此次访问的事故车牌号为 {}",carPlate); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + List array = JSON.parseArray(data, String.class); + if (CollUtil.isEmpty(array)) { + log.info("该车牌号没有事故信息!"); + continue; + } + // 获取车牌号的所有事故信息 + Map> accidentIrsDataMap = accidentIrsDataService.list().stream() + .collect(Collectors.groupingBy(VehicleAccidentIrsData::getCarPlate)); + for (String datas : array) { + if (StrUtil.isNotBlank(datas)) { + List accidentArray = JSON.parseArray(datas, JSONObject.class); + if (CollUtil.isEmpty(accidentArray)) { + log.info("该车牌号没有事故信息!"); + continue; + } + + for (JSONObject jsonObject : accidentArray) { + VehicleAccidentIrsData accidentIrsData = new VehicleAccidentIrsData(); + accidentIrsData.setCarPlate(carPlate); + String jsonString = jsonObject.toJSONString(); + accidentIrsData.setJsonStrData(jsonString); + // 获取事故日期 + Timestamp sgfssj = jsonObject.getTimestamp("SGFSSJ"); + LocalDateTime accidentTime = LocalDateTimeUtil.of(sgfssj); + + if (accidentIrsDataMap.containsKey(carPlate)) { + List dataList = accidentIrsDataMap.get(carPlate); + Map dataMap = dataList.stream() + .collect(Collectors.toMap(v -> v.getCarPlate() + v.getAccidentTime(),v -> v)); + String key = accidentTime + carPlate; + if (dataMap.containsKey(key)) { + VehicleAccidentIrsData irsData = dataMap.get(key); + // 数据已经存在 + accidentIrsData.setId(irsData.getId()); + } + } + accidentIrsData.setAccidentTime(accidentTime); + accidentIrsData.setCreateOn(LocalDateTime.now()); + accidentIrsData.setUpdateOn(LocalDateTime.now()); + accidentIrsDataService.saveOrUpdate(accidentIrsData); + } + } + } + } + } + + //这个下面是单独函数 + public static Workbook readExcel(InputStream is, String extString) { + Workbook wb = null; + extString = extString.substring(extString.lastIndexOf(".")); + try { + if (".xls".equals(extString)) { + return wb = new HSSFWorkbook(is); + } else if (".xlsx".equals(extString)) { + return wb = new XSSFWorkbook(is); + } else { + return wb = null; + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wb; + } + + public void illegalDataSingleSave() throws FileNotFoundException { + List list = new ArrayList<>(); + Set set = new HashSet<>(); + + File directory = new File(""); + //临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "irs"; + File f = new File( filePath + File.separator + "车辆违法车牌号.xlsx"); + Workbook wb = readExcel(new FileInputStream(f), f.getName()); + Row row = null; + if (wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + //获取最大列数 + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + // 车牌号 + String carPlate = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + list.add(carPlate); + } + } + + // 去重 + List carPlateList = list.stream() + .filter(set::add) + .collect(Collectors.toList()); + + // 调用IRS接口,返回数据 + // 访问计数 + int count = 0; + for (String carPlate : carPlateList) { + String dataJsonStr = carService.vehicleIllegalQuery(carPlate); + log.info("获取到的数据为:" + dataJsonStr); + count++; + log.info("已访问车辆违法查询IRS接口 {} 次", count); + log.info("此次访问的违法车牌号为 {}",carPlate); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + log.info("data为:" + data); + List array = JSON.parseArray(data, JSONObject.class); + if (CollUtil.isEmpty(array)) { + log.info("该车牌号没有违法行为信息!"); + continue; + } + // 获取车牌号的所有违章信息 + Map> violationIrsDataMap = violationIrsDataService.list().stream() + .collect(Collectors.groupingBy(VehicleViolationIrsData::getCarPlate)); + + for (JSONObject jsonObject : array) { + if (Objects.nonNull(jsonObject)) { + VehicleViolationIrsData vid = new VehicleViolationIrsData(); + vid.setCarPlate(carPlate); + // 获取违法日期 + Timestamp wfsj = jsonObject.getTimestamp("wfsj"); + LocalDateTime vehicleIllegalTime = LocalDateTimeUtil.of(wfsj); + + String wfxw = jsonObject.getString("wfxw"); + vid.setViolationType(wfxw); + + if (violationIrsDataMap.containsKey(carPlate)) { + List dataList = violationIrsDataMap.get(carPlate); + // 对集合进行去重 + HashSet hashSet = new HashSet<>(); + List violationIrsDataList = dataList.stream() + .filter(d -> hashSet.add(d.getCarPlate() + d.getViolationTime() + d.getViolationType())) + .collect(Collectors.toList()); + Map dataMap = violationIrsDataList.stream() + .collect(Collectors.toMap(v -> v.getCarPlate() + v.getViolationTime() + v.getViolationType(),v -> v)); + String key = carPlate + vehicleIllegalTime + wfxw; + if (dataMap.containsKey(key)) { + VehicleViolationIrsData irsData = dataMap.get(key); + // 数据已经存在 + vid.setId(irsData.getId()); + } + } + vid.setViolationTime(vehicleIllegalTime); + String jsonStr = jsonObject.toJSONString(); + vid.setJsonStrData(jsonStr); + String cfzl = jsonObject.getString("cfzl"); + vid.setViolationKind(cfzl); + vid.setCreateOn(LocalDateTime.now()); + vid.setUpdateOn(LocalDateTime.now()); + violationIrsDataService.saveOrUpdate(vid); + } + } + } + } + + // 保存不重复的车牌号到数据库中 + public void carPlateSave() { + LambdaQueryWrapper query = Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .select(NdVehicleBaseInfo::getCarPlate).isNotNull(NdVehicleBaseInfo::getCarPlate); + HashSet carPlateSet = new HashSet<>(); + // 获取去重后的车辆信息 + List list = vehicleBaseInfoService.list(query).stream() + .filter(v -> carPlateSet.add(v.getCarPlate())).collect(Collectors.toList()); + // 获取所有车牌号 + List carPlates = CollUtils.fieldList(list, NdVehicleBaseInfo::getCarPlate); + + List tempList = carPlates.stream().map(c -> { + IrsTempCarplate tempCarPlate = new IrsTempCarplate(); + tempCarPlate.setCarPlate(c); + return tempCarPlate; + }).collect(Collectors.toList()); + irsTempCarplateService.saveBatch(tempList); + } + + + // 日志分析 + public void logSave() { + // 关键词 + String keyword = "此次访问的车牌号为"; + + try (BufferedReader reader = new BufferedReader(new FileReader("C:\\Users\\CMM\\Desktop\\0515\\info.log")); + BufferedWriter writer = new BufferedWriter(new FileWriter("C:\\Users\\CMM\\Desktop\\0515\\output.log"))) { + String line; + while ((line = reader.readLine()) != null) { + if (line.matches(".*" + keyword + ".*")) { + // 获取指定内容在行中的起始位置 + int startIndex = line.indexOf("为"); + // 截取指定内容及其后面的内容 + String extractedContent = line.substring(startIndex + 1); + // 将截取的内容写入输出文件 + writer.write(extractedContent); + // 换行 + writer.newLine(); + } + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + //// 关键词 + //String keyword = "此次访问的违法车牌号为"; + // + //try (BufferedReader reader = new BufferedReader(new FileReader("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\0517\\info.log")); + // BufferedWriter writer = new BufferedWriter(new FileWriter("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\0517\\output.log"))) { + // String line; + // while ((line = reader.readLine()) != null) { + // if (line.matches(".*" + keyword + ".*")) { + // // 获取指定内容在行中的起始位置 + // int startIndex = line.indexOf("为"); + // // 截取指定内容及其后面的内容 + // String extractedContent = line.substring(startIndex + 1); + // // 将截取的内容写入输出文件 + // writer.write(extractedContent); + // // 换行 + // writer.newLine(); + // } + // } + //} catch (IOException e) { + // e.printStackTrace(); + //} + LocalDateTime startTime = LocalDateTimeUtil.parse(NdDateUtils.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); + LocalDateTime endTime = LocalDateTimeUtil.parse(NdDateUtils.format(LocalDateTime.now().plusMinutes(1), DatePattern.NORM_DATETIME_MINUTE_PATTERN), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); + System.out.println(startTime); + System.out.println(endTime); + + } + + /** + * 从IRS事故数据表中更新数据到车辆事故数据表中 + * @return void + * @author CMM + * @since 2023/05/16 10:26 + */ + public void updateAccidentData() { + + // 从IRS事故数据表中更新数据到车辆事故数据表中 + Map> listMap = + accidentIrsDataService.list().stream().collect(Collectors.groupingBy(VehicleAccidentIrsData::getCarPlate)); + + // 获取车牌号 + Set carPlateList = + accidentIrsDataService.list().stream().map(VehicleAccidentIrsData::getCarPlate).collect(Collectors.toSet()); + + // 获取车辆基本信息 + List vehicleBaseInfos = vehicleBaseInfoService + .list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class).in(NdVehicleBaseInfo::getCarPlate, carPlateList)); + Map vehicleBaseInfoMap = + vehicleBaseInfos.stream().collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + // 获取企业信息 + Map companyMap = + companyService.list().stream().collect(Collectors.toMap(Company::getId, c -> c)); + + // 获取已经存在的事故数据 + List accidentTmpVas = vehicleAccidentService + .list(Wrappers.lambdaQuery(NdVehicleAccident.class).in(NdVehicleAccident::getCarPlate, carPlateList)); + Map accidentMap = accidentTmpVas.stream() + .collect(Collectors.collectingAndThen( + Collectors.toCollection(() -> new TreeSet<>( + Comparator.comparing(a -> a.getCarPlate() + StrPool.SEMICOLON + a.getAccidentTime()))), + ArrayList::new)) + .stream().collect(Collectors.toMap(d -> d.getCarPlate() + d.getAccidentTime(), d -> d)); + + // 获取已经存在的死亡事故数据 + List deadAccidentTmpVas = vehicleAccidentDeadService.list( + Wrappers.lambdaQuery(NdVehicleAccidentDead.class).in(NdVehicleAccidentDead::getCarPlate, carPlateList)); + Map deadAccidentMap = deadAccidentTmpVas.stream() + .collect(Collectors.collectingAndThen( + Collectors.toCollection(() -> new TreeSet<>( + Comparator.comparing(a -> a.getCarPlate() + StrPool.SEMICOLON + a.getAccidentTime()))), + ArrayList::new)) + .stream().collect(Collectors.toMap(d -> d.getCarPlate() + d.getAccidentTime(), d -> d)); + + for (String carPlate : carPlateList) { + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoMap.get(carPlate); + + //if (Objects.isNull(vehicleBaseInfo)) { + // log.info("该车牌号不在系统中!"); + // continue; + //} + //// 查出对应车牌号关联的责任驾驶员 + // String driverName = vehicleBaseInfo.getResponsibleDriverFirst(); + // + // if (Objects.isNull(driverName)) { + // log.info("该车牌号没有责任驾驶员!"); + // continue; + // } + + Long companyId = null; + Company company = null; + if (Objects.nonNull(vehicleBaseInfo)) { + companyId = vehicleBaseInfo.getCompanyId(); + company = companyMap.get(companyId); + } + + // 获取IRS事故数据 + List accidentIrsDataList = listMap.get(carPlate); + + for (VehicleAccidentIrsData accidentIrsData : accidentIrsDataList) { + // 解析获取事故时间等信息 + String jsonStrData = accidentIrsData.getJsonStrData(); + JSONObject jsonObject = JSON.parseObject(jsonStrData); + + // 获取行政区划 + String xzqh = jsonObject.getString("XZQH"); + // 获取区域信息 + Long regionId = regionsCacheHelper.getIdByCode(xzqh); + String regionName = regionsCacheHelper.getDisplayName(regionId); + // 获取事故地点 + String sgdd = jsonObject.getString("SGDD"); + // 获取车辆类型 + Integer vehicleType = null; + if (Objects.nonNull(vehicleBaseInfo)) { + vehicleType = vehicleBaseInfo.getVehicleType(); + } + // 获取受伤人数 + Integer ssrs = jsonObject.getInteger("SSRS"); + // 获取事故日期 + Timestamp sgfssj = jsonObject.getTimestamp("SGFSSJ"); + LocalDateTime accidentTime = LocalDateTimeUtil.of(sgfssj); + // 获取简要案情 + String jyaq = jsonObject.getString("JYAQ"); + // 获取事故编号 + String sgbh = jsonObject.getString("SGBH"); + // 获取经纬度电子坐标 + String dzzb = jsonObject.getString("DZZB"); + String longitude = null; + String latitude = null; + if (StringUtils.isNotBlank(dzzb) && dzzb.contains(StrPool.COMMA)) { + String[] split = dzzb.split(StrPool.COMMA); + Double longitudeD = Double.valueOf(split[0]); + Double latitudeD = Double.valueOf(split[1]); + DecimalFormat df = new DecimalFormat("#.###"); + longitude = df.format(longitudeD); + latitude = df.format(latitudeD); + } else { + // 交管事故数据未上传经纬度坐标,从当天的GPS数据中根据车牌号和事故时间查询经纬度 + LocalDateTime startTime = LocalDateTimeUtil.parse( + NdDateUtils.format(accidentTime, DatePattern.NORM_DATETIME_MINUTE_PATTERN), + DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); + LocalDateTime endTime = LocalDateTimeUtil.parse( + NdDateUtils.format(accidentTime.plusMinutes(1), DatePattern.NORM_DATETIME_MINUTE_PATTERN), + DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); + // 如果跨天了就设置相同地查询边界 + if (!NdDateUtils.format(startTime, DatePattern.NORM_DATE_PATTERN) + .equals(NdDateUtils.format(endTime, DatePattern.NORM_DATE_PATTERN))) { + endTime = startTime; + } + + List vehiclePositionInfos; + try { + vehiclePositionInfos = iVehiclePositionInfoService.dynamicGpsTableHistorySearch(carPlate, + accidentTime, endTime, NdDateUtils.format(startTime, "yyyy_MM_dd")); + if (CollUtil.isNotEmpty(vehiclePositionInfos)) { + VehiclePositionInfo positionInfo; + List positionInfoList = vehiclePositionInfos.stream() + .filter(v -> v.getUpdateTime().equals(accidentTime)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(positionInfoList)) { + positionInfo = positionInfoList.get(0); + } else { + // 没有时间完全一样的GPS数据,就取第一个 + positionInfo = vehiclePositionInfos.get(0); + } + longitude = String.valueOf(positionInfo.getCarLongitude()); + latitude = String.valueOf(positionInfo.getCarLatitude()); + } + } catch (Exception e) { + // GPS数据中查询不到数据(GPS表可能被删除) + log.error(e.getMessage()); + } + } + + // 获取当场、24小时、3日内、7日内、30日内死亡人数 + Integer swrs = Objects.nonNull(jsonObject.getInteger("SWRS")) ? jsonObject.getInteger("SWRS") : 0; + Integer swrs24 = Objects.nonNull(jsonObject.getInteger("SWRS24")) ? jsonObject.getInteger("SWRS24") : 0; + Integer swrs3 = Objects.nonNull(jsonObject.getInteger("SWRS3")) ? jsonObject.getInteger("SWRS3") : 0; + Integer swrs7 = Objects.nonNull(jsonObject.getInteger("SWRS7")) ? jsonObject.getInteger("SWRS7") : 0; + Integer swrs30 = Objects.nonNull(jsonObject.getInteger("SWRS30")) ? jsonObject.getInteger("SWRS30") : 0; + // 有死亡人数,再插入到死亡事故表中 + if (swrs != 0 || swrs24 != 0 || swrs3 != 0 || swrs7 != 0 || swrs30 != 0) { + // 插入数据到死亡事故表中 + NdVehicleAccidentDead accidentDead = new NdVehicleAccidentDead(); + // 判断是否已经插入过 + if (deadAccidentMap.containsKey(carPlate + accidentTime)) { + NdVehicleAccidentDead dead = deadAccidentMap.get(carPlate + accidentTime); + accidentDead.setId(dead.getId()); + } + if (swrs30 != 0) { + accidentDead.setDeathToll(swrs30); + } else if (swrs7 != 0) { + accidentDead.setDeathToll(swrs7); + } else if (swrs3 != 0) { + accidentDead.setDeathToll(swrs3); + } else if (swrs24 != 0) { + accidentDead.setDeathToll(swrs24); + } else { + accidentDead.setDeathToll(swrs); + } + accidentDead.setInjuries(ssrs); + accidentDead.setRegionId(regionId); + accidentDead.setRegionName(regionName); + // 获取事故时间 + accidentDead.setAccidentTime(accidentTime); + accidentDead.setAccidentAddress(sgdd); + // 装配车牌号、事故驾驶员、企业名称 + accidentDead.setCarPlate(carPlate); + // accidentDead.setAccidentDriver(driverName); + accidentDead.setCompanyId(companyId); + if (Objects.nonNull(company)) { + accidentDead.setCompanyName(company.getName()); + } + // 是否上报默认为未上报 + accidentDead.setReportStatus(VehicleAccidentReportStatusEnum.UNDER_REPORT.getCode()); + accidentDead.setBriefCase(jyaq); + accidentDead.setAccidentNo(sgbh); + accidentDead.setLongitude(longitude); + accidentDead.setLatitude(latitude); + vehicleAccidentDeadService.saveOrUpdate(accidentDead); + } + // 插入到事故表中 + NdVehicleAccident accident = new NdVehicleAccident(); + // 判断事故类型 + if (swrs != 0 || swrs24 != 0 || swrs3 != 0 || swrs7 != 0 || swrs30 != 0){ + accident.setAccidentType(AccidentTypeEnum.DEAD.getCode()); + } else if (Objects.nonNull(ssrs) && ssrs > 0) { + accident.setAccidentType(AccidentTypeEnum.INJURY.getCode()); + }else { + accident.setAccidentType(AccidentTypeEnum.OTHER.getCode()); + } + // 获取已经存在的事故信息 + NdVehicleAccident vehicleAccident = accidentMap.get(carPlate + accidentTime); + // 获取事故时间 + if (accidentMap.containsKey(carPlate + accidentTime)) { + accident.setId(vehicleAccident.getId()); + } + accident.setInjuries(ssrs); + if (swrs30 != 0) { + accident.setDeathToll(swrs30); + } else if (swrs7 != 0) { + accident.setDeathToll(swrs7); + } else if (swrs3 != 0) { + accident.setDeathToll(swrs3); + } else if (swrs24 != 0) { + accident.setDeathToll(swrs24); + } else { + accident.setDeathToll(swrs); + } + accident.setRegionId(regionId); + accident.setRegionName(regionName); + // 获取事故时间 + accident.setAccidentTime(accidentTime); + accident.setAccidentAddress(sgdd); + // 装配车牌号、事故驾驶员、车辆类型、企业名称 + accident.setCarPlate(carPlate); + + // accident.setAccidentDriver(driverName); + accident.setVehicleType(vehicleType); + accident.setCompanyId(companyId); + if (Objects.nonNull(company)) { + accident.setCompanyName(company.getName()); + } + // 是否上报默认为未上报 + accident.setReportStatus(VehicleAccidentReportStatusEnum.UNDER_REPORT.getCode()); + accident.setBriefCase(jyaq); + accident.setAccidentNo(sgbh); + accident.setLongitude(longitude); + accident.setLatitude(latitude); + vehicleAccidentService.saveOrUpdate(accident); + } + } + log.info("事故数据更新完成!"); + } + + public void updateViolationData() { + Map map = violationIrsDataService + .list(Wrappers.lambdaQuery(VehicleViolationIrsData.class) + .select(VehicleViolationIrsData::getId, VehicleViolationIrsData::getViolationType)) + .stream() + .collect(Collectors.toMap(VehicleViolationIrsData::getId, VehicleViolationIrsData::getViolationType)); + + List violationIdList = map.keySet().stream().filter(c -> { + String type = map.get(c); + return NO_DRIVING_LICENSE_LIST.contains(type) || NO_VEHICLE_LICENSE_LIST.contains(type) + || VIOLATION_TRAFFIC_LIGHTS_LIST.contains(type) || VIOLATION_TIME_LIST.contains(type) + || VIOLATION_ROAD_LIST.contains(type); + }).collect(Collectors.toList()); + + // 获取需要更新的数据 + Map> listMap = + violationIrsDataService.list(Wrappers.lambdaQuery(VehicleViolationIrsData.class) + .select(VehicleViolationIrsData::getId,VehicleViolationIrsData::getCarPlate, + VehicleViolationIrsData::getJsonStrData)) + .stream().filter(v -> violationIdList.contains(v.getId())) + .collect(Collectors.groupingBy(VehicleViolationIrsData::getCarPlate)); + + // 获取车牌号 + Set carPlateList = listMap.keySet(); + // 过滤掉不在系统中的车牌号 + List carPlates = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class).select(NdVehicleBaseInfo::getCarPlate)); + List carPlateLists = carPlateList.stream().filter(carPlates::contains).collect(Collectors.toList()); + // 违章数据的车牌号都不在系统中,不需要更新 + if (CollUtil.isEmpty(carPlateLists)){ + log.info("没有需要更新的数据!"); + return; + } + // 获取车辆基本信息 + List vehicleBaseInfos = vehicleBaseInfoService + .list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .select(NdVehicleBaseInfo::getCarPlate,NdVehicleBaseInfo::getCompanyId) + .in(NdVehicleBaseInfo::getCarPlate, carPlateLists)); + Map vehicleBaseInfoMap = + vehicleBaseInfos.stream().collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + // 获取企业信息 + Map companyMap = + companyService.list().stream().collect(Collectors.toMap(Company::getId, c -> c)); + + // 获取已经存在的违章数据 + List violationTmpVas = vehicleViolationService + .list(Wrappers.lambdaQuery(NdVehicleViolation.class).in(NdVehicleViolation::getCarPlate, carPlateLists)); + Map violationMap = violationTmpVas.stream() + .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(a -> a.getCarPlate() + + StrPool.SEMICOLON + a.getViolationDate() + StrPool.SEMICOLON + a.getViolationType()))), ArrayList::new)) + .stream().collect(Collectors.toMap(d -> d.getCarPlate() + d.getViolationDate() + d.getViolationType() + d.getViolationAddress(), d -> d)); + + for (String carPlate : carPlateLists) { + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoMap.get(carPlate); + + Long companyId = vehicleBaseInfo.getCompanyId(); + Company company = null; + if (Objects.nonNull(companyId)) { + company = companyMap.get(companyId); + } + + // 获取IRS违章数据 + List violationIrsDataList = listMap.get(carPlate); + + for (VehicleViolationIrsData violationIrsData : violationIrsDataList) { + + // 解析获取事故时间等信息 + String jsonStrData = violationIrsData.getJsonStrData(); + JSONObject jsonObject = JSON.parseObject(jsonStrData); + + NdVehicleViolation vehicleViolation = new NdVehicleViolation(); + + // 获取违法日期 + Timestamp wfsj = jsonObject.getTimestamp("wfsj"); + LocalDateTime vehicleIllegalTime = LocalDateTimeUtil.of(wfsj); + vehicleViolation.setViolationDate(vehicleIllegalTime); + // 获取违法地址 + String wfdz = jsonObject.getString("wfdz"); + // 获取违法行为 + String wfxw = jsonObject.getString("wfxw"); + // 获取违法编号 + String wfbh = jsonObject.getString("wfbh"); + + // 获取经纬度 + String longitude = jsonObject.getString("jd"); + String latitude = jsonObject.getString("wd"); + + // 判断是否已经插入过 + String key = carPlate + vehicleIllegalTime + wfdz + wfxw; + if (violationMap.containsKey(key)) { + NdVehicleViolation violation = violationMap.get(key); + vehicleViolation.setId(violation.getId()); + } + vehicleViolation.setCarPlate(carPlate); + // 获取行政区划 + String xzqh = jsonObject.getString("xzqh"); + // 获取区域信息 + Long regionId = regionsCacheHelper.getIdByCode(xzqh); + String regionName = regionsCacheHelper.getDisplayName(regionId); + vehicleViolation.setRegionId(regionId); + vehicleViolation.setRegionName(regionName); + // 如果是闯红灯 + if (VIOLATION_TRAFFIC_LIGHTS_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.RED_LIGHT.getCode()); + vehicleViolation.setAddressRedLight(wfdz); + } else if (NO_DRIVING_LICENSE_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.MISS_CERT.getCode()); + vehicleViolation.setMissingCertificateType(MissCertEnum.DRIVER_LINCENSE.getCode()); + } else if (NO_VEHICLE_LICENSE_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.MISS_CERT.getCode()); + vehicleViolation.setMissingCertificateType(MissCertEnum.DRIVE_PERMIT.getCode()); + } else if (VIOLATION_TIME_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.PERIOD.getCode()); + int hour = vehicleIllegalTime.getHour(); + int minute = vehicleIllegalTime.getMinute(); + String period = null; + // 时间段暂时设置为违章时间所在小时的前后半小时 + if (minute < 30) { + period = vehicleIllegalTime.minusHours(1).getHour() + TaskConstant.Data.VIOLATION_TIME_HALF + + StrPool.DASH + hour + TaskConstant.Data.VIOLATION_TIME_HALF; + } else { + period = hour + TaskConstant.Data.VIOLATION_TIME_START + StrPool.DASH + + vehicleIllegalTime.plusHours(1).getHour() + TaskConstant.Data.VIOLATION_TIME_START; + } + vehicleViolation.setViolationPeriod(period); + // if (hour >= TaskContant.Data.VIOLATION_TIME_SEVEN && hour <= + // TaskContant.Data.VIOLATION_TIME_NINE) { + // period = TaskContant.Data.VIOLATION_TIME_AM_START + StrPool.DASH + // + TaskContant.Data.VIOLATION_TIME_AM_END; + // vehicleViolation.setViolationPeriod(period); + // } else if (hour >= TaskContant.Data.VIOLATION_TIME_SIXTEEN + // && hour <= TaskContant.Data.VIOLATION_TIME_EIGHTEEN) { + // period = TaskContant.Data.VIOLATION_TIME_PM_START + StrPool.DASH + // + TaskContant.Data.VIOLATION_TIME_PM_END; + // vehicleViolation.setViolationPeriod(period); + // } + } else if (VIOLATION_ROAD_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.SECTION.getCode()); + vehicleViolation.setWaySection(wfdz); + } + // 获取当事人(驾驶员) + String driverName = jsonObject.getString("dsr"); + + vehicleViolation.setCompanyId(companyId); + if (Objects.nonNull(company)) { + vehicleViolation.setCompanyName(company.getName()); + } + // 驾驶员姓名和企业名称获取驾驶员信息 + List driverInfoList = driverInfoService.list(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getDriverName, driverName).eq(DriverInfo::getCompanyId, companyId)); + if (CollUtil.isEmpty(driverInfoList)) { + log.info("该车牌号对应的企业下没有该驾驶员信息"); + } else { + // 获取最后一个 + DriverInfo driverInfo = driverInfoList.get(driverInfoList.size() - 1); + vehicleViolation.setDriverId(driverInfo.getId()); + } + vehicleViolation.setDriverName(driverName); + vehicleViolation.setLongitude(longitude); + vehicleViolation.setLatitude(latitude); + vehicleViolation.setViolationNo(wfbh); + vehicleViolation.setViolationAddress(wfdz); + vehicleViolationService.saveOrUpdate(vehicleViolation); + } + } + log.info("违章数据更新完成!"); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/manage/IrsDriversLicenseManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/manage/IrsDriversLicenseManage.java new file mode 100644 index 0000000..df4f5bd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/manage/IrsDriversLicenseManage.java @@ -0,0 +1,284 @@ +package com.ningdatech.carapi.irs.manage; + +import static com.ningdatech.carapi.irs.service.AbstractLicenseGetByIrsService.DELAY_MINUTES; + +import java.io.*; +import java.sql.Timestamp; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import javax.annotation.PostConstruct; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.google.common.collect.Lists; +import com.ningdatech.carapi.irs.entity.DriversLicenseRaw; +import com.ningdatech.carapi.irs.service.DriverService; +import com.ningdatech.carapi.irs.service.IDriversLicenseRawService; +import com.ningdatech.carapi.irs.service.PullLicenseByIrsService; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.IdcardUtil; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * IrsLicensePullTask + *

+ * + * @author WendyYang + * @since 2023/5/16 + **/ +@Component +@Slf4j +public class IrsDriversLicenseManage { + + + private final PullLicenseByIrsService driverLicenseGetService; + private final PullLicenseByIrsService drivingLicenseGetService; + private final DriverService driverService; + private final IDriversLicenseRawService driversLicenseRawService; + + + public IrsDriversLicenseManage(@Qualifier("drivingLicensePullByIrsService") PullLicenseByIrsService driverLicenseGetService, + @Qualifier("drivingLicensePullByIrsService") PullLicenseByIrsService drivingLicenseGetService, + DriverService driverService, + IDriversLicenseRawService driversLicenseRawService) { + this.driverLicenseGetService = driverLicenseGetService; + this.drivingLicenseGetService = drivingLicenseGetService; + this.driverService = driverService; + this.driversLicenseRawService = driversLicenseRawService; + } + + @PostConstruct + public void initTask() { + driverLicenseGetService.initPullLicenseTask(); + drivingLicenseGetService.initPullLicenseTask(); + } + + public void submitDriverLicensePullTask() { + driverLicenseGetService.startPullLicenseTask(DELAY_MINUTES); + } + + public void submitDrivingLicensePullTask() { + drivingLicenseGetService.startPullLicenseTask(DELAY_MINUTES); + } + + public void vehicleLicenseSingleSave() { + List list = new ArrayList<>(); + Set set = new HashSet<>(); + + File directory = new File(""); + //临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "irs"; + File f = new File( filePath + File.separator + "行驶证身份证号.xlsx"); + Workbook wb = null; + try { + wb = readExcel(new FileInputStream(f), f.getName()); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + Row row = null; + if (wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + //获取最大列数 + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + // 身份证号 + String idCard = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + list.add(idCard); + } + } + + // 去重并校验身份证号 + List idCardList = list.stream() + .filter(set::add) + .filter(IdcardUtil::isValidCard) + .collect(Collectors.toList()); + + // 调用IRS接口,返回数据 + // 访问计数 + int count = 0; + for (String idCard : idCardList) { + String dataJsonStr = driverService.vehicleLicenseQuery(idCard); + count++; + log.info("已访问行驶证查询IRS接口 {} 次", count); + log.info("此次访问的行驶证身份证号为 {}",idCard); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + List array = JSON.parseArray(data, JSONObject.class); + if (CollUtil.isEmpty(array)) { + log.info("该身份证号没有行驶证信息!"); + continue; + } + // 获取身份证号的所有行驶证信息 + Map> drivingLicenseMap = driversLicenseRawService.list().stream() + .collect(Collectors.groupingBy(DriversLicenseRaw::getIdcard)); + + for (JSONObject jsonObject : array) { + if (Objects.nonNull(jsonObject)) { + // 获取发证日期,判断是否重复 + Timestamp fZRQ = jsonObject.getTimestamp("fZRQ"); + + List driversLicenseRaws = drivingLicenseMap.get(idCard); + + List licenseRaws = Lists.newArrayList(); + if (CollUtil.isNotEmpty(driversLicenseRaws)) { + licenseRaws = driversLicenseRaws.stream().filter(d -> { + String detail = d.getDrivingLicenseDetail(); + JSONObject json = JSON.parseObject(detail, JSONObject.class); + Timestamp timestamp = json.getTimestamp("fZRQ"); + if (timestamp.equals(fZRQ)) { + return true; + } else { + return false; + } + }).collect(Collectors.toList()); + } + // 保存新增的行驶证信息 + if (CollUtil.isNotEmpty(licenseRaws)) { + DriversLicenseRaw driversLicenseRaw = new DriversLicenseRaw(); + driversLicenseRaw.setIdcard(idCard); + String jsonString = jsonObject.toJSONString(); + driversLicenseRaw.setDrivingLicenseDetail(jsonString); + driversLicenseRaw.setCreateOn(LocalDateTime.now()); + driversLicenseRaw.setUpdateOn(LocalDateTime.now()); + driversLicenseRawService.save(driversLicenseRaw); + } + + } + } + } + } + + public void drivingLicenseSingleSave() { + List list = new ArrayList<>(); + Set set = new HashSet<>(); + + File directory = new File(""); + //临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "irs"; + File f = new File( filePath + File.separator + "驾驶证身份证号.xlsx"); + Workbook wb = null; + try { + wb = readExcel(new FileInputStream(f), f.getName()); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + Row row = null; + if (wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + //获取最大列数 + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + // 身份证号 + String idCard = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + list.add(idCard); + } + } + + // 去重并校验身份证号 + List idCardList = list.stream() + .filter(set::add) + .filter(IdcardUtil::isValidCard) + .collect(Collectors.toList()); + + // 调用IRS接口,返回数据 + // 访问计数 + int count = 0; + for (String idCard : idCardList) { + String dataJsonStr = driverService.vehicleLicenseQuery(idCard); + count++; + log.info("已访问驾驶证查询IRS接口 {} 次", count); + log.info("此次访问的驾驶证身份证号为 {}",idCard); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + List array = JSON.parseArray(data, JSONObject.class); + if (CollUtil.isEmpty(array)) { + log.info("该身份证号没有驾驶证信息!"); + continue; + } + // 获取身份证号的所有驾驶证信息 + Map> drivingLicenseMap = driversLicenseRawService.list().stream() + .collect(Collectors.groupingBy(DriversLicenseRaw::getIdcard)); + + for (JSONObject jsonObject : array) { + if (Objects.nonNull(jsonObject)) { + // 获取发证日期,判断是否重复 + Timestamp fZRQ = jsonObject.getTimestamp("fZRQ"); + + List driversLicenseRaws = drivingLicenseMap.get(idCard); + List licenseRaws = Lists.newArrayList(); + if (CollUtil.isNotEmpty(driversLicenseRaws)) { + licenseRaws = driversLicenseRaws.stream().filter(d -> { + String detail = d.getDriverLicenseDetail(); + JSONObject json = JSON.parseObject(detail, JSONObject.class); + Timestamp timestamp = json.getTimestamp("fZRQ"); + if (timestamp.equals(fZRQ)) { + return true; + } else { + return false; + } + }).collect(Collectors.toList()); + } + // 保存新增的驾驶证信息 + if (CollUtil.isNotEmpty(licenseRaws)) { + DriversLicenseRaw driversLicenseRaw = new DriversLicenseRaw(); + driversLicenseRaw.setIdcard(idCard); + String jsonString = jsonObject.toJSONString(); + driversLicenseRaw.setDriverLicenseDetail(jsonString); + driversLicenseRaw.setCreateOn(LocalDateTime.now()); + driversLicenseRaw.setUpdateOn(LocalDateTime.now()); + driversLicenseRawService.save(driversLicenseRaw); + } + } + } + } + } + + //这个下面是单独函数 + public static Workbook readExcel(InputStream is, String extString) { + Workbook wb = null; + extString = extString.substring(extString.lastIndexOf(".")); + try { + if (".xls".equals(extString)) { + return wb = new HSSFWorkbook(is); + } else if (".xlsx".equals(extString)) { + return wb = new XSSFWorkbook(is); + } else { + return wb = null; + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wb; + } + + public List vehicleLicenseTest() { + return driverService.vehicleLicenseTest(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/manage/SmsManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/manage/SmsManage.java new file mode 100644 index 0000000..ec6b723 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/manage/SmsManage.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.irs.manage; + +import com.ningdatech.carapi.irs.service.SmsService; +import com.ningdatech.carapi.open.model.dto.UserLoginDTO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * @Classname SmsManage + * @Description 短信通 + * @Date 2023/3/1 16:53 + * @Author PoffyZhang + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class SmsManage { + + private final SmsService service; + public String sendSmsCode(String mobile, String verificationCode) { + return service.sendSmsCode(mobile,verificationCode); + } + + public String getCode(UserLoginDTO param) { + return service.getCode(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/DriversLicenseMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/DriversLicenseMapper.java new file mode 100644 index 0000000..ed8b23b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/DriversLicenseMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.irs.mapper; + +import com.ningdatech.carapi.irs.entity.DriversLicenseRaw; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author WendyYang + * @since 2023-05-16 + */ +public interface DriversLicenseMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/DriversLicenseMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/DriversLicenseMapper.xml new file mode 100644 index 0000000..13e9548 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/DriversLicenseMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/IrsTempCarplateMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/IrsTempCarplateMapper.java new file mode 100644 index 0000000..3712f22 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/IrsTempCarplateMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.irs.mapper; + +import com.ningdatech.carapi.irs.model.entity.IrsTempCarplate; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-05-15 + */ +public interface IrsTempCarplateMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/IrsTempCarplateMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/IrsTempCarplateMapper.xml new file mode 100644 index 0000000..2709044 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/IrsTempCarplateMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/VehicleAccidentIrsDataMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/VehicleAccidentIrsDataMapper.java new file mode 100644 index 0000000..c4bc416 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/VehicleAccidentIrsDataMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.irs.mapper; + +import com.ningdatech.carapi.irs.model.entity.VehicleAccidentIrsData; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-05-12 + */ +public interface VehicleAccidentIrsDataMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/VehicleAccidentIrsDataMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/VehicleAccidentIrsDataMapper.xml new file mode 100644 index 0000000..9b7ff59 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/VehicleAccidentIrsDataMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/VehicleViolationIrsDataMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/VehicleViolationIrsDataMapper.java new file mode 100644 index 0000000..3d1353f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/VehicleViolationIrsDataMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.irs.mapper; + +import com.ningdatech.carapi.irs.model.entity.VehicleViolationIrsData; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-05-12 + */ +public interface VehicleViolationIrsDataMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/VehicleViolationIrsDataMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/VehicleViolationIrsDataMapper.xml new file mode 100644 index 0000000..2bd62ae --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/mapper/VehicleViolationIrsDataMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/dto/irs/DriverLicenseDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/dto/irs/DriverLicenseDTO.java new file mode 100644 index 0000000..1ccac7b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/dto/irs/DriverLicenseDTO.java @@ -0,0 +1,81 @@ +package com.ningdatech.carapi.irs.model.dto.irs; + +import lombok.Data; + +/** + *

+ * DriverLicenseDTO + *

+ * + * @author WendyYang + * @since 2023/5/16 + **/ +@Data +@SuppressWarnings("all") +public class DriverLicenseDTO { + + private String sfbd; + private String syyxqz; + private String bzcs; + private String ccfzjg; + private String ryzt; + private String signvalue; + private String zt; + private String dzyx; + private String csrq; + private String signcert; + private String lxzsyzbm; + private String signhashcode; + private String ljjf; + private String syrq; + private String ydabh; + private String hmcd; + private String bz; + private String jbr; + private String zjcx; + private String qfrq; + private String lsh; + private String lxdh; + private String gj; + private String sjhm; + private String lxzsxxdz; + private String xb; + private String xzqj; + private String lxzsxzqh; + private String dabh; + private String yzjcx; + private String xzqh; + private String cclzrq; + private String yxqz; + private String xh; + private String xm; + private String dwbh; + private String gxsj; + private String yxqs; + private String zxbh; + private String fzrq; + private String fzjg; + private String xczg; + private String xxtzrq; + private String djzsxxdz; + private String xzcrq; + private String jzqx; + private String djzsxzqh; + private String sfzmhm; + private String zzzm; + private String cfrq; + private String ly; + private String xczjcx; + private String sqdm; + private String sxqksbj; + private String jxmc; + private String zzfzjg; + private String jly; + private String xgzl; + private String zzfzrq; + private String sxbj; + private String sfzmmc; + private String tong_time; + private String glbm; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/dto/irs/DrivingLicenseDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/dto/irs/DrivingLicenseDTO.java new file mode 100644 index 0000000..3742603 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/dto/irs/DrivingLicenseDTO.java @@ -0,0 +1,153 @@ +package com.ningdatech.carapi.irs.model.dto.irs; + +import lombok.Data; + +/** + *

+ * irs返回行驶证详情 + *

+ * + * @author WendyYang + * @since 2023/5/16 + **/ +@Data +@SuppressWarnings("all") +public class DrivingLicenseDTO { + + private String zbzl; + private String zqyzl; + private String jyw; + private String xnyzl; + private String clyt; + private String djrq; + private String hdwjcd; + private String cdqdxslcds; + private String qzbfqz; + private String zj; + private String llpz1; + private String tnsvalue; + private String fdjrq; + private String signvalue; + private String zzcmc; + private String jkpzhm; + private String zs; + private String zt; + private String llpz2; + private String signcert; + private String signhashcode; + private String zzg; + private String jyhgbzbh; + private String yxh; + private String hpzk; + private String hpzl; + private String zzl; + private String fhgzrq; + private String bpcs; + private String cyry; + private String bz; + private String ccdjrq; + private String hgzbh; + private String zzz; + private String jbr; + private String dzyx; + private String hdzk; + private String gbthps; + private String csys; + private String djzsbh; + private String qpzk; + private String fprq; + private String sjhm; + private String dabh; + private String ncdqsy; + private String xzqh; + private String yxqz; + private String ccrq; + private String dybj; + private String cnzzzl; + private String wxmbc; + private String bdjcs; + private String dphgzbh; + private String dzbsxlh; + private String hpqysj; + private String cnzzxs; + private String sfxny; + private String hdzzl; + private String sfzmhm; + private String xsrq; + private String syqsrq; + private String xsjg; + private String hxnbcd; + private String sqdm; + private String fdjh; + private String yzbm2; + private String yzbm1; + private String qmbh; + private String xgzl; + private String ltgg; + private String zdjzshs; + private String tong_time; + private String cwkc; + private String cnzzzdy; + private String bzcs; + private String bxzzrq; + private String hxnbkd; + private String cnzzdtdy; + private String ytsx; + private String clsbdh; + private String xsdw; + private String hdfs; + private String cwkk; + private String cwkg; + private String zxxs; + private String xszbh; + private String nszm; + private String qlj; + private String nszmbh; + private String clly; + private String cllx; + private String lsh; + private String lxdh; + private String zsxxdz; + private String gl; + private String yqjyqz2; + private String syq; + private String hbdbqk; + private String syr; + private String xh; + private String gcjk; + private String pzbh1; + private String yqjyqzbfqz; + private String pzbh2; + private String clxh; + private String dwbh; + private String zsxzqh; + private String qddjxh; + private String jkpz; + private String hmbh; + private String pl; + private String fzrq; + private String hphm; + private String clpp1; + private String zdyzt; + private String fzjg; + private String clpp2; + private String gxrq; + private String fdjxh; + private String fdjgs; + private String hlj; + private String lts; + private String sfyzhgn; + private String qddjgl; + private String zzjglx; + private String cdqdxslcgk; + private String zzxzqh; + private String hxnbgd; + private String cnzzzdl; + private String qddjh; + private String rlzl; + private String zzxxdz; + private String syxz; + private String sfzmmc; + private String glbm; + +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/dto/irs/ResponseDataDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/dto/irs/ResponseDataDTO.java new file mode 100644 index 0000000..bdbc85c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/dto/irs/ResponseDataDTO.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.irs.model.dto.irs; + +import lombok.Data; + +import java.util.List; + +/** + *

+ * irs接口返回数据格式 + *

+ * + * @author WendyYang + * @since 2023/5/16 + **/ +@Data +public class ResponseDataDTO { + + private String code; + + private String msg; + + private T data; + + private List datas; + + private int dataCount; + + public boolean succeed() { + return "00".equals(code); + } + +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/entity/IrsTempCarplate.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/entity/IrsTempCarplate.java new file mode 100644 index 0000000..9e0b437 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/entity/IrsTempCarplate.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.irs.model.entity; + +import java.io.Serializable; + +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; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-05-15 + */ +@Data +@TableName("nd_irs_temp_carplate") +@ApiModel(value = "IrsTempCarplate对象", description = "") +public class IrsTempCarplate implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("车牌号") + private String carPlate; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/entity/VehicleAccidentIrsData.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/entity/VehicleAccidentIrsData.java new file mode 100644 index 0000000..12f6ad3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/entity/VehicleAccidentIrsData.java @@ -0,0 +1,98 @@ +package com.ningdatech.carapi.irs.model.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; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-05-12 + */ +@TableName("nd_vehicle_accident_irs_data") +@ApiModel(value = "AccidentIrsData对象", description = "") +public class VehicleAccidentIrsData implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("事故发生时间") + private LocalDateTime accidentTime; + + @ApiModelProperty("irs返回事故数据字符串") + private String jsonStrData; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + public String getCarPlate() { + return carPlate; + } + + public void setCarPlate(String carPlate) { + this.carPlate = carPlate; + } + public LocalDateTime getAccidentTime() { + return accidentTime; + } + + public void setAccidentTime(LocalDateTime accidentTime) { + this.accidentTime = accidentTime; + } + public String getJsonStrData() { + return jsonStrData; + } + + public void setJsonStrData(String jsonStrData) { + this.jsonStrData = jsonStrData; + } + public LocalDateTime getCreateOn() { + return createOn; + } + + public void setCreateOn(LocalDateTime createOn) { + this.createOn = createOn; + } + public LocalDateTime getUpdateOn() { + return updateOn; + } + + public void setUpdateOn(LocalDateTime updateOn) { + this.updateOn = updateOn; + } + + @Override + public String toString() { + return "AccidentIrsData{" + + "id=" + id + + ", carPlate=" + carPlate + + ", accidentTime=" + accidentTime + + ", jsonStrData=" + jsonStrData + + ", createOn=" + createOn + + ", updateOn=" + updateOn + + "}"; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/entity/VehicleViolationIrsData.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/entity/VehicleViolationIrsData.java new file mode 100644 index 0000000..dfd57d6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/model/entity/VehicleViolationIrsData.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.irs.model.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-05-12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName("nd_vehicle_violation_irs_data") +@ApiModel(value = "VehicleViolationIrsData对象", description = "") +public class VehicleViolationIrsData implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆违章时间") + private LocalDateTime violationTime; + + @ApiModelProperty("irs返回车辆违章数据字符串") + private String jsonStrData; + + @ApiModelProperty("车辆违章类型") + private String violationType; + + @ApiModelProperty("车辆违章种类") + private String violationKind; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/AbstractLicenseGetByIrsService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/AbstractLicenseGetByIrsService.java new file mode 100644 index 0000000..0c9ae6e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/AbstractLicenseGetByIrsService.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.irs.service; + +import com.ningdatech.cache.redis.RedisOps; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.client.RestTemplate; + +import java.util.Map; +import java.util.concurrent.*; + +/** + *

+ * AbstractLicenseGetByIrsService + *

+ * + * @author WendyYang + * @since 2023/5/16 + **/ +@RequiredArgsConstructor +public abstract class AbstractLicenseGetByIrsService { + + protected final IDriverInfoService driverInfoService; + protected final RestTemplate restTemplate; + protected final RefreshKeyService refreshKeyService; + protected final RedisOps redisOps; + protected final IDriversLicenseRawService driversLicenseRawService; + + public static final String RK_DRIVER_LICENSE = "DRIVER_LICENSE_IRS"; + public static final String RK_DRIVING_LICENSE = "DRIVING_LICENSE_IRS"; + + protected static final int LIMIT_BY_DAY = 100; + + // 应用appKey + protected static final String APP_KEY = "A330000100000202105003941"; + protected static final String APP_SECRET = "e07fd4471e92410d9860282d939b1217"; + + protected static final Map> FUTURE_MAP = new ConcurrentHashMap<>(); + public static ScheduledExecutorService scheduler; + + protected static final int MINUTES_DAY = 24 * 60; + protected static final int INIT_DELAY_MINUTES = 5; + + public static final int DELAY_MINUTES = 2; + + /** + * 开启证件信息获取任务 + * + * @param rk 证件类型 + * @param service 证件信息获取实现类 + * @param delayMinutes 延迟执行时间 + */ + protected void startLicensePullTask(String rk, PullLicenseByIrsService service, Integer delayMinutes) { + if (scheduler == null || scheduler.isShutdown()) { + scheduler = Executors.newScheduledThreadPool(2); + } + Future future = scheduler.scheduleAtFixedRate(() -> { + service.pullLicense(); + try { + long leftCnt = service.getLeftCount(); + boolean status = service.runningStatus(); + if (!status && leftCnt == 0) { + Future self = FUTURE_MAP.remove(rk); + if (self != null && !self.isCancelled()) { + self.cancel(true); + } + if (FUTURE_MAP.isEmpty()) { + scheduler.shutdown(); + } + } + } catch (Exception e) { + throw new RuntimeException(e); + } + }, delayMinutes, MINUTES_DAY, TimeUnit.MINUTES); + FUTURE_MAP.put(rk, future); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/AccidentService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/AccidentService.java new file mode 100644 index 0000000..3a58ec1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/AccidentService.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.irs.service; + +import java.util.List; + +public interface AccidentService { + + List getAccident(); + + List accidentQuery(); + + /** + * 根据车牌号查询IRS数据 + * @param hphm + * @return + */ + String accidentQuery(String hphm); + + String accidentQuery(String hphm,Integer index); + + String getAccident(String sgbh); + + String updateAccident(); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/CarService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/CarService.java new file mode 100644 index 0000000..b1f9011 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/CarService.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.irs.service; + +/** + * CarService + * @author CMM + * @since 2023/04/23 15:20 + */ +public interface CarService { + + String vehicleIllegalQuery(); + + /** + * 根据号牌号码(车牌号)查询车辆违法数据 + * @param hphm + * @return + */ + String vehicleIllegalQuery(String hphm); + + /** + * 根据号牌号码(车牌号)查询车辆违法数据 + * @param hphm + * @return + */ + String vehicleIllegalQuery(String hphm,Integer index); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/DriverService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/DriverService.java new file mode 100644 index 0000000..1a8c67e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/DriverService.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.irs.service; + +import java.util.List; + +/** + * DriverService + * @author CMM + * @since 2023/05/21 19:01 + */ + +public interface DriverService { + /** + * 根据车牌号查询驾驶员行驶证 + * @return + */ + String vehicleLicenseQuery(String carPlate); + + /** + * 根据车牌号查询驾驶员行驶证 + * @return + */ + String vehicleLicenseQuery(String carPlate,Integer index); + + /** + * 根据身份证号查询驾驶员驾驶证 + * @return + */ + + String drivingLicenseQuery(String idCard); + + List vehicleLicenseTest(); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/FilePreviewService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/FilePreviewService.java new file mode 100644 index 0000000..a01e761 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/FilePreviewService.java @@ -0,0 +1,13 @@ +package com.ningdatech.carapi.irs.service; + +public interface FilePreviewService { + /** + * 文件预览 + * @param ext 附件后缀 + * @param remoteUrl 附件下载地址 + * @param markText 自定义水印(false 不显示水印) + * @param upt true 表示强制更新预览(可不传) + * @return + */ + String filePreview(String ext,String remoteUrl,String markText,String upt); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/IDriversLicenseRawService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/IDriversLicenseRawService.java new file mode 100644 index 0000000..4036f62 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/IDriversLicenseRawService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.irs.service; + +import com.ningdatech.carapi.irs.entity.DriversLicenseRaw; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author WendyYang + * @since 2023-05-16 + */ +public interface IDriversLicenseRawService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/IIrsTempCarplateService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/IIrsTempCarplateService.java new file mode 100644 index 0000000..a656c05 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/IIrsTempCarplateService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.irs.service; + +import com.ningdatech.carapi.irs.model.entity.IrsTempCarplate; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-05-15 + */ +public interface IIrsTempCarplateService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/IVehicleAccidentIrsDataService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/IVehicleAccidentIrsDataService.java new file mode 100644 index 0000000..0fdd988 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/IVehicleAccidentIrsDataService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.irs.service; + +import com.ningdatech.carapi.irs.model.entity.VehicleAccidentIrsData; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-05-12 + */ +public interface IVehicleAccidentIrsDataService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/IVehicleViolationIrsDataService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/IVehicleViolationIrsDataService.java new file mode 100644 index 0000000..ded3a38 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/IVehicleViolationIrsDataService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.irs.service; + +import com.ningdatech.carapi.irs.model.entity.VehicleViolationIrsData; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-05-12 + */ +public interface IVehicleViolationIrsDataService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/PullLicenseByIrsService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/PullLicenseByIrsService.java new file mode 100644 index 0000000..b89575b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/PullLicenseByIrsService.java @@ -0,0 +1,49 @@ +package com.ningdatech.carapi.irs.service; + +/** + *

+ * LicensePullService + *

+ * + * @author WendyYang + * @since 2023/5/16 + **/ +public interface PullLicenseByIrsService { + + /** + * 是否正在获取 + * + * @return / + */ + boolean runningStatus(); + + /** + * 剩余待处理数量 + * + * @return / + */ + long getLeftCount(); + + /** + * 调用irs接口获取证件信息 + * + * @param cardId 车牌号 + * @return / + */ + String getLicenseDetail(String cardId); + + /** + * 证件信息获取(设置执行状态) + */ + void pullLicense(); + + /** + * 证件信息获取 + */ + void pullLicenseDetail(); + + void initPullLicenseTask(); + + void startPullLicenseTask(int delayMinutes); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/RefreshKeyService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/RefreshKeyService.java new file mode 100644 index 0000000..a8d18ca --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/RefreshKeyService.java @@ -0,0 +1,15 @@ +package com.ningdatech.carapi.irs.service; + +import com.ningdatech.cache.model.cache.CacheKey; + +public interface RefreshKeyService { + + String refresh(); + + String getRequestSecret(String appKey, String appSecret); + String getRefreshSecret(String appKey, String appSecret); + String refreshSecret(String appKey, String refreshSecret); + + String getRequestSecret(String appKey, String appSecret, CacheKey requestKey, CacheKey refreshKey); + String refreshRequestSecret(String appKey, CacheKey requestKey, CacheKey refreshKey, String refreshSecret); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/SmsService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/SmsService.java new file mode 100644 index 0000000..08659c4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/SmsService.java @@ -0,0 +1,12 @@ +package com.ningdatech.carapi.irs.service; + +import com.ningdatech.carapi.open.model.dto.UserLoginDTO; + +public interface SmsService { + + String sendMessage(String mobile,String content); + + String sendSmsCode(String mobile, String verificationCode); + + String getCode(UserLoginDTO param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/AccidentServieImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/AccidentServieImpl.java new file mode 100644 index 0000000..1590892 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/AccidentServieImpl.java @@ -0,0 +1,806 @@ +package com.ningdatech.carapi.irs.service.impl; + +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.car.position.entity.VehiclePositionInfo; +import com.ningdatech.carapi.car.position.service.IVehiclePositionInfoService; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.irs.model.entity.VehicleAccidentIrsData; +import com.ningdatech.carapi.irs.service.AccidentService; +import com.ningdatech.carapi.irs.service.IVehicleAccidentIrsDataService; +import com.ningdatech.carapi.irs.service.RefreshKeyService; +import com.ningdatech.carapi.irs.utils.Md5Utils; +import com.ningdatech.carapi.safe.constant.AccidentTypeEnum; +import com.ningdatech.carapi.safe.constant.VehicleAccidentReportStatusEnum; +import com.ningdatech.carapi.safe.entity.NdVehicleAccident; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentDead; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentDeadService; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentService; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.file.utils.StrPool; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.util.StrUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname AccidentServieImpl + * @Description + * @Date 2023/3/1 16:58 + * @Author PoffyZhang + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class AccidentServieImpl implements AccidentService { + + private final RestTemplate restTemplate; + private final RefreshKeyService refreshKeyService; + private final INdVehicleAccidentService vehicleAccidentService; + private final INdVehicleAccidentDeadService vehicleAccidentDeadService; + private final CachePlusOps cachePlusOps; + private final IVehicleAccidentIrsDataService accidentIrsDataService; + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final CompanyService companyService; + private final RegionsCacheHelper regionsCacheHelper; + private final IVehiclePositionInfoService iVehiclePositionInfoService; + + @Override + public List getAccident() { + // 应用appKey + String appKey = "A330000100000202105003941"; + // app密钥 + String appSecret = "e07fd4471e92410d9860282d939b1217"; + + // 刷新秘钥 + String requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret); + log.info("requestSecret : {}",requestSecret); + + // 请求签名 + Long requestTime = System.currentTimeMillis(); + String sign = Md5Utils.hash(appKey + requestSecret + requestTime); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/001003007/certificate/4c7ECl4H7xX309J8.htm"; + + // 事故编号 + String sgbh1 = "330783120230000035"; + + List sgbhList = Lists.newArrayList(); + sgbhList.add(sgbh1); + + List resList = Lists.newArrayList(); + for (String sgbh : sgbhList) { + + MultiValueMap map = new LinkedMultiValueMap(); + String projectId = "9000001120230507162550676"; + map.add("appKey", appKey); + map.add("requestTime", requestTime); + map.add("projectId", projectId); + map.add("sgbh", sgbh); + map.add("sign", sign); + map.add("additional", "{}"); + map.add("Organization", "测试部门"); + map.add("Organization_ID", "123123"); + map.add("powerMatters", "12131212"); + map.add("subPowerMatters", "123"); + map.add("User_ID", "11111"); + map.add("User_Name", "sasasa"); + ResponseEntity responseEntity = null; + String res = null; + + try { + log.info("请求参数 :{}", JSON.toJSONString(map)); + res = restTemplate.postForObject(url, map, String.class); + log.info("[RestTemplateTest-事故责任认定书] http request :{}", res); + } catch (Exception e) { + log.error("[RestTemplateTest-事故责任认定书] http request error:" + e); + } + resList.add(res); + } + return resList; + } + + @Override + public List accidentQuery() { + + // 应用appKey + String appKey = "A330000100000202105003941"; + String appSecret = "e07fd4471e92410d9860282d939b1217"; + String innerAppKey = "210a2657177f478c808381deb13a4dac"; + + // 刷新秘钥 + //String requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret); + + String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003007/dataSharing/YT9d9lbynbdwae2a.htm"; + // 获取车牌号的所有事故信息 + Map> accidentIrsDataMap = accidentIrsDataService.list().stream() + .collect(Collectors.groupingBy(VehicleAccidentIrsData::getCarPlate)); + // 车牌号 + //List hphmList = Lists.newArrayList("浙FQ0350", "浙FQ9133", "浙A5W918", "皖CE7498", "浙A08C01", "浙A10B67", + // "浙A2X587", "浙A32C01", "浙A58D51", "浙A5W612", "浙A6T266", "浙A7T769", "浙A87A99", "浙A8V378", + // "浙A8X675", "浙A9W395", "浙C10503", "浙C18690", "浙C29834", "浙C31707", "浙C50774", "浙C52266", + // "浙C60570", "浙CB1067", "浙CD7156", "浙CD9307", "浙CM0185", "浙CM0530", "浙D06281", "浙D21710", + // "浙DE6628", "浙DK8334", "浙DR7626", "浙DS4531", "浙DT9961", "浙DW0280", "浙E22736", "浙E26621", + // "浙E35787", "浙E36017", "浙E61296", "浙E65230", "浙E66392", "浙E68952", "浙E69691", "浙FDJ589", + // "浙FDS332", "浙FG1096", "浙FL9735", "浙FN0693", "浙FN3161", "浙FP2719", "浙FV1233", "浙G26527", + // "浙G56057", "浙G57250", "浙G57322", "浙G59700", "浙G59773", "浙G71275", "浙G72831", "浙G72953", + // "浙G80298", "浙G97198", "浙H22426", "浙JB0993", "浙JB9232", "浙KK3520", "浙KK9576", "浙KM1560", + // "浙A5U783", "浙DJ3611", "浙A6Y375", "浙A6U922", "浙A6W577", "浙E28698", "浙EA7598", "浙E26285", + // "浙FH5719", "浙FQ0535", "浙G95837", "浙G88336", "浙G83080", "浙G83221", "浙KK9580", "浙KF2283", + // "浙J53439", "浙J96011", "浙J36206", "浙JB7869", "浙J21786", "浙JA6561", "浙J02703", "浙CD0103", + // "浙CH9707", "浙CM9758", "浙CL3917", "浙L17121", "浙D05980", "浙J17217", "浙H38803", "浙JA5611", + // "浙DH3577", "浙A32C01", "浙D18098", "浙A3Z386", "浙FAG361", "浙A8V905", "浙A98A65", "浙DV2412", + // "浙D16351", "浙H26806", "浙CL1381", "浙KK7680", "浙J00625", "浙G82887", "浙CJ3879", "浙L26560", + // "浙J36737", "浙A83C69", "浙L23611", "浙A10B22", "浙B0M838", "浙BX9108"); + + //List hphmList = Lists.newArrayList("浙E69638", "浙FN3726", "浙E67275", "浙DJ9937", "浙G27718"); + //List hphmList = Lists.newArrayList("浙A7V557", "浙A37B22", "浙G50189", "浙CH6355", + // "浙A03E89", "浙DS6620"); + List hphmList = Lists.newArrayList("浙A6P887", "浙G63797", "浙J01696", "浙C37222"); + + + // 号牌种类 + String hpzl = "01"; + int cnt = 0; + List resList = Lists.newArrayList(); + String[] carPlates = hphmList.stream().toArray(String[]::new); + for (int i = 0; i < carPlates.length; i++) { + String carPlate = carPlates[i]; + String dataJsonStr; + dataJsonStr = accidentQuery(carPlate,i); + log.info("此次访问的事故车牌号为 {}", carPlate); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + List array = JSON.parseArray(data, String.class); + if (CollUtil.isEmpty(array)) { + log.info("该车牌号没有事故信息!"); + continue; + } + cnt = i + 1; + log.info("已访问事故查询IRS接口 {} 次", cnt); + for (String datas : array) { + if (StrUtil.isNotBlank(datas)) { + List accidentArray = JSON.parseArray(datas, JSONObject.class); + if (CollUtil.isEmpty(accidentArray)) { + log.info("该车牌号没有事故信息!"); + continue; + } + + for (JSONObject jsonObject : accidentArray) { + VehicleAccidentIrsData accidentIrsData = new VehicleAccidentIrsData(); + accidentIrsData.setCarPlate(carPlate); + String jsonString = jsonObject.toJSONString(); + accidentIrsData.setJsonStrData(jsonString); + // 获取事故日期 + Timestamp sgfssj = jsonObject.getTimestamp("SGFSSJ"); + LocalDateTime accidentTime = LocalDateTimeUtil.of(sgfssj); + if (accidentIrsDataMap.containsKey(carPlate)) { + List dataList = accidentIrsDataMap.get(carPlate); + Map dataMap = dataList.stream() + .collect(Collectors.toMap(VehicleAccidentIrsData::getAccidentTime, v -> v)); + if (dataMap.containsKey(accidentTime)) { + VehicleAccidentIrsData irsData = dataMap.get(accidentTime); + // 数据已经存在 + accidentIrsData.setId(irsData.getId()); + } + } + accidentIrsData.setAccidentTime(accidentTime); + accidentIrsData.setCreateOn(LocalDateTime.now()); + accidentIrsData.setUpdateOn(LocalDateTime.now()); + accidentIrsDataService.saveOrUpdate(accidentIrsData); + } + } + } + resList.add(dataJsonStr); + } + + //for (String hphm : hphmList) { + // + // // 请求秘钥 + // CacheKey requestKey = new CacheKey(TaskContant.RedisKey.IRS_ACCIDENT_QUERY_REQUEST_SECRET_TEST); + // // 刷新密钥 + // CacheKey refreshKey = new CacheKey(TaskContant.RedisKey.IRS_ACCIDENT_QUERY_REFRESH_SECRET_TEST); + // // 根据key获取缓存中的请求秘钥和刷新密钥 + // String requestSecret = cachePlusOps.get(requestKey); + // String refreshSecret = cachePlusOps.get(refreshKey); + // + // // 任务第一次调用接口,获取刷新秘钥和请求秘钥,并保存到redis中 + // try { + // if (Objects.nonNull(refreshSecret)) { + // requestSecret = refreshKeyService.refreshRequestSecret(appKey, requestKey, refreshKey, refreshSecret); + // if (requestSecret == null) { + // requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + // } + // } else { + // requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + // } + // } catch (Exception e) { + // log.error("获取刷新密钥失败:{},此次事故查询车牌号为{}", e.getMessage(), hphm); + // return null; + // } + // if (Objects.isNull(refreshSecret)) { + // try { + // requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + // if (requestSecret == null) { + // return null; + // } + // } catch (Exception e) { + // log.error("获取刷新密钥失败:{},此次事故查询车牌号为{}", e.getMessage(), hphm); + // return null; + // } + // } + // // 不是第一次调用,看请求秘钥是否过期 + // // 刷新密钥有效期两天,而定时任务每天都会执行一次,每次任务执行又会更新刷新密钥,所以刷新密钥不会过期 + // // 只需判断请求秘钥是否过期 + // else if (Objects.isNull(requestSecret)) { + // try { + // // 调用IRS刷新秘钥接口,更新刷新密钥和请求秘钥 + // requestSecret = refreshKeyService.refreshRequestSecret(appKey, requestKey, refreshKey, refreshSecret); + // if (requestSecret == null) { + // requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + // } + // } catch (Exception e) { + // log.error("刷新请求密钥失败:{},此次事故查询车牌号为{}", e.getMessage(), hphm); + // return null; + // } + // } + // + // // 请求签名 + // Long requestTime = System.currentTimeMillis(); + // String sign = Md5Utils.hash(appKey + requestSecret + requestTime); + // + // MultiValueMap map = new LinkedMultiValueMap(); + // // 附加信息 + // map.add("additional","{\"powerMatters\":\"许可-0000-00\",\"subPowerMatters\":\"许可-0000-0101\",\"accesscardId\":\"33071918111111784523\"}"); + // map.add("appKey",appKey); + // map.add("requestTime",requestTime); + // map.add("sign",sign); + // map.add("hpzl",hpzl); + // map.add("hphm",hphm); + // String res = null; + // try { + // HttpHeaders headers = new HttpHeaders(); + // headers.add("innerAppKey",innerAppKey); + // HttpEntity httpEntity = new HttpEntity<>(map,headers); + // log.info("请求参数 :{}", JSON.toJSONString(map)); + // res = restTemplate.postForObject(url, httpEntity ,String.class); + // log.info("[RestTemplateTest-事故查询] http request :{}", res); + // } catch (Exception e) { + // log.error("[RestTemplateTest-事故查询] http request error", e); + // } + // resList.add(res); + //} + + // 更新事故数据 + updateAccidentData(); + log.info("更新事故数据完成!"); + String s = resList.toString(); + log.info("查询结果为:" + s); + + return resList; + } + + @Override + public String accidentQuery(String hphm) { + // 应用appKey + String appKey = "A330000100000202105003941"; + String appSecret = "e07fd4471e92410d9860282d939b1217"; + String innerAppKey = "210a2657177f478c808381deb13a4dac"; + String hpzl = "01"; + + // 刷新秘钥 + String requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret); + + // 请求签名 + Long requestTime = System.currentTimeMillis(); + String sign = Md5Utils.hash(appKey + requestSecret + requestTime); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003007/dataSharing/YT9d9lbynbdwae2a.htm"; + + MultiValueMap map = new LinkedMultiValueMap(); + // 附加信息 + map.add("additional","{\"powerMatters\":\"许可-0000-00\",\"subPowerMatters\":\"许可-0000-0101\",\"accesscardId\":\"33071918111111784523\"}"); + map.add("appKey",appKey); + map.add("requestTime",requestTime); + map.add("sign",sign); + map.add("hpzl",hpzl); + map.add("hphm",hphm); + String res = null; + try { + HttpHeaders headers = new HttpHeaders(); + headers.add("innerAppKey",innerAppKey); + HttpEntity httpEntity = new HttpEntity<>(map,headers); + log.info("请求参数 :{}", JSON.toJSONString(map)); + res = restTemplate.postForObject(url, httpEntity ,String.class); + log.info("[RestTemplateTest-事故查询] http request :{}", res); + } catch (Exception e) { + log.error("[RestTemplateTest-事故查询] http request error", e); + } + return res; + } + + @Override + public String accidentQuery(String hphm,Integer index) { + // 应用appKey + String appKey = "A330000100000202105003941"; + String appSecret = "e07fd4471e92410d9860282d939b1217"; + String innerAppKey = "210a2657177f478c808381deb13a4dac"; + String hpzl = "01"; + + // 请求秘钥 + CacheKey requestKey = new CacheKey(TaskConstant.RedisKey.IRS_ACCIDENT_QUERY_REQUEST_SECRET); + // 刷新密钥 + CacheKey refreshKey = new CacheKey(TaskConstant.RedisKey.IRS_ACCIDENT_QUERY_REFRESH_SECRET); + // 根据key获取缓存中的请求秘钥和刷新密钥 + String requestSecret = cachePlusOps.get(requestKey); + String refreshSecret = cachePlusOps.get(refreshKey); + if (index == 0) { + // 任务第一次调用接口,获取刷新秘钥和请求秘钥,并保存到redis中 + try { + if (Objects.nonNull(refreshSecret)){ + requestSecret = refreshKeyService.refreshRequestSecret(appKey, requestKey, refreshKey, refreshSecret); + if (requestSecret == null) { + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + } + }else { + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + } + } catch (Exception e) { + log.error("获取刷新密钥失败:{},此次事故查询车牌号为{}", e.getMessage(), hphm); + return null; + } + } else if (Objects.isNull(refreshSecret)) { + try { + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + if (requestSecret == null) { + return null; + } + } catch (Exception e) { + log.error("获取刷新密钥失败:{},此次事故查询车牌号为{}", e.getMessage(), hphm); + return null; + } + } + // 不是第一次调用,看请求秘钥是否过期 + // 刷新密钥有效期两天,而定时任务每天都会执行一次,每次任务执行又会更新刷新密钥,所以刷新密钥不会过期 + // 只需判断请求秘钥是否过期 + else if (Objects.isNull(requestSecret)) { + try { + // 调用IRS刷新秘钥接口,更新刷新密钥和请求秘钥 + requestSecret = refreshKeyService.refreshRequestSecret(appKey, requestKey, refreshKey, refreshSecret); + if (requestSecret == null) { + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + } + } catch (Exception e) { + log.error("刷新请求密钥失败:{},此次事故查询车牌号为{}", e.getMessage(), hphm); + return null; + } + } + + + // 请求签名 + Long requestTime = System.currentTimeMillis(); + log.info("请求参数中请求秘钥为:" + requestSecret); + String sign = Md5Utils.hash(appKey + requestSecret + requestTime); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003007/dataSharing/YT9d9lbynbdwae2a.htm"; + + MultiValueMap map = new LinkedMultiValueMap(); + // 附加信息 + map.add("additional","{\"powerMatters\":\"许可-0000-00\",\"subPowerMatters\":\"许可-0000-0101\",\"accesscardId\":\"33071918111111784523\"}"); + map.add("appKey",appKey); + map.add("requestTime",requestTime); + map.add("sign",sign); + map.add("hpzl",hpzl); + map.add("hphm",hphm); + HttpHeaders headers = new HttpHeaders(); + headers.add("innerAppKey", innerAppKey); + HttpEntity httpEntity = new HttpEntity<>(map, headers); + log.info("请求参数 :{}", JSON.toJSONString(map)); + String res = restTemplate.postForObject(url, httpEntity, String.class); + log.info("[RestTemplateTest-事故查询] http request :{}", res); + return res; + } + + @Override + public String getAccident(String sgbh) { + // 应用appKey + String appKey = "A330000100000202105003941"; + // app密钥 + String appSecret = "e07fd4471e92410d9860282d939b1217"; + + // 请求秘钥 + CacheKey requestKey = new CacheKey(TaskConstant.RedisKey.IRS_ACCIDENT_DUTY_REQUEST_SECRET); + // 刷新密钥 + CacheKey refreshKey = new CacheKey(TaskConstant.RedisKey.IRS_ACCIDENT_DUTY_REFRESH_SECRET); + // 根据key获取缓存中的请求秘钥和刷新密钥 + String requestSecret = cachePlusOps.get(requestKey); + String refreshSecret = cachePlusOps.get(refreshKey); + + try { + // 不是第一次调用接口,获取刷新秘钥和请求秘钥,并保存到redis中 + if (Objects.nonNull(refreshSecret)) { + requestSecret = refreshKeyService.refreshRequestSecret(appKey, requestKey, refreshKey, refreshSecret); + if (requestSecret == null) { + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + } + } else { + // 第一次调用接口,获取刷新秘钥和请求秘钥,并保存到redis中 + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + } + } catch (Exception e) { + log.error("获取刷新密钥失败:{},此次事故责任认定书事故编号为{}", e.getMessage(), sgbh); + return null; + } + + log.info("requestSecret : {}",requestSecret); + + // 请求签名 + Long requestTime = System.currentTimeMillis(); + String sign = Md5Utils.hash(appKey + requestSecret + requestTime); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/001003007/certificate/4c7ECl4H7xX309J8.htm"; + + MultiValueMap map = new LinkedMultiValueMap(); + String projectId = "9000001120230507162550676"; + map.add("appKey", appKey); + map.add("requestTime", requestTime); + map.add("projectId", projectId); + map.add("sgbh", sgbh); + map.add("sign", sign); + map.add("additional", "{}"); + map.add("Organization", "测试部门"); + map.add("Organization_ID", "123123"); + map.add("powerMatters", "12131212"); + map.add("subPowerMatters", "123"); + map.add("User_ID", "11111"); + map.add("User_Name", "sasasa"); + ResponseEntity responseEntity = null; + String res = null; + + try { + log.info("请求参数 :{}", JSON.toJSONString(map)); + res = restTemplate.postForObject(url, map, String.class); + log.info("[RestTemplateTest-事故责任认定书] http request :{}", res); + } catch (Exception e) { + log.error("[RestTemplateTest-事故责任认定书] http request error:" + e); + } + + return res; + } + + @Override + public String updateAccident() { + // 获取认定内容为空,事故编号不为空的事故数据 + List accidents = vehicleAccidentService.list().stream() + .filter(v -> Objects.nonNull(v.getAccidentNo()) && Objects.isNull(v.getFirmContent())) + .collect(Collectors.toList()); + + // 从车辆死亡事故信息表中获取事故编号 + Map deadAccidentNoMap = vehicleAccidentDeadService.list(Wrappers.lambdaQuery(NdVehicleAccidentDead.class) + .select(NdVehicleAccidentDead::getAccidentNo,NdVehicleAccidentDead::getId)).stream() + // 筛选出事故编号不为空,但没有认定内容的死亡事故数据 + .filter(v -> Objects.nonNull(v.getAccidentNo()) && Objects.isNull(v.getFirmContent())) + .collect(Collectors.toMap(v -> v.getAccidentNo() + StrPool.DASH + v.getCarPlate(),NdVehicleAccidentDead::getId)); + + // 如果有事故编号且都已经有了认定内容,则不运行 + if (CollUtil.isEmpty(accidents)){ + log.info("此次任务数据量为空!"); + return null; + } + + for (NdVehicleAccident accident : accidents) { + String carPlate = accident.getCarPlate(); + String sgbh = accident.getAccidentNo(); + // 获取事故责任认定书返回结果 + String dataJsonStr = getAccident(sgbh); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + // 获取返回数据 + String datas = object.getString("datas"); + JSONObject jsonObject = JSON.parseObject(datas, JSONObject.class); + // 获取结构化数据签名结果 + // 未查询到结果 + if (Objects.isNull(jsonObject)){ + log.info("事故编号{}未查询到事故责任认定书数据",sgbh); + continue; + } + String elcLicenceStruct = jsonObject.getString("ELC_LICENCE_STRUCT"); + JSONObject elcLicenceStructObject = JSON.parseObject(elcLicenceStruct, JSONObject.class); + // 未查询到结果 + if (Objects.isNull(elcLicenceStructObject)){ + log.info("事故编号{}未查询到事故责任认定书数据",sgbh); + continue; + } + // 获取结构化数据 + String data = elcLicenceStructObject.getString("DATA"); + JSONObject dataObject = JSON.parseObject(data, JSONObject.class); + // 未查询到结果 + if (Objects.isNull(dataObject)){ + log.info("事故编号{}未查询到事故责任认定书数据",sgbh); + continue; + } + // 获取认定内容 + String rdnr = dataObject.getString("RDNR"); + // 更新认定内容到车辆事故信息表 + accident.setFirmContent(rdnr); + vehicleAccidentService.updateById(accident); + // 如果是亡人事故,更新认定内容到车辆死亡事故信息表 + String key = sgbh + StrPool.DASH + carPlate; + if (deadAccidentNoMap.containsKey(key)){ + Long deadAccidentId = deadAccidentNoMap.get(key); + NdVehicleAccidentDead deadAccident = vehicleAccidentDeadService.getById(deadAccidentId); + deadAccident.setFirmContent(rdnr); + vehicleAccidentDeadService.updateById(deadAccident); + } + } + return "更新成功"; + } + + /** + * 从IRS事故数据表中更新数据到车辆事故数据表中 + * + * @return void + * @author CMM + * @since 2023/05/16 10:26 + */ + private void updateAccidentData() { + + // 从IRS事故数据表中更新数据到车辆事故数据表中 + Map> listMap = + accidentIrsDataService.list().stream().collect(Collectors.groupingBy(VehicleAccidentIrsData::getCarPlate)); + + // 获取车牌号 + Set carPlateList = + accidentIrsDataService.list().stream().map(VehicleAccidentIrsData::getCarPlate).collect(Collectors.toSet()); + + // 获取车辆基本信息 + List vehicleBaseInfos = vehicleBaseInfoService + .list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class).in(NdVehicleBaseInfo::getCarPlate, carPlateList)); + Map vehicleBaseInfoMap = + vehicleBaseInfos.stream().collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + // 获取企业信息 + Map companyMap = + companyService.list().stream().collect(Collectors.toMap(Company::getId, c -> c)); + + // 获取已经存在的事故数据 + List accidentTmpVas = vehicleAccidentService + .list(Wrappers.lambdaQuery(NdVehicleAccident.class).in(NdVehicleAccident::getCarPlate, carPlateList)); + Map accidentMap = accidentTmpVas.stream() + .collect(Collectors.collectingAndThen( + Collectors.toCollection(() -> new TreeSet<>( + Comparator.comparing(a -> a.getCarPlate() + StrPool.SEMICOLON + a.getAccidentTime()))), + ArrayList::new)) + .stream().collect(Collectors.toMap(d -> d.getCarPlate() + d.getAccidentTime(), d -> d)); + + // 获取已经存在的死亡事故数据 + List deadAccidentTmpVas = vehicleAccidentDeadService.list( + Wrappers.lambdaQuery(NdVehicleAccidentDead.class).in(NdVehicleAccidentDead::getCarPlate, carPlateList)); + Map deadAccidentMap = deadAccidentTmpVas.stream() + .collect(Collectors.collectingAndThen( + Collectors.toCollection(() -> new TreeSet<>( + Comparator.comparing(a -> a.getCarPlate() + StrPool.SEMICOLON + a.getAccidentTime()))), + ArrayList::new)) + .stream().collect(Collectors.toMap(d -> d.getCarPlate() + d.getAccidentTime(), d -> d)); + + for (String carPlate : carPlateList) { + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoMap.get(carPlate); + //if (Objects.isNull(vehicleBaseInfo)) { + // log.info("该车牌号不在系统中!"); + // continue; + //} + //// 查出对应车牌号关联的责任驾驶员 + // String driverName = vehicleBaseInfo.getResponsibleDriverFirst(); + // + // if (Objects.isNull(driverName)) { + // log.info("该车牌号没有责任驾驶员!"); + // continue; + // } + Long companyId = null; + Company company = null; + if (Objects.nonNull(vehicleBaseInfo)) { + companyId = vehicleBaseInfo.getCompanyId(); + company = companyMap.get(companyId); + } + + // 获取IRS事故数据 + List accidentIrsDataList = listMap.get(carPlate); + + for (VehicleAccidentIrsData accidentIrsData : accidentIrsDataList) { + // 解析获取事故时间等信息 + String jsonStrData = accidentIrsData.getJsonStrData(); + JSONObject jsonObject = JSON.parseObject(jsonStrData); + + // 获取行政区划 + String xzqh = jsonObject.getString("XZQH"); + // 获取区域信息 + Long regionId = regionsCacheHelper.getIdByCode(xzqh); + String regionName = regionsCacheHelper.getDisplayName(regionId); + // 获取事故地点 + String sgdd = jsonObject.getString("SGDD"); + // 获取车辆类型 + Integer vehicleType = null; + if (Objects.nonNull(vehicleBaseInfo)) { + vehicleType = vehicleBaseInfo.getVehicleType(); + } + // 获取受伤人数 + Integer ssrs = jsonObject.getInteger("SSRS"); + // 获取事故日期 + Timestamp sgfssj = jsonObject.getTimestamp("SGFSSJ"); + LocalDateTime accidentTime = LocalDateTimeUtil.of(sgfssj); + // 获取简要案情 + String jyaq = jsonObject.getString("JYAQ"); + // 获取事故编号 + String sgbh = jsonObject.getString("SGBH"); + // 获取经纬度电子坐标 + String dzzb = jsonObject.getString("DZZB"); + String longitude = null; + String latitude = null; + if (StringUtils.isNotBlank(dzzb) && dzzb.contains(StrPool.COMMA)) { + String[] split = dzzb.split(StrPool.COMMA); + Double longitudeD = Double.valueOf(split[0]); + Double latitudeD = Double.valueOf(split[1]); + DecimalFormat df = new DecimalFormat("#.###"); + longitude = df.format(longitudeD); + latitude = df.format(latitudeD); + } else { + // 交管事故数据未上传经纬度坐标,从当天的GPS数据中根据车牌号和事故时间查询经纬度 + LocalDateTime startTime = LocalDateTimeUtil.parse( + NdDateUtils.format(accidentTime, DatePattern.NORM_DATETIME_MINUTE_PATTERN), + DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); + LocalDateTime endTime = LocalDateTimeUtil.parse( + NdDateUtils.format(accidentTime.plusMinutes(1), DatePattern.NORM_DATETIME_MINUTE_PATTERN), + DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); + // 如果跨天了就设置相同地查询边界 + if (!NdDateUtils.format(startTime, DatePattern.NORM_DATE_PATTERN) + .equals(NdDateUtils.format(endTime, DatePattern.NORM_DATE_PATTERN))) { + endTime = startTime; + } + + List vehiclePositionInfos; + try { + vehiclePositionInfos = iVehiclePositionInfoService.dynamicGpsTableHistorySearch(carPlate, + accidentTime, endTime, NdDateUtils.format(startTime, "yyyy_MM_dd")); + if (CollUtil.isNotEmpty(vehiclePositionInfos)) { + VehiclePositionInfo positionInfo; + List positionInfoList = vehiclePositionInfos.stream() + .filter(v -> v.getUpdateTime().equals(accidentTime)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(positionInfoList)) { + positionInfo = positionInfoList.get(0); + } else { + // 没有时间完全一样的GPS数据,就取第一个 + positionInfo = vehiclePositionInfos.get(0); + } + longitude = String.valueOf(positionInfo.getCarLongitude()); + latitude = String.valueOf(positionInfo.getCarLatitude()); + } + } catch (Exception e) { + // GPS数据中查询不到数据(GPS表可能被删除) + log.error(e.getMessage()); + } + } + + // 获取当场、24小时、3日内、7日内、30日内死亡人数 + Integer swrs = Objects.nonNull(jsonObject.getInteger("SWRS")) ? jsonObject.getInteger("SWRS") : 0; + Integer swrs24 = Objects.nonNull(jsonObject.getInteger("SWRS24")) ? jsonObject.getInteger("SWRS24") : 0; + Integer swrs3 = Objects.nonNull(jsonObject.getInteger("SWRS3")) ? jsonObject.getInteger("SWRS3") : 0; + Integer swrs7 = Objects.nonNull(jsonObject.getInteger("SWRS7")) ? jsonObject.getInteger("SWRS7") : 0; + Integer swrs30 = Objects.nonNull(jsonObject.getInteger("SWRS30")) ? jsonObject.getInteger("SWRS30") : 0; + // 有死亡人数,再插入到死亡事故表中 + if (swrs != 0 || swrs24 != 0 || swrs3 != 0 || swrs7 != 0 || swrs30 != 0) { + // 插入数据到死亡事故表中 + NdVehicleAccidentDead accidentDead = new NdVehicleAccidentDead(); + // 判断是否已经插入过 + if (deadAccidentMap.containsKey(carPlate + accidentTime)) { + NdVehicleAccidentDead dead = deadAccidentMap.get(carPlate + accidentTime); + accidentDead.setId(dead.getId()); + } + if (swrs30 != 0) { + accidentDead.setDeathToll(swrs30); + } else if (swrs7 != 0) { + accidentDead.setDeathToll(swrs7); + } else if (swrs3 != 0) { + accidentDead.setDeathToll(swrs3); + } else if (swrs24 != 0) { + accidentDead.setDeathToll(swrs24); + } else { + accidentDead.setDeathToll(swrs); + } + accidentDead.setInjuries(ssrs); + accidentDead.setRegionId(regionId); + accidentDead.setRegionName(regionName); + // 获取事故时间 + accidentDead.setAccidentTime(accidentTime); + accidentDead.setAccidentAddress(sgdd); + // 装配车牌号、事故驾驶员、企业名称 + accidentDead.setCarPlate(carPlate); + // accidentDead.setAccidentDriver(driverName); + accidentDead.setCompanyId(companyId); + if (Objects.nonNull(company)) { + accidentDead.setCompanyName(company.getName()); + } + // 是否上报默认为未上报 + accidentDead.setReportStatus(VehicleAccidentReportStatusEnum.UNDER_REPORT.getCode()); + accidentDead.setBriefCase(jyaq); + accidentDead.setAccidentNo(sgbh); + accidentDead.setLongitude(longitude); + accidentDead.setLatitude(latitude); + vehicleAccidentDeadService.saveOrUpdate(accidentDead); + } + // 插入到事故表中 + NdVehicleAccident accident = new NdVehicleAccident(); + // 判断事故类型 + if (swrs != 0 || swrs24 != 0 || swrs3 != 0 || swrs7 != 0 || swrs30 != 0){ + accident.setAccidentType(AccidentTypeEnum.DEAD.getCode()); + } else if (Objects.nonNull(ssrs) && ssrs > 0) { + accident.setAccidentType(AccidentTypeEnum.INJURY.getCode()); + }else { + accident.setAccidentType(AccidentTypeEnum.OTHER.getCode()); + } + // 获取已经存在的事故信息 + NdVehicleAccident vehicleAccident = accidentMap.get(carPlate + accidentTime); + // 获取事故时间 + if (accidentMap.containsKey(carPlate + accidentTime)) { + accident.setId(vehicleAccident.getId()); + } + accident.setInjuries(ssrs); + if (swrs30 != 0) { + accident.setDeathToll(swrs30); + } else if (swrs7 != 0) { + accident.setDeathToll(swrs7); + } else if (swrs3 != 0) { + accident.setDeathToll(swrs3); + } else if (swrs24 != 0) { + accident.setDeathToll(swrs24); + } else { + accident.setDeathToll(swrs); + } + accident.setRegionId(regionId); + accident.setRegionName(regionName); + // 获取事故时间 + accident.setAccidentTime(accidentTime); + accident.setAccidentAddress(sgdd); + // 装配车牌号、事故驾驶员、车辆类型、企业名称 + accident.setCarPlate(carPlate); + + // accident.setAccidentDriver(driverName); + accident.setVehicleType(vehicleType); + accident.setCompanyId(companyId); + if (Objects.nonNull(company)) { + accident.setCompanyName(company.getName()); + } + // 是否上报默认为未上报 + accident.setReportStatus(VehicleAccidentReportStatusEnum.UNDER_REPORT.getCode()); + accident.setBriefCase(jyaq); + accident.setAccidentNo(sgbh); + accident.setLongitude(longitude); + accident.setLatitude(latitude); + vehicleAccidentService.saveOrUpdate(accident); + } + } + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/CarServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/CarServiceImpl.java new file mode 100644 index 0000000..a8eeeb9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/CarServiceImpl.java @@ -0,0 +1,239 @@ +package com.ningdatech.carapi.irs.service.impl; + +import java.time.Duration; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Objects; + +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Service; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import com.alibaba.fastjson.JSON; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.irs.service.CarService; +import com.ningdatech.carapi.irs.service.RefreshKeyService; +import com.ningdatech.carapi.irs.utils.Md5Utils; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/04/23 15:21 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class CarServiceImpl implements CarService { + + private final RestTemplate restTemplate; + private final RefreshKeyService refreshKeyService; + private final CachePlusOps cachePlusOps; + + @Override + public String vehicleIllegalQuery() { + // 应用appKey + String appKey = "A330000100000202105003941"; + String appSecret = "e07fd4471e92410d9860282d939b1217"; + String innerAppKey = "210a2657177f478c808381deb13a4dac"; + // 刷新密钥 + String requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret); + + // 请求签名 + Long requestTime = System.currentTimeMillis(); + String sign = Md5Utils.hash(appKey + requestSecret + requestTime); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003007/dataSharing/Czp71c3856d9gf1a.htm"; + //// 车辆分类 + //String clfl = "abc"; + //// 当事人 -- + //String dsr = "abc"; + //// 号牌号码 -- + //String hphm = "abc"; + //// 号牌种类 + //String hpzl = "abc"; + //// 决定书编号 -- + //String jdsbh = "abc"; + // 驾驶证号 -- + String jszh = "330382198711014059"; + //// 违法编号 -- + //String wfbh = "abc"; + //// 机动车使用性质 + //String syxz = "abc"; + + MultiValueMap map = new LinkedMultiValueMap(); + // 附加信息 + map.add("additional","{\"powerMatters\":\"许可-0000-00\",\"subPowerMatters\":\"许可-0000-0101\",\"accesscardId\":\"33071918111111784523\"}"); + map.add("appKey",appKey); + map.add("requestTime",requestTime); + map.add("sign",sign); + //map.add("dsr",dsr); + //map.add("hphm",hphm); + //map.add("jdsbh",jdsbh); + map.add("jszh",jszh); + //map.add("wfbh",wfbh); + //map.add("hpzl",hpzl); + //map.add("syxz",syxz); + //map.add("clfl",clfl); + String res = null; + try { + HttpHeaders headers = new HttpHeaders(); + headers.add("innerAppKey",innerAppKey); + HttpEntity httpEntity = new HttpEntity<>(map,headers); + log.info("请求参数 :{}", JSON.toJSONString(map)); + res = restTemplate.postForObject(url, httpEntity ,String.class); + log.info("[RestTemplateTest-车辆违法查询] http request :{}", res); + } catch (Exception e) { + log.error("[RestTemplateTest-车辆违法查询] http request error", e); + } + return res; + } + + @Override + public String vehicleIllegalQuery(String hphm) { + // 应用appKey + String appKey = "A330000100000202105003941"; + String appSecret = "e07fd4471e92410d9860282d939b1217"; + String innerAppKey = "210a2657177f478c808381deb13a4dac"; + // 根据传入的时间判断是否需要刷新密钥 + // 刷新密钥 + String requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret); + // 号牌种类 + String hpzl = "01"; + + // 请求签名 + Long requestTime = System.currentTimeMillis(); + String sign = Md5Utils.hash(appKey + requestSecret + requestTime); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003007/dataSharing/Czp71c3856d9gf1a.htm"; + + MultiValueMap map = new LinkedMultiValueMap(); + // 附加信息 + map.add("additional","{\"powerMatters\":\"许可-0000-00\",\"subPowerMatters\":\"许可-0000-0101\",\"accesscardId\":\"33071918111111784523\"}"); + map.add("appKey",appKey); + map.add("requestTime",requestTime); + map.add("sign",sign); + map.add("hphm",hphm); + map.add("hpzl",hpzl); + String res = null; + try { + HttpHeaders headers = new HttpHeaders(); + headers.add("innerAppKey",innerAppKey); + HttpEntity httpEntity = new HttpEntity<>(map,headers); + log.info("请求参数 :{}", JSON.toJSONString(map)); + res = restTemplate.postForObject(url, httpEntity ,String.class); + log.info("[RestTemplateTest-车辆违法查询] http request :{}", res); + } catch (Exception e) { + log.error("[RestTemplateTest-车辆违法查询] http request error", e); + } + return res; + } + + @Override + public String vehicleIllegalQuery(String hphm, Integer index) { + // 应用appKey + String appKey = "A330000100000202105003941"; + String appSecret = "e07fd4471e92410d9860282d939b1217"; + String innerAppKey = "210a2657177f478c808381deb13a4dac"; + + // 请求秘钥 + CacheKey requestKey = new CacheKey(TaskConstant.RedisKey.IRS_VEHICLE_ILLEGAL_REQUEST_SECRET); + // 刷新密钥 + CacheKey refreshKey = new CacheKey(TaskConstant.RedisKey.IRS_VEHICLE_ILLEGAL_REFRESH_SECRET); + // 根据key获取缓存中的请求秘钥和刷新密钥 + String requestSecret = cachePlusOps.get(requestKey); + String refreshSecret = cachePlusOps.get(refreshKey); + if (index == 0) { + // 任务第一次调用接口,获取刷新秘钥和请求秘钥,并保存到redis中 + try { + if (Objects.nonNull(refreshSecret)){ + requestSecret = refreshKeyService.refreshRequestSecret(appKey, requestKey, refreshKey, refreshSecret); + if (requestSecret == null) { + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + } + }else { + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + } + } catch (Exception e) { + log.error("获取刷新密钥失败:{},此次车辆违法查询车牌号为{}", e.getMessage(), hphm); + return null; + } + } + // 如果获取不到刷新密钥,重新生成 + else if (Objects.isNull(refreshSecret)) { + try { + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + if (requestSecret == null) { + return null; + } + } catch (Exception e) { + log.error("获取刷新密钥失败:{},此次车辆违法查询车牌号为{}", e.getMessage(), hphm); + return null; + } + } + // 不是第一次调用,看请求秘钥是否过期 + // 刷新密钥有效期两天,而定时任务每天都会执行一次,每次任务执行又会更新刷新密钥,所以刷新密钥不会过期 + // 只需判断请求秘钥是否过期 + else if (Objects.isNull(requestSecret)) { + try { + // 调用IRS刷新秘钥接口,更新刷新密钥和请求秘钥 + requestSecret = refreshKeyService.refreshRequestSecret(appKey, requestKey, refreshKey, refreshSecret); + if (requestSecret == null) { + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + } + } catch (Exception e) { + log.error("刷新请求密钥失败:{},此次车辆违法查询车牌号为{}", e.getMessage(), hphm); + return null; + } + } + + // 号牌种类 + String hpzl = "01"; + + // 请求签名 + Long requestTime = System.currentTimeMillis(); + log.info("请求参数中请求秘钥为:" + requestSecret); + String sign = Md5Utils.hash(appKey + requestSecret + requestTime); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003007/dataSharing/Czp71c3856d9gf1a.htm"; + + MultiValueMap map = new LinkedMultiValueMap(); + // 附加信息 + map.add("additional","{\"powerMatters\":\"许可-0000-00\",\"subPowerMatters\":\"许可-0000-0101\",\"accesscardId\":\"33071918111111784523\"}"); + map.add("appKey",appKey); + map.add("requestTime",requestTime); + map.add("sign",sign); + map.add("hphm",hphm); + map.add("hpzl",hpzl); + HttpHeaders headers = new HttpHeaders(); + headers.add("innerAppKey", innerAppKey); + HttpEntity httpEntity = new HttpEntity<>(map, headers); + log.info("请求参数 :{}", JSON.toJSONString(map)); + String res = restTemplate.postForObject(url, httpEntity, String.class); + log.info("[RestTemplateTest-车辆违法查询] http request :{}", res); + return res; + } + + public static void main(String[] args) { + // 请求秘钥过期时间 + Long requestSecretEndTime = 1688746680035L; + //Long requestSecretEndTime = 1688574780035L; + // 将时间戳转换为Instant对象 + Instant instant = Instant.ofEpochMilli(requestSecretEndTime); + // 将Instant对象转换为LocalDateTime对象 + LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + int minute = localDateTime.getMinute(); + System.out.println(minute); + System.out.println(localDateTime); + + Duration duration = Duration.between(LocalDateTime.now(), localDateTime); + // 获取相差的小时数 + long hours = duration.toHours(); + + System.out.println("相差的小时数:" + hours); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/DriverServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/DriverServiceImpl.java new file mode 100644 index 0000000..46bc37d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/DriverServiceImpl.java @@ -0,0 +1,234 @@ +package com.ningdatech.carapi.irs.service.impl; + +import java.util.List; +import java.util.Objects; + +import org.springframework.stereotype.Service; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import com.alibaba.fastjson.JSON; +import com.google.common.collect.Lists; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.irs.service.DriverService; +import com.ningdatech.carapi.irs.service.RefreshKeyService; +import com.ningdatech.carapi.irs.utils.Md5Utils; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/04/23 15:21 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class DriverServiceImpl implements DriverService { + + private final RestTemplate restTemplate; + private final RefreshKeyService refreshKeyService; + private final CachePlusOps cachePlusOps; + + @Override + public String vehicleLicenseQuery(String carPlate) { + // 应用appKey + String appKey = "A330000100000202105003941"; + String appSecret = "e07fd4471e92410d9860282d939b1217"; + // 刷新密钥 + String requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret); + + // 请求签名 + Long requestTime = System.currentTimeMillis(); + String sign = Md5Utils.hash(appKey + requestSecret + requestTime); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/001003007/dataSharing/vehicleQmInfo.htm"; + + + MultiValueMap map = new LinkedMultiValueMap(); + // 附加信息 + map.add("additional","{\"powerMatters\":\"许可0000-00\",\"subPowerMatters\":\"许可0000-0101\",\"accesscardId\":\"33071918******784523\",\"materialName\":\"社会团体变更登记申请表\",\"sponsorName\":\"阿里巴巴(中国)有限公司\",\"sponsorCode\":\"91330100799655058B\",\"projectId\":\"330000261711151100004\"}"); + map.add("appKey",appKey); + map.add("requestTime",requestTime); + map.add("sign",sign); + //map.add("sfzmhm",idCard); + map.add("HPHM",carPlate); + String res = null; + try { + log.info("请求参数 :{}", JSON.toJSONString(map)); + res = restTemplate.postForObject(url, map ,String.class); + log.info("[RestTemplateTest-行驶证信息查询] http request :{}", res); + } catch (Exception e) { + log.error("[RestTemplateTest-行驶证信息查询] http request error", e); + } + return res; + } + + @Override + public String vehicleLicenseQuery(String carPlate,Integer index) { + // 应用appKey + String appKey = "A330000100000202105003941"; + String appSecret = "e07fd4471e92410d9860282d939b1217"; + + // 请求秘钥 + CacheKey requestKey = new CacheKey(TaskConstant.RedisKey.IRS_VEHICLE_LICENSE_REQUEST_SECRET); + // 刷新密钥 + CacheKey refreshKey = new CacheKey(TaskConstant.RedisKey.IRS_VEHICLE_LICENSE_REFRESH_SECRET); + + // 根据key获取缓存中的请求秘钥和刷新密钥 + String requestSecret = cachePlusOps.get(requestKey); + String refreshSecret = cachePlusOps.get(refreshKey); + if (index == 0) { + // 任务第一次调用接口,获取刷新秘钥和请求秘钥,并保存到redis中 + try { + if (Objects.nonNull(refreshSecret)){ + requestSecret = refreshKeyService.refreshRequestSecret(appKey, requestKey, refreshKey, refreshSecret); + if (requestSecret == null) { + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + } + }else { + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + } + } catch (Exception e) { + log.error("获取刷新密钥失败:{},此次车辆行驶证查询车牌号为{}", e.getMessage(), carPlate); + return null; + } + } else if (Objects.isNull(refreshSecret)) { + try { + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + if (requestSecret == null) { + return null; + } + } catch (Exception e) { + log.error("获取刷新密钥失败:{},此次车辆行驶证查询车牌号为{}", e.getMessage(), carPlate); + return null; + } + } + // 不是第一次调用,看请求秘钥是否过期 + // 刷新密钥有效期两天,而定时任务每天都会执行一次,每次任务执行又会更新刷新密钥,所以刷新密钥不会过期 + // 只需判断请求秘钥是否过期 + else if (Objects.isNull(requestSecret)) { + try { + // 调用IRS刷新秘钥接口,更新刷新密钥和请求秘钥 + requestSecret = refreshKeyService.refreshRequestSecret(appKey, requestKey, refreshKey, refreshSecret); + if (requestSecret == null) { + requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret, requestKey, refreshKey); + } + } catch (Exception e) { + log.error("刷新请求密钥失败:{},此次车辆行驶证查询车牌号为{}", e.getMessage(), carPlate); + return null; + } + } + + // 请求签名 + Long requestTime = System.currentTimeMillis(); + log.info("请求参数中请求秘钥为:" + requestSecret); + String sign = Md5Utils.hash(appKey + requestSecret + requestTime); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/001003007/dataSharing/vehicleQmInfo.htm"; + + + MultiValueMap map = new LinkedMultiValueMap(); + // 附加信息 + map.add("additional","{\"powerMatters\":\"许可0000-00\",\"subPowerMatters\":\"许可0000-0101\",\"accesscardId\":\"33071918******784523\",\"materialName\":\"社会团体变更登记申请表\",\"sponsorName\":\"阿里巴巴(中国)有限公司\",\"sponsorCode\":\"91330100799655058B\",\"projectId\":\"330000261711151100004\"}"); + map.add("appKey",appKey); + map.add("requestTime",requestTime); + map.add("sign",sign); + //map.add("sfzmhm",idCard); + map.add("HPHM",carPlate); + log.info("请求参数 :{}", JSON.toJSONString(map)); + String res = restTemplate.postForObject(url, map, String.class); + log.info("[RestTemplateTest-行驶证信息查询] http request :{}", res); + return res; + } + + @Override + public String drivingLicenseQuery(String idCard) { + // 应用appKey + String appKey = "A330000100000202105003941"; + String appSecret = "e07fd4471e92410d9860282d939b1217"; + // 刷新密钥 + String requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret); + + // 请求签名 + Long requestTime = System.currentTimeMillis(); + String sign = Md5Utils.hash(appKey + requestSecret + requestTime); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/001003007/dataSharing/driverLicenseInfo.htm"; + + MultiValueMap map = new LinkedMultiValueMap(); + // 附加信息 + map.add("additional","{\"powerMatters\":\"许可-0000-00\",\"subPowerMatters\":\"许可-0000-0101\",\"accesscardId\":\"33071918111111784523\",\"materialName\":\"社会团体变更登记申请表\",\"sponsorName\":\"阿里巴巴(中国)有限公司\",\"sponsorCode\":\"91330100799655058B\",\"projectId\":\"330000261711151100004\"}"); + map.add("appKey",appKey); + map.add("requestTime",requestTime); + map.add("sign",sign); + map.add("cardId",idCard); + String res = null; + try { + log.info("请求参数 :{}", JSON.toJSONString(map)); + res = restTemplate.postForObject(url, map ,String.class); + log.info("[RestTemplateTest-驾驶证查询] http request :{}", res); + } catch (Exception e) { + log.error("[RestTemplateTest-驾驶证查询] http request error", e); + } + return res; + } + + /** + * 根据车架号查询行驶证信息 + * @return java.lang.String + * @author CMM + * @since 2023/05/22 21:23 + */ + @Override + public List vehicleLicenseTest() { + + // 应用appKey + String appKey = "A330000100000202105003941"; + String appSecret = "e07fd4471e92410d9860282d939b1217"; + // 刷新密钥 + String requestSecret = refreshKeyService.getRequestSecret(appKey, appSecret); + + // 请求签名 + Long requestTime = System.currentTimeMillis(); + String sign = Md5Utils.hash(appKey + requestSecret + requestTime); + String url = "https://interface.zjzwfw.gov.cn/gateway/api/001003007/dataSharing/vehicleQmInfo.htm"; + + List cjhList = Lists.newArrayList(); + + //cjhList.add("LZ5N2DE57HB611625"); + //cjhList.add("LZ5N2DE57HB611623"); + //cjhList.add("LZ5N2DE57HB611633"); + //cjhList.add("LZ5N2DE57HB611626"); + //cjhList.add("LZ5N2DE57HB611632"); + //cjhList.add("LZ5N2DE57HB611624"); + + cjhList.add("LUZAGBGA3NA136300"); + cjhList.add("LUZAGBGA7NA168084"); + + //String hphm = "浙C52502"; + //cjhList.add(hphm); + + List resList = Lists.newArrayList(); + for (String cjh : cjhList) { + MultiValueMap map = new LinkedMultiValueMap(); + // 附加信息 + map.add("additional", "{\"powerMatters\":\"许可0000-00\",\"subPowerMatters\":\"许可0000-0101\",\"accesscardId\":\"33071918******784523\",\"materialName\":\"社会团体变更登记申请表\",\"sponsorName\":\"阿里巴巴(中国)有限公司\",\"sponsorCode\":\"91330100799655058B\",\"projectId\":\"330000261711151100004\"}"); + map.add("appKey", appKey); + map.add("requestTime", requestTime); + map.add("sign", sign); + map.add("clsbdh", cjh); + //map.add("HPHM",cjh); + String res = null; + try { + log.info("请求参数 :{}", JSON.toJSONString(map)); + res = restTemplate.postForObject(url, map, String.class); + log.info("[RestTemplateTest-行驶证信息查询] http request :{}", res); + } catch (Exception e) { + log.error("[RestTemplateTest-行驶证信息查询] http request error", e); + } + resList.add(res); + } + return resList; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/DriversLicenseImplRawService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/DriversLicenseImplRawService.java new file mode 100644 index 0000000..933eff3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/DriversLicenseImplRawService.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.irs.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.irs.entity.DriversLicenseRaw; +import com.ningdatech.carapi.irs.mapper.DriversLicenseMapper; +import com.ningdatech.carapi.irs.service.IDriversLicenseRawService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author WendyYang + * @since 2023-05-16 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class DriversLicenseImplRawService extends ServiceImpl implements IDriversLicenseRawService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/FilePreviewServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/FilePreviewServiceImpl.java new file mode 100644 index 0000000..ee305c6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/FilePreviewServiceImpl.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.irs.service.impl; + +import org.springframework.http.MediaType; +import org.springframework.http.RequestEntity; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; + +import com.ningdatech.carapi.irs.service.FilePreviewService; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.client.RestTemplate; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author CMM + * @since 2023/03/07 15:36 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class FilePreviewServiceImpl implements FilePreviewService { + + @Override + public String filePreview(String ext,String remoteUrl,String markText,String upt) { + return null; + } + + + public static void main(String[] args) { + RestTemplate restTemplate = new RestTemplate(); + Map map = new HashMap<>(); + map.put("ext","png"); + map.put("remoteUrl","http://pic37.nipic.com/20140113/9900276_184927469000_2.png"); + map.put("markText","false"); + map.put("upt",null); + ResponseEntity responseEntity = null; + //发送post请求 + RequestEntity> requestEntity = RequestEntity + .post("") + .header("Accept", MediaType.APPLICATION_JSON.toString()) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON) + .body(map); + + try { + responseEntity= restTemplate.exchange(requestEntity,String.class); + } catch (Exception e) { + log.error("[RestTemplateTest-test] http request error", e); + } + + System.out.println(responseEntity.toString()); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/IrsTempCarplateServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/IrsTempCarplateServiceImpl.java new file mode 100644 index 0000000..77aae85 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/IrsTempCarplateServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.irs.service.impl; + +import com.ningdatech.carapi.irs.model.entity.IrsTempCarplate; +import com.ningdatech.carapi.irs.mapper.IrsTempCarplateMapper; +import com.ningdatech.carapi.irs.service.IIrsTempCarplateService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-05-15 + */ +@Service +public class IrsTempCarplateServiceImpl extends ServiceImpl implements IIrsTempCarplateService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/PullDriverLicenseByIrsServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/PullDriverLicenseByIrsServiceImpl.java new file mode 100644 index 0000000..87a71a1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/PullDriverLicenseByIrsServiceImpl.java @@ -0,0 +1,185 @@ +package com.ningdatech.carapi.irs.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.text.StrPool; +import cn.hutool.core.util.IdcardUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.cache.redis.RedisOps; +import com.ningdatech.carapi.common.contants.IrsConst; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.irs.entity.DriversLicenseRaw; +import com.ningdatech.carapi.irs.model.dto.irs.DriverLicenseDTO; +import com.ningdatech.carapi.irs.model.dto.irs.ResponseDataDTO; +import com.ningdatech.carapi.irs.service.AbstractLicenseGetByIrsService; +import com.ningdatech.carapi.irs.service.IDriversLicenseRawService; +import com.ningdatech.carapi.irs.service.PullLicenseByIrsService; +import com.ningdatech.carapi.irs.service.RefreshKeyService; +import com.ningdatech.carapi.irs.utils.Md5Utils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + *

+ * DriverLicensePullServiceImpl + *

+ * + * @author WendyYang + * @since 2023/5/16 + **/ +@Slf4j +@Service("driverLicensePullByIrsService") +public class PullDriverLicenseByIrsServiceImpl extends AbstractLicenseGetByIrsService implements PullLicenseByIrsService { + + public PullDriverLicenseByIrsServiceImpl(IDriverInfoService driverInfoService, + RestTemplate restTemplate, + RefreshKeyService refreshKeyService, + RedisOps redisOps, + IDriversLicenseRawService driversLicenseRawService) { + super(driverInfoService, restTemplate, refreshKeyService, redisOps, driversLicenseRawService); + } + + @Override + public boolean runningStatus() { + String statusKey = RK_DRIVER_LICENSE + StrPool.COLON + "STATUS"; + return Boolean.TRUE.equals(redisOps.exists(statusKey)); + } + + @Override + public long getLeftCount() { + String dataKey = RK_DRIVER_LICENSE + StrPool.COLON + "IDCARD"; + return ObjectUtil.defaultIfNull(redisOps.lLen(dataKey), 0L); + } + + /** + * 获取驾驶证信息 + * + * @param cardId 身份证号 + * @return irs接口返回值 + */ + @Override + public String getLicenseDetail(String cardId) { + MultiValueMap reqParam = new LinkedMultiValueMap<>(); + // 附加信息 + reqParam.add("additional", "{\"powerMatters\":\"许可-0000-00\",\"subPowerMatters\":\"许可-0000-0101\",\"accesscardId\":\"33071918111111784523\",\"materialName\":\"社会团体变更登记申请表\",\"sponsorName\":\"阿里巴巴(中国)有限公司\",\"sponsorCode\":\"91330100799655058B\",\"projectId\":\"330000261711151100004\"}"); + reqParam.add("appKey", APP_KEY); + // 刷新密钥 + String requestSecret = refreshKeyService.getRequestSecret(APP_KEY, APP_SECRET); + // 请求签名 + Long requestTime = System.currentTimeMillis(); + String sign = Md5Utils.hash(APP_KEY + requestSecret + requestTime); + // irs驾驶证查询接口 + reqParam.set("requestTime", requestTime); + reqParam.set("sign", sign); + reqParam.set("cardId", cardId); + + String res; + try { + log.info("请求参数:{}", reqParam); + res = restTemplate.postForObject(IrsConst.DRIVER_LICENSE_URL, reqParam, String.class); + log.info("驾驶证查询:{}", res); + } catch (Exception e) { + log.error("驾驶证查询:", e); + res = null; + } + return res; + } + + @Override + public void pullLicense() { + String statusKey = RK_DRIVER_LICENSE + StrPool.COLON + "STATUS"; + try { + if (Boolean.FALSE.equals(redisOps.setNx(statusKey, "RUNNING"))) { + return; + } + pullLicenseDetail(); + } finally { + redisOps.del(statusKey); + } + } + + @Override + public void pullLicenseDetail() { + String dataKey = RK_DRIVER_LICENSE + StrPool.COLON + "IDCARDS"; + List currIdcards = redisOps.lPop(dataKey); + if (CollUtil.isEmpty(currIdcards)) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(DriverInfo.class) + .select(DriverInfo::getIdCard); + List driverInfos = driverInfoService.list(query); + Set idCards = driverInfos.stream() + .map(DriverInfo::getIdCard) + .filter(IdcardUtil::isValidCard) + .collect(Collectors.toSet()); + if (idCards.isEmpty()) { + return; + } + List> parts = new ArrayList<>(ListUtil.partition(new ArrayList<>(idCards), LIMIT_BY_DAY)); + currIdcards = parts.remove(0); + if (!parts.isEmpty()) { + redisOps.lPush(dataKey, parts.toArray()); + } + } + List failedIdcards = currIdcards.stream().filter(idcard -> { + try { + String resData = getLicenseDetail(idcard); + if (StrUtil.isBlank(resData)) { + return true; + } + ResponseDataDTO response = JSON.parseObject(resData, + new TypeReference>() { + }); + if (response.succeed()) { + List list = response.getDatas(); + if (CollUtil.isNotEmpty(list)) { + DriverLicenseDTO dl = list.get(0); + DriversLicenseRaw raw = new DriversLicenseRaw(); + raw.setIdcard(idcard); + raw.setDriverLicenseDetail(JSONUtil.toJsonStr(dl)); + LambdaQueryWrapper query = Wrappers + .lambdaQuery(DriversLicenseRaw.class) + .eq(DriversLicenseRaw::getIdcard, idcard); + driversLicenseRawService.saveOrUpdate(raw, query); + return false; + } + } + return true; + } catch (Exception e) { + log.error("获取驾驶证信息异常:", e); + return true; + } + }).collect(Collectors.toList()); + if (!failedIdcards.isEmpty()) { + redisOps.lPush(dataKey, failedIdcards.toArray()); + } + } + + @Override + public void initPullLicenseTask() { + long leftCnt = getLeftCount(); + boolean runningStatus = runningStatus(); + if (runningStatus || leftCnt > 0) { + startPullLicenseTask(INIT_DELAY_MINUTES); + } + } + + @Override + public void startPullLicenseTask(int delayMinutes) { + startLicensePullTask(RK_DRIVER_LICENSE, this, delayMinutes); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/PullDrivingLicenseByIrsServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/PullDrivingLicenseByIrsServiceImpl.java new file mode 100644 index 0000000..e9c1bc8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/PullDrivingLicenseByIrsServiceImpl.java @@ -0,0 +1,185 @@ +package com.ningdatech.carapi.irs.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.text.StrPool; +import cn.hutool.core.util.IdcardUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.cache.redis.RedisOps; +import com.ningdatech.carapi.common.contants.IrsConst; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.irs.entity.DriversLicenseRaw; +import com.ningdatech.carapi.irs.model.dto.irs.DrivingLicenseDTO; +import com.ningdatech.carapi.irs.model.dto.irs.ResponseDataDTO; +import com.ningdatech.carapi.irs.service.AbstractLicenseGetByIrsService; +import com.ningdatech.carapi.irs.service.IDriversLicenseRawService; +import com.ningdatech.carapi.irs.service.PullLicenseByIrsService; +import com.ningdatech.carapi.irs.service.RefreshKeyService; +import com.ningdatech.carapi.irs.utils.Md5Utils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + *

+ * DriverLicensePullServiceImpl + *

+ * + * @author WendyYang + * @since 2023/5/16 + **/ +@Slf4j +@Service("drivingLicensePullByIrsService") +public class PullDrivingLicenseByIrsServiceImpl extends AbstractLicenseGetByIrsService implements PullLicenseByIrsService { + + + public PullDrivingLicenseByIrsServiceImpl(IDriverInfoService driverInfoService, + RestTemplate restTemplate, + RefreshKeyService refreshKeyService, + RedisOps redisOps, + IDriversLicenseRawService driversLicenseRawService) { + super(driverInfoService, restTemplate, refreshKeyService, redisOps, driversLicenseRawService); + } + + @Override + public boolean runningStatus() { + String statusKey = RK_DRIVING_LICENSE + StrPool.COLON + "STATUS"; + return Boolean.TRUE.equals(redisOps.exists(statusKey)); + } + + @Override + public long getLeftCount() { + String dataKey = RK_DRIVING_LICENSE + StrPool.COLON + "IDCARD"; + return ObjectUtil.defaultIfNull(redisOps.lLen(dataKey), 0L); + } + + /** + * 获取行驶证信息 + * + * @param idcard 身份正好 + * @return / + */ + @Override + public String getLicenseDetail(String idcard) { + // 刷新密钥 + String requestSecret = refreshKeyService.getRequestSecret(APP_KEY, APP_SECRET); + // 请求签名 + Long requestTime = System.currentTimeMillis(); + String sign = Md5Utils.hash(APP_KEY + requestSecret + requestTime); + + MultiValueMap map = new LinkedMultiValueMap<>(); + // 附加信息 + map.add("additional", "{\"powerMatters\":\"许可0000-00\",\"subPowerMatters\":\"许可0000-0101\",\"accesscardId\":\"33071918******784523\",\"materialName\":\"社会团体变更登记申请表\",\"sponsorName\":\"阿里巴巴(中国)有限公司\",\"sponsorCode\":\"91330100799655058B\",\"projectId\":\"330000261711151100004\"}"); + map.add("appKey", APP_KEY); + map.add("requestTime", requestTime); + map.add("sign", sign); + map.add("sfzmhm", idcard); + String res; + try { + log.info("请求参数:{}", map); + res = restTemplate.postForObject(IrsConst.DRIVING_LICENSE_URL, map, String.class); + log.info("行驶证信息查询:{}", res); + } catch (Exception e) { + log.error("行驶证信息查询:", e); + res = null; + } + return res; + } + + @Override + public void pullLicense() { + String statusKey = RK_DRIVING_LICENSE + StrPool.COLON + "STATUS"; + try { + if (Boolean.FALSE.equals(redisOps.setNx(statusKey, "RUNNING"))) { + return; + } + pullLicenseDetail(); + } finally { + redisOps.del(statusKey); + } + } + + @Override + public void pullLicenseDetail() { + String dataKey = RK_DRIVING_LICENSE + StrPool.COLON + "IDCARD"; + List currIdcards = redisOps.lPop(dataKey); + if (CollUtil.isEmpty(currIdcards)) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(DriverInfo.class) + .select(DriverInfo::getIdCard); + List driverInfos = driverInfoService.list(query); + Set idCards = driverInfos.stream() + .map(DriverInfo::getIdCard) + .filter(IdcardUtil::isValidCard) + .collect(Collectors.toSet()); + if (idCards.isEmpty()) { + return; + } + List> parts = new ArrayList<>(ListUtil.partition(new ArrayList<>(idCards), LIMIT_BY_DAY)); + currIdcards = parts.remove(0); + if (!parts.isEmpty()) { + redisOps.lPush(dataKey, parts.toArray()); + } + } + List failedIdcards = currIdcards.stream().filter(idcard -> { + try { + String resData = getLicenseDetail(idcard); + if (StrUtil.isBlank(resData)) { + return true; + } + ResponseDataDTO response = JSON.parseObject(resData, + new TypeReference>() { + }); + if (response.succeed()) { + List list = response.getDatas(); + if (CollUtil.isNotEmpty(list)) { + DrivingLicenseDTO dl = list.get(0); + DriversLicenseRaw raw = new DriversLicenseRaw(); + raw.setIdcard(idcard); + raw.setDrivingLicenseDetail(JSONUtil.toJsonStr(dl)); + LambdaQueryWrapper query = Wrappers + .lambdaQuery(DriversLicenseRaw.class) + .eq(DriversLicenseRaw::getIdcard, idcard); + driversLicenseRawService.saveOrUpdate(raw, query); + return false; + } + } + return true; + } catch (Exception e) { + log.error("获取行驶证信息异常:", e); + return true; + } + }).collect(Collectors.toList()); + if (!failedIdcards.isEmpty()) { + redisOps.lPush(dataKey, failedIdcards.toArray()); + } + } + + @Override + public void initPullLicenseTask() { + long leftCnt = getLeftCount(); + boolean runningStatus = runningStatus(); + if (runningStatus || leftCnt > 0) { + startPullLicenseTask(INIT_DELAY_MINUTES); + } + } + + @Override + public void startPullLicenseTask(int delayMinutes) { + startLicensePullTask(RK_DRIVING_LICENSE, this, delayMinutes); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/RefreshServieImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/RefreshServieImpl.java new file mode 100644 index 0000000..fd6bd28 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/RefreshServieImpl.java @@ -0,0 +1,232 @@ +package com.ningdatech.carapi.irs.service.impl; + +import java.time.Duration; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.HashMap; +import java.util.Objects; + +import org.springframework.stereotype.Service; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.irs.service.RefreshKeyService; +import com.ningdatech.carapi.irs.utils.HttpUtil; +import com.ningdatech.carapi.irs.utils.Md5Utils; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname RefreshServieImpl + * @Description + * @Date 2023/3/1 16:58 + * @Author PoffyZhang + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class RefreshServieImpl implements RefreshKeyService { + private final CachePlusOps cachePlusOps; + @Override + public String refresh() { + String appkey = "A330000100000202105003941"; // appkey + Long requestTime = System.currentTimeMillis (); + HttpUtil httpUtil = HttpUtil.getInstance(); + String requstSecret = "e07fd4471e92410d9860282d939b1217"; // app密钥 + log.info("请求密钥" + requstSecret); + String sign = Md5Utils.hash (appkey + requstSecret + requestTime); + String url = String.format ("http://59.202.38.178/gateway/app/refreshTokenByKey.htm" + + "?appKey=%s&requestTime=%s&sign=%s",appkey,requestTime+"",sign); + log.info(url); + String result = httpUtil.sendHttpGet(url); + log.info(result); + JSONObject dataJson = JSON.parseObject(result).getJSONObject("datas"); + if(Objects.nonNull(dataJson)){ + return dataJson.getString("requestSecret"); + } + return result; + } + + @Override + public String getRequestSecret(String appKey, String appSecret) { + Long requestTime = System.currentTimeMillis(); + // 刷新秘钥 + HttpUtil httpUtil = HttpUtil.getInstance(); + log.info("请求密钥" + appSecret); + String refreshSign = Md5Utils.hash (appKey + appSecret + requestTime); + String refreshUrl = String.format ("http://59.202.38.178/gateway/app/refreshTokenByKey.htm" + + "?appKey=%s&requestTime=%s&sign=%s", appKey, requestTime +"",refreshSign); + log.info(refreshUrl); + String result = httpUtil.sendHttpGet(refreshUrl); + log.info(result); + JSONObject dataJson = JSON.parseObject(result).getJSONObject("datas"); + if(Objects.nonNull(dataJson)){ + return dataJson.getString("requestSecret"); + } + return result; + } + + /** + * 获取应用的刷新密钥和请求秘钥 + * @param appKey + * @param appSecret + * @return + */ + @Override + public String getRefreshSecret(String appKey, String appSecret) { + Long requestTime = System.currentTimeMillis(); + // 刷新秘钥 + HttpUtil httpUtil = HttpUtil.getInstance(); + log.info("请求密钥" + appSecret); + String sign = Md5Utils.hash (appKey + appSecret + requestTime); + HashMap params = new HashMap<>(); + //String refreshUrl = String.format ("http://59.202.38.178/gateway/app/refreshTokenByKey.htm" + + // "?appKey=%s&requestTime=%s&sign=%s", appKey, requestTime +"",refreshSign); + + String refreshUrl = "https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm"; + params.put("appKey",appKey); + params.put("sign",sign); + params.put("requestTime",requestTime + ""); + String result = httpUtil.sendHttpPost(refreshUrl,params); + log.info(result); + JSONObject jsonObject = JSON.parseObject(result, JSONObject.class); + if(Objects.nonNull(jsonObject)){ + return jsonObject.getString("datas"); + } + return result; + } + + @Override + public String refreshSecret(String appKey, String refreshSecret) { + Long requestTime = System.currentTimeMillis(); + // 刷新秘钥 + HttpUtil httpUtil = HttpUtil.getInstance(); + log.info("刷新密钥" + refreshSecret); + String refreshSign = Md5Utils.hash (appKey + refreshSecret + requestTime); + HashMap params = new HashMap<>(); + + String refreshUrl = "https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm"; + params.put("appKey",appKey); + params.put("sign",refreshSign); + params.put("requestTime",requestTime + ""); + String result = httpUtil.sendHttpPost(refreshUrl,params); + log.info(result); + JSONObject jsonObject = JSON.parseObject(result, JSONObject.class); + if(Objects.nonNull(jsonObject)){ + return jsonObject.getString("datas"); + } + return result; + } + + @Override + public String getRequestSecret(String appKey, String appSecret, CacheKey requestKey, CacheKey refreshKey) { + String requestSecret; + String refreshSecret; + String result = getRefreshSecret(appKey, appSecret); + JSONObject jsonObject = JSON.parseObject(result, JSONObject.class); + if (Objects.nonNull(jsonObject)) { + refreshSecret = jsonObject.getString("refreshSecret"); + requestSecret = jsonObject.getString("requestSecret"); + // 请求秘钥过期时间 + Long requestSecretEndTime = jsonObject.getLong("requestSecretEndTime"); + // 刷新密钥过期时间 + Long refreshSecretEndTime = jsonObject.getLong("refreshSecretEndTime"); + + LocalDateTime requestEndTime = getEndTime(requestSecretEndTime); + LocalDateTime refreshEndTime = getEndTime(refreshSecretEndTime); + LocalDateTime startTime = LocalDateTime.now(); + // 请求秘钥有效期(分钟),提前1分钟刷新 + Duration minuteDuration = Duration.between(startTime, requestEndTime); + long minute = minuteDuration.toMinutes() - 1; + // 刷新密钥有效期(小时),提前1小时刷新 + Duration hourDuration = Duration.between(startTime, refreshEndTime); + // 获取相差的小时数,并提前1小时刷新 + long hour = hourDuration.toHours() - 1; + log.info("刷新秘钥有效期:" + hour); + if (Objects.nonNull(requestSecret)) { + // 请求秘钥,有效期15分钟 + requestKey.setExpire(Duration.ofMinutes(minute)); + cachePlusOps.set(requestKey, requestSecret, Boolean.TRUE); + }else { + return null; + } + if (Objects.nonNull(refreshSecret)) { + // 刷新密钥,有效期48小时 + refreshKey.setExpire(Duration.ofHours(hour)); + cachePlusOps.set(refreshKey, refreshSecret, Boolean.TRUE); + }else { + return null; + } + }else { + return null; + } + return requestSecret; + } + + private LocalDateTime getEndTime(Long requestSecretEndTime) { + // 将时间戳转换为Instant对象 + Instant instant = Instant.ofEpochMilli(requestSecretEndTime); + // 将Instant对象转换为LocalDateTime对象 + return LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + } + + @Override + public String refreshRequestSecret(String appKey, CacheKey requestKey, CacheKey refreshKey, String refreshSecret) { + String requestSecret; + String result = refreshSecret(appKey, refreshSecret); + JSONObject jsonObject = JSON.parseObject(result, JSONObject.class); + if (Objects.nonNull(jsonObject)) { + refreshSecret = jsonObject.getString("refreshSecret"); + requestSecret = jsonObject.getString("requestSecret"); + // 请求秘钥过期时间 + Long requestSecretEndTime = jsonObject.getLong("requestSecretEndTime"); + // 刷新密钥过期时间 + Long refreshSecretEndTime = jsonObject.getLong("refreshSecretEndTime"); + + LocalDateTime requestEndTime = getEndTime(requestSecretEndTime); + LocalDateTime refreshEndTime = getEndTime(refreshSecretEndTime); + LocalDateTime startTime = LocalDateTime.now(); + // 请求秘钥有效期(分钟),提前1分钟刷新 + Duration minuteDuration = Duration.between(startTime, requestEndTime); + long minute = minuteDuration.toMinutes() - 1; + log.info("请求秘钥有效期:" + minute); + // 刷新密钥有效期(小时),提前1小时刷新 + Duration duration = Duration.between(startTime, refreshEndTime); + // 获取相差的小时数,并提前1小时刷新 + long hour = duration.toHours() - 1; + log.info("刷新秘钥有效期:" + hour); + if (Objects.nonNull(requestSecret)) { + // 请求秘钥,有效期15分钟 + requestKey.setExpire(Duration.ofMinutes(minute)); + cachePlusOps.set(requestKey, requestSecret, Boolean.TRUE); + }else { + return null; + } + if (Objects.nonNull(refreshSecret)) { + // 刷新密钥,有效期48小时 + refreshKey.setExpire(Duration.ofHours(hour)); + cachePlusOps.set(refreshKey, refreshSecret, Boolean.TRUE); + }else { + return null; + } + }else { + return null; + } + return requestSecret; + } + + public static void main(String[] args) { +// String appkey = "A330000100000202105003941"; // appkey +// Long requestTime = System.currentTimeMillis (); +// System.out.println(requestTime); +// String requstSecret = "e07fd4471e92410d9860282d939b1217"; // app密钥 +// String sign = Md5Utils.hash (appkey + requstSecret + requestTime); +// System.out.println(sign); + + System.out.println("7520d721086111e7985b008cfaeb3d74".length()); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/SmsServieImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/SmsServieImpl.java new file mode 100644 index 0000000..aa123b0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/SmsServieImpl.java @@ -0,0 +1,240 @@ +package com.ningdatech.carapi.irs.service.impl; + +import java.security.MessageDigest; +import java.time.Duration; +import java.time.LocalDateTime; +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.*; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; + +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.irs.constant.SmsConstant; +import com.ningdatech.carapi.irs.service.SmsService; +import com.ningdatech.carapi.open.model.dto.UserLoginDTO; +import com.ningdatech.carapi.sys.contants.UserLoginConstant; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; + +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.crypto.digest.MD5; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname SmsServieImpl + * @Description + * @Date 2023/3/1 16:58 + * @Author PoffyZhang + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class SmsServieImpl implements SmsService { + + private final RestTemplate restTemplate; + private final INdUserInfoService ndUserInfoService; + private final INdUserAuthService ndUserAuthService; + private final CachePlusOps cachePlusOps; + + @Value("${sms.user}") + private String user; + + @Value("${sms.siid}") + private String siid; + + @Value("${sms.secretKey}") + private String secretKey; + + @Value("${sms.url}") + private String url; + + @Override + public String sendMessage(String mobile, String content) { + String secretKey = "082e691f65fd4a4d9f353b9c54b6735e"; + String accessKey = "bff297b3ac7f45f293de72087ba6d095"; + + String timeStamp = LocalDateTimeUtil.format(LocalDateTime.now(),"yyyyMMddHHmmssSSS"); + String transactionID = timeStamp; + String streamingNo = "9000001120230507162550676"; + String authenticator = Base64.getEncoder().encodeToString((timeStamp + transactionID + streamingNo + secretKey).getBytes()); + + Map map = new HashMap<>(); + map.put("siid","zhejiang1"); + map.put("user","httpadmin"); + map.put("authenticator",authenticator); + map.put("timeStamp",timeStamp); + map.put("transactionID",transactionID); + map.put("streamingNo",streamingNo); + map.put("mobile",mobile); + map.put("content",content); + ResponseEntity responseEntity = null; + + //发送post请求 + RequestEntity> requestEntity = RequestEntity + .post("http://115.239.134.217/smsservice/httpservices/capService") + .header("Accept", MediaType.APPLICATION_JSON.toString()) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON) + .body(map); //也可以是DTO + //http://115.239.134.217/smsservice/httpservices/capService + //https://interface.zjzwfw.gov.cn/gateway/component/routing/agent.htm + try { + responseEntity= restTemplate.exchange(requestEntity,String.class); + } catch (Exception e) { + log.error("[RestTemplateTest-test] http request error", e); + } + //请求参数 参数类型 是否必填 描述 示例值 + //siid String 否 客户编号 + // user String 否 HTTP帐号 + // authenticator String 否 认证码 参数4.4 BASE64(timeStamp+transactionID + streamingNO + 接口密钥) + // timestamp String 否 当前时间戳 + //transactionID String 否 事务号 + //streamingNo String 否 流水号 + //mobile String 否 多个号码用英文逗号分隔 + //extcode String 否 扩展码 + // contet String 否 内容 + return responseEntity.toString(); + } + + @Override + public String sendSmsCode(String mobile, String verificationCode) { + String timeStamp = LocalDateTimeUtil.format(LocalDateTime.now(),"yyyyMMddHHmmssSSS"); + String transactionID = timeStamp; + String streamingNo = siid + transactionID; + String authenticator = encoderByMd5(timeStamp + transactionID + streamingNo + secretKey); + + Map map = new HashMap<>(); + map.put("siid",siid); + map.put("user",user); + map.put("authenticator",authenticator); + map.put("timeStamp",timeStamp); + map.put("transactionID",transactionID); + map.put("streamingNo",streamingNo); + map.put("mobile",mobile); + String content = String.format(SmsConstant.SMS_CONSTANT_TEMPLATE,verificationCode); + map.put("content",content); + ResponseEntity responseEntity = null; + + //发送post请求 + RequestEntity> requestEntity = RequestEntity + .post(url) + .header("Accept", MediaType.APPLICATION_JSON.toString()) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON) + //也可以是DTO + .body(map); + try { + responseEntity= restTemplate.exchange(requestEntity,String.class); + } catch (Exception e) { + log.error("[RestTemplateTest-test] http request error", e); + } + return responseEntity.toString(); + } + private String encoderByMd5(String str) { + try { + // 确定计算方法 + MessageDigest md5 = MessageDigest.getInstance("MD5"); + // 加密后的字符串 + return cn.hutool.core.codec.Base64.encode(md5.digest(str.getBytes("UTF-8"))); + } catch (Exception e) { + return ""; + } + } + + @Override + public String getCode(UserLoginDTO param) { + // 获取用户名入参信息 + String userName = param.getUsername(); + // 根据用户名获取用户账号信息 + NdUserAuth userAuth = ndUserAuthService.getOne(Wrappers.lambdaQuery(NdUserAuth.class) + .eq(NdUserAuth::getIdentifier, userName)); + VUtils.isTrue(Objects.isNull(userAuth)).throwMessage("该用户不存在!"); + // 根据用户ID获取用户信息 + NdUserInfo ndUserInfo = ndUserInfoService.getOne(Wrappers.lambdaQuery(NdUserInfo.class) + .eq(NdUserInfo::getId, userAuth.getUserId())); + VUtils.isTrue(Objects.isNull(ndUserInfo)).throwMessage("该用户不存在!"); + String mobile = ndUserInfo.getMobile(); + VUtils.isTrue(StringUtils.isBlank(mobile)).throwMessage("该用户没有设置手机号!"); + + String verificationCode = CodeUtil.codeFen(6); + // 将验证码保存到redis中,并设置过期时间 + CacheKey key = new CacheKey(UserLoginConstant.RedisKey.USER_LOGIN + userName); + key.setExpire(Duration.ofMinutes(10)); + cachePlusOps.set(key,verificationCode,false); + + String url = "http://shuiniche.ningdatech.com/cm/open/api/sms/send-sms-code"; + + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + + Map requestBody = new HashMap<>(); + requestBody.put("mobile", mobile); + requestBody.put("verificationCode", verificationCode); + HttpEntity> requestEntity = new HttpEntity<>(requestBody, headers); + try { + ResponseEntity responseEntity = restTemplate.postForEntity(url, requestEntity, String.class); + return responseEntity.getBody(); + } catch (RestClientException e) { + throw new BizException("调用短信转发服务失败!"); + } + } + + public static void main(String[] args) { + //String mobile = "15058187290"; + String mobile = "18556991003"; + String content = "司机爱UI时候爱US哈UI晒u"; + RestTemplate restTemplate = new RestTemplate(); + +// String secretKey = "082e691f65fd4a4d9f353b9c54b6735e"; +// String accessKey = "bff297b3ac7f45f293de72087ba6d095"; + String secretKey = "ZjHc5%7&"; + + String timeStamp = LocalDateTimeUtil.format(LocalDateTime.now(),"yyyyMMddHHmmssSSS"); + String transactionID = timeStamp; + String streamingNo = "9000001120230507162550677"; + String authenticator = Base64.getEncoder().encodeToString( + MD5.create().digest((timeStamp + transactionID + streamingNo + secretKey).getBytes())); + + Map map = new HashMap<>(); + map.put("siid","ZJHCJSJXTYXGS9"); + map.put("user","zjhc9"); + map.put("authenticator",authenticator); + map.put("timeStamp",timeStamp); + map.put("transactionID",transactionID); + map.put("streamingNo",streamingNo); + map.put("mobile",mobile); + map.put("content",content); + ResponseEntity responseEntity = null; + + //发送post请求 + RequestEntity> requestEntity = RequestEntity + .post("http://115.239.134.217/smsservice/httpservices/capService") + .header("Accept", MediaType.APPLICATION_JSON.toString()) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON) + .body(map); //也可以是DTO + + try { + responseEntity= restTemplate.exchange(requestEntity,String.class); + } catch (Exception e) { + log.error("[RestTemplateTest-test] http request error", e); + } + + System.out.println(responseEntity.toString()); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/VehicleAccidentIrsDataServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/VehicleAccidentIrsDataServiceImpl.java new file mode 100644 index 0000000..3290478 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/VehicleAccidentIrsDataServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.irs.service.impl; + +import com.ningdatech.carapi.irs.model.entity.VehicleAccidentIrsData; +import com.ningdatech.carapi.irs.mapper.VehicleAccidentIrsDataMapper; +import com.ningdatech.carapi.irs.service.IVehicleAccidentIrsDataService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-05-12 + */ +@Service +public class VehicleAccidentIrsDataServiceImpl extends ServiceImpl implements IVehicleAccidentIrsDataService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/VehicleViolationIrsDataServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/VehicleViolationIrsDataServiceImpl.java new file mode 100644 index 0000000..419c52b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/service/impl/VehicleViolationIrsDataServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.irs.service.impl; + +import com.ningdatech.carapi.irs.model.entity.VehicleViolationIrsData; +import com.ningdatech.carapi.irs.mapper.VehicleViolationIrsDataMapper; +import com.ningdatech.carapi.irs.service.IVehicleViolationIrsDataService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-05-12 + */ +@Service +public class VehicleViolationIrsDataServiceImpl extends ServiceImpl implements IVehicleViolationIrsDataService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/task/MyAccidentQueryTask.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/task/MyAccidentQueryTask.java new file mode 100644 index 0000000..c64fc56 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/task/MyAccidentQueryTask.java @@ -0,0 +1,569 @@ +package com.ningdatech.carapi.irs.task; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +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.util.NdDateUtils; +import com.ningdatech.carapi.car.position.entity.VehiclePositionInfo; +import com.ningdatech.carapi.car.position.service.IVehiclePositionInfoService; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.irs.model.entity.VehicleAccidentIrsData; +import com.ningdatech.carapi.irs.service.AccidentService; +import com.ningdatech.carapi.irs.service.IVehicleAccidentIrsDataService; +import com.ningdatech.carapi.safe.constant.AccidentTypeEnum; +import com.ningdatech.carapi.safe.constant.VehicleAccidentReportStatusEnum; +import com.ningdatech.carapi.safe.entity.NdVehicleAccident; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentDead; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentDeadService; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentService; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.file.utils.StrPool; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.date.StopWatch; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.StrUtil; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @description + * @since 2023/05/21 15:38 + */ +@Component +@Slf4j +@Data +public class MyAccidentQueryTask implements Runnable { + + private final AccidentService accidentService; + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final IVehicleAccidentIrsDataService accidentIrsDataService; + private final CompanyService companyService; + private final INdVehicleAccidentService vehicleAccidentService; + private final INdVehicleAccidentDeadService vehicleAccidentDeadService; + private final RegionsCacheHelper regionsCacheHelper; + private final IVehiclePositionInfoService iVehiclePositionInfoService; + + /** + * 接口访问次数限制 + */ + private Integer BIGGEST_ACCESS_NUM = 2950; + /** + * 存储数据下标的文件名 + */ + private String ACCIDENT_QUERY_INDEX_FILE = "accidentIndex.txt"; + /** + * 上次中断的车牌号下标 + */ + private Long lastIndex = 0L; + /** + * 上次执行的次数 + */ + private Integer lastCount = 0; + /** + * 是否继续执行任务 + */ + private boolean isRunning = true; + + public MyAccidentQueryTask(AccidentService accidentService, IVehicleBaseInfoService vehicleBaseInfoService, + IVehicleAccidentIrsDataService accidentIrsDataService, CompanyService companyService, + INdVehicleAccidentService vehicleAccidentService, INdVehicleAccidentDeadService vehicleAccidentDeadService, + RegionsCacheHelper regionsCacheHelper, IVehiclePositionInfoService iVehiclePositionInfoService) { + this.accidentService = accidentService; + this.vehicleBaseInfoService = vehicleBaseInfoService; + this.accidentIrsDataService = accidentIrsDataService; + this.companyService = companyService; + this.vehicleAccidentService = vehicleAccidentService; + this.vehicleAccidentDeadService = vehicleAccidentDeadService; + this.regionsCacheHelper = regionsCacheHelper; + this.iVehiclePositionInfoService = iVehiclePositionInfoService; + } + + @Override + public void run() { + + log.info("========== 根据IRS更新事故数据 ==========任务开始"); + // 判断当前执行任务的时间是否为月初的1号 如果是月初1号,任务应该从下标1重新开始跑 + LocalDateTime now = LocalDateTime.now(); + int dayOfMonth = now.getDayOfMonth(); + if (TaskConstant.Data.MONTH_VALUE_ONE.equals(dayOfMonth)){ + // 重置文件中的下标 + saveLastIndex(1L, 0); + } + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + while (isRunning) { + // 读取上次中断的数据下标和和已经执行的次数 + readLastIndex(); + log.info("读取到的下标为{}", lastIndex); + log.info("已访问接口次数{}", lastCount); + Map infoMap = + vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .select(NdVehicleBaseInfo::getId,NdVehicleBaseInfo::getCarPlate)) + .stream().collect(Collectors.toMap(NdVehicleBaseInfo::getId, NdVehicleBaseInfo::getCarPlate)); + OptionalLong maxKey = infoMap.keySet().stream().mapToLong(Long::longValue).max(); + Long maxIndex = null; + if (maxKey.isPresent()){ + maxIndex = maxKey.getAsLong(); + } + // 校验下标对应的车牌号是否一致 + String carNo; + carNo = infoMap.get(lastIndex); + while (Objects.isNull(carNo)) { + log.info("车辆id{}不存在,请检查该车辆信息是否已经被删除!", lastIndex); + // 查找下一个车辆信息,直到车辆信息存在 + lastIndex++; + if (Objects.nonNull(maxIndex) && lastIndex.compareTo(maxIndex) > 0){ + log.info("系统中没有待查询的车牌号"); + return; + } + carNo = infoMap.get(lastIndex); + } + + // 从车辆信息表中从上次执行中断的下标获取一定数量的车牌号 + int cnt = BIGGEST_ACCESS_NUM - lastCount; + LambdaQueryWrapper query = + Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .ge(NdVehicleBaseInfo::getId, lastIndex) + .last("limit " + cnt) + .select(NdVehicleBaseInfo::getCarPlate, NdVehicleBaseInfo::getId) + .isNotNull(NdVehicleBaseInfo::getCarPlate); + List list = vehicleBaseInfoService.list(query); + log.info("此次任务车辆数量为:" + list.size()); + if (CollUtil.isNotEmpty(list)) { + List carPlateList = list.stream().sorted(Comparator.comparing(NdVehicleBaseInfo::getId)) + .map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + Map carMap = list.stream().collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, NdVehicleBaseInfo::getId)); + String[] carPlates = carPlateList.stream().toArray(String[]::new); + // 执行查询任务 + executeTask(carPlates,carMap); + // 当访问次数达到当日设定数量时,结束循环,初始化累计访问次数,并更新事故数据 + if (BIGGEST_ACCESS_NUM.equals(lastCount) || lastIndex.equals(maxIndex)) { + isRunning = false; + // 任务执行完毕后保存最终的数据下标 + TreeMap sortedMap = new TreeMap<>(infoMap); + Map.Entry higherEntry = sortedMap.higherEntry(lastIndex); + if (Objects.nonNull(higherEntry)){ + lastIndex = higherEntry.getKey(); + } + saveLastIndex(lastIndex, 0); + // 更新事故数据 + updateAccidentData(); + log.info("事故数据更新完成!"); + } + } else { + log.info("本月任务已查询完成!"); + return; + } + } + stopWatch.stop(); + log.info("共更新事故数据:" + lastCount + "条"); + log.info("========== 根据IRS更新事故数据==========任务结束 {}s", stopWatch.getTotalTimeSeconds()); + + } + + private void executeTask(String[] carPlates, Map carMap) { + // 获取车牌号的所有事故信息 + Map> accidentIrsDataMap = accidentIrsDataService.list().stream() + .collect(Collectors.groupingBy(VehicleAccidentIrsData::getCarPlate)); + for (int i = 0; i < carPlates.length; i++) { + // 执行任务代码 + String carPlate = carPlates[i]; + String dataJsonStr; + try { + dataJsonStr = accidentService.accidentQuery(carPlate,i); + if (Objects.nonNull(dataJsonStr)) { + JSONObject jsonObject = JSON.parseObject(dataJsonStr, JSONObject.class); + String msg = jsonObject.getString("msg"); + if (msg.contains("签名错误")) { + // 签名错误 + lastIndex = carMap.get(carPlate); + lastCount++; + saveLastIndex(lastIndex, lastCount); + log.error("签名错误,任务中断时车牌号下标为{}", lastIndex); + break; + } + } + } catch (Exception e) { + // 接口请求异常,结束循环 + lastIndex = carMap.get(carPlate); + lastCount++; + saveLastIndex(lastIndex, lastCount); + log.error("任务中断时车牌号下标为{},中断原因:{}", lastIndex,e.getMessage()); + break; + } + if (Objects.isNull(dataJsonStr)) { + // 刷新请求秘钥失败,接口调用内容返回空,任务中断,保存下标 + lastIndex = carMap.get(carPlate); + saveLastIndex(lastIndex, lastCount); + log.error("车辆事故查询接口调用失败,车牌号为:" + carPlate); + break; + } + int index = i + 1; + // 如果还有下一个待查询车牌号 + if (index < carPlates.length) { + lastIndex = carMap.get(carPlates[index]); + }else { + // 已经是最后一个车牌号 + lastIndex = carMap.get(carPlates[i]); + } + log.info("下次待查询车牌号下标为:" + lastIndex); + lastCount++; + log.info("已访问事故查询IRS接口 {} 次", lastCount); + log.info("此次访问的事故车牌号为 {}", carPlate); + + try { + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + List array = JSON.parseArray(data, String.class); + if (CollUtil.isEmpty(array)) { + log.info("该车牌号没有事故信息!"); + continue; + } + for (String datas : array) { + if (StrUtil.isNotBlank(datas)) { + List accidentArray = JSON.parseArray(datas, JSONObject.class); + if (CollUtil.isEmpty(accidentArray)) { + log.info("该车牌号没有事故信息!"); + continue; + } + + for (JSONObject jsonObject : accidentArray) { + VehicleAccidentIrsData accidentIrsData = new VehicleAccidentIrsData(); + accidentIrsData.setCarPlate(carPlate); + String jsonString = jsonObject.toJSONString(); + accidentIrsData.setJsonStrData(jsonString); + // 获取事故日期 + Timestamp sgfssj = jsonObject.getTimestamp("SGFSSJ"); + LocalDateTime accidentTime = LocalDateTimeUtil.of(sgfssj); + if (accidentIrsDataMap.containsKey(carPlate)) { + List dataList = accidentIrsDataMap.get(carPlate); + Map dataMap = dataList.stream() + .collect(Collectors.toMap(VehicleAccidentIrsData::getAccidentTime, v -> v)); + if (dataMap.containsKey(accidentTime)) { + VehicleAccidentIrsData irsData = dataMap.get(accidentTime); + // 数据已经存在 + accidentIrsData.setId(irsData.getId()); + } + } + accidentIrsData.setAccidentTime(accidentTime); + accidentIrsData.setCreateOn(LocalDateTime.now()); + accidentIrsData.setUpdateOn(LocalDateTime.now()); + accidentIrsDataService.saveOrUpdate(accidentIrsData); + } + } + } + } catch (Exception e) { + throw new BizException("数据保存失败"); + } finally { + // 每次执行保存一次下标 + saveLastIndex(lastIndex,lastCount); + } + } + } + + private void saveLastIndex(Long lastIndex, Integer lastCount) { + + File directory = new File(""); + // 临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "irs"; + File file = new File(filePath + File.separator + ACCIDENT_QUERY_INDEX_FILE); + + try { + FileWriter fileWriter = new FileWriter(file); + BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); + + bufferedWriter.write(Long.toString(lastIndex)); + bufferedWriter.newLine(); + bufferedWriter.write(Integer.toString(lastCount)); + bufferedWriter.newLine(); + + bufferedWriter.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void readLastIndex() { + File directory = new File(""); + // 临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "irs"; + File file = new File(filePath + File.separator + ACCIDENT_QUERY_INDEX_FILE); + + try { + List dataList = FileUtil.readLines(file, StandardCharsets.UTF_8); + if (CollUtil.isNotEmpty(dataList) && dataList.size() == 2) { + lastIndex = Long.valueOf(dataList.get(0)); + lastCount = Integer.valueOf(dataList.get(1)); + } + } catch (Exception e) { + log.info("读取下标和车牌号失败!"); + e.printStackTrace(); + } + } + + /** + * 从IRS事故数据表中更新数据到车辆事故数据表中 + * + * @return void + * @author CMM + * @since 2023/05/16 10:26 + */ + private void updateAccidentData() { + + // 从IRS事故数据表中更新数据到车辆事故数据表中 + Map> listMap = + accidentIrsDataService.list().stream().collect(Collectors.groupingBy(VehicleAccidentIrsData::getCarPlate)); + + // 获取车牌号 + Set carPlateList = + accidentIrsDataService.list().stream().map(VehicleAccidentIrsData::getCarPlate).collect(Collectors.toSet()); + + // 获取车辆基本信息 + List vehicleBaseInfos = vehicleBaseInfoService + .list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class).in(NdVehicleBaseInfo::getCarPlate, carPlateList)); + Map vehicleBaseInfoMap = + vehicleBaseInfos.stream().collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + // 获取企业信息 + Map companyMap = + companyService.list().stream().collect(Collectors.toMap(Company::getId, c -> c)); + + // 获取已经存在的事故数据 + List accidentTmpVas = vehicleAccidentService + .list(Wrappers.lambdaQuery(NdVehicleAccident.class).in(NdVehicleAccident::getCarPlate, carPlateList)); + Map accidentMap = accidentTmpVas.stream() + .collect(Collectors.collectingAndThen( + Collectors.toCollection(() -> new TreeSet<>( + Comparator.comparing(a -> a.getCarPlate() + StrPool.SEMICOLON + a.getAccidentTime()))), + ArrayList::new)) + .stream().collect(Collectors.toMap(d -> d.getCarPlate() + d.getAccidentTime(), d -> d)); + + // 获取已经存在的死亡事故数据 + List deadAccidentTmpVas = vehicleAccidentDeadService.list( + Wrappers.lambdaQuery(NdVehicleAccidentDead.class).in(NdVehicleAccidentDead::getCarPlate, carPlateList)); + Map deadAccidentMap = deadAccidentTmpVas.stream() + .collect(Collectors.collectingAndThen( + Collectors.toCollection(() -> new TreeSet<>( + Comparator.comparing(a -> a.getCarPlate() + StrPool.SEMICOLON + a.getAccidentTime()))), + ArrayList::new)) + .stream().collect(Collectors.toMap(d -> d.getCarPlate() + d.getAccidentTime(), d -> d)); + + for (String carPlate : carPlateList) { + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoMap.get(carPlate); + if (Objects.isNull(vehicleBaseInfo)) { + //log.info("该车牌号不在系统中!"); + continue; + } + //// 查出对应车牌号关联的责任驾驶员 + // String driverName = vehicleBaseInfo.getResponsibleDriverFirst(); + // + // if (Objects.isNull(driverName)) { + // log.info("该车牌号没有责任驾驶员!"); + // continue; + // } + Long companyId = vehicleBaseInfo.getCompanyId(); + Company company = companyMap.get(companyId); + + // 获取IRS事故数据 + List accidentIrsDataList = listMap.get(carPlate); + + for (VehicleAccidentIrsData accidentIrsData : accidentIrsDataList) { + // 解析获取事故时间等信息 + String jsonStrData = accidentIrsData.getJsonStrData(); + JSONObject jsonObject = JSON.parseObject(jsonStrData); + + // 获取行政区划 + String xzqh = jsonObject.getString("XZQH"); + // 获取区域信息 + Long regionId = regionsCacheHelper.getIdByCode(xzqh); + String regionName = regionsCacheHelper.getDisplayName(regionId); + // 获取事故地点 + String sgdd = jsonObject.getString("SGDD"); + // 获取车辆类型 + Integer vehicleType = null; + if (Objects.nonNull(vehicleBaseInfo)) { + vehicleType = vehicleBaseInfo.getVehicleType(); + } + // 获取受伤人数 + Integer ssrs = jsonObject.getInteger("SSRS"); + // 获取事故日期 + Timestamp sgfssj = jsonObject.getTimestamp("SGFSSJ"); + LocalDateTime accidentTime = LocalDateTimeUtil.of(sgfssj); + // 获取简要案情 + String jyaq = jsonObject.getString("JYAQ"); + // 获取事故编号 + String sgbh = jsonObject.getString("SGBH"); + // 获取经纬度电子坐标 + String dzzb = jsonObject.getString("DZZB"); + String longitude = null; + String latitude = null; + if (StringUtils.isNotBlank(dzzb) && dzzb.contains(StrPool.COMMA)) { + String[] split = dzzb.split(StrPool.COMMA); + Double longitudeD = Double.valueOf(split[0]); + Double latitudeD = Double.valueOf(split[1]); + DecimalFormat df = new DecimalFormat("#.###"); + longitude = df.format(longitudeD); + latitude = df.format(latitudeD); + } else { + // 交管事故数据未上传经纬度坐标,从当天的GPS数据中根据车牌号和事故时间查询经纬度 + LocalDateTime startTime = LocalDateTimeUtil.parse( + NdDateUtils.format(accidentTime, DatePattern.NORM_DATETIME_MINUTE_PATTERN), + DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); + LocalDateTime endTime = LocalDateTimeUtil.parse( + NdDateUtils.format(accidentTime.plusMinutes(1), DatePattern.NORM_DATETIME_MINUTE_PATTERN), + DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); + // 如果跨天了就设置相同地查询边界 + if (!NdDateUtils.format(startTime, DatePattern.NORM_DATE_PATTERN) + .equals(NdDateUtils.format(endTime, DatePattern.NORM_DATE_PATTERN))) { + endTime = startTime; + } + + List vehiclePositionInfos; + try { + vehiclePositionInfos = iVehiclePositionInfoService.dynamicGpsTableHistorySearch(carPlate, + accidentTime, endTime, NdDateUtils.format(startTime, "yyyy_MM_dd")); + if (CollUtil.isNotEmpty(vehiclePositionInfos)) { + VehiclePositionInfo positionInfo; + List positionInfoList = vehiclePositionInfos.stream() + .filter(v -> v.getUpdateTime().equals(accidentTime)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(positionInfoList)) { + positionInfo = positionInfoList.get(0); + } else { + // 没有时间完全一样的GPS数据,就取第一个 + positionInfo = vehiclePositionInfos.get(0); + } + longitude = String.valueOf(positionInfo.getCarLongitude()); + latitude = String.valueOf(positionInfo.getCarLatitude()); + } + } catch (Exception e) { + // GPS数据中查询不到数据(GPS表可能被删除) + log.error(e.getMessage()); + } + } + + // 获取当场、24小时、3日内、7日内、30日内死亡人数 + Integer swrs = Objects.nonNull(jsonObject.getInteger("SWRS")) ? jsonObject.getInteger("SWRS") : 0; + Integer swrs24 = Objects.nonNull(jsonObject.getInteger("SWRS24")) ? jsonObject.getInteger("SWRS24") : 0; + Integer swrs3 = Objects.nonNull(jsonObject.getInteger("SWRS3")) ? jsonObject.getInteger("SWRS3") : 0; + Integer swrs7 = Objects.nonNull(jsonObject.getInteger("SWRS7")) ? jsonObject.getInteger("SWRS7") : 0; + Integer swrs30 = Objects.nonNull(jsonObject.getInteger("SWRS30")) ? jsonObject.getInteger("SWRS30") : 0; + // 有死亡人数,再插入到死亡事故表中 + if (swrs != 0 || swrs24 != 0 || swrs3 != 0 || swrs7 != 0 || swrs30 != 0) { + // 插入数据到死亡事故表中 + NdVehicleAccidentDead accidentDead = new NdVehicleAccidentDead(); + // 判断是否已经插入过 + if (deadAccidentMap.containsKey(carPlate + accidentTime)) { + NdVehicleAccidentDead dead = deadAccidentMap.get(carPlate + accidentTime); + accidentDead.setId(dead.getId()); + } + if (swrs30 != 0) { + accidentDead.setDeathToll(swrs30); + } else if (swrs7 != 0) { + accidentDead.setDeathToll(swrs7); + } else if (swrs3 != 0) { + accidentDead.setDeathToll(swrs3); + } else if (swrs24 != 0) { + accidentDead.setDeathToll(swrs24); + } else { + accidentDead.setDeathToll(swrs); + } + accidentDead.setInjuries(ssrs); + accidentDead.setRegionId(regionId); + accidentDead.setRegionName(regionName); + // 获取事故时间 + accidentDead.setAccidentTime(accidentTime); + accidentDead.setAccidentAddress(sgdd); + // 装配车牌号、事故驾驶员、企业名称 + accidentDead.setCarPlate(carPlate); + // accidentDead.setAccidentDriver(driverName); + accidentDead.setCompanyId(companyId); + if (Objects.nonNull(company)) { + accidentDead.setCompanyName(company.getName()); + } + // 是否上报默认为未上报 + accidentDead.setReportStatus(VehicleAccidentReportStatusEnum.UNDER_REPORT.getCode()); + accidentDead.setBriefCase(jyaq); + accidentDead.setAccidentNo(sgbh); + accidentDead.setLongitude(longitude); + accidentDead.setLatitude(latitude); + vehicleAccidentDeadService.saveOrUpdate(accidentDead); + } + // 插入到事故表中 + NdVehicleAccident accident = new NdVehicleAccident(); + // 判断事故类型 + if (swrs != 0 || swrs24 != 0 || swrs3 != 0 || swrs7 != 0 || swrs30 != 0){ + accident.setAccidentType(AccidentTypeEnum.DEAD.getCode()); + } else if (Objects.nonNull(ssrs) && ssrs > 0) { + accident.setAccidentType(AccidentTypeEnum.INJURY.getCode()); + }else { + accident.setAccidentType(AccidentTypeEnum.OTHER.getCode()); + } + // 获取已经存在的事故信息 + NdVehicleAccident vehicleAccident = accidentMap.get(carPlate + accidentTime); + // 获取事故时间 + if (accidentMap.containsKey(carPlate + accidentTime)) { + accident.setId(vehicleAccident.getId()); + } + accident.setInjuries(ssrs); + if (swrs30 != 0) { + accident.setDeathToll(swrs30); + } else if (swrs7 != 0) { + accident.setDeathToll(swrs7); + } else if (swrs3 != 0) { + accident.setDeathToll(swrs3); + } else if (swrs24 != 0) { + accident.setDeathToll(swrs24); + } else { + accident.setDeathToll(swrs); + } + accident.setRegionId(regionId); + accident.setRegionName(regionName); + // 获取事故时间 + accident.setAccidentTime(accidentTime); + accident.setAccidentAddress(sgdd); + // 装配车牌号、事故驾驶员、车辆类型、企业名称 + accident.setCarPlate(carPlate); + + // accident.setAccidentDriver(driverName); + accident.setVehicleType(vehicleType); + accident.setCompanyId(companyId); + if (Objects.nonNull(company)) { + accident.setCompanyName(company.getName()); + } + // 是否上报默认为未上报 + accident.setReportStatus(VehicleAccidentReportStatusEnum.UNDER_REPORT.getCode()); + accident.setBriefCase(jyaq); + accident.setAccidentNo(sgbh); + accident.setLongitude(longitude); + accident.setLatitude(latitude); + vehicleAccidentService.saveOrUpdate(accident); + } + } + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/task/MyDrivingLicenseQueryTask.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/task/MyDrivingLicenseQueryTask.java new file mode 100644 index 0000000..e971761 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/task/MyDrivingLicenseQueryTask.java @@ -0,0 +1,219 @@ +package com.ningdatech.carapi.irs.task; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.irs.entity.DriversLicenseRaw; +import com.ningdatech.carapi.irs.service.DriverService; +import com.ningdatech.carapi.irs.service.IDriversLicenseRawService; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.io.*; +import java.sql.Timestamp; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author CMM + * @description + * @since 2023/05/21 15:38 + */ +@Component +@Slf4j +@Data +public class MyDrivingLicenseQueryTask implements Runnable { + + private final DriverService driverService; + private final IDriverInfoService driverInfoService; + private final IDriversLicenseRawService driversLicenseRawService; + + /** + * 接口访问次数限制 + */ + private Integer BIGGEST_ACCESS_NUM = 95; + /** + * 存储数据下标的文件名 + */ + private String ACCIDENT_QUERY_INDEX_FILE = "vehicleLicenseIndex.txt"; + /** + * 上次中断的驾驶员下标 + */ + private Long lastIndex = 0L; + /** + * 上次执行的次数 + */ + private Integer lastCount = 0; + /** + * 是否继续执行任务 + */ + private boolean isRunning = true; + + public MyDrivingLicenseQueryTask(DriverService driverService, IDriverInfoService driverInfoService, IDriversLicenseRawService driversLicenseRawService) { + this.driverService = driverService; + this.driverInfoService = driverInfoService; + this.driversLicenseRawService = driversLicenseRawService; + } + + @Override + public void run() { + + log.info("========== 根据IRS更新驾驶证数据 ==========任务开始"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + while (isRunning) { + + // 读取上次中断的数据下标和和已经执行的次数 + readLastIndex(); + Map infoMap = driverInfoService.list().stream() + .collect(Collectors.toMap(DriverInfo::getId, v -> v)); + // 校验文件中存储的下标对应的身份证号是否一致 + DriverInfo info; + info = infoMap.get(lastIndex); + while (Objects.isNull(info)) { + log.error("文件中存储的驾驶员id{}不存在,请检查该驾驶员信息是否已经被删除!",lastIndex); + // 查找下一个驾驶员信息,直到驾驶员信息存在 + lastIndex++; + info = infoMap.get(lastIndex); + } + + // 从车辆信息表中从上次执行中断的下标获取一定数量的车牌号 + LambdaQueryWrapper query = + Wrappers.lambdaQuery(DriverInfo.class).ge(DriverInfo::getId, lastIndex) + .le(DriverInfo::getId, BIGGEST_ACCESS_NUM - lastCount + lastIndex - 1) + .select(DriverInfo::getIdCard).isNotNull(DriverInfo::getIdCard); + List list = driverInfoService.list(query); + + Set idCardSet = list.stream().map(DriverInfo::getIdCard).collect(Collectors.toSet()); + String[] idCards = idCardSet.toArray(new String[idCardSet.size()]); + try { + executeTask(idCards); + } catch (Exception e) { + // 下标恢复到上次执行失败的驾驶员下标 + lastIndex--; + // 线程被中断,退出循环 + isRunning = false; + e.printStackTrace(); + } finally { + // 任务执行完毕后保存最终的数据下标 + saveLastIndex(lastIndex, lastCount); + } + + stopWatch.stop(); + log.info("共更新驾驶证数据:" + lastCount + "条"); + log.info("========== 根据IRS更新驾驶证数据==========任务结束 {}s", stopWatch.getTotalTimeSeconds()); + } + + } + + private void executeTask(String[] idCards) { + for (int i = lastIndex.intValue(); i < idCards.length; i++) { + // 执行任务代码 + String idCard = idCards[i]; + String dataJsonStr = driverService.vehicleLicenseQuery(idCard); + lastIndex++; + lastCount++; + log.info("已访问驾驶证查询IRS接口 {} 次", lastCount); + log.info("此次访问的身份证号为 {}", idCard); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + List array = JSON.parseArray(data, JSONObject.class); + if (CollUtil.isEmpty(array)) { + log.info("该身份证号没有驾驶证信息!"); + continue; + } + // 获取身份证号的所有行驶证信息 + Map> vehicleLicenseMap = driversLicenseRawService.list().stream() + .collect(Collectors.groupingBy(DriversLicenseRaw::getIdcard)); + + for (JSONObject jsonObject : array) { + if (Objects.nonNull(jsonObject)) { + // 获取发证日期,判断是否重复 + Timestamp fZRQ = jsonObject.getTimestamp("fZRQ"); + + List driversLicenseRaws = vehicleLicenseMap.get(idCard); + List licenseRaws = driversLicenseRaws.stream().filter(d -> { + String detail = d.getDriverLicenseDetail(); + JSONObject json = JSON.parseObject(detail, JSONObject.class); + Timestamp timestamp = json.getTimestamp("fZRQ"); + if (timestamp.equals(fZRQ)) { + return true; + } else { + return false; + } + }).collect(Collectors.toList()); + + // 保存新增的驾驶证信息 + if (CollUtil.isNotEmpty(licenseRaws)) { + DriversLicenseRaw driversLicenseRaw = new DriversLicenseRaw(); + driversLicenseRaw.setIdcard(idCard); + String jsonString = jsonObject.toJSONString(); + driversLicenseRaw.setDrivingLicenseDetail(jsonString); + driversLicenseRaw.setCreateOn(LocalDateTime.now()); + driversLicenseRaw.setUpdateOn(LocalDateTime.now()); + driversLicenseRawService.save(driversLicenseRaw); + } + } + } + } + } + + private void saveLastIndex(Long lastIndex, Integer lastCount) { + + File directory = new File(""); + // 临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "irs"; + File file = new File(filePath + File.separator + ACCIDENT_QUERY_INDEX_FILE); + + try { + FileWriter fileWriter = new FileWriter(file); + BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); + + bufferedWriter.write(Long.toString(lastIndex)); + bufferedWriter.newLine(); + bufferedWriter.write(Integer.toString(lastCount)); + bufferedWriter.newLine(); + + bufferedWriter.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void readLastIndex() { + File directory = new File(""); + // 临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "irs"; + File file = new File(filePath + File.separator + ACCIDENT_QUERY_INDEX_FILE); + + try { + // 创建Scanner对象并指定文件路径 + Scanner scanner = new Scanner(file); + + // 读取下标数据 + while (scanner.hasNextLong()) { + long num = scanner.nextLong(); + lastIndex = num; + } + + // 读取字符串数据 + scanner = new Scanner(file); + while (scanner.hasNextInt()) { + int cnt = scanner.nextInt(); + lastCount = cnt; + } + // 关闭Scanner对象 + scanner.close(); + } catch (FileNotFoundException e) { + log.info("读取下标和车牌号失败!"); + e.printStackTrace(); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/task/MyVehicleIllegalQueryTask.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/task/MyVehicleIllegalQueryTask.java new file mode 100644 index 0000000..b6661e7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/task/MyVehicleIllegalQueryTask.java @@ -0,0 +1,512 @@ +package com.ningdatech.carapi.irs.task; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.sql.Timestamp; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import org.springframework.stereotype.Component; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.constant.MissCertEnum; +import com.ningdatech.carapi.common.constant.ViolationTypeEnum; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.irs.model.entity.VehicleViolationIrsData; +import com.ningdatech.carapi.irs.service.CarService; +import com.ningdatech.carapi.irs.service.IVehicleViolationIrsDataService; +import com.ningdatech.carapi.safe.entity.NdVehicleViolation; +import com.ningdatech.carapi.safe.service.INdVehicleViolationService; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.file.utils.StrPool; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.date.StopWatch; +import cn.hutool.core.io.FileUtil; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @description + * @since 2023/05/21 15:38 + */ +@Component +@Slf4j +@Data +public class MyVehicleIllegalQueryTask implements Runnable { + + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final CarService carService; + private final IVehicleViolationIrsDataService violationIrsDataService; + private final CompanyService companyService; + private final RegionsCacheHelper regionsCacheHelper; + private final INdVehicleViolationService vehicleViolationService; + private final IDriverInfoService driverInfoService; + + /** + * 无驾驶证违法行为code列表 + */ + private static final List NO_DRIVING_LICENSE_LIST = + Arrays.asList("5075", "5072", "5077", "5057", "10159", "1082", "70619", "6018", "7503", "7504", "7006", "70069", + "1015", "16444", "1644", "50411", "60182", "8005", "80059", "8605", "5603", "5703", "1610", "5041", "60541", + "1110", "7061", "10050", "10051", "10052", "10059", "1006", "1010", "10109", "1013", "1014", "6086", "5006", + "1005", "56031", "60181", "57021", "57031", "1704", "1701"); + + /** + * 无行驶证违法行为code列表 + */ + private static final List NO_VEHICLE_LICENSE_LIST = Arrays.asList("5071", "5069", "1088", "5702", "5705", + "7216", "7218", "1109", "6085", "5003", "57051", "50031", "57021", "5009", "5015"); + + /** + * 闯红灯(违反交通信号灯) + */ + private static final List VIOLATION_TRAFFIC_LIGHTS_LIST = Arrays.asList("13029", "1625", "16259", "1302"); + + /** + * 违规时段行驶 + */ + private static final List VIOLATION_TIME_LIST = Arrays.asList("8025"); + + /** + * 违规路段行驶 + */ + private static final List VIOLATION_ROAD_LIST = + Arrays.asList("1048", "10489", "40099", "8004", "8803", "11229", "8005J", "8002", "8048", "4009", "10393", + "10397", "1045", "10459", "1310", "13109", "1023", "10239", "8005", "8001C", "1122", "8014"); + + /** + * 接口访问次数限制 + */ + private Integer BIGGEST_ACCESS_NUM = 2950; + /** + * 存储数据下标的文件名 + */ + private String VEHICLE_ILLEGAL_QUERY_INDEX_FILE = "vehicleIllegalIndex.txt"; + /** + * 上次中断的车牌号下标 + */ + private Long lastIndex = 0L; + /** + * 上次执行的次数 + */ + private Integer lastCount = 0; + /** + * 是否继续执行任务 + */ + private boolean isRunning = true; + + public MyVehicleIllegalQueryTask(IVehicleBaseInfoService vehicleBaseInfoService, CarService carService, + IVehicleViolationIrsDataService violationIrsDataService, CompanyService companyService, + RegionsCacheHelper regionsCacheHelper, INdVehicleViolationService vehicleViolationService, + IDriverInfoService driverInfoService) { + this.vehicleBaseInfoService = vehicleBaseInfoService; + this.carService = carService; + this.violationIrsDataService = violationIrsDataService; + this.companyService = companyService; + this.regionsCacheHelper = regionsCacheHelper; + this.vehicleViolationService = vehicleViolationService; + this.driverInfoService = driverInfoService; + } + + @Override + public void run() { + log.info("========== 根据IRS更新车辆违法数据 ==========任务开始"); + // 判断当前执行任务的时间是否为月初的1号 如果是月初1号,任务应该从下标1重新开始跑 + LocalDateTime now = LocalDateTime.now(); + int dayOfMonth = now.getDayOfMonth(); + if (TaskConstant.Data.MONTH_VALUE_ONE.equals(dayOfMonth)){ + // 重置文件中的下标 + saveLastIndex(1L, 0); + } + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + while (isRunning) { + // 读取上次中断的数据下标和和已经执行的次数 + readLastIndex(); + log.info("读取到的下标为{}", lastIndex); + log.info("已访问接口次数{}", lastCount); + Map infoMap = + vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .select(NdVehicleBaseInfo::getId,NdVehicleBaseInfo::getCarPlate)) + .stream().collect(Collectors.toMap(NdVehicleBaseInfo::getId, NdVehicleBaseInfo::getCarPlate)); + OptionalLong maxKey = infoMap.keySet().stream().mapToLong(Long::longValue).max(); + Long maxIndex = null; + if (maxKey.isPresent()){ + maxIndex = maxKey.getAsLong(); + } + // 校验文件中存储的下标对应的车牌号是否一致 + String carNo; + carNo = infoMap.get(lastIndex); + while (Objects.isNull(carNo)) { + log.error("车辆id{}不存在,请检查该车辆信息是否已经被删除!", lastIndex); + // 查找下一个车辆信息,直到车辆信息存在 + lastIndex++; + if (Objects.nonNull(maxIndex) && lastIndex.compareTo(maxIndex) > 0){ + log.info("系统中没有待查询的车牌号"); + return; + } + carNo = infoMap.get(lastIndex); + } + + // 从车辆信息表中从上次执行中断的下标获取一定数量的车牌号 + int cnt = BIGGEST_ACCESS_NUM - lastCount; + LambdaQueryWrapper query = + Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .ge(NdVehicleBaseInfo::getId, lastIndex) + .last("limit " + cnt) + .select(NdVehicleBaseInfo::getCarPlate, NdVehicleBaseInfo::getId) + .isNotNull(NdVehicleBaseInfo::getCarPlate); + List list = vehicleBaseInfoService.list(query); + log.info("此次任务车辆数量为:" + list.size()); + if (CollUtil.isNotEmpty(list)) { + List carPlateList = list.stream().sorted(Comparator.comparing(NdVehicleBaseInfo::getId)) + .map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + Map carMap = list.stream().collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, NdVehicleBaseInfo::getId)); + String[] carPlates = carPlateList.stream().toArray(String[]::new); + // 执行查询任务 + executeTask(carPlates,carMap); + // 当访问次数达到当日设定数量时,结束循环,初始化累计访问次数,并更新车辆违章数据 + if (BIGGEST_ACCESS_NUM.equals(lastCount) || lastIndex.equals(maxIndex)) { + isRunning = false; + // 任务执行完毕后保存最终的数据下标 + TreeMap sortedMap = new TreeMap<>(infoMap); + Map.Entry higherEntry = sortedMap.higherEntry(lastIndex); + if (Objects.nonNull(higherEntry)){ + lastIndex = higherEntry.getKey(); + } + saveLastIndex(lastIndex, 0); + updateViolationData(); + log.info("违法数据更新完成!"); + } + } else { + log.info("本月任务已查询完成!"); + return; + } + } + stopWatch.stop(); + log.info("共更新车辆违法数据:" + lastCount + "条"); + log.info("========== 根据IRS更新车辆违法数据==========任务结束 {}s", stopWatch.getTotalTimeSeconds()); + + } + + private void executeTask(String[] carPlates, Map carMap) { + // 获取车牌号的所有违章信息 + Map> violationIrsDataMap = violationIrsDataService.list(Wrappers.lambdaQuery(VehicleViolationIrsData.class) + .select(VehicleViolationIrsData::getId,VehicleViolationIrsData::getCarPlate, VehicleViolationIrsData::getViolationTime, + VehicleViolationIrsData::getViolationType,VehicleViolationIrsData::getViolationKind)).stream() + .collect(Collectors.groupingBy(VehicleViolationIrsData::getCarPlate)); + for (int i = 0; i < carPlates.length; i++) { + // 执行任务代码 + String carPlate = carPlates[i]; + String dataJsonStr; + try { + dataJsonStr = carService.vehicleIllegalQuery(carPlate, i); + if (Objects.nonNull(dataJsonStr)) { + JSONObject jsonObject = JSON.parseObject(dataJsonStr, JSONObject.class); + String msg = jsonObject.getString("msg"); + if (msg.contains("签名错误")) { + // 签名错误 + lastIndex = carMap.get(carPlate); + lastCount++; + saveLastIndex(lastIndex, lastCount); + log.error("签名错误,任务中断时车牌号下标为{}", lastIndex); + break; + } + } + } catch (Exception e) { + // 接口请求异常,结束循环 + lastIndex = carMap.get(carPlate); + lastCount++; + saveLastIndex(lastIndex, lastCount); + log.error("任务中断时车牌号下标为{},中断原因:{}", lastIndex,e.getMessage()); + break; + } + if (Objects.isNull(dataJsonStr)) { + // 刷新请求秘钥失败,接口调用内容返回空,任务中断,保存下标 + lastIndex = carMap.get(carPlate); + saveLastIndex(lastIndex, lastCount); + log.error("车辆违法查询接口调用失败,车牌号为:" + carPlate); + break; + } + int index = i + 1; + // 如果还有下一个待查询车牌号 + if (index < carPlates.length) { + lastIndex = carMap.get(carPlates[index]); + }else { + // 已经是最后一个车牌号 + lastIndex = carMap.get(carPlates[i]); + } + log.info("下次待查询车牌号下标为:" + lastIndex); + lastCount++; + log.info("已访问车辆违法查询IRS接口 {} 次", lastCount); + log.info("此次访问的违法车牌号为 {}", carPlate); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + List array = JSON.parseArray(data, JSONObject.class); + if (CollUtil.isEmpty(array)) { + log.info("该车牌号没有违法行为信息!"); + continue; + } + + for (JSONObject jsonObject : array) { + if (Objects.nonNull(jsonObject)) { + VehicleViolationIrsData vid = new VehicleViolationIrsData(); + vid.setCarPlate(carPlate); + // 获取违法日期 + Timestamp wfsj = jsonObject.getTimestamp("wfsj"); + LocalDateTime vehicleIllegalTime = LocalDateTimeUtil.of(wfsj); + // 获取违法行为 + String wfxw = jsonObject.getString("wfxw"); + // 获取处罚种类 + String cfzl = jsonObject.getString("cfzl"); + String key = vehicleIllegalTime + wfxw + cfzl; + HashSet hashSet = new HashSet<>(); + + if (violationIrsDataMap.containsKey(carPlate)) { + List dataList = violationIrsDataMap.get(carPlate); + Map dataMap = dataList.stream() + .filter(v -> hashSet.add(v.getViolationTime() + v.getViolationType() + v.getViolationKind())) + .collect(Collectors.toMap(v -> v.getViolationTime() + v.getViolationType() + v.getViolationKind(), v -> v)); + if (dataMap.containsKey(key)) { + VehicleViolationIrsData irsData = dataMap.get(key); + // 数据已经存在 + vid.setId(irsData.getId()); + } + } + vid.setViolationTime(vehicleIllegalTime); + String jsonStr = jsonObject.toJSONString(); + vid.setJsonStrData(jsonStr); + vid.setViolationType(wfxw); + vid.setViolationKind(cfzl); + vid.setCreateOn(LocalDateTime.now()); + vid.setUpdateOn(LocalDateTime.now()); + violationIrsDataService.saveOrUpdate(vid); + } + } + } + } + + private void saveLastIndex(Long lastIndex, Integer lastCount) { + + File directory = new File(""); + // 临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "irs"; + File file = new File(filePath + File.separator + VEHICLE_ILLEGAL_QUERY_INDEX_FILE); + + try { + FileWriter fileWriter = new FileWriter(file); + BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); + + bufferedWriter.write(Long.toString(lastIndex)); + bufferedWriter.newLine(); + bufferedWriter.write(Integer.toString(lastCount)); + bufferedWriter.newLine(); + + bufferedWriter.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void readLastIndex() { + File directory = new File(""); + // 临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "irs"; + File file = new File(filePath + File.separator + VEHICLE_ILLEGAL_QUERY_INDEX_FILE); + try { + List dataList = FileUtil.readLines(file, StandardCharsets.UTF_8); + if (CollUtil.isNotEmpty(dataList) && dataList.size() == 2) { + lastIndex = Long.valueOf(dataList.get(0)); + lastCount = Integer.valueOf(dataList.get(1)); + } + } catch (Exception e) { + log.info("读取下标和车牌号失败!"); + e.printStackTrace(); + } + } + + public void updateViolationData() { + + Map map = violationIrsDataService + .list(Wrappers.lambdaQuery(VehicleViolationIrsData.class) + .select(VehicleViolationIrsData::getId, VehicleViolationIrsData::getViolationType)) + .stream() + .collect(Collectors.toMap(VehicleViolationIrsData::getId, VehicleViolationIrsData::getViolationType)); + + List violationIdList = map.keySet().stream().filter(c -> { + String type = map.get(c); + return NO_DRIVING_LICENSE_LIST.contains(type) || NO_VEHICLE_LICENSE_LIST.contains(type) + || VIOLATION_TRAFFIC_LIGHTS_LIST.contains(type) || VIOLATION_TIME_LIST.contains(type) + || VIOLATION_ROAD_LIST.contains(type); + }).collect(Collectors.toList()); + + // 获取需要更新的数据 + Map> listMap = + violationIrsDataService.list(Wrappers.lambdaQuery(VehicleViolationIrsData.class) + .select(VehicleViolationIrsData::getId,VehicleViolationIrsData::getCarPlate, + VehicleViolationIrsData::getJsonStrData)) + .stream().filter(v -> violationIdList.contains(v.getId())) + .collect(Collectors.groupingBy(VehicleViolationIrsData::getCarPlate)); + + // 获取车牌号 + Set carPlateList = listMap.keySet(); + // 过滤掉不在系统中的车牌号 + List carPlates = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class).select(NdVehicleBaseInfo::getCarPlate)); + List carPlateLists = carPlateList.stream().filter(carPlates::contains).collect(Collectors.toList()); + // 违章数据的车牌号都不在系统中,不需要更新 + if (CollUtil.isEmpty(carPlateLists)){ + log.info("没有需要更新的数据!"); + return; + } + // 获取车辆基本信息 + List vehicleBaseInfos = vehicleBaseInfoService + .list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .select(NdVehicleBaseInfo::getCarPlate,NdVehicleBaseInfo::getCompanyId) + .in(NdVehicleBaseInfo::getCarPlate, carPlateLists)); + Map vehicleBaseInfoMap = + vehicleBaseInfos.stream().collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + // 获取企业信息 + Map companyMap = + companyService.list().stream().collect(Collectors.toMap(Company::getId, c -> c)); + + // 获取已经存在的违章数据 + List violationTmpVas = vehicleViolationService + .list(Wrappers.lambdaQuery(NdVehicleViolation.class).in(NdVehicleViolation::getCarPlate, carPlateLists)); + Map violationMap = violationTmpVas.stream() + .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(a -> a.getCarPlate() + + StrPool.SEMICOLON + a.getViolationDate() + StrPool.SEMICOLON + a.getViolationType()))), ArrayList::new)) + .stream().collect(Collectors.toMap(d -> d.getCarPlate() + d.getViolationDate() + d.getViolationType() + d.getViolationAddress(), d -> d)); + + for (String carPlate : carPlateLists) { + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoMap.get(carPlate); + + Long companyId = vehicleBaseInfo.getCompanyId(); + Company company = null; + if (Objects.nonNull(companyId)) { + company = companyMap.get(companyId); + } + + // 获取IRS违章数据 + List violationIrsDataList = listMap.get(carPlate); + + for (VehicleViolationIrsData violationIrsData : violationIrsDataList) { + + // 解析获取事故时间等信息 + String jsonStrData = violationIrsData.getJsonStrData(); + JSONObject jsonObject = JSON.parseObject(jsonStrData); + + NdVehicleViolation vehicleViolation = new NdVehicleViolation(); + + // 获取违法日期 + Timestamp wfsj = jsonObject.getTimestamp("wfsj"); + LocalDateTime vehicleIllegalTime = LocalDateTimeUtil.of(wfsj); + vehicleViolation.setViolationDate(vehicleIllegalTime); + // 获取违法地址 + String wfdz = jsonObject.getString("wfdz"); + // 获取违法行为 + String wfxw = jsonObject.getString("wfxw"); + // 获取违法编号 + String wfbh = jsonObject.getString("wfbh"); + + // 获取经纬度 + String longitude = jsonObject.getString("jd"); + String latitude = jsonObject.getString("wd"); + + // 判断是否已经插入过 + String key = carPlate + vehicleIllegalTime + wfdz + wfxw; + if (violationMap.containsKey(key)) { + NdVehicleViolation violation = violationMap.get(key); + vehicleViolation.setId(violation.getId()); + } + vehicleViolation.setCarPlate(carPlate); + // 获取行政区划 + String xzqh = jsonObject.getString("xzqh"); + // 获取区域信息 + Long regionId = regionsCacheHelper.getIdByCode(xzqh); + String regionName = regionsCacheHelper.getDisplayName(regionId); + vehicleViolation.setRegionId(regionId); + vehicleViolation.setRegionName(regionName); + // 如果是闯红灯 + if (VIOLATION_TRAFFIC_LIGHTS_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.RED_LIGHT.getCode()); + vehicleViolation.setAddressRedLight(wfdz); + } else if (NO_DRIVING_LICENSE_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.MISS_CERT.getCode()); + vehicleViolation.setMissingCertificateType(MissCertEnum.DRIVER_LINCENSE.getCode()); + } else if (NO_VEHICLE_LICENSE_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.MISS_CERT.getCode()); + vehicleViolation.setMissingCertificateType(MissCertEnum.DRIVE_PERMIT.getCode()); + } else if (VIOLATION_TIME_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.PERIOD.getCode()); + int hour = vehicleIllegalTime.getHour(); + int minute = vehicleIllegalTime.getMinute(); + String period = null; + // 时间段暂时设置为违章时间所在小时的前后半小时 + if (minute < 30) { + period = vehicleIllegalTime.minusHours(1).getHour() + TaskConstant.Data.VIOLATION_TIME_HALF + + StrPool.DASH + hour + TaskConstant.Data.VIOLATION_TIME_HALF; + } else { + period = hour + TaskConstant.Data.VIOLATION_TIME_START + StrPool.DASH + + vehicleIllegalTime.plusHours(1).getHour() + TaskConstant.Data.VIOLATION_TIME_START; + } + vehicleViolation.setViolationPeriod(period); + // if (hour >= TaskContant.Data.VIOLATION_TIME_SEVEN && hour <= + // TaskContant.Data.VIOLATION_TIME_NINE) { + // period = TaskContant.Data.VIOLATION_TIME_AM_START + StrPool.DASH + // + TaskContant.Data.VIOLATION_TIME_AM_END; + // vehicleViolation.setViolationPeriod(period); + // } else if (hour >= TaskContant.Data.VIOLATION_TIME_SIXTEEN + // && hour <= TaskContant.Data.VIOLATION_TIME_EIGHTEEN) { + // period = TaskContant.Data.VIOLATION_TIME_PM_START + StrPool.DASH + // + TaskContant.Data.VIOLATION_TIME_PM_END; + // vehicleViolation.setViolationPeriod(period); + // } + } else if (VIOLATION_ROAD_LIST.contains(wfxw)) { + vehicleViolation.setViolationType(ViolationTypeEnum.SECTION.getCode()); + vehicleViolation.setWaySection(wfdz); + } + // 获取当事人(驾驶员) + String driverName = jsonObject.getString("dsr"); + + vehicleViolation.setCompanyId(companyId); + if (Objects.nonNull(company)) { + vehicleViolation.setCompanyName(company.getName()); + } + // 驾驶员姓名和企业名称获取驾驶员信息 + List driverInfoList = driverInfoService.list(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getDriverName, driverName).eq(DriverInfo::getCompanyId, companyId)); + if (CollUtil.isEmpty(driverInfoList)) { + log.info("该车牌号对应的企业下没有该驾驶员信息"); + } else { + // 获取最后一个 + DriverInfo driverInfo = driverInfoList.get(driverInfoList.size() - 1); + vehicleViolation.setDriverId(driverInfo.getId()); + } + vehicleViolation.setDriverName(driverName); + vehicleViolation.setLongitude(longitude); + vehicleViolation.setLatitude(latitude); + vehicleViolation.setViolationNo(wfbh); + vehicleViolation.setViolationAddress(wfdz); + vehicleViolationService.saveOrUpdate(vehicleViolation); + } + } + log.info("违章数据更新完成!"); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/task/MyVehicleLicenseQueryTask.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/task/MyVehicleLicenseQueryTask.java new file mode 100644 index 0000000..0326489 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/task/MyVehicleLicenseQueryTask.java @@ -0,0 +1,275 @@ +package com.ningdatech.carapi.irs.task; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.sql.Timestamp; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import org.springframework.stereotype.Component; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.irs.entity.DriversLicenseRaw; +import com.ningdatech.carapi.irs.service.DriverService; +import com.ningdatech.carapi.irs.service.IDriversLicenseRawService; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; +import cn.hutool.core.io.FileUtil; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @description + * @since 2023/05/21 15:38 + */ +@Component +@Slf4j +@Data +public class MyVehicleLicenseQueryTask implements Runnable { + + private final DriverService driverService; + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final IDriversLicenseRawService driversLicenseRawService; + + /** + * 接口访问次数限制 + */ + private Integer BIGGEST_ACCESS_NUM = 95; + /** + * 存储数据下标的文件名 + */ + private String ACCIDENT_QUERY_INDEX_FILE = "vehicleLicenseIndex.txt"; + /** + * 上次中断的驾驶员下标 + */ + private Long lastIndex = 0L; + /** + * 上次执行的次数 + */ + private Integer lastCount = 0; + /** + * 是否继续执行任务 + */ + private boolean isRunning = true; + + public MyVehicleLicenseQueryTask(DriverService driverService, IVehicleBaseInfoService vehicleBaseInfoService, + IDriversLicenseRawService driversLicenseRawService) { + this.driverService = driverService; + this.vehicleBaseInfoService = vehicleBaseInfoService; + this.driversLicenseRawService = driversLicenseRawService; + } + + @Override + public void run() { + + log.info("========== 根据IRS更新行驶证数据 ==========任务开始"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + while (isRunning) { + // 读取上次中断的数据下标和和已经执行的次数 + readLastIndex(); + Map infoMap = + vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .select(NdVehicleBaseInfo::getId,NdVehicleBaseInfo::getCarPlate)) + .stream().collect(Collectors.toMap(NdVehicleBaseInfo::getId, NdVehicleBaseInfo::getCarPlate)); + OptionalLong maxKey = infoMap.keySet().stream().mapToLong(Long::longValue).max(); + Long maxIndex = null; + if (maxKey.isPresent()){ + maxIndex = maxKey.getAsLong(); + } + // 校验下标对应的车牌号是否一致 + String carNo; + carNo = infoMap.get(lastIndex); + while (Objects.isNull(carNo)) { + log.info("车辆id{}不存在,请检查该车辆信息是否已经被删除!", lastIndex); + // 查找下一个车辆信息,直到车辆信息存在 + lastIndex++; + if (Objects.nonNull(maxIndex) && lastIndex.compareTo(maxIndex) > 0){ + log.info("系统中没有待查询的车牌号"); + return; + } + carNo = infoMap.get(lastIndex); + } + + // 从车辆信息表中从上次执行中断的下标获取一定数量的车牌号 + int cnt = BIGGEST_ACCESS_NUM - lastCount; + LambdaQueryWrapper query = + Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .ge(NdVehicleBaseInfo::getId, lastIndex) + .last("limit " + cnt) + .select(NdVehicleBaseInfo::getCarPlate, NdVehicleBaseInfo::getId) + .isNotNull(NdVehicleBaseInfo::getCarPlate); + List list = vehicleBaseInfoService.list(query); + log.info("此次任务车辆数量为:" + list.size()); + if (CollUtil.isNotEmpty(list)) { + List carPlateList = list.stream().sorted(Comparator.comparing(NdVehicleBaseInfo::getId)) + .map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + Map carMap = list.stream().collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, NdVehicleBaseInfo::getId)); + String[] carPlates = carPlateList.stream().toArray(String[]::new); + // 执行查询任务 + executeTask(carPlates,carMap); + // 当访问次数达到当日设定数量时,结束循环,初始化累计访问次数 + if (BIGGEST_ACCESS_NUM.equals(lastCount) || lastIndex.equals(maxIndex)) { + isRunning = false; + // 任务执行完毕后保存最终的数据下标 + TreeMap sortedMap = new TreeMap<>(infoMap); + Map.Entry higherEntry = sortedMap.higherEntry(lastIndex); + if (Objects.nonNull(higherEntry)){ + lastIndex = higherEntry.getKey(); + } + saveLastIndex(lastIndex, 0); + } + } else { + log.info("本月任务已查询完成!"); + return; + } + } + stopWatch.stop(); + log.info("共更新行驶证数据:" + lastCount + "条"); + log.info("========== 根据IRS更新行驶证数据==========任务结束 {}s", stopWatch.getTotalTimeSeconds()); + + } + + private void executeTask(String[] carPlates, Map carMap) { + for (int i = 0; i < carPlates.length; i++) { + // 执行任务代码 + String carPlate = carPlates[i]; + String dataJsonStr; + try { + dataJsonStr = driverService.vehicleLicenseQuery(carPlate,i); + if (Objects.nonNull(dataJsonStr)) { + JSONObject jsonObject = JSON.parseObject(dataJsonStr, JSONObject.class); + String msg = jsonObject.getString("msg"); + if (msg.contains("签名错误")) { + // 签名错误 + lastIndex = carMap.get(carPlate); + lastCount++; + saveLastIndex(lastIndex, lastCount); + log.error("签名错误,任务中断时车牌号下标为{}", lastIndex); + break; + } + } + } catch (Exception e) { + // 接口请求异常,结束循环 + lastIndex = carMap.get(carPlate); + lastCount++; + saveLastIndex(lastIndex, lastCount); + log.error("任务中断时车牌号下标为{},中断原因:{}", lastIndex,e.getMessage()); + break; + } + if (Objects.isNull(dataJsonStr)) { + // 刷新请求秘钥失败,接口调用内容返回空,任务中断,保存下标 + lastIndex = carMap.get(carPlate); + saveLastIndex(lastIndex, lastCount); + log.error("车辆行驶证查询接口调用失败,车牌号为:" + carPlate); + break; + } + int index = i + 1; + // 如果还有下一个待查询车牌号 + if (index < carPlates.length) { + lastIndex = carMap.get(carPlates[index]); + }else { + // 已经是最后一个车牌号 + lastIndex = carMap.get(carPlates[i]); + } + log.info("下次待查询车牌号下标为:" + lastIndex); + lastCount++; + log.info("已访问行驶证查询IRS接口 {} 次", lastCount); + log.info("此次访问的车牌号为 {}", carPlate); + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + List array = JSON.parseArray(data, JSONObject.class); + if (CollUtil.isEmpty(array)) { + log.info("该车牌号没有行驶证信息!"); + continue; + } + // 获取身份证号的所有行驶证信息 + Map> vehicleLicenseMap = + driversLicenseRawService.list().stream().collect(Collectors.groupingBy(DriversLicenseRaw::getCarPlate)); + + for (JSONObject jsonObject : array) { + if (Objects.nonNull(jsonObject)) { + // 获取发证日期,判断是否重复 + Timestamp fZRQ = jsonObject.getTimestamp("fZRQ"); + + List licenseRaws = Lists.newArrayList(); + List driversLicenseRaws = vehicleLicenseMap.get(carPlate); + if (CollUtil.isNotEmpty(driversLicenseRaws)) { + licenseRaws = driversLicenseRaws.stream().filter(d -> { + String detail = d.getDrivingLicenseDetail(); + JSONObject json = JSON.parseObject(detail, JSONObject.class); + Timestamp timestamp = json.getTimestamp("fZRQ"); + if (timestamp.equals(fZRQ)) { + return true; + } else { + return false; + } + }).collect(Collectors.toList()); + } + + // 没有跟当前发证日期相同地行驶证信息,保存新增的行驶证信息 + if (CollUtil.isEmpty(licenseRaws)) { + DriversLicenseRaw driversLicenseRaw = new DriversLicenseRaw(); + driversLicenseRaw.setCarPlate(carPlate); + String jsonString = jsonObject.toJSONString(); + driversLicenseRaw.setDrivingLicenseDetail(jsonString); + driversLicenseRaw.setCreateOn(LocalDateTime.now()); + driversLicenseRaw.setUpdateOn(LocalDateTime.now()); + driversLicenseRawService.save(driversLicenseRaw); + } + } + } + } + } + + private void saveLastIndex(Long lastIndex, Integer lastCount) { + + File directory = new File(""); + // 临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "irs"; + File file = new File(filePath + File.separator + ACCIDENT_QUERY_INDEX_FILE); + + try { + FileWriter fileWriter = new FileWriter(file); + BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); + + bufferedWriter.write(Long.toString(lastIndex)); + bufferedWriter.newLine(); + bufferedWriter.write(Integer.toString(lastCount)); + bufferedWriter.newLine(); + + bufferedWriter.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void readLastIndex() { + File directory = new File(""); + // 临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "irs"; + File file = new File(filePath + File.separator + ACCIDENT_QUERY_INDEX_FILE); + try { + List dataList = FileUtil.readLines(file, StandardCharsets.UTF_8); + if (CollUtil.isNotEmpty(dataList) && dataList.size() == 2) { + lastIndex = Long.valueOf(dataList.get(0)); + lastCount = Integer.valueOf(dataList.get(1)); + } + } catch (Exception e) { + log.info("读取下标和车牌号失败!"); + e.printStackTrace(); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/utils/HttpUtil.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/utils/HttpUtil.java new file mode 100644 index 0000000..8a929a3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/utils/HttpUtil.java @@ -0,0 +1,215 @@ +package com.ningdatech.carapi.irs.utils; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.conn.ssl.DefaultHostnameVerifier; +import org.apache.http.conn.util.PublicSuffixMatcher; +import org.apache.http.conn.util.PublicSuffixMatcherLoader; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +public class HttpUtil { + private Logger logger = LoggerFactory.getLogger(getClass()); + private RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(15000) + .setConnectTimeout(15000) + .setConnectionRequestTimeout(15000) + .build(); + private static HttpUtil instance = null; + private HttpUtil(){} + + public static HttpUtil getInstance(){ + if (instance == null) { + instance = new HttpUtil(); + } + return instance; + } + + /** + * 发送 post 请求 + * @param httpUrl 地址 + */ + public String sendHttpPost(String httpUrl) { + HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost + return sendHttpPost(httpPost); + } + + /** + * 发送 post 请求 + * @param httpUrl 地址 + * @param params 参数(格式:key1=value1&key2=value2) + */ + public String sendHttpPost(String httpUrl, String params) { + HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost + try { + //设置参数 + StringEntity stringEntity = new StringEntity(params, "UTF-8"); + stringEntity.setContentType("application/x-www-form-urlencoded"); + httpPost.setEntity(stringEntity); + } catch (Exception e) { + logger.error(e.getMessage(),e); + } + return sendHttpPost(httpPost); + } + + /** + * 发送 post 请求 + * @param httpUrl 地址 + * @param maps 参数 + */ + public String sendHttpPost(String httpUrl, Map maps) { + HttpPost httpPost= new HttpPost(httpUrl);// 创建 httpPost + // 创建参数队列 + List nameValuePairs = new ArrayList(); + for (String key : maps.keySet()) { + nameValuePairs.add(new BasicNameValuePair(key, maps.get(key))); + } + try { + httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8")); + } catch (Exception e) { + logger.error(e.getMessage(),e); + } + return sendHttpPost(httpPost); + } + + /** + * 发送 Post请求 + * @param httpPost + *@return + */ + private String sendHttpPost(HttpPost httpPost) { + CloseableHttpClient httpClient = null; + CloseableHttpResponse response = null; + HttpEntity entity = null; + String responseContent = null; + try { + // 创建默认的 httpClient 实例. + httpClient = HttpClients.createDefault(); + httpPost.setConfig(requestConfig); + // 执行请求 + response = httpClient.execute(httpPost); + entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + } catch (Exception e) { + logger.error(e.getMessage(),e); + } finally { + try { + // 关闭连接,释放资源 + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + logger.error(e.getMessage(),e); + } + } + return responseContent; + } + + /** + * 发送 get 请求 + * @param httpUrl + */ + public String sendHttpGet(String httpUrl) { + HttpGet httpGet = new HttpGet(httpUrl);// 创建 get 请求 + return sendHttpGet(httpGet); + } + + /** + * 发送 get请求 Https + * @param httpUrl + */ + public String sendHttpsGet(String httpUrl) { + HttpGet httpGet = new HttpGet(httpUrl);// 创建 get 请求 + return sendHttpsGet(httpGet); + } + + /** + * 发送 Get请求 + * @param httpGet + *@return + */ + private String sendHttpGet(HttpGet httpGet) { + CloseableHttpClient httpClient = null; + CloseableHttpResponse response = null; + HttpEntity entity = null; + String responseContent = null; + try { + // 创建默认的 httpClient 实例. + httpClient = HttpClients.createDefault(); + httpGet.setConfig(requestConfig); + // 执行请求 + response = httpClient.execute(httpGet); + entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + } catch (Exception e) { + logger.error(e.getMessage(),e); + } finally { + try { + // 关闭连接,释放资源 + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + logger.error(e.getMessage(),e); + } + } + return responseContent; + } + + /** + * 发送 Get请求 Https + *@return + */ + private String sendHttpsGet(HttpGet httpGet) { + CloseableHttpClient httpClient = null; + CloseableHttpResponse response = null; + HttpEntity entity = null; + String responseContent = null; + try { + // 创建默认的 httpClient 实例. + PublicSuffixMatcher publicSuffixMatcher = PublicSuffixMatcherLoader.load(new + URL(httpGet.getURI().toString())); + DefaultHostnameVerifier hostnameVerifier = new DefaultHostnameVerifier(publicSuffixMatcher); + httpClient = HttpClients.custom().setSSLHostnameVerifier(hostnameVerifier).build(); + httpGet.setConfig(requestConfig); + // 执行请求 + response = httpClient.execute(httpGet); + entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + } catch (Exception e) { + logger.error(e.getMessage(),e); + } finally { + try { + // 关闭连接,释放资源 + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + logger.error(e.getMessage(),e); + } + } + return responseContent; + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/utils/Md5Utils.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/utils/Md5Utils.java new file mode 100644 index 0000000..34e084f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/irs/utils/Md5Utils.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.irs.utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.security.MessageDigest; + +public class Md5Utils { + private static final Logger LOGGER = LoggerFactory.getLogger(Md5Utils.class); + public static byte[] md5(String s) { + MessageDigest algorithm; + try { + algorithm = MessageDigest.getInstance("MD5"); + algorithm.reset(); + algorithm.update(s.getBytes("UTF-8")); + byte[] messageDigest = algorithm.digest(); + return messageDigest; + } catch (Exception e) { + LOGGER.error("MD5 Error...", e); + } + return null; + } + private static final String toHex(byte hash[]) { + if (hash == null) { + return null; + } + StringBuffer buf = new StringBuffer(hash.length * 2); + int i; + for (i = 0; i < hash.length; i++) { + if ((hash[i] & 0xff) < 0x10) { + buf.append("0"); + } + buf.append(Long.toString(hash[i] & 0xff, 16)); + } + return buf.toString(); + } + + public static String hash(String s) { + try { + return new String(toHex(md5(s)).getBytes("UTF-8"), "UTF-8"); + } catch (Exception e) { + LOGGER.error("not supported charset...{}", e); + return s; + } + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/constant/LogBackupConstant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/constant/LogBackupConstant.java new file mode 100644 index 0000000..0e3dc3a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/constant/LogBackupConstant.java @@ -0,0 +1,15 @@ +package com.ningdatech.carapi.log.constant; + +/** + * 短信验证常量 + * @return + * @author CMM + * @since 2023/06/02 11:31 + */ +public interface LogBackupConstant { + + String LOG_FILE_NAME = "logs.tar.gz"; + String LOG_FILE_PATH = "backupLogs"; + + String HOST = "iZbp13nwyvib53j4j1p2xoZ"; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/controller/LogBackupController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/controller/LogBackupController.java new file mode 100644 index 0000000..a3acff3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/controller/LogBackupController.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.log.controller; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.carapi.log.manage.LogManage; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * 用户登录获取验证码 + * + * @author CMM + * @since 2023/01/06 16:38 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/log") +@Api(value = "LogBackupController", tags = "日志备份下载") +@RequiredArgsConstructor +public class LogBackupController { + + private final LogManage logManage; + + @ApiOperation(value = "log backup", notes = "log backup") + @GetMapping("/backup") + public String backupLog() { + return logManage.backupLog(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/controller/OpenApiLogBackupController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/controller/OpenApiLogBackupController.java new file mode 100644 index 0000000..05aec5f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/controller/OpenApiLogBackupController.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.log.controller; + +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.carapi.log.manage.LogBackupManage; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * 服务器系统日志备份 + * + * @author CMM + * @since 2023/01/06 16:38 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/log/backup") +@Api(value = "OpenApiLogBackupController", tags = "服务器系统日志备份") +@RequiredArgsConstructor +public class OpenApiLogBackupController { + + private final LogBackupManage logBackupManage; + + @GetMapping( "/download") + @ApiOperation(value = "将服务器定时备份的系统日志通过接口返回") + public ResponseEntity downloadFile(){ + return logBackupManage.downloadFile(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/manage/LogBackupManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/manage/LogBackupManage.java new file mode 100644 index 0000000..59d751b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/manage/LogBackupManage.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.log.manage; + +import java.io.File; + +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; + +import cn.hutool.core.io.FileUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/01/06 16:40 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class LogBackupManage { + + public ResponseEntity downloadFile() { + // 指定.tar.gz文件的路径 + File directory = new File(""); + // 临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "bash/logs.tar.gz"; + File file = new File(filePath); + byte[] fileBytes = FileUtil.readBytes(file); + + + // 设置响应头信息 + HttpHeaders headers = new HttpHeaders(); + headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=logs.tar.gz"); + headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_OCTET_STREAM_VALUE); + headers.add(HttpHeaders.CONTENT_LENGTH, String.valueOf(fileBytes.length)); + + // 返回ResponseEntity对象 + return ResponseEntity.ok() + .headers(headers) + .body(fileBytes); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/manage/LogManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/manage/LogManage.java new file mode 100644 index 0000000..5e407e2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/manage/LogManage.java @@ -0,0 +1,67 @@ +package com.ningdatech.carapi.log.manage; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Objects; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.util.FileCopyUtils; +import org.springframework.web.client.RestTemplate; + +import com.ningdatech.carapi.log.constant.LogBackupConstant; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/01/06 16:40 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class LogManage { + + private final RestTemplate restTemplate; + + @Value("${log.backup.url}") + private String backupUrl; + + public String backupLog() { + + ResponseEntity entity = restTemplate.getForEntity(backupUrl, byte[].class); + if (Boolean.TRUE.equals(saveFile(entity, LogBackupConstant.LOG_FILE_PATH))) { + return "备份成功"; + }else { + return "备份失败"; + } + } + + private Boolean saveFile(ResponseEntity entity, String backupFilePath) { + byte[] body = entity.getBody(); + try { + if (Objects.nonNull(body)) { + File directory = new File(""); + // 临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + backupFilePath; + File saveDir = new File(filePath); + if (!saveDir.exists()) { + saveDir.mkdirs(); + } + File saveFile = new File(saveDir, LogBackupConstant.LOG_FILE_NAME); + FileOutputStream fos = new FileOutputStream(saveFile); + FileCopyUtils.copy(body, fos); + fos.flush(); + fos.close(); + return true; + } + } catch (IOException e) { + log.error("文件保存失败:" + e.getMessage()); + return false; + } + return false; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/task/LogBackupTask.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/task/LogBackupTask.java new file mode 100644 index 0000000..3ed763b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/log/task/LogBackupTask.java @@ -0,0 +1,52 @@ +package com.ningdatech.carapi.log.task; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import com.ningdatech.carapi.log.constant.LogBackupConstant; +import com.ningdatech.carapi.log.manage.LogManage; + +import cn.hutool.core.date.StopWatch; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * 事故责任认定书信息 + * + * @author CMM + * @description + * @since 2022/12/02 16:28 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class LogBackupTask { + @Value("${task.switch.is-open}") + private boolean flag; + + private final LogManage logManage; + + + /** + * 定时备份服务器系统日志 每天23点的55分钟开始执行一次 + * + */ + @Scheduled(cron = "0 55 23 * * ?") + public void doTask() throws UnknownHostException { + if (flag && LogBackupConstant.HOST.equals(InetAddress.getLocalHost().getHostName())) { + log.info("========== 更新服务器备份日志 ==========任务开始"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + String result = logManage.backupLog(); + log.info(result); + log.info("本机IP为:" + InetAddress.getLocalHost().getHostAddress()); + stopWatch.stop(); + log.info("========== 更新服务器备份日志 ==========任务结束 耗时 {}s", stopWatch.getTotalTimeSeconds()); + } + + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/aop/TaskLock.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/aop/TaskLock.java new file mode 100644 index 0000000..90223e6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/aop/TaskLock.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.open.aop; + +import java.lang.annotation.*; + +/** + * @Classname TackLock + * @Description + * @Date 2022/10/31 15:34 + * @Created by PoffyZhang + */ + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface TaskLock { + + /** + * 定时任务名称 + * + * @return + */ + String name() default ""; + + /** + * redis缓存key值 + * + * @return + */ + String key(); + + /** + * 过期时间单位s (自动解锁时间,防止死锁) + * + * @return + */ + int expired(); + + /** + * 执行完毕是否解锁 + * + * @return + */ + boolean unLock() default true; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/aop/TaskLockAspect.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/aop/TaskLockAspect.java new file mode 100644 index 0000000..10fa7c2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/aop/TaskLockAspect.java @@ -0,0 +1,88 @@ +package com.ningdatech.carapi.open.aop; + +import com.ningdatech.cache.redis.RedisOps; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import java.time.Duration; +import java.util.UUID; + +/** + * @program: + * @description: 定时任务锁切面 + * @author: PoffyZhang + * @created: 2022/11/1 09:12 + */ +@Aspect +@Component +@Slf4j +@AllArgsConstructor +@Order(10) +public class TaskLockAspect { + + private RedisOps redisOps; + + @Pointcut("@annotation(com.ningdatech.carapi.open.aop.TaskLock)") + public void taskLockAspect() { + + } + + @Around("taskLockAspect() && @annotation(taskLock)") + public Object doAround(ProceedingJoinPoint proceedingJoinPoint, TaskLock taskLock) throws Throwable { + String value = UUID.randomUUID().toString(); + try { + if (lock(taskLock.key(), value, taskLock.expired())) { + return proceedingJoinPoint.proceed(); + } + } catch (Exception e) { + log.error("定时任务执行失败,{}", taskLock.key(), e); + } finally { + // 执行完毕解除锁 + if (taskLock.unLock()) { + String lockValue = getLockValue(taskLock.key()); + if (StringUtils.isNotEmpty(lockValue) && lockValue.equals(value)) { + // 解锁设置为延时1S + unLock(taskLock.key()); + } + } + } + return null; + } + + + + /** + * 加锁 + * @param key + * @param value + * @param time + * @return + */ + public boolean lock(String key , String value , int time){ + return redisOps.setXx(key,value,time,false); + } + + + /** + * 解锁 + * @param key + */ + public void unLock(String key){ + redisOps.expire(key,Duration.ofSeconds(1)); + } + + /** + * 获取锁值 + * @param key + * @return + */ + public String getLockValue(String key){ + return redisOps.get(key); + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/contants/AlarmContant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/contants/AlarmContant.java new file mode 100644 index 0000000..532cd2f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/contants/AlarmContant.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.open.contants; + +/** + * @Classname AlarmContant + * @Description + * @Date 2022/10/31 14:07 + * @Created by PoffyZhang + */ +public class AlarmContant { + + private AlarmContant(){ + + } + + public static final String ALARM_DATA_PRICTURE_KEY = "alarm_data:picture"; + + public static final String ALARM_DATA_VIDEO_KEY = "alarm_data:video"; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiAbnormalBehaviorAlarmDataController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiAbnormalBehaviorAlarmDataController.java new file mode 100644 index 0000000..4ed1a75 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiAbnormalBehaviorAlarmDataController.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.open.controller; + +import com.ningdatech.carapi.open.manage.AlarmDataManage; +import com.ningdatech.carapi.open.model.dto.AlarmDataPictureDTO; +import com.ningdatech.carapi.open.model.dto.AlarmDataVideoDTO; +import com.ningdatech.openapi.signature.annatation.OpenApiSignature; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + * @Classname AbnormalBehaviorAlarmDataController + * @Description + * @Date 2022/10/28 10:05 + * @Created by PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/alarm-data-save") +@Api(value = "AbnormalBehaviorAlarmData", tags = "保存异常行为数据") +@RequiredArgsConstructor +public class OpenApiAbnormalBehaviorAlarmDataController { + + private final AlarmDataManage alarmDataManage; + + @ApiOperation(value = "图片", notes = "图片") + @PostMapping("/picture") + @OpenApiSignature(expireCheck = false) + public Boolean savePricture(@Valid @RequestBody AlarmDataPictureDTO alarmDataPicture) { + return alarmDataManage.savePicture(alarmDataPicture); + } + + @ApiOperation(value = "短视频", notes = "短视频") + @PostMapping("/video") + @OpenApiSignature(expireCheck = false) + public Boolean saveVideo(@Valid @RequestBody AlarmDataVideoDTO alarmDataVideo) { + return alarmDataManage.saveVideo(alarmDataVideo); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiCarPositionController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiCarPositionController.java new file mode 100644 index 0000000..8ef1eca --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiCarPositionController.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.open.controller; + +import java.util.List; + +import javax.validation.Valid; + +import com.ningdatech.basic.model.PageVo; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.carapi.car.position.model.po.ReqTrajectoryDataPO; +import com.ningdatech.carapi.car.position.model.vo.ResRealTimeMonitorVehicleGisListVO; +import com.ningdatech.carapi.car.position.model.vo.ResTrajectoryDataVO; +import com.ningdatech.carapi.open.manage.OpenCarPositionManage; +import com.ningdatech.carapi.open.model.po.ReqRealTimeCapPositionPO; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/car/position") +@RequiredArgsConstructor +public class OpenApiCarPositionController { + + private final OpenCarPositionManage openCarPositionManage; + + @PostMapping("/trajectory-data-list") + @ApiOperation("获取车辆轨迹数据列表(无分页)") + @WebLog + public List trajectoryDatalist(@Valid @RequestBody ReqTrajectoryDataPO po) { + return openCarPositionManage.trajectoryDatalist(po); + } + + @PostMapping("/real-time-monitor-vehicle-gis-data") + @ApiOperation("实时监控车辆gis数据") + @WebLog + public PageVo realTimeMonitorVehicleGisData(@Valid @RequestBody ReqRealTimeCapPositionPO po) { + return openCarPositionManage.realTimeMonitorAllGisList(po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiCompanyArchivesController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiCompanyArchivesController.java new file mode 100644 index 0000000..36c043f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiCompanyArchivesController.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.open.controller; + +import java.util.List; + +import javax.validation.Valid; + +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.carapi.company.entity.dto.ResCompanyArchivesDetailsDTO; +import com.ningdatech.carapi.company.entity.vo.CompanyEmployeesVO; +import com.ningdatech.carapi.company.service.ICompanyArchivesService; +import com.ningdatech.carapi.open.model.vo.CompanySecurityInfoVO; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.dto.CompanySaveDTO; +import com.ningdatech.carapi.sys.entity.vo.CompanyVO; + +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + * @description: 企业档案管理 + * @author: liushuai + * @date: 2022/10/25 17:58 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/open/api/v1/company-archives") +public class OpenApiCompanyArchivesController { + private final ICompanyArchivesService iCompanyArchivesService; + + @GetMapping("/detail") + public ResCompanyArchivesDetailsDTO getCompanyDetail(@RequestParam(value = "companyId", required = false) Long companyId) { + return iCompanyArchivesService.getCompanyDetail(companyId); + } + + @GetMapping("/employees") + public List getCompanyEmployees(@RequestParam(value = "companyId", required = false) Long companyId) { + return iCompanyArchivesService.getCompanyEmployees(companyId); + } + + /** + * 企业安全信息 + * @param companyId + * @return + */ + @GetMapping("/security") + public CompanySecurityInfoVO getCompanySecurityInfo(@RequestParam(value = "companyId", required = false) Long companyId) { + return iCompanyArchivesService.getCompanySecurityInfo(companyId); + } + + @ApiOperation(value = "二维码注册新企业", notes = "二维码注册新企业") + @PostMapping("/register") + public CompanyVO registerCompany(@Valid @RequestBody CompanySaveDTO data) { + Company company = iCompanyArchivesService.saveCompany(data); + return BeanUtil.toBean(company, CompanyVO.class); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiDriverArchivesController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiDriverArchivesController.java new file mode 100644 index 0000000..54fa674 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiDriverArchivesController.java @@ -0,0 +1,104 @@ +package com.ningdatech.carapi.open.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.car.position.model.po.ReqDataPO; +import com.ningdatech.carapi.driver.manage.DriverArchivesManage; +import com.ningdatech.carapi.driver.model.po.ReqArchivalInfoSearchPO; +import com.ningdatech.carapi.driver.model.vo.ResArchivalInfoDetailVO; +import com.ningdatech.carapi.driver.model.vo.ResArchivalInfoSearchListVO; +import com.ningdatech.carapi.open.model.OpenApiTestReq; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentAnalysisVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentDeadVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleViolationVO; +import com.ningdatech.openapi.signature.annatation.OpenApiSignature; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/31 下午3:09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/v1/driver/archives") +@Api(tags = "外部调用驾驶员详情接口") +@RequiredArgsConstructor +public class OpenApiDriverArchivesController { + + private final DriverArchivesManage driverArchivesManage; + + @PostMapping("/archival-info/search") + @ApiOperation("驾驶员档案管理查询") + public PageVo archivalInfoSearch(@Valid @RequestBody ReqArchivalInfoSearchPO po) { + return driverArchivesManage.archivalInfoSearchOpen(po); + } + + @PostMapping("/archival-info/detail/{driverId}") + @ApiOperation("获取驾驶员档案详情") + public ResArchivalInfoDetailVO getArchivalInfoReviewDetail(@PathVariable("driverId") Long driverId) { + return driverArchivesManage.getDriverArchivalInfo(driverId); + } + + /** + * 查询驾驶员违章记录档案 + * + * @param driverId,violationType + * @return + */ + @ApiOperation(value = "查询驾驶员违章记录档案", notes = "查询驾驶员违章记录档案") + @GetMapping("/violation") + public List getViolation(@Valid @RequestParam Long driverId, @Valid @RequestParam Integer violationType) { + return driverArchivesManage.getViolation(driverId,violationType); + } + + /** + * 查询驾驶员事故记录档案 + * + * @param driverId + * @return + */ + @ApiOperation(value = "查询驾驶员事故记录档案", notes = "查询驾驶员事故记录档案") + @GetMapping("/accident-driver/{driverId}") + public List getAccidentVehicle(@Valid @PathVariable Long driverId) { + return driverArchivesManage.getAccidentVehicleOpen(driverId); + } + + /** + * 查询驾驶员死亡事故记录档案 + * + * @param driverId + * @return + */ + @ApiOperation(value = "查询驾驶员死亡事故记录档案", notes = "查询驾驶员死亡事故记录档案") + @GetMapping("/accident-dead/{driverId}") + public List getAccidentDead(@Valid @PathVariable Long driverId) { + return driverArchivesManage.getAccidentDeadOpen(driverId); + } + + /** + * 查询驾驶员事故分析记录档案 + * + * @param driverId + * @return + */ + @ApiOperation(value = "查询驾驶员事故分析记录档案", notes = "查询驾驶员事故分析记录档案") + @GetMapping("/accident-analysis/{driverId}") + public List getAccidentAnalysis(@Valid @PathVariable Long driverId) { + return driverArchivesManage.getAccidentAnalysisOpen(driverId); + } + + @PostMapping("/archival-info/search-batch") + @ApiOperation("驾驶员档案管理批量查询") + public List archivalInfoSearchBatch(@Valid @RequestBody ReqDataPO po) { + return driverArchivesManage.archivalInfoSearchBatchOpen(po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiEquipmentController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiEquipmentController.java new file mode 100644 index 0000000..1d21310 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiEquipmentController.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.open.controller; + +import com.ningdatech.carapi.car.equipment.manage.VehicleEquipmentManage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/archives/equipment") +@Api(value = "archives", tags = "车辆管理-档案管理") +@RequiredArgsConstructor +public class OpenApiEquipmentController { + private final VehicleEquipmentManage equipmentManage; + + @ApiOperation(value = "测试加一个车辆的设备", notes = "测试加一个车辆的设备") + @GetMapping("/test-add-equipment") + public Boolean testAddEquipment(@RequestParam String car_plate) { + return equipmentManage.initEquipmentFromSip(car_plate); + } + + @ApiOperation(value = "批量添加所有车辆", notes = "批量添加所有车辆") + @GetMapping("/test-add-equipment-all") + public Boolean testAddEquipmentAll() { + return equipmentManage.initEquipmentFromSipAll(); + } + + @GetMapping("/get-equip-no") + public void getEquipNo(){ + equipmentManage.getEquipNo(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiOssController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiOssController.java new file mode 100644 index 0000000..255a9de --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiOssController.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.open.controller; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.carapi.common.util.OssUtils; + +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/oss/") +@RequiredArgsConstructor +public class OpenApiOssController { + + @ApiOperation(value = "查询OSS存储文件大小", notes = "查询OSS存储文件大小") + @GetMapping("/get-oss") + public Long getOss() { + return OssUtils.getOss(null); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiRedisController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiRedisController.java new file mode 100644 index 0000000..4b349c4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiRedisController.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.open.controller; + +import com.ningdatech.cache.repository.CachePlusOps; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import java.util.Set; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/redis/") +@Api(value = "archives", tags = "对外联调接口") +@RequiredArgsConstructor +public class OpenApiRedisController { + + private final CachePlusOps cachePlusOps; + + @ApiOperation(value = "redis remove", notes = "redis") + @GetMapping("/remove") + public Boolean remove() { + // 模糊匹配所有以keyword:开头的所有key值 + Set keys = cachePlusOps.keys("cm:"+"*"); + + log.info("cm下的key数量:{}",keys.size()); + + for(String key : keys){ + cachePlusOps.del(key); + } + + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + Set keysAfter = cachePlusOps.keys("cm:"+"*"); + + log.info("删除后cm下的key数量:{}",keysAfter.size()); + + return Boolean.TRUE; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiRegionController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiRegionController.java new file mode 100644 index 0000000..8428419 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiRegionController.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.open.controller; + +import java.util.List; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.carapi.sys.entity.vo.RegionTreeVO; +import com.ningdatech.carapi.sys.manage.RegionManage; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/region/") +@Api(value = "archives", tags = "对外联调接口") +@RequiredArgsConstructor +public class OpenApiRegionController { + + private final RegionManage regionManage; + + @PostMapping("/tree") + @ApiOperation("获取区域编码的树状结构") + public List getRegionTree() { + return regionManage.getRegionInfo(); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiSecurityAdvisoryController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiSecurityAdvisoryController.java new file mode 100644 index 0000000..9a12c04 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiSecurityAdvisoryController.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.open.controller; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.carapi.open.manage.OpenSecurityAdvisoryManage; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/07/04 21:47 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/security/advisory") +@Api(value = "archives", tags = "对外联调接口") +@RequiredArgsConstructor +public class OpenApiSecurityAdvisoryController { + + private final OpenSecurityAdvisoryManage openSecurityAdvisoryManage; + + @ApiOperation("批量上传安全通报") + @GetMapping("/batchUpload") + public String batchUpload(){ + return openSecurityAdvisoryManage.batchUpload(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiTrainingOrganizationController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiTrainingOrganizationController.java new file mode 100644 index 0000000..bdc0eb2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiTrainingOrganizationController.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.open.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.driver.manage.TrainingOrganizationManage; +import com.ningdatech.carapi.driver.model.po.ReqDriverTrainingListPO; +import com.ningdatech.carapi.driver.model.vo.ResDriverTrainingListVO; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + * @author liuxinxin + * @date 2022/11/11 上午11:19 + */ + +@RequestMapping("/open/api/v1/driver/training-organization") +@RestController +@Api(tags = "驾驶员管理-培训管理-培训组织") +@Validated +@RequiredArgsConstructor +public class OpenApiTrainingOrganizationController { + + private final TrainingOrganizationManage trainingOrganizationManage; + + @PostMapping("/driver-training/list") + @ApiOperation("驾驶员培训记录列表") + public PageVo driverTrainingList(@Valid @RequestBody ReqDriverTrainingListPO request) { + return trainingOrganizationManage.driverTrainingList(request); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiUserLoginVerificationCodeController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiUserLoginVerificationCodeController.java new file mode 100644 index 0000000..92b10e5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiUserLoginVerificationCodeController.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.open.controller; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.carapi.open.manage.UserLoginManage; +import com.ningdatech.carapi.open.model.dto.UserLoginDTO; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * 用户登录获取验证码 + * + * @author CMM + * @since 2023/01/06 16:38 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/user/login") +@Api(value = "OpenApiUserLoginVerificationCodeController", tags = "验证码登录") +@RequiredArgsConstructor +public class OpenApiUserLoginVerificationCodeController { + + private final UserLoginManage userLoginManage; + + @PostMapping( "/get/verificationCode") + @ApiOperation(value = "触发发短信接口,获取短信验证码") + public String getVerificationCode(@RequestBody @Valid UserLoginDTO param){ + return userLoginManage.getVerificationCode(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiVehicleArchivesController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiVehicleArchivesController.java new file mode 100644 index 0000000..7f857d9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiVehicleArchivesController.java @@ -0,0 +1,126 @@ +package com.ningdatech.carapi.open.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.archives.aop.AuditVehicle; +import com.ningdatech.carapi.car.vehicle.model.dto.VehicleArchivesPageQuery; +import com.ningdatech.carapi.car.vehicle.model.dto.VehicleArchivesQueryDTO; +import com.ningdatech.carapi.archives.manage.ArchivesManage; +import com.ningdatech.carapi.car.vehicle.manage.VehicleManage; +import com.ningdatech.carapi.car.vehicle.model.vo.VehicleBaseVO; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.qrcode.model.vo.GetOnVehicleVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentAnalysisVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentDeadVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleViolationVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/archives/vehicle") +@Api(value = "archives", tags = "车辆管理-档案管理") +@RequiredArgsConstructor +public class OpenApiVehicleArchivesController { + + private final VehicleManage vehicleManage; + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final ArchivesManage archivesManage; + + @ApiOperation(value = "车辆档案列表查询", notes = "车辆档案列表查询") + @GetMapping("/archivesList") + public PageVo queryArchivesList(@Valid @ModelAttribute VehicleArchivesPageQuery vehicleArchivesPageQuery) { + return vehicleManage.queryArchivesListOpen(vehicleArchivesPageQuery); + } + + /** + * 查询车辆基本信息 + * + * @param id 主键id + * @return 查询结果 + */ + @ApiOperation(value = "查询车辆基本信息", notes = "查询车辆基本信息") + @GetMapping("/baseInfo") + public VehicleArchivesQueryDTO getDetails(@Valid @RequestParam Long id) { + return vehicleManage.getDetails(id); + } + + /** + * 查询车辆违章记录档案 + * + * @param carPlate,violationType + * @return + */ + @ApiOperation(value = "查询车辆违章记录档案", notes = "查询车辆违章记录档案") + @GetMapping("/violation") + @AuditVehicle + public List getViolation(@Valid @RequestParam String carPlate, @Valid @RequestParam Integer violationType) { + return archivesManage.getViolation(carPlate,violationType); + } + + /** + * 查询车辆事故记录档案 + * @param carPlate,violationType + * @return + */ + @ApiOperation(value = "查询车辆事故记录档案", notes = "查询车辆事故记录档案") + @GetMapping("/accident-vehicle") + @AuditVehicle + public List getAccidentVehicle(@Valid @RequestParam String carPlate) { + return archivesManage.getAccidentVehicleOpen(carPlate); + } + + /** + * 查询车辆死亡事故记录档案 + * + * @param carPlate,violationType + * @return + */ + @ApiOperation(value = "查询车辆死亡事故记录档案", notes = "查询车辆死亡事故记录档案") + @GetMapping("/accident-dead") + @AuditVehicle + public List getAccidentDead(@Valid @RequestParam String carPlate) { + return archivesManage.getAccidentDeadOpen(carPlate); + } + + /** + * 查询车辆事故分析记录档案 + * + * @param carPlate,violationType + * @return + */ + @ApiOperation(value = "查询车辆事故分析记录档案", notes = "查询车辆事故分析记录档案") + @GetMapping("/accident-analysis") + @AuditVehicle + public List getAccidentAnalysis(@Valid @RequestParam String carPlate) { + return archivesManage.getAccidentAnalysisOpen(carPlate); + } + + /** + * 查询车辆上车记录 + * + * @param driverId + * @return + */ + @ApiOperation(value = "查询车辆上车记录-驾驶员ID", notes = "查询车辆上车记录") + @GetMapping("/get-driver-on-car-list") + public List getOnCarDriver(@Valid @RequestParam String driverId) { + return archivesManage.getOnCarDriver(driverId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiVehicleController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiVehicleController.java new file mode 100644 index 0000000..a82a9cb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiVehicleController.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.open.controller; + +import com.ningdatech.carapi.car.position.model.po.ReqDataPO; +import com.ningdatech.carapi.car.vehicle.manage.VehicleManage; +import com.ningdatech.carapi.car.vehicle.model.vo.VehicleBaseVO; +import com.ningdatech.carapi.car.vehicle.model.vo.VehicleCarPlateVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/vehicle/") +@Api(value = "archives", tags = "对外联调接口") +@RequiredArgsConstructor +public class OpenApiVehicleController { + + private final VehicleManage vehicleManage; + + @ApiOperation(value = "用公司ID去查车牌号", notes = "用公司ID去查车牌号") + @GetMapping("/list-by-companyIds") + public List listByCompanyIds(@Valid @RequestParam("companyIds") List companyIds) { + return vehicleManage.listByCompanyIds(companyIds); + } + + @ApiOperation(value = "用批量车牌号去查车辆信息", notes = "用批量车牌号去查车辆信息") + @PostMapping("/list-by-carplate") + public List listByCarplate(@Valid @RequestBody ReqDataPO po) { + return vehicleManage.listByCarplate(po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiVehicleEquipmentController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiVehicleEquipmentController.java new file mode 100644 index 0000000..e98f037 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/controller/OpenApiVehicleEquipmentController.java @@ -0,0 +1,54 @@ +package com.ningdatech.carapi.open.controller; + +import com.ningdatech.carapi.car.equipment.manage.VehicleEquipmentManage; +import com.ningdatech.carapi.car.equipment.service.INdVehicleEquipmentInfoService; +import com.ningdatech.carapi.car.equipment.model.dto.VehicleEquipmentQueryDTO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/open/api/archives/equipment") +@Api(value = "archives", tags = "车辆管理-档案管理") +@RequiredArgsConstructor +public class OpenApiVehicleEquipmentController { + private final VehicleEquipmentManage equipmentManage; + private final INdVehicleEquipmentInfoService vehicleEquipmentInfoService; + + /** + * 查询车辆设备信息 + * @param id 设备ID + * @return 查询结果 + */ + @ApiOperation(value = "查询车辆设备信息-以设备ID查询", notes = "查询车辆设备信息-以设备ID查询") + @GetMapping("/detailsbyId/{id}") + public VehicleEquipmentQueryDTO getEquipmentById(@PathVariable("id") Long id) { + return equipmentManage.getEquipmentById(id); + } + + /** + * 查询车辆设备信息 + * @param vehicleId 车辆ID + * @return 查询结果 + */ + @ApiOperation(value = "查询车辆设备信息-以车辆ID查询", notes = "查询车辆设备信息-以车辆ID查询") + @GetMapping("/detailsbyVehicleId/{vehicleId}") + public List getEquipment(@PathVariable("vehicleId") Long vehicleId) { + return equipmentManage.getEquipment(vehicleId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/irs/contants/SmsContant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/irs/contants/SmsContant.java new file mode 100644 index 0000000..e52515a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/irs/contants/SmsContant.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.open.irs.contants; + +/** + * @author PoffyZhang + * @Classname smsContant + * @Description + * @Date 2022/12/14 18:46 + */ +public interface SmsContant { + + class Url { + + public static final String SMS_SEND_URL = "https://interface.zjzwfw.gov.cn/gateway/component/routing/agent.htm"; + + } + + class Param { + + public static final String TRSACTION_ID = ""; + + public static final String streaming_NO = ""; + + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/irs/service/SmsService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/irs/service/SmsService.java new file mode 100644 index 0000000..da152cc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/irs/service/SmsService.java @@ -0,0 +1,13 @@ +package com.ningdatech.carapi.open.irs.service; + +/** + * @author PoffyZhang + * @Classname smsService + * @Description + * @Date 2022/12/14 18:55 + */ +public interface SmsService { + + public String send(String mobile,String content); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/irs/service/impl/SmsServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/irs/service/impl/SmsServiceImpl.java new file mode 100644 index 0000000..2b6b059 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/irs/service/impl/SmsServiceImpl.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.open.irs.service.impl; + +import com.ningdatech.carapi.open.irs.service.SmsService; +import org.springframework.web.client.RestTemplate; + +import javax.annotation.Resource; + +/** + * @author PoffyZhang + * @Classname smsServiceImpl + * @Description + * @Date 2022/12/14 18:56 + */ +public class SmsServiceImpl implements SmsService { + + @Resource + private RestTemplate restTemplate; + + @Override + public String send(String mobile, String content) { +// restTemplate.postForObject(SmsContant.Url.SMS_SEND_URL,); + + return null; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/manage/AlarmDataManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/manage/AlarmDataManage.java new file mode 100644 index 0000000..9020dd8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/manage/AlarmDataManage.java @@ -0,0 +1,122 @@ +package com.ningdatech.carapi.open.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.exception.code.ExceptionCode; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.cache.redis.RedisOps; +import com.ningdatech.carapi.open.aop.TaskLock; +import com.ningdatech.carapi.open.contants.AlarmContant; +import com.ningdatech.carapi.open.model.dto.AlarmDataPictureDTO; +import com.ningdatech.carapi.open.model.dto.AlarmDataVideoDTO; +import com.ningdatech.carapi.safe.entity.AlarmDataPicture; +import com.ningdatech.carapi.safe.entity.AlarmDataVideo; +import com.ningdatech.carapi.safe.service.IAlarmDataPictureService; +import com.ningdatech.carapi.safe.service.IAlarmDataVideoService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; + +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @Classname AlarmDataManage + * @Description + * @Date 2022/10/28 11:05 + * @Created by PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class AlarmDataManage { + private final IAlarmDataPictureService alarmDataPictureService; + private final IAlarmDataVideoService alarmDataVideoService; + + private static final Long MAX_CACHE = 1000L; + + private final RedisOps redisOps; + + public Boolean savePicture(AlarmDataPictureDTO alarmDataPicture) { + if(Objects.isNull(alarmDataPicture)){ + throw new BizException(ExceptionCode.PARAM_EX.getCode(),"推送数据为空"); + } + + AlarmDataPicture entity = BeanUtil.copyProperties(alarmDataPicture, AlarmDataPicture.class); + + //当前如果大于1000 则先去批量插入 + if(MAX_CACHE <= redisOps.lLen(AlarmContant.ALARM_DATA_PRICTURE_KEY)){ + AlarmDataManage clazz = (AlarmDataManage) AopContext.currentProxy(); + clazz.savePicturesOver(); + } + + redisOps.rPush(AlarmContant.ALARM_DATA_PRICTURE_KEY,entity); + + return Boolean.TRUE; + } + + public Boolean saveVideo(AlarmDataVideoDTO alarmDataVideo) { + if(Objects.isNull(alarmDataVideo)){ + throw new BizException(ExceptionCode.PARAM_EX.getCode(),"推送数据为空"); + } + + AlarmDataVideo entity= BeanUtil.copyProperties(alarmDataVideo, AlarmDataVideo.class); + + //当前如果大于1000 则先去批量插入 + if(MAX_CACHE <= redisOps.lLen(AlarmContant.ALARM_DATA_VIDEO_KEY)){ + AlarmDataManage clazz = (AlarmDataManage) AopContext.currentProxy(); + clazz.saveVideoOver(); + } + + redisOps.rPush(AlarmContant.ALARM_DATA_VIDEO_KEY,entity); + + return Boolean.TRUE; + } + + @TaskLock(name = "批量插入图片锁", key = "alarm-data:picture_lock",expired = 5) + public void savePicturesOver() { + Long len = redisOps.lLen(AlarmContant.ALARM_DATA_PRICTURE_KEY); + List objects = redisOps.lRange(AlarmContant.ALARM_DATA_PRICTURE_KEY, 0, len); + List addList = Objects.nonNull(objects) ? objects.stream().filter(Objects::nonNull) + .map(AlarmDataPicture.class::cast) + .collect(Collectors.toList()) : Collections.emptyList(); + + if (CollUtil.isEmpty(addList)) { + log.info("暂无 告警数据 需要插入!"); + return; + } + + if(alarmDataPictureService.saveBatchForSql(addList)){ + //清理掉这部分缓存 不直接删除 怕有并发问题 + redisOps.lTrim( AlarmContant.ALARM_DATA_PRICTURE_KEY,len,-1); + } + } + + @TaskLock(name = "批量插入短视频锁", key = "alarm-data:video_lock",expired = 5) + public void saveVideoOver() { + //当缓存不为空 + if(0 >= redisOps.lLen(AlarmContant.ALARM_DATA_VIDEO_KEY)){ + return; + } + + Long len = redisOps.lLen(AlarmContant.ALARM_DATA_VIDEO_KEY); + List objects = redisOps.lRange(AlarmContant.ALARM_DATA_VIDEO_KEY, 0, len); + List addList = Objects.nonNull(objects) ? objects.stream().filter(Objects::nonNull) + .map(AlarmDataVideo.class::cast) + .collect(Collectors.toList()) : Collections.emptyList(); + + if (CollUtil.isEmpty(addList)) { + log.info("暂无 告警数据 需要插入!"); + return; + } + + if(alarmDataVideoService.saveBatchForSql(addList)){ + //清理掉这部分缓存 不直接删除 怕有并发问题 + redisOps.lTrim( AlarmContant.ALARM_DATA_PRICTURE_KEY,len,-1); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/manage/OpenCarPositionManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/manage/OpenCarPositionManage.java new file mode 100644 index 0000000..833ae41 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/manage/OpenCarPositionManage.java @@ -0,0 +1,343 @@ +package com.ningdatech.carapi.open.manage; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import com.alibaba.fastjson.JSON; +import com.google.common.collect.Lists; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.car.position.model.po.ReqRealTimeMonitorPO; +import com.ningdatech.carapi.car.vehicle.model.po.VehicleCompanyPO; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.google.common.collect.Maps; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.exception.code.ExceptionCode; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.car.position.contants.PositionContant; +import com.ningdatech.carapi.car.position.entity.VehiclePositionInfo; +import com.ningdatech.carapi.car.position.model.po.ReqTrajectoryDataPO; +import com.ningdatech.carapi.car.position.model.vo.ResRealTimeMonitorVehicleGisListVO; +import com.ningdatech.carapi.car.position.model.vo.ResTrajectoryDataVO; +import com.ningdatech.carapi.car.position.service.IVehiclePositionInfoService; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.common.constant.VehicleLimitSpeedEnum; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.util.SignUtil; +import com.ningdatech.carapi.open.model.po.ReqRealTimeCapPositionPO; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.VehiclesCacheHelper; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * 车辆位置信息 + * + * @author CMM + * @since 2023/11/17 09:35 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class OpenCarPositionManage { + + private final CompaniesCacheHelper companiesCacheHelper; + private final VehiclesCacheHelper vehiclesCacheHelper; + private final IVehiclePositionInfoService iVehiclePositionInfoService; + private final RedisTemplate redisTemplate; + private final RestTemplate restTemplate; + @Value("${car.interfaceKey}") + private String carPositionKey; + @Value("${gps.host}") + private String HOST; + + public List trajectoryDatalist(ReqTrajectoryDataPO po) { + + // 校验签名 + Map paramMap = new HashMap<>(16); + paramMap.put("carPlate", po.getCarPlate()); + // 根据传入的秘钥生成签名 + String appKey = po.getKey(); + String sign = SignUtil.generateSign(paramMap, appKey); + String interfaceKey = SignUtil.generateSign(paramMap, carPositionKey); + if (!sign.equals(interfaceKey)){ + log.error("无权访问轨迹回放接口!"); + throw new BizException("签名错误!"); + } + String carPlate = po.getCarPlate(); + LocalDateTime startTime = po.getStartTime(); + LocalDateTime endTime = po.getEndTime(); + if (Objects.isNull(startTime)) { + startTime = LocalDateTime.now().minusHours(2); + } + // 默认时间区间为2小时前到现在 + if (Objects.isNull(endTime)) { + endTime = LocalDateTime.now(); + } + + // 获取车辆基本信息 + NdVehicleBaseInfo car = vehiclesCacheHelper.getByCarPlate(carPlate); + VUtils.isTrue(Objects.isNull(car)).throwMessage("该车辆不在系统中!"); + + //判断日期有没有跨天 + checkDateExtendIntoNextDay(startTime, endTime); + + //动态表名 + List vehiclePositionInfoList = iVehiclePositionInfoService + .dynamicGpsTableHistorySearch(carPlate, startTime, endTime, NdDateUtils.format(startTime, "yyyy_MM_dd")); + + List resTrajectoryDataVOList = vehiclePositionInfoList.stream().map( + r -> { + ResTrajectoryDataVO vo = BeanUtil.copyProperties(r, ResTrajectoryDataVO.class); + vo.setIsOverSpeed(checkIsOverSpeed(r,car)); + return vo; + }).collect(Collectors.toList()); + //连续6次超速 才算超速 + checkContinuousOverspeed(resTrajectoryDataVOList); + return resTrajectoryDataVOList; + } + + public PageVo realTimeMonitorAllGisList(ReqRealTimeCapPositionPO po) { + // 根据传入的秘钥生成签名 + String appKey = po.getKey(); + String sign = appKey; + Integer pageNumber = po.getPageNumber(); + Integer pageSize = po.getPageSize(); + + // 校验签名 + String interfaceKey = carPositionKey; + if (!sign.equals(interfaceKey)){ + log.error("无权访问车辆实时位置接口!"); + throw new BizException("签名错误!"); + } + int total = vehiclesCacheHelper.all().size(); + List carPlates = vehiclesCacheHelper.all().stream() + .skip((pageNumber - 1) * pageSize) //跳过前面的元素 + .limit(pageSize) + .map(vehicles -> BeanUtil.copyProperties(vehicles,VehicleCompanyPO.class)) + .collect(Collectors.toList()); + log.info("request real carPlates 【{}】:", JSON.toJSONString(carPlates)); + if (CollUtil.isEmpty(carPlates)) { + return PageVo.empty(); + } + Map map = Maps.newConcurrentMap(); + map.put(PositionContant.FIELD_CAR_PLATE, carPlates.stream().map(VehicleCompanyPO::getCarPlate).collect(Collectors.joining(","))); + map.put(PositionContant.HOST_FEILD, HOST); + JSONObject response = restTemplate.getForObject(PositionContant.REAL_GPS_URL, JSONObject.class, map); + log.info("request real gps 【{}】:", JSON.toJSONString(response)); + if (Objects.isNull(response)) { + throw new BizException(ExceptionCode.BAD_REQUEST.getCode(), "实时数据请求失败 网络异常"); + } + Integer statusCode = response.getInteger("status_code"); + if (0 != statusCode) { + throw new BizException(ExceptionCode.BAD_REQUEST.getCode(), response.getString("message")); + } + JSONArray resultJsonArray = response.getJSONArray("result"); + if (Objects.isNull(resultJsonArray) || resultJsonArray.size() == 0) { + return PageVo.empty(); + } + Map carMap = carPlates.stream() + .filter(w -> Objects.nonNull(w) && Objects.nonNull(w.getCarPlate())) + .filter(CodeUtil.distinctByKey(VehicleCompanyPO::getCarPlate)).collect(Collectors.toMap(VehicleCompanyPO::getCarPlate, v -> v)); + List res = resultJsonArray.stream().map(o -> { + JSONObject j = JSON.parseObject(JSON.toJSONString(o)); + String carPlate = j.getString(PositionContant.FIELD_CAR_PLATE); + VehicleCompanyPO vehicleCompany = carMap.get(carPlate); + ResRealTimeMonitorVehicleGisListVO vo = new ResRealTimeMonitorVehicleGisListVO(); + vo.setCarLongitude(new BigDecimal(String.valueOf(j.getOrDefault(PositionContant.LONGITUDE,BigDecimal.valueOf(0L))))); + vo.setCarLatitude(new BigDecimal(String.valueOf(j.getOrDefault(PositionContant.LATITUDE,BigDecimal.valueOf(0L))))); + vo.setCarAltitude(new BigDecimal(String.valueOf(j.getOrDefault(PositionContant.ALTITUDE,BigDecimal.valueOf(0L))))); + vo.setCarDirection(new BigDecimal(String.valueOf(j.getOrDefault(PositionContant.DIRECTION,BigDecimal.valueOf(0L))))); + vo.setCarPlate(carPlate); + vo.setPlateColor(j.getString(PositionContant.PLATE_COLOR)); + vo.setCompanyId(vehicleCompany.getCompanyId()); + vo.setCompanyName(vehicleCompany.getCompanyName()); + vo.setCarVelocity(new BigDecimal(String.valueOf(j.getOrDefault(PositionContant.CAR_VELOCITY,BigDecimal.valueOf(0L))))); + vo.setUpdateTime((j.getString(PositionContant.UPDATE_TIME))); + vo.setSelfNo(vehicleCompany.getSelfNo()); + vo.setStatus(j.getInteger(PositionContant.ONLINE_STATUS)); + vo.setMoving(vehicleCompany.getMoving()); + vo.setVehicleType(vehicleCompany.getVehicleType()); + vo.setVehicleTypeName(vehicleCompany.getVechileTypeName()); + vo.setLimitSpeed(VehicleLimitSpeedEnum.getLimitSpeedByCode(vehicleCompany.getVehicleType())); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(res,total); + } + + public List realTimeMonitorVehicleGisData(ReqRealTimeCapPositionPO po) { + + Map paramMap = new HashMap<>(16); + paramMap.put("carPlate", po.getCarPlate()); + // 根据传入的秘钥生成签名 + String appKey = po.getKey(); + String sign = SignUtil.generateSign(paramMap, appKey); + // 校验签名 + String interfaceKey = SignUtil.generateSign(paramMap, carPositionKey); + if (!sign.equals(interfaceKey)){ + log.error("无权访问车辆实时位置接口!"); + throw new BizException("签名错误!"); + } + + String carNo = po.getCarPlate(); + // 获取车辆基本信息 + NdVehicleBaseInfo car = vehiclesCacheHelper.getByCarPlate(carNo); + VUtils.isTrue(Objects.isNull(car)).throwMessage("该车辆不在系统中!"); + + Map map = Maps.newConcurrentMap(); + map.put(PositionContant.FIELD_CAR_PLATE, carNo); + map.put(PositionContant.HOST_FEILD, HOST); + JSONObject response = restTemplate.getForObject(PositionContant.REAL_GPS_URL, JSONObject.class, map); + if (Objects.isNull(response)) { + throw new BizException(ExceptionCode.BAD_REQUEST.getCode(), "实时数据请求失败 网络异常"); + } + Integer statusCode = response.getInteger("status_code"); + if (0 != statusCode) { + throw new BizException(ExceptionCode.BAD_REQUEST.getCode(), response.getString("message")); + } + JSONArray resultJsonArray = response.getJSONArray("result"); + if (Objects.isNull(resultJsonArray) || resultJsonArray.size() == 0) { + return Collections.emptyList(); + } + return resultJsonArray.stream().map(o -> { + LinkedHashMap j = (LinkedHashMap) o; + String carPlate = String.valueOf(j.get(PositionContant.FIELD_CAR_PLATE)); + ResRealTimeMonitorVehicleGisListVO vo = new ResRealTimeMonitorVehicleGisListVO(); + vo.setCarLongitude(BigDecimal.valueOf(Double.parseDouble(String.valueOf(j.getOrDefault(PositionContant.LONGITUDE, BigDecimal.valueOf(0L)))))); + vo.setCarLatitude(BigDecimal.valueOf(Double.parseDouble(String.valueOf(j.getOrDefault(PositionContant.LATITUDE, BigDecimal.valueOf(0L)))))); + vo.setCarAltitude(BigDecimal.valueOf(Double.parseDouble(String.valueOf(j.getOrDefault(PositionContant.ALTITUDE, BigDecimal.valueOf(0L)))))); + vo.setCarDirection(BigDecimal.valueOf(Double.parseDouble(String.valueOf(j.getOrDefault(PositionContant.DIRECTION, BigDecimal.valueOf(0L)))))); + vo.setCarPlate(carPlate); + vo.setPlateColor(String.valueOf(j.get(PositionContant.PLATE_COLOR))); + vo.setCompanyId(car.getCompanyId()); + vo.setCarVelocity(BigDecimal.valueOf(Double.parseDouble(String.valueOf(j.getOrDefault(PositionContant.CAR_VELOCITY, BigDecimal.valueOf(0L)))))); + vo.setUpdateTime(String.valueOf(j.get(PositionContant.UPDATE_TIME))); + vo.setSelfNo(car.getSelfNo()); + vo.setStatus(Integer.valueOf(String.valueOf(j.getOrDefault(PositionContant.ONLINE_STATUS, car.getStatus())))); + vo.setMoving(car.getMoving()); + vo.setVehicleType(car.getVehicleType()); + if (Objects.nonNull(car.getVehicleType())) { + String vehicleTypeName = VehicleTypeEnum.getDescByCode(car.getVehicleType()); + vo.setVehicleTypeName(vehicleTypeName); + } + vo.setLimitSpeed(VehicleLimitSpeedEnum.getLimitSpeedByCode(car.getVehicleType())); + if (Objects.nonNull(car.getCompanyId())) { + CompanyDTO vehicleCompany = companiesCacheHelper.getById(car.getCompanyId()); + vo.setCompanyName(vehicleCompany.getName()); + } + return vo; + }).collect(Collectors.toList()); + } + + /** + * 判断日期有没有跨月 + */ + private void checkDateExtendIntoNextDay(LocalDateTime startTime, LocalDateTime endTime) { + if (!NdDateUtils.format(startTime, DatePattern.NORM_DATE_PATTERN) + .equals(NdDateUtils.format(endTime, DatePattern.NORM_DATE_PATTERN))) { + throw new BizException(ExceptionCode.OPERATION_EX.getCode(), "由于GPS数据量大 不支持跨日查询!"); + } + } + + private Boolean checkIsOverSpeed(VehiclePositionInfo positionInfo, NdVehicleBaseInfo car) { + //混凝土和移动泵车 是50 + Integer vehicleType = car.getVehicleType(); + VehicleTypeEnum enumByValue = VehicleTypeEnum.getEnumByValue(vehicleType); + assert enumByValue != null; + if(enumByValue.equals(VehicleTypeEnum.OTHER)){ + if(Objects.nonNull(positionInfo.getDashboardSpeed()) && + positionInfo.getCarVelocity().compareTo(BigDecimal.valueOf(80)) >= 0){ + return Boolean.TRUE; + } + }else if(enumByValue.equals(VehicleTypeEnum.KRHP)){ + if(Objects.nonNull(positionInfo.getDashboardSpeed()) && + positionInfo.getCarVelocity().compareTo(BigDecimal.valueOf(50)) >= 0) { + return Boolean.TRUE; + } + }else if(enumByValue.equals(VehicleTypeEnum.MIXER)){ + if(Objects.nonNull(positionInfo.getDashboardSpeed()) && + positionInfo.getCarVelocity().compareTo(BigDecimal.valueOf(50)) >= 0) { + return Boolean.TRUE; + } + }else if(enumByValue.equals(VehicleTypeEnum.BULK_CEMENT_TRUCK)){ + if(Objects.nonNull(positionInfo.getDashboardSpeed()) && + positionInfo.getCarVelocity().compareTo(BigDecimal.valueOf(80)) >= 0) { + return Boolean.TRUE; + } + }else if(enumByValue.equals(VehicleTypeEnum.READY_MIXED_MORTAR_TRUC)){ + if(Objects.nonNull(positionInfo.getDashboardSpeed()) && + positionInfo.getCarVelocity().compareTo(BigDecimal.valueOf(80)) >= 0) { + return Boolean.TRUE; + } + } + + return Boolean.FALSE; + } + + private void checkContinuousOverspeed(List resTrajectoryDataVOList) { + if(CollUtil.isNotEmpty(resTrajectoryDataVOList)){ + for(int i = 0;i < resTrajectoryDataVOList.size();i++){ + ResTrajectoryDataVO vo = resTrajectoryDataVOList.get(i); + String carPlate = vo.getCarPlate(); + String REDIS_CAR_FILED = "car-gps:"; + if(vo.getIsOverSpeed()){ + Object num = redisTemplate.opsForValue().get(carPlate); + //如果之前已经有连续6个了 那就相安无事 + if(Objects.isNull(num)){ + redisTemplate.opsForValue().set(REDIS_CAR_FILED + carPlate,1,500, TimeUnit.SECONDS); + }else{ + redisTemplate.opsForValue().increment(REDIS_CAR_FILED + carPlate); + } + }else{ + Object num = redisTemplate.opsForValue().get(REDIS_CAR_FILED + carPlate); + if(Objects.isNull(num)){ + redisTemplate.opsForValue().set(REDIS_CAR_FILED + carPlate,0,500,TimeUnit.SECONDS); + continue; + } + //如果之前已经有连续6个了 那就相安无事 + int overNum = Integer.parseInt(String.valueOf(num)); + if(overNum >= 6){ + redisTemplate.opsForValue().set(REDIS_CAR_FILED + carPlate,0,500,TimeUnit.SECONDS); + }else{ + //如果不是的话 要把之前的 置为不超速 + changeOverspeedFalse(resTrajectoryDataVOList,i,vo,overNum); + } + } + } + } + } + + private void changeOverspeedFalse(List resTrajectoryDataVOList,int index, ResTrajectoryDataVO vo, Integer overNum) { + int flagNum = overNum; + for(int i = index;i >= 0;i--){ + if(flagNum <= 0){ + break; + } + ResTrajectoryDataVO innerVo = resTrajectoryDataVOList.get(i); + if(innerVo.getCarPlate().equals(vo.getCarPlate())){ + innerVo.setIsOverSpeed(Boolean.FALSE); + flagNum--; + } + } + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/manage/OpenSecurityAdvisoryManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/manage/OpenSecurityAdvisoryManage.java new file mode 100644 index 0000000..d199bf8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/manage/OpenSecurityAdvisoryManage.java @@ -0,0 +1,162 @@ +package com.ningdatech.carapi.open.manage; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.temporal.TemporalAdjusters; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.safe.entity.NdSecurityAdvisory; +import com.ningdatech.carapi.safe.service.INdSecurityAdvisoryService; +import com.ningdatech.carapi.sys.entity.Region; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.IRegionService; +import com.ningdatech.file.entity.vo.result.FileResultVO; +import com.ningdatech.file.service.FileService; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/01/06 16:40 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class OpenSecurityAdvisoryManage { + + private final INdSecurityAdvisoryService ndSecurityAdvisoryService; + private final RegionsCacheHelper regionsCacheHelper; + private final FileService fileService; + private final IRegionService regionService; + + public String batchUpload() { + List folderList = Lists.newArrayList(); + folderList.add("3301_杭州市"); + folderList.add("3302_宁波市"); + folderList.add("3303_温州市"); + folderList.add("3304_嘉兴市"); + folderList.add("3305_湖州市"); + folderList.add("3306_绍兴市"); + folderList.add("3307_金华市"); + folderList.add("3308_衢州市"); + folderList.add("3309_舟山市"); + folderList.add("3310_台州市"); + folderList.add("3311_丽水市"); + for (String folderName : folderList) { + File directory = new File(""); + // 临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "advisory" + File.separator + folderName; + log.info(filePath); + File folder = new File(filePath); + if (folder.isDirectory()) { + readFiles(folder); + } else { + log.info("指定路径不是一个文件夹!"); + } + } + return "上传成功"; + } + + private void readFiles(File folder) { + File[] files = folder.listFiles(); + if (files != null) { + HashSet countySet = new HashSet<>(); + // 根据区县名称获取区域ID + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + for (File file : files) { + if (file.isDirectory()) { + // 递归调用,读取子文件夹中的文件 + readFiles(file); + } else { + // 输出文件名 + log.info(file.getName()); + // 上传文件到OSS + MultipartFile multipartFile; + try { + InputStream inputStream = new FileInputStream(file); + String fileName = file.getName(); + multipartFile = new MockMultipartFile("file", fileName, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + inputStream); + FileResultVO fileResultVo = fileService.upload(multipartFile, "default"); + // 保存到安全通报表中 + NdSecurityAdvisory ndSecurityAdvisory = new NdSecurityAdvisory(); + ndSecurityAdvisory.setCreateBy(2L); + ndSecurityAdvisory.setCreateOn(LocalDateTime.now()); + int startIndex = fileName.indexOf("月"); + String regionName = fileName.substring(startIndex + 1, startIndex + 4); + if ("景宁县".equals(regionName)){ + regionName = "景宁畲族自治县"; + } + Region region = regionMap.get(regionName); + Long regionId; + if (Objects.isNull(region)){ + String folderName = folder.getName(); + int start = folderName.indexOf(StrPool.UNDERSCORE); + String cityName = folderName.substring(start + 1, start + 4); + Region cityRegion = regionMap.get(cityName); + regionId = cityRegion.getId(); + + }else { + regionId = region.getId(); + } + ndSecurityAdvisory.setRegionId(regionId); + ndSecurityAdvisory.setRegionName(regionsCacheHelper.getDisplayName(regionId)); + // 获取当前日期 + LocalDate currentDate = LocalDate.now(); + // 获取当前日期所在月份的第一天 + LocalDate firstDayOfMonth = currentDate.with(TemporalAdjusters.firstDayOfMonth()); + // 获取第一天的开始时间 + LocalTime startTime = LocalTime.of(0, 0,0); + // 将日期和时间合并为完整的日期时间对象 + LocalDateTime time = LocalDateTime.of(firstDayOfMonth, startTime); + //String dateString = "2023-06-01 00:00:00"; + //DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + //LocalDateTime time = LocalDateTime.parse(dateString, formatter); + ndSecurityAdvisory.setAdvisoryDate(time); + ndSecurityAdvisory.setFileId(fileResultVo.getId()); + ndSecurityAdvisory.setAdvisoryFileName(fileName); + ndSecurityAdvisory.setCompanyId(32104L); + ndSecurityAdvisoryService.save(ndSecurityAdvisory); + } catch (IOException e) { + throw new BizException("上传文件失败:" + e.getMessage()); + } + } + } + } + } + + public static void main(String[] args) { + // 获取当前日期 + LocalDate currentDate = LocalDate.now(); + // 获取当前日期所在月份的第一天 + LocalDate firstDayOfMonth = currentDate.with(TemporalAdjusters.firstDayOfMonth()); + // 获取第一天的开始时间 + LocalTime startTime = LocalTime.of(0, 0,0); + // 将日期和时间合并为完整的日期时间对象 + LocalDateTime firstDayOfMonthWithStartTime = LocalDateTime.of(firstDayOfMonth, startTime); + + System.out.println(firstDayOfMonthWithStartTime); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/manage/UserLoginManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/manage/UserLoginManage.java new file mode 100644 index 0000000..26a994f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/manage/UserLoginManage.java @@ -0,0 +1,127 @@ +package com.ningdatech.carapi.open.manage; + +import java.time.Duration; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.SignUtil; +import com.ningdatech.carapi.open.model.dto.UserLoginDTO; +import com.ningdatech.carapi.sys.contants.UserLoginConstant; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.sys.service.UserRoleService; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; +import com.ningdatech.sms.send.GyytzMarketSmsHelper; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/01/06 16:40 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class UserLoginManage { + + private final INdUserInfoService ndUserInfoService; + private final INdUserAuthService ndUserAuthService; + private final UserRoleService userRoleService; + private final CachePlusOps cachePlusOps; + private final GyytzMarketSmsHelper gyytzMarketSmsHelper; + private final RestTemplate restTemplate; + private final CompanyService companyService; + @Value("${sms.interfaceKey}") + private String smsKey; + + @Value("${sms.transmitUrl}") + private String transmitUrl; + + + public String getVerificationCode(UserLoginDTO param) { + // 获取用户名入参信息 + String userName = param.getUsername(); + // 根据用户名获取用户账号信息 + NdUserAuth userAuth = ndUserAuthService.getOne(Wrappers.lambdaQuery(NdUserAuth.class) + .eq(NdUserAuth::getIdentifier, userName)); + VUtils.isTrue(Objects.isNull(userAuth)).throwMessage("该用户不存在!"); + // 根据用户ID获取用户信息 + NdUserInfo ndUserInfo = ndUserInfoService.getOne(Wrappers.lambdaQuery(NdUserInfo.class) + .eq(NdUserInfo::getId, userAuth.getUserId())); + VUtils.isTrue(Objects.isNull(ndUserInfo)).throwMessage("该用户不存在!"); + // 根据用户信息获取用户角色 + Long userId = ndUserInfo.getId(); + Long companyId = ndUserInfo.getCompanyId(); + UserRole userRole = userRoleService.getOne(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getUserId, userId)); + String mobile = null; + if (Objects.nonNull(userRole)){ + Long roleId = userRole.getRoleId(); + // 如果是企业用户,优先获取企业联系人电话 + if (UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId().equals(roleId)){ + // 获取企业联系人电话 + Company company = companyService.getById(companyId); + String contactPhone = company.getContactPhone(); + if (Objects.nonNull(contactPhone)) { + mobile = contactPhone; + }else { + // 如果没有联系人,则向企业关联的法人手机号发送短信 + mobile = ndUserInfo.getMobile(); + } + }else { + mobile = ndUserInfo.getMobile(); + } + } + VUtils.isTrue(StringUtils.isBlank(mobile)).throwMessage("该用户没有设置手机号!"); + + // 生成验证码,保存到用户信息表中 + String verificationCode = CodeUtil.codeFen(6); + ndUserInfo.setVerificationCode(verificationCode); + ndUserInfoService.updateById(ndUserInfo); + + // 将验证码保存到redis中,并设置过期时间 + CacheKey key = new CacheKey(UserLoginConstant.RedisKey.USER_LOGIN + userName); + key.setExpire(Duration.ofMinutes(10)); + cachePlusOps.set(key,verificationCode,false); + + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + + Map requestBody = new HashMap<>(); + requestBody.put("mobile", mobile); + requestBody.put("verificationCode", verificationCode); + // 生成签名 + String sign = SignUtil.generateSign(requestBody, smsKey); + requestBody.put("sign",sign); + + HttpEntity> requestEntity = new HttpEntity<>(requestBody, headers); + try { + ResponseEntity responseEntity = restTemplate.postForEntity(transmitUrl, requestEntity, String.class); + return responseEntity.getBody(); + } catch (RestClientException e) { + throw new BizException("调用短信转发服务失败!"); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/OpenApiTestReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/OpenApiTestReq.java new file mode 100644 index 0000000..c4d83f6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/OpenApiTestReq.java @@ -0,0 +1,26 @@ +package com.ningdatech.carapi.open.model; + +import com.ningdatech.openapi.signature.model.AbstractOpenApiSignatureReq; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; + +/** + *

ø + * OpenApiTestReq + *

+ * + * @author WendyYang + * @since 18:32 2022/11/2 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class OpenApiTestReq extends AbstractOpenApiSignatureReq { + + private String name; + + @NotBlank(message = "name is required") + private String code; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/dto/AlarmDataPictureDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/dto/AlarmDataPictureDTO.java new file mode 100644 index 0000000..421ce37 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/dto/AlarmDataPictureDTO.java @@ -0,0 +1,144 @@ +package com.ningdatech.carapi.open.model.dto; + +import com.ningdatech.openapi.signature.model.AbstractOpenApiSignatureReq; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @Classname AlarmDataPicture + * @Description + * @Date 2022/10/28 10:47 + * @Created by PoffyZhang + */ +@Data +@ApiModel(value = "AlarmDataPicture", description = "告警数据 图片保存") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class AlarmDataPictureDTO extends AbstractOpenApiSignatureReq{ + + private static final long serialVersionUID = 1L; + + /** + *设备上报图片ID + */ + @ApiModelProperty("设备上报图片ID") + @NotBlank(message = "设备上报图片ID不能为空") + private String originPicId; + + /** + *车辆编号 + */ + @ApiModelProperty("车辆编号") + private String vehicleIndexCode; + + /** + *车辆自编号 + */ + @ApiModelProperty("车辆自编号") + private String vehicleSelfNo; + + /** + *监控点编号 + */ + @ApiModelProperty("监控点编号") + private String cameraIndexCode; + + /** + *监控点名称 + */ + @ApiModelProperty("监控点名称") + private String cameraName; + + /** + *上传类型 + */ + @ApiModelProperty("上传类型 2:报警") + private Integer uploadType; + + /** + * 告警ID + */ + @ApiModelProperty("告警ID") + @NotBlank(message = "告警ID不能为空") + private String alarmId; + + /** + * 事件类型 + */ + @ApiModelProperty("事件类型") + private String alarmType; + + /** + * 事件类型名 + */ + @ApiModelProperty("事件类型名 如:接打电话") + private String alarmTypeName; + + /** + * 抓拍时间 + */ + @ApiModelProperty("抓拍时间") + @NotNull(message = "抓拍时间不能为空") + private String captureTime; + + /** + * 图片地址 + */ + @ApiModelProperty("图片地址") + @NotBlank(message = "图片地址不能为空") + private String url; + + /** + * 缩略图地址 + */ + @ApiModelProperty("缩略图地址") + private String thumbUrl; + + /** + * 本图片所关联的抓拍图片的唯一标识 + */ + @ApiModelProperty("本图片所关联的抓拍图片的唯一标识") + private String parentPicId; + + /** + * 人脸小图在关联的抓拍图片上的坐标 + */ + @ApiModelProperty("人脸小图在关联的抓拍图片上的坐标") + private String faceRect; + + /** + * 图片类型 + */ + @ApiModelProperty("图片类型 可选项,0x01标识可见光,0x02标识热成像,若没有,则默认为可见光") + private String picType; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @NotBlank(message = "车牌号不能为空") + private String plateNo; + + /** + * 区域编码 + */ + @ApiModelProperty("区域编码") + private String regionIndexCode; + + /** + * 区域名称 + */ + @ApiModelProperty("区域名称") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/dto/AlarmDataVideoDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/dto/AlarmDataVideoDTO.java new file mode 100644 index 0000000..71ea452 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/dto/AlarmDataVideoDTO.java @@ -0,0 +1,169 @@ +package com.ningdatech.carapi.open.model.dto; + +import com.ningdatech.openapi.signature.model.AbstractOpenApiSignatureReq; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @Classname AlarmDataVideo + * @Description + * @Date 2022/10/28 10:47 + * @Created by PoffyZhang + */ +@Data +@ApiModel(value = "AlarmDataVideo", description = "告警数据 短视频保存") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class AlarmDataVideoDTO extends AbstractOpenApiSignatureReq { + + private static final long serialVersionUID = 1L; + + /** + *设备上报短视频唯一标识 + */ + @ApiModelProperty("设备上报短视频唯一标识") + @NotBlank(message = "设备上报短视频唯一标识不能为空") + private String orginVideoId; + + /** + *车辆编号 + */ + @ApiModelProperty("车辆编号") + private String vehicleIndexCode; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @NotBlank(message = "车牌号不能为空") + private String plateNo; + + /** + *车辆自编号 + */ + @ApiModelProperty("车辆自编号") + private String vehicleSelfNo; + + /** + * 区域编码 + */ + @ApiModelProperty("区域编码") + private String regionIndexCode; + + /** + * 区域名称 + */ + @ApiModelProperty("区域名称") + private String regionName; + + /** + *监控点编号 + */ + @ApiModelProperty("监控点编号") + private String cameraIndexCode; + + /** + *监控点名称 + */ + @ApiModelProperty("监控点名称") + private String cameraName; + + /** + *服务编号 + */ + @ApiModelProperty("服务编号") + @NotBlank(message = "服务编号不能为空") + private String serviceIndexCode; + + /** + *开始时间 + */ + @ApiModelProperty("开始时间") + @NotBlank(message = "开始时间不能为空") + private String beginTime; + + /** + *结束时间 + */ + @ApiModelProperty("结束时间") + @NotBlank(message = "结束时间不能为空") + private String endTime; + + /** + *流码开始时间 + */ + @ApiModelProperty("流码开始时间") + @NotBlank(message = "流码开始时间不能为空") + private String streamBeginTime; + + /** + *流码结束时间 + */ + @ApiModelProperty("流码结束时间") + @NotBlank(message = "流码结束时间不能为空") + private String streamEndTime; + + /** + *片段时长 + */ + @ApiModelProperty("片段时长 秒") + @NotNull(message = "片段时长不能为空") + private Integer videoLength; + + /** + * 告警ID + */ + @ApiModelProperty("告警ID") + @NotBlank(message = "告警ID不能为空") + private String alarmId; + + /** + * 告警时间 + */ + @ApiModelProperty("告警时间") + @NotBlank(message = "告警时间不能为空") + private String alarmTime; + + /** + * 事件类型 + */ + @ApiModelProperty("事件类型") + private String alarmType; + + /** + * 事件类型名 + */ + @ApiModelProperty("事件类型名 如:接打电话") + private String alarmTypeName; + + /** + * 片段编号 + */ + @ApiModelProperty("片段编号") + @NotBlank(message = "片段编号不能为空") + private String recordIndexCode; + + /** + * 短视频地址 + */ + @ApiModelProperty("短视频地址") + @NotBlank(message = "短视频地址不能为空") + private String url; + + /** + * 封面url + */ + @ApiModelProperty("封面url") + private String coverUrl; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/dto/UserLoginDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/dto/UserLoginDTO.java new file mode 100644 index 0000000..5995325 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/dto/UserLoginDTO.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.open.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户登录实体类 + * + * @author CMM + * @since 2023/01/05 17:41 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class UserLoginDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("用户名") + private String username; + + @ApiModelProperty("密码") + private String password; + + @ApiModelProperty("用户ID") + private Long userId; + + @ApiModelProperty("手机号") + private String mobile; + + @ApiModelProperty("验证码") + private String verificationCode; + + @ApiModelProperty("签名") + private String sign; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/po/ReqRealTimeCapPositionPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/po/ReqRealTimeCapPositionPO.java new file mode 100644 index 0000000..ee455d5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/po/ReqRealTimeCapPositionPO.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.open.model.po; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; + +/** + * @author CMM + * @since 2023/11/17 10:47 + */ +@ApiModel(description = "车辆实时位置请求入参") +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ReqRealTimeCapPositionPO extends PagePo { + @ApiModelProperty("车牌号") + String carPlate; + + @ApiModelProperty("校验公钥") + @NotBlank(message = "秘钥不能为空") + private String key; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/vo/CompanySecurityInfoVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/vo/CompanySecurityInfoVO.java new file mode 100644 index 0000000..d330006 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/open/model/vo/CompanySecurityInfoVO.java @@ -0,0 +1,63 @@ +package com.ningdatech.carapi.open.model.vo; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 企业安全信息 + * + * @author CMM + * @since 2023/05/26 12:18 + */ +@Data +public class CompanySecurityInfoVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("公共信用评价分值") + private Integer commonCreditScore; + + @ApiModelProperty("基本管理信用分值") + private Integer basicCreditScore; + + @ApiModelProperty("安全生产管理信用分值") + private Integer safeProductCreditScore; + + @ApiModelProperty("行业监管信用分值") + private Integer industryRegulateCreditScore; + + @ApiModelProperty("行业荣誉加分") + private Integer industryHonorBonus; + + @ApiModelProperty("企业信用评价总分") + private Integer companyCreditEvaluateTotalScore; + + @ApiModelProperty("信用等级") + private String creditLevel; + + @ApiModelProperty("信用等级含义") + private String creditLevelName; + + @ApiModelProperty("企业风险等级") + private Integer dangerLevel; + + @ApiModelProperty("企业风险名称") + private String dangerLevelName; + + @ApiModelProperty("企业安全风险分值") + private Integer companySafeRiskScore; + + @ApiModelProperty("累计违章次数") + private Integer violationCnt; + + @ApiModelProperty("累计出险次数") + private Integer outDangerCnt; + + @ApiModelProperty("累计受伤人数") + private Integer injuryCnt; + + @ApiModelProperty("累计死亡人数") + private Integer deadCnt; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/controller/QrcodeController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/controller/QrcodeController.java new file mode 100644 index 0000000..f0b8a8c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/controller/QrcodeController.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.qrcode.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.driver.model.vo.ResArchivalInfoSearchListVO; +import com.ningdatech.carapi.qrcode.manage.QrcodeManage; +import com.ningdatech.carapi.qrcode.model.dto.GetOnVehicleDTO; +import com.ningdatech.carapi.qrcode.model.dto.VehicleGetOnPageQuery; +import com.ningdatech.carapi.qrcode.model.vo.GetOnVehicleVO; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import com.ningdatech.log.annotation.WebLog; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + *

+ * 前端控制器 + * 二维码相关 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/qrcode") +@Api(value = "Qrcode", tags = "二维码") +@RequiredArgsConstructor +public class QrcodeController { + + private final QrcodeManage qrcodeManage; + + @ApiOperation(value = "获取当前登录驾驶员信息", notes = "获取当前登录驾驶员信息") + @GetMapping("/driver-logined") + @WebLog + public ResArchivalInfoSearchListVO queryLoginedDriver() { + return qrcodeManage.queryLoginedDriver(); + } + + @ApiOperation(value = "扫码上车", notes = "扫码上车") + @PostMapping("/get-on-vehicle") + @WebLog + public GetOnVehicleVO getOnVehicle(@Valid @RequestBody GetOnVehicleDTO getOnVehicleDTO) { + return qrcodeManage.getOnVehicle(getOnVehicleDTO, LoginUserUtil.getUserId()); + } + + @ApiOperation(value = "上车记录列表查询", notes = "上车记录列表查询") + @GetMapping("/get-on-list") + public PageVo getOnList(@Valid @ModelAttribute VehicleGetOnPageQuery vehicleArchivesPageQuery) { + return qrcodeManage.getOnList(vehicleArchivesPageQuery); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/entity/NdVehicleGetOn.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/entity/NdVehicleGetOn.java new file mode 100644 index 0000000..e31dc64 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/entity/NdVehicleGetOn.java @@ -0,0 +1,90 @@ +package com.ningdatech.carapi.qrcode.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-25 + */ +@Data +@TableName("nd_vehicle_get_on") +@ApiModel(value = "NdVehicleGetOn", description = "车辆档案-上车记录") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleGetOn extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("车辆ID") + @TableField(value = "vehicle_id") + private Long vehicleId; + + @ApiModelProperty("驾驶员ID") + @TableField(value = "driver_id") + private Long driverId; + + @ApiModelProperty("车牌号") + @TableField(value = "car_plate") + private String carPlate; + + @ApiModelProperty("驾驶员名字") + @TableField(value = "driver_name") + private String driverName; + + @ApiModelProperty("车辆颜色") + @TableField(value = "plate_color") + private String plateColor; + + @ApiModelProperty("车辆类型") + @TableField(value = "vehicle_type") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + @TableField(value = "vehicle_type_name") + private String vehicleTypeName; + + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; + + @ApiModelProperty("运营商名") + @TableField(value = "operator_name") + private String operatorName; + + @ApiModelProperty("公司id") + @TableField(value = "company_id") + private Long companyId; + + @ApiModelProperty("公司名") + @TableField(value = "company_name") + private String companyName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/manage/QrcodeManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/manage/QrcodeManage.java new file mode 100644 index 0000000..5adb837 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/manage/QrcodeManage.java @@ -0,0 +1,144 @@ +package com.ningdatech.carapi.qrcode.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +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.exception.code.ExceptionCode; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.car.vehicle.model.dto.VehicleArchivesQueryDTO; +import com.ningdatech.carapi.car.vehicle.manage.VehicleManage; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.helper.DriverInfoHelper; +import com.ningdatech.carapi.driver.manage.DriverArchivesManage; +import com.ningdatech.carapi.driver.model.po.ReqGetArchivalInfoReviewDetailPO; +import com.ningdatech.carapi.driver.model.vo.ResArchivalInfoDetailVO; +import com.ningdatech.carapi.driver.model.vo.ResArchivalInfoSearchListVO; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.qrcode.entity.NdVehicleGetOn; +import com.ningdatech.carapi.qrcode.model.dto.GetOnVehicleDTO; +import com.ningdatech.carapi.qrcode.model.dto.VehicleGetOnPageQuery; +import com.ningdatech.carapi.qrcode.model.vo.GetOnVehicleVO; +import com.ningdatech.carapi.qrcode.service.VehicleGetOnService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Objects; + +/** + * @Classname OrcodeManage + * @Description + * @Date 2022/10/18 14:39 + * @Created by PoffyZhang + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class QrcodeManage { + + private final IDriverInfoService driverInfoService; + private final VehicleGetOnService vehicleGetOnService; + private final VehicleManage vehicleManage; + private final DriverArchivesManage driverArchivesManage; + private final RegionsCacheHelper regionsCacheHelper; + private final DriverInfoHelper driverInfoHelper; + + /** + * 获取当前登录驾驶员信息 + * + * @return + */ + public ResArchivalInfoSearchListVO queryLoginedDriver() { + Long userId = LoginUserUtil.getUserId(); + if (Objects.isNull(userId)) { + throw new BizException(ExceptionCode.JWT_NOT_LOGIN.getCode(), "请确认当前驾驶员已登录"); + } + + LambdaQueryWrapper driverInfoLambdaQueryWrappery = Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getUserId, userId) + .orderByDesc(DriverInfo::getUpdateOn); + DriverInfo driveInfo = driverInfoService.getOne(driverInfoLambdaQueryWrappery); + if (Objects.isNull(driveInfo)) { + throw new BizException("驾驶员信息不存在!"); + } + ResArchivalInfoSearchListVO res = BeanUtil.copyProperties(driveInfo, ResArchivalInfoSearchListVO.class); + res.setDriverId(driveInfo.getId()); + return res; + } + + public PageVo getOnList(VehicleGetOnPageQuery vehicleArchivesPageQuery) { + Page page = vehicleArchivesPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleGetOn.class); + buildWrapper(wrapper, vehicleArchivesPageQuery); + vehicleGetOnService.page(page, wrapper); + List data = CollUtils.convert(page.getRecords(), e -> BeanUtil.copyProperties(e, GetOnVehicleVO.class)); + return PageVo.of(data, page.getTotal()); + } + + private void buildWrapper(LambdaQueryWrapper wrapper, VehicleGetOnPageQuery vehicleArchivesPageQuery) { + if (Objects.nonNull(vehicleArchivesPageQuery.getRegionId())) { + List regionIds = regionsCacheHelper.listChildRegionId(vehicleArchivesPageQuery.getRegionId()); + wrapper.in(CollUtil.isNotEmpty(regionIds), NdVehicleGetOn::getRegionId, regionIds); + } + wrapper.like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getCarPlate()), NdVehicleGetOn::getCarPlate, vehicleArchivesPageQuery.getCarPlate()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getCompanyName()), NdVehicleGetOn::getCompanyName, vehicleArchivesPageQuery.getCompanyName()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getVehicleType()), NdVehicleGetOn::getVehicleType, vehicleArchivesPageQuery.getVehicleType()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getDriverName()), NdVehicleGetOn::getDriverName, vehicleArchivesPageQuery.getDriverName()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getOperatorName()), NdVehicleGetOn::getOperatorName, vehicleArchivesPageQuery.getOperatorName()) + .ge(Objects.nonNull(vehicleArchivesPageQuery.getStartTime()), NdVehicleGetOn::getCreateOn, vehicleArchivesPageQuery.getStartTime()) + .le(Objects.nonNull(vehicleArchivesPageQuery.getEndTime()), NdVehicleGetOn::getCreateOn, vehicleArchivesPageQuery.getEndTime()) + .orderBy(Boolean.TRUE, Boolean.FALSE, NdVehicleGetOn::getCreateOn); + } + + /** + * 扫码上车 + * + * @param data + * @return + */ + public GetOnVehicleVO getOnVehicle(GetOnVehicleDTO data, Long userId) { + driverInfoHelper.driverCertificateValidCheck(userId); + + NdVehicleGetOn vehicleGetOn = BeanUtil.toBean(data, NdVehicleGetOn.class); + //进行业务处理 + //1.查询车辆信息 + VehicleArchivesQueryDTO vehicleDetails = vehicleManage.getDetails(data.getVehicleId()); + if (Objects.isNull(vehicleDetails)) { + throw new BizException(ExceptionCode.NOT_FOUND.getCode(), "找不到目标车辆 {}", data.getVehicleId()); + } + //2.查询驾驶员信息 + ReqGetArchivalInfoReviewDetailPO po = new ReqGetArchivalInfoReviewDetailPO(); + po.setDriverId(data.getDriverId()); + ResArchivalInfoDetailVO archivalInfoDetail = driverArchivesManage.getDriverDetail(po); + if (Objects.isNull(archivalInfoDetail)) { + throw new BizException(ExceptionCode.NOT_FOUND.getCode(), "找不到目标驾驶员 {}", data.getVehicleId()); + } + //3.拼接信息存入上车表 + vehicleGetOn.setCarPlate(vehicleDetails.getCarPlate()); + vehicleGetOn.setPlateColor(vehicleDetails.getPlateColor()); + vehicleGetOn.setCompanyId(vehicleDetails.getCompanyId()); + vehicleGetOn.setCompanyName(vehicleDetails.getCompanyName()); + vehicleGetOn.setDriverName(archivalInfoDetail.getDriverName()); + vehicleGetOn.setOperatorName(vehicleDetails.getOperatorName()); + vehicleGetOn.setRegionId(vehicleDetails.getRegionId()); + vehicleGetOn.setRegionName(vehicleDetails.getRegionName()); + if (Objects.nonNull(vehicleDetails.getVehicleType())) { + vehicleGetOn.setVehicleType(vehicleDetails.getVehicleType()); + vehicleGetOn.setVehicleTypeName(VehicleTypeEnum.getDescByCode(vehicleDetails.getVehicleType())); + } + //创建人 最后修改人 + vehicleGetOn.setCreateBy(userId); + vehicleGetOn.setUpdateBy(userId); + vehicleGetOnService.save(vehicleGetOn); + return BeanUtil.toBean(vehicleGetOn, GetOnVehicleVO.class); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/mapper/VehicleGetOnMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/mapper/VehicleGetOnMapper.java new file mode 100644 index 0000000..e68c3d9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/mapper/VehicleGetOnMapper.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.qrcode.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.qrcode.entity.NdVehicleGetOn; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-18 + */ +public interface VehicleGetOnMapper extends BaseMapper { + + List selectVehicleGetOnList(@Param("carPlateList") List carPlateList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/mapper/VehicleGetOnMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/mapper/VehicleGetOnMapper.xml new file mode 100644 index 0000000..306c2c3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/mapper/VehicleGetOnMapper.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/model/dto/GetOnVehicleDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/model/dto/GetOnVehicleDTO.java new file mode 100644 index 0000000..e2862cb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/model/dto/GetOnVehicleDTO.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.qrcode.model.dto; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdVehicleGetOn", description = "二维码-上车 值对象") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class GetOnVehicleDTO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 驾驶员ID + */ + @ApiModelProperty("驾驶员ID") + @NotNull(message = "驾驶员ID必填") + private Long driverId; + + /** + * 车辆ID + */ + @ApiModelProperty("车辆ID") + @NotNull(message = "车辆ID必填") + private Long vehicleId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/model/dto/VehicleGetOnPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/model/dto/VehicleGetOnPageQuery.java new file mode 100644 index 0000000..d224c39 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/model/dto/VehicleGetOnPageQuery.java @@ -0,0 +1,83 @@ +package com.ningdatech.carapi.qrcode.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 实体类 + * 车辆档案 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "VehicleGetOnPageQuery", description = "上车信息") +public class VehicleGetOnPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 上车开始时间 + */ + @ApiModelProperty(value = "上车开始时间") + private LocalDateTime startTime; + + /** + * 上车结束时间 + */ + @ApiModelProperty(value = "上车结束时间") + private LocalDateTime endTime; + + /** + * 驾驶员名 + */ + @ApiModelProperty(value = "驾驶员名") + private String driverName; + + /** + * 车牌号 + */ + @ApiModelProperty(value = "车牌号") + private String carPlate; + + /** + * 所属企业名 + */ + @ApiModelProperty(value = "所属企业名") + private String companyName; + + /** + * 车辆类型 + */ + @ApiModelProperty(value = "车辆类型") + private Integer vehicleType; + + /** + * 所属区域id + */ + @ApiModelProperty(value = "所属区域id") + private Long regionId; + + + /** + * 运营商名 + */ + @ApiModelProperty(value = "运营商名") + private String operatorName; + + @ApiModelProperty("审核类型 1.待审核 2.已审核") + private Integer auditType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/model/vo/GetOnVehicleVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/model/vo/GetOnVehicleVO.java new file mode 100644 index 0000000..e3d2447 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/model/vo/GetOnVehicleVO.java @@ -0,0 +1,71 @@ +package com.ningdatech.carapi.qrcode.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "GetOnVehicleVO", description = "二维码-上车 视图对象") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class GetOnVehicleVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("车辆ID") + private Long vehicleId; + + @ApiModelProperty("驾驶员ID") + private Long driverId; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("驾驶员名字") + private String driverName; + + @ApiModelProperty("车辆颜色") + private String plateColor; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名") + private String regionName; + + @ApiModelProperty("运营商名") + private String operatorName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名") + private String companyName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/service/VehicleGetOnService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/service/VehicleGetOnService.java new file mode 100644 index 0000000..7612db9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/service/VehicleGetOnService.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.qrcode.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.qrcode.entity.NdVehicleGetOn; + +import java.util.List; + +/** + * @Classname VehicleGetOnService + * @Description + * @Date 2022/10/18 15:11 + * @Created by PoffyZhang + */ +public interface VehicleGetOnService extends IService { + + List selectVehicleGetOnList(List carPlateList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/service/impl/VehicleGetOnServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/service/impl/VehicleGetOnServiceImpl.java new file mode 100644 index 0000000..506e2fc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/qrcode/service/impl/VehicleGetOnServiceImpl.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.qrcode.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.qrcode.entity.NdVehicleGetOn; +import com.ningdatech.carapi.qrcode.mapper.VehicleGetOnMapper; +import com.ningdatech.carapi.qrcode.service.VehicleGetOnService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-18 + */ +@Service +@RequiredArgsConstructor +public class VehicleGetOnServiceImpl extends ServiceImpl implements VehicleGetOnService { + + private final VehicleGetOnMapper vehicleGetOnMapper; + @Override + public List selectVehicleGetOnList(List carPlateList) { + return vehicleGetOnMapper.selectVehicleGetOnList(carPlateList); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/client/RadarHandler.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/client/RadarHandler.java new file mode 100644 index 0000000..14fe594 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/client/RadarHandler.java @@ -0,0 +1,95 @@ +package com.ningdatech.carapi.radar.client; + +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.Socket; +import java.nio.charset.StandardCharsets; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import cn.hutool.socket.SocketUtil; +import com.google.common.collect.Lists; +import com.ningdatech.carapi.radar.helper.RadarDataHelper; +import com.ningdatech.carapi.radar.model.entity.RadarData; +import com.ningdatech.carapi.radar.service.IRadarDataService; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * 雷达客户端数据处理器 + * @since 2024/09/28 10:32 + */ +@Slf4j +public class RadarHandler implements Runnable{ + private final Socket clientSocket; + private final IRadarDataService radarDataService; + private final String radarIp; + private final RadarDataHelper radarDataHelper; + + public RadarHandler(Socket socket, IRadarDataService radarDataService, String radarIp, RadarDataHelper radarDataHelper) { + this.clientSocket = socket; + this.radarDataService = radarDataService; + this.radarIp = radarIp; + this.radarDataHelper = radarDataHelper; + } + + @Override + public void run() { + ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); + // 获取输入流以读取雷达发送的数据 + try { + // 从接入数据 开始 持续接收1分钟的数据 接收完成后 关闭连接 + // 设置1分钟后关闭连接 + executor.schedule(() -> { + try { + clientSocket.close(); + } catch (IOException e) { + log.error("Error closing client socket: ", e); + } + }, 1, TimeUnit.MINUTES); + + InputStream dataInputStream = clientSocket.getInputStream(); + // 开启保活选项 + clientSocket.setKeepAlive(true); + byte[] buffer = new byte[1024]; + int bytesRead; + // 循环读取数据,直到Socket被关闭 + while (!clientSocket.isClosed() && (bytesRead = dataInputStream.read(buffer)) != -1) { + // 处理读取到的数据 + String dataString = new String(buffer, 0, bytesRead, StandardCharsets.UTF_8); + log.info("Received: {}", dataString); + RadarData radarData = new RadarData(); + radarData.setArmIp(radarIp); + // 解析数据 + radarData.setCreateOn(LocalDateTime.now()); + radarData.setUpdateOn(LocalDateTime.now()); + radarDataService.save(radarData); + } + } catch (IOException e) { + throw new RuntimeException(e); + }finally { + // 关闭ScheduledExecutorService + executor.shutdown(); + try { + if (!executor.awaitTermination(5, TimeUnit.SECONDS)) { + executor.shutdownNow(); + } + } catch (InterruptedException e) { + executor.shutdownNow(); + } + } + } + + private void processData(String dataString, RadarData radarData) { + // 校验包头、包尾 + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/constant/RadarCarTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/constant/RadarCarTypeEnum.java new file mode 100644 index 0000000..aa25adb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/constant/RadarCarTypeEnum.java @@ -0,0 +1,68 @@ +package com.ningdatech.carapi.radar.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2022/12/20 14:10 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "RadarCarTypeEnum", description = "雷达车辆类型-枚举") +public enum RadarCarTypeEnum { + /** + * 自行车情况 + */ + NON_MOTOR(1, "非机动车"), + CAR(2, "小型车辆"), + BUS(3, "中大型车辆"), + UNKNOWN(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 (RadarCarTypeEnum t : RadarCarTypeEnum.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 (RadarCarTypeEnum t : RadarCarTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/constant/RadarDataTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/constant/RadarDataTypeEnum.java new file mode 100644 index 0000000..32c6800 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/constant/RadarDataTypeEnum.java @@ -0,0 +1,66 @@ +package com.ningdatech.carapi.radar.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2022/12/20 14:10 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "RadarDataTypeEnum", description = "雷达数据类型-枚举") +public enum RadarDataTypeEnum { + /** + * 自行车情况 + */ + OBJECT_DATA(1, "目标数据"), + TRAFFIC_DATA(2, "流量数据"); + + 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 (RadarDataTypeEnum t : RadarDataTypeEnum.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 (RadarDataTypeEnum t : RadarDataTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/controller/RadarController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/controller/RadarController.java new file mode 100644 index 0000000..e94a26b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/controller/RadarController.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.radar.controller; + +import com.ningdatech.carapi.radar.manage.RadarManage; +import com.ningdatech.carapi.radar.model.vo.RadarObjectDataVO; +import com.ningdatech.carapi.radar.model.vo.RadarTrafficFlowDataVO; +import com.ningdatech.carapi.road.model.req.RoadMonitorReq; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/radar") +@RequiredArgsConstructor +public class RadarController { + + private final RadarManage radarManage; + + @ApiOperation(value = "客户端-雷达监听连接测试", notes = "客户端-雷达监听连接测试") + @GetMapping("/get-radar-data-as-client") + public String getRadarDataAsClient() { + return radarManage.getRadarDataAsClient(); + } + + @ApiOperation(value = "服务端-雷达监听连接测试", notes = "服务端-雷达监听连接测试") + @GetMapping("/get-radar-data-as-server") + public String getRadarDataAsServer() { + return radarManage.getRadarDataAsServer(); + } + + @ApiOperation(value = "工作台雷达交通流量数据", notes = "工作台雷达交通流量数据") + @GetMapping("/workbench/radar-traffic-flow-data") + public RadarTrafficFlowDataVO workbenchRadarTrafficFlowData(RoadMonitorReq req) { + return radarManage.workbenchRadarTrafficFlowData(req); + } + + @ApiOperation(value = "道路监控驾驶舱雷达交通流量数据", notes = "道路监控驾驶舱雷达交通流量数据") + @GetMapping("/radar-traffic-flow-data") + public RadarTrafficFlowDataVO radarTrafficFlowData(RoadMonitorReq req) { + return radarManage.radarTrafficFlowData(req); + } + + @ApiOperation(value = "道路监控驾驶舱雷达目标轨迹数据", notes = "道路监控驾驶舱雷达目标轨迹数据") + @GetMapping("/radar-object-data") + public List radarObjectData(RoadMonitorReq req) { + return radarManage.radarObjectData(req); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/helper/RadarDataHelper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/helper/RadarDataHelper.java new file mode 100644 index 0000000..d7b7fe0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/helper/RadarDataHelper.java @@ -0,0 +1,482 @@ +package com.ningdatech.carapi.radar.helper; + +import com.google.common.collect.Lists; +import com.ningdatech.carapi.radar.model.vo.RadarDataVO; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.List; + +/** + * @author CMM + * @since 2024/11/08 10:15 + */ +@Component +@RequiredArgsConstructor +public class RadarDataHelper { + + // 将16进制字符串转换为字节数组 + public byte[] hexStringToByteArray(String s) { + // 确保字符串长度为偶数 + if (s.length() % 2 != 0) { + // 如果长度为奇数,移除最后一个字符 + s = s.substring(0, s.length() - 1); + } + int len = s.length(); + byte[] data = new byte[len / 2]; + for (int i = 0; i < len; i += 2) { + // 如果输入的字符不是16进制字符,跳过 + if (!Character.isDigit(s.charAt(i)) && !Character.isLetter(s.charAt(i))) { + continue; + } + data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + + Character.digit(s.charAt(i+1), 16)); + } + return data; + } + + // 以16进制字节数组解析数据帧并提取指定位置指定字节数的数据 + public byte[] extractHexData(String hexFrame, int dataOffset, int dataLength) { + byte[] frameBytes = hexStringToByteArray(hexFrame); + // 检查数据长度是否超出帧的范围 + if (dataOffset + dataLength > frameBytes.length) { + throw new IllegalArgumentException("Data length exceeds frame boundary"); + } + // 提取数据 + byte[] extractedData = new byte[dataLength]; + System.arraycopy(frameBytes, dataOffset, extractedData, 0, dataLength); + return extractedData; + } + + // 在字节数组中查找特定模式 + public int findPattern(byte[] array, byte[] pattern) { + for (int i = 0; i < array.length - pattern.length + 1; i++) { + boolean found = true; + for (int j = 0; j < pattern.length; j++) { + if (array[i + j] != pattern[j]) { + found = false; + break; + } + } + if (found) { + return i; + } + } + return -1; + } + + // 将字节数组转换为16进制字符串 + public String byteArrayToHexString(byte[] bytes) { + StringBuilder sb = new StringBuilder(); + for (byte b : bytes) { + // 过滤掉EF00 + if (b == (byte) 0xEF || b == (byte) 0x00){ + continue; + } + sb.append(String.format("%02X", b)); + } + return sb.toString(); + } + + // 将字节数组转换为16进制字符串 + public String byteArrayToHexStringAll(byte[] bytes) { + StringBuilder sb = new StringBuilder(); + for (byte b : bytes) { + sb.append(String.format("%02X", b)); + } + return sb.toString(); + } + + public void processRadarData(String data) { + String head = "55aa55bb"; + String tail = "55cc55dd"; + + // 解析上面的数据帧data 包头是head 包尾是tail 从包头到包尾分段取出数据 放入一个字符串列表中 等待解析 + List segments = Lists.newArrayList(); + int headIndex = data.indexOf(head); + while (headIndex != -1) { + int tailIndex = data.indexOf(tail, headIndex + head.length()); + if (tailIndex != -1) { + // 提取从包头到包尾的数据段 + String segment = data.substring(headIndex + head.length(), tailIndex); + segments.add(segment); + // 移动到下一个包头的位置 + headIndex = data.indexOf(head, tailIndex + tail.length()); + } else { + // 没有找到包尾,结束循环 + break; + } + } + + // 遍历这些数据帧 解析其中携带的数据 + for (String segment : segments) { + System.out.println(segment); + + //// 获取数据长度 2字节 4字符 判断数据包长度 + byte[] dataLengthData = extractHexData(segment, 0, 2); + String dataLengthHexString = byteArrayToHexStringAll(dataLengthData); + // 将16进制字符串转换为字节数组 + byte[] lengthBytes = new byte[2]; + // 高8位 + lengthBytes[0] = (byte) Integer.parseInt(dataLengthHexString.substring(0, 2), 16); + // 低8位 + lengthBytes[1] = (byte) Integer.parseInt(dataLengthHexString.substring(2, 4), 16); + + // 将字节数组转换为16位整数,注意网络字节序是大端序 + int byteLength = ((lengthBytes[0] & 0xFF) << 8) | (lengthBytes[1] & 0xFF); + // 打印结果 + System.out.println("数据长度: " + byteLength); + + // 获取数据帧类型 1字节 2字符 判断是目标轨迹数据还是交通流量数据 + byte[] objectTypeData = extractHexData(segment, 2, 1); + String objectTypeHexString = byteArrayToHexString(objectTypeData); + System.out.println("数据帧类型:" + objectTypeHexString); + + // 获取设备编号 20字节 40字符 判断是哪个雷达的发送的数据 + byte[] deviceIdData = extractHexData(segment, 4, 16); + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < deviceIdData.length; i++) { + byte b = deviceIdData[i]; + // 16进制数 "32" + String hexString = String.format("%02X", b); + // 将16进制字符串转换为十进制整数 + int decimalValue = Integer.parseInt(hexString, 16); + // 将十进制整数转换为对应的ASCII字符 + char asciiChar = (char) decimalValue; + // 如果不为0则添加到字符串中 + if (decimalValue != 0) { + builder.append(asciiChar); + } + } + System.out.println("设备编号:" + builder); + + + byte[] timestampData = extractHexData(segment, 24, 8); + String timestampHexString = byteArrayToHexString(timestampData); + System.out.println("时间戳:" + timestampHexString); + String localDateTime = getLocalDateTime(segment, timestampData); + System.out.println("时间戳:" + localDateTime); + // 获取数据 + // 用获取到的数据长度 减去数据长度(2字节)、数据帧类型(1字节)、校验和(1字节)、数据编号)、时间戳(8字节)、包头包尾(8字节) + int dataLength = byteLength - 2 - 1 - 1 - 20 - 8; + segment = segment.substring(64); + System.out.println("总数据:" + segment); + + // 如果是目标轨迹数据 + if ("01".equals(objectTypeHexString)) { + if (dataLength >= 36) { + byte[] dataBytes = hexStringToByteArray(segment); + // 36个字节为一组数据 进行分组解析 + for (int i = 0; i < dataBytes.length; i += 36) { + byte[] dataSegment = Arrays.copyOfRange(dataBytes, i, i + 36); + String dataSegmentHexString = byteArrayToHexStringAll(dataSegment); + System.out.println("数据:" + dataSegmentHexString); + // 获取目标所属车道 + byte[] targetLaneData = extractHexData(dataSegmentHexString, 2, 1); + String targetLaneHexString = byteArrayToHexStringAll(targetLaneData); + // 将16进制数转换为10进制数 + int targetLane = Integer.parseInt(targetLaneHexString, 16); + System.out.println("目标所属车道:" + targetLane); + // 获取目标类型 + byte[] carTypeData = extractHexData(dataSegmentHexString, 3, 1); + String carTypeHexString = byteArrayToHexStringAll(carTypeData); + System.out.println("目标类型:" + carTypeHexString); + // 获取目标速度 + byte[] targetSpeedData = extractHexData(dataSegmentHexString, 20, 2); + String targetSpeedHexString = byteArrayToHexStringAll(targetSpeedData); + double targetSpeed = Integer.parseInt(targetSpeedHexString, 16) * 0.01; + System.out.println("目标速度:" + targetSpeed); + // 获取目标经度 + byte[] targetLongitudeData = extractHexData(dataSegmentHexString, 28, 4); + String targetLongitudeHexString = byteArrayToHexStringAll(targetLongitudeData); + // 将十六进制字符串转换为long类型的数字 + long targetLongitudeLongValue = Long.parseLong(targetLongitudeHexString, 16); + // 将long类型的数字转换为double类型的数字 + double targetLongitude = (double) targetLongitudeLongValue / 10000000; + System.out.println("目标经度:" + targetLongitude); + // 获取目标纬度 + byte[] targetLatitudeData = extractHexData(dataSegmentHexString, 32, 4); + String targetLatitudeHexString = byteArrayToHexStringAll(targetLatitudeData); + + // 将十六进制字符串转换为long类型的数字 + long targetLatitudeLongValue = Long.parseLong(targetLatitudeHexString, 16); + // 将long类型的数字转换为double类型的数字 + double targetLatitude = (double) targetLatitudeLongValue / 10000000; + System.out.println("目标纬度:" + targetLatitude); + } + } + } + // 如果是交通流量数据 + else if ("03".equals(objectTypeHexString)) { + if (dataLength >= 22) { + byte[] dataBytes = hexStringToByteArray(segment); + // 22个字节为一组数据 进行分组解析 + for (int i = 0; i < dataBytes.length; i += 22) { + byte[] dataSegment = Arrays.copyOfRange(dataBytes, i, i + 22); + String dataSegmentHexString = byteArrayToHexStringAll(dataSegment); + System.out.println("数据:" + dataSegmentHexString); + // 获取统计周期 + byte[] statisticsCycleData = extractHexData(dataSegmentHexString, 0, 2); + String statisticsCycleHexString = byteArrayToHexStringAll(statisticsCycleData); + // 将16进制数转换为10进制数 + int statisticsCycle = Integer.parseInt(statisticsCycleHexString, 16); + System.out.println("统计周期:" + statisticsCycle); + // 获取实时车流量 + byte[] realTimeTrafficFlowData = extractHexData(dataSegmentHexString, 12, 2); + String realTimeTrafficFlowHexString = byteArrayToHexStringAll(realTimeTrafficFlowData); + // 将16进制数转换为10进制数 + int realTimeTrafficFlow = Integer.parseInt(realTimeTrafficFlowHexString, 16); + System.out.println("总流量:" + realTimeTrafficFlow); + // 获取平均车速 + byte[] averageSpeedData = extractHexData(dataSegmentHexString, 14, 2); + String averageSpeedHexString = byteArrayToHexStringAll(averageSpeedData); + double averageSpeed = Integer.parseInt(averageSpeedHexString, 16) * 0.1; + System.out.println("平均速度:" + averageSpeed); + // 获取最大排队长度 + byte[] maxQueueLengthData = extractHexData(dataSegmentHexString, 20, 2); + String maxQueueLengthHexString = byteArrayToHexStringAll(maxQueueLengthData); + // 将16进制数转换为10进制数 + int maxQueueLength = Integer.parseInt(maxQueueLengthHexString, 16); + System.out.println("最大排队长度:" + maxQueueLength); + } + } + } + } + } + + public List getRadarDataList(String data) { + + List vos = Lists.newArrayList(); + + String head = "55aa55bb"; + String tail = "55cc55dd"; + + // 解析上面的数据帧data 包头是head 包尾是tail 从包头到包尾分段取出数据 放入一个字符串列表中 等待解析 + List segments = Lists.newArrayList(); + int headIndex = data.indexOf(head); + while (headIndex != -1) { + int tailIndex = data.indexOf(tail, headIndex + head.length()); + if (tailIndex != -1) { + // 提取从包头到包尾的数据段 + String segment = data.substring(headIndex + head.length(), tailIndex); + segments.add(segment); + // 移动到下一个包头的位置 + headIndex = data.indexOf(head, tailIndex + tail.length()); + } else { + // 没有找到包尾,结束循环 + break; + } + } + + // 遍历这些数据帧 解析其中携带的数据 + for (String segment : segments) { + RadarDataVO vo = new RadarDataVO(); + //// 获取数据长度 2字节 4字符 判断数据包长度 + byte[] dataLengthData = extractHexData(segment, 0, 2); + String dataLengthHexString = byteArrayToHexStringAll(dataLengthData); + // 将16进制字符串转换为字节数组 + byte[] lengthBytes = new byte[2]; + // 高8位 + lengthBytes[0] = (byte) Integer.parseInt(dataLengthHexString.substring(0, 2), 16); + // 低8位 + lengthBytes[1] = (byte) Integer.parseInt(dataLengthHexString.substring(2, 4), 16); + + // 将字节数组转换为16位整数,注意网络字节序是大端序 + int byteLength = ((lengthBytes[0] & 0xFF) << 8) | (lengthBytes[1] & 0xFF); + + // 获取数据帧类型 1字节 2字符 判断是目标轨迹数据还是交通流量数据 + byte[] objectTypeData = extractHexData(segment, 2, 1); + String objectTypeHexString = byteArrayToHexString(objectTypeData); + + // 获取设备编号 20字节 40字符 判断是哪个雷达的发送的数据 + byte[] deviceIdData = extractHexData(segment, 4, 16); + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < deviceIdData.length; i++) { + byte b = deviceIdData[i]; + // 16进制数 "32" + String hexString = String.format("%02X", b); + // 将16进制字符串转换为十进制整数 + int decimalValue = Integer.parseInt(hexString, 16); + // 将十进制整数转换为对应的ASCII字符 + char asciiChar = (char) decimalValue; + // 如果不为0则添加到字符串中 + if (decimalValue != 0) { + builder.append(asciiChar); + } + } + vo.setDeviceId(builder.toString()); + + byte[] timestampData = extractHexData(segment, 24, 8); + String timestampHexString = byteArrayToHexString(timestampData); + System.out.println("时间戳:" + timestampHexString); + String localDateTime = getLocalDateTime(segment, timestampData); + vo.setTimeStamp(localDateTime); + + // 获取数据 + // 用获取到的数据长度 减去数据长度(2字节)、数据帧类型(1字节)、校验和(1字节)、数据编号)、时间戳(8字节)、包头包尾(8字节) + int dataLength = byteLength - 2 - 1 - 1 - 20 - 8; + segment = segment.substring(64); + + // 如果是目标轨迹数据 + if ("01".equals(objectTypeHexString)) { + vo.setDataType("1"); + if (dataLength >= 36) { + byte[] dataBytes = hexStringToByteArray(segment); + // 36个字节为一组数据 进行分组解析 + for (int i = 0; i < dataBytes.length; i += 36) { + byte[] dataSegment = Arrays.copyOfRange(dataBytes, i, i + 36); + String dataSegmentHexString = byteArrayToHexStringAll(dataSegment); + // 获取目标所属车道 + byte[] targetLaneData = extractHexData(dataSegmentHexString, 2, 1); + String targetLaneHexString = byteArrayToHexStringAll(targetLaneData); + // 将16进制数转换为10进制数 + int targetLane = Integer.parseInt(targetLaneHexString, 16); + vo.setTargetLane(String.valueOf(targetLane)); + // 获取目标类型 + byte[] carTypeData = extractHexData(dataSegmentHexString, 3, 1); + String carTypeHexString = byteArrayToHexStringAll(carTypeData); + vo.setCarType(carTypeHexString); + // 获取目标速度 + byte[] targetSpeedData = extractHexData(dataSegmentHexString, 20, 2); + String targetSpeedHexString = byteArrayToHexStringAll(targetSpeedData); + double targetSpeed = Integer.parseInt(targetSpeedHexString, 16) * 0.01; + vo.setTargetSpeed(String.valueOf(targetSpeed)); + // 获取目标经度 + byte[] targetLongitudeData = extractHexData(dataSegmentHexString, 28, 4); + String targetLongitudeHexString = byteArrayToHexStringAll(targetLongitudeData); + // 将十六进制字符串转换为long类型的数字 + long targetLongitudeLongValue = Long.parseLong(targetLongitudeHexString, 16); + // 将long类型的数字转换为double类型的数字 + double targetLongitude = (double) targetLongitudeLongValue / 10000000; + vo.setTargetLongitude(String.valueOf(targetLongitude)); + // 获取目标纬度 + byte[] targetLatitudeData = extractHexData(dataSegmentHexString, 32, 4); + String targetLatitudeHexString = byteArrayToHexStringAll(targetLatitudeData); + // 将十六进制字符串转换为long类型的数字 + long targetLatitudeLongValue = Long.parseLong(targetLatitudeHexString, 16); + // 将long类型的数字转换为double类型的数字 + double targetLatitude = (double) targetLatitudeLongValue / 10000000; + vo.setTargetLatitude(String.valueOf(targetLatitude)); + vos.add(vo); + } + } + } + // 如果是交通流量数据 + else if ("03".equals(objectTypeHexString)) { + vo.setDataType("3"); + if (dataLength >= 22) { + byte[] dataBytes = hexStringToByteArray(segment); + // 22个字节为一组数据 进行分组解析 + for (int i = 0; i < dataBytes.length; i += 22) { + byte[] dataSegment = Arrays.copyOfRange(dataBytes, i, i + 22); + String dataSegmentHexString = byteArrayToHexStringAll(dataSegment); + // 获取实时车流量 + byte[] realTimeTrafficFlowData = extractHexData(dataSegmentHexString, 12, 2); + String realTimeTrafficFlowHexString = byteArrayToHexStringAll(realTimeTrafficFlowData); + // 将16进制数转换为10进制数 + int realTimeTrafficFlow = Integer.parseInt(realTimeTrafficFlowHexString, 16); + vo.setRealTimeTrafficFlow(String.valueOf(realTimeTrafficFlow)); + // 获取平均车速 + byte[] averageSpeedData = extractHexData(dataSegmentHexString, 14, 2); + String averageSpeedHexString = byteArrayToHexStringAll(averageSpeedData); + double averageSpeed = Integer.parseInt(averageSpeedHexString, 16) * 0.1; + vo.setAverageCarSpeed(String.valueOf(averageSpeed)); + // 获取最大排队长度 + byte[] maxQueueLengthData = extractHexData(dataSegmentHexString, 20, 2); + String maxQueueLengthHexString = byteArrayToHexStringAll(maxQueueLengthData); + // 将16进制数转换为10进制数 + int maxQueueLength = Integer.parseInt(maxQueueLengthHexString, 16); + vo.setMaxQueueLength(String.valueOf(maxQueueLength)); + vos.add(vo); + } + } + } + } + return vos; + } + + private String getLocalDateTime(String segment, byte[] timestampData) { + // 第一个字节 -> year + byte year = timestampData[0]; + // 将16进制字节转换为整数 + int yearInt = Integer.parseInt(String.format("%02X", year), 16); + // 创建位掩码来提取第0到7位 + int yearMask = 0xFF; + // 使用位掩码提取第0到第7位 + int extractedYearBits = yearInt & yearMask; + // 数据 0~255 对应 2000~2255 year 获取实际的年份 + int yearValue = extractedYearBits + 2000; + System.out.println("年份:" + yearValue); + + // 第二个字节 -> month + byte month = timestampData[1]; + // 将16进制字节转换为整数 + int monthInt = Integer.parseInt(String.format("%02X", month), 16); + // 创建位掩码来提取第0到3位 + // 1~12 对应 1~12 month + int monthMask = 0x0F; + // 使用位掩码提取第0到第3位 + int monthValue = monthInt & monthMask; + System.out.println("月份:" + monthValue); + + // 第三个字节 -> day + byte day = timestampData[2]; + // 将16进制字节转换为整数 + int dayInt = Integer.parseInt(String.format("%02X", day), 16); + // 创建位掩码来提取第0到4位 + // 数据 1~31 对应 1~31 day + int dayMask = 0x1F; + // 使用位掩码提取第0到第4位 + // 数据 1~31 对应 1~31 day + int dayValue = dayInt & dayMask; + System.out.println("天:" + dayValue); + + // 第四个字节 -> hour + byte hour = timestampData[3]; + // 将16进制字节转换为整数 + int hourInt = Integer.parseInt(String.format("%02X", hour), 16); + // 创建位掩码来提取第0到4位 + int hourMask = 0x1F; + // 使用位掩码提取第0到第4位 + // 数据 0~31 对应 0~23 hour + int hourValue = hourInt & hourMask; + System.out.println("小时:" + hourValue); + + // 第五个字节 -> minute + byte minute = timestampData[4]; + // 将16进制字节转换为整数 + int minuteInt = Integer.parseInt(String.format("%02X", minute), 16); + // 创建位掩码来提取第0到5位 + int minuteMask = 0x3F; + // 使用位掩码提取第0到第5位 + // 数据 0~63 对应 0~59 minute + int minuteValue = minuteInt & minuteMask; + System.out.println("分钟:" + minuteValue); + + // 第六个字节 -> second + byte second = timestampData[5]; + // 将16进制字节转换为整数 + int secondInt = Integer.parseInt(String.format("%02X", second), 16); + // 创建位掩码来提取第0到5位 + int secondMask = 0x3F; + // 使用位掩码提取第0到第5位 + // 数据 0~63 对应 0~59 second + int secondValue = secondInt & secondMask; + System.out.println("秒:" + secondValue); + // 第7、8个字节-> millisecond + // 把第7和第8个字节拼接成16进制字符串 再转换为整数 + byte[] millisecondData = extractHexData(segment, 30, 2); + String millisecondHexString = byteArrayToHexString(millisecondData); + int millisecondValue = Integer.parseInt(millisecondHexString, 16); + // 创建位掩码来提取第0到9位 + int millisecondMask = 0x3FF; + // 使用位掩码提取第0到第9位 + millisecondValue = millisecondValue & millisecondMask; + // 数据 0~999 对应 0~999 毫秒 + System.out.println("毫秒:" + millisecondValue); + // 拼接成LocalDateTime 类型的数据 + String localDateTime = yearValue + "-" + monthValue + "-" + dayValue + " " + hourValue + ":" + minuteValue + ":" + secondValue; + return localDateTime; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/manage/RadarManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/manage/RadarManage.java new file mode 100644 index 0000000..9139d18 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/manage/RadarManage.java @@ -0,0 +1,264 @@ +package com.ningdatech.carapi.radar.manage; + +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.nio.charset.StandardCharsets; +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import cn.hutool.socket.SocketUtil; +import com.ningdatech.carapi.radar.helper.RadarDataHelper; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.carapi.radar.constant.RadarCarTypeEnum; +import com.ningdatech.carapi.radar.constant.RadarDataTypeEnum; +import com.ningdatech.carapi.radar.model.entity.RadarData; +import com.ningdatech.carapi.radar.model.vo.RadarObjectDataVO; +import com.ningdatech.carapi.radar.model.vo.RadarTrafficFlowDataVO; +import com.ningdatech.carapi.radar.service.IRadarDataService; +import com.ningdatech.carapi.road.model.req.RoadMonitorReq; + +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * 车辆位置信息 + * + * @author CMM + * @since 2023/11/17 09:35 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class RadarManage { + + private final IRadarDataService radarDataService; + private final RadarDataHelper radarDataHelper; + + public String getRadarDataAsClient() { + // 盒子ip地址:192.168.6.42 --> 192.168.6.40(黄山隧道义乌来向雷达)、192.168.6.43(黄山隧道义乌去向雷达) + ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); + // 默认结果 + String result = "接收失败!"; + String ip = "192.168.6.42"; + // String ip = "192.168.2.249"; + try (Socket socket = SocketUtil.connect(ip, 13000)) { + log.info("Client connected to server on port: {}", 13000); + InputStream inputStream = socket.getInputStream(); + if (Objects.nonNull(inputStream)) { + // 读取输入流中的1024个字节 + byte[] buffer = new byte[1024]; + if (inputStream.available() > 0) { + int len = inputStream.read(buffer); + // 处理读取到的数据 + byte[] data = Arrays.copyOf(buffer, len); + log.info("Received: {}", Arrays.toString(data)); + log.info("Connect Successfully!"); + }else { + return "流数据为空!"; + } + }else{ + return result; + } + // 从接入数据 开始 持续接收1分钟的数据 接收完成后 关闭连接 + // 设置1分钟后关闭连接 + executor.schedule(() -> { + try { + socket.close(); + } catch (IOException e) { + log.error("Error closing client socket: ", e); + } + }, 1, TimeUnit.MINUTES); + + // 开启保活选项 + socket.setKeepAlive(true); + byte[] buffer = new byte[1024]; + int bytesRead; + // 循环读取数据,直到Socket被关闭 + while (!socket.isClosed() && (bytesRead = inputStream.read(buffer)) != -1) { + // 处理读取到的数据 + String dataString = new String(buffer, 0, bytesRead, StandardCharsets.UTF_8); + log.info("Received: {}", dataString); + radarDataHelper.processRadarData(dataString); + } + // 如果循环正常结束,则修改结果 + result = "接收成功!"; + } catch (IOException e) { + return e.getMessage(); + }finally { + // 关闭ScheduledExecutorService + executor.shutdown(); + try { + if (!executor.awaitTermination(5, TimeUnit.SECONDS)) { + executor.shutdownNow(); + } + } catch (InterruptedException e) { + executor.shutdownNow(); + } + } + // 返回最终结果 + return result; + } + + public String getRadarDataAsServer() { + // 盒子ip地址:192.168.6.42 --> 192.168.6.40(黄山隧道义乌来向雷达)、192.168.6.43(黄山隧道义乌去向雷达) + ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); + // 默认结果 + String result = "接收失败!"; + String ip = "192.168.6.42"; + //String ip = "192.168.2.249"; + try (ServerSocket serverSocket = new ServerSocket()) { + // 设置超时时间 + serverSocket.setSoTimeout(60000); + InetSocketAddress address = new InetSocketAddress(ip, 13000); + //InetSocketAddress address = new InetSocketAddress("192.168.2.254", 13000); + serverSocket.bind(address); + + // 等待客户端连接 + System.out.println("等待客户端连接..."); + Socket socket = serverSocket.accept(); + System.out.println("客户端已连接!"); + + // 读取客户端推送的数据 + InputStream inputStream = socket.getInputStream(); + byte[] buffer = new byte[1024]; + int len; + while ((len = inputStream.read(buffer)) != -1) { + // 处理接收到的数据 + String data = new String(buffer, 0, len); + System.out.println("接收到数据:" + data); + } + result = "接收成功!"; + } catch (Exception e) { + log.error("Error closing server socket: ", e); + } + // 返回最终结果 + return result; + } + + + public RadarTrafficFlowDataVO radarTrafficFlowData(RoadMonitorReq req) { + RadarTrafficFlowDataVO vo = new RadarTrafficFlowDataVO(); + String region = req.getRegion(); + // 雷达区域-ip对应关系 + Map radarRegionIpMap = getRadarRegionIpMap(); + // 判断查询的是哪个设备的数据 + String radarIp = radarRegionIpMap.getOrDefault(region, null); + if (StringUtils.isBlank(radarIp)){ + throw new BizException("查询区域数据不存在!"); + } + // 从雷达数据信息表中获取查询区域最新的一条流量数据 + RadarData radarData = radarDataService.getOne(Wrappers.lambdaQuery(RadarData.class) + .eq(RadarData::getRadarIp, radarIp) + .eq(RadarData::getDataType, RadarDataTypeEnum.TRAFFIC_DATA.getCode()) + .orderByDesc(RadarData::getUpdateOn) + .last("limit 1")); + if (Objects.nonNull(radarData)) { + BeanUtils.copyProperties(radarData, vo); + } + return vo; + } + + private static Map getRadarRegionIpMap() { + Map radarRegionIpMap = new HashMap<>(); + // 黄山隧道东阳去向 + radarRegionIpMap.put("1", "192.168.6.45"); + // 黄山隧道东阳来向 + radarRegionIpMap.put("2", "192.168.6.47"); + // 黄山隧道义乌去向 + radarRegionIpMap.put("3", "192.168.6.43"); + // 黄山隧道义乌来向 + radarRegionIpMap.put("4", "192.168.6.40"); + // 何里隧道兰溪方向 + radarRegionIpMap.put("5", "192.168.10.63"); + // 何里隧道义乌方向 + radarRegionIpMap.put("6", "192.168.10.60"); + return radarRegionIpMap; + } + + public List radarObjectData(RoadMonitorReq req) { + String region = req.getRegion(); + // 雷达区域-ip对应关系 + Map radarRegionIpMap = getRadarRegionIpMap(); + // 判断查询的是哪个设备的数据 + String radarIp = radarRegionIpMap.getOrDefault(region, null); + if (StringUtils.isBlank(radarIp)){ + throw new BizException("查询区域数据不存在!"); + } + // 从雷达数据信息表中获取查询区域最近1分钟的目标数据 + LocalDateTime startTime = LocalDateTime.now().minusMinutes(1); + List radarDataList = radarDataService.list(Wrappers.lambdaQuery(RadarData.class) + .eq(RadarData::getRadarIp, radarIp) + .eq(RadarData::getDataType, RadarDataTypeEnum.OBJECT_DATA.getCode()) + .ge(RadarData::getUpdateOn, startTime) + .orderByDesc(RadarData::getUpdateOn)); + // 如果查询不到数据,则返回雷达数据表中最新的100条目标轨迹数据 + if (CollUtil.isEmpty(radarDataList)){ + radarDataList = radarDataService.list(Wrappers.lambdaQuery(RadarData.class) + .eq(RadarData::getRadarIp, radarIp) + .eq(RadarData::getDataType, RadarDataTypeEnum.OBJECT_DATA.getCode()) + .orderByDesc(RadarData::getUpdateOn) + .last("limit 100")); + } + return radarDataList.stream().map(d -> { + RadarObjectDataVO vo = new RadarObjectDataVO(); + // TODO 待接入雷达数据后 转换为中文 当前以原始编号返回 + vo.setTargetLane(d.getTargetLane()); + vo.setCarType(RadarCarTypeEnum.getDescByCode(d.getCarType())); + vo.setTargetSpeed(d.getTargetSpeed()); + vo.setTargetLatitude(d.getTargetLatitude()); + vo.setTargetLongitude(d.getTargetLongitude()); + vo.setUpdateOn(d.getUpdateOn()); + return vo; + }).collect(Collectors.toList()); + } + + public RadarTrafficFlowDataVO workbenchRadarTrafficFlowData(RoadMonitorReq req) { + RadarTrafficFlowDataVO vo = new RadarTrafficFlowDataVO(); + // 雷达区域-ip对应关系 + List radarDataList = getRadarDataList(); + if (CollUtil.isEmpty(radarDataList)){ + vo.setRealTimeTrafficFlow("0"); + return vo; + } + // 计算实时流量的和 + List list = radarDataList.stream().map(RadarData::getRealTimeTrafficFlow).collect(Collectors.toList()); + List decimals = list.stream().map(d -> BigDecimal.valueOf(Double.parseDouble(d))).collect(Collectors.toList()); + BigDecimal total = decimals.stream().reduce(BigDecimal.ZERO, BigDecimal::add).stripTrailingZeros(); + vo.setRealTimeTrafficFlow(String.valueOf(total)); + return vo; + } + + private List getRadarDataList() { + Map radarRegionIpMap = getRadarRegionIpMap(); + List radarIpList = new ArrayList<>(radarRegionIpMap.values()); + + // 从雷达数据信息表中获取每个区域最新的一条流量数据 + List radarDataList = Lists.newArrayList(); + radarIpList.forEach(radarIp -> { + RadarData radarData = radarDataService.getOne(Wrappers.lambdaQuery(RadarData.class) + .eq(RadarData::getRadarIp, radarIp) + .eq(RadarData::getDataType, RadarDataTypeEnum.TRAFFIC_DATA.getCode()) + .orderByDesc(RadarData::getUpdateOn) + .last("limit 1")); + if (Objects.nonNull(radarData)) { + radarDataList.add(radarData); + } + }); + return radarDataList; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/mapper/RadarDataMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/mapper/RadarDataMapper.java new file mode 100644 index 0000000..73762f2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/mapper/RadarDataMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.radar.mapper; + +import com.ningdatech.carapi.radar.model.entity.RadarData; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2024-09-28 + */ +public interface RadarDataMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/mapper/RadarDataMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/mapper/RadarDataMapper.xml new file mode 100644 index 0000000..62de9ef --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/mapper/RadarDataMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/mapper/RadarOriginalDataMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/mapper/RadarOriginalDataMapper.java new file mode 100644 index 0000000..7a7bbca --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/mapper/RadarOriginalDataMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.radar.mapper; + +import com.ningdatech.carapi.radar.model.entity.RadarOriginalData; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2024-11-13 + */ +public interface RadarOriginalDataMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/mapper/RadarOriginalDataMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/mapper/RadarOriginalDataMapper.xml new file mode 100644 index 0000000..71a0824 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/mapper/RadarOriginalDataMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/dto/RadarInfoDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/dto/RadarInfoDTO.java new file mode 100644 index 0000000..f6d034d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/dto/RadarInfoDTO.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.radar.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author CMM + * @since 2024/09/28 11:24 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class RadarInfoDTO { + + @ApiModelProperty("雷达ip") + private String radarIp; + + @ApiModelProperty("雷达监听端口号") + private Integer radarPort; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/entity/RadarData.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/entity/RadarData.java new file mode 100644 index 0000000..2c707c9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/entity/RadarData.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.radar.model.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; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2024-09-28 + */ +@TableName("nd_radar_data") +@ApiModel(value = "RadarData对象", description = "") +@Data +public class RadarData implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("推送数据的盒子ip") + private String armIp; + + @ApiModelProperty("推送数据的雷达ip") + private String radarIp; + + @ApiModelProperty("数据类型 1 目标数据、2 流量数据") + private Integer dataType; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + + //---------- 目标轨迹数据 ----------// + @ApiModelProperty("目标所属车道") + private String targetLane; + + @ApiModelProperty("车辆类型") + private Integer carType; + + @ApiModelProperty("目标速度") + private String targetSpeed; + + @ApiModelProperty("目标经度") + private String targetLongitude; + + @ApiModelProperty("目标纬度") + private String targetLatitude; + + //---------- 交通流量数据 ----------// + @ApiModelProperty("实时车流量") + private String realTimeTrafficFlow; + + @ApiModelProperty("平均车速") + private String averageCarSpeed; + + @ApiModelProperty("最大排队长度") + private String maxQueueLength; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/entity/RadarOriginalData.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/entity/RadarOriginalData.java new file mode 100644 index 0000000..540baa9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/entity/RadarOriginalData.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.radar.model.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; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2024-11-13 + */ +@TableName("nd_radar_original_data") +@ApiModel(value = "RadarOriginalData对象", description = "") +@Data +public class RadarOriginalData implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("盒子推送的雷达数据") + private String data; + + @ApiModelProperty("盒子对应的ip") + private String armIp; + + @ApiModelProperty("数据类型") + private String dataType; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/vo/RadarDataVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/vo/RadarDataVO.java new file mode 100644 index 0000000..d3eb5d1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/vo/RadarDataVO.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.radar.model.vo; + +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author CMM + * @since 2024/10/23 10:49 + */ +@Data +@ApiModel(description = "道路监控驾驶舱雷达流量数据-VO") +@NoArgsConstructor +@AllArgsConstructor +public class RadarDataVO { + + @ApiModelProperty("设备编号") + private String deviceId; + + @ApiModelProperty("上报时间") + private String timeStamp; + + @ApiModelProperty("数据类型") + private String dataType; + + @ApiModelProperty("目标所属车道") + private String targetLane; + + @ApiModelProperty("车辆类型") + private String carType; + + @ApiModelProperty("目标速度") + private String targetSpeed; + + @ApiModelProperty("目标经度") + private String targetLongitude; + + @ApiModelProperty("目标纬度") + private String targetLatitude; + + @ApiModelProperty("实时车流量") + private String realTimeTrafficFlow; + + @ApiModelProperty("平均车速") + private String averageCarSpeed; + + @ApiModelProperty("最大排队长度") + private String maxQueueLength; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/vo/RadarObjectDataVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/vo/RadarObjectDataVO.java new file mode 100644 index 0000000..141c1a1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/vo/RadarObjectDataVO.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.radar.model.vo; + +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author CMM + * @since 2024/10/23 10:49 + */ +@Data +@ApiModel(description = "道路监控驾驶舱雷达流量数据-VO") +@NoArgsConstructor +@AllArgsConstructor +public class RadarObjectDataVO { + + @ApiModelProperty("目标所属车道") + private String targetLane; + + @ApiModelProperty("车辆类型") + private String carType; + + @ApiModelProperty("目标速度") + private String targetSpeed; + + @ApiModelProperty("目标经度") + private String targetLongitude; + + @ApiModelProperty("目标纬度") + private String targetLatitude; + + @ApiModelProperty("上报时间") + private LocalDateTime updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/vo/RadarTrafficFlowDataVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/vo/RadarTrafficFlowDataVO.java new file mode 100644 index 0000000..c46abac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/model/vo/RadarTrafficFlowDataVO.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.radar.model.vo; + +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author CMM + * @since 2024/10/23 10:49 + */ +@Data +@ApiModel(description = "道路监控驾驶舱雷达流量数据-VO") +@NoArgsConstructor +@AllArgsConstructor +public class RadarTrafficFlowDataVO { + + @ApiModelProperty("实时车流量") + private String realTimeTrafficFlow; + + @ApiModelProperty("平均车速") + private String averageCarSpeed; + + @ApiModelProperty("最大排队长度") + private String maxQueueLength; + + @ApiModelProperty("上报时间") + private LocalDateTime updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/properties/RadarDataTaskProperties.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/properties/RadarDataTaskProperties.java new file mode 100644 index 0000000..d8c46dd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/properties/RadarDataTaskProperties.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.radar.properties; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * @author CMM + * @author CMM + * @date 2024/9/27 14:40 + * / + * /** + * @since 2024/09/27 14:40 + */ +@Data +@Component +@ConfigurationProperties(prefix = "radar-data-task") +public class RadarDataTaskProperties { + /** + * 是否开启雷达数据接收 + */ + private Boolean enable; + + // 雷达盒子设备的IP地址 + // 黄山隧道-义乌方向 + private String hsYwRadarArmIp; + // 黄山隧道-东阳方向 + private String hsDyRadarArmIp; + // 何里隧道 + private String hlRadarArmIp; + + // 雷达盒子监听的端口号 + // 黄山隧道-义乌方向 + private Integer hsYwRadarArmPort; + // 黄山隧道-东阳方向 + private Integer hsDyRadarArmPort; + // 何里隧道 + private Integer hlRadarArmPort; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/server/MultiRadarServer.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/server/MultiRadarServer.java new file mode 100644 index 0000000..990e365 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/server/MultiRadarServer.java @@ -0,0 +1,60 @@ +package com.ningdatech.carapi.radar.server; + +import java.io.IOException; +import java.net.Socket; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import com.ningdatech.carapi.radar.client.RadarHandler; +import com.ningdatech.carapi.radar.helper.RadarDataHelper; +import com.ningdatech.carapi.radar.model.dto.RadarInfoDTO; +import com.ningdatech.carapi.radar.service.IRadarDataService; + +import cn.hutool.socket.SocketUtil; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @author CMM + * @date 2024/9/28 10:27 + * / + * /** + * @since 2024/09/28 10:27 + */ +@Slf4j +public class MultiRadarServer { + + private final IRadarDataService radarDataService; + private final ExecutorService executorService; + private final RadarDataHelper radarDataHelper; + + public MultiRadarServer(IRadarDataService radarDataService, List radarInfoList, RadarDataHelper radarDataHelper) { + this.radarDataService = radarDataService; + this.executorService = Executors.newFixedThreadPool(radarInfoList.size()); + this.radarDataHelper = radarDataHelper; + } + + public void startServers(List radarInfoList) { + log.info("Radar server started. Waiting for connections..."); + for (RadarInfoDTO radarInfo : radarInfoList) { + if (Objects.nonNull(radarInfo.getRadarIp()) && Objects.nonNull(radarInfo.getRadarPort())) { + // 每个设备创建一个线程 建立一个Socket + executorService.execute(() -> { + try (Socket socket = SocketUtil.connect(radarInfo.getRadarIp(), radarInfo.getRadarPort(),60000)){ + log.info("ServerSocket started on port: {}", radarInfo.getRadarPort()); + while (!Thread.currentThread().isInterrupted()) { + log.info("Connected to a radar on port: {}", radarInfo.getRadarPort()); + RadarHandler task = new RadarHandler(socket, radarDataService, radarInfo.getRadarIp(),radarDataHelper); + Thread thread = new Thread(task); + thread.start(); + } + } catch (IOException e) { + log.error("Error occurred while client connection: ", e); + } + }); + } + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/service/IRadarDataService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/service/IRadarDataService.java new file mode 100644 index 0000000..b167f40 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/service/IRadarDataService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.radar.service; + +import com.ningdatech.carapi.radar.model.entity.RadarData; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2024-09-28 + */ +public interface IRadarDataService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/service/IRadarOriginalDataService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/service/IRadarOriginalDataService.java new file mode 100644 index 0000000..aaf1a19 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/service/IRadarOriginalDataService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.radar.service; + +import com.ningdatech.carapi.radar.model.entity.RadarOriginalData; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2024-11-13 + */ +public interface IRadarOriginalDataService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/service/impl/RadarDataServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/service/impl/RadarDataServiceImpl.java new file mode 100644 index 0000000..ee79667 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/service/impl/RadarDataServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.radar.service.impl; + +import com.ningdatech.carapi.radar.model.entity.RadarData; +import com.ningdatech.carapi.radar.mapper.RadarDataMapper; +import com.ningdatech.carapi.radar.service.IRadarDataService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2024-09-28 + */ +@Service +public class RadarDataServiceImpl extends ServiceImpl implements IRadarDataService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/service/impl/RadarOriginalDataServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/service/impl/RadarOriginalDataServiceImpl.java new file mode 100644 index 0000000..d6d6cdf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/service/impl/RadarOriginalDataServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.radar.service.impl; + +import com.ningdatech.carapi.radar.model.entity.RadarOriginalData; +import com.ningdatech.carapi.radar.mapper.RadarOriginalDataMapper; +import com.ningdatech.carapi.radar.service.IRadarOriginalDataService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2024-11-13 + */ +@Service +public class RadarOriginalDataServiceImpl extends ServiceImpl implements IRadarOriginalDataService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/task/RadarDataTask.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/task/RadarDataTask.java new file mode 100644 index 0000000..bd361ee --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/task/RadarDataTask.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.radar.task; + +import java.util.List; + +import org.apache.commons.compress.utils.Lists; +import org.springframework.stereotype.Component; + +import com.ningdatech.carapi.radar.helper.RadarDataHelper; +import com.ningdatech.carapi.radar.model.dto.RadarInfoDTO; +import com.ningdatech.carapi.radar.properties.RadarDataTaskProperties; +import com.ningdatech.carapi.radar.server.MultiRadarServer; +import com.ningdatech.carapi.radar.service.IRadarDataService; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * 雷达数据接收定时任务 + * @since 2024/09/27 14:36 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class RadarDataTask { + + private final RadarDataTaskProperties properties; + private final IRadarDataService radarDataService; + private final RadarDataHelper radarDataHelper; + + //@PostConstruct + //public void initTask() { + // if (!properties.getEnable()) { + // log.warn("雷达数据同步已关闭……"); + // return; + // } + // //initRadarDataTaskByStart(); + //} + + /** + * 项目重启之后重新初始化雷达接收定时任务 + */ + private void initRadarDataTaskByStart() { + log.info("雷达数据接收任务已启动……"); + List radarInfoList = Lists.newArrayList(); + // 每个盒子开启一个线程 + radarInfoList.add(new RadarInfoDTO(properties.getHsYwRadarArmIp(),properties.getHsYwRadarArmPort())); + radarInfoList.add(new RadarInfoDTO(properties.getHsDyRadarArmIp(),properties.getHsDyRadarArmPort())); + radarInfoList.add(new RadarInfoDTO(properties.getHlRadarArmIp(),properties.getHlRadarArmPort())); + MultiRadarServer server = new MultiRadarServer(radarDataService,radarInfoList,radarDataHelper); + server.startServers(radarInfoList); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/task/RadarRealTimeDataUpdateTask.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/task/RadarRealTimeDataUpdateTask.java new file mode 100644 index 0000000..45efbfd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/task/RadarRealTimeDataUpdateTask.java @@ -0,0 +1,240 @@ +package com.ningdatech.carapi.radar.task; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.Statement; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import cn.hutool.core.collection.CollUtil; +import com.google.common.collect.Lists; +import com.ningdatech.carapi.radar.helper.RadarDataHelper; +import com.ningdatech.carapi.radar.model.entity.RadarData; +import com.ningdatech.carapi.radar.model.entity.RadarOriginalData; +import com.ningdatech.carapi.radar.model.vo.RadarDataVO; +import com.ningdatech.carapi.radar.service.IRadarDataService; +import com.ningdatech.carapi.radar.service.IRadarOriginalDataService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.carapi.gps.manage.GpsDataPullManage; + +import cn.hutool.core.date.StopWatch; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * 雷达实时数据更新定时任务 + * @since 2024/10/12 10:39 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class RadarRealTimeDataUpdateTask { + + @Value("${task.switch.is-open}") + private boolean flag; + + @Value("${task.gps-data-pull.domain}") + private String domain; + + @Value("${task.gps-data-pull.real-time-data-url}") + private String realTimeDataUrl; + + @Value("${task.gps-data-pull.key}") + private String key; + + private final GpsDataPullManage gpsDataPullManage; + private final IRadarOriginalDataService radarOriginalDataService; + private final RadarDataHelper radarDataHelper; + private final IRadarDataService radarDataService; + + @Value("${spring.datasource.url}") + private String dataBaseUrl; + @Value("${spring.datasource.username}") + private String username; + @Value("${spring.datasource.password}") + private String password; + + // 定时更新雷达实时数据 每1分钟一次 + @Scheduled(cron = "0 */1 * * * ?") + public void doTask() { + if (!flag){ + log.info("雷达实时数据更新定时任务未开启!"); + return; + } + log.info("=========== 雷达实时数据更新 ======== 任务开始"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + // 从表中分别获取三个盒子的最新的目标轨迹数据和交通流量数据 + List dataList = radarOriginalDataService.list(); + log.info("=========== 雷达实时数据更新 ======== 获取数据条数:{}",dataList.size()); + // 按照盒子ip分组 + Map> dataMap = dataList.stream().collect(Collectors.groupingBy(RadarOriginalData::getArmIp)); + List finalDataList = Lists.newArrayList(); + for (Map.Entry> entry : dataMap.entrySet()) { + RadarOriginalData data = new RadarOriginalData(); + // 针对每个盒子分别解析数据 + String armIp = entry.getKey(); + List datas = entry.getValue(); + log.info("=========== 雷达实时数据更新 ======== 盒子ip:{},数据条数:{}",armIp, datas.size()); + // 盒子有对应的原始数据 + if (CollUtil.isNotEmpty(datas)) { + // 根据数据类型进行分组 + Map> dataTypeMap = datas.stream().filter(d -> Objects.nonNull(d.getDataType())).collect(Collectors.groupingBy(RadarOriginalData::getDataType)); + // 获取每个数据类型(目标轨迹数据或者交通流量数据)的数据中最新的一条数据 + for (Map.Entry> dataTypeEntry : dataTypeMap.entrySet()) { + String dataType = dataTypeEntry.getKey(); + List dataTypeDatas = dataTypeEntry.getValue(); + if (Objects.nonNull(dataTypeDatas) && CollUtil.isNotEmpty(dataTypeDatas)) { + log.info("=========== 雷达实时数据更新 ======== 数据类型:{},数据量:{}",dataType,dataTypeDatas.size()); + // 按照创建时间排序 取最新的一条数据 + RadarOriginalData radarOriginalData1 = dataTypeDatas.get(0); + log.info("=========== 雷达实时数据更新 ======== 数据类型:{},最新数据:{}",dataType,radarOriginalData1); + // 按照创建时间排序 取最新的一条数据 + RadarOriginalData radarOriginalData = dataTypeDatas.stream().filter(d -> Objects.nonNull(d) && Objects.nonNull(d.getCreateOn())).max(Comparator.comparing(RadarOriginalData::getCreateOn)).orElse(null); + if (Objects.nonNull(radarOriginalData)) { + data.setId(radarOriginalData.getId()); + data.setData(radarOriginalData.getData()); + data.setArmIp(armIp); + data.setDataType(dataType); + finalDataList.add(data); + } + } + } + } + } + List finalIdList = finalDataList.stream().map(RadarOriginalData::getId).collect(Collectors.toList()); + // 过滤出dataList中其他数据 从表中删除 + if (CollUtil.isNotEmpty(finalIdList)) { + List removeIdList = dataList.stream().map(RadarOriginalData::getId).filter(id -> !finalIdList.contains(id)).collect(Collectors.toList()); + radarOriginalDataService.removeBatchByIds(removeIdList); + log.info("=========== 雷达实时数据更新 ======== 删除数据条数:{}", removeIdList.size()); + } + // 处理数据 + List objects = Lists.newArrayList(); + for (RadarOriginalData radarOriginalData : finalDataList) { + String armIp = radarOriginalData.getArmIp(); + String dataType = radarOriginalData.getDataType(); + String data = radarOriginalData.getData(); + List radarDataList = radarDataHelper.getRadarDataList(data); + if (CollUtil.isNotEmpty(radarDataList)) { + // 获取radarDataList中数据类型为dataType的数据 + List dataTypeDataList = radarDataList.stream().filter(radarDataVO -> radarDataVO.getDataType().equals(dataType)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(dataTypeDataList)) { + for (RadarDataVO radarDataVO : dataTypeDataList) { + RadarData radarData = new RadarData(); + radarData.setArmIp(armIp); + Map deviceIdRadarIpMap = new HashMap<>(); + deviceIdRadarIpMap.put("21626092", "192.168.6.43"); + deviceIdRadarIpMap.put("21626098", "192.168.6.40"); + deviceIdRadarIpMap.put("21626114", "192.168.6.45"); + deviceIdRadarIpMap.put("21626163", "192.168.6.47"); + deviceIdRadarIpMap.put("21626197", "192.168.10.63"); + deviceIdRadarIpMap.put("21626107", "192.168.10.60"); + String radarIp = deviceIdRadarIpMap.getOrDefault(radarDataVO.getDeviceId(), null); + radarData.setRadarIp(radarIp); + String voDataType = radarDataVO.getDataType(); + if ("1".equals(voDataType)) { + radarData.setDataType(1); + } else if ("3".equals(voDataType)) { + radarData.setDataType(2); + } + radarData.setCreateOn(LocalDateTime.now()); + radarData.setUpdateOn(LocalDateTime.now()); + + radarData.setTargetLane(radarDataVO.getTargetLane()); + + Map carTypeMap = new HashMap<>(); + carTypeMap.put("00", 4); + carTypeMap.put("01", 1); + carTypeMap.put("02", 2); + carTypeMap.put("03", 3); + + Integer type = carTypeMap.getOrDefault(radarDataVO.getCarType(), 4); + radarData.setCarType(type); + radarData.setTargetSpeed(radarDataVO.getTargetSpeed()); + radarData.setTargetLongitude(radarDataVO.getTargetLongitude()); + radarData.setTargetLatitude(radarDataVO.getTargetLatitude()); + + radarData.setRealTimeTrafficFlow(radarDataVO.getRealTimeTrafficFlow()); + radarData.setAverageCarSpeed(radarDataVO.getAverageCarSpeed()); + radarData.setMaxQueueLength(radarDataVO.getMaxQueueLength()); + radarData.setCreateOn(LocalDateTime.now()); + radarData.setUpdateOn(LocalDateTime.now()); + objects.add(radarData); + } + } + } + } + // 插入数据 + if (CollUtil.isNotEmpty(objects)) { + radarDataService.saveBatch(objects); + log.info("=========== 雷达实时数据更新 ======== 插入数据条数:{}",objects.size()); + } + stopWatch.stop(); + log.info("=========== 雷达实时数据更新 ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); + } + + private void truncateTable() { + // SQL 语句清空表 + String truncateTableSQL = "TRUNCATE TABLE nd_data_access_gps_real_time_data"; + + Connection conn = null; + Statement stmt = null; + + try { + // 加载数据库驱动 + Class.forName("com.mysql.cj.jdbc.Driver"); + // 建立连接 + conn = DriverManager.getConnection(dataBaseUrl, username, password); + // 创建 Statement 对象 + stmt = conn.createStatement(); + // 执行 SQL 语句 + stmt.executeUpdate(truncateTableSQL); + log.info("表已被清空,自增主键已重置。"); + } catch (Exception e) { + log.error("Error truncating table: {}", e.getMessage()); + } finally { + // 关闭资源 + try { + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (Exception e) { + log.error("Error closing resources: {}", e.getMessage()); + } + } + } + + private Map assemblyParams(String key, String sLon, String eLon, String sLat, String eLat) { + long timeNow = System.currentTimeMillis() / 1000; + String token = gpsDataPullManage.generateMD5Token(timeNow, key); + + Map params = new HashMap<>(); + params.put("timeNow", String.valueOf(timeNow)); + params.put("token", token); + if (StringUtils.isNotBlank(sLon)) { + params.put("Slon", sLon); + } + if (StringUtils.isNotBlank(eLon)) { + params.put("Elon", eLon); + } + if (StringUtils.isNotBlank(sLat)) { + params.put("Slat", sLat); + } + if (StringUtils.isNotBlank(eLat)) { + params.put("Elat", eLat); + } + return params; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constant/DataUploadAuditStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constant/DataUploadAuditStatusEnum.java new file mode 100644 index 0000000..ffd0a63 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constant/DataUploadAuditStatusEnum.java @@ -0,0 +1,72 @@ +package com.ningdatech.carapi.report.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 直报系统数据审核状态 + * @return + * @author CMM + * @since 2023/02/07 13:55 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "DataUploadAuditStatusEnum", description = "直报系统数据审核状态-枚举") +public enum DataUploadAuditStatusEnum { + + /** + * 审核中 + */ + UNDER_AUDIT(1,"审核中"), + + /** + * 审核通过 + */ + AUDIT_PASS(2, "审核通过"), + + /** + * 被退回 + */ + AUDIT_BACK(3,"被退回"), + + /** + * 未上报 + */ + NOT_REPORT(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 (DataUploadAuditStatusEnum t : DataUploadAuditStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constant/DataUploadAuditTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constant/DataUploadAuditTypeEnum.java new file mode 100644 index 0000000..ee94a82 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constant/DataUploadAuditTypeEnum.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.report.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 直报系统数据审核状态 + * @return + * @author CMM + * @since 2023/02/07 13:55 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "DataUploadAuditTypeEnum", description = "直报系统数据审核类型-枚举") +public enum DataUploadAuditTypeEnum { + + /** + * 市级散办审核 + */ + CITY_AUDIT(1,"市级散办审核"), + + /** + * 审核通过 + */ + PROVINCE_AUDIT(2, "省散办审核"); + + 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 (DataUploadAuditTypeEnum t : DataUploadAuditTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constant/QueryTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constant/QueryTypeEnum.java new file mode 100644 index 0000000..9693bba --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constant/QueryTypeEnum.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.report.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 直报系统上报数据类型 + * @return + * @author CMM + * @since 2023/02/07 13:55 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "QueryTypeEnum", description = "直报系统上报查询类型-枚举") +public enum QueryTypeEnum { + + /** + * 审核列表查询 + */ + AUDIT_LIST(1,"审核列表查询"), + + /** + * 查询列表查询 + */ + QUERY_LIST(2, "查询列表查询"),; + + private Integer code; + private String desc; + + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(int code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (QueryTypeEnum t : QueryTypeEnum.values()) { + if (code == t.getCode()) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constant/UploadDataTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constant/UploadDataTypeEnum.java new file mode 100644 index 0000000..3e2311f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constant/UploadDataTypeEnum.java @@ -0,0 +1,92 @@ +package com.ningdatech.carapi.report.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 直报系统上报数据类型 + * @return + * @author CMM + * @since 2023/02/07 13:55 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "UploadDataTypeEnum", description = "直报系统上报数据类型-枚举") +public enum UploadDataTypeEnum { + + /** + * 散装水泥供应量快报 + */ + BULK_CEMENT_SUPPLY_BULLETIN(1,"散装水泥供应量快报"), + + /** + * 中转库进出量快报 + */ + BULK_CEMENT_TRANSFER_BULLETIN(2, "中转库进出量快报"), + + /** + * 温台舟使用量快报 + */ + BULK_CEMENT_THREE_CITY_USAGE_BULLETIN(3,"温台舟使用量快报"), + + /** + * 混凝土供应量快报 + */ + CONCRETE_SUPPLY_BULLETIN(4,"混凝土供应量快报"), + + /** + * 砂浆供应量快报 + */ + MORTAR_SUPPLY_BULLETIN(5,"砂浆供应量快报"), + + /** + * 非禁现区域散装水泥销售使用情况统计年报表 + */ + NON_PROHIBITED_AREAS_BULK_CEMENT_SALES_USE(6,"非禁现区域散装水泥销售使用情况统计年报表"), + + /** + * 散装水泥物流设施统计年报表 + */ + BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT(7,"散装水泥物流设施统计年报表"), + + /** + * 生产材料物流装备统计年报表 + */ + MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT(8,"生产材料物流装备统计年报表"); + + private Integer code; + private String desc; + + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(int code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (UploadDataTypeEnum t : UploadDataTypeEnum.values()) { + if (code == t.getCode()) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constants/ReportConstant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constants/ReportConstant.java new file mode 100644 index 0000000..36f4402 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/constants/ReportConstant.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.report.constants; + +/** + * @return + * @author CMM + * @since 2023/06/07 10:27 + */ +public interface ReportConstant { + + String TOTAL = "合计"; + String YEAR = "年"; + + String ISSUE_LIBRARY = "发放库"; + String TRANSFER_LIBRARY = "中转库"; + String FIX_RECEIVE_LIBRARY = "固定接收库"; + + String SPECIAL_VEHICLE = "专用汽车"; + String SPECIAL_VESSEL = "专用船"; + String BULK_CEMENT_TANK = "散装水泥罐"; + String CONCRETE_MIXER_TRUCK = "混凝土搅拌车"; + String CONCRETE_PUMP_TRUCK = "混凝土泵车"; + String DRY_MIX_MORTAR_TRUCK = "干混砂浆运输车"; + String DRY_MIX_MORTAR_MOVING_STORAGE = "干混砂浆移动简仓"; + String DRY_MIX_MORTAR_BACK_TANK_CAR = "干混砂浆背罐车"; + + String BULK_CEMENT_SUPPLY_TEMPLATE = "散装水泥供应量统计月报表"; + String BULK_CEMENT_TRANSFER_TEMPLATE = "浙江省散装水泥中转库进出量快报"; + String BULK_CEMENT_THREE_CITY_USAGE_TEMPLATE = "温州、台州、舟山市散装水泥使用量快报"; + String CONCRETE_SUPPLY_TEMPLATE = "预拌混凝土生产及废弃物综合利用情况统计月报表"; + String MORTAR_SUPPLY_TEMPLATE = "预拌砂浆生产及废弃物综合利用情况统计月报表"; + String NON_PRO_AREAS_TEMPLATE = "非禁现区域散装水泥销售使用情况统计年报表"; + String BULK_CEMENT_LOG_FAC_STA_TEMPLATE = "散装水泥物流设施统计年报表"; + String MATERIAL_LOG_EQUIP_STA_TEMPLATE = "散装水泥、预拌混凝土、干混砂浆物流装备统计年报表"; + String BULK_CEMENT_SUPPLY_EMPTY_TEMPLATE = "散装水泥供应量统计月报表(空)"; + String BULK_CEMENT_TRANSFER_EMPTY_TEMPLATE = "浙江省散装水泥中转库进出量快报(空)"; + String BULK_CEMENT_THREE_CITY_USAGE_EMPTY_TEMPLATE = "温州、台州、舟山市散装水泥使用量快报(空)"; + String CONCRETE_SUPPLY_EMPTY_TEMPLATE = "预拌混凝土生产及废弃物综合利用情况统计月报表(空)"; + String MORTAR_SUPPLY_EMPTY_TEMPLATE = "预拌混凝土生产及废弃物综合利用情况统计月报表(空)"; + String NON_PRO_AREAS_EMPTY_TEMPLATE = "非禁现区域散装水泥销售使用情况统计年报表(空)"; + String BULK_CEMENT_LOG_FAC_STA_EMPTY_TEMPLATE = "散装水泥物流设施统计年报表(空)"; + String MATERIAL_LOG_EQUIP_STA_EMPTY_TEMPLATE = "散装水泥、预拌混凝土、干混砂浆物流装备统计年报表(空)"; + + int TWELVE = 12; + + String VEHICLE_ACCIDENT_DATA_TEMPLATE = "车辆事故数据"; + String VEHICLE_ACCIDENT_DATA_TEMPLATE_EMPTY = "车辆事故数据(空)"; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementDirectSystemController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementDirectSystemController.java new file mode 100644 index 0000000..5458d76 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementDirectSystemController.java @@ -0,0 +1,89 @@ +package com.ningdatech.carapi.report.controller; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.report.manage.BulkCementDirectSystemManage; +import com.ningdatech.carapi.report.model.po.ReqDataAuditPO; +import com.ningdatech.carapi.report.model.po.ReqDataQueryModifyPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadDetailPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.vo.ResDataQueryDetailVO; +import com.ningdatech.carapi.report.model.vo.ResDataQueryListVO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 散装水泥直报系统 前端控制器 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@RequestMapping("/api/v1/direct/report/system") +@RestController +@Api(tags = "数据上报-公用接口") +@Validated +@RequiredArgsConstructor +public class BulkCementDirectSystemController { + + private final BulkCementDirectSystemManage bulkCementDirectSystemManage; + + @PostMapping("/upload/data/detail") + @ApiOperation("散装水泥直报系统上报数据详情") + public ResDataUploadDetailVO uploadDataDetail(@Valid @RequestBody ReqDataUploadDetailPO po) { + return bulkCementDirectSystemManage.uploadDataDetail(po); + } + + @PostMapping("/data/query/list") + @ApiOperation("散装水泥直报系统数据查询列表") + public PageVo dataQueryList(@Valid @RequestBody ReqDataUploadListPO po) { + return bulkCementDirectSystemManage.dataQueryList(po); + } + + @PostMapping("/data/query/detail") + @ApiOperation("散装水泥直报系统数据查询详情") + public ResDataQueryDetailVO uploadDataQueryDetail(@Valid @RequestBody ReqDataUploadListPO po) { + return bulkCementDirectSystemManage.uploadDataQueryDetail(po); + } + + @PostMapping("/data/query/modify") + @ApiOperation("12月份数据查询编辑") + @WebLog(value = "12月份数据查询编辑", modular = "数据上报-12月份数据查询编辑") + public String uploadDataQueryModify(@Valid @RequestBody ReqDataQueryModifyPO po) { + return bulkCementDirectSystemManage.uploadDataQueryModify(po); + } + + @PostMapping("/data/audit/list") + @ApiOperation("散装水泥直报系统数据审核列表") + public PageVo dataAuditList(@Valid @RequestBody ReqDataUploadListPO po) { + return bulkCementDirectSystemManage.dataAuditList(po); + } + + @PostMapping("/data/audit") + @ApiOperation("散装水泥直报系统数据审核") + @WebLog(value = "散装水泥直报系统数据审核", modular = "数据上报-散装水泥直报系统数据审核") + public String dataAudit(@Valid @RequestBody ReqDataAuditPO po) { + return bulkCementDirectSystemManage.dataAudit(po); + } + + @PostMapping("/upload/data/query/export") + @ApiOperation("散装水泥直报系统数据查询导出") + @WebLog(value = "散装水泥供应量上报数据查询导出", modular = "数据上报-散装水泥供应量上报数据查询导出") + public void uploadDataQueryExport(@Valid @RequestBody ReqDataUploadListPO po, HttpServletResponse response) { + bulkCementDirectSystemManage.exportQueryData(po,response); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementLogFacStaAnnualReportController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementLogFacStaAnnualReportController.java new file mode 100644 index 0000000..97d5b88 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementLogFacStaAnnualReportController.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.report.controller; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.report.manage.BulkCementLogFacStaManage; +import com.ningdatech.carapi.report.model.dto.ReqBulkCementLogFacStaDataUploadDTO; +import com.ningdatech.carapi.report.model.po.ReqBulkCementLogFacStaDataUploadPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.vo.ResBulkCementLogFacStaDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResBulkCementLogFacStaRelatedDataVO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 散装水泥直报系统 前端控制器 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@RequestMapping("/api/v1/direct/report/system") +@RestController +@Api(tags = "数据上报-散装水泥物流设施统计年报") +@Validated +@RequiredArgsConstructor +public class BulkCementLogFacStaAnnualReportController { + + private final BulkCementLogFacStaManage bulkCementLogFacStaManage; + + @PostMapping("/get/bulk-cement-log-fac-sta/related/data") + @ApiOperation("获取散装水泥物流设施统计年报相关数据") + public ResBulkCementLogFacStaRelatedDataVO getConcreteSupplyRelatedData(@Valid @RequestBody ReqBulkCementLogFacStaDataUploadDTO dto) { + return bulkCementLogFacStaManage.getBulkCementLogFacStaRelatedData(dto); + } + + @PostMapping("/get/bulk-cement-log-fac-sta/upload/data") + @ApiOperation("获取散装水泥物流设施统计年报计算数据") + public ResBulkCementLogFacStaDataUploadDetailVO getBulkCementLogFacStaUploadData(@Valid @RequestBody ReqBulkCementLogFacStaDataUploadDTO dto) { + return bulkCementLogFacStaManage.getBulkCementLogFacStaUploadData(dto); + } + @PostMapping("/bulk-cement-log-fac-sta/data/upload") + @ApiOperation("散装水泥物流设施统计年报数据上报") + @WebLog(value = "散装水泥物流设施统计年报数据上报", modular = "数据上报-散装水泥物流设施统计年报数据上报") + public String bulkCementSupplyDataUpload(@Valid @RequestBody ReqBulkCementLogFacStaDataUploadPO po) { + return bulkCementLogFacStaManage.bulkCementLogFacStaDataUpload(po); + } + @PostMapping("/bulk-cement-log-fac-sta/data/upload/list") + @ApiOperation("散装水泥物流设施统计年报年报数据上报列表") + public PageVo dataUploadList(@Valid @RequestBody ReqDataUploadListPO po) { + return bulkCementLogFacStaManage.dataUploadList(po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementSupplyBulletinController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementSupplyBulletinController.java new file mode 100644 index 0000000..0c362f5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementSupplyBulletinController.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.report.controller; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.report.manage.BulkCementSupplyBulletinManage; +import com.ningdatech.carapi.report.model.po.ReqBulkCementSupplyDataUploadPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.vo.ResBulkCementSupplyDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 散装水泥直报系统 前端控制器 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@RequestMapping("/api/v1/direct/report/system") +@RestController +@Api(tags = "数据上报-散装水泥供应量快报") +@Validated +@RequiredArgsConstructor +public class BulkCementSupplyBulletinController { + + private final BulkCementSupplyBulletinManage bulkCementSupplyBulletinManage; + @PostMapping("/get/bulk-cement-supply/upload/data") + @ApiOperation("获取散装水泥供应量快报计算数据") + public ResBulkCementSupplyDataUploadDetailVO getBulkCementSupplyUploadData(@Valid @RequestBody ReqBulkCementSupplyDataUploadPO po) { + return bulkCementSupplyBulletinManage.getBulkCementSupplyUploadData(po); + } + @PostMapping("/bulk-cement-supply/data/upload") + @ApiOperation("散装水泥供应量快报数据上报") + @WebLog(value = "散装水泥供应量快报数据上报", modular = "数据上报-散装水泥供应量快报数据上报") + public String bulkCementSupplyDataUpload(@Valid @RequestBody ReqBulkCementSupplyDataUploadPO po) { + return bulkCementSupplyBulletinManage.bulkCementSupplyDataUpload(po); + } + @PostMapping("/bulk-cement-supply/data/upload/list") + @ApiOperation("散装水泥供应量数据上报列表") + public PageVo dataUploadList(@Valid @RequestBody ReqDataUploadListPO po) { + return bulkCementSupplyBulletinManage.dataUploadList(po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementThreeCityUsageBulletinController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementThreeCityUsageBulletinController.java new file mode 100644 index 0000000..971715b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementThreeCityUsageBulletinController.java @@ -0,0 +1,63 @@ +package com.ningdatech.carapi.report.controller; + +import java.math.BigDecimal; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.report.manage.BulkCementThreeCityUsageBulletinManage; +import com.ningdatech.carapi.report.model.po.ReqBulkCementThreeCityUsageDataUploadPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.vo.ResBulkCementThreeCityUsageDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 散装水泥直报系统 前端控制器 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@RequestMapping("/api/v1/direct/report/system") +@RestController +@Api(tags = "数据上报-温台舟使用量快报") +@Validated +@RequiredArgsConstructor +public class BulkCementThreeCityUsageBulletinController { + + private final BulkCementThreeCityUsageBulletinManage bulkCementThreeCityUsageBulletinManage; + + @PostMapping("/get/bulk-cement-three-city-usage/yearTarget") + @ApiOperation("获取温台舟使用量年目标数据") + public BigDecimal getBulkCementThreeCityUsageYearTarget(@Valid @RequestBody ReqBulkCementThreeCityUsageDataUploadPO po) { + return bulkCementThreeCityUsageBulletinManage.getBulkCementThreeCityUsageYearTarget(po); + } + @PostMapping("/get/bulk-cement-three-city-usage/upload/data") + @ApiOperation("获取温台舟使用量快报计算数据") + public ResBulkCementThreeCityUsageDataUploadDetailVO getBulkCementThreeCityUsageUploadData(@Valid @RequestBody ReqBulkCementThreeCityUsageDataUploadPO po) { + return bulkCementThreeCityUsageBulletinManage.getBulkCementThreeCityUsageUploadData(po); + } + @PostMapping("/bulk-cement-three-city-usage/data/upload") + @ApiOperation("温台舟使用量数据上报") + @WebLog(value = "温台舟使用量数据上报", modular = "数据上报-温台舟使用量数据上报") + public String bulkCementThreeCityUsageDataUpload(@Valid @RequestBody ReqBulkCementThreeCityUsageDataUploadPO po) { + return bulkCementThreeCityUsageBulletinManage.bulkCementThreeCityUsageDataUpload(po); + } + @PostMapping("/bulk-cement-three-city-usage/data/upload/list") + @ApiOperation("温台舟使用量数据上报列表") + public PageVo dataUploadList(@Valid @RequestBody ReqDataUploadListPO po) { + return bulkCementThreeCityUsageBulletinManage.dataUploadList(po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementTransferBulletinController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementTransferBulletinController.java new file mode 100644 index 0000000..8add44f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/BulkCementTransferBulletinController.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.report.controller; + +import java.math.BigDecimal; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.report.manage.BulkCementTransferBulletinManage; +import com.ningdatech.carapi.report.model.po.ReqBulkCementTransferDataUploadPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.vo.ResBulkCementTransferDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 散装水泥直报系统 前端控制器 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@RequestMapping("/api/v1/direct/report/system") +@RestController +@Api(tags = "数据上报-中转库进出量统计") +@Validated +@RequiredArgsConstructor +public class BulkCementTransferBulletinController { + + private final BulkCementTransferBulletinManage bulkCementTransferBulletinManage; + + @PostMapping("/get/bulk-cement-transfer/last-month/data") + @ApiOperation("获取中转库进出量上月数据") + public BigDecimal getBulkCementTransferLastMonthData(@Valid @RequestBody ReqBulkCementTransferDataUploadPO po) { + return bulkCementTransferBulletinManage.getBulkCementTransferLastMonthData(po); + } + + @PostMapping("/get/bulk-cement-transfer/upload/data") + @ApiOperation("获取中转库进出量计算数据") + public ResBulkCementTransferDataUploadDetailVO getBulkCementSupplyUploadData(@Valid @RequestBody ReqBulkCementTransferDataUploadPO po) { + return bulkCementTransferBulletinManage.getBulkCementTransferUploadData(po); + } + @PostMapping("/bulk-cement-transfer/data/upload") + @ApiOperation("中转库进出量数据上报") + @WebLog(value = "中转库进出量数据上报", modular = "数据上报-中转库进出量数据上报") + public String bulkCementSupplyDataUpload(@Valid @RequestBody ReqBulkCementTransferDataUploadPO po) { + return bulkCementTransferBulletinManage.bulkCementTransferDataUpload(po); + } + @PostMapping("/bulk-cement-transfer/data/upload/list") + @ApiOperation("中转库进出量数据上报列表") + public PageVo dataUploadList(@Valid @RequestBody ReqDataUploadListPO po) { + return bulkCementTransferBulletinManage.dataUploadList(po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/ConcreteSupplyBulletinController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/ConcreteSupplyBulletinController.java new file mode 100644 index 0000000..e1cadbb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/ConcreteSupplyBulletinController.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.report.controller; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.report.manage.ConcreteSupplyBulletinManage; +import com.ningdatech.carapi.report.model.po.ReqConcreteSupplyDataUploadPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.vo.ResConcreteSupplyDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResConcreteSupplyRelatedDataVO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 散装水泥直报系统 前端控制器 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@RequestMapping("/api/v1/direct/report/system") +@RestController +@Api(tags = "数据上报-混凝土供应量快报") +@Validated +@RequiredArgsConstructor +public class ConcreteSupplyBulletinController { + + private final ConcreteSupplyBulletinManage concreteSupplyBulletinManage; + + @PostMapping("/get/concrete-supply/related/data") + @ApiOperation("获取混凝土供应量相关数据") + public ResConcreteSupplyRelatedDataVO getConcreteSupplyRelatedData(@Valid @RequestBody ReqConcreteSupplyDataUploadPO po) { + return concreteSupplyBulletinManage.getConcreteSupplyRelatedData(po); + } + @PostMapping("/get/concrete-supply/upload/data") + @ApiOperation("获取混凝土供应量快报计算数据") + public ResConcreteSupplyDataUploadDetailVO getConcreteSupplyUploadData(@Valid @RequestBody ReqConcreteSupplyDataUploadPO po) { + return concreteSupplyBulletinManage.getConcreteSupplyUploadData(po); + } + @PostMapping("/concrete-supply/data/upload") + @ApiOperation("混凝土供应量快报数据上报") + @WebLog(value = "混凝土供应量快报数据上报", modular = "数据上报-混凝土供应量快报数据上报") + public String concreteSupplyDataUpload(@Valid @RequestBody ReqConcreteSupplyDataUploadPO po) { + return concreteSupplyBulletinManage.concreteSupplyDataUpload(po); + } + @PostMapping("/concrete-supply/data/upload/list") + @ApiOperation("混凝土供应量数据上报列表") + public PageVo dataUploadList(@Valid @RequestBody ReqDataUploadListPO po) { + return concreteSupplyBulletinManage.dataUploadList(po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/MaterialLogEquipStaAnnualReportController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/MaterialLogEquipStaAnnualReportController.java new file mode 100644 index 0000000..18fbb64 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/MaterialLogEquipStaAnnualReportController.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.report.controller; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.report.manage.MaterialLogEquipStaManage; +import com.ningdatech.carapi.report.model.dto.ReqMaterialLogEquipStaDataUploadDTO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.po.ReqMaterialLogEquipStaDataUploadPO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.carapi.report.model.vo.ResMaterialLogEquipStaDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResMaterialLogEquipStaRelatedDataVO; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 散装水泥直报系统 前端控制器 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@RequestMapping("/api/v1/direct/report/system") +@RestController +@Api(tags = "数据上报-散装水泥、预拌混凝土、干混砂浆物流装备统计年报") +@Validated +@RequiredArgsConstructor +public class MaterialLogEquipStaAnnualReportController { + + private final MaterialLogEquipStaManage materialLogEquipStaManage; + + @PostMapping("/get/material-log-equip-sta/related/data") + @ApiOperation("获取散装水泥、预拌混凝土、干混砂浆物流装备统计年报相关数据") + public ResMaterialLogEquipStaRelatedDataVO getConcreteSupplyRelatedData(@Valid @RequestBody ReqMaterialLogEquipStaDataUploadDTO dto) { + return materialLogEquipStaManage.getMaterialLogEquipStaRelatedData(dto); + } + + @PostMapping("/get/material-log-equip-sta/upload/data") + @ApiOperation("获取散装水泥、预拌混凝土、干混砂浆物流装备统计年报计算数据") + public ResMaterialLogEquipStaDataUploadDetailVO getBulkCementLogFacStaUploadData(@Valid @RequestBody ReqMaterialLogEquipStaDataUploadDTO dto) { + return materialLogEquipStaManage.getMaterialLogEquipStaUploadData(dto); + } + @PostMapping("/material-log-equip-sta/data/upload") + @ApiOperation("散装水泥、预拌混凝土、干混砂浆物流装备统计年报数据上报") + @WebLog(value = "非禁现区散装水泥销售使用情况年报数据上报", modular = "数据上报-非禁现区散装水泥销售使用情况年报数据上报") + public String bulkCementSupplyDataUpload(@Valid @RequestBody ReqMaterialLogEquipStaDataUploadPO po) { + return materialLogEquipStaManage.materialLogEquipStaDataUpload(po); + } + @PostMapping("/material-log-equip-sta/data/upload/list") + @ApiOperation("散装水泥、预拌混凝土、干混砂浆物流装备统计年报数据上报列表") + public PageVo dataUploadList(@Valid @RequestBody ReqDataUploadListPO po) { + return materialLogEquipStaManage.dataUploadList(po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/MortarSupplyBulletinController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/MortarSupplyBulletinController.java new file mode 100644 index 0000000..bd1ad6e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/MortarSupplyBulletinController.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.report.controller; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.report.manage.MortarSupplyBulletinManage; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.po.ReqMortarSupplyDataUploadPO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.carapi.report.model.vo.ResMortarSupplyDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResMortarSupplyRelatedDataVO; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 散装水泥直报系统 前端控制器 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@RequestMapping("/api/v1/direct/report/system") +@RestController +@Api(tags = "数据上报-砂浆供应量快报") +@Validated +@RequiredArgsConstructor +public class MortarSupplyBulletinController { + + private final MortarSupplyBulletinManage mortarSupplyBulletinManage; + + @PostMapping("/get/mortar-supply/related/data") + @ApiOperation("获取砂浆供应量相关数据") + public ResMortarSupplyRelatedDataVO getMortarSupplyRelatedData(@Valid @RequestBody ReqMortarSupplyDataUploadPO po) { + return mortarSupplyBulletinManage.getMortarSupplyRelatedData(po); + } + @PostMapping("/get/mortar-supply/upload/data") + @ApiOperation("获取砂浆供应量快报计算数据") + public ResMortarSupplyDataUploadDetailVO getMortarSupplyUploadData(@Valid @RequestBody ReqMortarSupplyDataUploadPO po) { + return mortarSupplyBulletinManage.getMortarSupplyUploadData(po); + } + @PostMapping("/mortar-supply/data/upload") + @ApiOperation("砂浆供应量快报数据上报") + @WebLog(value = "砂浆供应量快报数据上报", modular = "数据上报-砂浆供应量快报数据上报") + public String mortarSupplyDataUpload(@Valid @RequestBody ReqMortarSupplyDataUploadPO po) { + return mortarSupplyBulletinManage.mortarSupplyDataUpload(po); + } + @PostMapping("/mortar-supply/data/upload/list") + @ApiOperation("散装水泥供应量数据上报列表") + public PageVo dataUploadList(@Valid @RequestBody ReqDataUploadListPO po) { + return mortarSupplyBulletinManage.dataUploadList(po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/NonProhibitedAreasBulkCementSalesUseController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/NonProhibitedAreasBulkCementSalesUseController.java new file mode 100644 index 0000000..86955dd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/controller/NonProhibitedAreasBulkCementSalesUseController.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.report.controller; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.report.manage.NonProhibitedAreasBulkCementSalesUseManage; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.po.ReqNonProhibitedAreasDataUploadPO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.carapi.report.model.vo.ResNonProhibitedAreasDataUploadDetailVO; +import com.ningdatech.log.annotation.WebLog; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 散装水泥直报系统 前端控制器 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@RequestMapping("/api/v1/direct/report/system") +@RestController +@Api(tags = "数据上报-非禁现区域散装水泥销售使用情况") +@Validated +@RequiredArgsConstructor +public class NonProhibitedAreasBulkCementSalesUseController { + + private final NonProhibitedAreasBulkCementSalesUseManage nonProhibitedAreasBulkCementSalesUseManage; + + @PostMapping("/get/non-prohibited-areas/upload/data") + @ApiOperation("获取非禁现区散装水泥销售使用情况年报计算数据") + public ResNonProhibitedAreasDataUploadDetailVO getBulkCementSupplyUploadData(@Valid @RequestBody ReqNonProhibitedAreasDataUploadPO po) { + return nonProhibitedAreasBulkCementSalesUseManage.getNonProhibitedAreasUploadData(po); + } + @PostMapping("/non-prohibited-areas/data/upload") + @ApiOperation("非禁现区散装水泥销售使用情况年报数据上报") + @WebLog(value = "非禁现区散装水泥销售使用情况年报数据上报", modular = "数据上报-非禁现区散装水泥销售使用情况年报数据上报") + public String bulkCementSupplyDataUpload(@Valid @RequestBody ReqNonProhibitedAreasDataUploadPO po) { + return nonProhibitedAreasBulkCementSalesUseManage.nonProhibitedAreasDataUpload(po); + } + @PostMapping("/non-prohibited-areas/data/upload/list") + @ApiOperation("非禁现区散装水泥销售使用情况年报数据上报列表") + public PageVo dataUploadList(@Valid @RequestBody ReqDataUploadListPO po) { + return nonProhibitedAreasBulkCementSalesUseManage.dataUploadList(po); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementDirectSystemManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementDirectSystemManage.java new file mode 100644 index 0000000..468b13a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementDirectSystemManage.java @@ -0,0 +1,3585 @@ +package com.ningdatech.carapi.report.manage; + +import java.io.*; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +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.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.car.vehicle.contants.VehicleContant; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.common.helper.UserInfoHelper; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.report.constant.DataUploadAuditStatusEnum; +import com.ningdatech.carapi.report.constant.DataUploadAuditTypeEnum; +import com.ningdatech.carapi.report.constant.QueryTypeEnum; +import com.ningdatech.carapi.report.constant.UploadDataTypeEnum; +import com.ningdatech.carapi.report.constants.ReportConstant; +import com.ningdatech.carapi.report.model.dto.*; +import com.ningdatech.carapi.report.model.entity.*; +import com.ningdatech.carapi.report.model.po.ReqDataAuditPO; +import com.ningdatech.carapi.report.model.po.ReqDataQueryModifyPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadDetailPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.vo.*; +import com.ningdatech.carapi.report.service.*; +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.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.TemplateExportParams; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.poi.excel.ExcelUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/09/28 11:15 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class BulkCementDirectSystemManage { + + private final IBulkCementDirectReportSystemAuditRecordService auditRecordService; + private final IBulkCementDirectReportSystemAuditInfoService auditInfoService; + private final IBulkCementSupplyBulletinService bulkCementSupplyBulletinService; + private final RegionsCacheHelper regionsCacheHelper; + private final IBulkCementDirectReportSystemDataRelevanceService dataRelevanceService; + private final IBulkCementDirectReportSystemUniversalIndexService universalIndexService; + private final CompaniesCacheHelper companiesCacheHelper; + private final IBulkCementTransferBulletinService bulkCementTransferBulletinService; + private final IBulkCementThreeCityUsageBulletinService bulkCementThreeCityUsageBulletinService; + private final IConcreteSupplyBulletinService concreteSupplyBulletinService; + private final IMortarSupplyBulletinService mortarSupplyBulletinService; + private final INonProhibitedAreasBulkCementSalesUseService nonProhibitedAreasBulkCementSalesUseService; + private final IBulkCementLogisticFacilityStatisticAnnualReportService bulkCementLogFacStaAnnualReportService; + private final IMaterialLogisticEquipmentStatisticAnnualReportService materialLogEquipStaAnnualReportService; + private final UserInfoHelper userInfoHelper; + + public PageVo dataAuditList(ReqDataUploadListPO req) { + + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + + Page page = req.page(); + // 根据所属区域和登录用户角色查出对应的散装水泥供应量数据审核记录 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(BulkCementDirectReportSystemAuditRecord.class); + BulkCementDirectSystemManage context = (BulkCementDirectSystemManage) AopContext.currentProxy(); + context.buildDataAuditListQuery(wrapper, req); + auditRecordService.page(page,wrapper); + List records = page.getRecords(); + if (CollUtil.isEmpty(records)){ + return PageVo.empty(); + } + // 获取审核信息 + List auditInfoIdList = records.stream().map(BulkCementDirectReportSystemAuditRecord::getAuditInfoId).collect(Collectors.toList()); + VUtils.isTrue(CollUtil.isEmpty(auditInfoIdList)).throwMessage("审核信息不存在!"); + Map auditInfoMap = auditInfoService.list(Wrappers.lambdaQuery(BulkCementDirectReportSystemAuditInfo.class) + .in(BulkCementDirectReportSystemAuditInfo::getId, auditInfoIdList)) + .stream().collect(Collectors.toMap(BulkCementDirectReportSystemAuditInfo::getId, v -> v)); + Map dataRelevanceMap = dataRelevanceService.list(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class)) + .stream().collect(Collectors.toMap(BulkCementDirectReportSystemDataRelevance::getId, v -> v)); + List resVos = records.stream().map(r -> { + ResDataUploadListVO vo = new ResDataUploadListVO(); + LocalDateTime month = r.getReportMonth(); + if (Objects.nonNull(month)) { + String reportMonthStr = NdDateUtils.format(month, NdDateUtils.DEFAULT_MONTH_FORMAT); + LocalDateTime reportMonth = LocalDateTimeUtil.parse(reportMonthStr, DateTimeFormatter.ofPattern(DatePattern.NORM_MONTH_PATTERN)); + vo.setReportMonth(reportMonth); + } + vo.setReportYear(r.getReportYear()); + vo.setRegionId(r.getRegionId()); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(r.getRegionId()); + vo.setRegionName(regionDto.getRegionName()); + vo.setAuditDataId(r.getAuditDataId()); + + // 如果登录用户是市散办 + if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())){ + List auditDataIdList = Lists.newArrayList(); + auditDataIdList.add(r.getAuditDataId()); + vo.setAuditDataIdList(auditDataIdList); + } + // 如果登录用户是省散办 + else if (UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId()) || + UserRoleTypeEnum.SYSTEM_ROLE_ID.getId().equals(userDetail.getRoleId())) { + Long relevanceId = r.getAuditDataId(); + Map> auditDataIdListMap = MapUtil.newHashMap(); + BulkCementDirectReportSystemDataRelevance dataRelevance = dataRelevanceMap.get(relevanceId); + if (Objects.nonNull(dataRelevance) && StringUtils.isNotBlank(dataRelevance.getAuditDataIdList())){ + String auditDataIdList = dataRelevance.getAuditDataIdList(); + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + auditDataIdListMap.put(relevanceId,idList); + vo.setAuditDataIdListMap(auditDataIdListMap); + } + } + BulkCementDirectReportSystemAuditInfo auditInfo = auditInfoMap.get(r.getAuditInfoId()); + if (Objects.nonNull(auditInfo)) { + vo.setAuditInfoId(auditInfo.getId()); + vo.setAuditOpinion(auditInfo.getAuditOpinion()); + vo.setAuditTime(auditInfo.getAuditTime()); + vo.setAuditStatus(r.getAuditStatus()); + String desc = DataUploadAuditStatusEnum.getDescByCode(r.getAuditStatus()); + vo.setAuditStatusName(desc); + } + vo.setSubmitTime(r.getCreateOn()); + vo.setAuditRecordId(r.getId()); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(resVos, page.getTotal()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void buildDataAuditListQuery(LambdaQueryWrapper wrapper, ReqDataUploadListPO req) { + + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + + // 获取入参 + LocalDateTime reportStartMonth = req.getReportStartMonth(); + Integer reportStartYear = req.getReportStartYear(); + LocalDateTime reportEndMonth = req.getReportEndMonth(); + Integer reportEndYear = req.getReportEndYear(); + List auditStatusList = req.getAuditStatusList(); + Integer auditStatus = req.getAuditStatus(); + Integer auditDataType = req.getAuditDataType(); + VUtils.isTrue(Objects.isNull(auditDataType)).throwMessage("请传入审核数据类型!"); + Long regionId = req.getRegionId(); + VUtils.isTrue(CollUtil.isEmpty(auditStatusList)).throwMessage("请传入审核列表审核状态筛选条件!"); + wrapper.ge(Objects.nonNull(reportStartMonth), BulkCementDirectReportSystemAuditRecord::getReportMonth, reportStartMonth) + .le(Objects.nonNull(reportEndMonth), BulkCementDirectReportSystemAuditRecord::getReportMonth, reportEndMonth) + .ge(Objects.nonNull(reportStartYear), BulkCementDirectReportSystemAuditRecord::getReportYear, reportStartYear) + .le(Objects.nonNull(reportEndYear), BulkCementDirectReportSystemAuditRecord::getReportYear, reportEndYear) + .in(BulkCementDirectReportSystemAuditRecord::getAuditStatus,auditStatusList) + .eq(BulkCementDirectReportSystemAuditRecord::getAuditDataType,auditDataType) + .eq(Objects.nonNull(auditStatus),BulkCementDirectReportSystemAuditRecord::getAuditStatus,auditStatus) + .eq(Objects.nonNull(regionId),BulkCementDirectReportSystemAuditRecord::getRegionId,regionId) + .orderByDesc(BulkCementDirectReportSystemAuditRecord::getUpdateOn) + .isNotNull(BulkCementDirectReportSystemAuditRecord::getAuditInfoId); + // 如果是市级散办,筛选出审核类型为市级散办审核的数据 + if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(roleId)){ + wrapper.eq(BulkCementDirectReportSystemAuditRecord::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + } + // 如果是省级散办,筛选出审核类型为省散办审核的数据 + else if (UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId) || UserRoleTypeEnum.SYSTEM_ROLE_ID.getId().equals(roleId)) { + wrapper.eq(BulkCementDirectReportSystemAuditRecord::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + } + } + + @Transactional(rollbackFor = Exception.class) + public String dataAudit(ReqDataAuditPO req) { + + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + + // 获取入参 + Long auditDataId = req.getAuditDataId(); + Long auditIndoId = req.getAuditInfoId(); + Long auditRecordId = req.getAuditRecordId(); + String auditOpinion = req.getAuditOpinion(); + Integer auditStatus = req.getAuditStatus(); + LocalDateTime reportMonth = req.getReportMonth(); + Integer reportYear = req.getReportYear(); + Integer auditDataType = req.getAuditDataType(); + + // 更新审核信息 + BulkCementDirectReportSystemAuditInfo auditInfo = auditInfoService.getById(auditIndoId); + VUtils.isTrue(Objects.isNull(auditInfo)).throwMessage("审核信息不存在!"); + auditInfo.setAuditOpinion(auditOpinion); + auditInfo.setAuditTime(LocalDateTime.now()); + auditInfo.setAuditStatus(auditStatus); + auditInfo.setAuditBy(userDetail.getUserId()); + auditInfo.setCreateBy(userDetail.getUserId()); + auditInfo.setCreateOn(LocalDateTime.now()); + auditInfo.setUpdateBy(userDetail.getUserId()); + auditInfo.setUpdateOn(LocalDateTime.now()); + auditInfoService.updateById(auditInfo); + // 更新审核记录信息 + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(BulkCementDirectReportSystemAuditRecord.class); + BulkCementDirectSystemManage context = (BulkCementDirectSystemManage) AopContext.currentProxy(); + context.buildAuditRecordQuery(wrapper, auditRecordId); + BulkCementDirectReportSystemAuditRecord auditRecord = auditRecordService.getOne(wrapper); + VUtils.isTrue(Objects.isNull(auditRecord)).throwMessage("审核记录不存在!"); + auditRecord.setAuditStatus(auditStatus); + auditRecord.setUpdateOn(LocalDateTime.now()); + auditRecord.setUpdateBy(userDetail.getUserId()); + auditRecordService.updateById(auditRecord); + + // 更新对应类型的审核数据 + // 如果登录审核用户是市级散办 更新对应数据信息 + if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + switch (auditDataType) { + // 散装水泥供应量数据 + case 1: + BulkCementSupplyBulletin cementSupplyBulletin = bulkCementSupplyBulletinService.getById(auditDataId); + cementSupplyBulletin.setAuditStatus(auditStatus); + cementSupplyBulletin.setUpdateOn(LocalDateTime.now()); + cementSupplyBulletin.setUpdateBy(userDetail.getUserId()); + bulkCementSupplyBulletinService.updateById(cementSupplyBulletin); + break; + // 中转库进出量统计数据 + case 2: + BulkCementTransferBulletin bulkCementTransferBulletin = bulkCementTransferBulletinService.getById(auditDataId); + bulkCementTransferBulletin.setAuditStatus(auditStatus); + bulkCementTransferBulletin.setUpdateOn(LocalDateTime.now()); + bulkCementTransferBulletin.setUpdateBy(userDetail.getUserId()); + bulkCementTransferBulletinService.updateById(bulkCementTransferBulletin); + break; + // 温台舟使用量快报数据 + case 3: + BulkCementThreeCityUsageBulletin bulkCementThreeCityUsageBulletin = bulkCementThreeCityUsageBulletinService.getById(auditDataId); + bulkCementThreeCityUsageBulletin.setAuditStatus(auditStatus); + bulkCementThreeCityUsageBulletin.setUpdateOn(LocalDateTime.now()); + bulkCementThreeCityUsageBulletin.setUpdateBy(userDetail.getUserId()); + bulkCementThreeCityUsageBulletinService.updateById(bulkCementThreeCityUsageBulletin); + break; + // 混凝土供应量快报数据 + case 4: + ConcreteSupplyBulletin concreteSupplyBulletin = concreteSupplyBulletinService.getById(auditDataId); + concreteSupplyBulletin.setAuditStatus(auditStatus); + concreteSupplyBulletin.setUpdateOn(LocalDateTime.now()); + concreteSupplyBulletin.setUpdateBy(userDetail.getUserId()); + concreteSupplyBulletinService.updateById(concreteSupplyBulletin); + break; + // 砂浆供应量快报数据 + case 5: + MortarSupplyBulletin mortarSupplyBulletin = mortarSupplyBulletinService.getById(auditDataId); + mortarSupplyBulletin.setAuditStatus(auditStatus); + mortarSupplyBulletin.setUpdateOn(LocalDateTime.now()); + mortarSupplyBulletin.setUpdateBy(userDetail.getUserId()); + mortarSupplyBulletinService.updateById(mortarSupplyBulletin); + break; + // 非禁现区域散装水泥销售使用情况数据 + case 6: + NonProhibitedAreasBulkCementSalesUse nonProhibitedAreasBulkCementSalesUse = nonProhibitedAreasBulkCementSalesUseService.getById(auditDataId); + nonProhibitedAreasBulkCementSalesUse.setAuditStatus(auditStatus); + nonProhibitedAreasBulkCementSalesUse.setUpdateOn(LocalDateTime.now()); + nonProhibitedAreasBulkCementSalesUse.setUpdateBy(userDetail.getUserId()); + nonProhibitedAreasBulkCementSalesUseService.updateById(nonProhibitedAreasBulkCementSalesUse); + break; + // 散装水泥物流设施统计年报表数据 + case 7: + // 获取填报的各设备名称的数据更新审核状态 + BulkCementDirectReportSystemDataRelevance dataRelevance1 = dataRelevanceService.getById(auditDataId); + String auditDataIdList1 = dataRelevance1.getAuditDataIdList(); + VUtils.isTrue(StringUtils.isBlank(auditDataIdList1)).throwMessage("审核数据不存在!"); + List idList1 = Arrays.stream(auditDataIdList1.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + for (Long id : idList1) { + BulkCementLogisticFacilityStatisticAnnualReport bulkCementLogFacStaAnnualReport = bulkCementLogFacStaAnnualReportService.getById(id); + bulkCementLogFacStaAnnualReport.setAuditStatus(auditStatus); + bulkCementLogFacStaAnnualReport.setUpdateOn(LocalDateTime.now()); + bulkCementLogFacStaAnnualReport.setUpdateBy(userDetail.getUserId()); + bulkCementLogFacStaAnnualReportService.updateById(bulkCementLogFacStaAnnualReport); + } + // 更新区县关联数据 + dataRelevance1.setAuditStatus(auditStatus); + dataRelevance1.setUpdateOn(LocalDateTime.now()); + dataRelevance1.setUpdateBy(userDetail.getUserId()); + dataRelevanceService.updateById(dataRelevance1); + break; + // 散装水泥、预拌砂浆、干混砂浆物流装备统计年报表数据 + case 8: + // 获取填报的各设备名称的数据更新审核状态 + BulkCementDirectReportSystemDataRelevance dataRelevance2 = dataRelevanceService.getById(auditDataId); + String auditDataIdList2 = dataRelevance2.getAuditDataIdList(); + VUtils.isTrue(StringUtils.isBlank(auditDataIdList2)).throwMessage("审核数据不存在!"); + List idList2 = Arrays.stream(auditDataIdList2.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + for (Long id : idList2) { + MaterialLogisticEquipmentStatisticAnnualReport materialLogEquipStaAnnualReport = materialLogEquipStaAnnualReportService.getById(id); + materialLogEquipStaAnnualReport.setAuditStatus(auditStatus); + materialLogEquipStaAnnualReport.setUpdateOn(LocalDateTime.now()); + materialLogEquipStaAnnualReport.setUpdateBy(userDetail.getUserId()); + materialLogEquipStaAnnualReportService.updateById(materialLogEquipStaAnnualReport); + } + // 更新区县关联数据 + dataRelevance2.setAuditStatus(auditStatus); + dataRelevance2.setUpdateOn(LocalDateTime.now()); + dataRelevance2.setUpdateBy(userDetail.getUserId()); + dataRelevanceService.updateById(dataRelevance2); + break; + default: + throw new IllegalStateException("Unexpected value: " + auditDataType); + } + } + + // 登录用户是市级散办更新对应的市级关联数据 + // 登录用户是省散办更新对应的省关联数 + Long regionId; + if (UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId()) || + UserRoleTypeEnum.SYSTEM_ROLE_ID.getId().equals(userDetail.getRoleId())){ + regionId = DefValConstants.ZJREGION_ID; + }else { + regionId = userDetail.getRegionId(); + } + + BulkCementDirectReportSystemDataRelevance dataRelevance = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType,auditDataType) + // 非年报关联数据,通过传入的上报月份查询 + .eq(Objects.nonNull(reportMonth), BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + // 年报数据,通过传入的上报年份查询 + .eq(Objects.nonNull(reportYear),BulkCementDirectReportSystemDataRelevance::getReportYear,reportYear)); + VUtils.isTrue(Objects.isNull(dataRelevance)).throwMessage("关联数据不存在!"); + + // 如果审核通过,更新关联数据ID列表 + // 注意:审核数据类型如果为散装水泥物流设施统计年报或者散装水泥、预拌混凝土、干混砂浆物流装备统计年报数据 + // 实际上auditDataIdList中存放的是各区县关联数据ID + if (DataUploadAuditStatusEnum.AUDIT_PASS.getCode().equals(auditStatus)){ + String auditDataIdList = dataRelevance.getAuditDataIdList(); + // 如果是审核的第一个数据,更新关联数据中上报数据列表 + if (StringUtils.isBlank(auditDataIdList)){ + List auditIdList = Lists.newArrayList(); + auditIdList.add(auditDataId); + String idListStr = auditIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + dataRelevance.setAuditDataIdList(idListStr); + } + // 如果审核的不是第一个数据,更新关联数据中上报数据列表 + else { + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!idList.contains(auditDataId)){ + idList.add(auditDataId); + String idListStr = idList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + dataRelevance.setAuditDataIdList(idListStr); + } + } + } + // 如果登录用户是市级散办,更新关联数据审核状态为未上报,更新关联表中数据的最近一次更新时间和关联数据ID列表 + if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())){ + dataRelevance.setLastUpdateTime(LocalDateTime.now()); + dataRelevance.setAuditStatus(DataUploadAuditStatusEnum.NOT_REPORT.getCode()); + } + // 如果登录用户是省散办,审核状态设置为审核通过 + else if (UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId()) || + UserRoleTypeEnum.SYSTEM_ROLE_ID.getId().equals(userDetail.getRoleId())) { + dataRelevance.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + // 市级关联数据也要更新状态为审核通过 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(auditDataId); + cityRelevanceData.setAuditStatus(auditStatus); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setLastUpdateTime(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(userDetail.getUserId()); + dataRelevanceService.updateById(cityRelevanceData); + } + dataRelevance.setUpdateOn(LocalDateTime.now()); + dataRelevance.setUpdateBy(userDetail.getUserId()); + dataRelevanceService.updateById(dataRelevance); + return "审核成功!"; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildAuditRecordQuery(LambdaQueryWrapper wrapper, Long auditRecordId) { + wrapper.eq(BulkCementDirectReportSystemAuditRecord::getId,auditRecordId); + } + + public PageVo dataQueryList(ReqDataUploadListPO req) { + + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Integer pageNumber = req.getPageNumber(); + Integer pageSize = req.getPageSize(); + + Long regionId; + if (UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId()) || + UserRoleTypeEnum.SYSTEM_ROLE_ID.getId().equals(userDetail.getRoleId())){ + regionId = DefValConstants.ZJREGION_ID; + }else { + regionId = userDetail.getRegionId(); + } + + // 市级散办和省散办账号有该列表权限 + // 根据所属区域查出对应数据类型的上报记录 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class); + + // 获取入参 + LocalDateTime reportStartMonth = req.getReportStartMonth(); + Integer reportStartYear = req.getReportStartYear(); + LocalDateTime reportEndMonth = req.getReportEndMonth(); + Integer reportEndYear = req.getReportEndYear(); + Integer auditStatus = req.getAuditStatus(); + Integer auditDataType = req.getAuditDataType(); + VUtils.isTrue(Objects.isNull(auditDataType)).throwMessage("请传入审核数据类型!"); + wrapper.ge(Objects.nonNull(reportStartMonth), BulkCementDirectReportSystemDataRelevance::getReportMonth, reportStartMonth) + .le(Objects.nonNull(reportEndMonth), BulkCementDirectReportSystemDataRelevance::getReportMonth, reportEndMonth) + .ge(Objects.nonNull(reportStartYear), BulkCementDirectReportSystemDataRelevance::getReportYear, reportStartYear) + .le(Objects.nonNull(reportEndYear), BulkCementDirectReportSystemDataRelevance::getReportYear, reportEndYear) + .eq(Objects.nonNull(auditStatus),BulkCementDirectReportSystemDataRelevance::getAuditStatus,auditStatus) + // 其中市级关联数据对应的数据ID列表为对应上报数据的ID + // 省级关联数据对应的数据ID列表为各市级关联数据的ID + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType,auditDataType) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId,regionId) + .orderByDesc(BulkCementDirectReportSystemDataRelevance::getReportMonth); + List list = dataRelevanceService.list(wrapper); + if (CollUtil.isEmpty(list)){ + return PageVo.empty(); + } + // 获取审核信息 + List auditInfoIdList = list.stream().map(BulkCementDirectReportSystemDataRelevance::getAuditInfoId).collect(Collectors.toList()); + Map auditInfoMap = auditInfoService.list(Wrappers.lambdaQuery(BulkCementDirectReportSystemAuditInfo.class).in(BulkCementDirectReportSystemAuditInfo::getId, auditInfoIdList)) + .stream().collect(Collectors.toMap(BulkCementDirectReportSystemAuditInfo::getId, v -> v)); + // 获取关联数据信息 + Map dataRelevanceMap = dataRelevanceService.list(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .select(BulkCementDirectReportSystemDataRelevance::getId,BulkCementDirectReportSystemDataRelevance::getAuditStatus, BulkCementDirectReportSystemDataRelevance::getAuditDataIdList)) + .stream().collect(Collectors.toMap(BulkCementDirectReportSystemDataRelevance::getId, v -> v)); + List resVos = list.stream().map(r -> { + ResDataQueryListVO vo = new ResDataQueryListVO(); + LocalDateTime month = r.getReportMonth(); + if (Objects.nonNull(month)) { + String reportMonthStr = NdDateUtils.format(month, NdDateUtils.DEFAULT_MONTH_FORMAT_EN); + LocalDateTime reportMonth = LocalDateTimeUtil.parse(reportMonthStr, DateTimeFormatter.ofPattern(NdDateUtils.DEFAULT_MONTH_FORMAT_EN)); + vo.setReportMonth(reportMonth); + } + vo.setReportYear(r.getReportYear()); + vo.setRegionId(r.getRegionId()); + vo.setRelevanceDataId(r.getId()); + + String auditDataIdList = r.getAuditDataIdList(); + if (StringUtils.isNotBlank(auditDataIdList)) { + List idList = Lists.newArrayList(); + Map> dataIdListMap = MapUtil.newHashMap(); + // 如果登录用户为市级散办或者查询列表为温台舟使用量列表,直接得到所属各区县(三 市)上报数据的ID列表 + // 注意:此处审核数据类型如果为散装水泥物流设施统计年报或者散装水泥、预拌混凝土、干混砂浆物流装备统计年报数据 + // 实际上auditDataIdList中存放的是各区县关联数据ID + if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + } + // 如果登录用户为省级散办,先得到各所属市关联的数据ID列表,再得出各市所属各区县上报数据的ID列表 + else if (UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId()) || + UserRoleTypeEnum.SYSTEM_ROLE_ID.getId().equals(userDetail.getRoleId())) { + List relevanceIdList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + for (Long relevanceId : relevanceIdList) { + BulkCementDirectReportSystemDataRelevance dataRelevance = dataRelevanceMap.get(relevanceId); + if (Objects.nonNull(dataRelevance) && StringUtils.isNotBlank(dataRelevance.getAuditDataIdList())) { + String dataIdList = dataRelevance.getAuditDataIdList(); + List ids = Arrays.stream(dataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + // 筛选出所有已经审核通过的关联上报数据 + if (DataUploadAuditStatusEnum.AUDIT_PASS.getCode().equals(dataRelevance.getAuditStatus())){ + // 一对多的关系 + dataIdListMap.put(relevanceId, ids); + } + } + } + } + vo.setAuditDataIdList(idList); + vo.setAuditDataIdListMap(dataIdListMap); + } + BulkCementDirectReportSystemAuditInfo auditInfo = auditInfoMap.get(r.getAuditInfoId()); + if (Objects.nonNull(auditInfo)) { + vo.setAuditOpinion(auditInfo.getAuditOpinion()); + vo.setAuditInfoId(auditInfo.getId()); + } + vo.setAuditStatus(r.getAuditStatus()); + String desc = DataUploadAuditStatusEnum.getDescByCode(r.getAuditStatus()); + vo.setAuditStatusName(desc); + vo.setCreateOn(r.getCreateOn()); + vo.setUpdateTime(r.getUpdateOn()); + return vo; + }).collect(Collectors.toList()); + List result; + List dataList = Lists.newArrayList(); + // 省级账号 过滤掉没有数据的记录 + if (UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId()) || + UserRoleTypeEnum.SYSTEM_ROLE_ID.getId().equals(userDetail.getRoleId())){ + dataList = resVos.stream().filter(r -> CollUtil.isNotEmpty(r.getAuditDataIdListMap())).collect(Collectors.toList()); + result = dataList.stream().skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize).collect(Collectors.toList()); + }else { + result = resVos; + } + + return PageVo.of(result, dataList.size()); + } + + public ResDataQueryDetailVO uploadDataQueryDetail(ReqDataUploadListPO req) { + + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + + List auditDataIdList = req.getAuditDataIdList(); + Map> auditDataIdListMap = req.getAuditDataIdListMap(); + Integer auditDataType = req.getAuditDataType(); + LocalDateTime reportMonth = req.getReportMonth(); + Integer reportYear = req.getReportYear(); + Long regionId = req.getRegionId(); + + // 判断传入的区域ID是否在登录用户所属的区域权限内 + Long userDetailRegionId = userDetail.getRegionId(); + List listChildRegionId = regionsCacheHelper.listChildRegionId(userDetailRegionId, true, false); + if (!listChildRegionId.contains(userDetailRegionId)){ + throw new BizException("您无权查看该地区数据!"); + } + + Integer queryType = req.getQueryType(); + if (Objects.isNull(regionId)){ + if (UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId()) || + UserRoleTypeEnum.SYSTEM_ROLE_ID.getId().equals(userDetail.getRoleId())){ + regionId = DefValConstants.ZJREGION_ID; + }else { + regionId = userDetail.getRegionId(); + } + } + ResDataQueryDetailVO vo = new ResDataQueryDetailVO(); + vo.setReportMonth(reportMonth); + vo.setReportYear(reportYear); + // 根据登录用户角色判断应当返回的数据 + // 如果登录用户是市级散办,返回所属各区县上报的对应类型的数据 + if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())){ + if (CollUtil.isEmpty(auditDataIdList)){ + return vo; + } + Map dataMap = MapUtil.newHashMap(); + // 获取所属区县上报已审核通过的对应类型的数据 + Long companyId = userDetail.getCompanyId(); + getDataMap(auditDataIdList, auditDataType, companyId, dataMap, Boolean.FALSE, reportMonth,regionId,queryType); + assemblyDetailVO(auditDataType, vo, dataMap, Boolean.FALSE, reportMonth,regionId,reportYear,queryType,userDetail); + } + // 如果登录用户是省散办,返回所属各市上报的对应类型的数据 + else if (UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId()) || + UserRoleTypeEnum.SYSTEM_ROLE_ID.getId().equals(userDetail.getRoleId())) { + if (CollUtil.isNotEmpty(auditDataIdListMap)) { + Map dataMap = MapUtil.newHashMap(); + Set relevanceIds = auditDataIdListMap.keySet(); + Map dataRelevanceMap = dataRelevanceService.list(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .in(BulkCementDirectReportSystemDataRelevance::getId, relevanceIds)) + .stream().collect(Collectors.toMap(BulkCementDirectReportSystemDataRelevance::getId, v -> v)); + for (Long relevanceId : relevanceIds) { + BulkCementDirectReportSystemDataRelevance dataRelevance = dataRelevanceMap.get(relevanceId); + if (Objects.nonNull(dataRelevance)){ + List idList = auditDataIdListMap.get(relevanceId); + Long companyId = dataRelevance.getCompanyId(); + Long relevanceRegionId = dataRelevance.getRegionId(); + Map tempDataMap = MapUtil.newHashMap(); + if (UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode().equals(auditDataType) || + UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode().equals(auditDataType)){ + getDataMap(idList, auditDataType, companyId, tempDataMap, Boolean.TRUE, reportMonth, relevanceRegionId, queryType); + for (Map.Entry entry : tempDataMap.entrySet()) { + // key为发放库、中转库、固定接收库 + String key = entry.getKey(); + Map mapValue = (Map) entry.getValue(); + Map value = (Map) dataMap.get(key); + if (Objects.nonNull(value)){ + for (Map.Entry objectEntry : mapValue.entrySet()) { + // key为各市散装中心名称 + String entryKey = objectEntry.getKey(); + Object valueList = objectEntry.getValue(); + value.put(entryKey, valueList); + } + }else { + dataMap.put(key,mapValue); + } + } + }else { + getDataMap(idList, auditDataType, companyId, dataMap, Boolean.TRUE, reportMonth, relevanceRegionId, queryType); + } + } + } + assemblyDetailVO(auditDataType,vo,dataMap,Boolean.TRUE, reportMonth, regionId, reportYear, queryType, userDetail); + } + } + return vo; + } + + private void assemblyDetailVO(Integer auditDataType, ResDataQueryDetailVO vo, Map dataMap, Boolean flag, LocalDateTime reportMonth, Long regionId, Integer reportYear, Integer queryType, UserInfoDetails userDetail) { + + switch (auditDataType) { + // 散装水泥供应量数据 + case 1: + ResBulkCementSupplyDataQueryDetailVO bulkCementSupplyDataQueryDetailVo = new ResBulkCementSupplyDataQueryDetailVO(); + getBulkCementSupplyDataQueryDetailVo(dataMap, flag, reportMonth, bulkCementSupplyDataQueryDetailVo,regionId); + // 返回单位信息 + // 如果是审核列表查询,登录用户是市散办,查询的是具体区县的详情,如果是12月的数据,要返回单位信息 + if (QueryTypeEnum.AUDIT_LIST.getCode().equals(queryType) && + userDetail.getRoleId().equals(UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId()) && + reportMonth.getMonthValue() == ReportConstant.TWELVE){ + BulkCementSupplyBulletin bulkCementSupplyBulletin = bulkCementSupplyBulletinService.getOne(Wrappers.lambdaQuery(BulkCementSupplyBulletin.class) + .eq(BulkCementSupplyBulletin::getReportMonth, reportMonth) + .eq(BulkCementSupplyBulletin::getRegionId, regionId)); + if (Objects.nonNull(bulkCementSupplyBulletin)){ + bulkCementSupplyDataQueryDetailVo.setUnitResponsiblePerson(bulkCementSupplyBulletin.getUnitResponsiblePerson()); + bulkCementSupplyDataQueryDetailVo.setPreparer(bulkCementSupplyBulletin.getPreparer()); + bulkCementSupplyDataQueryDetailVo.setReviewer(bulkCementSupplyBulletin.getReviewer()); + LocalDateTime submissionDate = bulkCementSupplyBulletin.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + bulkCementSupplyDataQueryDetailVo.setSubmissionDate(submitDate); + } + } + // 否则省审核、市/省查询列表查询,返回登录用户所在市/省关联数据的单位信息 + else { + BulkCementDirectReportSystemDataRelevance dataRelevance1 = + dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, + UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId)); + if (Objects.nonNull(dataRelevance1)) { + bulkCementSupplyDataQueryDetailVo.setUnitResponsiblePerson(dataRelevance1.getUnitResponsiblePerson()); + bulkCementSupplyDataQueryDetailVo.setPreparer(dataRelevance1.getPreparer()); + bulkCementSupplyDataQueryDetailVo.setReviewer(dataRelevance1.getReviewer()); + LocalDateTime submissionDate = dataRelevance1.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, + DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + bulkCementSupplyDataQueryDetailVo.setSubmissionDate(submitDate); + } + } + vo.setBulkCementSupplyDataVo(bulkCementSupplyDataQueryDetailVo); + break; + // 中转库进出量统计数据 + case 2: + ResBulkCementTransferDataQueryDetailVO bulkCementTransferDataQueryDetailVo = new ResBulkCementTransferDataQueryDetailVO(); + getBulkCementTransferDataQueryDetailVo(dataMap, flag,reportMonth,bulkCementTransferDataQueryDetailVo,regionId); + // 返回单位信息 + // 如果是审核列表查询,查询的是具体区县的详情,如果是12月的数据,要返回单位信息 + if (QueryTypeEnum.AUDIT_LIST.getCode().equals(queryType) && + userDetail.getRoleId().equals(UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId()) && reportMonth.getMonthValue() == ReportConstant.TWELVE){ + BulkCementTransferBulletin bulkCementTransferBulletin = bulkCementTransferBulletinService.getOne(Wrappers.lambdaQuery(BulkCementTransferBulletin.class) + .eq(BulkCementTransferBulletin::getReportMonth, reportMonth) + .eq(BulkCementTransferBulletin::getRegionId, regionId)); + if (Objects.nonNull(bulkCementTransferBulletin)){ + bulkCementTransferDataQueryDetailVo.setUnitResponsiblePerson(bulkCementTransferBulletin.getUnitResponsiblePerson()); + bulkCementTransferDataQueryDetailVo.setPreparer(bulkCementTransferBulletin.getPreparer()); + bulkCementTransferDataQueryDetailVo.setReviewer(bulkCementTransferBulletin.getReviewer()); + LocalDateTime submissionDate = bulkCementTransferBulletin.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + bulkCementTransferDataQueryDetailVo.setSubmissionDate(submitDate); + } + } + // 否则省审核、市/省查询列表查询,返回登录用户所在市/省关联数据的单位信息 + else { + BulkCementDirectReportSystemDataRelevance dataRelevance2 = + dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, + UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId)); + if (Objects.nonNull(dataRelevance2)) { + bulkCementTransferDataQueryDetailVo.setUnitResponsiblePerson(dataRelevance2.getUnitResponsiblePerson()); + bulkCementTransferDataQueryDetailVo.setPreparer(dataRelevance2.getPreparer()); + bulkCementTransferDataQueryDetailVo.setReviewer(dataRelevance2.getReviewer()); + LocalDateTime submissionDate = dataRelevance2.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, + DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + bulkCementTransferDataQueryDetailVo.setSubmissionDate(submitDate); + } + } + vo.setBulkCementTransferDataVo(bulkCementTransferDataQueryDetailVo); + break; + // 温台舟使用量快报数据 + case 3: + ResBulkCementThreeCityUsageDataQueryDetailVO bulkCementThreeCityUsageDataQueryDetailVO = new ResBulkCementThreeCityUsageDataQueryDetailVO(); + getBulkCementThreeCityUsageDataQueryDetailVo(dataMap,reportMonth, bulkCementThreeCityUsageDataQueryDetailVO,regionId); + // 返回单位信息 + // 如果是审核列表查询,查询的是具体区县的详情,如果是12月的数据,要返回单位信息 + if (QueryTypeEnum.AUDIT_LIST.getCode().equals(queryType) && + userDetail.getRoleId().equals(UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId()) && reportMonth.getMonthValue() == ReportConstant.TWELVE){ + BulkCementThreeCityUsageBulletin bulkCementThreeCityUsageBulletin = bulkCementThreeCityUsageBulletinService.getOne(Wrappers.lambdaQuery(BulkCementThreeCityUsageBulletin.class) + .eq(BulkCementThreeCityUsageBulletin::getReportMonth, reportMonth) + .eq(BulkCementThreeCityUsageBulletin::getRegionId, regionId)); + if (Objects.nonNull(bulkCementThreeCityUsageBulletin)){ + bulkCementThreeCityUsageDataQueryDetailVO.setUnitResponsiblePerson(bulkCementThreeCityUsageBulletin.getUnitResponsiblePerson()); + bulkCementThreeCityUsageDataQueryDetailVO.setPreparer(bulkCementThreeCityUsageBulletin.getPreparer()); + bulkCementThreeCityUsageDataQueryDetailVO.setReviewer(bulkCementThreeCityUsageBulletin.getReviewer()); + LocalDateTime submissionDate = bulkCementThreeCityUsageBulletin.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + bulkCementThreeCityUsageDataQueryDetailVO.setSubmissionDate(submitDate); + } + } + // 否则省审核、市/省查询列表查询,返回登录用户所在市/省关联数据的单位信息 + else { + BulkCementDirectReportSystemDataRelevance dataRelevance3 = + dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, + UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId)); + if (Objects.nonNull(dataRelevance3)) { + bulkCementThreeCityUsageDataQueryDetailVO.setUnitResponsiblePerson(dataRelevance3.getUnitResponsiblePerson()); + bulkCementThreeCityUsageDataQueryDetailVO.setPreparer(dataRelevance3.getPreparer()); + bulkCementThreeCityUsageDataQueryDetailVO.setReviewer(dataRelevance3.getReviewer()); + LocalDateTime submissionDate = dataRelevance3.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, + DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + bulkCementThreeCityUsageDataQueryDetailVO.setSubmissionDate(submitDate); + } + } + vo.setBulkCementThreeCityUsageDataVo(bulkCementThreeCityUsageDataQueryDetailVO); + break; + // 混凝土供应量快报数据 + case 4: + ResConcreteSupplyDataQueryDetailVO concreteSupplyDataQueryDetailVO = new ResConcreteSupplyDataQueryDetailVO(); + getConcreteSupplyDataQueryDetailVo(dataMap, flag, reportMonth, concreteSupplyDataQueryDetailVO, regionId); + // 返回单位信息 + // 如果是审核列表查询,查询的是具体区县的详情,如果是12月的数据,要返回单位信息 + if (QueryTypeEnum.AUDIT_LIST.getCode().equals(queryType) && + userDetail.getRoleId().equals(UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId()) && reportMonth.getMonthValue() == ReportConstant.TWELVE){ + ConcreteSupplyBulletin concreteSupplyBulletin = concreteSupplyBulletinService.getOne(Wrappers.lambdaQuery(ConcreteSupplyBulletin.class) + .eq(ConcreteSupplyBulletin::getReportMonth, reportMonth) + .eq(ConcreteSupplyBulletin::getRegionId, regionId)); + if (Objects.nonNull(concreteSupplyBulletin)){ + concreteSupplyDataQueryDetailVO.setUnitResponsiblePerson(concreteSupplyBulletin.getUnitResponsiblePerson()); + concreteSupplyDataQueryDetailVO.setPreparer(concreteSupplyBulletin.getPreparer()); + concreteSupplyDataQueryDetailVO.setReviewer(concreteSupplyBulletin.getReviewer()); + LocalDateTime submissionDate = concreteSupplyBulletin.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + concreteSupplyDataQueryDetailVO.setSubmissionDate(submitDate); + } + } + // 否则省审核、市/省查询列表查询,返回登录用户所在市/省关联数据的单位信息 + else { + BulkCementDirectReportSystemDataRelevance dataRelevance4 = + dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, + UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId)); + if (Objects.nonNull(dataRelevance4)) { + concreteSupplyDataQueryDetailVO.setUnitResponsiblePerson(dataRelevance4.getUnitResponsiblePerson()); + concreteSupplyDataQueryDetailVO.setPreparer(dataRelevance4.getPreparer()); + concreteSupplyDataQueryDetailVO.setReviewer(dataRelevance4.getReviewer()); + LocalDateTime submissionDate = dataRelevance4.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, + DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + concreteSupplyDataQueryDetailVO.setSubmissionDate(submitDate); + } + } + vo.setConcreteSupplyDataVo(concreteSupplyDataQueryDetailVO); + break; + // 砂浆供应量快报数据 + case 5: + ResMortarSupplyDataQueryDetailVO mortarSupplyDataQueryDetailVO = new ResMortarSupplyDataQueryDetailVO(); + getMortarSupplyDataQueryDetailVo(dataMap, flag, reportMonth, mortarSupplyDataQueryDetailVO,regionId); + // 返回单位信息 + // 如果是审核列表查询,查询的是具体区县的详情,如果是12月的数据,要返回单位信息 + if (QueryTypeEnum.AUDIT_LIST.getCode().equals(queryType) && + userDetail.getRoleId().equals(UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId()) && reportMonth.getMonthValue() == ReportConstant.TWELVE){ + MortarSupplyBulletin mortarSupplyBulletin = mortarSupplyBulletinService.getOne(Wrappers.lambdaQuery(MortarSupplyBulletin.class) + .eq(MortarSupplyBulletin::getReportMonth, reportMonth) + .eq(MortarSupplyBulletin::getRegionId, regionId)); + if (Objects.nonNull(mortarSupplyBulletin)){ + mortarSupplyDataQueryDetailVO.setUnitResponsiblePerson(mortarSupplyBulletin.getUnitResponsiblePerson()); + mortarSupplyDataQueryDetailVO.setPreparer(mortarSupplyBulletin.getPreparer()); + mortarSupplyDataQueryDetailVO.setReviewer(mortarSupplyBulletin.getReviewer()); + LocalDateTime submissionDate = mortarSupplyBulletin.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + mortarSupplyDataQueryDetailVO.setSubmissionDate(submitDate); + } + } + // 否则省审核、市/省查询列表查询,返回登录用户所在市/省关联数据的单位信息 + else { + BulkCementDirectReportSystemDataRelevance dataRelevance5 = + dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, + UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId)); + if (Objects.nonNull(dataRelevance5)) { + mortarSupplyDataQueryDetailVO.setUnitResponsiblePerson(dataRelevance5.getUnitResponsiblePerson()); + mortarSupplyDataQueryDetailVO.setPreparer(dataRelevance5.getPreparer()); + mortarSupplyDataQueryDetailVO.setReviewer(dataRelevance5.getReviewer()); + LocalDateTime submissionDate = dataRelevance5.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, + DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + mortarSupplyDataQueryDetailVO.setSubmissionDate(submitDate); + } + } + vo.setMortarSupplyDataVo(mortarSupplyDataQueryDetailVO); + break; + // 非禁现区域散装水泥销售使用情况数据 + case 6: + ResNonProhibitedAreasDataQueryDetailVO nonProhibitedAreasDataQueryDetailVO = new ResNonProhibitedAreasDataQueryDetailVO(); + getNonProAreasDataQueryDetailVo(dataMap,reportYear, nonProhibitedAreasDataQueryDetailVO,regionId); + // 返回单位信息 + // 如果是审核列表查询,查询的是具体区县的详情 + if (QueryTypeEnum.AUDIT_LIST.getCode().equals(queryType) && + userDetail.getRoleId().equals(UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId())){ + NonProhibitedAreasBulkCementSalesUse nonProhibitedAreasBulkCementSalesUse = nonProhibitedAreasBulkCementSalesUseService.getOne(Wrappers.lambdaQuery(NonProhibitedAreasBulkCementSalesUse.class) + .eq(NonProhibitedAreasBulkCementSalesUse::getReportYear, reportYear) + .eq(NonProhibitedAreasBulkCementSalesUse::getRegionId, regionId)); + if (Objects.nonNull(nonProhibitedAreasBulkCementSalesUse)){ + nonProhibitedAreasDataQueryDetailVO.setUnitResponsiblePerson(nonProhibitedAreasBulkCementSalesUse.getUnitResponsiblePerson()); + nonProhibitedAreasDataQueryDetailVO.setPreparer(nonProhibitedAreasBulkCementSalesUse.getPreparer()); + nonProhibitedAreasDataQueryDetailVO.setReviewer(nonProhibitedAreasBulkCementSalesUse.getReviewer()); + LocalDateTime submissionDate = nonProhibitedAreasBulkCementSalesUse.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + nonProhibitedAreasDataQueryDetailVO.setSubmissionDate(submitDate); + nonProhibitedAreasDataQueryDetailVO.setRemark(nonProhibitedAreasBulkCementSalesUse.getRemark()); + } + } + // 否则省审核、市/省查询列表查询,返回登录用户所在市/省关联数据的单位信息 + else { + BulkCementDirectReportSystemDataRelevance dataRelevance6 = + dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, reportYear) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, + UploadDataTypeEnum.NON_PROHIBITED_AREAS_BULK_CEMENT_SALES_USE.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId)); + if (Objects.nonNull(dataRelevance6)) { + nonProhibitedAreasDataQueryDetailVO.setUnitResponsiblePerson(dataRelevance6.getUnitResponsiblePerson()); + nonProhibitedAreasDataQueryDetailVO.setPreparer(dataRelevance6.getPreparer()); + nonProhibitedAreasDataQueryDetailVO.setReviewer(dataRelevance6.getReviewer()); + LocalDateTime submissionDate = dataRelevance6.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, + DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + nonProhibitedAreasDataQueryDetailVO.setSubmissionDate(submitDate); + } + } + vo.setNonProAreasDataVo(nonProhibitedAreasDataQueryDetailVO); + break; + // 散装水泥物流设施统计年报表数据 + case 7: + ResBulkCementLogFacStaDataQueryVO bulkCementLogFacStaDataQueryVo = new ResBulkCementLogFacStaDataQueryVO(); + Map resMap1 = MapUtil.newHashMap(); + // map中是三种设备名称对应的数据集合 + for (Map.Entry entry : dataMap.entrySet()) { + Map map = (Map) entry.getValue(); + String key = entry.getKey(); + ResBulkCementLogFacStaDataQueryDetailVO bulkCementLogFacStaDataQueryDetailVO = new ResBulkCementLogFacStaDataQueryDetailVO(); + getBulkCementLogFacStaDataQueryDetailVo(key, map,reportYear, bulkCementLogFacStaDataQueryDetailVO,regionId); + resMap1.put(key,bulkCementLogFacStaDataQueryDetailVO); + } + bulkCementLogFacStaDataQueryVo.setBulkCementLogFacStaDataMap(resMap1); + // 返回单位信息 + BulkCementDirectReportSystemDataRelevance dataRelevance7 = + dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, reportYear) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, + UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId)); + if (Objects.nonNull(dataRelevance7)) { + bulkCementLogFacStaDataQueryVo.setUnitResponsiblePerson(dataRelevance7.getUnitResponsiblePerson()); + bulkCementLogFacStaDataQueryVo.setPreparer(dataRelevance7.getPreparer()); + bulkCementLogFacStaDataQueryVo.setReviewer(dataRelevance7.getReviewer()); + LocalDateTime submissionDate = dataRelevance7.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, + DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + bulkCementLogFacStaDataQueryVo.setSubmissionDate(submitDate); + } + vo.setBulkCementLogFacStaDataVo(bulkCementLogFacStaDataQueryVo); + break; + // 散装水泥、预拌砂浆、干混砂浆物流装备统计年报表数据 + case 8: + ResMaterialLogEquipStaDataQueryVO materialLogEquipStaDataQueryVo = new ResMaterialLogEquipStaDataQueryVO(); + Map resMap2 = MapUtil.newHashMap(); + // map中是八种设备名称对应的数据集合 + for (Map.Entry entry : dataMap.entrySet()) { + Map map = (Map) entry.getValue(); + String key = entry.getKey(); + ResMaterialLogEquipStaDataQueryDetailVO materialLogEquipStaDataQueryDetailVO = new ResMaterialLogEquipStaDataQueryDetailVO(); + getMaterialLogEquipStaDataQueryDetailVo(key, map,reportYear, materialLogEquipStaDataQueryDetailVO,regionId); + resMap2.put(key,materialLogEquipStaDataQueryDetailVO); + } + // 返回单位信息 + BulkCementDirectReportSystemDataRelevance dataRelevance8 = + dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, reportYear) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, + UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId)); + if (Objects.nonNull(dataRelevance8)) { + materialLogEquipStaDataQueryVo.setUnitResponsiblePerson(dataRelevance8.getUnitResponsiblePerson()); + materialLogEquipStaDataQueryVo.setPreparer(dataRelevance8.getPreparer()); + materialLogEquipStaDataQueryVo.setReviewer(dataRelevance8.getReviewer()); + LocalDateTime submissionDate = dataRelevance8.getSubmissionDate(); + String submissionDateStr = NdDateUtils.format(submissionDate, DatePattern.CHINESE_DATE_PATTERN); + LocalDateTime submitDate = LocalDateTimeUtil.parse(submissionDateStr, + DateTimeFormatter.ofPattern(DatePattern.CHINESE_DATE_PATTERN)); + materialLogEquipStaDataQueryVo.setSubmissionDate(submitDate); + } + materialLogEquipStaDataQueryVo.setMaterialLogEquipStaDataMap(resMap2); + vo.setMaterialLogEquipStaDataVo(materialLogEquipStaDataQueryVo); + break; + default: + throw new IllegalStateException("Unexpected value: " + auditDataType); + } + } + + private void getBulkCementSupplyDataQueryDetailVo(Map dataMap, Boolean flag, LocalDateTime reportMonth, ResBulkCementSupplyDataQueryDetailVO bulkCementSupplyDataQueryDetailVo, Long regionId) { + // 统计各字段合计值 + // 合计散装水泥总量 + List bulkCementAmountTotalList = Lists.newArrayList(); + // 合计水泥产量 + List cementOutputTotalList = Lists.newArrayList(); + // 合计完成量 + List completedAmountTotalList = Lists.newArrayList(); + // 合计水泥产量 + List cumulativeCementProductionTotalList = Lists.newArrayList(); + // 合计增加量 + List incrementTotalList = Lists.newArrayList(); + // 去年这个月的合计完成量 + List preYearCompletedAmountTotalList = Lists.newArrayList(); + + // 对于市级散办,map中只有一个键值对,统计的是该市各区县对应字段的集合 + // 对于省散办,map中对应各市键值对,统计的是各个市下各区县对应字段的集合 + for (Map.Entry entry : dataMap.entrySet()) { + List value = (List)entry.getValue(); + // 筛选出为市合计数据的那条记录(市散办有一条、省散办中有多个) + List totalDataList = value.stream().filter(v -> Boolean.TRUE.equals(v.getIsCityTotalData())).collect(Collectors.toList()); + // 散装水泥总量 + List data1List = totalDataList.stream().map(ResBulkCementSupplyDataUploadDetailVO::getBulkCementAmountTotal).collect(Collectors.toList()); + bulkCementAmountTotalList.addAll(data1List); + // 水泥产量 + List data2List = totalDataList.stream().map(ResBulkCementSupplyDataUploadDetailVO::getCementOutputTotal).collect(Collectors.toList()); + cementOutputTotalList.addAll(data2List); + // 完成量 + List data3List = totalDataList.stream().map(ResBulkCementSupplyDataUploadDetailVO::getCompletedTotalAmountTotal).collect(Collectors.toList()); + completedAmountTotalList.addAll(data3List); + // 水泥产量 + List data4List = totalDataList.stream().map(ResBulkCementSupplyDataUploadDetailVO::getCumulativeCementProductionTotal).collect(Collectors.toList()); + cumulativeCementProductionTotalList.addAll(data4List); + // 增加量 + List data5List = totalDataList.stream().map(ResBulkCementSupplyDataUploadDetailVO::getIncrementTotal).collect(Collectors.toList()); + incrementTotalList.addAll(data5List); + // 去年这个月的合计完成量 + List data6List = totalDataList.stream().map(v -> { + BigDecimal increaseRate = v.getIncreaseRateTotal(); + BigDecimal increment = v.getIncrementTotal(); + if (Objects.nonNull(increaseRate) && Objects.nonNull(increment)) { + if (BigDecimal.ZERO.compareTo(increaseRate) != 0) { + return increment.divide(increaseRate, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + } + } + return BigDecimal.ZERO; + }).collect(Collectors.toList()); + preYearCompletedAmountTotalList.addAll(data6List); + } + List totalValues = Lists.newArrayList(); + ResBulkCementSupplyDataUploadDetailVO totalVo = new ResBulkCementSupplyDataUploadDetailVO(); + // 合计散装水泥总量 + BigDecimal bulkCementAmountTotal = bulkCementAmountTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setBulkCementAmount(bulkCementAmountTotal); + // 合计水泥产量 + BigDecimal cementOutputTotal = cementOutputTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setCementOutput(cementOutputTotal); + // 合计完成量 + BigDecimal completedAmountTotal = completedAmountTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setCompletedTotalAmount(completedAmountTotal); + // 合计水泥产量 + BigDecimal cumulativeCementProductionTotal = cumulativeCementProductionTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setCumulativeCementProduction(cumulativeCementProductionTotal); + // 合计增加量 + BigDecimal incrementTotal = incrementTotalList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setIncrement(incrementTotal); + // 合计散装率: 合计完成量 / 合计水泥产量 * 100 + BigDecimal bulkRateTotal; + if (BigDecimal.ZERO.compareTo(cumulativeCementProductionTotal) != 0) { + bulkRateTotal = completedAmountTotal.divide(cumulativeCementProductionTotal, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + }else { + bulkRateTotal = BigDecimal.ZERO; + } + totalVo.setBulkRate(bulkRateTotal); + // 合计增长率:合计增长量 / 去年这个月的合计完成量 * 100 + BigDecimal increaseRateTotal; + BigDecimal preYearCompletedAmountTotal = preYearCompletedAmountTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + if (BigDecimal.ZERO.compareTo(preYearCompletedAmountTotal) != 0) { + increaseRateTotal = incrementTotal.divide(preYearCompletedAmountTotal, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + }else { + increaseRateTotal = incrementTotal.multiply(BigDecimal.valueOf(100L)); + } + totalVo.setIncreaseRate(increaseRateTotal); + // 合计散装率目标 + // 如果是省散办查询详情 + if (Boolean.TRUE.equals(flag)) { + int year = reportMonth.getYear(); + BulkCementDirectReportSystemUniversalIndex universalIndex = universalIndexService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemUniversalIndex.class) + .eq(BulkCementDirectReportSystemUniversalIndex::getYear, year) + .eq(BulkCementDirectReportSystemUniversalIndex::getRegionId, DefValConstants.ZJREGION_ID)); + if (Objects.nonNull(universalIndex)){ + totalVo.setBulkRateTarget(universalIndex.getBulkRateTarget()); + } + } + totalVo.setUnitName(ReportConstant.TOTAL); + totalValues.add(totalVo); + dataMap.put(ReportConstant.TOTAL,totalValues); + bulkCementSupplyDataQueryDetailVo.setBulkCementSupplyDataMap(dataMap); + } + + private void getBulkCementTransferDataQueryDetailVo(Map dataMap, Boolean flag, LocalDateTime reportMonth, ResBulkCementTransferDataQueryDetailVO bulkCementTransferDataQueryDetailVo, Long regionId) { + // 统计各字段合计值 + // 合计上月末库存 + List lastMonthEndInventoryTotalList = Lists.newArrayList(); + // 合计本月进库量 + List thisMonthIncomingStorageTotalList = Lists.newArrayList(); + // 合计累计进库量 + List cumulativeIncomingStorageTotalList = Lists.newArrayList(); + // 合计本月出库量 + List thisMonthOutgoingStorageTotalList = Lists.newArrayList(); + // 合计累计出库量 + List cumulativeOutgoingStorageTotalList = Lists.newArrayList(); + // 合计月末库存量 + List monthEndInventoryTotalList = Lists.newArrayList(); + + // 去年这个月的合计库存量 + List preYearMonthEndInventoryTotalList = Lists.newArrayList(); + + // 对于市级散办,map中只有一个键值对,统计的是该市各区县对应字段的集合 + // 对于省散办,map中对应各市键值对,统计的是各个市下各区县对应字段的集合 + for (Map.Entry entry : dataMap.entrySet()) { + List value = (List)entry.getValue(); + // 筛选出为市合计数据的那条记录(市散办有一条、省散办中有多个) + List totalDataList = value.stream().filter(v -> Boolean.TRUE.equals(v.getIsCityTotalData())).collect(Collectors.toList()); + // 上月末库存 + List data1List = totalDataList.stream().map(ResBulkCementTransferDataUploadDetailVO::getLastMonthEndInventoryTotal).collect(Collectors.toList()); + lastMonthEndInventoryTotalList.addAll(data1List); + // 本月进库量 + List data2List = totalDataList.stream().map(ResBulkCementTransferDataUploadDetailVO::getThisMonthIncomingStorageTotal).collect(Collectors.toList()); + thisMonthIncomingStorageTotalList.addAll(data2List); + // 累计进库量 + List data3List = totalDataList.stream().map(ResBulkCementTransferDataUploadDetailVO::getCumulativeIncomingStorageTotal).collect(Collectors.toList()); + cumulativeIncomingStorageTotalList.addAll(data3List); + // 本月出库量 + List data4List = totalDataList.stream().map(ResBulkCementTransferDataUploadDetailVO::getThisMonthOutgoingStorageTotal).collect(Collectors.toList()); + thisMonthOutgoingStorageTotalList.addAll(data4List); + // 累计出库量 + List data5List = totalDataList.stream().map(ResBulkCementTransferDataUploadDetailVO::getCumulativeOutgoingStorageTotal).collect(Collectors.toList()); + cumulativeOutgoingStorageTotalList.addAll(data5List); + // 月末库存量 + List data6List = totalDataList.stream().map(ResBulkCementTransferDataUploadDetailVO::getMonthEndInventoryTotal).collect(Collectors.toList()); + monthEndInventoryTotalList.addAll(data6List); + + // 去年这个月的合计月末库存量 + List data7List = totalDataList.stream().map(v -> { + BigDecimal monthEndInventory = v.getMonthEndInventoryTotal(); + BigDecimal monthEndInventoryGrowthRate = v.getMonthEndInventoryGrowthRateTotal(); + return monthEndInventory.divide(monthEndInventoryGrowthRate.add(BigDecimal.valueOf(100L)),RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100L)); + }).collect(Collectors.toList()); + preYearMonthEndInventoryTotalList.addAll(data7List); + } + List totalValues = Lists.newArrayList(); + ResBulkCementTransferDataUploadDetailVO totalVo = new ResBulkCementTransferDataUploadDetailVO(); + // 合计上月末库存 + BigDecimal lastMonthEndInventoryTotal = lastMonthEndInventoryTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setLastMonthEndInventory(lastMonthEndInventoryTotal); + // 合计本月进库量 + BigDecimal thisMonthIncomingStorageTotal = thisMonthIncomingStorageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisMonthIncomingStorage(thisMonthIncomingStorageTotal); + // 合计累计进库量 + BigDecimal cumulativeIncomingStorageTotal = cumulativeIncomingStorageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setCumulativeIncomingStorage(cumulativeIncomingStorageTotal); + // 合计本月出库量 + BigDecimal thisMonthOutgoingStorageTotal = thisMonthOutgoingStorageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisMonthOutgoingStorage(thisMonthOutgoingStorageTotal); + // 合计累计出库量 + BigDecimal cumulativeOutgoingStorageTotal = cumulativeOutgoingStorageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setCumulativeOutgoingStorage(cumulativeOutgoingStorageTotal); + // 合计月末库存量 + BigDecimal monthEndInventoryTotal = monthEndInventoryTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setMonthEndInventory( monthEndInventoryTotal); + // 合计月末库存同比增长率: (合计月末库存量 - 去年合计月末库存量) / 去年合计月末库存量 * 100 + BigDecimal monthEndInventoryGrowthRateTotal; + BigDecimal preYearMonthEndInventoryTotal = preYearMonthEndInventoryTotalList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + if (BigDecimal.ZERO.compareTo(preYearMonthEndInventoryTotal) != 0) { + monthEndInventoryGrowthRateTotal = (monthEndInventoryTotal.subtract(preYearMonthEndInventoryTotal)).divide(preYearMonthEndInventoryTotal, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + }else { + monthEndInventoryGrowthRateTotal = monthEndInventoryTotal.multiply(BigDecimal.valueOf(100L)); + } + totalVo.setMonthEndInventoryGrowthRate(monthEndInventoryGrowthRateTotal); + totalValues.add(totalVo); + totalVo.setUnitName(ReportConstant.TOTAL); + dataMap.put(ReportConstant.TOTAL,totalValues); + bulkCementTransferDataQueryDetailVo.setBulkCementTransferDataMap(dataMap); + } + + private void getBulkCementThreeCityUsageDataQueryDetailVo(Map dataMap, LocalDateTime reportMonth, ResBulkCementThreeCityUsageDataQueryDetailVO bulkCementThreeCityUsageDataQueryDetailVO, Long regionId) { + + // 统计各字段合计值 + // 合计年目标 + List yearTargetTotalList = Lists.newArrayList(); + // 合计本月使用量 + List thisMonthUsageTotalList = Lists.newArrayList(); + // 合计累计使用量 + List accumulativeUsageTotalList = Lists.newArrayList(); + // 合计本省本月使用量 + List thisProvinceThisMonthUsageTotalList = Lists.newArrayList(); + // 合计本省累计使用量 + List thisProvinceAccumulativeUsageTotalList = Lists.newArrayList(); + // 合计外省本月使用量 + List otherProvinceThisMonthUsageTotalList = Lists.newArrayList(); + // 合计外省累计使用量 + List otherProvinceAccumulativeUsageTotalList = Lists.newArrayList(); + + // 合计去年这个月的累计使用量 + List preYearAccumulativeUsageTotalList = Lists.newArrayList(); + // 合计上个月的累计使用量 + List preAccumulativeUsageTotalList = Lists.newArrayList(); + + // 对于市级散办,map中只有一个键值对,统计的是该市各区县对应字段的集合 + // 对于省散办,map中对应各市键值对,统计的是各个市下各区县对应字段的集合 + for (Map.Entry entry : dataMap.entrySet()) { + List value = (List)entry.getValue(); + // 筛选出为市合计数据的那条记录(市散办有一条、省散办中有多个) + List totalDataList = value.stream().filter(v -> Boolean.TRUE.equals(v.getIsCityTotalData())).collect(Collectors.toList()); + // 年目标 + List data1List = totalDataList.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getYearTargetTotal).collect(Collectors.toList()); + yearTargetTotalList.addAll(data1List); + // 本月使用量 + List data2List = totalDataList.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getThisMonthUsageTotal).collect(Collectors.toList()); + thisMonthUsageTotalList.addAll(data2List); + // 累计使用量 + List data3List = totalDataList.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getAccumulativeUsageTotal).collect(Collectors.toList()); + accumulativeUsageTotalList.addAll(data3List); + // 本省本月使用量 + List data4List = totalDataList.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getThisProvinceThisMonthUsageTotal).collect(Collectors.toList()); + thisProvinceThisMonthUsageTotalList.addAll(data4List); + // 本省累计使用量 + List data5List = totalDataList.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getThisProvinceAccumulativeUsageTotal).collect(Collectors.toList()); + thisProvinceAccumulativeUsageTotalList.addAll(data5List); + // 外省本月使用量 + List data6List = totalDataList.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getOtherProvinceThisMonthUsageTotal).collect(Collectors.toList()); + otherProvinceThisMonthUsageTotalList.addAll(data6List); + // 外省累计使用量 + List data7List = totalDataList.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getOtherProvinceThisMonthUsageTotal).collect(Collectors.toList()); + otherProvinceAccumulativeUsageTotalList.addAll(data7List); + + // 去年这个月的累计使用量 + List data8List = totalDataList.stream().map(v -> { + BigDecimal accumulativeUsageTotal = v.getAccumulativeUsageTotal(); + BigDecimal growthRateTotal = v.getGrowthRateTotal(); + if (Objects.nonNull(accumulativeUsageTotal) && Objects.nonNull(growthRateTotal)){ + if (BigDecimal.ZERO.compareTo(growthRateTotal) != 0) { + return accumulativeUsageTotal.divide(growthRateTotal.add(BigDecimal.valueOf(100L)), RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100L)); + } + } + return BigDecimal.ZERO; + }).collect(Collectors.toList()); + preYearAccumulativeUsageTotalList.addAll(data8List); + + // 上个月的累计使用量 + List data9List = totalDataList.stream().map(v -> { + BigDecimal thisMonthUsageTotal = v.getThisMonthUsageTotal(); + BigDecimal thisMonthUsage = v.getThisMonthUsage(); + if (Objects.nonNull(thisMonthUsage)) { + return thisMonthUsageTotal.subtract(thisMonthUsage); + }else { + return thisMonthUsageTotal; + } + }).collect(Collectors.toList()); + preAccumulativeUsageTotalList.addAll(data9List); + } + + List totalValues = Lists.newArrayList(); + ResBulkCementThreeCityUsageDataUploadDetailVO totalVo = new ResBulkCementThreeCityUsageDataUploadDetailVO(); + + // 合计年目标 + BigDecimal yearTargetTotal = yearTargetTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setYearTarget(yearTargetTotal); + // 合计累计使用量 + BigDecimal accumulativeUsageTotal = accumulativeUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setAccumulativeUsage(accumulativeUsageTotal); + // 合计占全年目标百分比:合计累计使用量 / 合计年目标 * 100 + BigDecimal percentageOfAnnualTargetTotal = BigDecimal.ZERO; + + if (BigDecimal.ZERO.compareTo(yearTargetTotal) != 0) { + percentageOfAnnualTargetTotal = accumulativeUsageTotal.divide(yearTargetTotal, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100L)); + } + totalVo.setPercentageOfAnnualTarget(percentageOfAnnualTargetTotal); + + // 合计同比增长率: (合计累计使用量 - 去年合计累计使用量) / 去年合计累计使用量 * 100 + BigDecimal growthRateTotal; + BigDecimal preYearAccumulativeUsageTotal = preYearAccumulativeUsageTotalList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + if (BigDecimal.ZERO.compareTo(preYearAccumulativeUsageTotal) != 0) { + growthRateTotal = (accumulativeUsageTotal.subtract(preYearAccumulativeUsageTotal)).divide(preYearAccumulativeUsageTotal, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + }else { + growthRateTotal = accumulativeUsageTotal.multiply(BigDecimal.valueOf(100L)); + } + totalVo.setGrowthRate(growthRateTotal); + + // 合计本月使用量 + BigDecimal thisMonthUsageTotal = thisMonthUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisMonthUsage(thisMonthUsageTotal); + // 合计本省本月使用量 + BigDecimal thisProvinceThisMonthUsageTotal = thisProvinceThisMonthUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisProvinceThisMonthUsage(thisProvinceThisMonthUsageTotal); + // 合计本省累计使用量 + BigDecimal thisProvinceAccumulativeUsageTotal = thisProvinceAccumulativeUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisProvinceAccumulativeUsage(thisProvinceAccumulativeUsageTotal); + // 合计外省本月使用量 + BigDecimal otherProvinceThisMonthUsageTotal = otherProvinceThisMonthUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setOtherProvinceThisMonthUsage(otherProvinceThisMonthUsageTotal); + // 合计外省累计使用量 + BigDecimal otherProvinceAccumulativeUsageTotal = otherProvinceAccumulativeUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setOtherProvinceAccumulativeUsage(otherProvinceAccumulativeUsageTotal); + totalVo.setUnitName(ReportConstant.TOTAL); + totalValues.add(totalVo); + dataMap.put(ReportConstant.TOTAL,totalValues); + bulkCementThreeCityUsageDataQueryDetailVO.setBulkCementThreeCityUsageDataMap(dataMap); + } + + private void getConcreteSupplyDataQueryDetailVo(Map dataMap, Boolean flag, LocalDateTime reportMonth, ResConcreteSupplyDataQueryDetailVO concreteSupplyDataQueryDetailVo, Long regionId) { + + // 统计各字段合计值 + // 合计三类指导目标 + List threeCategoryGuidGoalTotalList = Lists.newArrayList(); + // 合计生产企业数量 + List productionCompanyNumsTotalList = Lists.newArrayList(); + // 合计年设计生产能力 + List annualDesignProductionCapacityTotalList = Lists.newArrayList(); + // 合计本月实际产量 + List thisMonthOutputTotalList = Lists.newArrayList(); + // 合计累计实际产量 + List accumulativeOutputTotalList = Lists.newArrayList(); + // 合计本月使用散装水泥量 + List thisMonthCementUsageTotalList = Lists.newArrayList(); + // 合计累计使用散装水泥量 + List cementAccumulativeUsageTotalList = Lists.newArrayList(); + // 合计本月废弃物综合利用量 + List thisMonthWasteUtilizationTotalList = Lists.newArrayList(); + // 合计累计废弃物综合利用量 + List accumulativeWasteUtilizationTotalList = Lists.newArrayList(); + + // 对于市级散办,map中只有一个键值对,统计的是该市各区县对应字段的集合 + // 对于省散办,map中对应各市键值对,统计的是各个市下各区县对应字段的集合 + for (Map.Entry entry : dataMap.entrySet()) { + List value = (List)entry.getValue(); + // 筛选出为市合计数据的那条记录(市散办有一条、省散办中有多个) + List totalDataList = value.stream().filter(v -> Boolean.TRUE.equals(v.getIsCityTotalData())).collect(Collectors.toList()); + // 三类指导目标 + List data1List = totalDataList.stream().map(ResConcreteSupplyDataUploadDetailVO::getThreeCategoryGuidGoalTotal).collect(Collectors.toList()); + threeCategoryGuidGoalTotalList.addAll(data1List); + // 生产企业数量 + List data2List = totalDataList.stream().map(ResConcreteSupplyDataUploadDetailVO::getProductionCompanyNumsTotal).collect(Collectors.toList()); + productionCompanyNumsTotalList.addAll(data2List); + // 年设计生产能力 + List data3List = totalDataList.stream().map(ResConcreteSupplyDataUploadDetailVO::getAnnualDesignProductionCapacityTotal).collect(Collectors.toList()); + annualDesignProductionCapacityTotalList.addAll(data3List); + // 本月实际产量 + List data4List = totalDataList.stream().map(ResConcreteSupplyDataUploadDetailVO::getThisMonthOutputTotal).collect(Collectors.toList()); + thisMonthOutputTotalList.addAll(data4List); + // 累计实际产量 + List data5List = totalDataList.stream().map(ResConcreteSupplyDataUploadDetailVO::getAccumulativeOutputTotal).collect(Collectors.toList()); + accumulativeOutputTotalList.addAll(data5List); + + // 本月使用散装水泥量 + List data6List = totalDataList.stream().map(ResConcreteSupplyDataUploadDetailVO::getThisMonthCementUsageTotal).collect(Collectors.toList()); + thisMonthCementUsageTotalList.addAll(data6List); + // 累计使用散装水泥量 + List data7List = totalDataList.stream().map(ResConcreteSupplyDataUploadDetailVO::getCementAccumulativeUsageTotal).collect(Collectors.toList()); + cementAccumulativeUsageTotalList.addAll(data7List); + // 本月废弃物综合利用量 + List data8List = totalDataList.stream().map(ResConcreteSupplyDataUploadDetailVO::getThisMonthWasteUtilizationTotal).collect(Collectors.toList()); + thisMonthWasteUtilizationTotalList.addAll(data8List); + // 累计废弃物综合利用量 + List data9List = totalDataList.stream().map(ResConcreteSupplyDataUploadDetailVO::getAccumulativeWasteUtilizationTotal).collect(Collectors.toList()); + accumulativeWasteUtilizationTotalList.addAll(data9List); + + } + List totalValues = Lists.newArrayList(); + ResConcreteSupplyDataUploadDetailVO totalVo = new ResConcreteSupplyDataUploadDetailVO(); + + // 合计三类指导目标 + BigDecimal threeCategoryGuidGoalTotal = threeCategoryGuidGoalTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThreeCategoryGuidGoal(threeCategoryGuidGoalTotal); + // 合计生产企业数量 + int productionCompanyNumsTotal = productionCompanyNumsTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setProductionCompanyNums(productionCompanyNumsTotal); + // 合计年设计生产能力 + BigDecimal annualDesignProductionCapacityTotal = annualDesignProductionCapacityTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setAnnualDesignProductionCapacity(annualDesignProductionCapacityTotal); + // 合计本月实际产量 + BigDecimal thisMonthOutputTotal = thisMonthOutputTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisMonthOutput(thisMonthOutputTotal); + // 合计累计实际产量 + BigDecimal accumulativeOutputTotal = accumulativeOutputTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setAccumulativeOutput(accumulativeOutputTotal); + + // 合计本月使用散装水泥量 + BigDecimal thisMonthCementUsageTotal = thisMonthCementUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisMonthCementUsage(thisMonthCementUsageTotal); + // 合计累计使用散装水泥量 + BigDecimal cementAccumulativeUsageTotal = cementAccumulativeUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setCementAccumulativeUsage(cementAccumulativeUsageTotal); + // 合计本月废弃物综合利用量 + BigDecimal thisMonthWasteUtilizationTotal = thisMonthWasteUtilizationTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisMonthWasteUtilization(thisMonthWasteUtilizationTotal); + // 合计累计废弃物综合利用量 + BigDecimal accumulativeWasteUtilizationTotal = accumulativeWasteUtilizationTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setAccumulativeWasteUtilization(accumulativeWasteUtilizationTotal); + totalVo.setUnitName(ReportConstant.TOTAL); + totalValues.add(totalVo); + dataMap.put(ReportConstant.TOTAL,totalValues); + concreteSupplyDataQueryDetailVo.setConcreteSupplyDataMap(dataMap); + } + private void getMortarSupplyDataQueryDetailVo(Map dataMap, Boolean flag, LocalDateTime reportMonth, ResMortarSupplyDataQueryDetailVO mortarSupplyDataQueryDetailVo, Long regionId) { + + // 统计各字段合计值 + // 合计二类指导目标 + List twoCategoryGuidGoalTotalList = Lists.newArrayList(); + // 合计普通干混砂浆生产企业数量 + List dryMixedMortarProductionCompanyNumTotalList = Lists.newArrayList(); + // 合计普通干混砂浆生产总能力 + List dryMixedMortarProductiveCapacityTotalList = Lists.newArrayList(); + // 合计普通干混砂浆散装能力 + List dryMixedMortarBulkCapacityTotalList = Lists.newArrayList(); + // 合计本月总产量 + List thisMonthTotalOutputTotalList = Lists.newArrayList(); + // 合计本月累计总产量 + List thisMonthAccumulativeOutputTotalList = Lists.newArrayList(); + // 合计普通干混砂浆本月产量 + List dryMixedMortarThisMonthOutputTotalList = Lists.newArrayList(); + // 合计普通干混砂浆累计产量 + List dryMixedMortarThisMonthAccumulativeOutputTotalList = Lists.newArrayList(); + // 合计普通干混砂浆同比增长量 + List dryMixedMortarIncrementTotalList = Lists.newArrayList(); + + // 合计去年这个月普通干混砂浆累计产量 + List preYearDryMixedMortarThisMonthAccumulativeOutputTotalList = Lists.newArrayList(); + + // 合计普通干混砂浆本月散装量 + List dryMixedMortarThisMonthBulkQuantityTotalList = Lists.newArrayList(); + // 合计普通干混砂浆累计散装量 + List dryMixedMortarAccumulativeBulkQuantityTotalList = Lists.newArrayList(); + // 合计湿拌砂浆本月产量 + List wetMortarThisMonthOutputTotalList = Lists.newArrayList(); + // 合计湿拌砂浆累计产量 + List wetMortarAccumulativeOutputTotalList = Lists.newArrayList(); + // 合计散装水泥本月使用量 + List bulkCementThisMonthUsageTotalList = Lists.newArrayList(); + // 合计散装水泥累计使用量 + List bulkCementAccumulativeUsageTotalList = Lists.newArrayList(); + // 合计废弃物本月综合利用量 + List wasteThisMonthComprehensiveUtilizationTotalList = Lists.newArrayList(); + // 合计废弃物累计综合利用量 + List wasteAccumulativeComprehensiveUtilizationTotalList = Lists.newArrayList(); + + + // 对于市级散办,map中只有一个键值对,统计的是该市各区县对应字段的集合 + // 对于省散办,map中对应各市键值对,统计的是各个市下各区县对应字段的集合 + for (Map.Entry entry : dataMap.entrySet()) { + List value = (List)entry.getValue(); + // 筛选出为市合计数据的那条记录(市散办有一条、省散办中有多个) + List totalDataList = value.stream().filter(v -> Boolean.TRUE.equals(v.getIsCityTotalData())).collect(Collectors.toList()); + // 二类指导目标 + List data1List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getTwoCategoryGuidGoalTotal).collect(Collectors.toList()); + twoCategoryGuidGoalTotalList.addAll(data1List); + // 普通干混砂浆生产企业数量 + List data2List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarProductionCompanyNumTotal).collect(Collectors.toList()); + dryMixedMortarProductionCompanyNumTotalList.addAll(data2List); + // 普通干混砂浆生产总能力 + List data3List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarProductiveCapacityTotal).collect(Collectors.toList()); + dryMixedMortarProductiveCapacityTotalList.addAll(data3List); + // 普通干混砂浆散装能力 + List data4List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarBulkCapacityTotal).collect(Collectors.toList()); + dryMixedMortarBulkCapacityTotalList.addAll(data4List); + // 本月总产量 + List data5List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getThisMonthTotalOutputTotal).collect(Collectors.toList()); + thisMonthTotalOutputTotalList.addAll(data5List); + + // 本月累计总产量 + List data6List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getThisMonthAccumulativeOutputTotal).collect(Collectors.toList()); + thisMonthAccumulativeOutputTotalList.addAll(data6List); + // 普通干混砂浆本月产量 + List data7List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarThisMonthOutputTotal).collect(Collectors.toList()); + dryMixedMortarThisMonthOutputTotalList.addAll(data7List); + // 普通干混砂浆累计产量 + List data8List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarThisMonthAccumulativeOutputTotal).collect(Collectors.toList()); + dryMixedMortarThisMonthAccumulativeOutputTotalList.addAll(data8List); + // 普通干混砂浆同比增长量 + List data9List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarIncrementTotal).collect(Collectors.toList()); + dryMixedMortarIncrementTotalList.addAll(data9List); + // 去年这个月普通干混砂浆累计产量 + List data10List = totalDataList.stream().map(r -> { + BigDecimal dryMixedMortarIncrementTotal = r.getDryMixedMortarIncrementTotal(); + BigDecimal dryMixedMortarGrowthRateTotal = r.getDryMixedMortarGrowthRateTotal(); + if (Objects.nonNull(dryMixedMortarIncrementTotal) && Objects.nonNull(dryMixedMortarGrowthRateTotal)){ + if (BigDecimal.ZERO.compareTo(dryMixedMortarGrowthRateTotal) != 0){ + return dryMixedMortarIncrementTotal.divide(dryMixedMortarGrowthRateTotal,RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100L)); + } + } + return BigDecimal.ZERO; + }).collect(Collectors.toList()); + preYearDryMixedMortarThisMonthAccumulativeOutputTotalList.addAll(data10List); + // 普通干混砂浆本月散装量 + List data11List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarThisMonthBulkQuantityTotal).collect(Collectors.toList()); + dryMixedMortarThisMonthBulkQuantityTotalList.addAll(data11List); + // 普通干混砂浆累计散装量 + List data12List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarAccumulativeBulkQuantityTotal).collect(Collectors.toList()); + dryMixedMortarAccumulativeBulkQuantityTotalList.addAll(data12List); + // 湿拌砂浆本月产量 + List data13List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getWetMortarThisMonthOutputTotal).collect(Collectors.toList()); + wetMortarThisMonthOutputTotalList.addAll(data13List); + // 湿拌砂浆累计产量 + List data14List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getWetMortarAccumulativeOutputTotal).collect(Collectors.toList()); + wetMortarAccumulativeOutputTotalList.addAll(data14List); + // 散装水泥本月使用量 + List data15List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getBulkCementThisMonthUsageTotal).collect(Collectors.toList()); + bulkCementThisMonthUsageTotalList.addAll(data15List); + // 散装水泥累计使用量 + List data16List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getBulkCementAccumulativeUsageTotal).collect(Collectors.toList()); + bulkCementAccumulativeUsageTotalList.addAll(data16List); + // 废弃物本月综合利用量 + List data17List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getWasteThisMonthComprehensiveUtilizationTotal).collect(Collectors.toList()); + wasteThisMonthComprehensiveUtilizationTotalList.addAll(data17List); + // 废弃物累计综合利用量 + List data18List = totalDataList.stream().map(ResMortarSupplyDataUploadDetailVO::getWasteAccumulativeComprehensiveUtilizationTotal).collect(Collectors.toList()); + wasteAccumulativeComprehensiveUtilizationTotalList.addAll(data18List); + } + + List totalValues = Lists.newArrayList(); + ResMortarSupplyDataUploadDetailVO totalVo = new ResMortarSupplyDataUploadDetailVO(); + + // 合计二类指导目标 + BigDecimal twoCategoryGuidGoalTotal = twoCategoryGuidGoalTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setTwoCategoryGuidGoal(twoCategoryGuidGoalTotal); + // 合计普通干混砂浆生产企业数量 + int dryMixedMortarProductionCompanyNumTotal = dryMixedMortarProductionCompanyNumTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setDryMixedMortarProductionCompanyNum(dryMixedMortarProductionCompanyNumTotal); + // 合计普通干混砂浆生产总能力 + BigDecimal dryMixedMortarProductiveCapacityTotal = dryMixedMortarProductiveCapacityTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setDryMixedMortarProductiveCapacity(dryMixedMortarProductiveCapacityTotal); + // 合计普通干混砂浆散装能力 + BigDecimal dryMixedMortarBulkCapacityTotal = dryMixedMortarBulkCapacityTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setDryMixedMortarBulkCapacity(dryMixedMortarBulkCapacityTotal); + // 合计本月总产量 + BigDecimal thisMonthTotalOutputTotal = thisMonthTotalOutputTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisMonthTotalOutput(thisMonthTotalOutputTotal); + // 合计本月累计总产量 + BigDecimal thisMonthAccumulativeOutputTotal = thisMonthAccumulativeOutputTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisMonthAccumulativeOutput(thisMonthAccumulativeOutputTotal); + // 合计普通干混砂浆本月产量 + BigDecimal dryMixedMortarThisMonthOutputTotal = dryMixedMortarThisMonthOutputTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setDryMixedMortarThisMonthOutput(dryMixedMortarThisMonthOutputTotal); + // 合计普通干混砂浆累计产量 + BigDecimal dryMixedMortarThisMonthAccumulativeOutputTotal = dryMixedMortarThisMonthAccumulativeOutputTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setDryMixedMortarThisMonthAccumulativeOutput(dryMixedMortarThisMonthAccumulativeOutputTotal); + // 合计普通干混砂浆同比增长量 + BigDecimal dryMixedMortarIncrementTotal = dryMixedMortarIncrementTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setDryMixedMortarIncrement(dryMixedMortarIncrementTotal); + // 合计增长率 + BigDecimal preYearDryMixedMortarThisMonthAccumulativeOutputTotal = preYearDryMixedMortarThisMonthAccumulativeOutputTotalList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + BigDecimal dryMixedMortarGrowthRateTotal; + if (BigDecimal.ZERO.compareTo(preYearDryMixedMortarThisMonthAccumulativeOutputTotal) != 0){ + dryMixedMortarGrowthRateTotal = dryMixedMortarIncrementTotal.divide(preYearDryMixedMortarThisMonthAccumulativeOutputTotal, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100L)); + }else { + dryMixedMortarGrowthRateTotal = dryMixedMortarIncrementTotal.multiply(BigDecimal.valueOf(100L)); + } + totalVo.setDryMixedMortarGrowthRate(dryMixedMortarGrowthRateTotal); + + // 合计普通干混砂浆本月散装量 + BigDecimal dryMixedMortarThisMonthBulkQuantityTotal = dryMixedMortarThisMonthBulkQuantityTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setDryMixedMortarThisMonthBulkQuantity(dryMixedMortarThisMonthBulkQuantityTotal); + // 合计普通干混砂浆累计散装量 + BigDecimal dryMixedMortarAccumulativeBulkQuantityTotal = dryMixedMortarAccumulativeBulkQuantityTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setDryMixedMortarAccumulativeBulkQuantity(dryMixedMortarAccumulativeBulkQuantityTotal); + // 合计湿拌砂浆本月产量 + BigDecimal wetMortarThisMonthOutputTotal = wetMortarThisMonthOutputTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setWetMortarThisMonthOutput(wetMortarThisMonthOutputTotal); + // 合计湿拌砂浆累计产量 + BigDecimal wetMortarAccumulativeOutputTotal = wetMortarAccumulativeOutputTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setWetMortarAccumulativeOutput(wetMortarAccumulativeOutputTotal); + // 合计散装水泥本月使用量 + BigDecimal bulkCementThisMonthUsageTotal = bulkCementThisMonthUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setBulkCementThisMonthUsage(bulkCementThisMonthUsageTotal); + // 合计散装水泥累计使用量 + BigDecimal bulkCementAccumulativeUsageTotal = bulkCementAccumulativeUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setBulkCementAccumulativeUsage(bulkCementAccumulativeUsageTotal); + // 合计废弃物本月综合利用量 + BigDecimal wasteThisMonthComprehensiveUtilizationTotal = wasteThisMonthComprehensiveUtilizationTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setWasteThisMonthComprehensiveUtilization(wasteThisMonthComprehensiveUtilizationTotal); + // 合计废弃物累计综合利用量 + BigDecimal wasteAccumulativeComprehensiveUtilizationTotal = wasteAccumulativeComprehensiveUtilizationTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setWasteAccumulativeComprehensiveUtilization(wasteAccumulativeComprehensiveUtilizationTotal); + totalVo.setRegionName(ReportConstant.TOTAL); + totalValues.add(totalVo); + dataMap.put(ReportConstant.TOTAL,totalValues); + mortarSupplyDataQueryDetailVo.setMortarSupplyDataMap(dataMap); + } + private void getNonProAreasDataQueryDetailVo(Map dataMap, Integer reportYear, ResNonProhibitedAreasDataQueryDetailVO nonProhibitedAreasDataQueryDetailVO, Long regionId) { + + // 统计各字段合计值 + // 合计销售点总数 + List salePointAccumulativeNumTotalList = Lists.newArrayList(); + // 合计水泥企业建点数量 + List cementCompanyBuildPointNumTotalList = Lists.newArrayList(); + // 合计其他投资建点数量 + List otherInvestmentBuildPointNumTotalList = Lists.newArrayList(); + // 合计销售量 + List saleVolumeTotalList = Lists.newArrayList(); + // 合计散装水泥罐数量 + List bulkCementTankNumTotalList = Lists.newArrayList(); + + // 合计散装水泥罐容量 + List bulkCementTankCapacityTotalList = Lists.newArrayList(); + // 合计水泥使用量 + List cementUsageTotalList = Lists.newArrayList(); + // 合计散装水泥使用量 + List bulkCementUsageTotalList = Lists.newArrayList(); + // 合计生产预拌混凝土使用散装水泥量 + List readyMixedConcreteBulkCementUsageTotalList = Lists.newArrayList(); + // 合计生产水泥制品使用散装水泥量 + List cementProductsBulkCementUsageTotalList = Lists.newArrayList(); + + // 合计非禁现区生产预拌混凝土产量 + List readyMixedConcreteOutputTotalList = Lists.newArrayList(); + + // 对于市级散办,map中只有一个键值对,统计的是该市各区县对应字段的集合 + // 对于省散办,map中对应各市键值对,统计的是各个市下各区县对应字段的集合 + for (Map.Entry entry : dataMap.entrySet()) { + List value = (List)entry.getValue(); + // 筛选出为市合计数据的那条记录(市散办有一条、省散办中有多个) + List totalDataList = value.stream().filter(v -> Boolean.TRUE.equals(v.getIsCityTotalData())).collect(Collectors.toList()); + // 销售点总数 + List data1List = totalDataList.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getSalePointAccumulativeNumTotal).collect(Collectors.toList()); + salePointAccumulativeNumTotalList.addAll(data1List); + // 水泥企业建点数量 + List data2List = totalDataList.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getCementCompanyBuildPointNumTotal).collect(Collectors.toList()); + cementCompanyBuildPointNumTotalList.addAll(data2List); + // 其他投资建点数量 + List data3List = totalDataList.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getOtherInvestmentBuildPointNumTotal).collect(Collectors.toList()); + otherInvestmentBuildPointNumTotalList.addAll(data3List); + // 销售量 + List data4List = totalDataList.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getSaleVolumeTotal).collect(Collectors.toList()); + saleVolumeTotalList.addAll(data4List); + // 散装水泥罐数量 + List data5List = totalDataList.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getBulkCementTankNumTotal).collect(Collectors.toList()); + bulkCementTankNumTotalList.addAll(data5List); + + // 散装水泥罐容量 + List data6List = totalDataList.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getBulkCementTankCapacityTotal).collect(Collectors.toList()); + bulkCementTankCapacityTotalList.addAll(data6List); + // 水泥使用量 + List data7List = totalDataList.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getCementUsageTotal).collect(Collectors.toList()); + cementUsageTotalList.addAll(data7List); + // 散装水泥使用量 + List data8List = totalDataList.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getBulkCementUsageTotal).collect(Collectors.toList()); + bulkCementUsageTotalList.addAll(data8List); + // 生产预拌混凝土使用散装水泥量 + List data9List = totalDataList.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getReadyMixedConcreteBulkCementUsageTotal).collect(Collectors.toList()); + readyMixedConcreteBulkCementUsageTotalList.addAll(data9List); + // 生产水泥制品使用散装水泥量 + List data10List = totalDataList.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getCementProductsBulkCementUsageTotal).collect(Collectors.toList()); + cementProductsBulkCementUsageTotalList.addAll(data10List); + // 非禁现区生产预拌混凝土产量 + List data11List = totalDataList.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getReadyMixedConcreteOutputTotal).collect(Collectors.toList()); + readyMixedConcreteOutputTotalList.addAll(data11List); + } + + List totalValues = Lists.newArrayList(); + ResNonProhibitedAreasDataUploadDetailVO totalVo = new ResNonProhibitedAreasDataUploadDetailVO(); + + int salePointAccumulativeNumTotal = salePointAccumulativeNumTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setSalePointAccumulativeNum(salePointAccumulativeNumTotal); + int cementCompanyBuildPointNumTotal = cementCompanyBuildPointNumTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setCementCompanyBuildPointNum(cementCompanyBuildPointNumTotal); + int otherInvestmentBuildPointNumTotal = otherInvestmentBuildPointNumTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setOtherInvestmentBuildPointNum(otherInvestmentBuildPointNumTotal); + BigDecimal saleVolumeTotal = saleVolumeTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setSaleVolume(saleVolumeTotal); + int bulkCementTankNumTotal = bulkCementTankNumTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setBulkCementTankNum(bulkCementTankNumTotal); + + BigDecimal bulkCementTankCapacityTotal = bulkCementTankCapacityTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setBulkCementTankCapacity(bulkCementTankCapacityTotal); + BigDecimal cementUsageTotal = cementUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setCementUsage(cementUsageTotal); + BigDecimal bulkCementUsageTotal = bulkCementUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setBulkCementUsage(bulkCementUsageTotal); + BigDecimal readyMixedConcreteBulkCementUsageTotal = readyMixedConcreteBulkCementUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setReadyMixedConcreteBulkCementUsage(readyMixedConcreteBulkCementUsageTotal); + BigDecimal cementProductsBulkCementUsageTotal = cementProductsBulkCementUsageTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setCementProductsBulkCementUsage(cementProductsBulkCementUsageTotal); + + // 合计散装水泥使用率: 合计散装水泥使用量 / 合计水泥使用量 * 100 + BigDecimal bulkCementUsageRateTotal = bulkCementUsageTotal.divide(cementUsageTotal, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + totalVo.setBulkCementUsageRate(bulkCementUsageRateTotal); + + BigDecimal readyMixedConcreteOutputTotal = readyMixedConcreteOutputTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setReadyMixedConcreteOutput(readyMixedConcreteOutputTotal); + totalVo.setRegionName(ReportConstant.TOTAL); + totalValues.add(totalVo); + dataMap.put(ReportConstant.TOTAL,totalValues); + nonProhibitedAreasDataQueryDetailVO.setNonProAreasDataMap(dataMap); + } + + private void getBulkCementLogFacStaDataQueryDetailVo(String key, Map dataMap, Integer reportYear, ResBulkCementLogFacStaDataQueryDetailVO bulkCementLogFacStaDataQueryDetailVo, Long regionId) { + + // 统计各字段合计值 + // 合计年初数量 + List yearBeginNumTotalList = Lists.newArrayList(); + // 合计年初容量 + List yearBeginCapacityTotalList = Lists.newArrayList(); + // 合计本年新增容量 + List thisYearNewAddCapacityTotalList = Lists.newArrayList(); + // 合计本年新增数量 + List thisYearNewAddNumTotalList = Lists.newArrayList(); + // 合计本年报废数量 + List thisYearScrapNumTotalList = Lists.newArrayList(); + + // 合计本年报废容量 + List thisYearScrapCapacityTotalList = Lists.newArrayList(); + // 合计年末数量 + List yearEndNumTotalList = Lists.newArrayList(); + // 合计年末容量 + List yearEndCapacityTotalList = Lists.newArrayList(); + // 合计本年实际作业量 + List thisYearWorkAmountTotalList = Lists.newArrayList(); + + // 对于市级散办,map中只有一个键值对,统计的是该市各区县对应字段的集合 + // 对于省散办,map中对应各市键值对,统计的是各个市下各区县对应字段的集合 + for (Map.Entry entry : dataMap.entrySet()) { + List value = (List)entry.getValue(); + // 筛选出为市合计数据的那条记录(市散办有一条、省散办中有多个) + List totalDataList = value.stream().filter(v -> Boolean.TRUE.equals(v.getIsCityTotalData())).collect(Collectors.toList()); + // 年初数量 + List data1List = totalDataList.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getYearBeginNumTotal).collect(Collectors.toList()); + yearBeginNumTotalList.addAll(data1List); + // 年初容量 + List data2List = totalDataList.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getYearBeginCapacityTotal).collect(Collectors.toList()); + yearBeginCapacityTotalList.addAll(data2List); + // 本年新增容量 + List data3List = totalDataList.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getThisYearNewAddCapacityTotal).collect(Collectors.toList()); + thisYearNewAddCapacityTotalList.addAll(data3List); + // 本年新增数量 + List data4List = totalDataList.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getThisYearNewAddNumTotal).collect(Collectors.toList()); + thisYearNewAddNumTotalList.addAll(data4List); + // 本年报废数量 + List data5List = totalDataList.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getThisYearScrapNumTotal).collect(Collectors.toList()); + thisYearScrapNumTotalList.addAll(data5List); + + // 本年报废容量 + List data6List = totalDataList.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getThisYearScrapCapacityTotal).collect(Collectors.toList()); + thisYearScrapCapacityTotalList.addAll(data6List); + // 年末数量 + List data7List = totalDataList.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getYearEndNumTotal).collect(Collectors.toList()); + yearEndNumTotalList.addAll(data7List); + // 年末容量 + List data8List = totalDataList.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getYearEndCapacityTotal).collect(Collectors.toList()); + yearEndCapacityTotalList.addAll(data8List); + // 本年实际作业量 + List data9List = totalDataList.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getThisYearWorkAmountTotal).collect(Collectors.toList()); + thisYearWorkAmountTotalList.addAll(data9List); + } + + List totalValues = Lists.newArrayList(); + ResBulkCementLogFacStaDataUploadDetailVO totalVo = new ResBulkCementLogFacStaDataUploadDetailVO(); + int yearBeginNumTotal = yearBeginNumTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setYearBeginNum(yearBeginNumTotal); + BigDecimal yearBeginCapacityTotal = yearBeginCapacityTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setYearBeginCapacity(yearBeginCapacityTotal); + BigDecimal thisYearNewAddCapacityTotal = thisYearNewAddCapacityTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisYearNewAddCapacity(thisYearNewAddCapacityTotal); + int thisYearNewAddNumTotal = thisYearNewAddNumTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setThisYearNewAddNum(thisYearNewAddNumTotal); + int thisYearScrapNumTotal = thisYearScrapNumTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setThisYearScrapNum(thisYearScrapNumTotal); + + BigDecimal thisYearScrapCapacityTotal = thisYearScrapCapacityTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisYearScrapCapacity(thisYearScrapCapacityTotal); + int yearEndNumTotal = yearEndNumTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setYearEndNum(yearEndNumTotal); + BigDecimal yearEndCapacityTotal = yearEndCapacityTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setYearEndCapacity(yearEndCapacityTotal); + BigDecimal thisYearWorkAmountTotal = thisYearWorkAmountTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisYearWorkAmount(thisYearWorkAmountTotal); + // 将最终的合计数据也加入dataMap中 + totalVo.setRegionName(ReportConstant.TOTAL); + totalVo.setFacilityName(key); + totalVo.setReportYear(reportYear); + totalValues.add(totalVo); + dataMap.put(ReportConstant.TOTAL,totalValues); + bulkCementLogFacStaDataQueryDetailVo.setBulkCementLogFacDataMap(dataMap); + } + + private void getMaterialLogEquipStaDataQueryDetailVo(String key, Map dataMap, Integer reportYear, ResMaterialLogEquipStaDataQueryDetailVO materialLogEquipStaDataQueryDetailVo, Long regionId) { + + // 统计各字段合计值 + // 合计年初数量 + List yearBeginNumTotalList = Lists.newArrayList(); + // 合计年初额定量 + List yearBeginNominalRateTotalList = Lists.newArrayList(); + // 合计本年新增额定量 + List thisYearNewAddNominalRateTotalList = Lists.newArrayList(); + // 合计本年新增数量 + List thisYearNewAddNumTotalList = Lists.newArrayList(); + // 合计本年减少数量 + List thisYearDecreaseNumTotalList = Lists.newArrayList(); + + // 合计本年减少额定量 + List thisYearDecreaseNominalRateTotalList = Lists.newArrayList(); + // 合计年末数量 + List yearEndNumTotalList = Lists.newArrayList(); + // 合计年末额定量 + List yearEndNominalTotalList = Lists.newArrayList(); + + // 对于市级散办,map中只有一个键值对,统计的是该市各区县对应字段的集合 + // 对于省散办,map中对应各市键值对,统计的是各个市下各区县对应字段的集合 + for (Map.Entry entry : dataMap.entrySet()) { + List value = (List)entry.getValue(); + // 筛选出为市合计数据的那条记录(市散办有一条、省散办中有多个) + List totalDataList = value.stream().filter(v -> Boolean.TRUE.equals(v.getIsCityTotalData())).collect(Collectors.toList()); + // 年初数量 + List data1List = totalDataList.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getYearBeginNumTotal).collect(Collectors.toList()); + yearBeginNumTotalList.addAll(data1List); + // 年初额定量 + List data2List = totalDataList.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getYearBeginNominalRateTotal).collect(Collectors.toList()); + yearBeginNominalRateTotalList.addAll(data2List); + // 本年新增额定量 + List data3List = totalDataList.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getThisYearNewAddNominalRateTotal).collect(Collectors.toList()); + thisYearNewAddNominalRateTotalList.addAll(data3List); + // 本年新增数量 + List data4List = totalDataList.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getThisYearNewAddNumTotal).collect(Collectors.toList()); + thisYearNewAddNumTotalList.addAll(data4List); + // 本年减少数量 + List data5List = totalDataList.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getThisYearDecreaseNumTotal).collect(Collectors.toList()); + thisYearDecreaseNumTotalList.addAll(data5List); + + // 本年减少额定量 + List data6List = totalDataList.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getThisYearDecreaseNominalRateTotal).collect(Collectors.toList()); + thisYearDecreaseNominalRateTotalList.addAll(data6List); + // 年末数量 + List data7List = totalDataList.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getYearEndNumTotal).collect(Collectors.toList()); + yearEndNumTotalList.addAll(data7List); + // 年末额定量 + List data8List = totalDataList.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getYearEndNominalTotal).collect(Collectors.toList()); + yearEndNominalTotalList.addAll(data8List); + } + + List totalValues = Lists.newArrayList(); + ResMaterialLogEquipStaDataUploadDetailVO totalVo = new ResMaterialLogEquipStaDataUploadDetailVO(); + int yearBeginNumTotal = yearBeginNumTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setYearBeginNum(yearBeginNumTotal); + BigDecimal yearBeginCapacityTotal = yearBeginNominalRateTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setYearBeginNominalRate(yearBeginCapacityTotal); + BigDecimal thisYearNewAddCapacityTotal = thisYearNewAddNominalRateTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisYearNewAddNominalRate(thisYearNewAddCapacityTotal); + int thisYearNewAddNumTotal = thisYearNewAddNumTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setThisYearNewAddNum(thisYearNewAddNumTotal); + int thisYearScrapNumTotal = thisYearDecreaseNumTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setThisYearDecreaseNum(thisYearScrapNumTotal); + + BigDecimal thisYearScrapCapacityTotal = thisYearDecreaseNominalRateTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setThisYearDecreaseNominalRate(thisYearScrapCapacityTotal); + int yearEndNumTotal = yearEndNumTotalList.stream().mapToInt(Integer::intValue).sum(); + totalVo.setYearEndNum(yearEndNumTotal); + BigDecimal yearEndCapacityTotal = yearEndNominalTotalList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + totalVo.setYearEndNominal(yearEndCapacityTotal); + // 将最终的合计数据也加入dataMap中 + totalVo.setRegionName(ReportConstant.TOTAL); + totalVo.setEquipmentName(key); + totalVo.setReportYear(reportYear); + totalValues.add(totalVo); + dataMap.put(ReportConstant.TOTAL,totalValues); + materialLogEquipStaDataQueryDetailVo.setMaterialLogEquipDataMap(dataMap); + } + + private void getDataMap(List auditDataIdList, Integer auditDataType, Long companyId, Map dataMap, Boolean flag, LocalDateTime reportMonth, Long regionId, Integer queryType) { + CompanyDTO companyDto = companiesCacheHelper.getById(companyId); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + BulkCementDirectSystemManage context = (BulkCementDirectSystemManage) AopContext.currentProxy(); + switch (auditDataType) { + // 散装水泥供应量数据 + case 1: + assemblyBulkCementSupplyDataMap(context, auditDataIdList, dataMap, flag, reportMonth, regionDto,queryType); + break; + // 中转库进出量统计数据 + case 2: + assemblyBulkCementTransferDataMap(context, auditDataIdList, dataMap, flag, reportMonth,regionDto,queryType); + break; + // 温台舟使用量快报数据 + case 3: + assemblyBulkCementThreeCityUsageDataMap(context,auditDataIdList, dataMap, reportMonth, regionDto,queryType); + break; + // 混凝土供应量快报数据 + case 4: + assemblyConcreteSupplyDataMap(context,auditDataIdList, dataMap, flag, regionDto); + break; + // 砂浆供应量快报数据 + case 5: + assemblyMortarSupplyDataMap(context,auditDataIdList, dataMap, flag,reportMonth, regionDto,queryType); + break; + // 非禁现区域散装水泥销售使用情况数据 + case 6: + assemblyNonProAreasDataMap(context,auditDataIdList, dataMap, flag, regionDto, companyDto); + break; + // 散装水泥物流设施统计年报表数据 + case 7: + assemblyBulkCementLogFacStaDataMap(context,auditDataIdList, dataMap, flag, regionDto); + break; + // 散装水泥、预拌砂浆、干混砂浆物流装备统计年报表数据 + case 8: + assemblyMaterialLogEquipStaDataMap(context,auditDataIdList, dataMap, flag, regionDto); + break; + default: + throw new IllegalStateException("Unexpected value: " + auditDataType); + } + } + + private void assemblyMaterialLogEquipStaDataMap(BulkCementDirectSystemManage context, List auditDataIdList, Map dataMap, Boolean flag, RegionDTO regionDto) { + // 根据传入的关联数据ID列表,获取相关联的上报数据信息 + // 获取关联数据信息 + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class); + context.buildRelevanceDataMapQuery(wrapper, auditDataIdList); + List dataList = dataRelevanceService.list(wrapper); + if (CollUtil.isEmpty(dataList)){ + return; + } + + Map dataRelevanceMap = dataList.stream().collect(Collectors.toMap(BulkCementDirectReportSystemDataRelevance::getId, v -> v)); + List dataIdList = Lists.newArrayList(); + for (Long relevanceId : auditDataIdList) { + BulkCementDirectReportSystemDataRelevance relevance = dataRelevanceMap.get(relevanceId); + if (Objects.nonNull(relevance) && StringUtils.isNotBlank(relevance.getAuditDataIdList())) { + String auditDataIdListStr = relevance.getAuditDataIdList(); + List idList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + dataIdList.addAll(idList); + } + } + Map materialLogEquipStaAnnualReportMap = materialLogEquipStaAnnualReportService.list(Wrappers.lambdaQuery(MaterialLogisticEquipmentStatisticAnnualReport.class) + .in(MaterialLogisticEquipmentStatisticAnnualReport::getId, dataIdList)) + .stream().collect(Collectors.toMap(MaterialLogisticEquipmentStatisticAnnualReport::getId, v -> v)); + List vos8 = dataIdList.stream().map(a -> { + ResMaterialLogEquipStaDataUploadDetailVO resVo = new ResMaterialLogEquipStaDataUploadDetailVO(); + MaterialLogisticEquipmentStatisticAnnualReport materialLogEquipStaAnnualReport = materialLogEquipStaAnnualReportMap.get(a); + if (Objects.nonNull(materialLogEquipStaAnnualReport)) { + BeanUtils.copyProperties(materialLogEquipStaAnnualReport, resVo); + // 不为市合计数据 + resVo.setIsCityTotalData(Boolean.FALSE); + } + return resVo; + }).collect(Collectors.toList()); + // 先按装备名称分组 + // 专用汽车 + List specialVehicleDetailVos = vos8.stream() + .filter(v -> ReportConstant.SPECIAL_VEHICLE.equals(v.getEquipmentName())) + .collect(Collectors.toList()); + // 专用船 + List specialVesselDetailVos = vos8.stream() + .filter(v -> ReportConstant.SPECIAL_VESSEL.equals(v.getEquipmentName())) + .collect(Collectors.toList()); + // 散装水泥罐 + List bulkCementTankDetailVos = vos8.stream() + .filter(v -> ReportConstant.BULK_CEMENT_TANK.equals(v.getEquipmentName())) + .collect(Collectors.toList()); + // 混凝土搅拌车 + List concreteMixerTruckDetailVos = vos8.stream() + .filter(v -> ReportConstant.CONCRETE_MIXER_TRUCK.equals(v.getEquipmentName())) + .collect(Collectors.toList()); + // 混凝土泵车 + List concretePumpTruckDetailVos = vos8.stream() + .filter(v -> ReportConstant.CONCRETE_PUMP_TRUCK.equals(v.getEquipmentName())) + .collect(Collectors.toList()); + // 干混砂浆运输车 + List dryMixMortarTruckDetailVos = vos8.stream() + .filter(v -> ReportConstant.DRY_MIX_MORTAR_TRUCK.equals(v.getEquipmentName())) + .collect(Collectors.toList()); + // 干混砂浆移动简仓 + List dryMixMortarMovingStorageDetailVos = vos8.stream() + .filter(v -> ReportConstant.DRY_MIX_MORTAR_MOVING_STORAGE.equals(v.getEquipmentName())) + .collect(Collectors.toList()); + // 干混砂浆背罐车 + List dryMixMortarBackTankCarDetailVos = vos8.stream() + .filter(v -> ReportConstant.DRY_MIX_MORTAR_BACK_TANK_CAR.equals(v.getEquipmentName())) + .collect(Collectors.toList()); + + // 计算当前市各设备名称的合计数据,并加入到dataMap对应键值对中的vos中 + ResMaterialLogEquipStaDataUploadDetailVO vo1 = new ResMaterialLogEquipStaDataUploadDetailVO(); + ResMaterialLogEquipStaDataUploadDetailVO vo2 = new ResMaterialLogEquipStaDataUploadDetailVO(); + ResMaterialLogEquipStaDataUploadDetailVO vo3 = new ResMaterialLogEquipStaDataUploadDetailVO(); + ResMaterialLogEquipStaDataUploadDetailVO vo4 = new ResMaterialLogEquipStaDataUploadDetailVO(); + ResMaterialLogEquipStaDataUploadDetailVO vo5 = new ResMaterialLogEquipStaDataUploadDetailVO(); + ResMaterialLogEquipStaDataUploadDetailVO vo6 = new ResMaterialLogEquipStaDataUploadDetailVO(); + ResMaterialLogEquipStaDataUploadDetailVO vo7 = new ResMaterialLogEquipStaDataUploadDetailVO(); + ResMaterialLogEquipStaDataUploadDetailVO vo8 = new ResMaterialLogEquipStaDataUploadDetailVO(); + + vo1.setIsCityTotalData(Boolean.TRUE); + vo2.setIsCityTotalData(Boolean.TRUE); + vo3.setIsCityTotalData(Boolean.TRUE); + vo4.setIsCityTotalData(Boolean.TRUE); + vo5.setIsCityTotalData(Boolean.TRUE); + vo6.setIsCityTotalData(Boolean.TRUE); + vo7.setIsCityTotalData(Boolean.TRUE); + vo8.setIsCityTotalData(Boolean.TRUE); + CompanyDTO companyDto = companiesCacheHelper.getByName(regionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + vo1.setRegionName(ReportConstant.TOTAL); + vo2.setRegionName(ReportConstant.TOTAL); + vo3.setRegionName(ReportConstant.TOTAL); + vo4.setRegionName(ReportConstant.TOTAL); + vo5.setRegionName(ReportConstant.TOTAL); + vo6.setRegionName(ReportConstant.TOTAL); + vo7.setRegionName(ReportConstant.TOTAL); + vo8.setRegionName(ReportConstant.TOTAL); + + // 统计专用汽车各字段合计值 + Map dataMap1 = MapUtil.newHashMap(); + getCityMaterialLogEquipStaTotalData(specialVehicleDetailVos, vo1); + specialVehicleDetailVos.add(vo1); + // 单位名称改成了地区 + dataMap1.put(regionDto.getRegionName(),specialVehicleDetailVos); + dataMap.put(ReportConstant.SPECIAL_VEHICLE,dataMap1); + // 统计专用船各字段合计值 + Map dataMap2 = MapUtil.newHashMap(); + getCityMaterialLogEquipStaTotalData(specialVesselDetailVos, vo2); + specialVesselDetailVos.add(vo2); + // 单位名称改成了地区 + dataMap2.put(regionDto.getRegionName(),specialVesselDetailVos); + dataMap.put(ReportConstant.SPECIAL_VESSEL,dataMap2); + // 统计散装水泥罐各字段合计值 + Map dataMap3 = MapUtil.newHashMap(); + getCityMaterialLogEquipStaTotalData(bulkCementTankDetailVos, vo3); + bulkCementTankDetailVos.add(vo3); + // 单位名称改成了地区 + dataMap3.put(regionDto.getRegionName(),bulkCementTankDetailVos); + dataMap.put(ReportConstant.BULK_CEMENT_TANK,dataMap3); + + // 统计混凝土搅拌车各字段合计值 + Map dataMap4 = MapUtil.newHashMap(); + getCityMaterialLogEquipStaTotalData(concreteMixerTruckDetailVos, vo4); + concreteMixerTruckDetailVos.add(vo4); + // 单位名称改成了地区 + dataMap4.put(regionDto.getRegionName(),concreteMixerTruckDetailVos); + dataMap.put(ReportConstant.CONCRETE_MIXER_TRUCK,dataMap4); + // 统计混凝土泵车各字段合计值 + Map dataMap5 = MapUtil.newHashMap(); + getCityMaterialLogEquipStaTotalData(concretePumpTruckDetailVos, vo5); + concretePumpTruckDetailVos.add(vo5); + // 单位名称改成了地区 + dataMap5.put(regionDto.getRegionName(),concretePumpTruckDetailVos); + dataMap.put(ReportConstant.CONCRETE_PUMP_TRUCK,dataMap5); + // 统计干混砂浆运输车各字段合计值 + Map dataMap6 = MapUtil.newHashMap(); + getCityMaterialLogEquipStaTotalData(dryMixMortarTruckDetailVos, vo6); + dryMixMortarTruckDetailVos.add(vo6); + // 单位名称改成了地区 + dataMap6.put(regionDto.getRegionName(),dryMixMortarTruckDetailVos); + dataMap.put(ReportConstant.DRY_MIX_MORTAR_TRUCK,dataMap6); + + // 统计干混砂浆移动简仓各字段合计值 + Map dataMap7 = MapUtil.newHashMap(); + getCityMaterialLogEquipStaTotalData(dryMixMortarMovingStorageDetailVos, vo7); + dryMixMortarMovingStorageDetailVos.add(vo7); + // 单位名称改成了地区 + dataMap7.put(regionDto.getRegionName(),concretePumpTruckDetailVos); + dataMap.put(ReportConstant.DRY_MIX_MORTAR_MOVING_STORAGE,dataMap7); + // 统计干混砂浆背罐车各字段合计值 + Map dataMap8 = MapUtil.newHashMap(); + getCityMaterialLogEquipStaTotalData(dryMixMortarBackTankCarDetailVos, vo8); + dryMixMortarBackTankCarDetailVos.add(vo8); + // 单位名称改成了地区 + dataMap8.put(regionDto.getRegionName(),dryMixMortarBackTankCarDetailVos); + dataMap.put(ReportConstant.DRY_MIX_MORTAR_BACK_TANK_CAR,dataMap8); + } + private void assemblyBulkCementLogFacStaDataMap(BulkCementDirectSystemManage context, List auditDataIdList, Map dataMap, Boolean flag, RegionDTO regionDto) { + // 根据传入的关联数据ID列表,获取相关联的上报数据信息 + // 获取关联数据信息 + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class); + context.buildRelevanceDataMapQuery(wrapper, auditDataIdList); + List dataList = dataRelevanceService.list(wrapper); + if (CollUtil.isEmpty(dataList)){ + return; + } + + Map dataRelevanceMap = dataList.stream().collect(Collectors.toMap(BulkCementDirectReportSystemDataRelevance::getId, v -> v)); + List dataIdList = Lists.newArrayList(); + for (Long relevanceId : auditDataIdList) { + BulkCementDirectReportSystemDataRelevance relevance = dataRelevanceMap.get(relevanceId); + if (Objects.nonNull(relevance) && StringUtils.isNotBlank(relevance.getAuditDataIdList())) { + String auditDataIdListStr = relevance.getAuditDataIdList(); + List idList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + dataIdList.addAll(idList); + } + } + Map bulkCementLogFacStaAnnualReportMap = bulkCementLogFacStaAnnualReportService.list(Wrappers.lambdaQuery(BulkCementLogisticFacilityStatisticAnnualReport.class) + .in(BulkCementLogisticFacilityStatisticAnnualReport::getId, dataIdList)) + .stream().collect(Collectors.toMap(BulkCementLogisticFacilityStatisticAnnualReport::getId, v -> v)); + List vos7 = dataIdList.stream().map(a -> { + ResBulkCementLogFacStaDataUploadDetailVO resVo = new ResBulkCementLogFacStaDataUploadDetailVO(); + BulkCementLogisticFacilityStatisticAnnualReport bulkCementLogFacStaAnnualReport = bulkCementLogFacStaAnnualReportMap.get(a); + if (Objects.nonNull(bulkCementLogFacStaAnnualReport)) { + BeanUtils.copyProperties(bulkCementLogFacStaAnnualReport, resVo); + // 不为市合计数据 + resVo.setIsCityTotalData(Boolean.FALSE); + } + return resVo; + }).collect(Collectors.toList()); + // 先按设备名称分组 + // 发放库 + List issueLibDetailVos = vos7.stream() + .filter(v -> ReportConstant.ISSUE_LIBRARY.equals(v.getFacilityName())) + .collect(Collectors.toList()); + // 中转库 + List transferLibDetailVos = vos7.stream() + .filter(v -> ReportConstant.TRANSFER_LIBRARY.equals(v.getFacilityName())) + .collect(Collectors.toList()); + // 固定接收库 + List fixRecLibDetailVos = vos7.stream() + .filter(v -> ReportConstant.FIX_RECEIVE_LIBRARY.equals(v.getFacilityName())) + .collect(Collectors.toList()); + + // 计算当前市各设备名称的合计数据,并加入到dataMap对应键值对中的vos中 + ResBulkCementLogFacStaDataUploadDetailVO vo7 = new ResBulkCementLogFacStaDataUploadDetailVO(); + ResBulkCementLogFacStaDataUploadDetailVO vo8 = new ResBulkCementLogFacStaDataUploadDetailVO(); + ResBulkCementLogFacStaDataUploadDetailVO vo9 = new ResBulkCementLogFacStaDataUploadDetailVO(); + vo7.setIsCityTotalData(Boolean.TRUE); + vo8.setIsCityTotalData(Boolean.TRUE); + vo9.setIsCityTotalData(Boolean.TRUE); + + CompanyDTO companyDto = companiesCacheHelper.getByName(regionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + vo7.setRegionName(ReportConstant.TOTAL); + vo8.setRegionName(ReportConstant.TOTAL); + vo9.setRegionName(ReportConstant.TOTAL); + + // 统计发放库各字段合计值 + Map dataMap1 = MapUtil.newHashMap(); + getCityBulkCementLogFacStaTotalData(issueLibDetailVos, vo7); + issueLibDetailVos.add(vo7); + // 单位名称改成了地区 + dataMap1.put(regionDto.getRegionName(),issueLibDetailVos); + dataMap.put(ReportConstant.ISSUE_LIBRARY,dataMap1); + // 统计中转库各字段合计值 + Map dataMap2 = MapUtil.newHashMap(); + getCityBulkCementLogFacStaTotalData(transferLibDetailVos, vo8); + transferLibDetailVos.add(vo8); + // 单位名称改成了地区 + dataMap2.put(regionDto.getRegionName(),transferLibDetailVos); + dataMap.put(ReportConstant.TRANSFER_LIBRARY,dataMap2); + // 统计固定接收库各字段合计值 + Map dataMap3 = MapUtil.newHashMap(); + getCityBulkCementLogFacStaTotalData(fixRecLibDetailVos, vo9); + fixRecLibDetailVos.add(vo9); + // 单位名称改成了地区 + dataMap3.put(regionDto.getRegionName(),fixRecLibDetailVos); + dataMap.put(ReportConstant.FIX_RECEIVE_LIBRARY,dataMap3); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildRelevanceDataMapQuery(LambdaQueryWrapper wrapper, List auditDataIdList) { + wrapper.in(BulkCementDirectReportSystemDataRelevance::getId,auditDataIdList) + .select(BulkCementDirectReportSystemDataRelevance::getId, BulkCementDirectReportSystemDataRelevance::getAuditDataIdList); + } + + private void assemblyNonProAreasDataMap(BulkCementDirectSystemManage context, List auditDataIdList, Map dataMap, Boolean flag, RegionDTO regionDto, CompanyDTO companyDto) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NonProhibitedAreasBulkCementSalesUse.class); + context.buildNonProAreasDataMapQuery(wrapper, auditDataIdList); + List dataList = nonProhibitedAreasBulkCementSalesUseService.list(wrapper); + if (CollUtil.isEmpty(dataList)){ + return; + } + + Map nonProhibitedAreasBulkCementSalesUseMap = dataList.stream().collect(Collectors.toMap(NonProhibitedAreasBulkCementSalesUse::getId, v -> v)); + List vos6 = auditDataIdList.stream().map(a -> { + ResNonProhibitedAreasDataUploadDetailVO resVo = new ResNonProhibitedAreasDataUploadDetailVO(); + NonProhibitedAreasBulkCementSalesUse nonProhibitedAreasBulkCementSalesUse = nonProhibitedAreasBulkCementSalesUseMap.get(a); + if (Objects.nonNull(nonProhibitedAreasBulkCementSalesUse)) { + BeanUtils.copyProperties(nonProhibitedAreasBulkCementSalesUse, resVo); + // 不为市合计数据 + resVo.setIsCityTotalData(Boolean.FALSE); + } + return resVo; + }).collect(Collectors.toList()); + // 计算当前市的合计数据,并加入到dataMap对应键值对中的vos中 + ResNonProhibitedAreasDataUploadDetailVO vo6 = new ResNonProhibitedAreasDataUploadDetailVO(); + vo6.setIsCityTotalData(Boolean.TRUE); + vo6.setRegionName(ReportConstant.TOTAL); + // 统计各字段合计值 + getCityNonProAreasTotalData(vos6, vo6); + vos6.add(vo6); + // 单位名称改成了地区 + dataMap.put(regionDto.getRegionName(),vos6); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildNonProAreasDataMapQuery(LambdaQueryWrapper wrapper, List auditDataIdList) { + wrapper.in(NonProhibitedAreasBulkCementSalesUse::getId,auditDataIdList); + } + + private void assemblyMortarSupplyDataMap(BulkCementDirectSystemManage context, List auditDataIdList, Map dataMap, Boolean flag, LocalDateTime reportMonth, RegionDTO regionDto, Integer queryType) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(MortarSupplyBulletin.class); + context.buildMortarSupplyDataMapQuery(wrapper, auditDataIdList); + List dataList = mortarSupplyBulletinService.list(wrapper); + if (CollUtil.isEmpty(dataList)){ + return; + } + Map bulkCementSupplyBulletinMap = dataList.stream().collect(Collectors.toMap(MortarSupplyBulletin::getId, v -> v)); + List vos5 = auditDataIdList.stream().map(a -> { + ResMortarSupplyDataUploadDetailVO resVo = new ResMortarSupplyDataUploadDetailVO(); + MortarSupplyBulletin mortarSupplyBulletin = bulkCementSupplyBulletinMap.get(a); + if (Objects.nonNull(mortarSupplyBulletin)) { + BeanUtils.copyProperties(mortarSupplyBulletin, resVo); + // 不为市合计数据 + resVo.setIsCityTotalData(Boolean.FALSE); + } + return resVo; + }).collect(Collectors.toList()); + // 计算当前市的合计数据,并加入到dataMap对应键值对中的vos中 + ResMortarSupplyDataUploadDetailVO vo5 = new ResMortarSupplyDataUploadDetailVO(); + vo5.setIsCityTotalData(Boolean.TRUE); + // 如果登录用户是市级散办 + vo5.setRegionName(ReportConstant.TOTAL); + // 统计各字段合计值 + getCityMortarSupplyTotalData(vos5, vo5,reportMonth,regionDto,queryType); + vos5.add(vo5); + CompanyDTO companyDto = companiesCacheHelper.getByName(regionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + // 单位名称改成了地区 + dataMap.put(regionDto.getRegionName(),vos5); + } + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildMortarSupplyDataMapQuery(LambdaQueryWrapper wrapper, List auditDataIdList) { + wrapper.in(MortarSupplyBulletin::getId,auditDataIdList); + } + + private void assemblyConcreteSupplyDataMap(BulkCementDirectSystemManage context, List auditDataIdList, Map dataMap, Boolean flag, RegionDTO regionDto) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ConcreteSupplyBulletin.class); + context.buildConcreteSupplyDataMapQuery(wrapper, auditDataIdList); + List dataList = concreteSupplyBulletinService.list(wrapper); + if (CollUtil.isEmpty(dataList)){ + return; + } + Map concreteSupplyBulletinMap = dataList.stream().collect(Collectors.toMap(ConcreteSupplyBulletin::getId, v -> v)); + List vos4 = auditDataIdList.stream().map(a -> { + ResConcreteSupplyDataUploadDetailVO resVo = new ResConcreteSupplyDataUploadDetailVO(); + ConcreteSupplyBulletin concreteSupplyBulletin = concreteSupplyBulletinMap.get(a); + if (Objects.nonNull(concreteSupplyBulletin)) { + BeanUtils.copyProperties(concreteSupplyBulletin, resVo); + // 不为市合计数据 + resVo.setIsCityTotalData(Boolean.FALSE); + } + return resVo; + }).collect(Collectors.toList()); + // 计算当前市的合计数据,并加入到dataMap对应键值对中的vos中 + ResConcreteSupplyDataUploadDetailVO vo4 = new ResConcreteSupplyDataUploadDetailVO(); + vo4.setIsCityTotalData(Boolean.TRUE); + vo4.setUnitName(ReportConstant.TOTAL); + // 统计各字段合计值 + getCityConcreteSupplyTotalData(vos4, vo4); + vos4.add(vo4); + CompanyDTO companyDto = companiesCacheHelper.getByName(regionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + // 单位名称改成了地区 + dataMap.put(regionDto.getRegionName(),vos4); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildConcreteSupplyDataMapQuery(LambdaQueryWrapper wrapper, List auditDataIdList) { + wrapper.in(ConcreteSupplyBulletin::getId,auditDataIdList); + } + + private void assemblyBulkCementThreeCityUsageDataMap(BulkCementDirectSystemManage context, List auditDataIdList, Map dataMap, LocalDateTime reportMonth, RegionDTO regionDto, Integer queryType) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(BulkCementThreeCityUsageBulletin.class); + context.buildBulkCementThreeCityUsageDataMapQuery(wrapper, auditDataIdList); + List dataList = bulkCementThreeCityUsageBulletinService.list(wrapper); + if (CollUtil.isEmpty(dataList)){ + return; + } + Map bulkCementThreeCityUsageBulletinMap = dataList.stream().collect(Collectors.toMap(BulkCementThreeCityUsageBulletin::getId, v -> v)); + List vos3 = auditDataIdList.stream().map(a -> { + ResBulkCementThreeCityUsageDataUploadDetailVO resVo = new ResBulkCementThreeCityUsageDataUploadDetailVO(); + BulkCementThreeCityUsageBulletin bulkCementThreeCityUsageBulletin = bulkCementThreeCityUsageBulletinMap.get(a); + if (Objects.nonNull(bulkCementThreeCityUsageBulletin)) { + BeanUtils.copyProperties(bulkCementThreeCityUsageBulletin, resVo); + // 本省本月、外省本月数据需取整返回(其余在数据填报时已经做过处理,数据库中存的就是取整后的值) + BigDecimal thisProvinceThisMonthUsage = Objects.isNull(resVo.getThisProvinceThisMonthUsage()) ? BigDecimal.ZERO : resVo.getThisProvinceThisMonthUsage(); + resVo.setThisProvinceThisMonthUsage(thisProvinceThisMonthUsage.setScale(0, RoundingMode.HALF_UP)); + BigDecimal otherProvinceThisMonthUsage = Objects.isNull(resVo.getOtherProvinceThisMonthUsage()) ? BigDecimal.ZERO : resVo.getOtherProvinceThisMonthUsage(); + resVo.setThisMonthUsageTotal(otherProvinceThisMonthUsage.setScale(0, RoundingMode.HALF_UP)); + // 不为市合计数据 + resVo.setIsCityTotalData(Boolean.FALSE); + } + return resVo; + }).collect(Collectors.toList()); + // 计算当前市的合计数据,并加入到dataMap对应键值对中的vos中 + ResBulkCementThreeCityUsageDataUploadDetailVO vo3 = new ResBulkCementThreeCityUsageDataUploadDetailVO(); + vo3.setIsCityTotalData(Boolean.TRUE); + // 如果登录用户是市级散办,单位名称一列为合计 + // 登录用户是省散办不需要单独再加一条合计数据,dataMap中即为三个市各自上报的数据 + vo3.setUnitName(ReportConstant.TOTAL); + // 统计各字段合计值(与原数据一致,因为市登录用户只有一条数据) + getCityBulkCementThreeCityUsageTotalData(vos3, vo3,reportMonth,regionDto,queryType); + vos3.add(vo3); + CompanyDTO companyDto = companiesCacheHelper.getByName(regionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + // 单位名称改成了地区 + dataMap.put(regionDto.getRegionName(),vos3); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildBulkCementThreeCityUsageDataMapQuery(LambdaQueryWrapper wrapper, List auditDataIdList) { + wrapper.in(BulkCementThreeCityUsageBulletin::getId,auditDataIdList); + } + + private void assemblyBulkCementTransferDataMap(BulkCementDirectSystemManage context, List auditDataIdList, Map dataMap, Boolean flag, LocalDateTime reportMonth, RegionDTO regionDTO, Integer queryType) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(BulkCementTransferBulletin.class); + context.buildBulkCementTransferDataMapQuery(wrapper, auditDataIdList); + List dataList = bulkCementTransferBulletinService.list(wrapper); + if (CollUtil.isEmpty(dataList)){ + return; + } + Map bulkCementTransferBulletinMap = dataList.stream().collect(Collectors.toMap(BulkCementTransferBulletin::getId, v -> v)); + List vos2 = auditDataIdList.stream().map(a -> { + ResBulkCementTransferDataUploadDetailVO resVo = new ResBulkCementTransferDataUploadDetailVO(); + BulkCementTransferBulletin bulkCementTransferBulletin = bulkCementTransferBulletinMap.get(a); + if (Objects.nonNull(bulkCementTransferBulletin)) { + BeanUtils.copyProperties(bulkCementTransferBulletin, resVo); + // 不为市合计数据 + resVo.setIsCityTotalData(Boolean.FALSE); + } + return resVo; + }).collect(Collectors.toList()); + // 计算当前市的合计数据,并加入到dataMap对应键值对中的vos中 + ResBulkCementTransferDataUploadDetailVO vo2 = new ResBulkCementTransferDataUploadDetailVO(); + vo2.setIsCityTotalData(Boolean.TRUE); + vo2.setUnitName(ReportConstant.TOTAL); + // 统计各字段合计值 + getCityBulkCementTransferTotalData(vos2, vo2,reportMonth,regionDTO,queryType); + vos2.add(vo2); + CompanyDTO companyDto = companiesCacheHelper.getByName(regionDTO.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + // 单位名称改成了地区 + dataMap.put(regionDTO.getRegionName(),vos2); + } + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildBulkCementTransferDataMapQuery(LambdaQueryWrapper wrapper, List auditDataIdList) { + wrapper.in(BulkCementTransferBulletin::getId,auditDataIdList); + } + + private void assemblyBulkCementSupplyDataMap(BulkCementDirectSystemManage context, List auditDataIdList, Map dataMap, Boolean flag, LocalDateTime reportMonth, RegionDTO regionDTO, Integer queryType) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(BulkCementSupplyBulletin.class); + context.buildBulkCementSupplyDataMapQuery(wrapper, auditDataIdList); + List dataList = bulkCementSupplyBulletinService.list(wrapper); + if (CollUtil.isEmpty(dataList)){ + return; + } + Map bulkCementSupplyBulletinMap = dataList.stream().collect(Collectors.toMap(BulkCementSupplyBulletin::getId, v -> v)); + List vos1 = auditDataIdList.stream().map(a -> { + ResBulkCementSupplyDataUploadDetailVO resVo = new ResBulkCementSupplyDataUploadDetailVO(); + BulkCementSupplyBulletin bulkCementSupplyBulletin = bulkCementSupplyBulletinMap.get(a); + if (Objects.nonNull(bulkCementSupplyBulletin)) { + BeanUtils.copyProperties(bulkCementSupplyBulletin, resVo); + // 不为市合计数据 + resVo.setIsCityTotalData(Boolean.FALSE); + } + return resVo; + }).collect(Collectors.toList()); + // 计算当前市的合计数据,并加入到dataMap对应键值对中的vos中 + ResBulkCementSupplyDataUploadDetailVO vo1 = new ResBulkCementSupplyDataUploadDetailVO(); + vo1.setIsCityTotalData(Boolean.TRUE); + // 如果登录用户是市级散办 + vo1.setUnitName(ReportConstant.TOTAL); + // 如果是省散办查询页面,需要返回查询上报月份所在年份各市设定的散装率目标 + if (Boolean.TRUE.equals(flag)) { + int year = reportMonth.getYear(); + BulkCementDirectReportSystemUniversalIndex universalIndex = universalIndexService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemUniversalIndex.class) + .eq(BulkCementDirectReportSystemUniversalIndex::getYear, year) + .eq(BulkCementDirectReportSystemUniversalIndex::getRegionId, regionDTO.getId())); + if (Objects.nonNull(universalIndex)){ + vo1.setBulkRateTarget(universalIndex.getBulkRateTarget()); + } + } + // 统计各字段合计值 + getCityBulkCementSupplyTotalData(vos1, vo1,reportMonth,regionDTO,queryType); + vos1.add(vo1); + CompanyDTO companyDto = companiesCacheHelper.getByName(regionDTO.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + // 单位名称改成了地区 + dataMap.put(regionDTO.getRegionName(),vos1); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildBulkCementSupplyDataMapQuery(LambdaQueryWrapper wrapper, List auditDataIdList) { + wrapper.in(BulkCementSupplyBulletin::getId, auditDataIdList); + } + + private void getCityBulkCementSupplyTotalData(List vos, ResBulkCementSupplyDataUploadDetailVO vo, LocalDateTime reportMonth, RegionDTO regionDTO, Integer queryType) { + // 合计散装水泥总量 + List bulkCementAmountList = vos.stream().map(ResBulkCementSupplyDataUploadDetailVO::getBulkCementAmount).collect(Collectors.toList()); + // 合计水泥产量 + List cementOutputList = vos.stream().map(ResBulkCementSupplyDataUploadDetailVO::getCementOutput).collect(Collectors.toList()); + // 合计完成量 + List completedAmountList = vos.stream().map(ResBulkCementSupplyDataUploadDetailVO::getCompletedTotalAmount).collect(Collectors.toList()); + // 合计水泥产量 + List cumulativeCementProductionList = vos.stream().map(ResBulkCementSupplyDataUploadDetailVO::getCumulativeCementProduction).collect(Collectors.toList()); + // 合计增加量 + List incrementList = vos.stream().map(ResBulkCementSupplyDataUploadDetailVO::getIncrement).collect(Collectors.toList()); + // 去年这个月的合计完成量 + List childRegionIdList; + if (QueryTypeEnum.QUERY_LIST.getCode().equals(queryType)) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId; + if (userDetail.getRegionId().equals(DefValConstants.SYSTEM_ID)){ + regionId = DefValConstants.ZJREGION_ID; + }else { + regionId = userDetail.getRegionId(); + } + childRegionIdList = regionsCacheHelper.listChildRegionId(regionId, false, true); + }else { + childRegionIdList = regionsCacheHelper.listChildRegionId(regionDTO.getId(), true, true); + } + LocalDateTime preYearReportMonth = reportMonth.minusYears(1L); + List preYearDataList = bulkCementSupplyBulletinService.list(Wrappers.lambdaQuery(BulkCementSupplyBulletin.class) + .eq(BulkCementSupplyBulletin::getReportMonth, preYearReportMonth) + .in(BulkCementSupplyBulletin::getRegionId, childRegionIdList)); + List preYearCompletedAmountList = preYearDataList.stream().map(BulkCementSupplyBulletin::getCompletedTotalAmount).collect(Collectors.toList()); + + BigDecimal bulkCementAmountTotal = bulkCementAmountList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setBulkCementAmountTotal(bulkCementAmountTotal); + BigDecimal cementOutputTotal = cementOutputList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setCementOutputTotal(cementOutputTotal); + BigDecimal completedAmountTotal = completedAmountList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setCompletedTotalAmountTotal(completedAmountTotal); + BigDecimal cumulativeCementProductionTotal = cumulativeCementProductionList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setCumulativeCementProductionTotal(cumulativeCementProductionTotal); + BigDecimal incrementTotal = incrementList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setIncrementTotal(incrementTotal); + // 合计散装率: 合计完成量 / 合计水泥产量 * 100 + BigDecimal bulkRateTotal; + if (BigDecimal.ZERO.compareTo(cumulativeCementProductionTotal) != 0) { + bulkRateTotal = completedAmountTotal.divide(cumulativeCementProductionTotal, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + }else { + bulkRateTotal = completedAmountTotal.multiply(BigDecimal.valueOf(100L)); + } + vo.setBulkRateTotal(bulkRateTotal); + // 合计增长率:合计增长量 / 去年这个月的合计完成量 * 100 + BigDecimal preYearCompletedAmountTotal = preYearCompletedAmountList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + BigDecimal increaseRateTotal; + if (BigDecimal.ZERO.compareTo(preYearCompletedAmountTotal) != 0) { + increaseRateTotal = incrementTotal.divide(preYearCompletedAmountTotal, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + }else { + increaseRateTotal = incrementTotal.multiply(BigDecimal.valueOf(100L)); + } + vo.setIncreaseRateTotal(increaseRateTotal); + } + + private void getCityBulkCementTransferTotalData(List vos, ResBulkCementTransferDataUploadDetailVO vo, LocalDateTime reportMonth, RegionDTO regionDTO, Integer queryType) { + // 合计上月末库存 + List lastMonthEndInventoryList = vos.stream().map(ResBulkCementTransferDataUploadDetailVO::getLastMonthEndInventory).collect(Collectors.toList()); + // 合计本月进库量 + List thisMonthIncomingStorageList = vos.stream().map(ResBulkCementTransferDataUploadDetailVO::getThisMonthIncomingStorage).collect(Collectors.toList()); + // 合计累计进库量 + List cumulativeIncomingStorageList = vos.stream().map(ResBulkCementTransferDataUploadDetailVO::getCumulativeIncomingStorage).collect(Collectors.toList()); + // 合计本月出库量 + List thisMonthOutgoingStorageList = vos.stream().map(ResBulkCementTransferDataUploadDetailVO::getThisMonthOutgoingStorage).collect(Collectors.toList()); + // 合计累计出库量 + List cumulativeOutgoingStorageList = vos.stream().map(ResBulkCementTransferDataUploadDetailVO::getCumulativeOutgoingStorage).collect(Collectors.toList()); + // 合计库存量 + List monthEndInventoryList = vos.stream().map(ResBulkCementTransferDataUploadDetailVO::getMonthEndInventory).collect(Collectors.toList()); + + // 去年这个月的合计库存量 + LocalDateTime preYearReportMonth = reportMonth.minusYears(1L); + List childRegionIdList = Lists.newArrayList(); + if (QueryTypeEnum.QUERY_LIST.getCode().equals(queryType)) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId; + if (userDetail.getRegionId().equals(DefValConstants.SYSTEM_ID)){ + regionId = DefValConstants.ZJREGION_ID; + }else { + regionId = userDetail.getRegionId(); + } + childRegionIdList = regionsCacheHelper.listChildRegionId(regionId, false, true); + }else { + childRegionIdList = regionsCacheHelper.listChildRegionId(regionDTO.getId(), true, true); + } + List preYearDataList = bulkCementTransferBulletinService.list(Wrappers.lambdaQuery(BulkCementTransferBulletin.class) + .eq(BulkCementTransferBulletin::getReportMonth, preYearReportMonth) + .in(BulkCementTransferBulletin::getRegionId, childRegionIdList)); + List preYearMonthEndInventoryList = preYearDataList.stream().map(BulkCementTransferBulletin::getMonthEndInventory).collect(Collectors.toList()); + BigDecimal lastMonthEndInventoryTotal = lastMonthEndInventoryList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setLastMonthEndInventoryTotal(lastMonthEndInventoryTotal); + BigDecimal thisMonthIncomingStorageTotal = thisMonthIncomingStorageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisMonthIncomingStorageTotal(thisMonthIncomingStorageTotal); + BigDecimal cumulativeIncomingStorageTotal = cumulativeIncomingStorageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setCumulativeIncomingStorageTotal(cumulativeIncomingStorageTotal); + BigDecimal thisMonthOutgoingStorageTotal = thisMonthOutgoingStorageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisMonthOutgoingStorageTotal(thisMonthOutgoingStorageTotal); + BigDecimal cumulativeOutgoingStorageTotal = cumulativeOutgoingStorageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setCumulativeOutgoingStorageTotal(cumulativeOutgoingStorageTotal); + BigDecimal monthEndInventoryTotal = monthEndInventoryList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setMonthEndInventoryTotal(monthEndInventoryTotal); + // 合计同比增长率:(合计月末库存量 - 去年合计月末库存量) / 去年合计月末库存量 * 100 + BigDecimal preYearMonthEndInventoryTotal = preYearMonthEndInventoryList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + BigDecimal monthEndInventoryGrowthRateTotal = BigDecimal.ZERO; + if (BigDecimal.ZERO.compareTo(monthEndInventoryTotal) != 0){ + if (BigDecimal.ZERO.compareTo(preYearMonthEndInventoryTotal) != 0) { + BigDecimal subtract = monthEndInventoryTotal.subtract(preYearMonthEndInventoryTotal); + monthEndInventoryGrowthRateTotal = subtract.divide(preYearMonthEndInventoryTotal, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100L)); + }else { + monthEndInventoryGrowthRateTotal = monthEndInventoryTotal.multiply(BigDecimal.valueOf(100L)); + } + } + vo.setMonthEndInventoryGrowthRateTotal(monthEndInventoryGrowthRateTotal); + } + + private void getCityBulkCementThreeCityUsageTotalData(List vos, ResBulkCementThreeCityUsageDataUploadDetailVO vo, LocalDateTime reportMonth, RegionDTO regionDto, Integer queryType) { + // 合计年目标 + List yearTargetList = vos.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getYearTarget).collect(Collectors.toList()); + // 合计占全年目标百分比 + List percentageOfAnnualTargetList = vos.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getPercentageOfAnnualTarget).collect(Collectors.toList()); + // 合计本月使用量 + List thisMonthUsageList = vos.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getThisMonthUsage).collect(Collectors.toList()); + // 合计累计使用量 + List accumulativeUsageList = vos.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getAccumulativeUsage).collect(Collectors.toList()); + + // 去年这个月的合计累计使用量 + List childRegionIdList = Lists.newArrayList(); + if (QueryTypeEnum.QUERY_LIST.getCode().equals(queryType)) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId; + if (userDetail.getRegionId().equals(DefValConstants.SYSTEM_ID)){ + regionId = DefValConstants.ZJREGION_ID; + }else { + regionId = userDetail.getRegionId(); + } + childRegionIdList = regionsCacheHelper.listChildRegionId(regionId, false, true); + }else { + childRegionIdList = regionsCacheHelper.listChildRegionId(regionDto.getId(), true, true);; + } + LocalDateTime preYearReportMonth = reportMonth.minusYears(1L); + List preYearReportMonthDataList = bulkCementThreeCityUsageBulletinService.list(Wrappers.lambdaQuery(BulkCementThreeCityUsageBulletin.class) + .eq(BulkCementThreeCityUsageBulletin::getReportMonth, preYearReportMonth) + .in(BulkCementThreeCityUsageBulletin::getRegionId,childRegionIdList)); + List preYearAccumulativeUsage = preYearReportMonthDataList.stream().map(BulkCementThreeCityUsageBulletin::getAccumulativeUsage).collect(Collectors.toList()); + // 合计本省本月使用量 + List thisProvinceThisMonthUsageList = vos.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getThisProvinceThisMonthUsage).collect(Collectors.toList()); + // 合计本省累计使用量 + List thisProvinceAccumulativeUsageList = vos.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getThisProvinceAccumulativeUsage).collect(Collectors.toList()); + // 合计外省本月使用量 + List otherProvinceThisMonthUsageList = vos.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getOtherProvinceThisMonthUsage).collect(Collectors.toList()); + // 合计外省累计使用量 + List otherProvinceAccumulativeUsageList = vos.stream().map(ResBulkCementThreeCityUsageDataUploadDetailVO::getOtherProvinceAccumulativeUsage).collect(Collectors.toList()); + + BigDecimal yearTargetTotal = yearTargetList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setYearTargetTotal(yearTargetTotal); + BigDecimal percentageOfAnnualTargetTotal = percentageOfAnnualTargetList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setPercentageOfAnnualTargetTotal(percentageOfAnnualTargetTotal); + BigDecimal thisMonthUsageTotal = thisMonthUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisMonthUsageTotal(thisMonthUsageTotal); + BigDecimal accumulativeUsageTotal = accumulativeUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setAccumulativeUsageTotal(accumulativeUsageTotal); + // 合计同比增长率 = (今年合计累计使用量 - 去年合计累计使用量) / 去年合计累计使用量 * 100 + BigDecimal growthRateTotal = BigDecimal.ZERO; + BigDecimal preYearAccumulativeUsageTotal = preYearAccumulativeUsage.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + if (BigDecimal.ZERO.compareTo(accumulativeUsageTotal) != 0) { + if (BigDecimal.ZERO.compareTo(preYearAccumulativeUsageTotal) != 0) { + BigDecimal subtract = accumulativeUsageTotal.subtract(preYearAccumulativeUsageTotal); + growthRateTotal = subtract.divide(preYearAccumulativeUsageTotal, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100L)); + }else { + growthRateTotal = accumulativeUsageTotal.multiply(BigDecimal.valueOf(100L)); + } + } + vo.setGrowthRateTotal(growthRateTotal); + BigDecimal thisProvinceThisMonthUsageTotal = thisProvinceThisMonthUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisProvinceThisMonthUsageTotal(thisProvinceThisMonthUsageTotal); + BigDecimal thisProvinceAccumulativeUsageTotal = thisProvinceAccumulativeUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisProvinceAccumulativeUsageTotal(thisProvinceAccumulativeUsageTotal); + BigDecimal otherProvinceThisMonthUsageTotal = otherProvinceThisMonthUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setOtherProvinceThisMonthUsageTotal(otherProvinceThisMonthUsageTotal); + BigDecimal otherProvinceAccumulativeUsageTotal = otherProvinceAccumulativeUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setOtherProvinceAccumulativeUsageTotal(otherProvinceAccumulativeUsageTotal); + } + private void getCityConcreteSupplyTotalData(List vos, ResConcreteSupplyDataUploadDetailVO vo) { + // 合计三类指导目标 + List threeCategoryGuidGoalList = vos.stream().map(ResConcreteSupplyDataUploadDetailVO::getThreeCategoryGuidGoal).collect(Collectors.toList()); + // 合计生产企业数量 + List productionCompanyNumsList = vos.stream().map(ResConcreteSupplyDataUploadDetailVO::getProductionCompanyNums).collect(Collectors.toList()); + // 合计年设计生产能力 + List annualDesignProductionCapacityList = vos.stream().map(ResConcreteSupplyDataUploadDetailVO::getAnnualDesignProductionCapacity).collect(Collectors.toList()); + // 合计本月实际产量 + List thisMonthOutputList = vos.stream().map(ResConcreteSupplyDataUploadDetailVO::getThisMonthOutput).collect(Collectors.toList()); + // 合计累计实际产量 + List accumulativeOutputList = vos.stream().map(ResConcreteSupplyDataUploadDetailVO::getAccumulativeOutput).collect(Collectors.toList()); + // 合计本月使用散装水泥量 + List thisMonthCementUsageList = vos.stream().map(ResConcreteSupplyDataUploadDetailVO::getThisMonthCementUsage).collect(Collectors.toList()); + // 合计累计使用散装水泥量 + List cementAccumulativeUsageList = vos.stream().map(ResConcreteSupplyDataUploadDetailVO::getCementAccumulativeUsage).collect(Collectors.toList()); + // 合计本月废弃物综合利用量 + List thisMonthWasteUtilizationList = vos.stream().map(ResConcreteSupplyDataUploadDetailVO::getThisMonthWasteUtilization).collect(Collectors.toList()); + // 合计累计废弃物综合利用量 + List accumulativeWasteUtilizationList = vos.stream().map(ResConcreteSupplyDataUploadDetailVO::getAccumulativeWasteUtilization).collect(Collectors.toList()); + + BigDecimal threeCategoryGuidGoalTotal = threeCategoryGuidGoalList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThreeCategoryGuidGoalTotal(threeCategoryGuidGoalTotal); + int productionCompanyNumsTotal = productionCompanyNumsList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setProductionCompanyNumsTotal(productionCompanyNumsTotal); + BigDecimal annualDesignProductionCapacityTotal = annualDesignProductionCapacityList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setAnnualDesignProductionCapacityTotal(annualDesignProductionCapacityTotal); + BigDecimal thisMonthOutputTotal = thisMonthOutputList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisMonthOutputTotal(thisMonthOutputTotal); + BigDecimal accumulativeOutputTotal = accumulativeOutputList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setAccumulativeOutputTotal(accumulativeOutputTotal); + BigDecimal thisMonthCementUsageTotal = thisMonthCementUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisMonthCementUsageTotal(thisMonthCementUsageTotal); + BigDecimal cementAccumulativeUsageTotal = cementAccumulativeUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setCementAccumulativeUsageTotal(cementAccumulativeUsageTotal); + BigDecimal thisMonthWasteUtilizationTotal = thisMonthWasteUtilizationList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisMonthWasteUtilizationTotal(thisMonthWasteUtilizationTotal); + BigDecimal accumulativeWasteUtilizationTotal = accumulativeWasteUtilizationList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setAccumulativeWasteUtilizationTotal(accumulativeWasteUtilizationTotal); + } + + private void getCityMortarSupplyTotalData(List vos, ResMortarSupplyDataUploadDetailVO vo, LocalDateTime reportMonth, RegionDTO regionDto, Integer queryType) { + // 合计二类指导目标 + List twoCategoryGuidGoalList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getTwoCategoryGuidGoal).collect(Collectors.toList()); + // 合计普通干混砂浆生产企业数量 + List dryMixedMortarProductionCompanyNumList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarProductionCompanyNum).collect(Collectors.toList()); + // 合计普通干混砂浆生产总能力 + List dryMixedMortarProductiveCapacityList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarProductiveCapacity).collect(Collectors.toList()); + // 合计普通干混砂浆散装能力 + List dryMixedMortarBulkCapacityList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarBulkCapacity).collect(Collectors.toList()); + // 合计本月总产量 + List thisMonthTotalOutputList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getThisMonthTotalOutput).collect(Collectors.toList()); + // 合计本月累计总产量 + List thisMonthAccumulativeOutputList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getThisMonthAccumulativeOutput).collect(Collectors.toList()); + // 合计普通干混砂浆本月产量 + List dryMixedMortarThisMonthOutputList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarThisMonthOutput).collect(Collectors.toList()); + // 合计普通干混砂浆累计产量 + List dryMixedMortarThisMonthAccumulativeOutputList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarThisMonthAccumulativeOutput).collect(Collectors.toList()); + // 合计普通干混砂浆同比增长量 + List dryMixedMortarIncrementList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarIncrement).collect(Collectors.toList()); + + // 合计去年这个月普通干混砂浆累计产量 + LocalDateTime preYearReportMonth = reportMonth.minusYears(1L); + List childRegionIdList = Lists.newArrayList(); + if (QueryTypeEnum.QUERY_LIST.getCode().equals(queryType)) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId; + if (userDetail.getRegionId().equals(DefValConstants.SYSTEM_ID)){ + regionId = DefValConstants.ZJREGION_ID; + }else { + regionId = userDetail.getRegionId(); + } + childRegionIdList = regionsCacheHelper.listChildRegionId(regionId, false, true); + }else { + childRegionIdList = regionsCacheHelper.listChildRegionId(regionDto.getId(), true, true); + } + List preYearDataList = mortarSupplyBulletinService.list(Wrappers.lambdaQuery(MortarSupplyBulletin.class) + .eq(MortarSupplyBulletin::getReportMonth, preYearReportMonth) + .in(MortarSupplyBulletin::getRegionId, childRegionIdList)); + List preYearDryMixedMortarThisMonthAccumulativeOutputList = preYearDataList.stream().map(MortarSupplyBulletin::getDryMixedMortarThisMonthAccumulativeOutput).collect(Collectors.toList()); + + // 合计普通干混砂浆本月散装量 + List dryMixedMortarThisMonthBulkQuantityList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarThisMonthBulkQuantity).collect(Collectors.toList()); + // 合计普通干混砂浆累计散装量 + List dryMixedMortarAccumulativeBulkQuantityList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getDryMixedMortarAccumulativeBulkQuantity).collect(Collectors.toList()); + // 合计湿拌砂浆本月产量 + List wetMortarThisMonthOutputList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getWetMortarThisMonthOutput).collect(Collectors.toList()); + // 合计湿拌砂浆累计产量 + List wetMortarAccumulativeOutputList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getWetMortarAccumulativeOutput).collect(Collectors.toList()); + // 合计散装水泥本月使用量 + List bulkCementThisMonthUsageList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getBulkCementThisMonthUsage).collect(Collectors.toList()); + // 合计散装水泥累计使用量 + List bulkCementAccumulativeUsageList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getBulkCementAccumulativeUsage).collect(Collectors.toList()); + // 合计废弃物本月综合利用量 + List wasteThisMonthComprehensiveUtilizationList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getWasteThisMonthComprehensiveUtilization).collect(Collectors.toList()); + // 合计废弃物累计综合利用量 + List wasteAccumulativeComprehensiveUtilizationList = vos.stream().map(ResMortarSupplyDataUploadDetailVO::getWasteAccumulativeComprehensiveUtilization).collect(Collectors.toList()); + + BigDecimal twoCategoryGuidGoalTotal = twoCategoryGuidGoalList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setTwoCategoryGuidGoalTotal(twoCategoryGuidGoalTotal); + int dryMixedMortarProductionCompanyNumTotal = dryMixedMortarProductionCompanyNumList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setDryMixedMortarProductionCompanyNumTotal(dryMixedMortarProductionCompanyNumTotal); + BigDecimal dryMixedMortarProductiveCapacityTotal = dryMixedMortarProductiveCapacityList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setDryMixedMortarProductiveCapacityTotal(dryMixedMortarProductiveCapacityTotal); + BigDecimal dryMixedMortarBulkCapacityTotal = dryMixedMortarBulkCapacityList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setDryMixedMortarBulkCapacityTotal(dryMixedMortarBulkCapacityTotal); + + BigDecimal thisMonthTotalOutputTotal = thisMonthTotalOutputList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisMonthTotalOutputTotal(thisMonthTotalOutputTotal); + BigDecimal thisMonthAccumulativeOutputTotal = thisMonthAccumulativeOutputList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisMonthAccumulativeOutputTotal(thisMonthAccumulativeOutputTotal); + BigDecimal dryMixedMortarThisMonthOutputTotal = dryMixedMortarThisMonthOutputList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setDryMixedMortarThisMonthOutputTotal(dryMixedMortarThisMonthOutputTotal); + BigDecimal dryMixedMortarThisMonthAccumulativeOutputTotal = dryMixedMortarThisMonthAccumulativeOutputList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setDryMixedMortarThisMonthAccumulativeOutputTotal(dryMixedMortarThisMonthAccumulativeOutputTotal); + BigDecimal dryMixedMortarIncrementTotal = dryMixedMortarIncrementList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setDryMixedMortarIncrementTotal(dryMixedMortarIncrementTotal); + BigDecimal preYearDryMixedMortarThisMonthAccumulativeOutputTotal = preYearDryMixedMortarThisMonthAccumulativeOutputList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + // 合计普通干混砂浆增长率: 合计普通干混砂浆同比增长量 / 合计去年这个月普通干混砂浆累计产量 * 100 + BigDecimal dryMixedMortarGrowthRateTotal = BigDecimal.ZERO; + if (BigDecimal.ZERO.compareTo(preYearDryMixedMortarThisMonthAccumulativeOutputTotal) != 0){ + dryMixedMortarGrowthRateTotal = dryMixedMortarIncrementTotal.divide(preYearDryMixedMortarThisMonthAccumulativeOutputTotal, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + } + vo.setDryMixedMortarGrowthRateTotal(dryMixedMortarGrowthRateTotal); + BigDecimal dryMixedMortarThisMonthBulkQuantityTotal = dryMixedMortarThisMonthBulkQuantityList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setDryMixedMortarThisMonthBulkQuantityTotal(dryMixedMortarThisMonthBulkQuantityTotal); + BigDecimal dryMixedMortarAccumulativeBulkQuantityTotal = dryMixedMortarAccumulativeBulkQuantityList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setDryMixedMortarAccumulativeBulkQuantityTotal(dryMixedMortarAccumulativeBulkQuantityTotal); + BigDecimal wetMortarThisMonthOutputTotal = wetMortarThisMonthOutputList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setWetMortarThisMonthOutputTotal(wetMortarThisMonthOutputTotal); + BigDecimal wetMortarAccumulativeOutputTotal = wetMortarAccumulativeOutputList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setWetMortarAccumulativeOutputTotal(wetMortarAccumulativeOutputTotal); + BigDecimal bulkCementThisMonthUsageTotal = bulkCementThisMonthUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setBulkCementThisMonthUsageTotal(bulkCementThisMonthUsageTotal); + BigDecimal bulkCementAccumulativeUsageTotal = bulkCementAccumulativeUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setBulkCementAccumulativeUsageTotal(bulkCementAccumulativeUsageTotal); + BigDecimal wasteThisMonthComprehensiveUtilizationTotal = wasteThisMonthComprehensiveUtilizationList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setWasteThisMonthComprehensiveUtilizationTotal(wasteThisMonthComprehensiveUtilizationTotal); + BigDecimal wasteAccumulativeComprehensiveUtilizationTotal = wasteAccumulativeComprehensiveUtilizationList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setWasteAccumulativeComprehensiveUtilizationTotal(wasteAccumulativeComprehensiveUtilizationTotal); + } + + private void getCityNonProAreasTotalData(List vos, ResNonProhibitedAreasDataUploadDetailVO vo) { + // 合计销售点总数 + List salePointAccumulativeNumList = vos.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getSalePointAccumulativeNum).collect(Collectors.toList()); + // 合计水泥企业建点数量 + List cementCompanyBuildPointNumList = vos.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getCementCompanyBuildPointNum).collect(Collectors.toList()); + // 合计其他投资建点数量 + List otherInvestmentBuildPointNumList = vos.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getOtherInvestmentBuildPointNum).collect(Collectors.toList()); + // 合计销售量 + List saleVolumeList = vos.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getSaleVolume).collect(Collectors.toList()); + // 合计散装水泥罐数量 + List bulkCementTankNumList = vos.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getBulkCementTankNum).collect(Collectors.toList()); + + // 合计散装水泥罐容量 + List bulkCementTankCapacityList = vos.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getBulkCementTankCapacity).collect(Collectors.toList()); + // 合计水泥使用量 + List cementUsageList = vos.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getCementUsage).collect(Collectors.toList()); + // 合计散装水泥使用量 + List bulkCementUsageList = vos.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getBulkCementUsage).collect(Collectors.toList()); + // 合计生产预拌混凝土使用散装水泥量 + List readyMixedConcreteBulkCementUsageList = vos.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getReadyMixedConcreteBulkCementUsage).collect(Collectors.toList()); + // 合计生产水泥制品使用散装水泥量 + List cementProductsBulkCementUsageList = vos.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getCementProductsBulkCementUsage).collect(Collectors.toList()); + + // 合计非禁现区生产预拌混凝土产量 + List readyMixedConcreteOutputList = vos.stream().map(ResNonProhibitedAreasDataUploadDetailVO::getReadyMixedConcreteOutput).collect(Collectors.toList()); + + int salePointAccumulativeNumTotal = salePointAccumulativeNumList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setSalePointAccumulativeNumTotal(salePointAccumulativeNumTotal); + int cementCompanyBuildPointNumTotal = cementCompanyBuildPointNumList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setCementCompanyBuildPointNumTotal(cementCompanyBuildPointNumTotal); + int otherInvestmentBuildPointNumTotal = otherInvestmentBuildPointNumList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setOtherInvestmentBuildPointNumTotal(otherInvestmentBuildPointNumTotal); + BigDecimal saleVolumeTotal = saleVolumeList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setSaleVolumeTotal(saleVolumeTotal); + int bulkCementTankNumTotal = bulkCementTankNumList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setBulkCementTankNumTotal(bulkCementTankNumTotal); + + BigDecimal bulkCementTankCapacityTotal = bulkCementTankCapacityList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setBulkCementTankCapacityTotal(bulkCementTankCapacityTotal); + BigDecimal cementUsageTotal = cementUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setCementUsageTotal(cementUsageTotal); + BigDecimal bulkCementUsageTotal = bulkCementUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setBulkCementUsageTotal(bulkCementUsageTotal); + BigDecimal readyMixedConcreteBulkCementUsageTotal = readyMixedConcreteBulkCementUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setReadyMixedConcreteBulkCementUsageTotal(readyMixedConcreteBulkCementUsageTotal); + BigDecimal cementProductsBulkCementUsageTotal = cementProductsBulkCementUsageList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setCementProductsBulkCementUsageTotal(cementProductsBulkCementUsageTotal); + + // 合计散装水泥使用率: 合计散装水泥使用量 / 合计水泥使用量 * 100 + BigDecimal bulkCementUsageRateTotal = bulkCementUsageTotal.divide(cementUsageTotal, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + vo.setBulkCementUsageRateTotal(bulkCementUsageRateTotal); + + BigDecimal readyMixedConcreteOutputTotal = readyMixedConcreteOutputList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setReadyMixedConcreteOutputTotal(readyMixedConcreteOutputTotal); + + } + private void getCityBulkCementLogFacStaTotalData(List vos, ResBulkCementLogFacStaDataUploadDetailVO vo) { + // 合计年初数量 + List yearBeginNumList = vos.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getYearBeginNum).collect(Collectors.toList()); + // 合计年初容量 + List yearBeginCapacityList = vos.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getYearBeginCapacity).collect(Collectors.toList()); + // 合计本年新增容量 + List thisYearNewAddCapacityList = vos.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getThisYearNewAddCapacity).collect(Collectors.toList()); + // 合计本年新增数量 + List thisYearNewAddNumList = vos.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getThisYearNewAddNum).collect(Collectors.toList()); + // 合计本年报废数量 + List thisYearScrapNumList = vos.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getThisYearScrapNum).collect(Collectors.toList()); + + // 合计本年报废容量 + List thisYearScrapCapacityList = vos.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getThisYearScrapCapacity).collect(Collectors.toList()); + // 合计年末数量 + List yearEndNumList = vos.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getYearEndNum).collect(Collectors.toList()); + // 合计年末容量 + List yearEndCapacityList = vos.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getYearEndCapacity).collect(Collectors.toList()); + // 合计本年实际作业量 + List thisYearWorkAmountList = vos.stream().map(ResBulkCementLogFacStaDataUploadDetailVO::getThisYearWorkAmount).collect(Collectors.toList()); + + int yearBeginNumTotal = yearBeginNumList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setYearBeginNumTotal(yearBeginNumTotal); + BigDecimal yearBeginCapacityTotal = yearBeginCapacityList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setYearBeginCapacityTotal(yearBeginCapacityTotal); + BigDecimal thisYearNewAddCapacityTotal = thisYearNewAddCapacityList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisYearNewAddCapacityTotal(thisYearNewAddCapacityTotal); + int thisYearNewAddNumTotal = thisYearNewAddNumList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setThisYearNewAddNumTotal(thisYearNewAddNumTotal); + int thisYearScrapNumTotal = thisYearScrapNumList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setThisYearScrapNumTotal(thisYearScrapNumTotal); + + BigDecimal thisYearScrapCapacityTotal = thisYearScrapCapacityList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisYearScrapCapacityTotal(thisYearScrapCapacityTotal); + int yearEndNumTotal = yearEndNumList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setYearEndNumTotal(yearEndNumTotal); + BigDecimal yearEndCapacityTotal = yearEndCapacityList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setYearEndCapacityTotal(yearEndCapacityTotal); + BigDecimal thisYearWorkAmountTotal = thisYearWorkAmountList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisYearWorkAmountTotal(thisYearWorkAmountTotal); + } + private void getCityMaterialLogEquipStaTotalData(List vos, ResMaterialLogEquipStaDataUploadDetailVO vo) { + // 合计年初数量 + List yearBeginNumList = vos.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getYearBeginNum).collect(Collectors.toList()); + // 合计年初额定量 + List yearBeginNominalRateList = vos.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getYearBeginNominalRate).collect(Collectors.toList()); + // 合计本年新增额定量 + List thisYearNewAddNominalRateList = vos.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getThisYearNewAddNominalRate).collect(Collectors.toList()); + // 合计本年新增数量 + List thisYearNewAddNumList = vos.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getThisYearNewAddNum).collect(Collectors.toList()); + // 合计本年减少数量 + List thisYearDecreaseNumList = vos.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getThisYearDecreaseNum).collect(Collectors.toList()); + + // 合计本年减少额定量 + List thisYearDecreaseNominalRateList = vos.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getThisYearDecreaseNominalRate).collect(Collectors.toList()); + // 合计年末数量 + List yearEndNumList = vos.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getYearEndNum).collect(Collectors.toList()); + // 合计年末额定量 + List yearEndNominalList = vos.stream().map(ResMaterialLogEquipStaDataUploadDetailVO::getYearEndNominal).collect(Collectors.toList()); + + int yearBeginNumTotal = yearBeginNumList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setYearBeginNumTotal(yearBeginNumTotal); + BigDecimal yearBeginNominalRateTotal = yearBeginNominalRateList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setYearBeginNominalRateTotal(yearBeginNominalRateTotal); + BigDecimal thisYearNewAddNominalRateTotal = thisYearNewAddNominalRateList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisYearNewAddNominalRateTotal(thisYearNewAddNominalRateTotal); + int thisYearNewAddNumTotal = thisYearNewAddNumList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setThisYearNewAddNumTotal(thisYearNewAddNumTotal); + int thisYearDecreaseNumTotal = thisYearDecreaseNumList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setThisYearDecreaseNumTotal(thisYearDecreaseNumTotal); + + BigDecimal thisYearDecreaseNominalRateTotal = thisYearDecreaseNominalRateList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setThisYearDecreaseNominalRateTotal(thisYearDecreaseNominalRateTotal); + int yearEndNumTotal = yearEndNumList.stream().filter(Objects::nonNull).mapToInt(Integer::intValue).sum(); + vo.setYearEndNumTotal(yearEndNumTotal); + BigDecimal yearEndNominalTotal = yearEndNominalList.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); + vo.setYearEndNominalTotal(yearEndNominalTotal); + } + + public String uploadDataQueryModify(ReqDataQueryModifyPO req) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long relevanceId = req.getRelevanceId(); + BulkCementDirectReportSystemDataRelevance dataRelevance = dataRelevanceService.getById(relevanceId); + VUtils.isTrue(Objects.isNull(dataRelevance)).throwMessage("关联数据不存在!"); + dataRelevance.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + dataRelevance.setPreparer(req.getPreparer()); + dataRelevance.setReviewer(req.getReviewer()); + dataRelevance.setSubmissionDate(req.getSubmissionDate()); + dataRelevance.setUpdateOn(LocalDateTime.now()); + dataRelevance.setUpdateBy(userDetail.getUserId()); + dataRelevanceService.updateById(dataRelevance); + return "编辑成功"; + } + + public void exportQueryData(ReqDataUploadListPO req, HttpServletResponse response) { + + ResDataQueryDetailVO resDataQueryDetailVo = uploadDataQueryDetail(req); + + Integer auditDataType = req.getAuditDataType(); + String templateName; + String templatePath; + List dtoList = Lists.newArrayList(); + List bulkCementLogFacStaDto1List = Lists.newArrayList(); + List bulkCementLogFacStaDto2List = Lists.newArrayList(); + List bulkCementLogFacStaDto3List = Lists.newArrayList(); + List materialLogEquipStaDto1List = Lists.newArrayList(); + List materialLogEquipStaDto2List = Lists.newArrayList(); + List materialLogEquipStaDto3List = Lists.newArrayList(); + List materialLogEquipStaDto4List = Lists.newArrayList(); + List materialLogEquipStaDto5List = Lists.newArrayList(); + List materialLogEquipStaDto6List = Lists.newArrayList(); + List materialLogEquipStaDto7List = Lists.newArrayList(); + List materialLogEquipStaDto8List = Lists.newArrayList(); + + File directory = new File(""); + LocalDateTime reportMonth = req.getReportMonth(); + Integer reportYear = req.getReportYear(); + //设置日期格式 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月"); + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy年MM月dd日"); + String date; + String unitResponsiblePerson = StrPool.EMPTY; + String preparer = StrPool.EMPTY; + String reviewer = StrPool.EMPTY; + String submissionDate = StrPool.EMPTY; + switch (auditDataType) { + // 散装水泥供应量数据 + case 1: + if (Objects.nonNull(resDataQueryDetailVo) && Objects.nonNull(resDataQueryDetailVo.getBulkCementSupplyDataVo())) { + templateName = ReportConstant.BULK_CEMENT_SUPPLY_TEMPLATE; + dtoList = getBulkCementSupplyDtoList(resDataQueryDetailVo); + }else { + templateName = ReportConstant.BULK_CEMENT_SUPPLY_EMPTY_TEMPLATE; + } + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请传入上报月份"); + date = sdf.format(NdDateUtils.localDateTime2Date(reportMonth)); + break; + // 中转库进出量统计数据 + case 2: + if (Objects.nonNull(resDataQueryDetailVo) && Objects.nonNull(resDataQueryDetailVo.getBulkCementTransferDataVo())) { + templateName = ReportConstant.BULK_CEMENT_TRANSFER_TEMPLATE; + dtoList = getBulkCementTransferDtoList(resDataQueryDetailVo); + }else { + templateName = ReportConstant.BULK_CEMENT_TRANSFER_EMPTY_TEMPLATE; + } + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请传入上报月份"); + date = sdf.format(NdDateUtils.localDateTime2Date(reportMonth)); + break; + // 温台舟使用量快报数据 + case 3: + if (Objects.nonNull(resDataQueryDetailVo) && Objects.nonNull(resDataQueryDetailVo.getBulkCementThreeCityUsageDataVo())) { + templateName = ReportConstant.BULK_CEMENT_THREE_CITY_USAGE_TEMPLATE; + dtoList = getBulkCementThreeCityUsageDtoList(resDataQueryDetailVo); + }else { + templateName = ReportConstant.BULK_CEMENT_THREE_CITY_USAGE_EMPTY_TEMPLATE; + } + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请传入上报月份"); + date = sdf.format(NdDateUtils.localDateTime2Date(reportMonth)); + break; + // 混凝土供应量快报数据 + case 4: + if (Objects.nonNull(resDataQueryDetailVo) && Objects.nonNull(resDataQueryDetailVo.getConcreteSupplyDataVo())) { + templateName = ReportConstant.CONCRETE_SUPPLY_TEMPLATE; + dtoList = getConcreteSupplyDtoList(resDataQueryDetailVo); + }else { + templateName = ReportConstant.CONCRETE_SUPPLY_EMPTY_TEMPLATE; + } + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请传入上报月份"); + date = sdf.format(NdDateUtils.localDateTime2Date(reportMonth)); + break; + // 砂浆供应量快报数据 + case 5: + if (Objects.nonNull(resDataQueryDetailVo) && Objects.nonNull(resDataQueryDetailVo.getMortarSupplyDataVo())) { + templateName = ReportConstant.MORTAR_SUPPLY_TEMPLATE; + List dataList = new ArrayList<>(); + List mortarSupplyDtoList = getMortarSupplyDtoList(resDataQueryDetailVo); + mortarSupplyDtoList.forEach(m -> { + LinkedHashMap dataMap = new LinkedHashMap<>(); + dataMap.put("regionName",m.getRegionName()); + dataMap.put("twoCategoryGuidGoal",m.getTwoCategoryGuidGoal()); + dataMap.put("dryMixedMortarProductionCompanyNum",m.getDryMixedMortarProductionCompanyNum()); + dataMap.put("dryMixedMortarProductiveCapacity",m.getDryMixedMortarProductiveCapacity()); + dataMap.put("dryMixedMortarBulkCapacity",m.getDryMixedMortarBulkCapacity()); + dataMap.put("thisMonthTotalOutput",m.getThisMonthTotalOutput()); + dataMap.put("thisMonthAccumulativeOutput",m.getThisMonthAccumulativeOutput()); + dataMap.put("dryMixedMortarThisMonthOutput",m.getDryMixedMortarThisMonthOutput()); + dataMap.put("dryMixedMortarThisMonthAccumulativeOutput",m.getDryMixedMortarThisMonthAccumulativeOutput()); + dataMap.put("dryMixedMortarIncrement",m.getDryMixedMortarIncrement()); + dataMap.put("dryMixedMortarGrowthRate",m.getDryMixedMortarGrowthRate()); + dataMap.put("dryMixedMortarThisMonthBulkQuantity",m.getDryMixedMortarThisMonthBulkQuantity()); + dataMap.put("dryMixedMortarAccumulativeBulkQuantity",m.getDryMixedMortarAccumulativeBulkQuantity()); + dataMap.put("wetMortarThisMonthOutput",m.getWetMortarThisMonthOutput()); + dataMap.put("wetMortarAccumulativeOutput",m.getWetMortarAccumulativeOutput()); + dataMap.put("bulkCementThisMonthUsage",m.getBulkCementThisMonthUsage()); + dataMap.put("bulkCementAccumulativeUsage",m.getBulkCementAccumulativeUsage()); + dataMap.put("wasteAccumulativeComprehensiveUtilization",m.getWasteAccumulativeComprehensiveUtilization()); + dataList.add(dataMap); + }); + dtoList = dataList; + }else { + templateName = ReportConstant.MORTAR_SUPPLY_EMPTY_TEMPLATE; + } + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请传入上报月份"); + date = sdf.format(NdDateUtils.localDateTime2Date(reportMonth)); + break; + // 非禁现区域散装水泥销售使用情况数据 + case 6: + if (Objects.nonNull(resDataQueryDetailVo) && Objects.nonNull(resDataQueryDetailVo.getNonProAreasDataVo())) { + templateName = ReportConstant.NON_PRO_AREAS_TEMPLATE; + dtoList = getNonProAreasDtoList(resDataQueryDetailVo); + }else { + templateName = ReportConstant.NON_PRO_AREAS_EMPTY_TEMPLATE; + } + VUtils.isTrue(Objects.isNull(reportYear)).throwMessage("请传入上报年份!"); + date = reportYear + ReportConstant.YEAR; + ResNonProhibitedAreasDataQueryDetailVO nonProAreasDataVo = resDataQueryDetailVo.getNonProAreasDataVo(); + unitResponsiblePerson = nonProAreasDataVo.getUnitResponsiblePerson(); + preparer = nonProAreasDataVo.getPreparer(); + reviewer = nonProAreasDataVo.getReviewer(); + if (Objects.nonNull(nonProAreasDataVo.getSubmissionDate())) { + submissionDate = sdf2.format(NdDateUtils.localDateTime2Date(nonProAreasDataVo.getSubmissionDate())); + } + break; + // 散装水泥物流设施统计年报表数据 + case 7: + if (Objects.nonNull(resDataQueryDetailVo) && Objects.nonNull(resDataQueryDetailVo.getBulkCementLogFacStaDataVo())) { + templateName = ReportConstant.BULK_CEMENT_LOG_FAC_STA_TEMPLATE; + // 发放库 + bulkCementLogFacStaDto1List = getBulkCementLogFacStaDtoList(resDataQueryDetailVo,ReportConstant.ISSUE_LIBRARY); + // 中转库 + bulkCementLogFacStaDto2List = getBulkCementLogFacStaDtoList(resDataQueryDetailVo,ReportConstant.TRANSFER_LIBRARY); + // 固定接收库 + bulkCementLogFacStaDto3List = getBulkCementLogFacStaDtoList(resDataQueryDetailVo,ReportConstant.FIX_RECEIVE_LIBRARY); + }else { + templateName = ReportConstant.BULK_CEMENT_LOG_FAC_STA_EMPTY_TEMPLATE; + } + VUtils.isTrue(Objects.isNull(reportYear)).throwMessage("请传入上报年份!"); + date = reportYear + ReportConstant.YEAR; + ResBulkCementLogFacStaDataQueryVO bulkCementLogFacStaDataVo = resDataQueryDetailVo.getBulkCementLogFacStaDataVo(); + unitResponsiblePerson = bulkCementLogFacStaDataVo.getUnitResponsiblePerson(); + preparer = bulkCementLogFacStaDataVo.getPreparer(); + reviewer = bulkCementLogFacStaDataVo.getReviewer(); + if (Objects.nonNull(bulkCementLogFacStaDataVo.getSubmissionDate())) { + submissionDate = sdf2.format(NdDateUtils.localDateTime2Date(bulkCementLogFacStaDataVo.getSubmissionDate())); + } + break; + // 散装水泥、预拌砂浆、干混砂浆物流装备统计年报表数据 + case 8: + if (Objects.nonNull(resDataQueryDetailVo) && Objects.nonNull(resDataQueryDetailVo.getMaterialLogEquipStaDataVo())) { + templateName = ReportConstant.MATERIAL_LOG_EQUIP_STA_TEMPLATE; + // 专用汽车 + materialLogEquipStaDto1List = getMaterialLogEquipStaDtoList(resDataQueryDetailVo,ReportConstant.SPECIAL_VEHICLE); + // 专用船 + materialLogEquipStaDto2List = getMaterialLogEquipStaDtoList(resDataQueryDetailVo,ReportConstant.SPECIAL_VESSEL); + // 散装水泥罐 + materialLogEquipStaDto3List = getMaterialLogEquipStaDtoList(resDataQueryDetailVo,ReportConstant.BULK_CEMENT_TANK); + // 混凝土搅拌车 + materialLogEquipStaDto4List = getMaterialLogEquipStaDtoList(resDataQueryDetailVo,ReportConstant.CONCRETE_MIXER_TRUCK); + // 混凝土泵车 + materialLogEquipStaDto5List = getMaterialLogEquipStaDtoList(resDataQueryDetailVo,ReportConstant.CONCRETE_PUMP_TRUCK); + // 干混砂浆运输车 + materialLogEquipStaDto6List = getMaterialLogEquipStaDtoList(resDataQueryDetailVo,ReportConstant.DRY_MIX_MORTAR_TRUCK); + // 干混砂浆移动简仓 + materialLogEquipStaDto7List = getMaterialLogEquipStaDtoList(resDataQueryDetailVo,ReportConstant.DRY_MIX_MORTAR_MOVING_STORAGE); + // 干混砂浆背罐车 + materialLogEquipStaDto8List = getMaterialLogEquipStaDtoList(resDataQueryDetailVo,ReportConstant.DRY_MIX_MORTAR_BACK_TANK_CAR); + }else { + templateName = ReportConstant.MATERIAL_LOG_EQUIP_STA_EMPTY_TEMPLATE; + } + VUtils.isTrue(Objects.isNull(reportYear)).throwMessage("请传入上报年份!"); + date = reportYear + ReportConstant.YEAR; + ResMaterialLogEquipStaDataQueryVO materialLogEquipStaDataVo = resDataQueryDetailVo.getMaterialLogEquipStaDataVo(); + unitResponsiblePerson = materialLogEquipStaDataVo.getUnitResponsiblePerson(); + preparer = materialLogEquipStaDataVo.getPreparer(); + reviewer = materialLogEquipStaDataVo.getReviewer(); + if (Objects.nonNull(materialLogEquipStaDataVo.getSubmissionDate())) { + submissionDate = sdf2.format(NdDateUtils.localDateTime2Date(materialLogEquipStaDataVo.getSubmissionDate())); + } + break; + default: + throw new IllegalStateException("Unexpected value: " + auditDataType); + } + templatePath = directory.getAbsolutePath() + File.separator + "template" + File.separator + templateName + ".xls"; + // 获取本地目录的Excel模板 + TemplateExportParams temp = new TemplateExportParams(templatePath); + temp.setSheetNum(new Integer[] {0}); + temp.setSheetName(new String[] {templateName}); + Map map = new HashMap<>(4); + map.put("date", date); + map.put("unitResponsiblePerson", unitResponsiblePerson); + map.put("preparer", preparer); + map.put("reviewer", reviewer); + map.put("submissionDate", submissionDate); + if (UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode().equals(auditDataType)){ + map.put("map1List", bulkCementLogFacStaDto1List); + map.put("map2List", bulkCementLogFacStaDto2List); + map.put("map3List", bulkCementLogFacStaDto3List); + } else if (UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode().equals(auditDataType)) { + map.put("map1List", materialLogEquipStaDto1List); + map.put("map2List", materialLogEquipStaDto2List); + map.put("map3List", materialLogEquipStaDto3List); + map.put("map4List", materialLogEquipStaDto4List); + map.put("map5List", materialLogEquipStaDto5List); + map.put("map6List", materialLogEquipStaDto6List); + map.put("map7List", materialLogEquipStaDto7List); + map.put("map8List", materialLogEquipStaDto8List); + } else { + map.put("mapList", dtoList); + } + Workbook workbook = ExcelExportUtil.exportExcel(temp, map); + if (!UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode().equals(auditDataType) && + !UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode().equals(auditDataType) && + CollUtil.isEmpty(dtoList)) { + // 输出空模板 + // 获取本地目录的空Excel模板 + try { + InputStream templateInputStream = this.getClass().getClassLoader().getResourceAsStream("template" + File.separator + templateName + ".xlsx"); + OutputStream outputStream = response.getOutputStream(); + // 设置要下载的文件的名称 + ExcelDownUtil.setFileName(templateName, response); + // 设置文件的MIME类型 + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); + + byte[] b = new byte[2048]; + int len; + while ((len = templateInputStream.read(b)) != -1) { + outputStream.write(b, 0, len); + } + templateInputStream.close(); + outputStream.flush(); + outputStream.close(); + } catch (IOException e) { + throw new BizException("读取模板失败!"); + } + return; + } + if (workbook == null){ + throw new BizException("读取编辑表模板失败!"); + } + // 重置响应对象 + response.reset(); + try { + response.setHeader("Content-disposition", + "attachment;filename*=utf-8''" + URLEncoder.encode(Objects.requireNonNull(templateName), "UTF-8") + ".xlsx"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + response.setContentType(ExcelUtil.XLS_CONTENT_TYPE); + response.setHeader("Pragma", "no-cache"); + response.setHeader("Cache-Control", "no-cache"); + response.setDateHeader("Expires", 0); + // 写出数据输出流到页面 + try { + OutputStream output = response.getOutputStream(); + BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output); + workbook.write(bufferedOutPut); + bufferedOutPut.flush(); + bufferedOutPut.close(); + output.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private List getMaterialLogEquipStaDtoList(ResDataQueryDetailVO resDataQueryDetailVo,String key) { + List dtoList; + ResMaterialLogEquipStaDataQueryVO materialLogEquipStaDataQueryVo = resDataQueryDetailVo.getMaterialLogEquipStaDataVo(); + Map materialLogEquipStaDataMap = materialLogEquipStaDataQueryVo.getMaterialLogEquipStaDataMap(); + + List dataList = Lists.newArrayList(); + // materialLogEquipStaDataMap为以装备名称为key的8组map值 + ResMaterialLogEquipStaDataQueryDetailVO detailVo = (ResMaterialLogEquipStaDataQueryDetailVO) materialLogEquipStaDataMap.get(key); + Map dataMap = detailVo.getMaterialLogEquipDataMap(); + Set> entries = dataMap.entrySet().stream() + .filter(e -> !ReportConstant.TOTAL.equals(e.getKey())).collect(Collectors.toSet()); + List values = (List) dataMap.get(ReportConstant.TOTAL); + dataList.add(values.get(0)); + // 如果是市级散办,map中只有一个键值对,且包含合计的数据 + // 如果是省散办,entries中有多个键值对,且包含合计的数据 + for (Map.Entry entry : entries) { + List value = (List) entry.getValue(); + List vos = value.stream().filter(v -> !ReportConstant.TOTAL.equals(v.getRegionName())).collect(Collectors.toList()); + String cityNameKey = entry.getKey(); + ResMaterialLogEquipStaDataUploadDetailVO totalVo = new ResMaterialLogEquipStaDataUploadDetailVO(); + ResMaterialLogEquipStaDataUploadDetailVO vo = value.stream().filter(v -> ReportConstant.TOTAL.equals(v.getRegionName())).collect(Collectors.toList()).get(0); + totalVo.setRegionName(cityNameKey); + totalVo.setYearBeginNum(vo.getYearBeginNumTotal()); + totalVo.setYearBeginNominalRate(vo.getYearBeginNominalRateTotal()); + totalVo.setThisYearNewAddNum(vo.getThisYearNewAddNumTotal()); + totalVo.setThisYearNewAddNominalRate(vo.getThisYearNewAddNominalRateTotal()); + totalVo.setThisYearDecreaseNum(vo.getThisYearDecreaseNumTotal()); + totalVo.setThisYearDecreaseNominalRate(vo.getThisYearDecreaseNominalRateTotal()); + totalVo.setYearEndNum(vo.getYearEndNumTotal()); + totalVo.setYearEndNominal(vo.getYearEndNominalTotal()); + totalVo.setRemark(vo.getRemark()); + dataList.add(totalVo); + dataList.addAll(vos); + } + dtoList = dataList.stream().map(d -> { + MaterialLogEquipStaQueryDataExportDTO exportDto = new MaterialLogEquipStaQueryDataExportDTO(); + BeanUtils.copyProperties(d, exportDto); + return exportDto; + }).collect(Collectors.toList()); + return dtoList; + } + private List getBulkCementLogFacStaDtoList(ResDataQueryDetailVO resDataQueryDetailVo, String key) { + List dtoList = Lists.newArrayList(); + ResBulkCementLogFacStaDataQueryVO bulkCementLogFacStaDataQueryVo = resDataQueryDetailVo.getBulkCementLogFacStaDataVo(); + Map bulkCementLogFacStaDataMap = bulkCementLogFacStaDataQueryVo.getBulkCementLogFacStaDataMap(); + + List dataList = Lists.newArrayList(); + // bulkCementLogFacStaDataMap为以设备名称为key的三组map值 + ResBulkCementLogFacStaDataQueryDetailVO detailVo = (ResBulkCementLogFacStaDataQueryDetailVO) bulkCementLogFacStaDataMap.get(key); + Map dataMap = detailVo.getBulkCementLogFacDataMap(); + Set> entries = dataMap.entrySet().stream() + .filter(e -> !ReportConstant.TOTAL.equals(e.getKey())).collect(Collectors.toSet()); + List values = (List) dataMap.get(ReportConstant.TOTAL); + dataList.add(values.get(0)); + // 如果是市级散办,map中只有一个键值对,且包含合计的数据 + // 如果是省散办,entries中有多个键值对,且包含合计的数据 + for (Map.Entry entry : entries) { + List value = (List) entry.getValue(); + List vos = value.stream().filter(v -> !ReportConstant.TOTAL.equals(v.getRegionName())).collect(Collectors.toList()); + String cityNameKey = entry.getKey(); + ResBulkCementLogFacStaDataUploadDetailVO totalVo = new ResBulkCementLogFacStaDataUploadDetailVO(); + ResBulkCementLogFacStaDataUploadDetailVO vo = value.stream().filter(v -> ReportConstant.TOTAL.equals(v.getRegionName())).collect(Collectors.toList()).get(0); + totalVo.setRegionName(cityNameKey); + totalVo.setYearBeginNum(vo.getYearBeginNumTotal()); + totalVo.setYearBeginCapacity(vo.getYearBeginCapacityTotal()); + totalVo.setThisYearNewAddNum(vo.getThisYearNewAddNumTotal()); + totalVo.setThisYearNewAddCapacity(vo.getThisYearNewAddCapacityTotal()); + totalVo.setThisYearScrapNum(vo.getThisYearScrapNumTotal()); + totalVo.setThisYearScrapCapacity(vo.getThisYearScrapCapacityTotal()); + totalVo.setYearEndNum(vo.getYearEndNumTotal()); + totalVo.setYearEndCapacity(vo.getYearEndCapacityTotal()); + totalVo.setThisYearWorkAmount(vo.getThisYearWorkAmountTotal()); + totalVo.setRemark(vo.getRemark()); + dataList.add(totalVo); + dataList.addAll(vos); + } + List exportDtoList = dataList.stream().map(d -> { + BulkCementLogFacStaQueryDataExportDTO exportDto = new BulkCementLogFacStaQueryDataExportDTO(); + BeanUtils.copyProperties(d,exportDto); + return exportDto; + }).collect(Collectors.toList()); + dtoList.addAll(exportDtoList); + return dtoList; + } + private List getNonProAreasDtoList(ResDataQueryDetailVO resDataQueryDetailVo) { + List dtoList; + ResNonProhibitedAreasDataQueryDetailVO nonProAreasDataVo = resDataQueryDetailVo.getNonProAreasDataVo(); + Map nonProAreasDataMap = nonProAreasDataVo.getNonProAreasDataMap(); + List dataList = Lists.newArrayList(); + // 如果是市级散办,map中只有一个键值对,且包含合计的数据 + // 如果是省散办,entries中有多个键值对,且包含合计的数据 + Set> entries = nonProAreasDataMap.entrySet().stream() + .filter(e -> !ReportConstant.TOTAL.equals(e.getKey())).collect(Collectors.toSet()); + List values = (List) nonProAreasDataMap.get(ReportConstant.TOTAL); + dataList.add(values.get(0)); + for (Map.Entry entry : entries) { + List value = (List) entry.getValue(); + List vos = value.stream().filter(v -> !ReportConstant.TOTAL.equals(v.getRegionName())).collect(Collectors.toList()); + String key = entry.getKey(); + ResNonProhibitedAreasDataUploadDetailVO totalVo = new ResNonProhibitedAreasDataUploadDetailVO(); + ResNonProhibitedAreasDataUploadDetailVO vo = value.stream().filter(v -> ReportConstant.TOTAL.equals(v.getRegionName())).collect(Collectors.toList()).get(0); + totalVo.setRegionName(key); + totalVo.setSalePointAccumulativeNum(vo.getSalePointAccumulativeNumTotal()); + totalVo.setCementCompanyBuildPointNum(vo.getCementCompanyBuildPointNumTotal()); + totalVo.setOtherInvestmentBuildPointNum(vo.getOtherInvestmentBuildPointNumTotal()); + totalVo.setSaleVolume(vo.getSaleVolumeTotal()); + totalVo.setBulkCementTankNum(vo.getBulkCementTankNumTotal()); + totalVo.setBulkCementTankCapacity(vo.getBulkCementTankCapacityTotal()); + totalVo.setCementUsage(vo.getCementUsageTotal()); + totalVo.setBulkCementUsage(vo.getBulkCementUsageTotal()); + totalVo.setReadyMixedConcreteBulkCementUsage(vo.getReadyMixedConcreteBulkCementUsageTotal()); + totalVo.setBulkCementUsageRate(vo.getBulkCementUsageRateTotal()); + totalVo.setReadyMixedConcreteOutput(vo.getReadyMixedConcreteOutputTotal()); + totalVo.setRemark(vo.getRemark()); + dataList.add(totalVo); + dataList.addAll(vos); + } + dtoList = dataList.stream().map(d -> { + NonProAreasQueryDataExportDTO exportDto = new NonProAreasQueryDataExportDTO(); + BeanUtils.copyProperties(d, exportDto); + return exportDto; + }).collect(Collectors.toList()); + return dtoList; + } + private List getMortarSupplyDtoList(ResDataQueryDetailVO resDataQueryDetailVo) { + List dtoList; + ResMortarSupplyDataQueryDetailVO mortarSupplyDataVo = resDataQueryDetailVo.getMortarSupplyDataVo(); + Map mortarSupplyDataMap = mortarSupplyDataVo.getMortarSupplyDataMap(); + List dataList = Lists.newArrayList(); + // 如果是市级散办,map中只有一个键值对,且包含合计的数据 + // 如果是省散办,entries中有多个键值对,且包含合计的数据 + Set> entries = mortarSupplyDataMap.entrySet().stream() + .filter(e -> !ReportConstant.TOTAL.equals(e.getKey())).collect(Collectors.toSet()); + List values = (List) mortarSupplyDataMap.get(ReportConstant.TOTAL); + dataList.add(values.get(0)); + for (Map.Entry entry : entries) { + List value = (List) entry.getValue(); + List vos = value.stream().filter(v -> !ReportConstant.TOTAL.equals(v.getRegionName())).collect(Collectors.toList()); + String key = entry.getKey(); + ResMortarSupplyDataUploadDetailVO totalVo = new ResMortarSupplyDataUploadDetailVO(); + ResMortarSupplyDataUploadDetailVO vo = value.stream().filter(v -> ReportConstant.TOTAL.equals(v.getRegionName())).collect(Collectors.toList()).get(0); + totalVo.setRegionName(key); + totalVo.setTwoCategoryGuidGoal(vo.getTwoCategoryGuidGoalTotal()); + totalVo.setDryMixedMortarProductionCompanyNum(vo.getDryMixedMortarProductionCompanyNumTotal()); + totalVo.setDryMixedMortarProductiveCapacity(vo.getDryMixedMortarProductiveCapacityTotal()); + totalVo.setDryMixedMortarBulkCapacity(vo.getDryMixedMortarBulkCapacityTotal()); + totalVo.setThisMonthTotalOutput(vo.getThisMonthTotalOutputTotal()); + totalVo.setThisMonthAccumulativeOutput(vo.getThisMonthAccumulativeOutputTotal()); + totalVo.setDryMixedMortarThisMonthOutput(vo.getDryMixedMortarThisMonthOutputTotal()); + totalVo.setDryMixedMortarThisMonthAccumulativeOutput(vo.getDryMixedMortarThisMonthAccumulativeOutputTotal()); + totalVo.setDryMixedMortarIncrement(vo.getDryMixedMortarIncrementTotal()); + totalVo.setDryMixedMortarGrowthRate(vo.getDryMixedMortarGrowthRateTotal()); + totalVo.setDryMixedMortarThisMonthBulkQuantity(vo.getDryMixedMortarThisMonthBulkQuantityTotal()); + totalVo.setDryMixedMortarAccumulativeBulkQuantity(vo.getDryMixedMortarAccumulativeBulkQuantityTotal()); + totalVo.setWetMortarThisMonthOutput(vo.getWetMortarThisMonthOutputTotal()); + totalVo.setWetMortarAccumulativeOutput(vo.getWetMortarAccumulativeOutputTotal()); + totalVo.setBulkCementThisMonthUsage(vo.getBulkCementThisMonthUsageTotal()); + totalVo.setBulkCementAccumulativeUsage(vo.getBulkCementAccumulativeUsageTotal()); + totalVo.setWasteAccumulativeComprehensiveUtilization(vo.getWasteAccumulativeComprehensiveUtilizationTotal()); + dataList.add(totalVo); + dataList.addAll(vos); + } + dtoList = dataList.stream().map(d -> { + MortarSupplyQueryDataExportDTO exportDto = new MortarSupplyQueryDataExportDTO(); + BeanUtils.copyProperties(d, exportDto); + return exportDto; + }).collect(Collectors.toList()); + return dtoList; + } + private List getConcreteSupplyDtoList(ResDataQueryDetailVO resDataQueryDetailVo) { + List dtoList; + ResConcreteSupplyDataQueryDetailVO concreteSupplyDataVo = resDataQueryDetailVo.getConcreteSupplyDataVo(); + Map concreteSupplyDataMap = concreteSupplyDataVo.getConcreteSupplyDataMap(); + List dataList = Lists.newArrayList(); + // 如果是市级散办,map中只有一个键值对,且包含合计的数据 + // 如果是省散办,entries中有多个键值对,且包含合计的数据 + Set> entries = concreteSupplyDataMap.entrySet().stream() + .filter(e -> !ReportConstant.TOTAL.equals(e.getKey())).collect(Collectors.toSet()); + List values = (List) concreteSupplyDataMap.get(ReportConstant.TOTAL); + dataList.add(values.get(0)); + for (Map.Entry entry : entries) { + List value = (List) entry.getValue(); + List vos = value.stream() + .filter(v -> !ReportConstant.TOTAL.equals(v.getUnitName())).collect(Collectors.toList()); + String key = entry.getKey(); + ResConcreteSupplyDataUploadDetailVO totalVo = new ResConcreteSupplyDataUploadDetailVO(); + ResConcreteSupplyDataUploadDetailVO vo = value.stream() + .filter(v -> ReportConstant.TOTAL.equals(v.getUnitName())).collect(Collectors.toList()).get(0); + totalVo.setUnitName(key); + totalVo.setThreeCategoryGuidGoal(vo.getThreeCategoryGuidGoalTotal()); + totalVo.setProductionCompanyNums(vo.getProductionCompanyNumsTotal()); + totalVo.setAnnualDesignProductionCapacity(vo.getAnnualDesignProductionCapacityTotal()); + totalVo.setThisMonthOutput(vo.getThisMonthOutputTotal()); + totalVo.setAccumulativeOutput(vo.getAccumulativeOutputTotal()); + totalVo.setThisMonthCementUsage(vo.getThisMonthCementUsageTotal()); + totalVo.setCementAccumulativeUsage(vo.getCementAccumulativeUsageTotal()); + totalVo.setThisMonthWasteUtilization(vo.getThisMonthWasteUtilizationTotal()); + totalVo.setAccumulativeWasteUtilization(vo.getAccumulativeWasteUtilizationTotal()); + totalVo.setRemark(vo.getRemark()); + dataList.add(totalVo); + dataList.addAll(vos); + } + dtoList = dataList.stream().map(d -> { + ConcreteSupplyQueryDataExportDTO exportDto = new ConcreteSupplyQueryDataExportDTO(); + BeanUtils.copyProperties(d, exportDto); + return exportDto; + }).collect(Collectors.toList()); + return dtoList; + } + private List getBulkCementThreeCityUsageDtoList(ResDataQueryDetailVO resDataQueryDetailVo) { + List dtoList; + ResBulkCementThreeCityUsageDataQueryDetailVO bulkCementThreeCityUsageDataVo = resDataQueryDetailVo.getBulkCementThreeCityUsageDataVo(); + Map bulkCementThreeCityUsageDataMap = bulkCementThreeCityUsageDataVo.getBulkCementThreeCityUsageDataMap(); + List dataList = Lists.newArrayList(); + // 如果是市级散办,map中只有一个键值对,且包含合计的数据 + // 如果是省散办,entries中有多个键值对,且包含合计的数据 + Set> entries = bulkCementThreeCityUsageDataMap.entrySet().stream() + .filter(e -> !ReportConstant.TOTAL.equals(e.getKey())).collect(Collectors.toSet()); + List values = (List) bulkCementThreeCityUsageDataMap.get(ReportConstant.TOTAL); + dataList.add(values.get(0)); + for (Map.Entry entry : entries) { + List value = (List) entry.getValue(); + List vos = value.stream() + .filter(v -> !ReportConstant.TOTAL.equals(v.getUnitName())).collect(Collectors.toList()); + String key = entry.getKey(); + ResBulkCementThreeCityUsageDataUploadDetailVO totalVo = new ResBulkCementThreeCityUsageDataUploadDetailVO(); + ResBulkCementThreeCityUsageDataUploadDetailVO vo = value.stream() + .filter(v -> ReportConstant.TOTAL.equals(v.getUnitName())).collect(Collectors.toList()).get(0); + totalVo.setUnitName(key); + totalVo.setYearTarget(vo.getYearTargetTotal()); + totalVo.setPercentageOfAnnualTarget(vo.getPercentageOfAnnualTargetTotal()); + totalVo.setThisMonthUsage(vo.getThisMonthUsageTotal()); + totalVo.setAccumulativeUsage(vo.getAccumulativeUsageTotal()); + totalVo.setGrowthRate(vo.getGrowthRateTotal()); + totalVo.setThisProvinceThisMonthUsage(vo.getThisProvinceThisMonthUsageTotal()); + totalVo.setThisProvinceAccumulativeUsage(vo.getThisProvinceAccumulativeUsageTotal()); + totalVo.setOtherProvinceAccumulativeUsage(vo.getOtherProvinceAccumulativeUsageTotal()); + totalVo.setOtherProvinceAccumulativeUsage(vo.getOtherProvinceAccumulativeUsageTotal()); + dataList.add(totalVo); + dataList.addAll(vos); + } + dtoList = dataList.stream().map(d -> { + BulkCementThreeCityUsageQueryDataExportDTO exportDto = new BulkCementThreeCityUsageQueryDataExportDTO(); + BeanUtils.copyProperties(d, exportDto); + return exportDto; + }).collect(Collectors.toList()); + return dtoList; + } + private List getBulkCementTransferDtoList(ResDataQueryDetailVO resDataQueryDetailVo) { + List dtoList; + ResBulkCementTransferDataQueryDetailVO bulkCementTransferDataVo = resDataQueryDetailVo.getBulkCementTransferDataVo(); + Map bulkCementTransferDataMap = bulkCementTransferDataVo.getBulkCementTransferDataMap(); + List dataList = Lists.newArrayList(); + // 如果是市级散办,map中只有一个键值对,且包含合计的数据 + // 如果是省散办,entries中有多个键值对,且包含合计的数据 + Set> entries = bulkCementTransferDataMap.entrySet().stream() + .filter(e -> !ReportConstant.TOTAL.equals(e.getKey())).collect(Collectors.toSet()); + List values = (List) bulkCementTransferDataMap.get(ReportConstant.TOTAL); + dataList.add(values.get(0)); + for (Map.Entry entry : entries) { + List value = (List) entry.getValue(); + List vos = value.stream().filter(v -> !ReportConstant.TOTAL.equals(v.getUnitName())).collect(Collectors.toList()); + String key = entry.getKey(); + ResBulkCementTransferDataUploadDetailVO totalVo = new ResBulkCementTransferDataUploadDetailVO(); + ResBulkCementTransferDataUploadDetailVO vo = value.stream().filter(v -> ReportConstant.TOTAL.equals(v.getUnitName())).collect(Collectors.toList()).get(0); + totalVo.setUnitName(key); + totalVo.setLastMonthEndInventory(vo.getLastMonthEndInventoryTotal()); + totalVo.setThisMonthIncomingStorage(vo.getThisMonthIncomingStorageTotal()); + totalVo.setCumulativeIncomingStorage(vo.getCumulativeIncomingStorageTotal()); + totalVo.setThisMonthOutgoingStorage(vo.getThisMonthOutgoingStorageTotal()); + totalVo.setCumulativeOutgoingStorage(vo.getCumulativeOutgoingStorageTotal()); + totalVo.setMonthEndInventory(vo.getMonthEndInventoryTotal()); + totalVo.setMonthEndInventoryGrowthRate(vo.getMonthEndInventoryGrowthRateTotal()); + dataList.add(totalVo); + dataList.addAll(vos); + } + dtoList = dataList.stream().map(d -> { + BulkCementTransferQueryDataExportDTO exportDto = new BulkCementTransferQueryDataExportDTO(); + BeanUtils.copyProperties(d, exportDto); + return exportDto; + }).collect(Collectors.toList()); + return dtoList; + } + + private List getBulkCementSupplyDtoList(ResDataQueryDetailVO resDataQueryDetailVo) { + List dtoList; + ResBulkCementSupplyDataQueryDetailVO bulkCementSupplyDataVo = resDataQueryDetailVo.getBulkCementSupplyDataVo(); + Map bulkCementSupplyDataMap = bulkCementSupplyDataVo.getBulkCementSupplyDataMap(); + List dataList = Lists.newArrayList(); + // 如果是市级散办,map中只有一个键值对,且包含合计的数据 + // 如果是省散办,entries中有多个键值对,且包含合计的数据 + Set> entries = bulkCementSupplyDataMap.entrySet().stream() + .filter(e -> !ReportConstant.TOTAL.equals(e.getKey())).collect(Collectors.toSet()); + List values = (List) bulkCementSupplyDataMap.get(ReportConstant.TOTAL); + dataList.add(values.get(0)); + for (Map.Entry entry : entries) { + List value = (List) entry.getValue(); + List vos = value.stream().filter(v -> !ReportConstant.TOTAL.equals(v.getUnitName())).collect(Collectors.toList()); + String key = entry.getKey(); + ResBulkCementSupplyDataUploadDetailVO totalVo = new ResBulkCementSupplyDataUploadDetailVO(); + ResBulkCementSupplyDataUploadDetailVO vo = value.stream().filter(v -> ReportConstant.TOTAL.equals(v.getUnitName())).collect(Collectors.toList()).get(0); + totalVo.setUnitName(key); + totalVo.setBulkRateTarget(vo.getBulkRateTarget()); + totalVo.setBulkCementAmount(vo.getBulkCementAmountTotal()); + totalVo.setCementOutput(vo.getCementOutputTotal()); + totalVo.setCompletedTotalAmount(vo.getCompletedTotalAmountTotal()); + totalVo.setBulkRate(vo.getBulkRateTotal()); + totalVo.setIncrement(vo.getIncrementTotal()); + totalVo.setIncreaseRate(vo.getIncreaseRateTotal()); + totalVo.setCumulativeCementProduction(vo.getCumulativeCementProductionTotal()); + dataList.add(totalVo); + dataList.addAll(vos); + } + dtoList = dataList.stream().map(d -> { + BulkCementSupplyQueryDataExportDTO exportDto = new BulkCementSupplyQueryDataExportDTO(); + BeanUtils.copyProperties(d, exportDto); + return exportDto; + }).collect(Collectors.toList()); + return dtoList; + } + + public ResDataUploadDetailVO uploadDataDetail(ReqDataUploadDetailPO req) { + Long auditDataId = req.getAuditDataId(); + Integer auditDataType = req.getAuditDataType(); + ResDataUploadDetailVO resVo = new ResDataUploadDetailVO(); + BulkCementDirectSystemManage context = (BulkCementDirectSystemManage) AopContext.currentProxy(); + switch (auditDataType) { + // 散装水泥供应量数据 + case 1: + LambdaQueryWrapper wrapper1 = Wrappers.lambdaQuery(BulkCementSupplyBulletin.class); + context.buildBulkCementSupplyBulletinQuery(wrapper1, auditDataId); + BulkCementSupplyBulletin bulkCementSupplyBulletin = bulkCementSupplyBulletinService.getOne(wrapper1); + VUtils.isTrue(Objects.isNull(bulkCementSupplyBulletin)).throwMessage("数据不存在!"); + ResBulkCementSupplyDataUploadDetailVO vo1 = new ResBulkCementSupplyDataUploadDetailVO(); + BeanUtils.copyProperties(bulkCementSupplyBulletin, vo1); + resVo.setBulkCementSupplyDataUploadDetailVo(vo1); + resVo.setReportMonth(bulkCementSupplyBulletin.getReportMonth()); + resVo.setUnitResponsiblePerson(bulkCementSupplyBulletin.getUnitResponsiblePerson()); + resVo.setPreparer(bulkCementSupplyBulletin.getPreparer()); + resVo.setReviewer(bulkCementSupplyBulletin.getReviewer()); + resVo.setSubmissionDate(bulkCementSupplyBulletin.getSubmissionDate()); + break; + // 中转库进出量统计数据 + case 2: + LambdaQueryWrapper wrapper2 = Wrappers.lambdaQuery(BulkCementTransferBulletin.class); + context.buildBulkCementTransferBulletinQuery(wrapper2, auditDataId); + BulkCementTransferBulletin bulkCementTransferBulletin = bulkCementTransferBulletinService.getOne(wrapper2); + VUtils.isTrue(Objects.isNull(bulkCementTransferBulletin)).throwMessage("数据不存在!"); + ResBulkCementTransferDataUploadDetailVO vo2 = new ResBulkCementTransferDataUploadDetailVO(); + BeanUtils.copyProperties(bulkCementTransferBulletin, vo2); + resVo.setBulkCementTransferDataUploadDetailVo(vo2); + resVo.setReportMonth(bulkCementTransferBulletin.getReportMonth()); + resVo.setUnitResponsiblePerson(bulkCementTransferBulletin.getUnitResponsiblePerson()); + resVo.setPreparer(bulkCementTransferBulletin.getPreparer()); + resVo.setReviewer(bulkCementTransferBulletin.getReviewer()); + resVo.setSubmissionDate(bulkCementTransferBulletin.getSubmissionDate()); + break; + // 温台舟使用量快报数据 + case 3: + LambdaQueryWrapper wrapper3 = Wrappers.lambdaQuery(BulkCementThreeCityUsageBulletin.class); + context.buildBulkCementThreeCityUsageBulletinQuery(wrapper3, auditDataId); + BulkCementThreeCityUsageBulletin bulkCementThreeCityUsageBulletin = bulkCementThreeCityUsageBulletinService.getOne(wrapper3); + VUtils.isTrue(Objects.isNull(bulkCementThreeCityUsageBulletin)).throwMessage("数据不存在!"); + ResBulkCementThreeCityUsageDataUploadDetailVO vo3 = new ResBulkCementThreeCityUsageDataUploadDetailVO(); + BeanUtils.copyProperties(bulkCementThreeCityUsageBulletin, vo3); + resVo.setBulkCementThreeCityUsageDataUploadDetailVo(vo3); + resVo.setReportMonth(bulkCementThreeCityUsageBulletin.getReportMonth()); + resVo.setUnitResponsiblePerson(bulkCementThreeCityUsageBulletin.getUnitResponsiblePerson()); + resVo.setPreparer(bulkCementThreeCityUsageBulletin.getPreparer()); + resVo.setReviewer(bulkCementThreeCityUsageBulletin.getReviewer()); + resVo.setSubmissionDate(bulkCementThreeCityUsageBulletin.getSubmissionDate()); + break; + // 混凝土供应量快报数据 + case 4: + LambdaQueryWrapper wrapper4 = Wrappers.lambdaQuery(ConcreteSupplyBulletin.class); + context.buildConcreteSupplyBulletinQuery(wrapper4, auditDataId); + ConcreteSupplyBulletin concreteSupplyBulletin = concreteSupplyBulletinService.getOne(wrapper4); + VUtils.isTrue(Objects.isNull(concreteSupplyBulletin)).throwMessage("数据不存在!"); + ResConcreteSupplyDataUploadDetailVO vo4 = new ResConcreteSupplyDataUploadDetailVO(); + BeanUtils.copyProperties(concreteSupplyBulletin, vo4); + resVo.setConcreteSupplyDataUploadDetailVO(vo4); + resVo.setRemark(concreteSupplyBulletin.getRemark()); + resVo.setReportMonth(concreteSupplyBulletin.getReportMonth()); + resVo.setUnitResponsiblePerson(concreteSupplyBulletin.getUnitResponsiblePerson()); + resVo.setPreparer(concreteSupplyBulletin.getPreparer()); + resVo.setReviewer(concreteSupplyBulletin.getReviewer()); + resVo.setSubmissionDate(concreteSupplyBulletin.getSubmissionDate()); + break; + // 砂浆供应量快报数据 + case 5: + LambdaQueryWrapper wrapper5 = Wrappers.lambdaQuery(MortarSupplyBulletin.class); + context.buildMortarSupplyBulletinQuery(wrapper5, auditDataId); + MortarSupplyBulletin mortarSupplyBulletin = mortarSupplyBulletinService.getOne(wrapper5); + VUtils.isTrue(Objects.isNull(mortarSupplyBulletin)).throwMessage("数据不存在!"); + ResMortarSupplyDataUploadDetailVO vo5 = new ResMortarSupplyDataUploadDetailVO(); + BeanUtils.copyProperties(mortarSupplyBulletin, vo5); + resVo.setMortarSupplyDataUploadDetailVO(vo5); + resVo.setReportMonth(mortarSupplyBulletin.getReportMonth()); + resVo.setUnitResponsiblePerson(mortarSupplyBulletin.getUnitResponsiblePerson()); + resVo.setPreparer(mortarSupplyBulletin.getPreparer()); + resVo.setReviewer(mortarSupplyBulletin.getReviewer()); + resVo.setSubmissionDate(mortarSupplyBulletin.getSubmissionDate()); + break; + // 非禁现区域散装水泥销售使用情况数据 + case 6: + LambdaQueryWrapper wrapper6 = Wrappers.lambdaQuery(NonProhibitedAreasBulkCementSalesUse.class); + context.buildNonProhibitedAreasBulkCementSalesUseQuery(wrapper6, auditDataId); + NonProhibitedAreasBulkCementSalesUse nonProhibitedAreasBulkCementSalesUse = nonProhibitedAreasBulkCementSalesUseService.getOne(wrapper6); + VUtils.isTrue(Objects.isNull(nonProhibitedAreasBulkCementSalesUse)).throwMessage("数据不存在!"); + ResNonProhibitedAreasDataUploadDetailVO vo6 = new ResNonProhibitedAreasDataUploadDetailVO(); + BeanUtils.copyProperties(nonProhibitedAreasBulkCementSalesUse, vo6); + resVo.setNonProhibitedAreasDataUploadDetailVO(vo6); + resVo.setReportYear(nonProhibitedAreasBulkCementSalesUse.getReportYear()); + resVo.setUnitResponsiblePerson(nonProhibitedAreasBulkCementSalesUse.getUnitResponsiblePerson()); + resVo.setPreparer(nonProhibitedAreasBulkCementSalesUse.getPreparer()); + resVo.setReviewer(nonProhibitedAreasBulkCementSalesUse.getReviewer()); + resVo.setSubmissionDate(nonProhibitedAreasBulkCementSalesUse.getSubmissionDate()); + break; + // 散装水泥物流设施统计年报表数据 + case 7: + // 获取关联表数据 + LambdaQueryWrapper wrapper7 = Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class); + context.buildBulkCementDirectReportSystemDataRelevanceQuery(wrapper7, auditDataId); + BulkCementDirectReportSystemDataRelevance dataRelevance1 = dataRelevanceService.getOne(wrapper7); + VUtils.isTrue(Objects.isNull(dataRelevance1)).throwMessage("数据不存在!"); + String auditDataIdList1 = dataRelevance1.getAuditDataIdList(); + if (StringUtils.isBlank(auditDataIdList1)){ + return null; + } + // 按设备名称分组返回 + Map dataMap1 = MapUtil.newHashMap(); + List idList1 = Arrays.stream(auditDataIdList1.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + for (Long id : idList1) { + BulkCementLogisticFacilityStatisticAnnualReport bulkCementLogFacStaAnnualReport = bulkCementLogFacStaAnnualReportService.getById(id); + ResBulkCementLogFacStaDataUploadDetailVO vo = new ResBulkCementLogFacStaDataUploadDetailVO(); + BeanUtils.copyProperties(bulkCementLogFacStaAnnualReport, vo); + dataMap1.put(bulkCementLogFacStaAnnualReport.getFacilityName(), vo); + } + resVo.setBulkCementLogFacStaDataUploadDetailVO(dataMap1); + resVo.setReportYear(dataRelevance1.getReportYear()); + resVo.setUnitResponsiblePerson(dataRelevance1.getUnitResponsiblePerson()); + resVo.setPreparer(dataRelevance1.getPreparer()); + resVo.setReviewer(dataRelevance1.getReviewer()); + resVo.setSubmissionDate(dataRelevance1.getSubmissionDate()); + break; + // 散装水泥、预拌砂浆、干混砂浆物流装备统计年报表数据 + case 8: + // 获取关联表数据 + LambdaQueryWrapper wrapper8 = Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class); + context.buildBulkCementDirectReportSystemDataRelevanceQuery(wrapper8, auditDataId); + BulkCementDirectReportSystemDataRelevance dataRelevance2 = dataRelevanceService.getOne(wrapper8); + VUtils.isTrue(Objects.isNull(dataRelevance2)).throwMessage("数据不存在!"); + String auditDataIdList2 = dataRelevance2.getAuditDataIdList(); + if (StringUtils.isBlank(auditDataIdList2)){ + return null; + } + // 按装备名称分组返回 + Map dataMap2 = MapUtil.newHashMap(); + List idList2 = Arrays.stream(auditDataIdList2.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + for (Long id : idList2) { + MaterialLogisticEquipmentStatisticAnnualReport materialLogEquipStaAnnualReport = materialLogEquipStaAnnualReportService.getById(id); + ResMaterialLogEquipStaDataUploadDetailVO vo = new ResMaterialLogEquipStaDataUploadDetailVO(); + BeanUtils.copyProperties(materialLogEquipStaAnnualReport, vo); + dataMap2.put(materialLogEquipStaAnnualReport.getEquipmentName(), vo); + } + resVo.setMaterialLogEquipStaDataUploadDetailVO(dataMap2); + resVo.setReportYear(dataRelevance2.getReportYear()); + resVo.setUnitResponsiblePerson(dataRelevance2.getUnitResponsiblePerson()); + resVo.setPreparer(dataRelevance2.getPreparer()); + resVo.setReviewer(dataRelevance2.getReviewer()); + resVo.setSubmissionDate(dataRelevance2.getSubmissionDate()); + break; + default: + throw new IllegalStateException("Unexpected value: " + auditDataType); + } + return resVo; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildBulkCementDirectReportSystemDataRelevanceQuery(LambdaQueryWrapper wrapper7, Long auditDataId) { + wrapper7.eq(BulkCementDirectReportSystemDataRelevance::getId,auditDataId); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildNonProhibitedAreasBulkCementSalesUseQuery(LambdaQueryWrapper wrapper6, Long auditDataId) { + wrapper6.eq(NonProhibitedAreasBulkCementSalesUse::getId,auditDataId); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildMortarSupplyBulletinQuery(LambdaQueryWrapper wrapper5, Long auditDataId) { + wrapper5.eq(MortarSupplyBulletin::getId,auditDataId); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildConcreteSupplyBulletinQuery(LambdaQueryWrapper wrapper4, Long auditDataId) { + wrapper4.eq(ConcreteSupplyBulletin::getId,auditDataId); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildBulkCementThreeCityUsageBulletinQuery(LambdaQueryWrapper wrapper3, Long auditDataId) { + wrapper3.eq(BulkCementThreeCityUsageBulletin::getId,auditDataId); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildBulkCementTransferBulletinQuery(LambdaQueryWrapper wrapper2, Long auditDataId) { + wrapper2.eq(BulkCementTransferBulletin::getId,auditDataId); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ALL) + public void buildBulkCementSupplyBulletinQuery(LambdaQueryWrapper wrapper1, Long auditDataId) { + wrapper1.eq(BulkCementSupplyBulletin::getId,auditDataId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementLogFacStaManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementLogFacStaManage.java new file mode 100644 index 0000000..31c846d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementLogFacStaManage.java @@ -0,0 +1,461 @@ +package com.ningdatech.carapi.report.manage; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.car.vehicle.contants.VehicleContant; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.report.constant.DataUploadAuditStatusEnum; +import com.ningdatech.carapi.report.constant.DataUploadAuditTypeEnum; +import com.ningdatech.carapi.report.constant.UploadDataTypeEnum; +import com.ningdatech.carapi.report.model.dto.ReqBulkCementLogFacStaDataUploadDTO; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditInfo; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditRecord; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemDataRelevance; +import com.ningdatech.carapi.report.model.entity.BulkCementLogisticFacilityStatisticAnnualReport; +import com.ningdatech.carapi.report.model.po.ReqBulkCementLogFacStaDataUploadPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.vo.ResBulkCementLogFacStaDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResBulkCementLogFacStaRelatedDataVO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemAuditInfoService; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemAuditRecordService; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemDataRelevanceService; +import com.ningdatech.carapi.report.service.IBulkCementLogisticFacilityStatisticAnnualReportService; +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.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/09/28 11:15 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class BulkCementLogFacStaManage { + + private final IBulkCementDirectReportSystemAuditRecordService auditRecordService; + private final IBulkCementDirectReportSystemAuditInfoService auditInfoService; + private final RegionsCacheHelper regionsCacheHelper; + private final IBulkCementDirectReportSystemDataRelevanceService dataRelevanceService; + private final IBulkCementLogisticFacilityStatisticAnnualReportService bulkCementLogFacStaService; + private final CompaniesCacheHelper companiesCacheHelper; + + public PageVo dataUploadList(ReqDataUploadListPO req) { + + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId = userDetail.getRegionId(); + Page page = req.page(); + // 根据所属区域查出对应的散装水泥物流设施统计年报数据上报记录 + // (每个上报年份对应多个设备名称的数据,需要从数据关联表中查询) + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class); + // 获取入参 + Integer reportStartYear = req.getReportStartYear(); + Integer reportEndYear = req.getReportEndYear(); + Integer auditStatus = req.getAuditStatus(); + wrapper.ge(Objects.nonNull(reportStartYear), BulkCementDirectReportSystemDataRelevance::getReportYear, reportStartYear) + .le(Objects.nonNull(reportEndYear), BulkCementDirectReportSystemDataRelevance::getReportYear, reportEndYear) + .eq(Objects.nonNull(auditStatus),BulkCementDirectReportSystemDataRelevance::getAuditStatus,auditStatus) + // 市级/省级散办单位可根据区域分别查出对应的关联数据 + // 其中市级关联数据对应的数据ID列表为对应上报数据关联数据的ID + // 省级关联数据对应的数据ID列表为各市级关联数据的ID(温台舟使用量关联数据对应的数据ID列表 + // 仍为对应上报数据的ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType,UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId,regionId) + .orderByDesc(BulkCementDirectReportSystemDataRelevance::getReportYear); + //.isNotNull(BulkCementDirectReportSystemDataRelevance::getAuditInfoId); + dataRelevanceService.page(page,wrapper); + + List records = page.getRecords(); + if (CollUtil.isEmpty(records)){ + return PageVo.empty(); + } + // 获取审核信息 + List auditInfoIdList = records.stream().map(BulkCementDirectReportSystemDataRelevance::getAuditInfoId).collect(Collectors.toList()); + Map auditInfoMap = auditInfoService.list(Wrappers.lambdaQuery(BulkCementDirectReportSystemAuditInfo.class).in(BulkCementDirectReportSystemAuditInfo::getId, auditInfoIdList)) + .stream().collect(Collectors.toMap(BulkCementDirectReportSystemAuditInfo::getId, v -> v)); + List resVos = records.stream().map(r -> { + ResDataUploadListVO vo = new ResDataUploadListVO(); + Integer reportYear = r.getReportYear(); + vo.setRegionId(r.getRegionId()); + vo.setReportYear(reportYear); + vo.setAuditDataId(r.getId()); + + BulkCementDirectReportSystemAuditInfo auditInfo = auditInfoMap.get(r.getAuditInfoId()); + if (Objects.nonNull(auditInfo)) { + vo.setAuditOpinion(auditInfo.getAuditOpinion()); + } + vo.setAuditStatus(r.getAuditStatus()); + String desc = DataUploadAuditStatusEnum.getDescByCode(r.getAuditStatus()); + vo.setAuditStatusName(desc); + vo.setCreateOn(r.getCreateOn()); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(resVos, page.getTotal()); + } + + @Transactional(rollbackFor = Exception.class) + public String bulkCementLogFacStaDataUpload(ReqBulkCementLogFacStaDataUploadPO req) { + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Integer reportYear = req.getReportYear(); + VUtils.isTrue(Objects.isNull(reportYear)).throwMessage("请选择上报年份!"); + Long regionId = userDetail.getRegionId(); + + + // 如果登录用户为区县散办 + if (UserRoleTypeEnum.REGION_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + // 先提交市级审核申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(cityAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 发放库数据 + ReqBulkCementLogFacStaDataUploadDTO issueLibraryData = req.getIssueLibraryData(); + VUtils.isTrue(Objects.isNull(issueLibraryData)).throwMessage("请传入发放库数据!"); + // 中转库数据 + ReqBulkCementLogFacStaDataUploadDTO transferLibraryData = req.getTransferLibraryData(); + VUtils.isTrue(Objects.isNull(transferLibraryData)).throwMessage("请传入中转库数据!"); + // 固定接收库数据 + ReqBulkCementLogFacStaDataUploadDTO fixedReceiveLibraryData = req.getFixedReceiveLibraryData(); + VUtils.isTrue(Objects.isNull(fixedReceiveLibraryData)).throwMessage("请传入固定接收库数据!"); + // 合并保存(虽然每个设备名称的数据单独按一条数据保存,但审核数据仍在一条中) + List dataList = Lists.newArrayList(); + dataList.add(issueLibraryData); + dataList.add(transferLibraryData); + dataList.add(fixedReceiveLibraryData); + + // 创建区县关联数据信息(对应每个设备名称的数据关系为一对多) + BulkCementDirectReportSystemDataRelevance countryData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, reportYear) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode())); + + BulkCementDirectReportSystemDataRelevance countryRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + // 区县的区域ID + // 获取所在市的区域ID + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + Long parentId = regionDto.getParentId(); + // 判断上报年份所在市的市级关联数据不存在 + RegionDTO cityRegionDto = regionsCacheHelper.getByRegionId(parentId); + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, parentId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, reportYear) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode())); + // 判断当前地区当前上报年份数据是否已经存在,如果已经存在,更新原数据 + checkUploadData(reportYear, regionId, cityData); + // 说明为重新提交 + if (Objects.nonNull(countryData)){ + // 先删除关联的已经保存的各设备名称的数据 + String auditDataIdList = countryData.getAuditDataIdList(); + if (StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(idList)){ + bulkCementLogFacStaService.remove(Wrappers.lambdaQuery(BulkCementLogisticFacilityStatisticAnnualReport.class) + .in(BulkCementLogisticFacilityStatisticAnnualReport::getId,idList)); + } + } + // 更新市级关联数据 + updateCityData(cityData,countryData); + // 删除被退回的数据 + dataRelevanceService.removeById(countryData); + } + assemblyRelevanceData(userDetail, reportYear, countryRelevanceData); + countryRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()); + countryRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + countryRelevanceData.setAuditInfoId(cityAuditInfo.getId()); + countryRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + countryRelevanceData.setPreparer(req.getPreparer()); + countryRelevanceData.setReviewer(req.getReviewer()); + countryRelevanceData.setSubmissionDate(req.getSubmissionDate()); + countryRelevanceData.setRegionId(userDetail.getRegionId()); + countryRelevanceData.setCompanyId(userDetail.getCompanyId()); + List auditDataIdList = Lists.newArrayList(); + // 保存本次上报数据信息 + for (ReqBulkCementLogFacStaDataUploadDTO uploadDto : dataList) { + BulkCementLogisticFacilityStatisticAnnualReport bulkCementLogFacStaAnnualReport = + new BulkCementLogisticFacilityStatisticAnnualReport(); + assemblyData(uploadDto, userDetail, bulkCementLogFacStaAnnualReport); + bulkCementLogFacStaAnnualReport.setAuditInfoId(cityAuditInfo.getId()); + bulkCementLogFacStaAnnualReport.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + bulkCementLogFacStaService.save(bulkCementLogFacStaAnnualReport); + auditDataIdList.add(bulkCementLogFacStaAnnualReport.getId()); + } + // 保存关联数据ID集合(一条关联数据对应多条不同设备名称的数据) + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + countryRelevanceData.setAuditDataIdList(idListStr); + dataRelevanceService.saveOrUpdate(countryRelevanceData); + + // 补充数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, countryRelevanceData.getId(), cityAuditInfo.getId(), auditRecord); + auditRecord.setReportYear(reportYear); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + // 补充所在市的关联数据信息 + if (Objects.isNull(cityData)) { + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportYear, cityRelevanceData); + cityRelevanceData.setRegionId(parentId); + // 获取所在市散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(cityRegionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + cityRelevanceData.setCompanyId(companyDto.getId()); + } + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + // 有新上报的数据,就更新关联数据状态为未上报 + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.NOT_REPORT.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + } + + } + // 如果登录用户是市级散办,更新审核状态(未上报、被退回)为审核中,并提交省级审核信息和审核记录 + else if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + // 补充省散办关联数据信息 + Long cityRelevanceDataId = req.getId(); + VUtils.isTrue(Objects.isNull(cityRelevanceDataId)).throwMessage("请传入关联数据ID!"); + + // 提交省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(provinceAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + + // 更新市级关联数据审核状态为审核中 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(cityRelevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(userDetail.getUserId()); + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, reportYear) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode())); + + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + if (Objects.isNull(provinceData)) { + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportYear, provinceRelevanceData); + provinceRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + provinceRelevanceData.setCompanyId(companyDto.getId()); + } + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, cityRelevanceData.getId(), provinceAuditInfo.getId(), provinceAuditRecord); + provinceAuditRecord.setReportYear(cityRelevanceData.getReportYear()); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + } + return "上报成功!"; + } + + private void assemblyRelevanceData(UserInfoDetails userDetail, Integer reportYear, BulkCementDirectReportSystemDataRelevance relevanceData) { + relevanceData.setReportYear(reportYear); + relevanceData.setCreateOn(LocalDateTime.now()); + relevanceData.setCreateBy(userDetail.getUserId()); + relevanceData.setUpdateOn(LocalDateTime.now()); + relevanceData.setUpdateBy(userDetail.getUserId()); + relevanceData.setLastUpdateTime(LocalDateTime.now()); + + } + private void assemblyAuditRecord(UserInfoDetails userDetail, Long auditDataId, Long auditInfoId, BulkCementDirectReportSystemAuditRecord auditRecord) { + auditRecord.setAuditDataId(auditDataId); + auditRecord.setAuditInfoId(auditInfoId); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()); + auditRecord.setCompanyId(userDetail.getCompanyId()); + auditRecord.setRegionId(userDetail.getRegionId()); + auditRecord.setCreateOn(LocalDateTime.now()); + auditRecord.setCreateBy(userDetail.getUserId()); + auditRecord.setUpdateOn(LocalDateTime.now()); + auditRecord.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyAuditInfo(BulkCementDirectReportSystemAuditInfo auditInfo, DataUploadAuditStatusEnum underAudit, UserInfoDetails userDetail) { + auditInfo.setAuditStatus(underAudit.getCode()); + auditInfo.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()); + auditInfo.setCreateOn(LocalDateTime.now()); + auditInfo.setCreateBy(userDetail.getUserId()); + auditInfo.setUpdateOn(LocalDateTime.now()); + auditInfo.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyData(ReqBulkCementLogFacStaDataUploadDTO req, UserInfoDetails userDetail, BulkCementLogisticFacilityStatisticAnnualReport bulkCementLogFacStaAnnualReport) { + RegionDTO regionDto = regionsCacheHelper.getByRegionId(userDetail.getRegionId()); + String regionName = regionDto.getRegionName(); + // 单位名称改成了地区 + bulkCementLogFacStaAnnualReport.setRegionName(regionName); + bulkCementLogFacStaAnnualReport.setFacilityName(req.getFacilityName()); + bulkCementLogFacStaAnnualReport.setYearBeginNum(req.getYearBeginNum()); + bulkCementLogFacStaAnnualReport.setYearBeginCapacity(req.getYearBeginCapacity()); + bulkCementLogFacStaAnnualReport.setThisYearNewAddNum(req.getThisYearNewAddNum()); + bulkCementLogFacStaAnnualReport.setThisYearNewAddCapacity(req.getThisYearNewAddCapacity()); + bulkCementLogFacStaAnnualReport.setThisYearScrapNum(req.getThisYearScrapNum()); + bulkCementLogFacStaAnnualReport.setThisYearScrapCapacity(req.getThisYearScrapCapacity()); + bulkCementLogFacStaAnnualReport.setYearEndNum(req.getYearEndNum()); + bulkCementLogFacStaAnnualReport.setYearEndCapacity(req.getYearEndCapacity()); + bulkCementLogFacStaAnnualReport.setThisYearWorkAmount(req.getThisYearWorkAmount()); + bulkCementLogFacStaAnnualReport.setReportYear(req.getReportYear()); + bulkCementLogFacStaAnnualReport.setRemark(req.getRemark()); + bulkCementLogFacStaAnnualReport.setCompanyId(userDetail.getCompanyId()); + bulkCementLogFacStaAnnualReport.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + bulkCementLogFacStaAnnualReport.setPreparer(req.getPreparer()); + bulkCementLogFacStaAnnualReport.setReviewer(req.getReviewer()); + bulkCementLogFacStaAnnualReport.setSubmissionDate(req.getSubmissionDate()); + bulkCementLogFacStaAnnualReport.setRegionId(userDetail.getRegionId()); + bulkCementLogFacStaAnnualReport.setCreateOn(LocalDateTime.now()); + bulkCementLogFacStaAnnualReport.setCreateBy(userDetail.getUserId()); + bulkCementLogFacStaAnnualReport.setUpdateOn(LocalDateTime.now()); + bulkCementLogFacStaAnnualReport.setUpdateBy(userDetail.getUserId()); + } + + private void checkUploadData(Integer reportYear, Long regionId, BulkCementDirectReportSystemDataRelevance cityData) { + // 查询区县关联数据 + BulkCementDirectReportSystemDataRelevance dataRelevance = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, reportYear) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode())); + if (Objects.nonNull(dataRelevance) && + DataUploadAuditStatusEnum.AUDIT_PASS.getCode().equals(dataRelevance.getAuditStatus())){ + // 先删除关联的已经保存的各设备名称的数据 + String auditDataIdList = dataRelevance.getAuditDataIdList(); + if (StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(idList)){ + bulkCementLogFacStaService.remove(Wrappers.lambdaQuery(BulkCementLogisticFacilityStatisticAnnualReport.class) + .in(BulkCementLogisticFacilityStatisticAnnualReport::getId,idList)); + } + } + updateCityData(cityData,dataRelevance); + dataRelevanceService.removeById(dataRelevance); + } + } + + private void updateCityData(BulkCementDirectReportSystemDataRelevance cityData, BulkCementDirectReportSystemDataRelevance dataRelevance) { + if (Objects.nonNull(cityData)) { + String auditDataIdList = cityData.getAuditDataIdList(); + if (StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + // 将已经存在的该地区该上报年份的数据数据从市级关联表中删除 + idList.remove(dataRelevance.getId()); + } + } + } + + public ResBulkCementLogFacStaDataUploadDetailVO getBulkCementLogFacStaUploadData(ReqBulkCementLogFacStaDataUploadDTO req) { + // 获取填报的数据 + Integer yearBeginNum = req.getYearBeginNum(); + BigDecimal yearBeginCapacity = req.getYearBeginCapacity(); + Integer thisYearNewAddNum = req.getThisYearNewAddNum(); + BigDecimal thisYearNewAddCapacity = req.getThisYearNewAddCapacity(); + BigDecimal thisYearScrapCapacity = req.getThisYearScrapCapacity(); + Integer thisYearScrapNum = req.getThisYearScrapNum(); + BigDecimal thisYearWorkAmount = req.getThisYearWorkAmount(); + String remark = req.getRemark(); + Integer reportYear = req.getReportYear(); + String facilityName = req.getFacilityName(); + VUtils.isTrue(StringUtils.isBlank(facilityName)).throwMessage("请传入设备名称!"); + + ResBulkCementLogFacStaDataUploadDetailVO vo = new ResBulkCementLogFacStaDataUploadDetailVO(); + vo.setYearBeginNum(yearBeginNum); + vo.setYearBeginCapacity(yearBeginCapacity); + vo.setThisYearNewAddNum(thisYearNewAddNum); + vo.setThisYearNewAddCapacity(thisYearNewAddCapacity); + vo.setThisYearScrapCapacity(thisYearScrapCapacity); + vo.setThisYearScrapNum(thisYearScrapNum); + vo.setThisYearWorkAmount(thisYearWorkAmount); + vo.setReportYear(reportYear); + vo.setRemark(remark); + + // 计算各数据 + // 年末数量: 年初数量 + 本年新增数量 - 本年报废数量 + if (Objects.nonNull(yearBeginNum) && Objects.nonNull(thisYearNewAddNum) && Objects.nonNull(thisYearScrapNum)){ + int yearEndNum = yearBeginNum + thisYearNewAddNum - thisYearScrapNum; + vo.setYearEndNum(yearEndNum); + } + // 年末容量: 年初容量 + 本年新增容量 - 本年报废容量 + if (Objects.nonNull(yearBeginCapacity) && Objects.nonNull(thisYearNewAddCapacity) && Objects.nonNull(thisYearScrapCapacity)){ + BigDecimal yearEndCapacity = yearBeginCapacity.add(thisYearNewAddCapacity).subtract(thisYearScrapCapacity); + vo.setYearEndCapacity(yearEndCapacity); + } + return vo; + } + + public ResBulkCementLogFacStaRelatedDataVO getBulkCementLogFacStaRelatedData(ReqBulkCementLogFacStaDataUploadDTO dto) { + Integer reportYear = dto.getReportYear(); + VUtils.isTrue(Objects.isNull(reportYear)).throwMessage("请传入上报年份!"); + Long regionId = dto.getRegionId(); + VUtils.isTrue(Objects.isNull(regionId)).throwMessage("请传入区域ID!"); + String facilityName = dto.getFacilityName(); + VUtils.isTrue(StringUtils.isBlank(facilityName)).throwMessage("请传入设备名称!"); + Integer preReportYear = reportYear - 1; + BulkCementLogisticFacilityStatisticAnnualReport preYearBulkCementLogFacStaAnnualReport = bulkCementLogFacStaService.getOne(Wrappers.lambdaQuery(BulkCementLogisticFacilityStatisticAnnualReport.class) + .eq(BulkCementLogisticFacilityStatisticAnnualReport::getReportYear, preReportYear) + .eq(BulkCementLogisticFacilityStatisticAnnualReport::getFacilityName,facilityName) + .eq(BulkCementLogisticFacilityStatisticAnnualReport::getRegionId, regionId)); + ResBulkCementLogFacStaRelatedDataVO vo = new ResBulkCementLogFacStaRelatedDataVO(); + if (Objects.nonNull(preYearBulkCementLogFacStaAnnualReport)) { + // 去年的年末数量 + vo.setYearBeginNum(preYearBulkCementLogFacStaAnnualReport.getYearEndNum()); + // 去年的年末容量 + vo.setYearBeginCapacity(preYearBulkCementLogFacStaAnnualReport.getYearEndCapacity()); + } + return vo; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementSupplyBulletinManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementSupplyBulletinManage.java new file mode 100644 index 0000000..76071e1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementSupplyBulletinManage.java @@ -0,0 +1,402 @@ +package com.ningdatech.carapi.report.manage; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +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.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.car.vehicle.contants.VehicleContant; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.report.constant.DataUploadAuditStatusEnum; +import com.ningdatech.carapi.report.constant.DataUploadAuditTypeEnum; +import com.ningdatech.carapi.report.constant.UploadDataTypeEnum; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditInfo; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditRecord; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemDataRelevance; +import com.ningdatech.carapi.report.model.entity.BulkCementSupplyBulletin; +import com.ningdatech.carapi.report.model.po.ReqBulkCementSupplyDataUploadPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.vo.ResBulkCementSupplyDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemAuditInfoService; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemAuditRecordService; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemDataRelevanceService; +import com.ningdatech.carapi.report.service.IBulkCementSupplyBulletinService; +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.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/09/28 11:15 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class BulkCementSupplyBulletinManage { + + private final IBulkCementDirectReportSystemAuditRecordService auditRecordService; + private final IBulkCementDirectReportSystemAuditInfoService auditInfoService; + private final IBulkCementSupplyBulletinService bulkCementSupplyBulletinService; + private final RegionsCacheHelper regionsCacheHelper; + private final IBulkCementDirectReportSystemDataRelevanceService dataRelevanceService; + private final CompaniesCacheHelper companiesCacheHelper; + public PageVo dataUploadList(ReqDataUploadListPO req) { + + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId = userDetail.getRegionId(); + + Page page = req.page(); + // 根据所属区域查出对应的散装水泥供应量数据上报记录 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(BulkCementSupplyBulletin.class); + // 获取入参 + LocalDateTime reportStartMonth = req.getReportStartMonth(); + LocalDateTime reportEndMonth = req.getReportEndMonth(); + Integer auditStatus = req.getAuditStatus(); + wrapper.ge(Objects.nonNull(reportStartMonth), BulkCementSupplyBulletin::getReportMonth, reportStartMonth) + .le(Objects.nonNull(reportEndMonth), BulkCementSupplyBulletin::getReportMonth, reportEndMonth) + .eq(Objects.nonNull(auditStatus),BulkCementSupplyBulletin::getAuditStatus,auditStatus) + .eq(BulkCementSupplyBulletin::getRegionId,regionId) + .orderByDesc(BulkCementSupplyBulletin::getReportMonth); + //.isNotNull(BulkCementSupplyBulletin::getAuditInfoId); + bulkCementSupplyBulletinService.page(page,wrapper); + List records = page.getRecords(); + if (CollUtil.isEmpty(records)){ + return PageVo.empty(); + } + // 获取审核信息 + List auditInfoIdList = records.stream().map(BulkCementSupplyBulletin::getAuditInfoId).collect(Collectors.toList()); + Map auditInfoMap = auditInfoService.list(Wrappers.lambdaQuery(BulkCementDirectReportSystemAuditInfo.class).in(BulkCementDirectReportSystemAuditInfo::getId, auditInfoIdList)) + .stream().collect(Collectors.toMap(BulkCementDirectReportSystemAuditInfo::getId, v -> v)); + List resVos = records.stream().map(r -> { + ResDataUploadListVO vo = new ResDataUploadListVO(); + LocalDateTime month = r.getReportMonth(); + String reportMonthStr = NdDateUtils.format(month, NdDateUtils.DEFAULT_MONTH_FORMAT); + LocalDateTime reportMonth = LocalDateTimeUtil.parse(reportMonthStr, DateTimeFormatter.ofPattern(DatePattern.NORM_MONTH_PATTERN)); + vo.setRegionId(r.getRegionId()); + vo.setReportMonth(reportMonth); + vo.setAuditDataId(r.getId()); + BulkCementDirectReportSystemAuditInfo auditInfo = auditInfoMap.get(r.getAuditInfoId()); + if (Objects.nonNull(auditInfo)) { + vo.setAuditOpinion(auditInfo.getAuditOpinion()); + } + vo.setAuditStatus(r.getAuditStatus()); + String desc = DataUploadAuditStatusEnum.getDescByCode(r.getAuditStatus()); + vo.setAuditStatusName(desc); + vo.setCreateOn(r.getCreateOn()); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(resVos, page.getTotal()); + } + + @Transactional(rollbackFor = Exception.class) + public String bulkCementSupplyDataUpload(ReqBulkCementSupplyDataUploadPO req) { + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + LocalDateTime reportMonth = req.getReportMonth(); + Long regionId = userDetail.getRegionId(); + + + // 如果登录用户为区县散办 + if (UserRoleTypeEnum.REGION_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请选择上报月份!"); + + // 提交市级审核申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(cityAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 保存上报数据信息 + BulkCementSupplyBulletin cementSupplyBulletin = new BulkCementSupplyBulletin(); + // 区县的区域ID + Long countryRegionId = userDetail.getRegionId(); + // 获取所在市的区域ID + RegionDTO regionDto = regionsCacheHelper.getByRegionId(countryRegionId); + Long parentId = regionDto.getParentId(); + // 判断上报月份所在市的关联数据不存在 + RegionDTO cityRegionDto = regionsCacheHelper.getByRegionId(parentId); + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, parentId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode())); + // 判断当前地区当前上报月份数据是否已经存在,如果已经存在,删除原数据并更新市、省关联数据列表 + checkUploadData(reportMonth, regionId, cityData); + Long dataId = req.getId(); + // 上报数据Id不为空,说明为重新提交 + if (Objects.nonNull(dataId)) { + BulkCementSupplyBulletin oldData = bulkCementSupplyBulletinService.getById(dataId); + VUtils.isTrue(Objects.isNull(oldData)).throwMessage("重新提交数据不存在!"); + // 更新市级关联数据 + updateCityData(cityData,oldData); + // 删除被退回的数据 + bulkCementSupplyBulletinService.removeById(oldData); + } + assemblyData(req, userDetail, cementSupplyBulletin); + cementSupplyBulletin.setAuditInfoId(cityAuditInfo.getId()); + cementSupplyBulletin.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + bulkCementSupplyBulletinService.save(cementSupplyBulletin); + + // 补充数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, cementSupplyBulletin.getId(), cityAuditInfo.getId(), auditRecord); + auditRecord.setReportMonth(reportMonth); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + // 补充所在市的关联数据信息 + // 如果市级关联数据不存在,创建市级关联数据,但不更新上报数据,等审核通过再更新 + if (Objects.isNull(cityData)) { + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportMonth, cityRelevanceData); + cityRelevanceData.setRegionId(parentId); + // 获取所在市散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(cityRegionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + cityRelevanceData.setCompanyId(companyDto.getId()); + } + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode()); + // 有新上报的数据,关联数据状态为未上报 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.NOT_REPORT.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + } + } + // 如果登录用户是市级散办,更新审核状态(未上报、被退回)为审核中,并提交省级审核信息和审核记录 + else if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + Long relevanceDataId = req.getId(); + VUtils.isTrue(Objects.isNull(relevanceDataId)).throwMessage("请传入关联数据ID!"); + + // 提交省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(provinceAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + // 更新市级关联数据审核状态为审核中 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(relevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(userDetail.getUserId()); + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode())); + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + if (Objects.isNull(provinceData)) { + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportMonth, provinceRelevanceData); + provinceRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + provinceRelevanceData.setCompanyId(companyDto.getId()); + } + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, cityRelevanceData.getId(), provinceAuditInfo.getId(), provinceAuditRecord); + provinceAuditRecord.setReportMonth(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + } + + return "上报成功!"; + } + + private void assemblyRelevanceData(UserInfoDetails userDetail,LocalDateTime reportMonth, BulkCementDirectReportSystemDataRelevance relevanceData) { + relevanceData.setReportMonth(reportMonth); + relevanceData.setCreateOn(LocalDateTime.now()); + relevanceData.setCreateBy(userDetail.getUserId()); + relevanceData.setUpdateOn(LocalDateTime.now()); + relevanceData.setUpdateBy(userDetail.getUserId()); + relevanceData.setLastUpdateTime(LocalDateTime.now()); + } + private void assemblyAuditRecord(UserInfoDetails userDetail, Long auditDataId, Long auditInfoId, BulkCementDirectReportSystemAuditRecord auditRecord) { + auditRecord.setAuditDataId(auditDataId); + auditRecord.setAuditInfoId(auditInfoId); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode()); + auditRecord.setCompanyId(userDetail.getCompanyId()); + auditRecord.setRegionId(userDetail.getRegionId()); + auditRecord.setCreateOn(LocalDateTime.now()); + auditRecord.setCreateBy(userDetail.getUserId()); + auditRecord.setUpdateOn(LocalDateTime.now()); + auditRecord.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyAuditInfo(BulkCementDirectReportSystemAuditInfo auditInfo, DataUploadAuditStatusEnum underAudit, UserInfoDetails userDetail) { + auditInfo.setAuditStatus(underAudit.getCode()); + auditInfo.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode()); + auditInfo.setCreateOn(LocalDateTime.now()); + auditInfo.setCreateBy(userDetail.getUserId()); + auditInfo.setUpdateOn(LocalDateTime.now()); + auditInfo.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyData(ReqBulkCementSupplyDataUploadPO req, UserInfoDetails userDetail, BulkCementSupplyBulletin cementSupplyBulletin) { + RegionDTO regionDto = regionsCacheHelper.getByRegionId(userDetail.getRegionId()); + String regionName = regionDto.getRegionName(); + // 单位名称改成了地区 + cementSupplyBulletin.setUnitName(regionName); + cementSupplyBulletin.setBulkCementAmount(req.getBulkCementAmount()); + cementSupplyBulletin.setCementOutput(req.getCementOutput()); + cementSupplyBulletin.setCompletedTotalAmount(req.getCompletedTotalAmount()); + cementSupplyBulletin.setBulkRate(req.getBulkRate()); + cementSupplyBulletin.setIncrement(req.getIncrement()); + cementSupplyBulletin.setIncreaseRate(req.getIncreaseRate()); + cementSupplyBulletin.setCumulativeCementProduction(req.getCumulativeCementProduction()); + cementSupplyBulletin.setReportMonth(req.getReportMonth()); + cementSupplyBulletin.setCompanyId(userDetail.getCompanyId()); + cementSupplyBulletin.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cementSupplyBulletin.setPreparer(req.getPreparer()); + cementSupplyBulletin.setReviewer(req.getReviewer()); + cementSupplyBulletin.setSubmissionDate(req.getSubmissionDate()); + cementSupplyBulletin.setRegionId(userDetail.getRegionId()); + cementSupplyBulletin.setCreateOn(LocalDateTime.now()); + cementSupplyBulletin.setCreateBy(userDetail.getUserId()); + cementSupplyBulletin.setUpdateOn(LocalDateTime.now()); + cementSupplyBulletin.setUpdateBy(userDetail.getUserId()); + } + + private void checkUploadData(LocalDateTime reportMonth, Long regionId, BulkCementDirectReportSystemDataRelevance cityData) { + BulkCementSupplyBulletin bulkCementSupplyBulletin = bulkCementSupplyBulletinService.getOne(Wrappers.lambdaQuery(BulkCementSupplyBulletin.class) + .eq(BulkCementSupplyBulletin::getRegionId, regionId) + .eq(BulkCementSupplyBulletin::getReportMonth, reportMonth)); + // 判断审核状态,如果审核通过,更新审核通过的数据 + if (Objects.nonNull(bulkCementSupplyBulletin) && + DataUploadAuditStatusEnum.AUDIT_PASS.getCode().equals(bulkCementSupplyBulletin.getAuditStatus())){ + updateCityData(cityData, bulkCementSupplyBulletin); + bulkCementSupplyBulletinService.removeById(bulkCementSupplyBulletin); + } + } + + private void updateCityData(BulkCementDirectReportSystemDataRelevance cityData, BulkCementSupplyBulletin bulkCementSupplyBulletin) { + if (Objects.nonNull(cityData)) { + String auditDataIdList = cityData.getAuditDataIdList(); + if (StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + // 将已经存在的该地区该上报月份的数据数据从关联表中删除 + idList.remove(bulkCementSupplyBulletin.getId()); + } + } + } + + public ResBulkCementSupplyDataUploadDetailVO getBulkCementSupplyUploadData(ReqBulkCementSupplyDataUploadPO req) { + + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + // 获取填报的数据 + BigDecimal bulkCementAmount = req.getBulkCementAmount(); + BigDecimal cementOutput = req.getCementOutput(); + LocalDateTime reportMonth = req.getReportMonth(); + Long regionId = userDetail.getRegionId(); + + // 计算年初至本月累计各数据 + // 获取上个月该地区的散装水泥供应量数据 + LocalDateTime preReportMonth = reportMonth.minusMonths(1L); + BulkCementSupplyBulletin preBulkCementSupplyBulletin = bulkCementSupplyBulletinService.getOne(Wrappers.lambdaQuery(BulkCementSupplyBulletin.class) + .eq(BulkCementSupplyBulletin::getRegionId, regionId) + .eq(BulkCementSupplyBulletin::getReportMonth, preReportMonth)); + VUtils.isTrue(Objects.isNull(preBulkCementSupplyBulletin)).throwMessage("系统上个月数据不存在!"); + // 获取去年当前上报月份该地区的散装水泥供应量数据 + LocalDateTime preYearReportMonth = preReportMonth.minusYears(1L).plusMonths(1L); + BulkCementSupplyBulletin preYearBulkCementSupplyBulletin = bulkCementSupplyBulletinService.getOne(Wrappers.lambdaQuery(BulkCementSupplyBulletin.class) + .eq(BulkCementSupplyBulletin::getRegionId, regionId) + .eq(BulkCementSupplyBulletin::getReportMonth, preYearReportMonth)); + VUtils.isTrue(Objects.isNull(preYearBulkCementSupplyBulletin)).throwMessage("系统去年该月数据不存在!"); + + ResBulkCementSupplyDataUploadDetailVO vo = new ResBulkCementSupplyDataUploadDetailVO(); + vo.setBulkCementAmount(bulkCementAmount); + vo.setCementOutput(cementOutput); + + + BigDecimal completeAmount = null; + if (Objects.nonNull(bulkCementAmount)) { + // 完成量:散装水泥总量 + 上个月完成量 + BigDecimal preMonthCompletedTotalAmount = preBulkCementSupplyBulletin.getCompletedTotalAmount(); + BigDecimal preMonthCompletedAmount = Objects.isNull(preMonthCompletedTotalAmount) ? BigDecimal.ZERO : preMonthCompletedTotalAmount; + completeAmount = bulkCementAmount.add(preMonthCompletedAmount); + vo.setCompletedTotalAmount(completeAmount); + + // 比去年同期增加量: 完成量 - 去年这个月的完成量 + BigDecimal preYearCompletedTotalAmount = preYearBulkCementSupplyBulletin.getCompletedTotalAmount(); + BigDecimal preYearCompletedAmount = Objects.isNull(preYearCompletedTotalAmount) ? BigDecimal.ZERO : preYearCompletedTotalAmount; + BigDecimal increment = completeAmount.subtract(preYearCompletedAmount).setScale(2, RoundingMode.HALF_UP); + vo.setIncrement(increment); + + // 比去年同期增长率:增长量 / 去年这个月的完成量 + BigDecimal increaseRate; + if (BigDecimal.ZERO.compareTo(preYearCompletedAmount) != 0) { + increaseRate = increment.divide(preYearCompletedAmount, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + }else { + increaseRate = increment.divide(BigDecimal.ONE, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + } + vo.setIncreaseRate(increaseRate); + } + + if (Objects.nonNull(cementOutput)) { + // 本月止累计水泥产量:水泥产量 + 上个月的本月止累计水泥产量 + BigDecimal preMonthCumulativeCementProduction = preBulkCementSupplyBulletin.getCumulativeCementProduction(); + BigDecimal preMonthCumulativeOutput = Objects.isNull(preMonthCumulativeCementProduction) ? BigDecimal.ZERO : preMonthCumulativeCementProduction; + BigDecimal cumulativeOutput = cementOutput.add(preMonthCumulativeOutput).setScale(2, RoundingMode.HALF_UP); + vo.setCumulativeCementProduction(cumulativeOutput); + + // 散装率:完成量 / 水泥产量 * 100% + if (Objects.nonNull(completeAmount)) { + BigDecimal bulkRate = completeAmount.divide(cumulativeOutput, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + vo.setBulkRate(bulkRate); + } + } + return vo; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementThreeCityUsageBulletinManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementThreeCityUsageBulletinManage.java new file mode 100644 index 0000000..c863c52 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementThreeCityUsageBulletinManage.java @@ -0,0 +1,414 @@ +package com.ningdatech.carapi.report.manage; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +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.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.car.vehicle.contants.VehicleContant; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.report.constant.DataUploadAuditStatusEnum; +import com.ningdatech.carapi.report.constant.DataUploadAuditTypeEnum; +import com.ningdatech.carapi.report.constant.UploadDataTypeEnum; +import com.ningdatech.carapi.report.model.entity.*; +import com.ningdatech.carapi.report.model.po.ReqBulkCementThreeCityUsageDataUploadPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.vo.ResBulkCementThreeCityUsageDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.carapi.report.service.*; +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.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/09/28 11:15 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class BulkCementThreeCityUsageBulletinManage { + + private final IBulkCementDirectReportSystemAuditRecordService auditRecordService; + private final IBulkCementDirectReportSystemAuditInfoService auditInfoService; + private final RegionsCacheHelper regionsCacheHelper; + private final IBulkCementThreeCityUsageBulletinService bulkCementThreeCityUsageBulletinService; + private final IBulkCementDirectReportSystemUniversalIndexService universalIndexService; + private final IBulkCementDirectReportSystemDataRelevanceService dataRelevanceService; + private final CompaniesCacheHelper companiesCacheHelper; + public PageVo dataUploadList(ReqDataUploadListPO req) { + + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId = userDetail.getRegionId(); + + Page page = req.page(); + // 根据所属区域查出对应的散装水泥供应量数据上报记录 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(BulkCementThreeCityUsageBulletin.class); + // 获取入参 + LocalDateTime reportStartMonth = req.getReportStartMonth(); + LocalDateTime reportEndMonth = req.getReportEndMonth(); + Integer auditStatus = req.getAuditStatus(); + wrapper.ge(Objects.nonNull(reportStartMonth), BulkCementThreeCityUsageBulletin::getReportMonth, reportStartMonth) + .le(Objects.nonNull(reportEndMonth), BulkCementThreeCityUsageBulletin::getReportMonth, reportEndMonth) + .eq(Objects.nonNull(auditStatus),BulkCementThreeCityUsageBulletin::getAuditStatus,auditStatus) + .eq(BulkCementThreeCityUsageBulletin::getRegionId,regionId) + .orderByDesc(BulkCementThreeCityUsageBulletin::getReportMonth); + //.isNotNull(BulkCementThreeCityUsageBulletin::getAuditInfoId); + bulkCementThreeCityUsageBulletinService.page(page,wrapper); + List records = page.getRecords(); + if (CollUtil.isEmpty(records)){ + return PageVo.empty(); + } + // 获取审核信息 + List auditInfoIdList = records.stream().map(BulkCementThreeCityUsageBulletin::getAuditInfoId).collect(Collectors.toList()); + Map auditInfoMap = auditInfoService.list(Wrappers.lambdaQuery(BulkCementDirectReportSystemAuditInfo.class).in(BulkCementDirectReportSystemAuditInfo::getId, auditInfoIdList)) + .stream().collect(Collectors.toMap(BulkCementDirectReportSystemAuditInfo::getId, v -> v)); + List resVos = records.stream().map(r -> { + ResDataUploadListVO vo = new ResDataUploadListVO(); + LocalDateTime month = r.getReportMonth(); + String reportMonthStr = NdDateUtils.format(month, NdDateUtils.DEFAULT_MONTH_FORMAT); + LocalDateTime reportMonth = LocalDateTimeUtil.parse(reportMonthStr, DateTimeFormatter.ofPattern(DatePattern.NORM_MONTH_PATTERN)); + vo.setRegionId(r.getRegionId()); + vo.setReportMonth(reportMonth); + vo.setAuditDataId(r.getId()); + BulkCementDirectReportSystemAuditInfo auditInfo = auditInfoMap.get(r.getAuditInfoId()); + if (Objects.nonNull(auditInfo)) { + vo.setAuditOpinion(auditInfo.getAuditOpinion()); + } + vo.setAuditStatus(r.getAuditStatus()); + String desc = DataUploadAuditStatusEnum.getDescByCode(r.getAuditStatus()); + vo.setAuditStatusName(desc); + vo.setCreateOn(r.getCreateOn()); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(resVos, page.getTotal()); + } + + @Transactional(rollbackFor = Exception.class) + public String bulkCementThreeCityUsageDataUpload(ReqBulkCementThreeCityUsageDataUploadPO req) { + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + LocalDateTime reportMonth = req.getReportMonth(); + Long regionId = userDetail.getRegionId(); + + // 如果登录用户为区县散办 + if (UserRoleTypeEnum.REGION_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请选择上报月份!"); + + // 提交市级审核申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(cityAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 保存上报数据信息 + BulkCementThreeCityUsageBulletin bulkCementThreeCityUsageBulletin = new BulkCementThreeCityUsageBulletin(); + // 区县的区域ID + Long countryRegionId = userDetail.getRegionId(); + // 获取所在市的区域ID + RegionDTO regionDto = regionsCacheHelper.getByRegionId(countryRegionId); + Long parentId = regionDto.getParentId(); + // 判断上报月份所在市的关联数据不存在 + RegionDTO cityRegionDto = regionsCacheHelper.getByRegionId(parentId); + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, parentId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode())); + + // 判断当前地区当前上报月份数据是否已经存在,如果已经存在,删除原数据并更新市、省关联数据列表 + checkUploadData(reportMonth, regionId, cityData); + Long dataId = req.getId(); + // 上报数据不为空,说明为重新提交 + if (Objects.nonNull(dataId)) { + BulkCementThreeCityUsageBulletin oldData = bulkCementThreeCityUsageBulletinService.getById(dataId); + VUtils.isTrue(Objects.isNull(oldData)).throwMessage("重新提交数据不存在!"); + // 更新市级关联数据 + updateCityData(cityData,oldData); + // 删除被退回的数据 + bulkCementThreeCityUsageBulletinService.removeById(oldData); + + } + + assemblyData(req, userDetail, bulkCementThreeCityUsageBulletin); + bulkCementThreeCityUsageBulletin.setAuditInfoId(cityAuditInfo.getId()); + bulkCementThreeCityUsageBulletin.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + bulkCementThreeCityUsageBulletinService.saveOrUpdate(bulkCementThreeCityUsageBulletin); + + // 补充数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, bulkCementThreeCityUsageBulletin.getId(), cityAuditInfo.getId(), auditRecord); + auditRecord.setReportMonth(reportMonth); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + // 补充所在市的关联数据信息 + if (Objects.isNull(cityData)) { + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportMonth, cityRelevanceData); + cityRelevanceData.setRegionId(parentId); + // 获取所在市散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(cityRegionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + cityRelevanceData.setCompanyId(companyDto.getId()); + } + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode()); + // 有新上报的数据,就更新关联数据状态为未上报 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.NOT_REPORT.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + } + + } + // 如果登录用户是市级散办,更新审核状态(未上报、被退回)为审核中,并提交省级审核信息和审核记录 + else if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + Long relevanceDataId = req.getId(); + VUtils.isTrue(Objects.isNull(relevanceDataId)).throwMessage("请传入关联数据ID!"); + + // 提交省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(provinceAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + // 更新市级关联数据审核状态为审核中 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(relevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(userDetail.getUserId()); + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode())); + + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + if (Objects.isNull(provinceData)) { + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportMonth, provinceRelevanceData); + provinceRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + provinceRelevanceData.setCompanyId(companyDto.getId()); + } + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, cityRelevanceData.getId(), provinceAuditInfo.getId(), provinceAuditRecord); + provinceAuditRecord.setReportMonth(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + } + return "上报成功!"; + } + private void assemblyRelevanceData(UserInfoDetails userDetail, LocalDateTime reportMonth, BulkCementDirectReportSystemDataRelevance relevanceData) { + relevanceData.setReportMonth(reportMonth); + relevanceData.setCreateOn(LocalDateTime.now()); + relevanceData.setCreateBy(userDetail.getUserId()); + relevanceData.setUpdateOn(LocalDateTime.now()); + relevanceData.setUpdateBy(userDetail.getUserId()); + relevanceData.setLastUpdateTime(LocalDateTime.now()); + } + + private void assemblyAuditRecord(UserInfoDetails userDetail, Long auditDataId, Long auditInfoId, BulkCementDirectReportSystemAuditRecord auditRecord) { + auditRecord.setAuditDataId(auditDataId); + auditRecord.setAuditInfoId(auditInfoId); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode()); + auditRecord.setCompanyId(userDetail.getCompanyId()); + auditRecord.setRegionId(userDetail.getRegionId()); + auditRecord.setCreateOn(LocalDateTime.now()); + auditRecord.setCreateBy(userDetail.getUserId()); + auditRecord.setUpdateOn(LocalDateTime.now()); + auditRecord.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyAuditInfo(BulkCementDirectReportSystemAuditInfo auditInfo, DataUploadAuditStatusEnum underAudit, UserInfoDetails userDetail) { + auditInfo.setAuditStatus(underAudit.getCode()); + auditInfo.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode()); + auditInfo.setCreateOn(LocalDateTime.now()); + auditInfo.setCreateBy(userDetail.getUserId()); + auditInfo.setUpdateOn(LocalDateTime.now()); + auditInfo.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyData(ReqBulkCementThreeCityUsageDataUploadPO req, UserInfoDetails userDetail, BulkCementThreeCityUsageBulletin bulkCementThreeCityUsageBulletin) { + RegionDTO regionDto = regionsCacheHelper.getByRegionId(userDetail.getRegionId()); + String regionName = regionDto.getRegionName(); + // 单位名称改成了地区 + bulkCementThreeCityUsageBulletin.setUnitName(regionName); + bulkCementThreeCityUsageBulletin.setYearTarget(req.getYearTarget()); + bulkCementThreeCityUsageBulletin.setPercentageOfAnnualTarget(req.getPercentageOfAnnualTarget()); + bulkCementThreeCityUsageBulletin.setThisMonthUsage(req.getThisMonthUsage()); + bulkCementThreeCityUsageBulletin.setAccumulativeUsage(req.getAccumulativeUsage()); + bulkCementThreeCityUsageBulletin.setGrowthRate(req.getGrowthRate()); + bulkCementThreeCityUsageBulletin.setThisProvinceThisMonthUsage(req.getThisProvinceThisMonthUsage()); + bulkCementThreeCityUsageBulletin.setThisProvinceAccumulativeUsage(req.getThisProvinceAccumulativeUsage()); + bulkCementThreeCityUsageBulletin.setOtherProvinceThisMonthUsage(req.getOtherProvinceThisMonthUsage()); + bulkCementThreeCityUsageBulletin.setOtherProvinceAccumulativeUsage(req.getOtherProvinceAccumulativeUsage()); + bulkCementThreeCityUsageBulletin.setReportMonth(req.getReportMonth()); + bulkCementThreeCityUsageBulletin.setCompanyId(userDetail.getCompanyId()); + bulkCementThreeCityUsageBulletin.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + bulkCementThreeCityUsageBulletin.setPreparer(req.getPreparer()); + bulkCementThreeCityUsageBulletin.setReviewer(req.getReviewer()); + bulkCementThreeCityUsageBulletin.setSubmissionDate(req.getSubmissionDate()); + bulkCementThreeCityUsageBulletin.setRegionId(userDetail.getRegionId()); + bulkCementThreeCityUsageBulletin.setCreateOn(LocalDateTime.now()); + bulkCementThreeCityUsageBulletin.setCreateBy(userDetail.getUserId()); + bulkCementThreeCityUsageBulletin.setUpdateOn(LocalDateTime.now()); + bulkCementThreeCityUsageBulletin.setUpdateBy(userDetail.getUserId()); + } + + private void checkUploadData(LocalDateTime reportMonth, Long regionId, BulkCementDirectReportSystemDataRelevance cityData) { + BulkCementThreeCityUsageBulletin bulkCementThreeCityUsageBulletin = bulkCementThreeCityUsageBulletinService.getOne(Wrappers.lambdaQuery(BulkCementThreeCityUsageBulletin.class) + .eq(BulkCementThreeCityUsageBulletin::getRegionId, regionId) + .eq(BulkCementThreeCityUsageBulletin::getReportMonth, reportMonth)); + // 判断审核状态,如果审核通过,更新审核通过的数据 + if (Objects.nonNull(bulkCementThreeCityUsageBulletin) && + DataUploadAuditStatusEnum.AUDIT_PASS.getCode().equals(bulkCementThreeCityUsageBulletin.getAuditStatus())){ + updateCityData(cityData,bulkCementThreeCityUsageBulletin); + bulkCementThreeCityUsageBulletinService.removeById(bulkCementThreeCityUsageBulletin); + } + } + + private void updateCityData(BulkCementDirectReportSystemDataRelevance cityData, BulkCementThreeCityUsageBulletin bulkCementThreeCityUsageBulletin) { + if (Objects.nonNull(cityData)) { + String auditDataIdList = cityData.getAuditDataIdList(); + if (StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + // 将已经存在的该地区该上报月份的数据数据从关联表中删除 + idList.remove(bulkCementThreeCityUsageBulletin.getId()); + } + } + } + + public ResBulkCementThreeCityUsageDataUploadDetailVO getBulkCementThreeCityUsageUploadData(ReqBulkCementThreeCityUsageDataUploadPO req) { + + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + // 获取填报的数据 + BigDecimal thisProvinceThisMonthUsage = req.getThisProvinceThisMonthUsage(); + BigDecimal otherProvinceThisMonthUsage = req.getOtherProvinceThisMonthUsage(); + LocalDateTime reportMonth = req.getReportMonth(); + Long regionId = userDetail.getRegionId(); + + // 计算合计、本省、外省各数据 + // 获取上个月该地区的散装水泥使用量数据 + LocalDateTime preReportMonth = reportMonth.minusMonths(1L); + BulkCementThreeCityUsageBulletin preBulkCementThreeCityUsageBulletin = bulkCementThreeCityUsageBulletinService.getOne(Wrappers.lambdaQuery(BulkCementThreeCityUsageBulletin.class) + .eq(BulkCementThreeCityUsageBulletin::getRegionId, regionId) + .eq(BulkCementThreeCityUsageBulletin::getReportMonth, preReportMonth)); + VUtils.isTrue(Objects.isNull(preBulkCementThreeCityUsageBulletin)).throwMessage("系统上个月数据不存在!"); + // 获取去年当前上报月份该地区的散装水泥使用量数据 + LocalDateTime preYearReportMonth = preReportMonth.minusYears(1L).plusMonths(1L); + BulkCementThreeCityUsageBulletin preYearBulkCementThreeCityUsageBulletin = bulkCementThreeCityUsageBulletinService.getOne(Wrappers.lambdaQuery(BulkCementThreeCityUsageBulletin.class) + .eq(BulkCementThreeCityUsageBulletin::getRegionId, regionId) + .eq(BulkCementThreeCityUsageBulletin::getReportMonth, preYearReportMonth)); + VUtils.isTrue(Objects.isNull(preYearBulkCementThreeCityUsageBulletin)).throwMessage("系统去年该月数据不存在!"); + + ResBulkCementThreeCityUsageDataUploadDetailVO vo = new ResBulkCementThreeCityUsageDataUploadDetailVO(); + vo.setThisProvinceThisMonthUsage(thisProvinceThisMonthUsage); + vo.setOtherProvinceThisMonthUsage(otherProvinceThisMonthUsage); + if (Objects.nonNull(thisProvinceThisMonthUsage) && Objects.nonNull(otherProvinceThisMonthUsage)){ + // 本月使用量 = 本省本月使用量 + 外省本月使用量 + // 先取整再运算,防止数据相加再取整后值不一致 + BigDecimal thisProvince = thisProvinceThisMonthUsage.setScale(0, RoundingMode.HALF_UP); + BigDecimal otherProvince = otherProvinceThisMonthUsage.setScale(0, RoundingMode.HALF_UP); + BigDecimal thisMonthUsage = thisProvince.add(otherProvince); + vo.setThisMonthUsage(thisMonthUsage); + + // 累计使用量:上个月的累计使用量 + 本月使用量 = 本省累计使用量 + 外省累计使用量 + BigDecimal preMonthAccumulativeUsage = preBulkCementThreeCityUsageBulletin.getAccumulativeUsage(); + BigDecimal preMonthAccUsage = Objects.isNull(preMonthAccumulativeUsage) ? BigDecimal.ZERO : preMonthAccumulativeUsage; + BigDecimal accumulativeUsage = thisMonthUsage.add(preMonthAccUsage).setScale(0, RoundingMode.HALF_UP); + vo.setAccumulativeUsage(accumulativeUsage); + + // 同比增长率: (今年这个月的累计使用量 - 去年这个月的累计使用量) / 去年这个月的累计使用量 * 100 + BigDecimal preYearAccumulativeUsage = preYearBulkCementThreeCityUsageBulletin.getAccumulativeUsage(); + BigDecimal preYearAccUsage = Objects.isNull(preYearAccumulativeUsage) ? BigDecimal.ZERO : preYearAccumulativeUsage; + BigDecimal growthRate = accumulativeUsage.subtract(preYearAccUsage).divide(preYearAccUsage, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100L)); + vo.setGrowthRate(growthRate); + } + + if (Objects.nonNull(thisProvinceThisMonthUsage)) { + // 本省累计使用量:上个月本省累计使用量 + 本省本月使用量 + BigDecimal preMonthThisProvinceAccumulativeUsage = preBulkCementThreeCityUsageBulletin.getThisProvinceAccumulativeUsage(); + BigDecimal preMonthThisProvinceAccUsage = Objects.isNull(preMonthThisProvinceAccumulativeUsage) ? BigDecimal.ZERO : preMonthThisProvinceAccumulativeUsage; + BigDecimal thisProvinceAccumulativeUsage = thisProvinceThisMonthUsage.add(preMonthThisProvinceAccUsage).setScale(0, RoundingMode.HALF_UP); + vo.setThisProvinceAccumulativeUsage(thisProvinceAccumulativeUsage); + } + + if (Objects.nonNull(otherProvinceThisMonthUsage)) { + // 外省累计使用量:上个月外省累计使用量 + 外省本月使用量 + BigDecimal preMonthOtherProvinceAccumulativeUsage = preBulkCementThreeCityUsageBulletin.getOtherProvinceAccumulativeUsage(); + BigDecimal preMonthOtherProvinceAccUsage = Objects.isNull(preMonthOtherProvinceAccumulativeUsage) ? BigDecimal.ZERO : preMonthOtherProvinceAccumulativeUsage; + BigDecimal otherProvinceAccumulativeUsage = otherProvinceThisMonthUsage.add(preMonthOtherProvinceAccUsage).setScale(0, RoundingMode.HALF_UP); + vo.setOtherProvinceAccumulativeUsage(otherProvinceAccumulativeUsage); + } + return vo; + } + + public BigDecimal getBulkCementThreeCityUsageYearTarget(ReqBulkCementThreeCityUsageDataUploadPO po) { + LocalDateTime reportMonth = po.getReportMonth(); + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请传入上报月份!"); + Long regionId = po.getRegionId(); + VUtils.isTrue(Objects.isNull(regionId)).throwMessage("请传入区域ID!"); + int year = reportMonth.getYear(); + BulkCementDirectReportSystemUniversalIndex universalIndex = universalIndexService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemUniversalIndex.class) + .eq(BulkCementDirectReportSystemUniversalIndex::getRegionId, regionId) + .eq(BulkCementDirectReportSystemUniversalIndex::getYear, year)); + + if (Objects.isNull(universalIndex)){ + return BigDecimal.ZERO; + } + return universalIndex.getBulkCementUsageYearTarget(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementTransferBulletinManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementTransferBulletinManage.java new file mode 100644 index 0000000..8232299 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/BulkCementTransferBulletinManage.java @@ -0,0 +1,405 @@ +package com.ningdatech.carapi.report.manage; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +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.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.car.vehicle.contants.VehicleContant; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.report.constant.DataUploadAuditStatusEnum; +import com.ningdatech.carapi.report.constant.DataUploadAuditTypeEnum; +import com.ningdatech.carapi.report.constant.UploadDataTypeEnum; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditInfo; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditRecord; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemDataRelevance; +import com.ningdatech.carapi.report.model.entity.BulkCementTransferBulletin; +import com.ningdatech.carapi.report.model.po.ReqBulkCementTransferDataUploadPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.vo.ResBulkCementTransferDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemAuditInfoService; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemAuditRecordService; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemDataRelevanceService; +import com.ningdatech.carapi.report.service.IBulkCementTransferBulletinService; +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.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/09/28 11:15 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class BulkCementTransferBulletinManage { + + private final IBulkCementDirectReportSystemAuditRecordService auditRecordService; + private final IBulkCementDirectReportSystemAuditInfoService auditInfoService; + private final RegionsCacheHelper regionsCacheHelper; + private final IBulkCementDirectReportSystemDataRelevanceService dataRelevanceService; + private final IBulkCementTransferBulletinService bulkCementTransferBulletinService; + private final CompaniesCacheHelper companiesCacheHelper; + public PageVo dataUploadList(ReqDataUploadListPO req) { + + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId = userDetail.getRegionId(); + + Page page = req.page(); + // 根据所属区域查出对应的中转库进出量数据上报记录 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(BulkCementTransferBulletin.class); + // 获取入参 + LocalDateTime reportStartMonth = req.getReportStartMonth(); + LocalDateTime reportEndMonth = req.getReportEndMonth(); + Integer auditStatus = req.getAuditStatus(); + wrapper.ge(Objects.nonNull(reportStartMonth), BulkCementTransferBulletin::getReportMonth, reportStartMonth) + .le(Objects.nonNull(reportEndMonth), BulkCementTransferBulletin::getReportMonth, reportEndMonth) + .eq(Objects.nonNull(auditStatus),BulkCementTransferBulletin::getAuditStatus,auditStatus) + .eq(BulkCementTransferBulletin::getRegionId,regionId) + .orderByDesc(BulkCementTransferBulletin::getReportMonth); + //.isNotNull(BulkCementTransferBulletin::getAuditInfoId); + bulkCementTransferBulletinService.page(page,wrapper); + List records = page.getRecords(); + if (CollUtil.isEmpty(records)){ + return PageVo.empty(); + } + // 获取审核信息 + List auditInfoIdList = records.stream().map(BulkCementTransferBulletin::getAuditInfoId).collect(Collectors.toList()); + Map auditInfoMap = auditInfoService.list(Wrappers.lambdaQuery(BulkCementDirectReportSystemAuditInfo.class).in(BulkCementDirectReportSystemAuditInfo::getId, auditInfoIdList)) + .stream().collect(Collectors.toMap(BulkCementDirectReportSystemAuditInfo::getId, v -> v)); + List resVos = records.stream().map(r -> { + ResDataUploadListVO vo = new ResDataUploadListVO(); + LocalDateTime month = r.getReportMonth(); + String reportMonthStr = NdDateUtils.format(month, NdDateUtils.DEFAULT_MONTH_FORMAT); + LocalDateTime reportMonth = LocalDateTimeUtil.parse(reportMonthStr, DateTimeFormatter.ofPattern(DatePattern.NORM_MONTH_PATTERN)); + vo.setRegionId(r.getRegionId()); + vo.setReportMonth(reportMonth); + vo.setAuditDataId(r.getId()); + BulkCementDirectReportSystemAuditInfo auditInfo = auditInfoMap.get(r.getAuditInfoId()); + if (Objects.nonNull(auditInfo)) { + vo.setAuditOpinion(auditInfo.getAuditOpinion()); + } + vo.setAuditStatus(r.getAuditStatus()); + String desc = DataUploadAuditStatusEnum.getDescByCode(r.getAuditStatus()); + vo.setAuditStatusName(desc); + vo.setCreateOn(r.getCreateOn()); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(resVos, page.getTotal()); + } + + @Transactional(rollbackFor = Exception.class) + public String bulkCementTransferDataUpload(ReqBulkCementTransferDataUploadPO req) { + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + LocalDateTime reportMonth = req.getReportMonth(); + Long regionId = userDetail.getRegionId(); + + // 如果登录用户为区县散办 + if (UserRoleTypeEnum.REGION_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请选择上报月份!"); + + // 提交市级审核申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(cityAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 保存上报数据信息 + BulkCementTransferBulletin bulkCementTransferBulletin = new BulkCementTransferBulletin(); + // 区县的区域ID + Long countryRegionId = userDetail.getRegionId(); + // 获取所在市的区域ID + RegionDTO regionDto = regionsCacheHelper.getByRegionId(countryRegionId); + Long parentId = regionDto.getParentId(); + // 判断上报月份所在市的关联数据不存在 + RegionDTO cityRegionDto = regionsCacheHelper.getByRegionId(parentId); + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, parentId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode())); + // 判断当前地区当前上报月份数据是否已经存在,如果已经存在,删除原数据并更新市、省关联数据列表 + checkUploadData(reportMonth, regionId, cityData); + Long dataId = req.getId(); + // 上报数据不为空,说明为重新提交 + if (Objects.nonNull(dataId)) { + BulkCementTransferBulletin oldData = bulkCementTransferBulletinService.getById(dataId); + VUtils.isTrue(Objects.isNull(oldData)).throwMessage("重新提交数据不存在!"); + // 更新市级关联数据 + updateCityData(cityData,oldData); + // 删除被退回的数据 + bulkCementTransferBulletinService.removeById(oldData); + } + + assemblyData(req, userDetail, bulkCementTransferBulletin); + bulkCementTransferBulletin.setAuditInfoId(cityAuditInfo.getId()); + bulkCementTransferBulletin.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + bulkCementTransferBulletinService.saveOrUpdate(bulkCementTransferBulletin); + + // 补充数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, bulkCementTransferBulletin.getId(), cityAuditInfo.getId(), auditRecord); + auditRecord.setReportMonth(reportMonth); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + // 补充所在市的关联数据信息 + if (Objects.isNull(cityData)) { + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportMonth, cityRelevanceData); + cityRelevanceData.setRegionId(parentId); + // 获取所在市散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(cityRegionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + cityRelevanceData.setCompanyId(companyDto.getId()); + } + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode()); + // 有新上报的数据,就更新关联数据状态为未上报 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.NOT_REPORT.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + } + } + // 如果登录用户是市级散办,更新审核状态(未上报、被退回)为审核中,并提交省级审核信息和审核记录 + else if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + Long relevanceDataId = req.getId(); + VUtils.isTrue(Objects.isNull(relevanceDataId)).throwMessage("请传入关联数据ID!"); + + // 提交省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(provinceAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + // 更新市级关联数据审核状态为审核中 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(relevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(userDetail.getUserId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode())); + + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + if (Objects.isNull(provinceData)) { + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportMonth, provinceRelevanceData); + provinceRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + provinceRelevanceData.setCompanyId(companyDto.getId()); + } + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, cityRelevanceData.getId(), provinceAuditInfo.getId(), provinceAuditRecord); + provinceAuditRecord.setReportMonth(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + } + + return "上报成功!"; + } + + private void assemblyRelevanceData(UserInfoDetails userDetail, LocalDateTime reportMonth, BulkCementDirectReportSystemDataRelevance relevanceData) { + relevanceData.setReportMonth(reportMonth); + relevanceData.setCreateOn(LocalDateTime.now()); + relevanceData.setCreateBy(userDetail.getUserId()); + relevanceData.setUpdateOn(LocalDateTime.now()); + relevanceData.setUpdateBy(userDetail.getUserId()); + relevanceData.setLastUpdateTime(LocalDateTime.now()); + } + + private void assemblyAuditRecord(UserInfoDetails userDetail, Long auditDataId, Long auditInfoId, BulkCementDirectReportSystemAuditRecord auditRecord) { + auditRecord.setAuditDataId(auditDataId); + auditRecord.setAuditInfoId(auditInfoId); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode()); + auditRecord.setCompanyId(userDetail.getCompanyId()); + auditRecord.setRegionId(userDetail.getRegionId()); + auditRecord.setCreateOn(LocalDateTime.now()); + auditRecord.setCreateBy(userDetail.getUserId()); + auditRecord.setUpdateOn(LocalDateTime.now()); + auditRecord.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyAuditInfo(BulkCementDirectReportSystemAuditInfo auditInfo, DataUploadAuditStatusEnum underAudit, UserInfoDetails userDetail) { + auditInfo.setAuditStatus(underAudit.getCode()); + auditInfo.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode()); + auditInfo.setCreateOn(LocalDateTime.now()); + auditInfo.setCreateBy(userDetail.getUserId()); + auditInfo.setUpdateOn(LocalDateTime.now()); + auditInfo.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyData(ReqBulkCementTransferDataUploadPO req, UserInfoDetails userDetail, BulkCementTransferBulletin bulkCementTransferBulletin) { + RegionDTO regionDto = regionsCacheHelper.getByRegionId(userDetail.getRegionId()); + String regionName = regionDto.getRegionName(); + // 单位名称改成了地区 + bulkCementTransferBulletin.setUnitName(regionName); + bulkCementTransferBulletin.setLastMonthEndInventory(req.getLastMonthEndInventory()); + bulkCementTransferBulletin.setThisMonthIncomingStorage(req.getThisMonthIncomingStorage()); + bulkCementTransferBulletin.setCumulativeIncomingStorage(req.getCumulativeIncomingStorage()); + bulkCementTransferBulletin.setThisMonthOutgoingStorage(req.getThisMonthOutgoingStorage()); + bulkCementTransferBulletin.setCumulativeOutgoingStorage(req.getCumulativeOutgoingStorage()); + bulkCementTransferBulletin.setMonthEndInventory(req.getMonthEndInventory()); + bulkCementTransferBulletin.setMonthEndInventoryGrowthRate(req.getMonthEndInventoryGrowthRate()); + bulkCementTransferBulletin.setReportMonth(req.getReportMonth()); + bulkCementTransferBulletin.setCompanyId(userDetail.getCompanyId()); + bulkCementTransferBulletin.setRegionId(userDetail.getRegionId()); + bulkCementTransferBulletin.setCreateOn(LocalDateTime.now()); + bulkCementTransferBulletin.setCreateBy(userDetail.getUserId()); + bulkCementTransferBulletin.setUpdateOn(LocalDateTime.now()); + bulkCementTransferBulletin.setUpdateBy(userDetail.getUserId()); + } + + private void checkUploadData(LocalDateTime reportMonth, Long regionId, BulkCementDirectReportSystemDataRelevance cityData) { + BulkCementTransferBulletin bulkCementTransferBulletin = bulkCementTransferBulletinService.getOne(Wrappers.lambdaQuery(BulkCementTransferBulletin.class) + .eq(BulkCementTransferBulletin::getRegionId, regionId) + .eq(BulkCementTransferBulletin::getReportMonth, reportMonth)); + if (Objects.nonNull(bulkCementTransferBulletin) && + DataUploadAuditStatusEnum.AUDIT_PASS.getCode().equals(bulkCementTransferBulletin.getAuditStatus())){ + // 判断审核状态,如果审核通过,更新审核通过的数据 + updateCityData(cityData,bulkCementTransferBulletin); + bulkCementTransferBulletinService.removeById(bulkCementTransferBulletin); + } + } + + private void updateCityData(BulkCementDirectReportSystemDataRelevance cityData, BulkCementTransferBulletin bulkCementTransferBulletin) { + if (Objects.nonNull(cityData)) { + String auditDataIdList = cityData.getAuditDataIdList(); + if (StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + // 将已经存在的该地区该上报月份的数据数据从关联表中删除 + idList.remove(bulkCementTransferBulletin.getId()); + } + } + } + + public ResBulkCementTransferDataUploadDetailVO getBulkCementTransferUploadData(ReqBulkCementTransferDataUploadPO req) { + + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + // 上月末库存 + BigDecimal lastMonthEndInventory = req.getLastMonthEndInventory(); + VUtils.isTrue(Objects.isNull(lastMonthEndInventory)).throwMessage("请传入上月末库存!"); + // 获取填报的数据 + // 本月进库量 + BigDecimal thisMonthIncomingStorage = req.getThisMonthIncomingStorage(); + // 本月出库量 + BigDecimal thisMonthOutgoingStorage = req.getThisMonthOutgoingStorage(); + LocalDateTime reportMonth = req.getReportMonth(); + Long regionId = userDetail.getRegionId(); + + // 计算累计进库量、累计出库量、月末库存量、同比增长率 + // 获取上个月该地区的累计进库量、累计出库量 + LocalDateTime preReportMonth = reportMonth.minusMonths(1L); + BulkCementTransferBulletin preBulkCementTransferBulletin = bulkCementTransferBulletinService.getOne(Wrappers.lambdaQuery(BulkCementTransferBulletin.class) + .eq(BulkCementTransferBulletin::getRegionId, regionId) + .eq(BulkCementTransferBulletin::getReportMonth, preReportMonth)); + VUtils.isTrue(Objects.isNull(preBulkCementTransferBulletin)).throwMessage("系统上个月数据不存在!"); + // 获取去年当前上报月份该地区的月末库存量 + LocalDateTime preYearReportMonth = preReportMonth.minusYears(1L).plusMonths(1L); + BulkCementTransferBulletin preYearBulkCementTransferBulletin = bulkCementTransferBulletinService.getOne(Wrappers.lambdaQuery(BulkCementTransferBulletin.class) + .eq(BulkCementTransferBulletin::getRegionId, regionId) + .eq(BulkCementTransferBulletin::getReportMonth, preYearReportMonth)); + VUtils.isTrue(Objects.isNull(preYearBulkCementTransferBulletin)).throwMessage("系统去年该月数据不存在!"); + + ResBulkCementTransferDataUploadDetailVO vo = new ResBulkCementTransferDataUploadDetailVO(); + vo.setLastMonthEndInventory(lastMonthEndInventory); + vo.setThisMonthIncomingStorage(thisMonthIncomingStorage); + vo.setThisMonthOutgoingStorage(thisMonthOutgoingStorage); + + if (Objects.nonNull(thisMonthIncomingStorage)) { + // 累计进库量:本月进库量 + 上个月累计进库量 + BigDecimal preMonthCumulativeIncomingStorage = preBulkCementTransferBulletin.getCumulativeIncomingStorage(); + BigDecimal preMonCumInStorage = Objects.isNull(preMonthCumulativeIncomingStorage) ? BigDecimal.ZERO : preMonthCumulativeIncomingStorage; + BigDecimal cumulativeIncomingStorage = thisMonthIncomingStorage.add(preMonCumInStorage); + vo.setCumulativeIncomingStorage(cumulativeIncomingStorage); + } + + if (Objects.nonNull(thisMonthOutgoingStorage)) { + // 累计出库量: 本月出库量 + 上个月的累计出库量 + BigDecimal preMonthCumulativeOutgoingStorage = preBulkCementTransferBulletin.getCumulativeOutgoingStorage(); + BigDecimal preMonCumOutStorage = Objects.isNull(preMonthCumulativeOutgoingStorage) ? BigDecimal.ZERO : preMonthCumulativeOutgoingStorage; + BigDecimal cumulativeOutgoingStorage = thisMonthOutgoingStorage.add(preMonCumOutStorage); + vo.setCumulativeOutgoingStorage(cumulativeOutgoingStorage); + } + + if (Objects.nonNull(thisMonthIncomingStorage) && Objects.nonNull(thisMonthOutgoingStorage)){ + // 月末库存量 = 上月末库存量 + 本月进库量 - 本月出库量 + BigDecimal monthEndInventory = lastMonthEndInventory.add(thisMonthIncomingStorage).subtract(thisMonthOutgoingStorage); + vo.setMonthEndInventory(monthEndInventory); + // 同比增长率 = (月末库存量 - 去年月末库存量)/ 去年月末库存量 * 100 + BigDecimal preYearMonthEndInventory = preYearBulkCementTransferBulletin.getMonthEndInventory(); + BigDecimal monthEndInventoryGrowthRate = monthEndInventory.subtract(preYearMonthEndInventory).divide(preYearMonthEndInventory, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); + vo.setMonthEndInventoryGrowthRate(monthEndInventoryGrowthRate); + } + return vo; + } + + public BigDecimal getBulkCementTransferLastMonthData(ReqBulkCementTransferDataUploadPO po) { + LocalDateTime reportMonth = po.getReportMonth(); + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请传入上报月份!"); + Long regionId = po.getRegionId(); + VUtils.isTrue(Objects.isNull(regionId)).throwMessage("请传入区域ID!"); + LocalDateTime preReportMonth = reportMonth.minusMonths(1); + BulkCementTransferBulletin transferBulletin = bulkCementTransferBulletinService.getOne(Wrappers.lambdaQuery(BulkCementTransferBulletin.class) + .eq(BulkCementTransferBulletin::getReportMonth, preReportMonth) + .eq(BulkCementTransferBulletin::getRegionId, regionId)); + if (Objects.isNull(transferBulletin)){ + return BigDecimal.ZERO; + } + return transferBulletin.getLastMonthEndInventory(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/ConcreteSupplyBulletinManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/ConcreteSupplyBulletinManage.java new file mode 100644 index 0000000..c904192 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/ConcreteSupplyBulletinManage.java @@ -0,0 +1,417 @@ +package com.ningdatech.carapi.report.manage; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +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.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.car.vehicle.contants.VehicleContant; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.report.constant.DataUploadAuditStatusEnum; +import com.ningdatech.carapi.report.constant.DataUploadAuditTypeEnum; +import com.ningdatech.carapi.report.constant.UploadDataTypeEnum; +import com.ningdatech.carapi.report.model.entity.*; +import com.ningdatech.carapi.report.model.po.ReqConcreteSupplyDataUploadPO; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.vo.ResConcreteSupplyDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResConcreteSupplyRelatedDataVO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.carapi.report.service.*; +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.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/09/28 11:15 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class ConcreteSupplyBulletinManage { + + private final IBulkCementDirectReportSystemAuditRecordService auditRecordService; + private final IBulkCementDirectReportSystemAuditInfoService auditInfoService; + private final RegionsCacheHelper regionsCacheHelper; + private final IBulkCementDirectReportSystemDataRelevanceService dataRelevanceService; + private final IConcreteSupplyBulletinService concreteSupplyBulletinService; + private final IBulkCementDirectReportSystemUniversalIndexService universalIndexService; + private final CompaniesCacheHelper companiesCacheHelper; + + public PageVo dataUploadList(ReqDataUploadListPO req) { + + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId = userDetail.getRegionId(); + + Page page = req.page(); + // 根据所属区域查出对应的散装水泥供应量数据上报记录 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ConcreteSupplyBulletin.class); + // 获取入参 + LocalDateTime reportStartMonth = req.getReportStartMonth(); + LocalDateTime reportEndMonth = req.getReportEndMonth(); + Integer auditStatus = req.getAuditStatus(); + wrapper.ge(Objects.nonNull(reportStartMonth), ConcreteSupplyBulletin::getReportMonth, reportStartMonth) + .le(Objects.nonNull(reportEndMonth), ConcreteSupplyBulletin::getReportMonth, reportEndMonth) + .eq(Objects.nonNull(auditStatus),ConcreteSupplyBulletin::getAuditStatus,auditStatus) + .eq(ConcreteSupplyBulletin::getRegionId,regionId) + .orderByDesc(ConcreteSupplyBulletin::getReportMonth); + //.isNotNull(ConcreteSupplyBulletin::getAuditInfoId); + concreteSupplyBulletinService.page(page,wrapper); + List records = page.getRecords(); + if (CollUtil.isEmpty(records)){ + return PageVo.empty(); + } + // 获取审核信息 + List auditInfoIdList = records.stream().map(ConcreteSupplyBulletin::getAuditInfoId).collect(Collectors.toList()); + Map auditInfoMap = auditInfoService.list(Wrappers.lambdaQuery(BulkCementDirectReportSystemAuditInfo.class).in(BulkCementDirectReportSystemAuditInfo::getId, auditInfoIdList)) + .stream().collect(Collectors.toMap(BulkCementDirectReportSystemAuditInfo::getId, v -> v)); + List resVos = records.stream().map(r -> { + ResDataUploadListVO vo = new ResDataUploadListVO(); + LocalDateTime month = r.getReportMonth(); + String reportMonthStr = NdDateUtils.format(month, NdDateUtils.DEFAULT_MONTH_FORMAT); + LocalDateTime reportMonth = LocalDateTimeUtil.parse(reportMonthStr, DateTimeFormatter.ofPattern(DatePattern.NORM_MONTH_PATTERN)); + vo.setRegionId(r.getRegionId()); + vo.setReportMonth(reportMonth); + vo.setAuditDataId(r.getId()); + BulkCementDirectReportSystemAuditInfo auditInfo = auditInfoMap.get(r.getAuditInfoId()); + if (Objects.nonNull(auditInfo)) { + vo.setAuditOpinion(auditInfo.getAuditOpinion()); + } + vo.setAuditStatus(r.getAuditStatus()); + String desc = DataUploadAuditStatusEnum.getDescByCode(r.getAuditStatus()); + vo.setAuditStatusName(desc); + vo.setCreateOn(r.getCreateOn()); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(resVos, page.getTotal()); + } + + @Transactional(rollbackFor = Exception.class) + public String concreteSupplyDataUpload(ReqConcreteSupplyDataUploadPO req) { + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + LocalDateTime reportMonth = req.getReportMonth(); + Long regionId = userDetail.getRegionId(); + + // 如果登录用户为区县散办 + if (UserRoleTypeEnum.REGION_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请选择上报月份!"); + + // 提交市级审核申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(cityAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 保存上报数据信息 + ConcreteSupplyBulletin concreteSupplyBulletin = new ConcreteSupplyBulletin(); + // 区县的区域ID + Long countryRegionId = userDetail.getRegionId(); + // 获取所在市的区域ID + RegionDTO regionDto = regionsCacheHelper.getByRegionId(countryRegionId); + Long parentId = regionDto.getParentId(); + // 判断上报月份所在市的关联数据不存在 + RegionDTO cityRegionDto = regionsCacheHelper.getByRegionId(parentId); + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, parentId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode())); + // 判断当前地区当前上报月份数据是否已经存在,如果已经存在,删除原数据并更新市、省关联数据列表 + checkUploadData(reportMonth, regionId, cityData); + Long dataId = req.getId(); + // 上报数据不为空,说明为重新提交 + if (Objects.nonNull(dataId)) { + ConcreteSupplyBulletin oldData = concreteSupplyBulletinService.getById(dataId); + VUtils.isTrue(Objects.isNull(oldData)).throwMessage("重新提交数据不存在!"); + // 更新市级关联数据 + updateCityData(cityData,oldData); + // 删除被退回的数据 + concreteSupplyBulletinService.removeById(oldData); + } + + assemblyData(req, userDetail, concreteSupplyBulletin); + concreteSupplyBulletin.setAuditInfoId(cityAuditInfo.getId()); + concreteSupplyBulletin.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + concreteSupplyBulletinService.saveOrUpdate(concreteSupplyBulletin); + + // 补充数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, concreteSupplyBulletin.getId(), cityAuditInfo.getId(), auditRecord); + auditRecord.setReportMonth(reportMonth); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + // 补充所在市的关联数据信息 + if (Objects.isNull(cityData)) { + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportMonth, cityRelevanceData); + cityRelevanceData.setRegionId(parentId); + // 获取所在市散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(cityRegionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + cityRelevanceData.setCompanyId(companyDto.getId()); + } + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode()); + // 有新上报的数据,就更新关联数据状态为未上报 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.NOT_REPORT.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + } + + } + // 如果登录用户是市级散办,更新审核状态(未上报、被退回)为审核中,并提交省级审核信息和审核记录 + else if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + Long relevanceDataId = req.getId(); + VUtils.isTrue(Objects.isNull(relevanceDataId)).throwMessage("请传入关联数据ID!"); + + // 提交省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(provinceAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + + // 更新市级关联数据审核状态为审核中 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(relevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(userDetail.getUserId()); + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode())); + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + if (Objects.isNull(provinceData)) { + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportMonth, provinceRelevanceData); + provinceRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + provinceRelevanceData.setCompanyId(companyDto.getId()); + } + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, cityRelevanceData.getId(), provinceAuditInfo.getId(), provinceAuditRecord); + provinceAuditRecord.setReportMonth(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + } + + return "上报成功!"; + } + + private void assemblyRelevanceData(UserInfoDetails userDetail, LocalDateTime reportMonth, BulkCementDirectReportSystemDataRelevance relevanceData) { + relevanceData.setReportMonth(reportMonth); + relevanceData.setCreateOn(LocalDateTime.now()); + relevanceData.setCreateBy(userDetail.getUserId()); + relevanceData.setUpdateOn(LocalDateTime.now()); + relevanceData.setUpdateBy(userDetail.getUserId()); + relevanceData.setLastUpdateTime(LocalDateTime.now()); + } + private void assemblyAuditRecord(UserInfoDetails userDetail, Long auditDataId, Long auditInfoId, BulkCementDirectReportSystemAuditRecord auditRecord) { + auditRecord.setAuditDataId(auditDataId); + auditRecord.setAuditInfoId(auditInfoId); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode()); + auditRecord.setCompanyId(userDetail.getCompanyId()); + auditRecord.setRegionId(userDetail.getRegionId()); + auditRecord.setCreateOn(LocalDateTime.now()); + auditRecord.setCreateBy(userDetail.getUserId()); + auditRecord.setUpdateOn(LocalDateTime.now()); + auditRecord.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyAuditInfo(BulkCementDirectReportSystemAuditInfo auditInfo, DataUploadAuditStatusEnum underAudit, UserInfoDetails userDetail) { + auditInfo.setAuditStatus(underAudit.getCode()); + auditInfo.setAuditDataType(UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode()); + auditInfo.setCreateOn(LocalDateTime.now()); + auditInfo.setCreateBy(userDetail.getUserId()); + auditInfo.setUpdateOn(LocalDateTime.now()); + auditInfo.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyData(ReqConcreteSupplyDataUploadPO req, UserInfoDetails userDetail, ConcreteSupplyBulletin concreteSupplyBulletin) { + RegionDTO regionDto = regionsCacheHelper.getByRegionId(userDetail.getRegionId()); + String regionName = regionDto.getRegionName(); + // 单位名称改成了地区 + concreteSupplyBulletin.setUnitName(regionName); + concreteSupplyBulletin.setThreeCategoryGuidGoal(req.getThreeCategoryGuidGoal()); + concreteSupplyBulletin.setProductionCompanyNums(req.getProductionCompanyNums()); + concreteSupplyBulletin.setAnnualDesignProductionCapacity(req.getAnnualDesignProductionCapacity()); + concreteSupplyBulletin.setThisMonthOutput(req.getThisMonthOutput()); + concreteSupplyBulletin.setAccumulativeOutput(req.getAccumulativeOutput()); + concreteSupplyBulletin.setThisMonthCementUsage(req.getThisMonthCementUsage()); + concreteSupplyBulletin.setCementAccumulativeUsage(req.getCementAccumulativeUsage()); + concreteSupplyBulletin.setThisMonthWasteUtilization(req.getThisMonthWasteUtilization()); + concreteSupplyBulletin.setAccumulativeWasteUtilization(req.getAccumulativeWasteUtilization()); + concreteSupplyBulletin.setReportMonth(req.getReportMonth()); + concreteSupplyBulletin.setCompanyId(userDetail.getCompanyId()); + concreteSupplyBulletin.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + concreteSupplyBulletin.setPreparer(req.getPreparer()); + concreteSupplyBulletin.setReviewer(req.getReviewer()); + concreteSupplyBulletin.setSubmissionDate(req.getSubmissionDate()); + concreteSupplyBulletin.setRegionId(userDetail.getRegionId()); + concreteSupplyBulletin.setCreateOn(LocalDateTime.now()); + concreteSupplyBulletin.setCreateBy(userDetail.getUserId()); + concreteSupplyBulletin.setUpdateOn(LocalDateTime.now()); + concreteSupplyBulletin.setUpdateBy(userDetail.getUserId()); + concreteSupplyBulletin.setRemark(req.getRemark()); + } + + private void checkUploadData(LocalDateTime reportMonth, Long regionId, BulkCementDirectReportSystemDataRelevance cityData) { + ConcreteSupplyBulletin concreteSupplyBulletin = concreteSupplyBulletinService.getOne(Wrappers.lambdaQuery(ConcreteSupplyBulletin.class) + .eq(ConcreteSupplyBulletin::getRegionId, regionId) + .eq(ConcreteSupplyBulletin::getReportMonth, reportMonth)); + // 判断审核状态,如果审核通过,更新审核通过的数据 + if (Objects.nonNull(concreteSupplyBulletin) && + DataUploadAuditStatusEnum.AUDIT_PASS.getCode().equals(concreteSupplyBulletin.getAuditStatus())){ + updateCityData(cityData,concreteSupplyBulletin); + concreteSupplyBulletinService.removeById(concreteSupplyBulletin); + } + } + + private void updateCityData(BulkCementDirectReportSystemDataRelevance cityData, ConcreteSupplyBulletin concreteSupplyBulletin) { + if (Objects.nonNull(cityData)) { + String auditDataIdList = cityData.getAuditDataIdList(); + if (StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + // 将已经存在的该地区该上报月份的数据数据从关联表中删除 + idList.remove(concreteSupplyBulletin.getId()); + } + } + } + + public ResConcreteSupplyDataUploadDetailVO getConcreteSupplyUploadData(ReqConcreteSupplyDataUploadPO req) { + + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + // 获取填报的数据 + BigDecimal threeCategoryGuidGoal = req.getThreeCategoryGuidGoal(); + Integer productionCompanyNums = req.getProductionCompanyNums(); + BigDecimal annualDesignProductionCapacity = req.getAnnualDesignProductionCapacity(); + + BigDecimal thisMonthOutput = req.getThisMonthOutput(); + BigDecimal thisMonthCementUsage = req.getThisMonthCementUsage(); + BigDecimal thisMonthWasteUtilization = req.getThisMonthWasteUtilization(); + String remark = req.getRemark(); + + LocalDateTime reportMonth = req.getReportMonth(); + Long regionId = userDetail.getRegionId(); + + // 计算实际产量(立方米)、使用散装水泥量(吨)、废弃物综合利用量(吨) + // 获取上个月该地区的混凝土供应量数据 + LocalDateTime preReportMonth = reportMonth.minusMonths(1L); + ConcreteSupplyBulletin preConcreteSupplyBulletin = concreteSupplyBulletinService.getOne(Wrappers.lambdaQuery(ConcreteSupplyBulletin.class) + .eq(ConcreteSupplyBulletin::getRegionId, regionId) + .eq(ConcreteSupplyBulletin::getReportMonth, preReportMonth)); + VUtils.isTrue(Objects.isNull(preConcreteSupplyBulletin)).throwMessage("系统上个月数据不存在!"); + + ResConcreteSupplyDataUploadDetailVO vo = new ResConcreteSupplyDataUploadDetailVO(); + vo.setThreeCategoryGuidGoal(threeCategoryGuidGoal); + vo.setProductionCompanyNums(productionCompanyNums); + vo.setAnnualDesignProductionCapacity(annualDesignProductionCapacity); + vo.setRemark(remark); + + if (Objects.nonNull(thisMonthOutput)) { + // 累计产量:本月实际产量 + 上个月累计产量 + BigDecimal preMonthAccumulativeOutput = preConcreteSupplyBulletin.getAccumulativeOutput(); + BigDecimal preMonthAccOutput = Objects.isNull(preMonthAccumulativeOutput) ? BigDecimal.ZERO : preMonthAccumulativeOutput; + BigDecimal accumulativeOutput = thisMonthOutput.add(preMonthAccOutput); + vo.setAccumulativeOutput(accumulativeOutput); + } + + if (Objects.nonNull(thisMonthCementUsage)) { + // 累计使用散装水泥量: 本月使用散装水泥量 + 上个月累计使用散装水泥量 + BigDecimal preMonthCementAccumulativeUsage = preConcreteSupplyBulletin.getCementAccumulativeUsage(); + BigDecimal preMonthCementAccUsage = Objects.isNull(preMonthCementAccumulativeUsage) ? BigDecimal.ZERO : preMonthCementAccumulativeUsage; + BigDecimal cementAccumulativeUsage = thisMonthCementUsage.add(preMonthCementAccUsage); + vo.setCementAccumulativeUsage(cementAccumulativeUsage); + } + + if (Objects.nonNull(thisMonthWasteUtilization)) { + // 累计废弃物综合利用量: 本月废弃物综合利用量 + 上个月累计废弃物综合利用量 + BigDecimal preMonthAccumulativeWasteUtilization = preConcreteSupplyBulletin.getAccumulativeWasteUtilization(); + BigDecimal preMonthAccWasteUtilization = Objects.isNull(preMonthAccumulativeWasteUtilization) ? BigDecimal.ZERO : preMonthAccumulativeWasteUtilization; + BigDecimal accumulativeWasteUtilization = thisMonthWasteUtilization.add(preMonthAccWasteUtilization); + vo.setAccumulativeWasteUtilization(accumulativeWasteUtilization); + } + return vo; + } + + public ResConcreteSupplyRelatedDataVO getConcreteSupplyRelatedData(ReqConcreteSupplyDataUploadPO po) { + LocalDateTime reportMonth = po.getReportMonth(); + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请传入上报月份!"); + Long regionId = po.getRegionId(); + VUtils.isTrue(Objects.isNull(regionId)).throwMessage("请传入区域ID!"); + LocalDateTime preReportMonth = reportMonth.minusMonths(1); + ConcreteSupplyBulletin preMonthConcreteSupplyBulletin = concreteSupplyBulletinService.getOne(Wrappers.lambdaQuery(ConcreteSupplyBulletin.class) + .eq(ConcreteSupplyBulletin::getReportMonth, preReportMonth) + .eq(ConcreteSupplyBulletin::getRegionId, regionId)); + int year = reportMonth.getYear(); + BulkCementDirectReportSystemUniversalIndex universalIndex = universalIndexService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemUniversalIndex.class) + .eq(BulkCementDirectReportSystemUniversalIndex::getRegionId, regionId) + .eq(BulkCementDirectReportSystemUniversalIndex::getYear, year)); + ResConcreteSupplyRelatedDataVO vo = new ResConcreteSupplyRelatedDataVO(); + if (Objects.nonNull(preMonthConcreteSupplyBulletin)) { + vo.setProductionCompanyNums(preMonthConcreteSupplyBulletin.getProductionCompanyNums()); + vo.setAnnualDesignProductionCapacity(preMonthConcreteSupplyBulletin.getAnnualDesignProductionCapacity()); + } + if (Objects.nonNull(universalIndex)) { + vo.setThreeCategoryGuidGoal(universalIndex.getConcreteSupplyThreeCategoryGuidGoal()); + }else { + vo.setThreeCategoryGuidGoal(BigDecimal.ZERO); + } + return vo; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/MaterialLogEquipStaManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/MaterialLogEquipStaManage.java new file mode 100644 index 0000000..a58bd0b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/MaterialLogEquipStaManage.java @@ -0,0 +1,478 @@ +package com.ningdatech.carapi.report.manage; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.car.vehicle.contants.VehicleContant; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.report.constant.DataUploadAuditStatusEnum; +import com.ningdatech.carapi.report.constant.DataUploadAuditTypeEnum; +import com.ningdatech.carapi.report.constant.UploadDataTypeEnum; +import com.ningdatech.carapi.report.model.dto.ReqMaterialLogEquipStaDataUploadDTO; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditInfo; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditRecord; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemDataRelevance; +import com.ningdatech.carapi.report.model.entity.MaterialLogisticEquipmentStatisticAnnualReport; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.po.ReqMaterialLogEquipStaDataUploadPO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.carapi.report.model.vo.ResMaterialLogEquipStaDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResMaterialLogEquipStaRelatedDataVO; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemAuditInfoService; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemAuditRecordService; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemDataRelevanceService; +import com.ningdatech.carapi.report.service.IMaterialLogisticEquipmentStatisticAnnualReportService; +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.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/09/28 11:15 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class MaterialLogEquipStaManage { + + private final IBulkCementDirectReportSystemAuditRecordService auditRecordService; + private final IBulkCementDirectReportSystemAuditInfoService auditInfoService; + private final RegionsCacheHelper regionsCacheHelper; + private final IBulkCementDirectReportSystemDataRelevanceService dataRelevanceService; + private final CompaniesCacheHelper companiesCacheHelper; + private final IMaterialLogisticEquipmentStatisticAnnualReportService materialLogEquipStaAnnualReportService; + + public PageVo dataUploadList(ReqDataUploadListPO req) { + + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId = userDetail.getRegionId(); + Page page = req.page(); + // 根据所属区域查出对应的散装水泥物流设施统计年报数据上报记录 + // (每个上报年份对应多个设备名称的数据,需要从数据关联表中查询) + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class); + // 获取入参 + Integer reportStartYear = req.getReportStartYear(); + Integer reportEndYear = req.getReportEndYear(); + Integer auditStatus = req.getAuditStatus(); + wrapper.ge(Objects.nonNull(reportStartYear), BulkCementDirectReportSystemDataRelevance::getReportYear, reportStartYear) + .le(Objects.nonNull(reportEndYear), BulkCementDirectReportSystemDataRelevance::getReportYear, reportEndYear) + .eq(Objects.nonNull(auditStatus),BulkCementDirectReportSystemDataRelevance::getAuditStatus,auditStatus) + // 市级/省级散办单位可根据区域分别查出对应的关联数据 + // 其中市级关联数据对应的数据ID列表为对应上报数据关联数据的ID + // 省级关联数据对应的数据ID列表为各市级关联数据的ID(温台舟使用量关联数据对应的数据ID列表 + // 仍为对应上报数据的ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType,UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId,regionId) + .orderByDesc(BulkCementDirectReportSystemDataRelevance::getReportYear); + //.isNotNull(BulkCementDirectReportSystemDataRelevance::getAuditInfoId); + dataRelevanceService.page(page,wrapper); + + List records = page.getRecords(); + if (CollUtil.isEmpty(records)){ + return PageVo.empty(); + } + // 获取审核信息 + List auditInfoIdList = records.stream().map(BulkCementDirectReportSystemDataRelevance::getAuditInfoId).collect(Collectors.toList()); + Map auditInfoMap = auditInfoService.list(Wrappers.lambdaQuery(BulkCementDirectReportSystemAuditInfo.class).in(BulkCementDirectReportSystemAuditInfo::getId, auditInfoIdList)) + .stream().collect(Collectors.toMap(BulkCementDirectReportSystemAuditInfo::getId, v -> v)); + List resVos = records.stream().map(r -> { + ResDataUploadListVO vo = new ResDataUploadListVO(); + Integer reportYear = r.getReportYear(); + vo.setRegionId(r.getRegionId()); + vo.setReportYear(reportYear); + vo.setAuditDataId(r.getId()); + + BulkCementDirectReportSystemAuditInfo auditInfo = auditInfoMap.get(r.getAuditInfoId()); + if (Objects.nonNull(auditInfo)) { + vo.setAuditOpinion(auditInfo.getAuditOpinion()); + } + vo.setAuditStatus(r.getAuditStatus()); + String desc = DataUploadAuditStatusEnum.getDescByCode(r.getAuditStatus()); + vo.setAuditStatusName(desc); + vo.setCreateOn(r.getCreateOn()); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(resVos, page.getTotal()); + } + + @Transactional(rollbackFor = Exception.class) + public String materialLogEquipStaDataUpload(ReqMaterialLogEquipStaDataUploadPO req) { + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Integer reportYear = req.getReportYear(); + VUtils.isTrue(Objects.isNull(reportYear)).throwMessage("请选择上报年份!"); + Long regionId = userDetail.getRegionId(); + + // 如果登录用户为区县散办 + if (UserRoleTypeEnum.REGION_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + // 先提交市级审核申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(cityAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 专用汽车数据 + ReqMaterialLogEquipStaDataUploadDTO specialVehicleData = req.getSpecialVehicleData(); + VUtils.isTrue(Objects.isNull(specialVehicleData)).throwMessage("请传入专用汽车数据!"); + // 专用船数据 + ReqMaterialLogEquipStaDataUploadDTO specialVesselData = req.getSpecialVesselData(); + VUtils.isTrue(Objects.isNull(specialVesselData)).throwMessage("请传入专用船数据!"); + // 散装水泥罐数据 + ReqMaterialLogEquipStaDataUploadDTO bulkCementTankData = req.getBulkCementTankData(); + VUtils.isTrue(Objects.isNull(bulkCementTankData)).throwMessage("请传入散装水泥罐数据!"); + // 混凝土搅拌车数据 + ReqMaterialLogEquipStaDataUploadDTO concreteMixerTruckData = req.getConcreteMixerTruckData(); + VUtils.isTrue(Objects.isNull(concreteMixerTruckData)).throwMessage("请传入混凝土搅拌车数据!"); + // 混凝土泵车数据 + ReqMaterialLogEquipStaDataUploadDTO concretePumpTruckData = req.getConcretePumpTruckData(); + VUtils.isTrue(Objects.isNull(concretePumpTruckData)).throwMessage("请传入混凝土泵车数据!"); + // 干混砂浆运输车数据 + ReqMaterialLogEquipStaDataUploadDTO dryMixMortarTruckData = req.getDryMixMortarTruckData(); + VUtils.isTrue(Objects.isNull(dryMixMortarTruckData)).throwMessage("请传入干混砂浆运输车数据!"); + // 干混砂浆移动简仓数据 + ReqMaterialLogEquipStaDataUploadDTO dryMixMortarMovingStorageData = req.getDryMixMortarMovingStorageData(); + VUtils.isTrue(Objects.isNull(dryMixMortarMovingStorageData)).throwMessage("请传入干混砂浆移动简仓数据!"); + // 干混砂浆背罐车数据 + ReqMaterialLogEquipStaDataUploadDTO dryMixMortarBackTankCarData = req.getDryMixMortarBackTankCarData(); + VUtils.isTrue(Objects.isNull(dryMixMortarBackTankCarData)).throwMessage("请传入干混砂浆背罐车数据!"); + + + // 合并保存(虽然每个装备名称的数据单独按一条数据保存,但审核数据仍在一条中) + List dataList = Lists.newArrayList(); + dataList.add(specialVehicleData); + dataList.add(specialVesselData); + dataList.add(bulkCementTankData); + dataList.add(concreteMixerTruckData); + dataList.add(concretePumpTruckData); + dataList.add(dryMixMortarTruckData); + dataList.add(dryMixMortarMovingStorageData); + dataList.add(dryMixMortarBackTankCarData); + + // 创建区县关联数据信息(对应每个设备名称的数据关系为一对多) + BulkCementDirectReportSystemDataRelevance countryData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, reportYear) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode())); + + BulkCementDirectReportSystemDataRelevance countryRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + // 区县的区域ID + // 获取所在市的区域ID + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + Long parentId = regionDto.getParentId(); + // 判断上报年份所在市的市级关联数据不存在 + RegionDTO cityRegionDto = regionsCacheHelper.getByRegionId(parentId); + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, parentId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, reportYear) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode())); + // 判断当前地区当前上报年份数据是否已经存在,如果已经存在,更新原数据 + checkUploadData(reportYear, regionId, cityData); + // 说明为重新提交 + if (Objects.nonNull(countryData)){ + // 先删除关联的已经保存的各装备名称的数据 + String auditDataIdList = countryData.getAuditDataIdList(); + if (StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(idList)){ + materialLogEquipStaAnnualReportService.remove(Wrappers.lambdaQuery(MaterialLogisticEquipmentStatisticAnnualReport.class) + .in(MaterialLogisticEquipmentStatisticAnnualReport::getId,idList)); + } + } + // 更新市级关联数据 + updateCityData(cityData,countryData); + // 删除被退回的数据 + dataRelevanceService.removeById(countryData); + } + assemblyRelevanceData(userDetail, reportYear, countryRelevanceData); + countryRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + countryRelevanceData.setPreparer(req.getPreparer()); + countryRelevanceData.setReviewer(req.getReviewer()); + countryRelevanceData.setSubmissionDate(req.getSubmissionDate()); + countryRelevanceData.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + countryRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + countryRelevanceData.setRegionId(userDetail.getRegionId()); + countryRelevanceData.setCompanyId(userDetail.getCompanyId()); + List auditDataIdList = Lists.newArrayList(); + // 保存本次上报数据信息 + for (ReqMaterialLogEquipStaDataUploadDTO uploadDto : dataList) { + MaterialLogisticEquipmentStatisticAnnualReport materialLogEquipStaAnnualReport = + new MaterialLogisticEquipmentStatisticAnnualReport(); + assemblyData(uploadDto, userDetail, materialLogEquipStaAnnualReport); + materialLogEquipStaAnnualReport.setAuditInfoId(cityAuditInfo.getId()); + materialLogEquipStaAnnualReport.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + materialLogEquipStaAnnualReportService.save(materialLogEquipStaAnnualReport); + auditDataIdList.add(materialLogEquipStaAnnualReport.getId()); + } + // 保存关联数据ID集合(一条关联数据对应多条不同设备名称的数据) + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + countryRelevanceData.setAuditDataIdList(idListStr); + dataRelevanceService.saveOrUpdate(countryRelevanceData); + + // 补充数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, countryRelevanceData.getId(), cityAuditInfo.getId(), auditRecord); + auditRecord.setReportYear(reportYear); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + + // 补充所在市的关联数据信息 + if (Objects.isNull(cityData)) { + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportYear, cityRelevanceData); + cityRelevanceData.setRegionId(parentId); + // 获取所在市散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(cityRegionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + cityRelevanceData.setCompanyId(companyDto.getId()); + } + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + // 有新上报的数据,就更新关联数据状态为未上报 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.NOT_REPORT.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + } + } + // 如果登录用户是市级散办,更新审核状态(未上报、被退回)为审核中,并提交省级审核信息和审核记录 + else if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + // 补充省散办关联数据信息 + Long cityRelevanceDataId = req.getId(); + VUtils.isTrue(Objects.isNull(cityRelevanceDataId)).throwMessage("请传入关联数据ID!"); + + // 提交省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(provinceAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + + // 更新市级关联数据审核状态为审核中 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(cityRelevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(userDetail.getUserId()); + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报年份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, reportYear) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode())); + // 如果上报年份省级关联数据不存在 + // 补充省散办关联数据信息 + if (Objects.isNull(provinceData)) { + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportYear, provinceRelevanceData); + provinceRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + provinceRelevanceData.setCompanyId(companyDto.getId()); + } + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, cityRelevanceData.getId(), provinceAuditInfo.getId(), provinceAuditRecord); + provinceAuditRecord.setReportYear(cityRelevanceData.getReportYear()); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + } + return "上报成功!"; + } + + private void assemblyRelevanceData(UserInfoDetails userDetail, Integer reportYear, BulkCementDirectReportSystemDataRelevance relevanceData) { + relevanceData.setReportYear(reportYear); + relevanceData.setCreateOn(LocalDateTime.now()); + relevanceData.setCreateBy(userDetail.getUserId()); + relevanceData.setUpdateOn(LocalDateTime.now()); + relevanceData.setUpdateBy(userDetail.getUserId()); + relevanceData.setLastUpdateTime(LocalDateTime.now()); + } + private void assemblyAuditRecord(UserInfoDetails userDetail, Long auditDataId, Long auditInfoId, BulkCementDirectReportSystemAuditRecord auditRecord) { + auditRecord.setAuditDataId(auditDataId); + auditRecord.setAuditInfoId(auditInfoId); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + auditRecord.setCompanyId(userDetail.getCompanyId()); + auditRecord.setRegionId(userDetail.getRegionId()); + auditRecord.setCreateOn(LocalDateTime.now()); + auditRecord.setCreateBy(userDetail.getUserId()); + auditRecord.setUpdateOn(LocalDateTime.now()); + auditRecord.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyAuditInfo(BulkCementDirectReportSystemAuditInfo auditInfo, DataUploadAuditStatusEnum underAudit, UserInfoDetails userDetail) { + auditInfo.setAuditStatus(underAudit.getCode()); + auditInfo.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + auditInfo.setCreateOn(LocalDateTime.now()); + auditInfo.setCreateBy(userDetail.getUserId()); + auditInfo.setUpdateOn(LocalDateTime.now()); + auditInfo.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyData(ReqMaterialLogEquipStaDataUploadDTO req, UserInfoDetails userDetail, MaterialLogisticEquipmentStatisticAnnualReport materialLogEquipStaAnnualReport) { + RegionDTO regionDto = regionsCacheHelper.getByRegionId(userDetail.getRegionId()); + String regionName = regionDto.getRegionName(); + // 单位名称改成了地区 + materialLogEquipStaAnnualReport.setRegionName(regionName); + materialLogEquipStaAnnualReport.setEquipmentName(req.getEquipmentName()); + materialLogEquipStaAnnualReport.setYearBeginNum(req.getYearBeginNum()); + materialLogEquipStaAnnualReport.setYearBeginNominalRate(req.getYearBeginNominalRate()); + materialLogEquipStaAnnualReport.setThisYearNewAddNum(req.getThisYearNewAddNum()); + materialLogEquipStaAnnualReport.setThisYearNewAddNominalRate(req.getThisYearNewAddNominalRate()); + materialLogEquipStaAnnualReport.setThisYearDecreaseNum(req.getThisYearDecreaseNum()); + materialLogEquipStaAnnualReport.setThisYearDecreaseNominalRate(req.getThisYearDecreaseNominalRate()); + materialLogEquipStaAnnualReport.setYearEndNum(req.getYearEndNum()); + materialLogEquipStaAnnualReport.setYearEndNominal(req.getYearEndNominal()); + + materialLogEquipStaAnnualReport.setReportYear(req.getReportYear()); + materialLogEquipStaAnnualReport.setRemark(req.getRemark()); + materialLogEquipStaAnnualReport.setCompanyId(userDetail.getCompanyId()); + materialLogEquipStaAnnualReport.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + materialLogEquipStaAnnualReport.setPreparer(req.getPreparer()); + materialLogEquipStaAnnualReport.setReviewer(req.getReviewer()); + materialLogEquipStaAnnualReport.setSubmissionDate(req.getSubmissionDate()); + materialLogEquipStaAnnualReport.setRegionId(userDetail.getRegionId()); + materialLogEquipStaAnnualReport.setCreateOn(LocalDateTime.now()); + materialLogEquipStaAnnualReport.setCreateBy(userDetail.getUserId()); + materialLogEquipStaAnnualReport.setUpdateOn(LocalDateTime.now()); + materialLogEquipStaAnnualReport.setUpdateBy(userDetail.getUserId()); + } + + private void checkUploadData(Integer reportYear, Long regionId, BulkCementDirectReportSystemDataRelevance cityData) { + // 查询区县关联数据 + BulkCementDirectReportSystemDataRelevance dataRelevance = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, reportYear) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode())); + if (Objects.nonNull(dataRelevance) && + DataUploadAuditStatusEnum.AUDIT_PASS.getCode().equals(dataRelevance.getAuditStatus())){ + // 先删除关联的已经保存的各装备名称的数据 + String auditDataIdList = dataRelevance.getAuditDataIdList(); + if (StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(idList)){ + materialLogEquipStaAnnualReportService.remove(Wrappers.lambdaQuery(MaterialLogisticEquipmentStatisticAnnualReport.class) + .in(MaterialLogisticEquipmentStatisticAnnualReport::getId,idList)); + } + } + updateCityData(cityData,dataRelevance); + dataRelevanceService.removeById(dataRelevance); + } + } + + private void updateCityData(BulkCementDirectReportSystemDataRelevance cityData, BulkCementDirectReportSystemDataRelevance dataRelevance) { + if (Objects.nonNull(cityData)) { + String auditDataIdList = cityData.getAuditDataIdList(); + if (StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + // 将已经存在的该地区该上报年份的数据数据从市级关联表中删除 + idList.remove(dataRelevance.getId()); + } + } + } + + public ResMaterialLogEquipStaDataUploadDetailVO getMaterialLogEquipStaUploadData(ReqMaterialLogEquipStaDataUploadDTO req) { + // 获取填报的数据 + Integer yearBeginNum = req.getYearBeginNum(); + BigDecimal yearBeginNominalRate = req.getYearBeginNominalRate(); + Integer thisYearNewAddNum = req.getThisYearNewAddNum(); + BigDecimal thisYearNewAddNominalRate = req.getThisYearNewAddNominalRate(); + Integer thisYearDecreaseNum = req.getThisYearDecreaseNum(); + BigDecimal thisYearDecreaseNominalRate = req.getThisYearDecreaseNominalRate(); + String remark = req.getRemark(); + Integer reportYear = req.getReportYear(); + String equipmentName = req.getEquipmentName(); + VUtils.isTrue(StringUtils.isBlank(equipmentName)).throwMessage("请传入设备名称!"); + + ResMaterialLogEquipStaDataUploadDetailVO vo = new ResMaterialLogEquipStaDataUploadDetailVO(); + vo.setYearBeginNum(yearBeginNum); + vo.setYearBeginNominalRate(yearBeginNominalRate); + vo.setThisYearNewAddNum(thisYearNewAddNum); + vo.setThisYearNewAddNominalRate(thisYearNewAddNominalRate); + vo.setThisYearDecreaseNum(thisYearDecreaseNum); + vo.setThisYearDecreaseNominalRate(thisYearDecreaseNominalRate); + vo.setReportYear(reportYear); + vo.setRemark(remark); + + // 计算各数据 + // 年末数量: 年初数量 + 本年新增数量 - 本年减少数量 + if (Objects.nonNull(yearBeginNum) && Objects.nonNull(thisYearNewAddNum) && Objects.nonNull(thisYearDecreaseNum)){ + int yearEndNum = yearBeginNum + thisYearNewAddNum - thisYearDecreaseNum; + vo.setYearEndNum(yearEndNum); + } + // 年末额定量: 年初额定量 + 本年新增额定量 - 本年减少额定量 + if (Objects.nonNull(yearBeginNominalRate) && Objects.nonNull(thisYearNewAddNominalRate) && Objects.nonNull(thisYearDecreaseNominalRate)){ + BigDecimal yearEndCapacity = yearBeginNominalRate.add(thisYearNewAddNominalRate).subtract(thisYearDecreaseNominalRate); + vo.setYearEndNominal(yearEndCapacity); + } + return vo; + } + + public ResMaterialLogEquipStaRelatedDataVO getMaterialLogEquipStaRelatedData(ReqMaterialLogEquipStaDataUploadDTO dto) { + Integer reportYear = dto.getReportYear(); + VUtils.isTrue(Objects.isNull(reportYear)).throwMessage("请传入上报年份!"); + Long regionId = dto.getRegionId(); + VUtils.isTrue(Objects.isNull(regionId)).throwMessage("请传入区域ID!"); + String equipmentName = dto.getEquipmentName(); + VUtils.isTrue(StringUtils.isBlank(equipmentName)).throwMessage("请传入装备名称!"); + Integer preReportYear = reportYear - 1; + MaterialLogisticEquipmentStatisticAnnualReport materialLogEquipStaAnnualReport = materialLogEquipStaAnnualReportService.getOne(Wrappers.lambdaQuery(MaterialLogisticEquipmentStatisticAnnualReport.class) + .eq(MaterialLogisticEquipmentStatisticAnnualReport::getReportYear, preReportYear) + .eq(MaterialLogisticEquipmentStatisticAnnualReport::getEquipmentName,equipmentName) + .eq(MaterialLogisticEquipmentStatisticAnnualReport::getRegionId, regionId)); + ResMaterialLogEquipStaRelatedDataVO vo = new ResMaterialLogEquipStaRelatedDataVO(); + if (Objects.nonNull(materialLogEquipStaAnnualReport)) { + // 去年的年末数量 + vo.setYearBeginNum(materialLogEquipStaAnnualReport.getYearEndNum()); + // 去年的年末额定量 + vo.setYearBeginNominalRate(materialLogEquipStaAnnualReport.getYearEndNominal()); + } + return vo; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/MortarSupplyBulletinManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/MortarSupplyBulletinManage.java new file mode 100644 index 0000000..a4d1916 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/MortarSupplyBulletinManage.java @@ -0,0 +1,473 @@ +package com.ningdatech.carapi.report.manage; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +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.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.car.vehicle.contants.VehicleContant; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.report.constant.DataUploadAuditStatusEnum; +import com.ningdatech.carapi.report.constant.DataUploadAuditTypeEnum; +import com.ningdatech.carapi.report.constant.UploadDataTypeEnum; +import com.ningdatech.carapi.report.model.entity.*; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.po.ReqMortarSupplyDataUploadPO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.carapi.report.model.vo.ResMortarSupplyDataUploadDetailVO; +import com.ningdatech.carapi.report.model.vo.ResMortarSupplyRelatedDataVO; +import com.ningdatech.carapi.report.service.*; +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.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/09/28 11:15 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class MortarSupplyBulletinManage { + + private final IBulkCementDirectReportSystemAuditRecordService auditRecordService; + private final IBulkCementDirectReportSystemAuditInfoService auditInfoService; + private final RegionsCacheHelper regionsCacheHelper; + private final IBulkCementDirectReportSystemDataRelevanceService dataRelevanceService; + private final IMortarSupplyBulletinService mortarSupplyBulletinService; + private final IBulkCementDirectReportSystemUniversalIndexService universalIndexService; + private final CompaniesCacheHelper companiesCacheHelper; + + public PageVo dataUploadList(ReqDataUploadListPO req) { + + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId = userDetail.getRegionId(); + Page page = req.page(); + // 根据所属区域查出对应的散装水泥供应量数据上报记录 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(MortarSupplyBulletin.class); + // 获取入参 + LocalDateTime reportStartMonth = req.getReportStartMonth(); + LocalDateTime reportEndMonth = req.getReportEndMonth(); + Integer auditStatus = req.getAuditStatus(); + wrapper.ge(Objects.nonNull(reportStartMonth), MortarSupplyBulletin::getReportMonth, reportStartMonth) + .le(Objects.nonNull(reportEndMonth), MortarSupplyBulletin::getReportMonth, reportEndMonth) + .eq(Objects.nonNull(auditStatus),MortarSupplyBulletin::getAuditStatus,auditStatus) + .eq(MortarSupplyBulletin::getRegionId,regionId) + .orderByDesc(MortarSupplyBulletin::getReportMonth); + //.isNotNull(MortarSupplyBulletin::getAuditInfoId); + mortarSupplyBulletinService.page(page,wrapper); + List records = page.getRecords(); + if (CollUtil.isEmpty(records)){ + return PageVo.empty(); + } + // 获取审核信息 + List auditInfoIdList = records.stream().map(MortarSupplyBulletin::getAuditInfoId).collect(Collectors.toList()); + Map auditInfoMap = auditInfoService.list(Wrappers.lambdaQuery(BulkCementDirectReportSystemAuditInfo.class).in(BulkCementDirectReportSystemAuditInfo::getId, auditInfoIdList)) + .stream().collect(Collectors.toMap(BulkCementDirectReportSystemAuditInfo::getId, v -> v)); + List resVos = records.stream().map(r -> { + ResDataUploadListVO vo = new ResDataUploadListVO(); + LocalDateTime month = r.getReportMonth(); + String reportMonthStr = NdDateUtils.format(month, NdDateUtils.DEFAULT_MONTH_FORMAT); + LocalDateTime reportMonth = LocalDateTimeUtil.parse(reportMonthStr, DateTimeFormatter.ofPattern(DatePattern.NORM_MONTH_PATTERN)); + vo.setRegionId(r.getRegionId()); + vo.setReportMonth(reportMonth); + vo.setAuditDataId(r.getId()); + BulkCementDirectReportSystemAuditInfo auditInfo = auditInfoMap.get(r.getAuditInfoId()); + if (Objects.nonNull(auditInfo)) { + vo.setAuditOpinion(auditInfo.getAuditOpinion()); + } + vo.setAuditStatus(r.getAuditStatus()); + String desc = DataUploadAuditStatusEnum.getDescByCode(r.getAuditStatus()); + vo.setAuditStatusName(desc); + vo.setCreateOn(r.getCreateOn()); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(resVos, page.getTotal()); + } + + @Transactional(rollbackFor = Exception.class) + public String mortarSupplyDataUpload(ReqMortarSupplyDataUploadPO req) { + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + LocalDateTime reportMonth = req.getReportMonth(); + Long regionId = userDetail.getRegionId(); + + // 如果登录用户为区县散办 + if (UserRoleTypeEnum.REGION_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请选择上报月份!"); + + // 提交市级审核申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(cityAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 保存上报数据信息 + MortarSupplyBulletin mortarSupplyBulletin = new MortarSupplyBulletin(); + // 区县的区域ID + Long countryRegionId = userDetail.getRegionId(); + // 获取所在市的区域ID + RegionDTO regionDto = regionsCacheHelper.getByRegionId(countryRegionId); + Long parentId = regionDto.getParentId(); + // 判断上报月份所在市的关联数据不存在 + RegionDTO cityRegionDto = regionsCacheHelper.getByRegionId(parentId); + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, parentId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode())); + // 判断当前地区当前上报月份数据是否已经存在,如果已经存在,删除原数据并更新市、省关联数据列表 + checkUploadData(reportMonth, regionId, cityData); + Long dataId = req.getId(); + // 上报数据不为空,说明为重新提交 + if (Objects.nonNull(dataId)) { + MortarSupplyBulletin oldData = mortarSupplyBulletinService.getById(dataId); + VUtils.isTrue(Objects.isNull(oldData)).throwMessage("重新提交数据不存在!"); + // 更新市级关联数据 + updateCityData(cityData,oldData); + // 删除被退回的数据 + mortarSupplyBulletinService.removeById(oldData); + } + + assemblyData(req, userDetail, mortarSupplyBulletin); + mortarSupplyBulletin.setAuditInfoId(cityAuditInfo.getId()); + mortarSupplyBulletin.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + mortarSupplyBulletinService.saveOrUpdate(mortarSupplyBulletin); + + // 补充数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, mortarSupplyBulletin.getId(), cityAuditInfo.getId(), auditRecord); + auditRecord.setReportMonth(reportMonth); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + // 补充所在市的关联数据信息 + if (Objects.isNull(cityData)) { + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportMonth, cityRelevanceData); + cityRelevanceData.setRegionId(parentId); + // 获取所在市散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(cityRegionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + cityRelevanceData.setCompanyId(companyDto.getId()); + } + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode()); + // 有新上报的数据,就更新关联数据状态为未上报 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.NOT_REPORT.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + } + } + // 如果登录用户是市级散办,更新审核状态(未上报、被退回)为审核中,并提交省级审核信息和审核记录 + else if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + Long relevanceDataId = req.getId(); + VUtils.isTrue(Objects.isNull(relevanceDataId)).throwMessage("请传入关联数据ID!"); + + // 提交省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(provinceAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + // 更新市级关联数据审核状态为审核中 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(relevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(userDetail.getUserId()); + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, reportMonth) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode())); + + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + if (Objects.isNull(provinceData)) { + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, reportMonth, provinceRelevanceData); + provinceRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + provinceRelevanceData.setCompanyId(companyDto.getId()); + } + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, cityRelevanceData.getId(), provinceAuditInfo.getId(), provinceAuditRecord); + provinceAuditRecord.setReportMonth(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + } + + return "上报成功!"; + } + + private void assemblyRelevanceData(UserInfoDetails userDetail, LocalDateTime reportMonth, BulkCementDirectReportSystemDataRelevance relevanceData) { + relevanceData.setReportMonth(reportMonth); + relevanceData.setCreateOn(LocalDateTime.now()); + relevanceData.setCreateBy(userDetail.getUserId()); + relevanceData.setUpdateOn(LocalDateTime.now()); + relevanceData.setUpdateBy(userDetail.getUserId()); + relevanceData.setLastUpdateTime(LocalDateTime.now()); + } + private void assemblyAuditRecord(UserInfoDetails userDetail, Long auditDataId, Long auditInfoId, BulkCementDirectReportSystemAuditRecord auditRecord) { + auditRecord.setAuditDataId(auditDataId); + auditRecord.setAuditInfoId(auditInfoId); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode()); + auditRecord.setCompanyId(userDetail.getCompanyId()); + auditRecord.setRegionId(userDetail.getRegionId()); + auditRecord.setCreateOn(LocalDateTime.now()); + auditRecord.setCreateBy(userDetail.getUserId()); + auditRecord.setUpdateOn(LocalDateTime.now()); + auditRecord.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyAuditInfo(BulkCementDirectReportSystemAuditInfo auditInfo, DataUploadAuditStatusEnum underAudit, UserInfoDetails userDetail) { + auditInfo.setAuditStatus(underAudit.getCode()); + auditInfo.setAuditDataType(UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode()); + auditInfo.setCreateOn(LocalDateTime.now()); + auditInfo.setCreateBy(userDetail.getUserId()); + auditInfo.setUpdateOn(LocalDateTime.now()); + auditInfo.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyData(ReqMortarSupplyDataUploadPO req, UserInfoDetails userDetail, MortarSupplyBulletin mortarSupplyBulletin) { + RegionDTO regionDto = regionsCacheHelper.getByRegionId(userDetail.getRegionId()); + String regionName = regionDto.getRegionName(); + // 单位名称改成了地区 + mortarSupplyBulletin.setRegionName(regionName); + mortarSupplyBulletin.setTwoCategoryGuidGoal(req.getTwoCategoryGuidGoal()); + mortarSupplyBulletin.setDryMixedMortarProductionCompanyNum(req.getDryMixedMortarProductionCompanyNum()); + mortarSupplyBulletin.setDryMixedMortarProductiveCapacity(req.getDryMixedMortarProductiveCapacity()); + mortarSupplyBulletin.setDryMixedMortarBulkCapacity(req.getDryMixedMortarBulkCapacity()); + + mortarSupplyBulletin.setThisMonthTotalOutput(req.getThisMonthTotalOutput()); + mortarSupplyBulletin.setThisMonthAccumulativeOutput(req.getThisMonthAccumulativeOutput()); + mortarSupplyBulletin.setDryMixedMortarThisMonthOutput(req.getDryMixedMortarThisMonthOutput()); + mortarSupplyBulletin.setDryMixedMortarThisMonthAccumulativeOutput(req.getDryMixedMortarThisMonthAccumulativeOutput()); + mortarSupplyBulletin.setDryMixedMortarIncrement(req.getDryMixedMortarIncrement()); + mortarSupplyBulletin.setDryMixedMortarGrowthRate(req.getDryMixedMortarGrowthRate()); + mortarSupplyBulletin.setDryMixedMortarThisMonthBulkQuantity(req.getDryMixedMortarThisMonthBulkQuantity()); + mortarSupplyBulletin.setDryMixedMortarAccumulativeBulkQuantity(req.getDryMixedMortarAccumulativeBulkQuantity()); + mortarSupplyBulletin.setWetMortarThisMonthOutput(req.getWetMortarThisMonthOutput()); + mortarSupplyBulletin.setWetMortarAccumulativeOutput(req.getWetMortarAccumulativeOutput()); + mortarSupplyBulletin.setBulkCementThisMonthUsage(req.getBulkCementThisMonthUsage()); + mortarSupplyBulletin.setBulkCementAccumulativeUsage(req.getBulkCementAccumulativeUsage()); + mortarSupplyBulletin.setWasteThisMonthComprehensiveUtilization(req.getWasteThisMonthComprehensiveUtilization()); + mortarSupplyBulletin.setWasteAccumulativeComprehensiveUtilization(req.getWasteAccumulativeComprehensiveUtilization()); + mortarSupplyBulletin.setReportMonth(req.getReportMonth()); + mortarSupplyBulletin.setCompanyId(userDetail.getCompanyId()); + mortarSupplyBulletin.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + mortarSupplyBulletin.setPreparer(req.getPreparer()); + mortarSupplyBulletin.setReviewer(req.getReviewer()); + mortarSupplyBulletin.setSubmissionDate(req.getSubmissionDate()); + mortarSupplyBulletin.setRegionId(userDetail.getRegionId()); + mortarSupplyBulletin.setCreateOn(LocalDateTime.now()); + mortarSupplyBulletin.setCreateBy(userDetail.getUserId()); + mortarSupplyBulletin.setUpdateOn(LocalDateTime.now()); + mortarSupplyBulletin.setUpdateBy(userDetail.getUserId()); + } + + private void checkUploadData(LocalDateTime reportMonth, Long regionId, BulkCementDirectReportSystemDataRelevance cityData) { + MortarSupplyBulletin mortarSupplyBulletin = mortarSupplyBulletinService.getOne(Wrappers.lambdaQuery(MortarSupplyBulletin.class) + .eq(MortarSupplyBulletin::getRegionId, regionId) + .eq(MortarSupplyBulletin::getReportMonth, reportMonth)); + // 判断审核状态,如果审核通过,更新审核通过的数据 + if (Objects.nonNull(mortarSupplyBulletin) && + DataUploadAuditStatusEnum.AUDIT_PASS.getCode().equals(mortarSupplyBulletin.getAuditStatus())){ + updateCityData(cityData,mortarSupplyBulletin); + mortarSupplyBulletinService.removeById(mortarSupplyBulletin); + } + } + + private void updateCityData(BulkCementDirectReportSystemDataRelevance cityData, MortarSupplyBulletin mortarSupplyBulletin) { + if (Objects.nonNull(cityData)) { + String auditDataIdList = cityData.getAuditDataIdList(); + if (StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + // 将已经存在的该地区该上报月份的数据数据从关联表中删除 + idList.remove(mortarSupplyBulletin.getId()); + } + } + } + + public ResMortarSupplyDataUploadDetailVO getMortarSupplyUploadData(ReqMortarSupplyDataUploadPO req) { + + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + // 上月填报的数据 + BigDecimal twoCategoryGuidGoal = req.getTwoCategoryGuidGoal(); + Integer dryMixedMortarProductionCompanyNum = req.getDryMixedMortarProductionCompanyNum(); + BigDecimal dryMixedMortarProductiveCapacity = req.getDryMixedMortarProductiveCapacity(); + BigDecimal dryMixedMortarBulkCapacity = req.getDryMixedMortarBulkCapacity(); + + // 普通干混砂浆本月产量 + BigDecimal dryMixedMortarThisMonthOutput = req.getDryMixedMortarThisMonthOutput(); + // 普通干混砂浆本月散装量 + BigDecimal dryMixedMortarThisMonthBulkQuantity = req.getDryMixedMortarThisMonthBulkQuantity(); + // 湿拌砂浆本月产量 + BigDecimal wetMortarThisMonthOutput = req.getWetMortarThisMonthOutput(); + // 散装水泥本月使用量 + BigDecimal bulkCementThisMonthUsage = req.getBulkCementThisMonthUsage(); + // 废弃物本月综合利用量 + BigDecimal wasteThisMonthComprehensiveUtilization = req.getWasteThisMonthComprehensiveUtilization(); + + LocalDateTime reportMonth = req.getReportMonth(); + Long regionId = userDetail.getRegionId(); + + // 计算实际产量、使用散装水泥量、废弃物综合利用量 + // 获取上个月该地区的砂浆供应量数据 + LocalDateTime preReportMonth = reportMonth.minusMonths(1L); + MortarSupplyBulletin preMortarSupplyBulletin = mortarSupplyBulletinService.getOne(Wrappers.lambdaQuery(MortarSupplyBulletin.class) + .eq(MortarSupplyBulletin::getRegionId, regionId) + .eq(MortarSupplyBulletin::getReportMonth, preReportMonth)); + VUtils.isTrue(Objects.isNull(preMortarSupplyBulletin)).throwMessage("系统上个月数据不存在!"); + // 获取去年当前上报月份该地区的散装水泥供应量数据 + LocalDateTime preYearReportMonth = preReportMonth.minusYears(1L).plusMonths(1L); + MortarSupplyBulletin preYearMortarSupplyBulletin = mortarSupplyBulletinService.getOne(Wrappers.lambdaQuery(MortarSupplyBulletin.class) + .eq(MortarSupplyBulletin::getRegionId, regionId) + .eq(MortarSupplyBulletin::getReportMonth, preYearReportMonth)); + VUtils.isTrue(Objects.isNull(preYearMortarSupplyBulletin)).throwMessage("系统去年该月数据不存在!"); + + ResMortarSupplyDataUploadDetailVO vo = new ResMortarSupplyDataUploadDetailVO(); + vo.setTwoCategoryGuidGoal(twoCategoryGuidGoal); + vo.setDryMixedMortarProductionCompanyNum(dryMixedMortarProductionCompanyNum); + vo.setDryMixedMortarProductiveCapacity(dryMixedMortarProductiveCapacity); + vo.setDryMixedMortarBulkCapacity(dryMixedMortarBulkCapacity); + + if (Objects.nonNull(dryMixedMortarThisMonthOutput) && Objects.nonNull(wetMortarThisMonthOutput)){ + // 本月总产量:本月普通干混砂浆产量 + 本月湿拌砂浆产量 + BigDecimal thisMonthTotalOutput = dryMixedMortarThisMonthOutput.add(wetMortarThisMonthOutput); + vo.setThisMonthTotalOutput(thisMonthTotalOutput); + // 本月累计总产量:本月总产量 + 上个月的累计总产量 + BigDecimal preThisMonthAccumulativeOutput = preMortarSupplyBulletin.getThisMonthAccumulativeOutput(); + BigDecimal thisMonthAccumulativeOutput = thisMonthTotalOutput.add(preThisMonthAccumulativeOutput); + vo.setThisMonthAccumulativeOutput(thisMonthAccumulativeOutput); + } + + if (Objects.nonNull(dryMixedMortarThisMonthOutput)) { + // 普通干混砂浆累计产量:普通干混砂浆本月产量 + 上个月普通干混砂浆累计产量 + BigDecimal preMonthDryMixedMortarThisMonthAccumulativeOutput = preMortarSupplyBulletin.getDryMixedMortarThisMonthAccumulativeOutput(); + BigDecimal preMonthDryMixedMortarThisMonthAccOutput = Objects.isNull(preMonthDryMixedMortarThisMonthAccumulativeOutput) ? BigDecimal.ZERO : preMonthDryMixedMortarThisMonthAccumulativeOutput; + BigDecimal dryMixedMortarThisMonthAccumulativeOutput = dryMixedMortarThisMonthOutput.add(preMonthDryMixedMortarThisMonthAccOutput); + vo.setDryMixedMortarThisMonthAccumulativeOutput(dryMixedMortarThisMonthAccumulativeOutput); + + // 普通干混砂浆同比增加量: 普通干混砂浆累计产量 - 去年普通干混砂浆累计产量 + BigDecimal preYearDryMixedMortarThisMonthAccumulativeOutput = preYearMortarSupplyBulletin.getDryMixedMortarThisMonthAccumulativeOutput(); + BigDecimal preYearDryMixedMortarThisMonthAccOutput = Objects.isNull(preYearDryMixedMortarThisMonthAccumulativeOutput) ? BigDecimal.ZERO : preYearDryMixedMortarThisMonthAccumulativeOutput; + BigDecimal dryMixedMortarIncrement = dryMixedMortarThisMonthAccumulativeOutput.subtract(preYearDryMixedMortarThisMonthAccOutput); + vo.setDryMixedMortarIncrement(dryMixedMortarIncrement); + // 普通干混砂浆增长率:普通干混砂浆同比增加量 / 去年普通干混砂浆累计产量 + BigDecimal dryMixedMortarGrowthRate = dryMixedMortarIncrement.divide(preYearDryMixedMortarThisMonthAccumulativeOutput, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100L)); + vo.setDryMixedMortarGrowthRate(dryMixedMortarGrowthRate); + } + + if (Objects.nonNull(dryMixedMortarThisMonthBulkQuantity)) { + // 普通干混砂浆累计散装量:普通干混砂浆本月散装量 + 上个月普通干混砂浆累计散装量 + BigDecimal preDryMixedMortarAccumulativeBulkQuantity = preMortarSupplyBulletin.getDryMixedMortarAccumulativeBulkQuantity(); + BigDecimal dryMixedMortarAccumulativeBulkQuantity = dryMixedMortarThisMonthBulkQuantity.add(preDryMixedMortarAccumulativeBulkQuantity); + vo.setDryMixedMortarAccumulativeBulkQuantity(dryMixedMortarAccumulativeBulkQuantity); + } + + if (Objects.nonNull(wetMortarThisMonthOutput)) { + // 湿拌砂浆累计产量:湿拌砂浆本月产量 + 上个月湿拌砂浆累计产量 + BigDecimal preMonthWetMortarAccumulativeOutput = preMortarSupplyBulletin.getWetMortarAccumulativeOutput(); + BigDecimal preMonthWetMortarAccOutput = Objects.isNull(preMonthWetMortarAccumulativeOutput) ? BigDecimal.ZERO : preMonthWetMortarAccumulativeOutput; + BigDecimal wetMortarAccumulativeOutput = wetMortarThisMonthOutput.add(preMonthWetMortarAccOutput); + vo.setWetMortarAccumulativeOutput(wetMortarAccumulativeOutput); + } + + if (Objects.nonNull(bulkCementThisMonthUsage)) { + // 累计使用散装水泥量:本月使用散装水泥量 + 上个月累计使用散装水泥量 + BigDecimal preMonthBulkCementAccumulativeUsage = preMortarSupplyBulletin.getBulkCementAccumulativeUsage(); + BigDecimal preMonthBulkCementAccUsage = Objects.isNull(preMonthBulkCementAccumulativeUsage) ? BigDecimal.ZERO : preMonthBulkCementAccumulativeUsage; + BigDecimal bulkCementAccumulativeUsage = bulkCementThisMonthUsage.add(preMonthBulkCementAccUsage); + vo.setBulkCementAccumulativeUsage(bulkCementAccumulativeUsage); + } + + if (Objects.nonNull(wasteThisMonthComprehensiveUtilization)) { + // 累计废弃物综合利用量:本月废弃物综合利用量 + 上个月累计废弃物综合利用量 + BigDecimal preMonthWasteAccumulativeComprehensiveUtilization = preMortarSupplyBulletin.getWasteAccumulativeComprehensiveUtilization(); + BigDecimal preMonthWasteAccComprehensiveUtilization = Objects.isNull(preMonthWasteAccumulativeComprehensiveUtilization) ? BigDecimal.ZERO : preMonthWasteAccumulativeComprehensiveUtilization; + BigDecimal wasteAccumulativeComprehensiveUtilization = wasteThisMonthComprehensiveUtilization.add(preMonthWasteAccComprehensiveUtilization); + vo.setWasteAccumulativeComprehensiveUtilization(wasteAccumulativeComprehensiveUtilization); + } + return vo; + } + + public ResMortarSupplyRelatedDataVO getMortarSupplyRelatedData(ReqMortarSupplyDataUploadPO po) { + LocalDateTime reportMonth = po.getReportMonth(); + VUtils.isTrue(Objects.isNull(reportMonth)).throwMessage("请传入上报月份!"); + Long regionId = po.getRegionId(); + VUtils.isTrue(Objects.isNull(regionId)).throwMessage("请传入区域ID!"); + LocalDateTime preReportMonth = reportMonth.minusMonths(1); + MortarSupplyBulletin preMonthMortarSupplyBulletin = mortarSupplyBulletinService.getOne(Wrappers.lambdaQuery(MortarSupplyBulletin.class) + .eq(MortarSupplyBulletin::getReportMonth, preReportMonth) + .eq(MortarSupplyBulletin::getRegionId, regionId)); + int year = reportMonth.getYear(); + BulkCementDirectReportSystemUniversalIndex universalIndex = universalIndexService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemUniversalIndex.class) + .eq(BulkCementDirectReportSystemUniversalIndex::getRegionId, regionId) + .eq(BulkCementDirectReportSystemUniversalIndex::getYear, year)); + ResMortarSupplyRelatedDataVO vo = new ResMortarSupplyRelatedDataVO(); + if (Objects.nonNull(universalIndex)) { + vo.setTwoCategoryGuidGoal(universalIndex.getMortarSupplyTwoCategoryGuidGoal()); + }else { + vo.setTwoCategoryGuidGoal(BigDecimal.ZERO); + } + if (Objects.nonNull(preMonthMortarSupplyBulletin)){ + vo.setDryMixedMortarProductionCompanyNum(preMonthMortarSupplyBulletin.getDryMixedMortarProductionCompanyNum()); + vo.setDryMixedMortarProductiveCapacity(preMonthMortarSupplyBulletin.getDryMixedMortarProductiveCapacity()); + vo.setDryMixedMortarBulkCapacity(preMonthMortarSupplyBulletin.getDryMixedMortarBulkCapacity()); + } + return vo; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/NonProhibitedAreasBulkCementSalesUseManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/NonProhibitedAreasBulkCementSalesUseManage.java new file mode 100644 index 0000000..32729fc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/manage/NonProhibitedAreasBulkCementSalesUseManage.java @@ -0,0 +1,381 @@ +package com.ningdatech.carapi.report.manage; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +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.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.car.vehicle.contants.VehicleContant; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.report.constant.DataUploadAuditStatusEnum; +import com.ningdatech.carapi.report.constant.DataUploadAuditTypeEnum; +import com.ningdatech.carapi.report.constant.UploadDataTypeEnum; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditInfo; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditRecord; +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemDataRelevance; +import com.ningdatech.carapi.report.model.entity.NonProhibitedAreasBulkCementSalesUse; +import com.ningdatech.carapi.report.model.po.ReqDataUploadListPO; +import com.ningdatech.carapi.report.model.po.ReqNonProhibitedAreasDataUploadPO; +import com.ningdatech.carapi.report.model.vo.ResDataUploadListVO; +import com.ningdatech.carapi.report.model.vo.ResNonProhibitedAreasDataUploadDetailVO; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemAuditInfoService; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemAuditRecordService; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemDataRelevanceService; +import com.ningdatech.carapi.report.service.INonProhibitedAreasBulkCementSalesUseService; +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.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/09/28 11:15 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class NonProhibitedAreasBulkCementSalesUseManage { + + private final IBulkCementDirectReportSystemAuditRecordService auditRecordService; + private final IBulkCementDirectReportSystemAuditInfoService auditInfoService; + private final RegionsCacheHelper regionsCacheHelper; + private final IBulkCementDirectReportSystemDataRelevanceService dataRelevanceService; + private final INonProhibitedAreasBulkCementSalesUseService nonProhibitedAreasBulkCementSalesUseService; + private final CompaniesCacheHelper companiesCacheHelper; + + public PageVo dataUploadList(ReqDataUploadListPO req) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId = userDetail.getRegionId(); + Page page = req.page(); + // 根据所属区域查出对应的散装水泥供应量数据上报记录 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NonProhibitedAreasBulkCementSalesUse.class); + // 获取入参 + Integer reportStartYear = req.getReportStartYear(); + Integer reportEndYear = req.getReportEndYear(); + Integer auditStatus = req.getAuditStatus(); + wrapper.ge(Objects.nonNull(reportStartYear), NonProhibitedAreasBulkCementSalesUse::getReportYear, reportStartYear) + .le(Objects.nonNull(reportEndYear), NonProhibitedAreasBulkCementSalesUse::getReportYear, reportEndYear) + .eq(Objects.nonNull(auditStatus),NonProhibitedAreasBulkCementSalesUse::getAuditStatus,auditStatus) + .eq(NonProhibitedAreasBulkCementSalesUse::getRegionId,regionId) + .orderByDesc(NonProhibitedAreasBulkCementSalesUse::getReportYear); + //.isNotNull(NonProhibitedAreasBulkCementSalesUse::getAuditInfoId); + nonProhibitedAreasBulkCementSalesUseService.page(page,wrapper); + List records = page.getRecords(); + if (CollUtil.isEmpty(records)){ + return PageVo.empty(); + } + // 获取审核信息 + List auditInfoIdList = records.stream().map(NonProhibitedAreasBulkCementSalesUse::getAuditInfoId).collect(Collectors.toList()); + Map auditInfoMap = auditInfoService.list(Wrappers.lambdaQuery(BulkCementDirectReportSystemAuditInfo.class).in(BulkCementDirectReportSystemAuditInfo::getId, auditInfoIdList)) + .stream().collect(Collectors.toMap(BulkCementDirectReportSystemAuditInfo::getId, v -> v)); + List resVos = records.stream().map(r -> { + ResDataUploadListVO vo = new ResDataUploadListVO(); + Integer reportYear = r.getReportYear(); + vo.setRegionId(r.getRegionId()); + vo.setReportYear(reportYear); + vo.setAuditDataId(r.getId()); + BulkCementDirectReportSystemAuditInfo auditInfo = auditInfoMap.get(r.getAuditInfoId()); + if (Objects.nonNull(auditInfo)) { + vo.setAuditOpinion(auditInfo.getAuditOpinion()); + } + vo.setAuditStatus(r.getAuditStatus()); + String desc = DataUploadAuditStatusEnum.getDescByCode(r.getAuditStatus()); + vo.setAuditStatusName(desc); + vo.setCreateOn(r.getCreateOn()); + return vo; + }).collect(Collectors.toList()); + return PageVo.of(resVos, page.getTotal()); + } + + @Transactional(rollbackFor = Exception.class) + public String nonProhibitedAreasDataUpload(ReqNonProhibitedAreasDataUploadPO req) { + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Integer reportYear = req.getReportYear(); + Long regionId = userDetail.getRegionId(); + + // 如果登录用户为区县散办 + if (UserRoleTypeEnum.REGION_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + VUtils.isTrue(Objects.isNull(reportYear)).throwMessage("请选择上报年份!"); + + // 提交市级审核申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(cityAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 保存上报数据信息 + NonProhibitedAreasBulkCementSalesUse nonProAreasBulkCementSalesUse = new NonProhibitedAreasBulkCementSalesUse(); + // 区县的区域ID + Long countryRegionId = userDetail.getRegionId(); + // 获取所在市的区域ID + RegionDTO regionDto = regionsCacheHelper.getByRegionId(countryRegionId); + Long parentId = regionDto.getParentId(); + // 判断上报月份所在市的关联数据不存在 + RegionDTO cityRegionDto = regionsCacheHelper.getByRegionId(parentId); + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, parentId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, reportYear) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.NON_PROHIBITED_AREAS_BULK_CEMENT_SALES_USE.getCode())); + // 判断当前地区当前上报月份数据是否已经存在,如果已经存在,删除原数据并更新市、省关联数据列表 + checkUploadData(reportYear, regionId, cityData); + Long dataId = req.getId(); + // 上报数据不为空,说明为重新提交 + if (Objects.nonNull(dataId)) { + NonProhibitedAreasBulkCementSalesUse oldData = nonProhibitedAreasBulkCementSalesUseService.getById(dataId); + VUtils.isTrue(Objects.isNull(oldData)).throwMessage("重新提交数据不存在!"); + // 更新市级关联数据 + updateCityData(cityData,oldData); + // 删除被退回的数据 + nonProhibitedAreasBulkCementSalesUseService.removeById(oldData); + } + + assemblyData(req, userDetail, nonProAreasBulkCementSalesUse); + nonProAreasBulkCementSalesUse.setAuditInfoId(cityAuditInfo.getId()); + nonProAreasBulkCementSalesUse.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + nonProhibitedAreasBulkCementSalesUseService.saveOrUpdate(nonProAreasBulkCementSalesUse); + + // 补充数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, nonProAreasBulkCementSalesUse.getId(), cityAuditInfo.getId(), auditRecord); + auditRecord.setReportYear(reportYear); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + // 补充所在市的关联数据信息 + if (Objects.isNull(cityData)) { + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, nonProAreasBulkCementSalesUse.getId(), reportYear, cityRelevanceData); + cityRelevanceData.setRegionId(parentId); + // 获取所在市散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(cityRegionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + cityRelevanceData.setCompanyId(companyDto.getId()); + } + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.NON_PROHIBITED_AREAS_BULK_CEMENT_SALES_USE.getCode()); + // 有新上报的数据,就更新关联数据状态为未上报 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.NOT_REPORT.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + } + + } + // 如果登录用户是市级散办,更新审核状态(未上报、被退回)为审核中,并提交省级审核信息和审核记录 + else if (UserRoleTypeEnum.BULK_CEMENT_ADMIN_ROLE_ID.getId().equals(userDetail.getRoleId())) { + + Long relevanceDataId = req.getId(); + VUtils.isTrue(Objects.isNull(relevanceDataId)).throwMessage("请传入关联数据ID!"); + + // 提交省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + assemblyAuditInfo(provinceAuditInfo, DataUploadAuditStatusEnum.UNDER_AUDIT, userDetail); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + // 更新市级关联数据审核状态为审核中 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(relevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(userDetail.getUserId()); + cityRelevanceData.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + cityRelevanceData.setPreparer(req.getPreparer()); + cityRelevanceData.setReviewer(req.getReviewer()); + cityRelevanceData.setSubmissionDate(req.getSubmissionDate()); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, reportYear) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.NON_PROHIBITED_AREAS_BULK_CEMENT_SALES_USE.getCode())); + + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + if (Objects.isNull(provinceData)) { + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + assemblyRelevanceData(userDetail, relevanceDataId, reportYear, provinceRelevanceData); + provinceRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + provinceRelevanceData.setCompanyId(companyDto.getId()); + } + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.NON_PROHIBITED_AREAS_BULK_CEMENT_SALES_USE.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + assemblyAuditRecord(userDetail, cityRelevanceData.getId(), provinceAuditInfo.getId(), provinceAuditRecord); + provinceAuditRecord.setReportYear(cityRelevanceData.getReportYear()); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + } + + return "上报成功!"; + } + + private void assemblyRelevanceData(UserInfoDetails userDetail, Long auditDataId, Integer reportYear, BulkCementDirectReportSystemDataRelevance relevanceData) { + relevanceData.setReportYear(reportYear); + relevanceData.setCreateOn(LocalDateTime.now()); + relevanceData.setCreateBy(userDetail.getUserId()); + relevanceData.setUpdateOn(LocalDateTime.now()); + relevanceData.setUpdateBy(userDetail.getUserId()); + relevanceData.setLastUpdateTime(LocalDateTime.now()); + } + private void assemblyAuditRecord(UserInfoDetails userDetail, Long auditDataId, Long auditInfoId, BulkCementDirectReportSystemAuditRecord auditRecord) { + auditRecord.setAuditDataId(auditDataId); + auditRecord.setAuditInfoId(auditInfoId); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.UNDER_AUDIT.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.NON_PROHIBITED_AREAS_BULK_CEMENT_SALES_USE.getCode()); + auditRecord.setCompanyId(userDetail.getCompanyId()); + auditRecord.setRegionId(userDetail.getRegionId()); + auditRecord.setCreateOn(LocalDateTime.now()); + auditRecord.setCreateBy(userDetail.getUserId()); + auditRecord.setUpdateOn(LocalDateTime.now()); + auditRecord.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyAuditInfo(BulkCementDirectReportSystemAuditInfo auditInfo, DataUploadAuditStatusEnum underAudit, UserInfoDetails userDetail) { + auditInfo.setAuditStatus(underAudit.getCode()); + auditInfo.setAuditDataType(UploadDataTypeEnum.NON_PROHIBITED_AREAS_BULK_CEMENT_SALES_USE.getCode()); + auditInfo.setCreateOn(LocalDateTime.now()); + auditInfo.setCreateBy(userDetail.getUserId()); + auditInfo.setUpdateOn(LocalDateTime.now()); + auditInfo.setUpdateBy(userDetail.getUserId()); + } + + private void assemblyData(ReqNonProhibitedAreasDataUploadPO req, UserInfoDetails userDetail, NonProhibitedAreasBulkCementSalesUse nonProhibitedAreasBulkCementSalesUse) { + RegionDTO regionDto = regionsCacheHelper.getByRegionId(userDetail.getRegionId()); + String regionName = regionDto.getRegionName(); + // 单位名称改成了地区 + nonProhibitedAreasBulkCementSalesUse.setRegionName(regionName); + nonProhibitedAreasBulkCementSalesUse.setSalePointAccumulativeNum(req.getSalePointAccumulativeNum()); + nonProhibitedAreasBulkCementSalesUse.setCementCompanyBuildPointNum(req.getCementCompanyBuildPointNum()); + nonProhibitedAreasBulkCementSalesUse.setOtherInvestmentBuildPointNum(req.getOtherInvestmentBuildPointNum()); + nonProhibitedAreasBulkCementSalesUse.setSaleVolume(req.getSaleVolume()); + nonProhibitedAreasBulkCementSalesUse.setBulkCementTankNum(req.getBulkCementTankNum()); + nonProhibitedAreasBulkCementSalesUse.setBulkCementTankCapacity(req.getBulkCementTankCapacity()); + nonProhibitedAreasBulkCementSalesUse.setCementUsage(req.getCementUsage()); + nonProhibitedAreasBulkCementSalesUse.setBulkCementUsage(req.getBulkCementUsage()); + nonProhibitedAreasBulkCementSalesUse.setReadyMixedConcreteBulkCementUsage(req.getReadyMixedConcreteBulkCementUsage()); + nonProhibitedAreasBulkCementSalesUse.setCementProductsBulkCementUsage(req.getCementProductsBulkCementUsage()); + nonProhibitedAreasBulkCementSalesUse.setBulkCementUsageRate(req.getBulkCementUsageRate()); + nonProhibitedAreasBulkCementSalesUse.setReadyMixedConcreteOutput(req.getReadyMixedConcreteOutput()); + nonProhibitedAreasBulkCementSalesUse.setReportYear(req.getReportYear()); + nonProhibitedAreasBulkCementSalesUse.setRemark(req.getRemark()); + nonProhibitedAreasBulkCementSalesUse.setCompanyId(userDetail.getCompanyId()); + nonProhibitedAreasBulkCementSalesUse.setUnitResponsiblePerson(req.getUnitResponsiblePerson()); + nonProhibitedAreasBulkCementSalesUse.setPreparer(req.getPreparer()); + nonProhibitedAreasBulkCementSalesUse.setReviewer(req.getReviewer()); + nonProhibitedAreasBulkCementSalesUse.setSubmissionDate(req.getSubmissionDate()); + nonProhibitedAreasBulkCementSalesUse.setRegionId(userDetail.getRegionId()); + nonProhibitedAreasBulkCementSalesUse.setCreateOn(LocalDateTime.now()); + nonProhibitedAreasBulkCementSalesUse.setCreateBy(userDetail.getUserId()); + nonProhibitedAreasBulkCementSalesUse.setUpdateOn(LocalDateTime.now()); + nonProhibitedAreasBulkCementSalesUse.setUpdateBy(userDetail.getUserId()); + } + + private void checkUploadData(Integer reportYear, Long regionId, BulkCementDirectReportSystemDataRelevance cityData) { + NonProhibitedAreasBulkCementSalesUse nonProhibitedAreasBulkCementSalesUse = nonProhibitedAreasBulkCementSalesUseService.getOne(Wrappers.lambdaQuery(NonProhibitedAreasBulkCementSalesUse.class) + .eq(NonProhibitedAreasBulkCementSalesUse::getRegionId, regionId) + .eq(NonProhibitedAreasBulkCementSalesUse::getReportYear, reportYear)); + // 判断审核状态,如果审核通过,更新审核通过的数据 + if (Objects.nonNull(nonProhibitedAreasBulkCementSalesUse) && + DataUploadAuditStatusEnum.AUDIT_PASS.getCode().equals(nonProhibitedAreasBulkCementSalesUse.getAuditStatus())){ + updateCityData(cityData,nonProhibitedAreasBulkCementSalesUse); + nonProhibitedAreasBulkCementSalesUseService.removeById(nonProhibitedAreasBulkCementSalesUse); + } + } + + private void updateCityData(BulkCementDirectReportSystemDataRelevance cityData, NonProhibitedAreasBulkCementSalesUse nonProhibitedAreasBulkCementSalesUse) { + if (Objects.nonNull(cityData)) { + String auditDataIdList = cityData.getAuditDataIdList(); + if (StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + // 将已经存在的该地区该上报月份的数据数据从关联表中删除 + idList.remove(nonProhibitedAreasBulkCementSalesUse.getId()); + } + } + } + + public ResNonProhibitedAreasDataUploadDetailVO getNonProhibitedAreasUploadData(ReqNonProhibitedAreasDataUploadPO req) { + + // 获取登录用户信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + // 获取填报的数据 + Integer cementCompanyBuildPointNum = req.getCementCompanyBuildPointNum(); + Integer otherInvestmentBuildPointNum = req.getOtherInvestmentBuildPointNum(); + BigDecimal saleVolume = req.getSaleVolume(); + Integer bulkCementTankNum = req.getBulkCementTankNum(); + BigDecimal bulkCementTankCapacity = req.getBulkCementTankCapacity(); + BigDecimal cementUsage = req.getCementUsage(); + BigDecimal readyMixedConcreteBulkCementUsage = req.getReadyMixedConcreteBulkCementUsage(); + BigDecimal cementProductsBulkCementUsage = req.getCementProductsBulkCementUsage(); + BigDecimal readyMixedConcreteOutput = req.getReadyMixedConcreteOutput(); + String remark = req.getRemark(); + Integer reportYear = req.getReportYear(); + + ResNonProhibitedAreasDataUploadDetailVO vo = new ResNonProhibitedAreasDataUploadDetailVO(); + vo.setSaleVolume(saleVolume); + vo.setBulkCementTankNum(bulkCementTankNum); + vo.setBulkCementTankCapacity(bulkCementTankCapacity); + vo.setCementUsage(cementUsage); + vo.setReadyMixedConcreteBulkCementUsage(readyMixedConcreteBulkCementUsage); + vo.setCementProductsBulkCementUsage(cementProductsBulkCementUsage); + vo.setReadyMixedConcreteOutput(readyMixedConcreteOutput); + vo.setReportYear(reportYear); + vo.setRemark(remark); + + // 计算各数据 + // 非禁现区散装水泥销售点合计数量: 水泥企业建点数量 + 其它投资建点数量 + if (Objects.nonNull(cementCompanyBuildPointNum) && Objects.nonNull(otherInvestmentBuildPointNum)){ + int salePointAccumulativeNum = cementCompanyBuildPointNum + otherInvestmentBuildPointNum; + vo.setSalePointAccumulativeNum(salePointAccumulativeNum); + } + // 非禁现区散装水泥使用量: 生产预拌混凝土使用散装水泥量 + 生产水泥制品使用散装水泥量 + if (Objects.nonNull(readyMixedConcreteBulkCementUsage) && Objects.nonNull(cementProductsBulkCementUsage)){ + BigDecimal bulkCementUsage = readyMixedConcreteBulkCementUsage.add(cementProductsBulkCementUsage); + vo.setBulkCementUsage(bulkCementUsage); + // 非禁现区域散装水泥使用率:散装水泥使用量 / 水泥使用量 * 100 + if (Objects.nonNull(cementUsage)){ + BigDecimal bulkCementUsageRate = bulkCementUsage.divide(cementUsage, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100L)); + vo.setBulkCementUsageRate(bulkCementUsageRate); + } + } + return vo; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemAuditInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemAuditInfoMapper.java new file mode 100644 index 0000000..c7d16f5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemAuditInfoMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.mapper; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 散装水泥直报系统审核信息表 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-09-28 + */ +public interface BulkCementDirectReportSystemAuditInfoMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemAuditInfoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemAuditInfoMapper.xml new file mode 100644 index 0000000..c9d22a6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemAuditInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemAuditRecordMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemAuditRecordMapper.java new file mode 100644 index 0000000..d55380f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemAuditRecordMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.mapper; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 散装水泥直报系统审核记录表 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-09-28 + */ +public interface BulkCementDirectReportSystemAuditRecordMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemAuditRecordMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemAuditRecordMapper.xml new file mode 100644 index 0000000..a848c30 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemAuditRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemDataRelevanceMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemDataRelevanceMapper.java new file mode 100644 index 0000000..017a2b5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemDataRelevanceMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.mapper; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemDataRelevance; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 散装水泥直报系统市级上报数据关联表 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-09-30 + */ +public interface BulkCementDirectReportSystemDataRelevanceMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemDataRelevanceMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemDataRelevanceMapper.xml new file mode 100644 index 0000000..2f1c7ee --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemDataRelevanceMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemIndexMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemIndexMapper.java new file mode 100644 index 0000000..05d2cd6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemIndexMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.mapper; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemIndex; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 散装水泥直报系统指标数据 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-09-28 + */ +public interface BulkCementDirectReportSystemIndexMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemIndexMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemIndexMapper.xml new file mode 100644 index 0000000..afad4ab --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemIndexMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemUniversalIndexMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemUniversalIndexMapper.java new file mode 100644 index 0000000..0d2343a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemUniversalIndexMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.mapper; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemUniversalIndex; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 散装水泥直报系统通用指标 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-10-02 + */ +public interface BulkCementDirectReportSystemUniversalIndexMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemUniversalIndexMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemUniversalIndexMapper.xml new file mode 100644 index 0000000..fefac1e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementDirectReportSystemUniversalIndexMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementLogisticFacilityStatisticAnnualReportMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementLogisticFacilityStatisticAnnualReportMapper.java new file mode 100644 index 0000000..7847c33 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementLogisticFacilityStatisticAnnualReportMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.mapper; + +import com.ningdatech.carapi.report.model.entity.BulkCementLogisticFacilityStatisticAnnualReport; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 散装水泥物流设施统计年报表 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface BulkCementLogisticFacilityStatisticAnnualReportMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementLogisticFacilityStatisticAnnualReportMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementLogisticFacilityStatisticAnnualReportMapper.xml new file mode 100644 index 0000000..bf10cfe --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementLogisticFacilityStatisticAnnualReportMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementSupplyBulletinMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementSupplyBulletinMapper.java new file mode 100644 index 0000000..ca33a04 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementSupplyBulletinMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.mapper; + +import com.ningdatech.carapi.report.model.entity.BulkCementSupplyBulletin; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 散装水泥供应量快报 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface BulkCementSupplyBulletinMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementSupplyBulletinMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementSupplyBulletinMapper.xml new file mode 100644 index 0000000..658ef79 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementSupplyBulletinMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementThreeCityUsageBulletinMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementThreeCityUsageBulletinMapper.java new file mode 100644 index 0000000..3b55da9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementThreeCityUsageBulletinMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.mapper; + +import com.ningdatech.carapi.report.model.entity.BulkCementThreeCityUsageBulletin; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 温州、台州、舟山使用量快报 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface BulkCementThreeCityUsageBulletinMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementThreeCityUsageBulletinMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementThreeCityUsageBulletinMapper.xml new file mode 100644 index 0000000..83b37a4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementThreeCityUsageBulletinMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementTransferBulletinMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementTransferBulletinMapper.java new file mode 100644 index 0000000..18efa2a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementTransferBulletinMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.mapper; + +import com.ningdatech.carapi.report.model.entity.BulkCementTransferBulletin; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 中转库进出量快报 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface BulkCementTransferBulletinMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementTransferBulletinMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementTransferBulletinMapper.xml new file mode 100644 index 0000000..55e8b6e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/BulkCementTransferBulletinMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/ConcreteSupplyBulletinMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/ConcreteSupplyBulletinMapper.java new file mode 100644 index 0000000..b2acd74 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/ConcreteSupplyBulletinMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.mapper; + +import com.ningdatech.carapi.report.model.entity.ConcreteSupplyBulletin; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 混凝土供应量快报 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface ConcreteSupplyBulletinMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/ConcreteSupplyBulletinMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/ConcreteSupplyBulletinMapper.xml new file mode 100644 index 0000000..3d53e9d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/ConcreteSupplyBulletinMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/MaterialLogisticEquipmentStatisticAnnualReportMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/MaterialLogisticEquipmentStatisticAnnualReportMapper.java new file mode 100644 index 0000000..99511da --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/MaterialLogisticEquipmentStatisticAnnualReportMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.mapper; + +import com.ningdatech.carapi.report.model.entity.MaterialLogisticEquipmentStatisticAnnualReport; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 散装水泥、预拌混凝土、干混砂浆物流装备统计年报表 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface MaterialLogisticEquipmentStatisticAnnualReportMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/MaterialLogisticEquipmentStatisticAnnualReportMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/MaterialLogisticEquipmentStatisticAnnualReportMapper.xml new file mode 100644 index 0000000..745ca31 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/MaterialLogisticEquipmentStatisticAnnualReportMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/MortarSupplyBulletinMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/MortarSupplyBulletinMapper.java new file mode 100644 index 0000000..1ec496c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/MortarSupplyBulletinMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.mapper; + +import com.ningdatech.carapi.report.model.entity.MortarSupplyBulletin; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 砂浆供应量快报 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface MortarSupplyBulletinMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/MortarSupplyBulletinMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/MortarSupplyBulletinMapper.xml new file mode 100644 index 0000000..f7e6d06 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/MortarSupplyBulletinMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/NonProhibitedAreasBulkCementSalesUseMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/NonProhibitedAreasBulkCementSalesUseMapper.java new file mode 100644 index 0000000..3e0b9b5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/NonProhibitedAreasBulkCementSalesUseMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.mapper; + +import com.ningdatech.carapi.report.model.entity.NonProhibitedAreasBulkCementSalesUse; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 非禁现区域散装水泥销售使用情况统计年报表 Mapper 接口 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface NonProhibitedAreasBulkCementSalesUseMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/NonProhibitedAreasBulkCementSalesUseMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/NonProhibitedAreasBulkCementSalesUseMapper.xml new file mode 100644 index 0000000..bcc60c5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/mapper/NonProhibitedAreasBulkCementSalesUseMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/BulkCementLogFacStaQueryDataExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/BulkCementLogFacStaQueryDataExportDTO.java new file mode 100644 index 0000000..1a2fbe0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/BulkCementLogFacStaQueryDataExportDTO.java @@ -0,0 +1,69 @@ +package com.ningdatech.carapi.report.model.dto; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import javax.validation.constraints.NotNull; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/10/02 10:54 + */ +@Data +public class BulkCementLogFacStaQueryDataExportDTO { + + @NotNull(message = "年初数量不能为空") + @Excel(name = "数量",groupName = "年初") + private Integer yearBeginNum; + @Excel(name = "容量") + @NotNull(message = "年初容量不能为空") + private BigDecimal yearBeginCapacity; + + @NotNull(message = "本年新增数量不能为空") + @Excel(name = "数量",groupName = "本年新增") + private Integer thisYearNewAddNum; + @Excel(name = "容量") + @NotNull(message = "本年新增容量不能为空") + private BigDecimal thisYearNewAddCapacity; + + @NotNull(message = "本年报废数量不能为空") + @Excel(name = "数量",groupName = "本年报废") + private Integer thisYearScrapNum; + @Excel(name = "容量") + @NotNull(message = "本年报废容量不能为空") + private BigDecimal thisYearScrapCapacity; + + @NotNull(message = "年末数量不能为空") + @Excel(name = "数量",groupName = "年末") + private Integer yearEndNum; + @Excel(name = "容量") + @NotNull(message = "年末容量不能为空") + private BigDecimal yearEndCapacity; + + @Excel(name = "本年实际作业量") + @NotNull(message = "本年实际作业量不能为空") + private BigDecimal thisYearWorkAmount; + + @Excel(name = "设施名称") + @NotNull(message = "设施名称不能为空") + private String regionName; + + @Excel(name = "备注") + private String remark; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/BulkCementSupplyQueryDataExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/BulkCementSupplyQueryDataExportDTO.java new file mode 100644 index 0000000..10be57d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/BulkCementSupplyQueryDataExportDTO.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.report.model.dto; + +import java.math.BigDecimal; + +import javax.validation.constraints.NotNull; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + * @author CMM + * @since 2023/10/02 10:54 + */ +@Data +public class BulkCementSupplyQueryDataExportDTO { + @NotNull(message = "散装水泥总量不能为空") + @Excel(name = "散装水泥总量",groupName = "本月实际") + private BigDecimal bulkCementAmount; + @Excel(name = "水泥产量") + @NotNull(message = "水泥产量不能为空") + private BigDecimal cementOutput; + + @Excel(name = "完成量",groupName = "年初至本月累计") + @NotNull(message = "完成量不能为空") + private BigDecimal completedTotalAmount; + @Excel(name = "散装率") + @NotNull(message = "散装率不能为空") + private BigDecimal bulkRate; + @Excel(name = "本月止累计水泥产量") + @NotNull(message = "本月止累计水泥产量不能为空") + private BigDecimal cumulativeCementProduction; + + @Excel(name = "增加量",groupName = "比去年同期") + @NotNull(message = "增加量不能为空") + private BigDecimal increment; + @Excel(name = "增长率") + @NotNull(message = "增长率不能为空") + private BigDecimal increaseRate; + + @Excel(name = "单位") + @NotNull(message = "单位不能为空") + private String unitName; + + @Excel(name = "散装率目标") + private BigDecimal bulkRateTarget; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/BulkCementThreeCityUsageQueryDataExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/BulkCementThreeCityUsageQueryDataExportDTO.java new file mode 100644 index 0000000..79e19a0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/BulkCementThreeCityUsageQueryDataExportDTO.java @@ -0,0 +1,51 @@ +package com.ningdatech.carapi.report.model.dto; + +import java.math.BigDecimal; + +import javax.validation.constraints.NotNull; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + * @author CMM + * @since 2023/10/02 10:54 + */ +@Data +public class BulkCementThreeCityUsageQueryDataExportDTO { + @NotNull(message = "本月使用量不能为空") + @Excel(name = "本月",groupName = "合计") + private BigDecimal thisMonthUsage; + @Excel(name = "累计") + @NotNull(message = "本月累计使用量不能为空") + private BigDecimal accumulativeUsage; + @Excel(name = "同比增长率") + @NotNull(message = "同比增长率不能为空") + private BigDecimal growthRate; + + @Excel(name = "本月",groupName = "本省") + @NotNull(message = "本省本月使用量不能为空") + private BigDecimal thisProvinceThisMonthUsage; + @Excel(name = "累计") + @NotNull(message = "本省累计使用量不能为空") + private BigDecimal thisProvinceAccumulativeUsage; + + @Excel(name = "本月",groupName = "外省") + @NotNull(message = "外省本月使用量不能为空") + private BigDecimal otherProvinceThisMonthUsage; + @Excel(name = "累计") + @NotNull(message = "外省累计使用量不能为空") + private BigDecimal otherProvinceAccumulativeUsage; + + @Excel(name = "单位") + @NotNull(message = "单位名称不能为空") + private String unitName; + + @Excel(name = "年目标") + @NotNull(message = "年目标不能为空") + private BigDecimal yearTarget; + + @Excel(name = "占全年目标%") + @NotNull(message = "占全年目标百分比不能为空") + private BigDecimal percentageOfAnnualTarget; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/BulkCementTransferQueryDataExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/BulkCementTransferQueryDataExportDTO.java new file mode 100644 index 0000000..68057fd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/BulkCementTransferQueryDataExportDTO.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.report.model.dto; + +import java.math.BigDecimal; + +import javax.validation.constraints.NotNull; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + * @author CMM + * @since 2023/10/02 10:54 + */ +@Data +public class BulkCementTransferQueryDataExportDTO { + @NotNull(message = "本月进库量不能为空") + @Excel(name = "本月",groupName = "进库量") + private BigDecimal thisMonthIncomingStorage; + @Excel(name = "累计") + @NotNull(message = "累计进库量不能为空") + private BigDecimal cumulativeIncomingStorage; + + @Excel(name = "本月",groupName = "出库量") + @NotNull(message = "本月出库量不能为空") + private BigDecimal thisMonthOutgoingStorage; + @Excel(name = "累计") + @NotNull(message = "累计出库量不能为空") + private BigDecimal cumulativeOutgoingStorage; + + @Excel(name = "库存量",groupName = "月末库存") + @NotNull(message = "月末库存量不能为空") + private BigDecimal monthEndInventory; + @Excel(name = "同比增长率") + @NotNull(message = "月末库存同比增长率不能为空") + private BigDecimal monthEndInventoryGrowthRate; + + @Excel(name = "单位") + @NotNull(message = "单位名称不能为空") + private String unitName; + + @Excel(name = "上月末库存") + @NotNull(message = "上月末库存不能为空") + private BigDecimal lastMonthEndInventory; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/ConcreteSupplyQueryDataExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/ConcreteSupplyQueryDataExportDTO.java new file mode 100644 index 0000000..eeab8e2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/ConcreteSupplyQueryDataExportDTO.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.report.model.dto; + +import java.math.BigDecimal; + +import javax.validation.constraints.NotNull; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + * @author CMM + * @since 2023/10/02 10:54 + */ +@Data +public class ConcreteSupplyQueryDataExportDTO { + @NotNull(message = "本月实际产量不能为空") + @Excel(name = "本月",groupName = "实际产量(立方米)") + private BigDecimal thisMonthOutput; + @Excel(name = "累计") + @NotNull(message = "累计实际产量不能为空") + private BigDecimal accumulativeOutput; + + @Excel(name = "本月",groupName = "使用散装水泥量(吨)") + @NotNull(message = "本月使用散装水泥量不能为空") + private BigDecimal thisMonthCementUsage; + @Excel(name = "累计") + @NotNull(message = "累计使用散装水泥量不能为空") + private BigDecimal cementAccumulativeUsage; + + @Excel(name = "本月",groupName = "废弃物综合利用量(吨)") + @NotNull(message = "本月废弃物综合利用量不能为空") + private BigDecimal thisMonthWasteUtilization; + @Excel(name = "累计") + @NotNull(message = "累计废弃物综合利用量不能为空") + private BigDecimal accumulativeWasteUtilization; + + @Excel(name = "单位") + @NotNull(message = "单位不能为空") + private String unitName; + + @Excel(name = "三类指导目标(万立方米)") + @NotNull(message = "三类指导目标不能为空") + private BigDecimal threeCategoryGuidGoal; + + @Excel(name = "生产企业数量(个)") + @NotNull(message = "生产企业数量不能为空") + private Integer productionCompanyNums; + + @Excel(name = "年设计生产能力(万立方米)") + @NotNull(message = "年设计生产能力不能为空") + private BigDecimal annualDesignProductionCapacity; + + @Excel(name = "备注") + private String remark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/MaterialLogEquipStaQueryDataExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/MaterialLogEquipStaQueryDataExportDTO.java new file mode 100644 index 0000000..9994487 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/MaterialLogEquipStaQueryDataExportDTO.java @@ -0,0 +1,66 @@ +package com.ningdatech.carapi.report.model.dto; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import javax.validation.constraints.NotNull; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/10/02 10:54 + */ +@Data +public class MaterialLogEquipStaQueryDataExportDTO { + + @NotNull(message = "年初数量不能为空") + @Excel(name = "数量",groupName = "年初") + private Integer yearBeginNum; + @Excel(name = "额定量") + @NotNull(message = "年初额定量不能为空") + private BigDecimal yearBeginCapacity; + + @NotNull(message = "本年新增数量不能为空") + @Excel(name = "数量",groupName = "本年新增") + private Integer thisYearNewAddNum; + @Excel(name = "额定量") + @NotNull(message = "本年新增额定量不能为空") + private BigDecimal thisYearNewAddCapacity; + + @NotNull(message = "本年减少数量不能为空") + @Excel(name = "数量",groupName = "本年减少") + private Integer thisYearScrapNum; + @Excel(name = "额定量") + @NotNull(message = "本年减少额定量不能为空") + private BigDecimal thisYearScrapCapacity; + + @NotNull(message = "年末数量不能为空") + @Excel(name = "数量",groupName = "年末") + private Integer yearEndNum; + @Excel(name = "额定量") + @NotNull(message = "年末额定量不能为空") + private BigDecimal yearEndCapacity; + + + @Excel(name = "装备名称") + @NotNull(message = "装备名称不能为空") + private String regionName; + + @Excel(name = "备注") + private String remark; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/MortarSupplyQueryDataExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/MortarSupplyQueryDataExportDTO.java new file mode 100644 index 0000000..2faa54d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/MortarSupplyQueryDataExportDTO.java @@ -0,0 +1,142 @@ +package com.ningdatech.carapi.report.model.dto; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/10/02 10:54 + */ +@Data +public class MortarSupplyQueryDataExportDTO { + + @ApiModelProperty("地区名称") + private String regionName; + + @ApiModelProperty("二类指导目标(万吨)") + private BigDecimal twoCategoryGuidGoal; + @ApiModelProperty("当前市二类指导目标(万吨)合计") + private BigDecimal twoCategoryGuidGoalTotal; + + @ApiModelProperty("普通干混砂浆生产企业数量(个)") + private Integer dryMixedMortarProductionCompanyNum; + @ApiModelProperty("当前市普通干混砂浆生产企业数量(个)合计") + private Integer dryMixedMortarProductionCompanyNumTotal; + + @ApiModelProperty("普通干混砂浆生产总能力(万吨)") + private BigDecimal dryMixedMortarProductiveCapacity; + @ApiModelProperty("当前市普通干混砂浆生产总能力(万吨)合计") + private BigDecimal dryMixedMortarProductiveCapacityTotal; + + @ApiModelProperty("普通干混砂浆散装能力(万吨)") + private BigDecimal dryMixedMortarBulkCapacity; + @ApiModelProperty("当前市普通干混砂浆散装能力(万吨)合计") + private BigDecimal dryMixedMortarBulkCapacityTotal; + + @ApiModelProperty("本月总产量(吨)") + private BigDecimal thisMonthTotalOutput; + @ApiModelProperty("当前市本月总产量(吨)合计") + private BigDecimal thisMonthTotalOutputTotal; + + @ApiModelProperty("本月累计产量(吨)") + private BigDecimal thisMonthAccumulativeOutput; + @ApiModelProperty("当前市本月累计产量(吨)合计") + private BigDecimal thisMonthAccumulativeOutputTotal; + + @ApiModelProperty("普通干混砂浆本月产量(吨)") + private BigDecimal dryMixedMortarThisMonthOutput; + @ApiModelProperty("当前市普通干混砂浆本月产量(吨)合计") + private BigDecimal dryMixedMortarThisMonthOutputTotal; + + @ApiModelProperty("普通干混砂浆累计产量(吨)") + private BigDecimal dryMixedMortarThisMonthAccumulativeOutput; + @ApiModelProperty("当前市普通干混砂浆累计产量(吨)合计") + private BigDecimal dryMixedMortarThisMonthAccumulativeOutputTotal; + + @ApiModelProperty("普通干混砂浆同比增长量(吨)") + private BigDecimal dryMixedMortarIncrement; + @ApiModelProperty("当前市普通干混砂浆同比增长量(吨)合计") + private BigDecimal dryMixedMortarIncrementTotal; + + @ApiModelProperty("普通干混砂浆增长率(%)") + private BigDecimal dryMixedMortarGrowthRate; + @ApiModelProperty("当前市普通干混砂浆增长率(%)合计") + private BigDecimal dryMixedMortarGrowthRateTotal; + + @ApiModelProperty("普通干混砂浆本月散装量(吨)") + private BigDecimal dryMixedMortarThisMonthBulkQuantity; + @ApiModelProperty("当前市普通干混砂浆本月散装量(吨)合计") + private BigDecimal dryMixedMortarThisMonthBulkQuantityTotal; + + @ApiModelProperty("普通干混砂浆累计散装量(吨)") + private BigDecimal dryMixedMortarAccumulativeBulkQuantity; + @ApiModelProperty("当前市普通干混砂浆累计散装量(吨)合计") + private BigDecimal dryMixedMortarAccumulativeBulkQuantityTotal; + + @ApiModelProperty("湿拌砂浆本月产量(立方)") + private BigDecimal wetMortarThisMonthOutput; + @ApiModelProperty("当前市湿拌砂浆本月产量(立方)合计") + private BigDecimal wetMortarThisMonthOutputTotal; + + @ApiModelProperty("湿拌砂浆累计产量(立方)") + private BigDecimal wetMortarAccumulativeOutput; + @ApiModelProperty("当前市拌砂浆累计产量(立方)合计") + private BigDecimal wetMortarAccumulativeOutputTotal; + + @ApiModelProperty("散装水泥本月使用量(吨)") + private BigDecimal bulkCementThisMonthUsage; + @ApiModelProperty("当前市散装水泥本月使用量(吨)合计") + private BigDecimal bulkCementThisMonthUsageTotal; + + @ApiModelProperty("散装水泥累计使用量(吨)") + private BigDecimal bulkCementAccumulativeUsage; + @ApiModelProperty("当前市散装水泥累计使用量(吨)合计") + private BigDecimal bulkCementAccumulativeUsageTotal; + + @ApiModelProperty("废弃物累计综合利用量(吨)") + private BigDecimal wasteAccumulativeComprehensiveUtilization; + @ApiModelProperty("当前市废弃物累计综合利用量(吨)合计") + private BigDecimal wasteAccumulativeComprehensiveUtilizationTotal; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("是否为市合计数据") + private Boolean isCityTotalData; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/NonProAreasQueryDataExportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/NonProAreasQueryDataExportDTO.java new file mode 100644 index 0000000..ed260a3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/NonProAreasQueryDataExportDTO.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.report.model.dto; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import javax.validation.constraints.NotNull; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/10/02 10:54 + */ +@Data +public class NonProAreasQueryDataExportDTO { + @NotNull(message = "非禁现区散装水泥销售点合计数量不能为空") + @Excel(name = "合计(个)",groupName = "非禁现区散装水泥销售点") + private Integer salePointAccumulativeNum; + @Excel(name = "水泥企业建点数量(个)") + @NotNull(message = "非禁现区水泥企业建点数量不能为空") + private Integer cementCompanyBuildPointNum; + @Excel(name = "其他投资建点数量(个)") + @NotNull(message = "非禁现区其它投资建点数量不能为空") + private Integer otherInvestmentBuildPointNum; + @Excel(name = "销售量(万吨)") + @NotNull(message = "非禁现区散装水泥销售量不能为空") + private BigDecimal saleVolume; + @Excel(name = "数量(个)",groupName = "散装水泥罐") + @NotNull(message = "非禁现区散装水泥罐数量不能为空") + private Integer bulkCementTankNum; + @Excel(name = "容量(吨)") + @NotNull(message = "非禁现区散装水泥罐容量不能为空") + private BigDecimal bulkCementTankCapacity; + + + @Excel(name = "水泥使用量(万吨)",groupName = "非禁现区散装水泥使用情况") + @NotNull(message = "非禁现区水泥使用量不能为空") + private BigDecimal cementUsage; + @Excel(name = "散装水泥使用量(万吨)") + @NotNull(message = "非禁现区散装水泥使用量不能为空") + private BigDecimal bulkCementUsage; + @Excel(name = "生产预拌混凝土使用散装水泥量(万吨)") + @NotNull(message = "生产预拌混凝土散装水泥使用量不能为空") + private BigDecimal readyMixedConcreteBulkCementUsage; + @Excel(name = "生产水泥制品使用散装水泥量(万立方米)") + @NotNull(message = "生产水泥制品使用散装水泥量不能为空") + private BigDecimal cementProductsBulkCementUsage; + + @Excel(name = "地区") + @NotNull(message = "地区不能为空") + private String regionName; + + @Excel(name = "非禁现区域散装水泥使用率%") + @NotNull(message = "非禁现区域散装水泥使用率不能为空") + private BigDecimal bulkCementUsageRate; + + @Excel(name = "非禁现区域生产预拌混凝土产量(万立方米)") + @NotNull(message = "非禁现区域生产预拌混凝土产量不能为空") + private BigDecimal readyMixedConcreteOutput; + + @Excel(name = "备注") + private String remark; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/ReqBulkCementLogFacStaDataUploadDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/ReqBulkCementLogFacStaDataUploadDTO.java new file mode 100644 index 0000000..14c40fd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/ReqBulkCementLogFacStaDataUploadDTO.java @@ -0,0 +1,78 @@ +package com.ningdatech.carapi.report.model.dto; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "散装水泥物流设施统计年报上报数据") +public class ReqBulkCementLogFacStaDataUploadDTO { + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("地区") + private String regionName; + + @ApiModelProperty("设备名称") + private String facilityName; + + @ApiModelProperty("年初数量(个)") + private Integer yearBeginNum; + + @ApiModelProperty("年初容量(万吨)") + private BigDecimal yearBeginCapacity; + + @ApiModelProperty("本年新增数量(个)") + private Integer thisYearNewAddNum; + + @ApiModelProperty("本年新增容量(万吨)") + private BigDecimal thisYearNewAddCapacity; + + @ApiModelProperty("本年报废数量(个)") + private Integer thisYearScrapNum; + + @ApiModelProperty("本年报废容量(万吨)") + private BigDecimal thisYearScrapCapacity; + + @ApiModelProperty("年末数量(个)") + private Integer yearEndNum; + + @ApiModelProperty("年末容量(万吨)") + private BigDecimal yearEndCapacity; + + @ApiModelProperty("本年实际作业量(万吨)") + private BigDecimal thisYearWorkAmount; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/ReqMaterialLogEquipStaDataUploadDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/ReqMaterialLogEquipStaDataUploadDTO.java new file mode 100644 index 0000000..1113c88 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/dto/ReqMaterialLogEquipStaDataUploadDTO.java @@ -0,0 +1,79 @@ +package com.ningdatech.carapi.report.model.dto; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "散装水泥、预拌混凝土、干混砂浆物流装备统计年报上报数据") +public class ReqMaterialLogEquipStaDataUploadDTO { + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("地区") + private String regionName; + + @ApiModelProperty("装备名称") + private String equipmentName; + + @ApiModelProperty("年初数量(辆、个)") + private Integer yearBeginNum; + + @ApiModelProperty("年初额定量(吨、立方米)") + private BigDecimal yearBeginNominalRate; + + @ApiModelProperty("本年新增数量") + private Integer thisYearNewAddNum; + + @ApiModelProperty("本年新增额定量") + private BigDecimal thisYearNewAddNominalRate; + + @ApiModelProperty("本年减少数量") + private Integer thisYearDecreaseNum; + + @ApiModelProperty("本年减少额定量") + private BigDecimal thisYearDecreaseNominalRate; + + @ApiModelProperty("年末数量") + private Integer yearEndNum; + + @ApiModelProperty("年末额定量") + private BigDecimal yearEndNominal; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("上报年份") + private Integer reportYear; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemAuditInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemAuditInfo.java new file mode 100644 index 0000000..5f820c9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemAuditInfo.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.report.model.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 散装水泥直报系统审核信息表 + *

+ * + * @author CMM + * @since 2023-09-28 + */ +@Data +@TableName("nd_bulk_cement_direct_report_system_audit_info") +@ApiModel(value = "BulkCementDirectReportSystemAuditInfo对象", description = "散装水泥直报系统审核信息表") +public class BulkCementDirectReportSystemAuditInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("审核状态 1 待审核 2 审核通过 3 被退回 4 待上报") + private Integer auditStatus; + + @ApiModelProperty("审核数据类型 1 散装水泥供应量快报数据、2 中转库进出量统计数据、3 温台舟使用量快报数据、4 混凝土供应量快报数据、5 砂浆供应量快报数据、6 非禁现区域散装水泥销售使用情况数据、7 散装水泥物流设施统计年报表数据、8 散装水泥、预拌砂浆、干混砂浆物流装备统计年报表数据") + private Integer auditDataType; + + @ApiModelProperty("审核类型 1 市级散办审核 2 省散办审核") + private Integer auditType; + + @ApiModelProperty("审核意见") + private String auditOpinion; + + @ApiModelProperty("审核时间") + private LocalDateTime auditTime; + + @ApiModelProperty("审核人") + private Long auditBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemAuditRecord.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemAuditRecord.java new file mode 100644 index 0000000..a1b2bd6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemAuditRecord.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.report.model.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 散装水泥直报系统审核记录表 + *

+ * + * @author CMM + * @since 2023-09-28 + */ +@Data +@TableName("nd_bulk_cement_direct_report_system_audit_record") +@ApiModel(value = "BulkCementDirectReportSystemAuditRecord对象", description = "散装水泥直报系统审核记录表") +public class BulkCementDirectReportSystemAuditRecord implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("审核数据ID") + private Long auditDataId; + + @ApiModelProperty("审核数据类型 1 散装水泥供应量快报数据、2 中转库进出量统计数据、3 温台舟使用量快报数据、4 混凝土供应量快报数据、5 砂浆供应量快报数据、6 非禁现区域散装水泥销售使用情况数据、7 散装水泥物流设施统计年报表数据、8 散装水泥、预拌砂浆、干混砂浆物流装备统计年报表数据") + private Integer auditDataType; + + @ApiModelProperty("审核类型 1 市级散办审核 2 省散办审核") + private Integer auditType; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("审核状态 0 待审核 1 审核通过 2 被退回") + private Integer auditStatus; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemDataRelevance.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemDataRelevance.java new file mode 100644 index 0000000..3367797 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemDataRelevance.java @@ -0,0 +1,85 @@ +package com.ningdatech.carapi.report.model.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 散装水泥直报系统市级上报数据关联表 + *

+ * + * @author CMM + * @since 2023-09-30 + */ +@Data +@TableName("nd_bulk_cement_direct_report_system_data_relevance") +@ApiModel(value = "BulkCementDirectReportSystemDataRelevance对象", description = "散装水泥直报系统市级上报数据关联表") +public class BulkCementDirectReportSystemDataRelevance implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("审核状态 0 审核中 1 审核通过 2 被退回") + private Integer auditStatus; + + @ApiModelProperty("审核类型 1 市级散办审核 2 省散办审核") + private Integer auditType; + + @ApiModelProperty("市级上报审核关联数据ID列表") + private String auditDataIdList; + + @ApiModelProperty("审核数据类型 1 散装水泥供应量快报数据、2 中转库进出量统计数据、3 温台舟使用量快报数据、4 混凝土供应量快报数据、5 砂浆供应量快报数据、6 非禁现区域散装水泥销售使用情况数据、7 散装水泥物流设施统计年报表数据、8 散装水泥、预拌砂浆、干混砂浆物流装备统计年报表数据") + private Integer auditDataType; + + @ApiModelProperty("最近一次更新时间") + private LocalDateTime lastUpdateTime; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemIndex.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemIndex.java new file mode 100644 index 0000000..b4b76ed --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemIndex.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.report.model.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 散装水泥直报系统指标数据 + *

+ * + * @author CMM + * @since 2023-09-28 + */ +@Data +@TableName("nd_bulk_cement_direct_report_system_index") +@ApiModel(value = "BulkCementDirectReportSystemIndex对象", description = "散装水泥直报系统指标数据") +public class BulkCementDirectReportSystemIndex implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("指标类型 1 散装率目标 2 二类指导目标 3 三类指导目标") + private Integer indexType; + + @ApiModelProperty("指标名称") + private String indexName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemUniversalIndex.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemUniversalIndex.java new file mode 100644 index 0000000..97b5b0c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementDirectReportSystemUniversalIndex.java @@ -0,0 +1,66 @@ +package com.ningdatech.carapi.report.model.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 散装水泥直报系统通用指标 + *

+ * + * @author CMM + * @since 2023-10-02 + */ +@Data +@TableName("nd_bulk_cement_direct_report_system_universal_index") +@ApiModel(value = "BulkCementDirectReportSystemUniversalIndex对象", description = "散装水泥直报系统通用指标") +public class BulkCementDirectReportSystemUniversalIndex implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("散装率目标") + private BigDecimal bulkRateTarget; + + @ApiModelProperty("温州、台州、舟山三市散装水泥使用量") + private BigDecimal bulkCementUsageYearTarget; + + @ApiModelProperty("混凝土供应量三类指导目标(万立方米)") + private BigDecimal concreteSupplyThreeCategoryGuidGoal; + + @ApiModelProperty("砂浆供应量二类指导目标(万吨)") + private BigDecimal mortarSupplyTwoCategoryGuidGoal; + + @ApiModelProperty("年份") + private Integer year; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateBy; + + @ApiModelProperty("更新人") + private Long updateOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementLogisticFacilityStatisticAnnualReport.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementLogisticFacilityStatisticAnnualReport.java new file mode 100644 index 0000000..e39a608 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementLogisticFacilityStatisticAnnualReport.java @@ -0,0 +1,108 @@ +package com.ningdatech.carapi.report.model.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 散装水泥物流设施统计年报表 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Data +@TableName("nd_bulk_cement_logistic_facility_statistic_annual_report") +@ApiModel(value = "BulkCementLogisticFacilityStatisticAnnualReport对象", description = "散装水泥物流设施统计年报表") +public class BulkCementLogisticFacilityStatisticAnnualReport implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("地区") + private String regionName; + + @ApiModelProperty("设备名称") + private String facilityName; + + @ApiModelProperty("年初数量(个)") + private Integer yearBeginNum; + + @ApiModelProperty("年初容量(万吨)") + private BigDecimal yearBeginCapacity; + + @ApiModelProperty("本年新增数量(个)") + private Integer thisYearNewAddNum; + + @ApiModelProperty("本年新增容量(万吨)") + private BigDecimal thisYearNewAddCapacity; + + @ApiModelProperty("本年报废数量(个)") + private Integer thisYearScrapNum; + + @ApiModelProperty("本年报废容量(万吨)") + private BigDecimal thisYearScrapCapacity; + + @ApiModelProperty("年末数量(个)") + private Integer yearEndNum; + + @ApiModelProperty("年末容量(万吨)") + private BigDecimal yearEndCapacity; + + @ApiModelProperty("本年实际作业量(万吨)") + private BigDecimal thisYearWorkAmount; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("审核状态 1 审核中 2 审核通过 3 被退回 4 待上报") + private Integer auditStatus; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementSupplyBulletin.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementSupplyBulletin.java new file mode 100644 index 0000000..391faa0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementSupplyBulletin.java @@ -0,0 +1,99 @@ +package com.ningdatech.carapi.report.model.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 散装水泥供应量快报 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Data +@TableName("nd_bulk_cement_supply_bulletin") +@ApiModel(value = "BulkCementSupplyBulletin对象", description = "散装水泥供应量快报") +public class BulkCementSupplyBulletin implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("散装率目标") + private BigDecimal bulkRateTarget; + + @ApiModelProperty("散装水泥总量") + private BigDecimal bulkCementAmount; + + @ApiModelProperty("水泥产量") + private BigDecimal cementOutput; + + @ApiModelProperty("年初至本月累计完成总量") + private BigDecimal completedTotalAmount; + + @ApiModelProperty("年初至本月累计散装率") + private BigDecimal bulkRate; + + @ApiModelProperty("年初至本月累计 比去年同期 增加量") + private BigDecimal increment; + + @ApiModelProperty("年初至本月累计 比去年同期 增长率") + private BigDecimal increaseRate; + + @ApiModelProperty("本月止累计水泥产量") + private BigDecimal cumulativeCementProduction; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("审核状态 1 审核中 2 审核通过 3 被退回 4 待上报") + private Integer auditStatus; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementThreeCityUsageBulletin.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementThreeCityUsageBulletin.java new file mode 100644 index 0000000..b35963a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementThreeCityUsageBulletin.java @@ -0,0 +1,102 @@ +package com.ningdatech.carapi.report.model.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 温州、台州、舟山使用量快报 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Data +@TableName("nd_bulk_cement_three_city_usage_bulletin") +@ApiModel(value = "BulkCementThreeCityUsageBulletin对象", description = "温州、台州、舟山使用量快报") +public class BulkCementThreeCityUsageBulletin implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("年目标") + private BigDecimal yearTarget; + + @ApiModelProperty("占全年目标百分比") + private BigDecimal percentageOfAnnualTarget; + + @ApiModelProperty("本月使用量") + private BigDecimal thisMonthUsage; + + @ApiModelProperty("累计使用量") + private BigDecimal accumulativeUsage; + + @ApiModelProperty("同比增长率") + private BigDecimal growthRate; + + @ApiModelProperty("本省本月使用量") + private BigDecimal thisProvinceThisMonthUsage; + + @ApiModelProperty("本省累计使用量") + private BigDecimal thisProvinceAccumulativeUsage; + + @ApiModelProperty("外省本月使用量") + private BigDecimal otherProvinceThisMonthUsage; + + @ApiModelProperty("外省累计使用量") + private BigDecimal otherProvinceAccumulativeUsage; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("审核状态 1 审核中 2 审核通过 3 被退回 4 待上报") + private Integer auditStatus; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementTransferBulletin.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementTransferBulletin.java new file mode 100644 index 0000000..c52f9ad --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/BulkCementTransferBulletin.java @@ -0,0 +1,96 @@ +package com.ningdatech.carapi.report.model.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 中转库进出量快报 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Data +@TableName("nd_bulk_cement_transfer_bulletin") +@ApiModel(value = "BulkCementTransferBulletin对象", description = "中转库进出量快报") +public class BulkCementTransferBulletin implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("上月末库存") + private BigDecimal lastMonthEndInventory; + + @ApiModelProperty("本月进库量") + private BigDecimal thisMonthIncomingStorage; + + @ApiModelProperty("累计进库量") + private BigDecimal cumulativeIncomingStorage; + + @ApiModelProperty("本月出库量") + private BigDecimal thisMonthOutgoingStorage; + + @ApiModelProperty("累计出库量") + private BigDecimal cumulativeOutgoingStorage; + + @ApiModelProperty("月末库存量") + private BigDecimal monthEndInventory; + + @ApiModelProperty("月末库存同比增长率") + private BigDecimal monthEndInventoryGrowthRate; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("审核状态 1 审核中 2 审核通过 3 被退回 4 待上报") + private Integer auditStatus; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/ConcreteSupplyBulletin.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/ConcreteSupplyBulletin.java new file mode 100644 index 0000000..30588ca --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/ConcreteSupplyBulletin.java @@ -0,0 +1,105 @@ +package com.ningdatech.carapi.report.model.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 混凝土供应量快报 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Data +@TableName("nd_concrete_supply_bulletin") +@ApiModel(value = "ConcreteSupplyBulletin对象", description = "混凝土供应量快报") +public class ConcreteSupplyBulletin implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("三类指导目标(万立方米)") + private BigDecimal threeCategoryGuidGoal; + + @ApiModelProperty("生产企业数量(个)") + private Integer productionCompanyNums; + + @ApiModelProperty("年设计生产能力(万立方米)") + private BigDecimal annualDesignProductionCapacity; + + @ApiModelProperty("本月实际产量(立方米)") + private BigDecimal thisMonthOutput; + + @ApiModelProperty("累计产量(立方米)") + private BigDecimal accumulativeOutput; + + @ApiModelProperty("本月散装水泥使用量(吨)") + private BigDecimal thisMonthCementUsage; + + @ApiModelProperty("散装水泥累计使用量(吨)") + private BigDecimal cementAccumulativeUsage; + + @ApiModelProperty("本月废弃物综合利用量(吨)") + private BigDecimal thisMonthWasteUtilization; + + @ApiModelProperty("累计废弃物综合利用量(吨)") + private BigDecimal accumulativeWasteUtilization; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域ID") + private Long companyId; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("审核状态 1 审核中 2 审核通过 3 被退回 4 待上报") + private Integer auditStatus; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/MaterialLogisticEquipmentStatisticAnnualReport.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/MaterialLogisticEquipmentStatisticAnnualReport.java new file mode 100644 index 0000000..aa2b1d5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/MaterialLogisticEquipmentStatisticAnnualReport.java @@ -0,0 +1,105 @@ +package com.ningdatech.carapi.report.model.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 散装水泥、预拌混凝土、干混砂浆物流装备统计年报表 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Data +@TableName("nd_material_logistic_equipment_statistic_annual_report") +@ApiModel(value = "MaterialLogisticEquipmentStatisticAnnualReport对象", description = "散装水泥、预拌混凝土、干混砂浆物流装备统计年报表") +public class MaterialLogisticEquipmentStatisticAnnualReport implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("地区") + private String regionName; + + @ApiModelProperty("装备名称") + private String equipmentName; + + @ApiModelProperty("年初数量(辆、个)") + private Integer yearBeginNum; + + @ApiModelProperty("年初额定量(吨、立方米)") + private BigDecimal yearBeginNominalRate; + + @ApiModelProperty("本年新增数量") + private Integer thisYearNewAddNum; + + @ApiModelProperty("本年新增额定量") + private BigDecimal thisYearNewAddNominalRate; + + @ApiModelProperty("本年减少数量") + private Integer thisYearDecreaseNum; + + @ApiModelProperty("本年减少额定量") + private BigDecimal thisYearDecreaseNominalRate; + + @ApiModelProperty("年末数量") + private Integer yearEndNum; + + @ApiModelProperty("年末额定量") + private BigDecimal yearEndNominal; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("审核状态 1 审核中 2 审核通过 3 被退回 4 待上报") + private Integer auditStatus; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/MortarSupplyBulletin.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/MortarSupplyBulletin.java new file mode 100644 index 0000000..b991af3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/MortarSupplyBulletin.java @@ -0,0 +1,129 @@ +package com.ningdatech.carapi.report.model.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 砂浆供应量快报 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Data +@TableName("nd_mortar_supply_bulletin") +@ApiModel(value = "MortarSupplyBulletin对象", description = "砂浆供应量快报") +public class MortarSupplyBulletin implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("地区名称") + private String regionName; + + @ApiModelProperty("二类指导目标(万吨)") + private BigDecimal twoCategoryGuidGoal; + + @ApiModelProperty("普通干混砂浆生产企业数量(个)") + private Integer dryMixedMortarProductionCompanyNum; + + @ApiModelProperty("普通干混砂浆生产总能力(万吨)") + private BigDecimal dryMixedMortarProductiveCapacity; + + @ApiModelProperty("普通干混砂浆散装能力(万吨)") + private BigDecimal dryMixedMortarBulkCapacity; + + @ApiModelProperty("本月总产量(吨)") + private BigDecimal thisMonthTotalOutput; + + @ApiModelProperty("本月累计产量(吨)") + private BigDecimal thisMonthAccumulativeOutput; + + @ApiModelProperty("普通干混砂浆本月产量(吨)") + private BigDecimal dryMixedMortarThisMonthOutput; + + @ApiModelProperty("普通干混砂浆累计产量(吨)") + private BigDecimal dryMixedMortarThisMonthAccumulativeOutput; + + @ApiModelProperty("普通干混砂浆同比增长量(吨)") + private BigDecimal dryMixedMortarIncrement; + + @ApiModelProperty("普通干混砂浆增长率(%)") + private BigDecimal dryMixedMortarGrowthRate; + + @ApiModelProperty("普通干混砂浆本月散装量(吨)") + private BigDecimal dryMixedMortarThisMonthBulkQuantity; + + @ApiModelProperty("普通干混砂浆累计散装量(吨)") + private BigDecimal dryMixedMortarAccumulativeBulkQuantity; + + @ApiModelProperty("湿拌砂浆本月产量(立方)") + private BigDecimal wetMortarThisMonthOutput; + + @ApiModelProperty("湿拌砂浆累计产量(立方)") + private BigDecimal wetMortarAccumulativeOutput; + + @ApiModelProperty("散装水泥本月使用量(吨)") + private BigDecimal bulkCementThisMonthUsage; + + @ApiModelProperty("散装水泥累计使用量(吨)") + private BigDecimal bulkCementAccumulativeUsage; + + @ApiModelProperty("废弃物本月综合利用量(吨)") + private BigDecimal wasteThisMonthComprehensiveUtilization; + + @ApiModelProperty("废弃物累计综合利用量(吨)") + private BigDecimal wasteAccumulativeComprehensiveUtilization; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("审核状态 1 审核中 2 审核通过 3 被退回 4 待上报") + private Integer auditStatus; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/NonProhibitedAreasBulkCementSalesUse.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/NonProhibitedAreasBulkCementSalesUse.java new file mode 100644 index 0000000..430f250 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/entity/NonProhibitedAreasBulkCementSalesUse.java @@ -0,0 +1,114 @@ +package com.ningdatech.carapi.report.model.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 非禁现区域散装水泥销售使用情况统计年报表 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Data +@TableName("nd_non_prohibited_areas_bulk_cement_sales_use") +@ApiModel(value = "NonProhibitedAreasBulkCementSalesUse对象", description = "非禁现区域散装水泥销售使用情况统计年报表") +public class NonProhibitedAreasBulkCementSalesUse implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("非禁现区散装水泥销售点合计数量(个)") + private Integer salePointAccumulativeNum; + + @ApiModelProperty("非禁现区水泥企业建点数量(个)") + private Integer cementCompanyBuildPointNum; + + @ApiModelProperty("非禁现区其它投资建点数量(个)") + private Integer otherInvestmentBuildPointNum; + + @ApiModelProperty("非禁现区散装水泥销售量(万吨)") + private BigDecimal saleVolume; + + @ApiModelProperty("非禁现区散装水泥罐数量(个)") + private Integer bulkCementTankNum; + + @ApiModelProperty("非禁现区散装水泥罐容量(吨)") + private BigDecimal bulkCementTankCapacity; + + @ApiModelProperty("非禁现区水泥使用量(万吨)") + private BigDecimal cementUsage; + + @ApiModelProperty("非禁现区散装水泥使用量(万吨)") + private BigDecimal bulkCementUsage; + + @ApiModelProperty("生产预拌混凝土散装水泥使用量(万吨)") + private BigDecimal readyMixedConcreteBulkCementUsage; + + @ApiModelProperty("生产水泥制品散装水泥使用量(万立方米)") + private BigDecimal cementProductsBulkCementUsage; + + @ApiModelProperty("非禁现区域散装水泥使用率(%)") + private BigDecimal bulkCementUsageRate; + + @ApiModelProperty("非禁现区域生产预拌混凝土产量(万立方米)") + private BigDecimal readyMixedConcreteOutput; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出时间") + private LocalDateTime submissionDate; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("审核状态 1 审核中 2 审核通过 3 被退回 4 待上报") + private Integer auditStatus; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqBulkCementLogFacStaDataUploadPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqBulkCementLogFacStaDataUploadPO.java new file mode 100644 index 0000000..b113d9c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqBulkCementLogFacStaDataUploadPO.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.report.model.po; + +import java.time.LocalDateTime; + +import com.ningdatech.carapi.report.model.dto.ReqBulkCementLogFacStaDataUploadDTO; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "散装水泥物流设施统计年报上报数据") +public class ReqBulkCementLogFacStaDataUploadPO { + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("发放库上报数据") + private ReqBulkCementLogFacStaDataUploadDTO issueLibraryData; + + @ApiModelProperty("中转库上报数据") + private ReqBulkCementLogFacStaDataUploadDTO transferLibraryData; + + @ApiModelProperty("固定接收库上报数据") + private ReqBulkCementLogFacStaDataUploadDTO fixedReceiveLibraryData; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("上报年份") + private Integer reportYear; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqBulkCementSupplyDataUploadPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqBulkCementSupplyDataUploadPO.java new file mode 100644 index 0000000..f88b0bd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqBulkCementSupplyDataUploadPO.java @@ -0,0 +1,59 @@ +package com.ningdatech.carapi.report.model.po; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "散装水泥供应量上报数据") +public class ReqBulkCementSupplyDataUploadPO { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("散装水泥总量") + private BigDecimal bulkCementAmount; + + @ApiModelProperty("水泥产量") + private BigDecimal cementOutput; + + @ApiModelProperty("年初至本月累计完成总量") + private BigDecimal completedTotalAmount; + + @ApiModelProperty("年初至本月累计散装率") + private BigDecimal bulkRate; + + @ApiModelProperty("年初至本月累计 比去年同期 增加量") + private BigDecimal increment; + + @ApiModelProperty("年初至本月累计 比去年同期 增长率") + private BigDecimal increaseRate; + + @ApiModelProperty("本月止累计水泥产量") + private BigDecimal cumulativeCementProduction; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqBulkCementThreeCityUsageDataUploadPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqBulkCementThreeCityUsageDataUploadPO.java new file mode 100644 index 0000000..776deac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqBulkCementThreeCityUsageDataUploadPO.java @@ -0,0 +1,71 @@ +package com.ningdatech.carapi.report.model.po; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "温台舟使用量上报数据") +public class ReqBulkCementThreeCityUsageDataUploadPO { + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("年目标") + private BigDecimal yearTarget; + + @ApiModelProperty("本月使用量") + private BigDecimal thisMonthUsage; + + @ApiModelProperty("累计使用量") + private BigDecimal accumulativeUsage; + + @ApiModelProperty("同比增长率") + private BigDecimal growthRate; + + @ApiModelProperty("占全年目标百分比") + private BigDecimal percentageOfAnnualTarget; + + @ApiModelProperty("本省本月使用量") + private BigDecimal thisProvinceThisMonthUsage; + + @ApiModelProperty("本省累计使用量") + private BigDecimal thisProvinceAccumulativeUsage; + + @ApiModelProperty("外省本月使用量") + private BigDecimal otherProvinceThisMonthUsage; + + @ApiModelProperty("外省累计使用量") + private BigDecimal otherProvinceAccumulativeUsage; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqBulkCementTransferDataUploadPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqBulkCementTransferDataUploadPO.java new file mode 100644 index 0000000..c111a17 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqBulkCementTransferDataUploadPO.java @@ -0,0 +1,65 @@ +package com.ningdatech.carapi.report.model.po; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "中转库进出量上报数据") +public class ReqBulkCementTransferDataUploadPO { + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("上月末库存") + private BigDecimal lastMonthEndInventory; + + @ApiModelProperty("本月进库量") + private BigDecimal thisMonthIncomingStorage; + + @ApiModelProperty("累计进库量") + private BigDecimal cumulativeIncomingStorage; + + @ApiModelProperty("本月出库量") + private BigDecimal thisMonthOutgoingStorage; + + @ApiModelProperty("累计出库量") + private BigDecimal cumulativeOutgoingStorage; + + @ApiModelProperty("月末库存量") + private BigDecimal monthEndInventory; + + @ApiModelProperty("月末库存同比增长率") + private BigDecimal monthEndInventoryGrowthRate; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqConcreteSupplyDataUploadPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqConcreteSupplyDataUploadPO.java new file mode 100644 index 0000000..8289c4b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqConcreteSupplyDataUploadPO.java @@ -0,0 +1,74 @@ +package com.ningdatech.carapi.report.model.po; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "混凝土供应量上报数据") +public class ReqConcreteSupplyDataUploadPO { + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("三类指导目标(万立方米)") + private BigDecimal threeCategoryGuidGoal; + + @ApiModelProperty("生产企业数量(个)") + private Integer productionCompanyNums; + + @ApiModelProperty("年设计生产能力(万立方米)") + private BigDecimal annualDesignProductionCapacity; + + @ApiModelProperty("本月实际产量(立方米)") + private BigDecimal thisMonthOutput; + + @ApiModelProperty("累计产量(立方米)") + private BigDecimal accumulativeOutput; + + @ApiModelProperty("本月散装水泥使用量(吨)") + private BigDecimal thisMonthCementUsage; + + @ApiModelProperty("散装水泥累计使用量(吨)") + private BigDecimal cementAccumulativeUsage; + + @ApiModelProperty("本月废弃物综合利用量(吨)") + private BigDecimal thisMonthWasteUtilization; + + @ApiModelProperty("累计废弃物综合利用量(吨)") + private BigDecimal accumulativeWasteUtilization; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqDataAuditPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqDataAuditPO.java new file mode 100644 index 0000000..8cea548 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqDataAuditPO.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.report.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "数据审核请求") +public class ReqDataAuditPO { + + @ApiModelProperty("审核数据Id") + private Long auditDataId; + + @ApiModelProperty("审核信息Id") + private Long auditInfoId; + + @ApiModelProperty("审核记录ID") + private Long auditRecordId; + + @ApiModelProperty("审核意见") + private String auditOpinion; + + @ApiModelProperty("审核结果") + private Integer auditStatus; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("审核数据类型 1 散装水泥供应量快报数据、2 中转库进出量统计数据、3 温台舟使用量快报数据、4 混凝土供应量快报数据、5 砂浆供应量快报数据、6 非禁现区域散装水泥销售使用情况数据、7 散装水泥物流设施统计年报表数据、8 散装水泥、预拌砂浆、干混砂浆物流装备统计年报表数据") + private Integer auditDataType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqDataQueryModifyPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqDataQueryModifyPO.java new file mode 100644 index 0000000..407b3ac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqDataQueryModifyPO.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.report.model.po; + +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "数据上报查询编辑请求参数") +public class ReqDataQueryModifyPO { + + @ApiModelProperty("关联数据ID") + private Long relevanceId; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqDataUploadDetailPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqDataUploadDetailPO.java new file mode 100644 index 0000000..3d53920 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqDataUploadDetailPO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.report.model.po; + +import javax.validation.constraints.NotNull; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "数据上报详情查询请求") +public class ReqDataUploadDetailPO { + + @ApiModelProperty("审核数据类型 1 散装水泥供应量快报数据、2 中转库进出量统计数据、3 温台舟使用量快报数据、4 混凝土供应量快报数据、5 砂浆供应量快报数据、6 非禁现区域散装水泥销售使用情况数据、7 散装水泥物流设施统计年报表数据、8 散装水泥、预拌砂浆、干混砂浆物流装备统计年报表数据") + @NotNull(message = "请传入数据类型!") + private Integer auditDataType; + + @ApiModelProperty("审核数据ID") + @NotNull(message = "请传入数据ID!") + private Long auditDataId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqDataUploadListPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqDataUploadListPO.java new file mode 100644 index 0000000..c04c515 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqDataUploadListPO.java @@ -0,0 +1,59 @@ +package com.ningdatech.carapi.report.model.po; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "数据上报列表查询请求") +public class ReqDataUploadListPO extends PagePo { + + @ApiModelProperty("上报开始月份") + private LocalDateTime reportStartMonth; + @ApiModelProperty("上报开始年份") + private Integer reportStartYear; + + @ApiModelProperty("上报结束月份") + private LocalDateTime reportEndMonth; + @ApiModelProperty("上报结束年份") + private Integer reportEndYear; + + @ApiModelProperty("审核状态") + private Integer auditStatus; + + @ApiModelProperty("审核状态列表") + private List auditStatusList; + + @ApiModelProperty("区域信息id") + private Long regionId; + + @ApiModelProperty("审核数据类型 1 散装水泥供应量快报数据、2 中转库进出量统计数据、3 温台舟使用量快报数据、4 混凝土供应量快报数据、5 砂浆供应量快报数据、6 非禁现区域散装水泥销售使用情况数据、7 散装水泥物流设施统计年报表数据、8 散装水泥、预拌砂浆、干混砂浆物流装备统计年报表数据") + private Integer auditDataType; + + @ApiModelProperty("审核数据(对应上报数据)ID列表") + private List auditDataIdList; + + @ApiModelProperty("审核数据ID列表Map") + private Map> auditDataIdListMap; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("关联数据ID") + private Long relevanceDataId; + + @ApiModelProperty("查询类型 1 审核列表查询 2 查询列表查询") + private Integer queryType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqMaterialLogEquipStaDataUploadPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqMaterialLogEquipStaDataUploadPO.java new file mode 100644 index 0000000..3c41e35 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqMaterialLogEquipStaDataUploadPO.java @@ -0,0 +1,60 @@ +package com.ningdatech.carapi.report.model.po; + +import java.time.LocalDateTime; + +import com.ningdatech.carapi.report.model.dto.ReqMaterialLogEquipStaDataUploadDTO; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "散装水泥、预拌混凝土、干混砂浆物流装备统计年报上报数据") +public class ReqMaterialLogEquipStaDataUploadPO { + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("专用汽车上报数据") + private ReqMaterialLogEquipStaDataUploadDTO specialVehicleData; + + @ApiModelProperty("专用船上报数据") + private ReqMaterialLogEquipStaDataUploadDTO specialVesselData; + + @ApiModelProperty("散装水泥罐上报数据") + private ReqMaterialLogEquipStaDataUploadDTO bulkCementTankData; + + @ApiModelProperty("混凝土搅拌车上报数据") + private ReqMaterialLogEquipStaDataUploadDTO concreteMixerTruckData; + + @ApiModelProperty("混凝土泵车上报数据") + private ReqMaterialLogEquipStaDataUploadDTO concretePumpTruckData; + + @ApiModelProperty("干混砂浆运输车上报数据") + private ReqMaterialLogEquipStaDataUploadDTO dryMixMortarTruckData; + + @ApiModelProperty("干混砂浆移动简仓上报数据") + private ReqMaterialLogEquipStaDataUploadDTO dryMixMortarMovingStorageData; + + @ApiModelProperty("干混砂浆背罐车上报数据") + private ReqMaterialLogEquipStaDataUploadDTO dryMixMortarBackTankCarData; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("上报年份") + private Integer reportYear; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqMortarSupplyDataUploadPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqMortarSupplyDataUploadPO.java new file mode 100644 index 0000000..6ddf704 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqMortarSupplyDataUploadPO.java @@ -0,0 +1,98 @@ +package com.ningdatech.carapi.report.model.po; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "砂浆供应量上报数据") +public class ReqMortarSupplyDataUploadPO { + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("地区名称") + private String regionName; + + @ApiModelProperty("二类指导目标(万吨)") + private BigDecimal twoCategoryGuidGoal; + + @ApiModelProperty("普通干混砂浆生产企业数量(个)") + private Integer dryMixedMortarProductionCompanyNum; + + @ApiModelProperty("普通干混砂浆生产总能力(万吨)") + private BigDecimal dryMixedMortarProductiveCapacity; + + @ApiModelProperty("普通干混砂浆散装能力(万吨)") + private BigDecimal dryMixedMortarBulkCapacity; + + @ApiModelProperty("本月总产量(吨)") + private BigDecimal thisMonthTotalOutput; + + @ApiModelProperty("本月累计产量(吨)") + private BigDecimal thisMonthAccumulativeOutput; + + @ApiModelProperty("普通干混砂浆本月产量(吨)") + private BigDecimal dryMixedMortarThisMonthOutput; + + @ApiModelProperty("普通干混砂浆累计产量(吨)") + private BigDecimal dryMixedMortarThisMonthAccumulativeOutput; + + @ApiModelProperty("普通干混砂浆同比增长量(吨)") + private BigDecimal dryMixedMortarIncrement; + + @ApiModelProperty("普通干混砂浆增长率(%)") + private BigDecimal dryMixedMortarGrowthRate; + + @ApiModelProperty("普通干混砂浆本月散装量(吨)") + private BigDecimal dryMixedMortarThisMonthBulkQuantity; + + @ApiModelProperty("普通干混砂浆累计散装量(吨)") + private BigDecimal dryMixedMortarAccumulativeBulkQuantity; + + @ApiModelProperty("湿拌砂浆本月产量(立方)") + private BigDecimal wetMortarThisMonthOutput; + + @ApiModelProperty("湿拌砂浆累计产量(立方)") + private BigDecimal wetMortarAccumulativeOutput; + + @ApiModelProperty("散装水泥本月使用量(吨)") + private BigDecimal bulkCementThisMonthUsage; + + @ApiModelProperty("散装水泥累计使用量(吨)") + private BigDecimal bulkCementAccumulativeUsage; + + @ApiModelProperty("废弃物本月综合利用量(吨)") + private BigDecimal wasteThisMonthComprehensiveUtilization; + + @ApiModelProperty("废弃物累计综合利用量(吨)") + private BigDecimal wasteAccumulativeComprehensiveUtilization; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqNonProhibitedAreasDataUploadPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqNonProhibitedAreasDataUploadPO.java new file mode 100644 index 0000000..d4ac4e4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/po/ReqNonProhibitedAreasDataUploadPO.java @@ -0,0 +1,78 @@ +package com.ningdatech.carapi.report.model.po; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:43 + */ +@Data +@ApiModel(description = "非禁现区域散装水泥销售使用情况上报数据") +public class ReqNonProhibitedAreasDataUploadPO { + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("非禁现区散装水泥销售点合计数量(个)") + private Integer salePointAccumulativeNum; + + @ApiModelProperty("非禁现区水泥企业建点数量(个)") + private Integer cementCompanyBuildPointNum; + + @ApiModelProperty("非禁现区其它投资建点数量(个)") + private Integer otherInvestmentBuildPointNum; + + @ApiModelProperty("非禁现区散装水泥销售量(万吨)") + private BigDecimal saleVolume; + + @ApiModelProperty("非禁现区散装水泥罐数量(个)") + private Integer bulkCementTankNum; + + @ApiModelProperty("非禁现区散装水泥罐容量(吨)") + private BigDecimal bulkCementTankCapacity; + + @ApiModelProperty("非禁现区水泥使用量(万吨)") + private BigDecimal cementUsage; + + @ApiModelProperty("非禁现区散装水泥使用量(万吨)") + private BigDecimal bulkCementUsage; + + @ApiModelProperty("生产预拌混凝土散装水泥使用量(万吨)") + private BigDecimal readyMixedConcreteBulkCementUsage; + + @ApiModelProperty("生产水泥制品散装水泥使用量(万立方米)") + private BigDecimal cementProductsBulkCementUsage; + + @ApiModelProperty("非禁现区域散装水泥使用率(%)") + private BigDecimal bulkCementUsageRate; + + @ApiModelProperty("非禁现区域生产预拌混凝土产量(万立方米)") + private BigDecimal readyMixedConcreteOutput; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出时间") + private LocalDateTime submissionDate; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementLogFacStaDataQueryDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementLogFacStaDataQueryDetailVO.java new file mode 100644 index 0000000..df52d85 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementLogFacStaDataQueryDetailVO.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("散装水泥物流设施统计年报数据查询详情VO") +public class ResBulkCementLogFacStaDataQueryDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("散装水泥物流设施统计年报数据关联集合Map") + private Map bulkCementLogFacDataMap; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementLogFacStaDataQueryVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementLogFacStaDataQueryVO.java new file mode 100644 index 0000000..6bed472 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementLogFacStaDataQueryVO.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("散装水泥物流设施统计年报数据查询详情VO") +public class ResBulkCementLogFacStaDataQueryVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("散装水泥物流设施统计年报数据关联集合Map") + private Map bulkCementLogFacStaDataMap; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("备注") + private String remark; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementLogFacStaDataUploadDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementLogFacStaDataUploadDetailVO.java new file mode 100644 index 0000000..e26c0ce --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementLogFacStaDataUploadDetailVO.java @@ -0,0 +1,116 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("散装水泥物流设施统计年报数据上报详情VO") +public class ResBulkCementLogFacStaDataUploadDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("地区") + private String regionName; + + @ApiModelProperty("设备名称") + private String facilityName; + + @ApiModelProperty("年初数量(个)") + private Integer yearBeginNum; + @ApiModelProperty("当前市年初数量(个)合计") + private Integer yearBeginNumTotal; + + @ApiModelProperty("年初容量(万吨)") + private BigDecimal yearBeginCapacity; + @ApiModelProperty("当前市年初容量(万吨)合计") + private BigDecimal yearBeginCapacityTotal; + + @ApiModelProperty("本年新增数量(个)") + private Integer thisYearNewAddNum; + @ApiModelProperty("当前市本年新增数量(个)合计") + private Integer thisYearNewAddNumTotal; + + @ApiModelProperty("本年新增容量(万吨)") + private BigDecimal thisYearNewAddCapacity; + @ApiModelProperty("当前市本年新增容量(万吨)合计") + private BigDecimal thisYearNewAddCapacityTotal; + + @ApiModelProperty("本年报废数量(个)") + private Integer thisYearScrapNum; + @ApiModelProperty("当前市本年报废数量(个)合计") + private Integer thisYearScrapNumTotal; + + @ApiModelProperty("本年报废容量(万吨)") + private BigDecimal thisYearScrapCapacity; + @ApiModelProperty("当前市本年报废容量(万吨)合计") + private BigDecimal thisYearScrapCapacityTotal; + + @ApiModelProperty("年末数量(个)") + private Integer yearEndNum; + @ApiModelProperty("当前市年末数量(个)合计") + private Integer yearEndNumTotal; + + @ApiModelProperty("年末容量(万吨)") + private BigDecimal yearEndCapacity; + @ApiModelProperty("当前市年末容量(万吨)合计") + private BigDecimal yearEndCapacityTotal; + + @ApiModelProperty("本年实际作业量(万吨)") + private BigDecimal thisYearWorkAmount; + @ApiModelProperty("当前市本年实际作业量(万吨)合计") + private BigDecimal thisYearWorkAmountTotal; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("是否为市合计数据") + private Boolean isCityTotalData; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementLogFacStaRelatedDataVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementLogFacStaRelatedDataVO.java new file mode 100644 index 0000000..9480adb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementLogFacStaRelatedDataVO.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("散装水泥物流设施统计年报相关数据详情VO") +public class ResBulkCementLogFacStaRelatedDataVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("年初数量(个)") + private Integer yearBeginNum; + + @ApiModelProperty("年初容量(万吨)") + private BigDecimal yearBeginCapacity; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementSupplyDataQueryDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementSupplyDataQueryDetailVO.java new file mode 100644 index 0000000..e2a488d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementSupplyDataQueryDetailVO.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("散装水泥供应量数据上报详情VO") +public class ResBulkCementSupplyDataQueryDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("散装水泥供应量数据关联集合Map") + private Map bulkCementSupplyDataMap; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementSupplyDataUploadDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementSupplyDataUploadDetailVO.java new file mode 100644 index 0000000..d3b1d7d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementSupplyDataUploadDetailVO.java @@ -0,0 +1,103 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("散装水泥供应量数据上报详情VO") +public class ResBulkCementSupplyDataUploadDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("散装率目标") + private BigDecimal bulkRateTarget; + + @ApiModelProperty("散装水泥总量") + private BigDecimal bulkCementAmount; + @ApiModelProperty("当前市散装水泥总量合计") + private BigDecimal bulkCementAmountTotal; + + @ApiModelProperty("水泥产量") + private BigDecimal cementOutput; + @ApiModelProperty("当前市水泥产量合计") + private BigDecimal cementOutputTotal; + + @ApiModelProperty("年初至本月累计完成总量") + private BigDecimal completedTotalAmount; + @ApiModelProperty("当前市年初至本月累计完成总量合计") + private BigDecimal completedTotalAmountTotal; + + @ApiModelProperty("年初至本月累计散装率") + private BigDecimal bulkRate; + @ApiModelProperty("当前市年初至本月累计散装率合计") + private BigDecimal bulkRateTotal; + + @ApiModelProperty("年初至本月累计 比去年同期 增加量") + private BigDecimal increment; + @ApiModelProperty("当前市年初至本月累计 比去年同期 增加量合计") + private BigDecimal incrementTotal; + + @ApiModelProperty("年初至本月累计 比去年同期 增长率") + private BigDecimal increaseRate; + @ApiModelProperty("当前市年初至本月累计 比去年同期 增长率合计") + private BigDecimal increaseRateTotal; + + @ApiModelProperty("本月止累计水泥产量") + private BigDecimal cumulativeCementProduction; + @ApiModelProperty("当前市本月止累计水泥产量合计") + private BigDecimal cumulativeCementProductionTotal; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("是否为市合计数据") + private Boolean isCityTotalData; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementThreeCityUsageDataQueryDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementThreeCityUsageDataQueryDetailVO.java new file mode 100644 index 0000000..b6f3fc1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementThreeCityUsageDataQueryDetailVO.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("温台舟数据上报详情VO") +public class ResBulkCementThreeCityUsageDataQueryDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("温台舟数据关联集合Map") + private Map bulkCementThreeCityUsageDataMap; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementThreeCityUsageDataUploadDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementThreeCityUsageDataUploadDetailVO.java new file mode 100644 index 0000000..b284650 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementThreeCityUsageDataUploadDetailVO.java @@ -0,0 +1,110 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("温台舟使用量数据上报详情VO") +public class ResBulkCementThreeCityUsageDataUploadDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("年目标") + private BigDecimal yearTarget; + @ApiModelProperty("当前市年目标合计") + private BigDecimal yearTargetTotal; + + @ApiModelProperty("占全年目标百分比") + private BigDecimal percentageOfAnnualTarget; + @ApiModelProperty("当前市占全年目标百分比合计") + private BigDecimal percentageOfAnnualTargetTotal; + + @ApiModelProperty("本月使用量") + private BigDecimal thisMonthUsage; + @ApiModelProperty("当前市本月使用量合计") + private BigDecimal thisMonthUsageTotal; + + @ApiModelProperty("累计使用量") + private BigDecimal accumulativeUsage; + @ApiModelProperty("当前市累计使用量合计") + private BigDecimal accumulativeUsageTotal; + + @ApiModelProperty("同比增长率") + private BigDecimal growthRate; + @ApiModelProperty("当前市同比增长率合计") + private BigDecimal growthRateTotal; + + @ApiModelProperty("本省本月使用量") + private BigDecimal thisProvinceThisMonthUsage; + @ApiModelProperty("当前市本省本月使用量合计") + private BigDecimal thisProvinceThisMonthUsageTotal; + + @ApiModelProperty("本省累计使用量") + private BigDecimal thisProvinceAccumulativeUsage; + @ApiModelProperty("当前市本省累计使用量合计") + private BigDecimal thisProvinceAccumulativeUsageTotal; + + @ApiModelProperty("外省本月使用量") + private BigDecimal otherProvinceThisMonthUsage; + @ApiModelProperty("当前市外省本月使用量合计") + private BigDecimal otherProvinceThisMonthUsageTotal; + + @ApiModelProperty("外省累计使用量") + private BigDecimal otherProvinceAccumulativeUsage; + @ApiModelProperty("当前市外省累计使用量合计") + private BigDecimal otherProvinceAccumulativeUsageTotal; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("是否为市合计数据") + private Boolean isCityTotalData; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementTransferDataQueryDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementTransferDataQueryDetailVO.java new file mode 100644 index 0000000..d4871e5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementTransferDataQueryDetailVO.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("中转库进出量数据上报详情VO") +public class ResBulkCementTransferDataQueryDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("中转库进出量数据关联集合Map") + private Map bulkCementTransferDataMap; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementTransferDataUploadDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementTransferDataUploadDetailVO.java new file mode 100644 index 0000000..7761188 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResBulkCementTransferDataUploadDetailVO.java @@ -0,0 +1,88 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("中转库进出量数据上报详情VO") +public class ResBulkCementTransferDataUploadDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("上月末库存") + private BigDecimal lastMonthEndInventory; + @ApiModelProperty("当前市上月末库存合计") + private BigDecimal lastMonthEndInventoryTotal; + + @ApiModelProperty("本月进库量") + private BigDecimal thisMonthIncomingStorage; + @ApiModelProperty("当前市本月进库量合计") + private BigDecimal thisMonthIncomingStorageTotal; + + @ApiModelProperty("累计进库量") + private BigDecimal cumulativeIncomingStorage; + @ApiModelProperty("当前市累计进库量合计") + private BigDecimal cumulativeIncomingStorageTotal; + + @ApiModelProperty("本月出库量") + private BigDecimal thisMonthOutgoingStorage; + @ApiModelProperty("当前市本月出库量合计") + private BigDecimal thisMonthOutgoingStorageTotal; + + @ApiModelProperty("累计出库量") + private BigDecimal cumulativeOutgoingStorage; + @ApiModelProperty("当前市累计出库量合计") + private BigDecimal cumulativeOutgoingStorageTotal; + + @ApiModelProperty("月末库存量") + private BigDecimal monthEndInventory; + @ApiModelProperty("当前市月末库存量合计") + private BigDecimal monthEndInventoryTotal; + + @ApiModelProperty("月末库存同比增长率") + private BigDecimal monthEndInventoryGrowthRate; + @ApiModelProperty("当前市月末库存同比增长率合计") + private BigDecimal monthEndInventoryGrowthRateTotal; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("是否为市合计数据") + private Boolean isCityTotalData; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResConcreteSupplyDataQueryDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResConcreteSupplyDataQueryDetailVO.java new file mode 100644 index 0000000..cb97720 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResConcreteSupplyDataQueryDetailVO.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("混凝土供应量数据查询详情VO") +public class ResConcreteSupplyDataQueryDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("混凝土供应量数据关联集合Map") + private Map concreteSupplyDataMap; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResConcreteSupplyDataUploadDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResConcreteSupplyDataUploadDetailVO.java new file mode 100644 index 0000000..67322fc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResConcreteSupplyDataUploadDetailVO.java @@ -0,0 +1,113 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("混凝土供应量数据上报详情VO") +public class ResConcreteSupplyDataUploadDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Long id; + + @ApiModelProperty("单位名称") + private String unitName; + + @ApiModelProperty("三类指导目标(万立方米)") + private BigDecimal threeCategoryGuidGoal; + @ApiModelProperty("当前市三类指导目标(万立方米)合计") + private BigDecimal threeCategoryGuidGoalTotal; + + @ApiModelProperty("生产企业数量(个)") + private Integer productionCompanyNums; + @ApiModelProperty("当前市生产企业数量(个)合计") + private Integer productionCompanyNumsTotal; + + @ApiModelProperty("年设计生产能力(万立方米)") + private BigDecimal annualDesignProductionCapacity; + @ApiModelProperty("当前市年设计生产能力(万立方米)合计") + private BigDecimal annualDesignProductionCapacityTotal; + + @ApiModelProperty("本月实际产量(立方米)") + private BigDecimal thisMonthOutput; + @ApiModelProperty("当前市本月实际产量(立方米)合计") + private BigDecimal thisMonthOutputTotal; + + @ApiModelProperty("累计产量(立方米)") + private BigDecimal accumulativeOutput; + @ApiModelProperty("当前市累计产量(立方米)合计") + private BigDecimal accumulativeOutputTotal; + + @ApiModelProperty("本月散装水泥使用量(吨)") + private BigDecimal thisMonthCementUsage; + @ApiModelProperty("当前市本月散装水泥使用量(吨)合计") + private BigDecimal thisMonthCementUsageTotal; + + @ApiModelProperty("散装水泥累计使用量(吨)") + private BigDecimal cementAccumulativeUsage; + @ApiModelProperty("当前市散装水泥累计使用量(吨)合计") + private BigDecimal cementAccumulativeUsageTotal; + + @ApiModelProperty("本月废弃物综合利用量(吨)") + private BigDecimal thisMonthWasteUtilization; + @ApiModelProperty("当前市本月废弃物综合利用量(吨)合计") + private BigDecimal thisMonthWasteUtilizationTotal; + + @ApiModelProperty("累计废弃物综合利用量(吨)") + private BigDecimal accumulativeWasteUtilization; + @ApiModelProperty("当前市累计废弃物综合利用量(吨)合计") + private BigDecimal accumulativeWasteUtilizationTotal; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("是否为市合计数据") + private Boolean isCityTotalData; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResConcreteSupplyRelatedDataVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResConcreteSupplyRelatedDataVO.java new file mode 100644 index 0000000..6751f83 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResConcreteSupplyRelatedDataVO.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("混凝土供应量相关数据详情VO") +public class ResConcreteSupplyRelatedDataVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("三类指导目标(万立方米)") + private BigDecimal threeCategoryGuidGoal; + + @ApiModelProperty("生产企业数量(个)") + private Integer productionCompanyNums; + + @ApiModelProperty("年设计生产能力(万立方米)") + private BigDecimal annualDesignProductionCapacity; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResDataQueryDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResDataQueryDetailVO.java new file mode 100644 index 0000000..1ff68a9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResDataQueryDetailVO.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("数据查询详情返回VO") +public class ResDataQueryDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("散装水泥供应量数据查询VO") + private ResBulkCementSupplyDataQueryDetailVO bulkCementSupplyDataVo; + + @ApiModelProperty("中转库进出量数据查询VO") + private ResBulkCementTransferDataQueryDetailVO bulkCementTransferDataVo; + + @ApiModelProperty("温台舟使用量数据查询VO") + private ResBulkCementThreeCityUsageDataQueryDetailVO bulkCementThreeCityUsageDataVo; + + @ApiModelProperty("混凝土供应量数据查询VO") + private ResConcreteSupplyDataQueryDetailVO concreteSupplyDataVo; + + @ApiModelProperty("砂浆供应量数据查询VO") + private ResMortarSupplyDataQueryDetailVO mortarSupplyDataVo; + + @ApiModelProperty("非禁现区域散装水泥销售使用情况数据查询VO") + private ResNonProhibitedAreasDataQueryDetailVO nonProAreasDataVo; + + @ApiModelProperty("散装水泥物流设施统计年报数据查询VO") + private ResBulkCementLogFacStaDataQueryVO bulkCementLogFacStaDataVo; + + @ApiModelProperty("散装水泥、预拌混凝土、干混砂浆物流装备统计年报数据查询VO") + private ResMaterialLogEquipStaDataQueryVO materialLogEquipStaDataVo; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResDataQueryListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResDataQueryListVO.java new file mode 100644 index 0000000..56bba78 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResDataQueryListVO.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("数据查询列表返回VO") +public class ResDataQueryListVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("关联数据ID") + private Long relevanceDataId; + + @ApiModelProperty("审核记录ID") + private Long auditRecordId; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("所属区域") + private String regionName; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("审核状态") + private Integer auditStatus; + + @ApiModelProperty("审核状态名称") + private String auditStatusName; + + @ApiModelProperty("审核意见") + private String auditOpinion; + + @ApiModelProperty("审核数据(对应上报数据)ID列表") + private List auditDataIdList; + + @ApiModelProperty("审核数据ID列表Map") + private Map> auditDataIdListMap; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("最近一次更新时间") + private LocalDateTime updateTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResDataUploadDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResDataUploadDetailVO.java new file mode 100644 index 0000000..51ef68d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResDataUploadDetailVO.java @@ -0,0 +1,65 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("数据上报详情VO") +public class ResDataUploadDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("散装水泥供应量数据上报详情VO") + private ResBulkCementSupplyDataUploadDetailVO bulkCementSupplyDataUploadDetailVo; + + @ApiModelProperty("中转库进出量数据上报详情VO") + private ResBulkCementTransferDataUploadDetailVO bulkCementTransferDataUploadDetailVo; + + @ApiModelProperty("温台舟使用量数据上报详情VO") + private ResBulkCementThreeCityUsageDataUploadDetailVO bulkCementThreeCityUsageDataUploadDetailVo; + + @ApiModelProperty("混凝土供应量数据上报详情VO") + private ResConcreteSupplyDataUploadDetailVO concreteSupplyDataUploadDetailVO; + + @ApiModelProperty("砂浆供应量数据上报详情VO") + private ResMortarSupplyDataUploadDetailVO mortarSupplyDataUploadDetailVO; + + @ApiModelProperty("非禁现区散装水泥销售使用情况年报数据上报详情VO") + private ResNonProhibitedAreasDataUploadDetailVO nonProhibitedAreasDataUploadDetailVO; + + @ApiModelProperty("散装水泥物流设施统计年报数据上报详情VO") + private Map bulkCementLogFacStaDataUploadDetailVO; + + @ApiModelProperty("散装水泥、预拌混凝土、干混砂浆物流装备统计年报数据上报详情VO") + private Map materialLogEquipStaDataUploadDetailVO; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResDataUploadListVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResDataUploadListVO.java new file mode 100644 index 0000000..ac974b9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResDataUploadListVO.java @@ -0,0 +1,65 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("数据上报返回列表VO") +public class ResDataUploadListVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("审核记录ID") + private Long auditRecordId; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("所属区域") + private String regionName; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("审核状态") + private Integer auditStatus; + + @ApiModelProperty("审核状态名称") + private String auditStatusName; + + @ApiModelProperty("审核意见") + private String auditOpinion; + + @ApiModelProperty("审核时间") + private LocalDateTime auditTime; + + @ApiModelProperty("审核数据ID") + private Long auditDataId; + + @ApiModelProperty("审核数据ID列表") + private List auditDataIdList; + + @ApiModelProperty("审核数据ID列表Map") + private Map> auditDataIdListMap; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("提交时间") + private LocalDateTime submitTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMaterialLogEquipStaDataQueryDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMaterialLogEquipStaDataQueryDetailVO.java new file mode 100644 index 0000000..b68dba8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMaterialLogEquipStaDataQueryDetailVO.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("散装水泥物流设施统计年报数据查询详情VO") +public class ResMaterialLogEquipStaDataQueryDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("散装水泥、预拌混凝土、干混砂浆物流装备统计年报数据关联集合Map") + private Map materialLogEquipDataMap; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMaterialLogEquipStaDataQueryVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMaterialLogEquipStaDataQueryVO.java new file mode 100644 index 0000000..c70da2c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMaterialLogEquipStaDataQueryVO.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("散装水泥物流设施统计年报数据查询详情VO") +public class ResMaterialLogEquipStaDataQueryVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("散装水泥、预拌混凝土、干混砂浆物流装备统计年报数据关联集合Map") + private Map materialLogEquipStaDataMap; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("备注") + private String remark; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMaterialLogEquipStaDataUploadDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMaterialLogEquipStaDataUploadDetailVO.java new file mode 100644 index 0000000..743046c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMaterialLogEquipStaDataUploadDetailVO.java @@ -0,0 +1,111 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("散装水泥、预拌混凝土、干混砂浆物流装备统计年报数据上报详情VO") +public class ResMaterialLogEquipStaDataUploadDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("地区") + private String regionName; + + @ApiModelProperty("装备名称") + private String equipmentName; + + @ApiModelProperty("年初数量(辆、个)") + private Integer yearBeginNum; + @ApiModelProperty("当前市年初数量(辆、个)合计") + private Integer yearBeginNumTotal; + + @ApiModelProperty("年初额定量(吨、立方米)") + private BigDecimal yearBeginNominalRate; + @ApiModelProperty("当前市年初额定量(吨、立方米)合计") + private BigDecimal yearBeginNominalRateTotal; + + @ApiModelProperty("本年新增数量") + private Integer thisYearNewAddNum; + @ApiModelProperty("当前市本年新增数量合计") + private Integer thisYearNewAddNumTotal; + + @ApiModelProperty("本年新增额定量") + private BigDecimal thisYearNewAddNominalRate; + @ApiModelProperty("当前市本年新增额定量合计") + private BigDecimal thisYearNewAddNominalRateTotal; + + @ApiModelProperty("本年减少数量") + private Integer thisYearDecreaseNum; + @ApiModelProperty("当前市本年减少数量合计") + private Integer thisYearDecreaseNumTotal; + + @ApiModelProperty("本年减少额定量") + private BigDecimal thisYearDecreaseNominalRate; + @ApiModelProperty("当前市本年减少额定量合计") + private BigDecimal thisYearDecreaseNominalRateTotal; + + @ApiModelProperty("年末数量") + private Integer yearEndNum; + @ApiModelProperty("当前市年末数量合计") + private Integer yearEndNumTotal; + + @ApiModelProperty("年末额定量") + private BigDecimal yearEndNominal; + @ApiModelProperty("当前市年末额定量合计") + private BigDecimal yearEndNominalTotal; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("是否为市合计数据") + private Boolean isCityTotalData; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMaterialLogEquipStaRelatedDataVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMaterialLogEquipStaRelatedDataVO.java new file mode 100644 index 0000000..db73078 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMaterialLogEquipStaRelatedDataVO.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("散装水泥、预拌混凝土、干混砂浆物流装备统计年报相关数据详情VO") +public class ResMaterialLogEquipStaRelatedDataVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("年初数量(辆、个)") + private Integer yearBeginNum; + + @ApiModelProperty("年初额定量(吨、立方米)") + private BigDecimal yearBeginNominalRate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMortarSupplyDataQueryDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMortarSupplyDataQueryDetailVO.java new file mode 100644 index 0000000..2b05f2e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMortarSupplyDataQueryDetailVO.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("砂浆供应量数据查询详情VO") +public class ResMortarSupplyDataQueryDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("砂浆供应量数据关联集合Map") + private Map mortarSupplyDataMap; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMortarSupplyDataUploadDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMortarSupplyDataUploadDetailVO.java new file mode 100644 index 0000000..b7bbda5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMortarSupplyDataUploadDetailVO.java @@ -0,0 +1,159 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("砂浆供应量数据上报详情VO") +public class ResMortarSupplyDataUploadDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("地区名称") + private String regionName; + + @ApiModelProperty("二类指导目标(万吨)") + private BigDecimal twoCategoryGuidGoal; + @ApiModelProperty("当前市二类指导目标(万吨)合计") + private BigDecimal twoCategoryGuidGoalTotal; + + @ApiModelProperty("普通干混砂浆生产企业数量(个)") + private Integer dryMixedMortarProductionCompanyNum; + @ApiModelProperty("当前市普通干混砂浆生产企业数量(个)合计") + private Integer dryMixedMortarProductionCompanyNumTotal; + + @ApiModelProperty("普通干混砂浆生产总能力(万吨)") + private BigDecimal dryMixedMortarProductiveCapacity; + @ApiModelProperty("当前市普通干混砂浆生产总能力(万吨)合计") + private BigDecimal dryMixedMortarProductiveCapacityTotal; + + @ApiModelProperty("普通干混砂浆散装能力(万吨)") + private BigDecimal dryMixedMortarBulkCapacity; + @ApiModelProperty("当前市普通干混砂浆散装能力(万吨)合计") + private BigDecimal dryMixedMortarBulkCapacityTotal; + + @ApiModelProperty("本月总产量(吨)") + private BigDecimal thisMonthTotalOutput; + @ApiModelProperty("当前市本月总产量(吨)合计") + private BigDecimal thisMonthTotalOutputTotal; + + @ApiModelProperty("本月累计产量(吨)") + private BigDecimal thisMonthAccumulativeOutput; + @ApiModelProperty("当前市本月累计产量(吨)合计") + private BigDecimal thisMonthAccumulativeOutputTotal; + + @ApiModelProperty("普通干混砂浆本月产量(吨)") + private BigDecimal dryMixedMortarThisMonthOutput; + @ApiModelProperty("当前市普通干混砂浆本月产量(吨)合计") + private BigDecimal dryMixedMortarThisMonthOutputTotal; + + @ApiModelProperty("普通干混砂浆累计产量(吨)") + private BigDecimal dryMixedMortarThisMonthAccumulativeOutput; + @ApiModelProperty("当前市普通干混砂浆累计产量(吨)合计") + private BigDecimal dryMixedMortarThisMonthAccumulativeOutputTotal; + + @ApiModelProperty("普通干混砂浆同比增长量(吨)") + private BigDecimal dryMixedMortarIncrement; + @ApiModelProperty("当前市普通干混砂浆同比增长量(吨)合计") + private BigDecimal dryMixedMortarIncrementTotal; + + @ApiModelProperty("普通干混砂浆增长率(%)") + private BigDecimal dryMixedMortarGrowthRate; + @ApiModelProperty("当前市普通干混砂浆增长率(%)合计") + private BigDecimal dryMixedMortarGrowthRateTotal; + + @ApiModelProperty("普通干混砂浆本月散装量(吨)") + private BigDecimal dryMixedMortarThisMonthBulkQuantity; + @ApiModelProperty("当前市普通干混砂浆本月散装量(吨)合计") + private BigDecimal dryMixedMortarThisMonthBulkQuantityTotal; + + @ApiModelProperty("普通干混砂浆累计散装量(吨)") + private BigDecimal dryMixedMortarAccumulativeBulkQuantity; + @ApiModelProperty("当前市普通干混砂浆累计散装量(吨)合计") + private BigDecimal dryMixedMortarAccumulativeBulkQuantityTotal; + + @ApiModelProperty("湿拌砂浆本月产量(立方)") + private BigDecimal wetMortarThisMonthOutput; + @ApiModelProperty("当前市湿拌砂浆本月产量(立方)合计") + private BigDecimal wetMortarThisMonthOutputTotal; + + @ApiModelProperty("湿拌砂浆累计产量(立方)") + private BigDecimal wetMortarAccumulativeOutput; + @ApiModelProperty("当前市拌砂浆累计产量(立方)合计") + private BigDecimal wetMortarAccumulativeOutputTotal; + + @ApiModelProperty("散装水泥本月使用量(吨)") + private BigDecimal bulkCementThisMonthUsage; + @ApiModelProperty("当前市散装水泥本月使用量(吨)合计") + private BigDecimal bulkCementThisMonthUsageTotal; + + @ApiModelProperty("散装水泥累计使用量(吨)") + private BigDecimal bulkCementAccumulativeUsage; + @ApiModelProperty("当前市散装水泥累计使用量(吨)合计") + private BigDecimal bulkCementAccumulativeUsageTotal; + + @ApiModelProperty("废弃物本月综合利用量(吨)") + private BigDecimal wasteThisMonthComprehensiveUtilization; + @ApiModelProperty("当前市废弃物本月综合利用量(吨)合计") + private BigDecimal wasteThisMonthComprehensiveUtilizationTotal; + + @ApiModelProperty("废弃物累计综合利用量(吨)") + private BigDecimal wasteAccumulativeComprehensiveUtilization; + @ApiModelProperty("当前市废弃物累计综合利用量(吨)合计") + private BigDecimal wasteAccumulativeComprehensiveUtilizationTotal; + + @ApiModelProperty("上报月份") + private LocalDateTime reportMonth; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("是否为市合计数据") + private Boolean isCityTotalData; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMortarSupplyRelatedDataVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMortarSupplyRelatedDataVO.java new file mode 100644 index 0000000..c1e7e68 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResMortarSupplyRelatedDataVO.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("砂浆供应量相关数据详情VO") +public class ResMortarSupplyRelatedDataVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("二类指导目标(万吨)") + private BigDecimal twoCategoryGuidGoal; + + @ApiModelProperty("普通干混砂浆生产企业数量(个)") + private Integer dryMixedMortarProductionCompanyNum; + + @ApiModelProperty("普通干混砂浆生产总能力(万吨)") + private BigDecimal dryMixedMortarProductiveCapacity; + + @ApiModelProperty("普通干混砂浆散装能力(万吨)") + private BigDecimal dryMixedMortarBulkCapacity; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResNonProhibitedAreasDataQueryDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResNonProhibitedAreasDataQueryDetailVO.java new file mode 100644 index 0000000..c764fee --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResNonProhibitedAreasDataQueryDetailVO.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("非禁现区散装水泥销售情况年报数据查询详情VO") +public class ResNonProhibitedAreasDataQueryDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("非禁现区散装水泥销售情况年报数据关联集合Map") + private Map nonProAreasDataMap; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出日期") + private LocalDateTime submissionDate; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResNonProhibitedAreasDataUploadDetailVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResNonProhibitedAreasDataUploadDetailVO.java new file mode 100644 index 0000000..833ee66 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/model/vo/ResNonProhibitedAreasDataUploadDetailVO.java @@ -0,0 +1,132 @@ +package com.ningdatech.carapi.report.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2023/09/28 11:38 + */ +@Data +@ApiModel("非禁现区散装水泥销售情况数据上报详情VO") +public class ResNonProhibitedAreasDataUploadDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("非禁现区散装水泥销售点合计数量(个)") + private Integer salePointAccumulativeNum; + @ApiModelProperty("当前市非禁现区散装水泥销售点合计数量(个)合计") + private Integer salePointAccumulativeNumTotal; + + @ApiModelProperty("非禁现区水泥企业建点数量(个)") + private Integer cementCompanyBuildPointNum; + @ApiModelProperty("当前市非禁现区水泥企业建点数量(个)合计") + private Integer cementCompanyBuildPointNumTotal; + + @ApiModelProperty("非禁现区其它投资建点数量(个)") + private Integer otherInvestmentBuildPointNum; + @ApiModelProperty("当前市非禁现区其它投资建点数量(个)合计") + private Integer otherInvestmentBuildPointNumTotal; + + @ApiModelProperty("非禁现区散装水泥销售量(万吨)") + private BigDecimal saleVolume; + @ApiModelProperty("当前市非禁现区散装水泥销售量(万吨)合计") + private BigDecimal saleVolumeTotal; + + @ApiModelProperty("非禁现区散装水泥罐数量(个)") + private Integer bulkCementTankNum; + @ApiModelProperty("当前市非禁现区散装水泥罐数量(个)合计") + private Integer bulkCementTankNumTotal; + + @ApiModelProperty("非禁现区散装水泥罐容量(吨)") + private BigDecimal bulkCementTankCapacity; + @ApiModelProperty("当前市非禁现区散装水泥罐容量(吨)合计") + private BigDecimal bulkCementTankCapacityTotal; + + @ApiModelProperty("非禁现区水泥使用量(万吨)") + private BigDecimal cementUsage; + @ApiModelProperty("当前市非禁现区水泥使用量(万吨)合计") + private BigDecimal cementUsageTotal; + + @ApiModelProperty("非禁现区散装水泥使用量(万吨)") + private BigDecimal bulkCementUsage; + @ApiModelProperty("当前市非禁现区散装水泥使用量(万吨)合计") + private BigDecimal bulkCementUsageTotal; + + @ApiModelProperty("生产预拌混凝土散装水泥使用量(万吨)") + private BigDecimal readyMixedConcreteBulkCementUsage; + @ApiModelProperty("当前市生产预拌混凝土散装水泥使用量(万吨)合计") + private BigDecimal readyMixedConcreteBulkCementUsageTotal; + + @ApiModelProperty("生产水泥制品散装水泥使用量(万立方米)") + private BigDecimal cementProductsBulkCementUsage; + @ApiModelProperty("当前市生产水泥制品散装水泥使用量(万立方米)合计") + private BigDecimal cementProductsBulkCementUsageTotal; + + @ApiModelProperty("非禁现区域散装水泥使用率(%)") + private BigDecimal bulkCementUsageRate; + @ApiModelProperty("当前市非禁现区域散装水泥使用率(%)合计") + private BigDecimal bulkCementUsageRateTotal; + + @ApiModelProperty("非禁现区域生产预拌混凝土产量(万立方米)") + private BigDecimal readyMixedConcreteOutput; + @ApiModelProperty("当前市非禁现区域生产预拌混凝土产量(万立方米)合计") + private BigDecimal readyMixedConcreteOutputTotal; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("单位负责人") + private String unitResponsiblePerson; + + @ApiModelProperty("填表人") + private String preparer; + + @ApiModelProperty("复核人") + private String reviewer; + + @ApiModelProperty("报出时间") + private LocalDateTime submissionDate; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("上报年份") + private Integer reportYear; + + @ApiModelProperty("审核信息ID") + private Long auditInfoId; + + @ApiModelProperty("是否为市合计数据") + private Boolean isCityTotalData; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private Long createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private Long updateBy; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemAuditInfoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemAuditInfoService.java new file mode 100644 index 0000000..da69bfb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemAuditInfoService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.service; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 散装水泥直报系统审核信息表 服务类 + *

+ * + * @author CMM + * @since 2023-09-28 + */ +public interface IBulkCementDirectReportSystemAuditInfoService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemAuditRecordService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemAuditRecordService.java new file mode 100644 index 0000000..3500109 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemAuditRecordService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.service; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 散装水泥直报系统审核记录表 服务类 + *

+ * + * @author CMM + * @since 2023-09-28 + */ +public interface IBulkCementDirectReportSystemAuditRecordService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemDataRelevanceService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemDataRelevanceService.java new file mode 100644 index 0000000..f8163a5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemDataRelevanceService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.service; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemDataRelevance; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 散装水泥直报系统市级上报数据关联表 服务类 + *

+ * + * @author CMM + * @since 2023-09-30 + */ +public interface IBulkCementDirectReportSystemDataRelevanceService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemIndexService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemIndexService.java new file mode 100644 index 0000000..ec6fdb5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemIndexService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.service; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemIndex; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 散装水泥直报系统指标数据 服务类 + *

+ * + * @author CMM + * @since 2023-09-28 + */ +public interface IBulkCementDirectReportSystemIndexService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemUniversalIndexService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemUniversalIndexService.java new file mode 100644 index 0000000..b7b388d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementDirectReportSystemUniversalIndexService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.service; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemUniversalIndex; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 散装水泥直报系统通用指标 服务类 + *

+ * + * @author CMM + * @since 2023-10-02 + */ +public interface IBulkCementDirectReportSystemUniversalIndexService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementLogisticFacilityStatisticAnnualReportService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementLogisticFacilityStatisticAnnualReportService.java new file mode 100644 index 0000000..b9e4c71 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementLogisticFacilityStatisticAnnualReportService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.service; + +import com.ningdatech.carapi.report.model.entity.BulkCementLogisticFacilityStatisticAnnualReport; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 散装水泥物流设施统计年报表 服务类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface IBulkCementLogisticFacilityStatisticAnnualReportService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementSupplyBulletinService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementSupplyBulletinService.java new file mode 100644 index 0000000..78d79e2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementSupplyBulletinService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.service; + +import com.ningdatech.carapi.report.model.entity.BulkCementSupplyBulletin; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 散装水泥供应量快报 服务类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface IBulkCementSupplyBulletinService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementThreeCityUsageBulletinService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementThreeCityUsageBulletinService.java new file mode 100644 index 0000000..12a9e76 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementThreeCityUsageBulletinService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.service; + +import com.ningdatech.carapi.report.model.entity.BulkCementThreeCityUsageBulletin; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 温州、台州、舟山使用量快报 服务类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface IBulkCementThreeCityUsageBulletinService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementTransferBulletinService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementTransferBulletinService.java new file mode 100644 index 0000000..5858a26 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IBulkCementTransferBulletinService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.service; + +import com.ningdatech.carapi.report.model.entity.BulkCementTransferBulletin; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 中转库进出量快报 服务类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface IBulkCementTransferBulletinService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IConcreteSupplyBulletinService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IConcreteSupplyBulletinService.java new file mode 100644 index 0000000..b862611 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IConcreteSupplyBulletinService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.service; + +import com.ningdatech.carapi.report.model.entity.ConcreteSupplyBulletin; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 混凝土供应量快报 服务类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface IConcreteSupplyBulletinService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IMaterialLogisticEquipmentStatisticAnnualReportService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IMaterialLogisticEquipmentStatisticAnnualReportService.java new file mode 100644 index 0000000..bd3d78f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IMaterialLogisticEquipmentStatisticAnnualReportService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.service; + +import com.ningdatech.carapi.report.model.entity.MaterialLogisticEquipmentStatisticAnnualReport; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 散装水泥、预拌混凝土、干混砂浆物流装备统计年报表 服务类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface IMaterialLogisticEquipmentStatisticAnnualReportService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IMortarSupplyBulletinService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IMortarSupplyBulletinService.java new file mode 100644 index 0000000..3e2f18c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/IMortarSupplyBulletinService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.service; + +import com.ningdatech.carapi.report.model.entity.MortarSupplyBulletin; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 砂浆供应量快报 服务类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface IMortarSupplyBulletinService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/INonProhibitedAreasBulkCementSalesUseService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/INonProhibitedAreasBulkCementSalesUseService.java new file mode 100644 index 0000000..a14e681 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/INonProhibitedAreasBulkCementSalesUseService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.report.service; + +import com.ningdatech.carapi.report.model.entity.NonProhibitedAreasBulkCementSalesUse; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 非禁现区域散装水泥销售使用情况统计年报表 服务类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +public interface INonProhibitedAreasBulkCementSalesUseService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemAuditInfoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemAuditInfoServiceImpl.java new file mode 100644 index 0000000..c3253fa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemAuditInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.report.service.impl; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditInfo; +import com.ningdatech.carapi.report.mapper.BulkCementDirectReportSystemAuditInfoMapper; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemAuditInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 散装水泥直报系统审核信息表 服务实现类 + *

+ * + * @author CMM + * @since 2023-09-28 + */ +@Service +public class BulkCementDirectReportSystemAuditInfoServiceImpl extends ServiceImpl implements IBulkCementDirectReportSystemAuditInfoService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemAuditRecordServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemAuditRecordServiceImpl.java new file mode 100644 index 0000000..01a0b79 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemAuditRecordServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.report.service.impl; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemAuditRecord; +import com.ningdatech.carapi.report.mapper.BulkCementDirectReportSystemAuditRecordMapper; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemAuditRecordService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 散装水泥直报系统审核记录表 服务实现类 + *

+ * + * @author CMM + * @since 2023-09-28 + */ +@Service +public class BulkCementDirectReportSystemAuditRecordServiceImpl extends ServiceImpl implements IBulkCementDirectReportSystemAuditRecordService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemDataRelevanceServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemDataRelevanceServiceImpl.java new file mode 100644 index 0000000..635d122 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemDataRelevanceServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.report.service.impl; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemDataRelevance; +import com.ningdatech.carapi.report.mapper.BulkCementDirectReportSystemDataRelevanceMapper; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemDataRelevanceService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 散装水泥直报系统市级上报数据关联表 服务实现类 + *

+ * + * @author CMM + * @since 2023-09-30 + */ +@Service +public class BulkCementDirectReportSystemDataRelevanceServiceImpl extends ServiceImpl implements IBulkCementDirectReportSystemDataRelevanceService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemIndexServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemIndexServiceImpl.java new file mode 100644 index 0000000..a075f63 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemIndexServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.report.service.impl; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemIndex; +import com.ningdatech.carapi.report.mapper.BulkCementDirectReportSystemIndexMapper; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemIndexService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 散装水泥直报系统指标数据 服务实现类 + *

+ * + * @author CMM + * @since 2023-09-28 + */ +@Service +public class BulkCementDirectReportSystemIndexServiceImpl extends ServiceImpl implements IBulkCementDirectReportSystemIndexService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemUniversalIndexServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemUniversalIndexServiceImpl.java new file mode 100644 index 0000000..8e74097 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementDirectReportSystemUniversalIndexServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.report.service.impl; + +import com.ningdatech.carapi.report.model.entity.BulkCementDirectReportSystemUniversalIndex; +import com.ningdatech.carapi.report.mapper.BulkCementDirectReportSystemUniversalIndexMapper; +import com.ningdatech.carapi.report.service.IBulkCementDirectReportSystemUniversalIndexService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 散装水泥直报系统通用指标 服务实现类 + *

+ * + * @author CMM + * @since 2023-10-02 + */ +@Service +public class BulkCementDirectReportSystemUniversalIndexServiceImpl extends ServiceImpl implements IBulkCementDirectReportSystemUniversalIndexService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementLogisticFacilityStatisticAnnualReportServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementLogisticFacilityStatisticAnnualReportServiceImpl.java new file mode 100644 index 0000000..fc83d26 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementLogisticFacilityStatisticAnnualReportServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.report.service.impl; + +import com.ningdatech.carapi.report.model.entity.BulkCementLogisticFacilityStatisticAnnualReport; +import com.ningdatech.carapi.report.mapper.BulkCementLogisticFacilityStatisticAnnualReportMapper; +import com.ningdatech.carapi.report.service.IBulkCementLogisticFacilityStatisticAnnualReportService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 散装水泥物流设施统计年报表 服务实现类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Service +public class BulkCementLogisticFacilityStatisticAnnualReportServiceImpl extends ServiceImpl implements IBulkCementLogisticFacilityStatisticAnnualReportService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementSupplyBulletinServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementSupplyBulletinServiceImpl.java new file mode 100644 index 0000000..b89ab95 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementSupplyBulletinServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.report.service.impl; + +import com.ningdatech.carapi.report.service.IBulkCementSupplyBulletinService; +import com.ningdatech.carapi.report.model.entity.BulkCementSupplyBulletin; +import com.ningdatech.carapi.report.mapper.BulkCementSupplyBulletinMapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 散装水泥供应量快报 服务实现类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Service +public class BulkCementSupplyBulletinServiceImpl extends ServiceImpl implements IBulkCementSupplyBulletinService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementThreeCityUsageBulletinServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementThreeCityUsageBulletinServiceImpl.java new file mode 100644 index 0000000..1231989 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementThreeCityUsageBulletinServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.report.service.impl; + +import com.ningdatech.carapi.report.model.entity.BulkCementThreeCityUsageBulletin; +import com.ningdatech.carapi.report.mapper.BulkCementThreeCityUsageBulletinMapper; +import com.ningdatech.carapi.report.service.IBulkCementThreeCityUsageBulletinService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 温州、台州、舟山使用量快报 服务实现类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Service +public class BulkCementThreeCityUsageBulletinServiceImpl extends ServiceImpl implements IBulkCementThreeCityUsageBulletinService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementTransferBulletinServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementTransferBulletinServiceImpl.java new file mode 100644 index 0000000..c008b05 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/BulkCementTransferBulletinServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.report.service.impl; + +import com.ningdatech.carapi.report.model.entity.BulkCementTransferBulletin; +import com.ningdatech.carapi.report.mapper.BulkCementTransferBulletinMapper; +import com.ningdatech.carapi.report.service.IBulkCementTransferBulletinService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 中转库进出量快报 服务实现类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Service +public class BulkCementTransferBulletinServiceImpl extends ServiceImpl implements IBulkCementTransferBulletinService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/ConcreteSupplyBulletinServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/ConcreteSupplyBulletinServiceImpl.java new file mode 100644 index 0000000..91eea74 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/ConcreteSupplyBulletinServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.report.service.impl; + +import com.ningdatech.carapi.report.model.entity.ConcreteSupplyBulletin; +import com.ningdatech.carapi.report.mapper.ConcreteSupplyBulletinMapper; +import com.ningdatech.carapi.report.service.IConcreteSupplyBulletinService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 混凝土供应量快报 服务实现类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Service +public class ConcreteSupplyBulletinServiceImpl extends ServiceImpl implements IConcreteSupplyBulletinService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/MaterialLogisticEquipmentStatisticAnnualReportServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/MaterialLogisticEquipmentStatisticAnnualReportServiceImpl.java new file mode 100644 index 0000000..f3c8b18 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/MaterialLogisticEquipmentStatisticAnnualReportServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.report.service.impl; + +import com.ningdatech.carapi.report.model.entity.MaterialLogisticEquipmentStatisticAnnualReport; +import com.ningdatech.carapi.report.mapper.MaterialLogisticEquipmentStatisticAnnualReportMapper; +import com.ningdatech.carapi.report.service.IMaterialLogisticEquipmentStatisticAnnualReportService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 散装水泥、预拌混凝土、干混砂浆物流装备统计年报表 服务实现类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Service +public class MaterialLogisticEquipmentStatisticAnnualReportServiceImpl extends ServiceImpl implements IMaterialLogisticEquipmentStatisticAnnualReportService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/MortarSupplyBulletinServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/MortarSupplyBulletinServiceImpl.java new file mode 100644 index 0000000..7c5a025 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/MortarSupplyBulletinServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.report.service.impl; + +import com.ningdatech.carapi.report.model.entity.MortarSupplyBulletin; +import com.ningdatech.carapi.report.mapper.MortarSupplyBulletinMapper; +import com.ningdatech.carapi.report.service.IMortarSupplyBulletinService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 砂浆供应量快报 服务实现类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Service +public class MortarSupplyBulletinServiceImpl extends ServiceImpl implements IMortarSupplyBulletinService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/NonProhibitedAreasBulkCementSalesUseServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/NonProhibitedAreasBulkCementSalesUseServiceImpl.java new file mode 100644 index 0000000..21ae644 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/report/service/impl/NonProhibitedAreasBulkCementSalesUseServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.report.service.impl; + +import com.ningdatech.carapi.report.model.entity.NonProhibitedAreasBulkCementSalesUse; +import com.ningdatech.carapi.report.mapper.NonProhibitedAreasBulkCementSalesUseMapper; +import com.ningdatech.carapi.report.service.INonProhibitedAreasBulkCementSalesUseService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 非禁现区域散装水泥销售使用情况统计年报表 服务实现类 + *

+ * + * @author CMM + * @since 2023-09-27 + */ +@Service +public class NonProhibitedAreasBulkCementSalesUseServiceImpl extends ServiceImpl implements INonProhibitedAreasBulkCementSalesUseService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/BicycleStatusTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/BicycleStatusTypeEnum.java new file mode 100644 index 0000000..da17ef9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/BicycleStatusTypeEnum.java @@ -0,0 +1,66 @@ +package com.ningdatech.carapi.road.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2022/12/20 14:10 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "BicycleStatusTypeEnum", description = "自行车情况-枚举") +public enum BicycleStatusTypeEnum { + /** + * 自行车情况 + */ + Bicycle_Collisions(1, "自行车碰撞"), + Motorway_Intrusion(2, "自行车误入高速公路"); + + 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 (BicycleStatusTypeEnum t : BicycleStatusTypeEnum.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 (BicycleStatusTypeEnum t : BicycleStatusTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/CongestionStatusTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/CongestionStatusTypeEnum.java new file mode 100644 index 0000000..2695ad8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/CongestionStatusTypeEnum.java @@ -0,0 +1,69 @@ +package com.ningdatech.carapi.road.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2022/12/20 14:10 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "CongestionStatusTypeEnum", description = "驾驶员异常情况-枚举") +public enum CongestionStatusTypeEnum { + /** + * 驾驶员异常情况 + */ + Heavy(1, "严重拥堵"), + Medium(2, "中度拥堵"), + Light(3, "轻度拥堵"); + + + + 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 (CongestionStatusTypeEnum t : CongestionStatusTypeEnum.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 (CongestionStatusTypeEnum t : CongestionStatusTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/DriverStatusTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/DriverStatusTypeEnum.java new file mode 100644 index 0000000..7e2b3a8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/DriverStatusTypeEnum.java @@ -0,0 +1,69 @@ +package com.ningdatech.carapi.road.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2022/12/20 14:10 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "DriverStatusTypeEnum", description = "驾驶员异常情况-枚举") +public enum DriverStatusTypeEnum { + /** + * 驾驶员异常情况 + */ + Fatigue(1, "疲劳驾驶"), + + Poor_habits(2, "不良驾驶习惯"); + + + + 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 (DriverStatusTypeEnum t : DriverStatusTypeEnum.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 (DriverStatusTypeEnum t : DriverStatusTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/OffenseStatusTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/OffenseStatusTypeEnum.java new file mode 100644 index 0000000..8f91a76 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/OffenseStatusTypeEnum.java @@ -0,0 +1,68 @@ +package com.ningdatech.carapi.road.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2022/12/20 14:10 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "OffenseStatusTypeEnum", description = "车辆违章情况-枚举") +public enum OffenseStatusTypeEnum { + /** + * 车辆违章情况 + */ + Running_a_red_light(1, "闯红灯"), + Crossing_the_line(2, "越线行驶"); + + + + 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 (OffenseStatusTypeEnum t : OffenseStatusTypeEnum.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 (OffenseStatusTypeEnum t : OffenseStatusTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/PedestrianStatusTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/PedestrianStatusTypeEnum.java new file mode 100644 index 0000000..adb54ed --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/PedestrianStatusTypeEnum.java @@ -0,0 +1,68 @@ +package com.ningdatech.carapi.road.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2022/12/20 14:10 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "PedestrianStatusTypeEnum", description = "行人情况-枚举") +public enum PedestrianStatusTypeEnum { + /** + * 行人情况 + */ + Trespass(1, "擅自进入"), + Traverse(2, "横穿道路"); + + + + 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 (PedestrianStatusTypeEnum t : PedestrianStatusTypeEnum.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 (PedestrianStatusTypeEnum t : PedestrianStatusTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/RoadBehaviorTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/RoadBehaviorTypeEnum.java new file mode 100644 index 0000000..c1d9363 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/RoadBehaviorTypeEnum.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.road.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2022/12/20 14:10 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "VehicleDangerLevelEnum", description = "车辆风险等级-枚举") +public enum RoadBehaviorTypeEnum { + /** + * 道路异常行为类型 + */ + DRIVER(1, "驾驶员异常"), + CAR(2, "车辆异常"), + ROAD(3,"道路异常"), + ENVIRONMENT(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 (RoadBehaviorTypeEnum t : RoadBehaviorTypeEnum.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 (RoadBehaviorTypeEnum t : RoadBehaviorTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/RoadStatusTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/RoadStatusTypeEnum.java new file mode 100644 index 0000000..aca8fdc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/RoadStatusTypeEnum.java @@ -0,0 +1,69 @@ +package com.ningdatech.carapi.road.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2022/12/20 14:10 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "RoadStatusTypeEnum", description = "道路情况-枚举") +public enum RoadStatusTypeEnum { + /** + * 道路情况 + */ + Damaged(1, "路面损坏"), + Debris(2, "路面有杂物"), + Slippery(3, "路面湿滑"); + + + + 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 (RoadStatusTypeEnum t : RoadStatusTypeEnum.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 (RoadStatusTypeEnum t : RoadStatusTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/SpeedStatusTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/SpeedStatusTypeEnum.java new file mode 100644 index 0000000..c6c922c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/SpeedStatusTypeEnum.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.road.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2022/12/20 14:10 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "SpeedStatusTypeEnum", description = "车辆速度情况-枚举") +public enum SpeedStatusTypeEnum { + /** + * 车辆速度情况 + */ + Over(1, "超速"), + Low(2, "低速"), + Stop(3, "停车"), + Reverse(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 (SpeedStatusTypeEnum t : SpeedStatusTypeEnum.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 (SpeedStatusTypeEnum t : SpeedStatusTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/VehicleStatusTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/VehicleStatusTypeEnum.java new file mode 100644 index 0000000..dc5bcba --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/VehicleStatusTypeEnum.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.road.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2022/12/20 14:10 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "VehicleStatusTypeEnum", description = "车辆情况-枚举") +public enum VehicleStatusTypeEnum { + /** + * 车辆情况 + */ + Vehicle_Collisions(1, "车辆碰撞"), + Overturn(2, "车辆翻车"), + Smoke_or_Fire(3, "冒烟/起火"), + Dropping(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 (VehicleStatusTypeEnum t : VehicleStatusTypeEnum.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 (VehicleStatusTypeEnum t : VehicleStatusTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/WeatherStatusTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/WeatherStatusTypeEnum.java new file mode 100644 index 0000000..8c3d59b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/constant/WeatherStatusTypeEnum.java @@ -0,0 +1,69 @@ +package com.ningdatech.carapi.road.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * @return + * @author CMM + * @since 2022/12/20 14:10 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "WeatherStatusTypeEnum", description = "天气情况-枚举") +public enum WeatherStatusTypeEnum { + /** + * 道路情况 + */ + Fog(1, "雾天"), + Rain(2, "雨天"), + Snow(3, "雪天"), + Wind(4, "大风"), + Sandstorm(5, "沙尘暴"); + + 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 (WeatherStatusTypeEnum t : WeatherStatusTypeEnum.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 (WeatherStatusTypeEnum t : WeatherStatusTypeEnum.values()) { + if (desc.equals(t.getDesc())) { + return t.code; + } + } + return null; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/controller/RoadMonitorController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/controller/RoadMonitorController.java new file mode 100644 index 0000000..a95c6f0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/controller/RoadMonitorController.java @@ -0,0 +1,84 @@ +package com.ningdatech.carapi.road.controller; + +import com.ningdatech.carapi.road.manage.RoadMonitorManage; +import com.ningdatech.carapi.road.model.req.RoadMonitorHandleReq; +import com.ningdatech.carapi.road.model.req.RoadMonitorReq; +import com.ningdatech.carapi.road.model.req.VideoDownloadReq; +import com.ningdatech.carapi.road.model.vo.ComprehensiveSituationVO; +import com.ningdatech.carapi.radar.model.vo.RadarTrafficFlowDataVO; +import com.ningdatech.carapi.road.model.vo.RoadDangerBehaviorVO; +import com.ningdatech.carapi.road.model.vo.VehicleGpsDataVO; +import com.ningdatech.log.annotation.WebLog; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/road-monitor") +@RequiredArgsConstructor +public class RoadMonitorController { + + private final RoadMonitorManage roadMonitorManage; + + @ApiOperation(value = "综合态势数据", notes = "综合态势数据") + @GetMapping("/get-comprehensive-situation-data") + public ComprehensiveSituationVO getComSitData(RoadMonitorReq req) { + return roadMonitorManage.getComSitData(req); + } + + @ApiOperation(value = "危险行为数据", notes = "危险行为数据") + @GetMapping("/get-road-danger-behavior-data") + public List getRoadDangerBehaviorData(RoadMonitorReq req) { + return roadMonitorManage.getRoadDangerBehaviorData(req); + } + + @ApiOperation(value = "违法违章与预警记录数据", notes = "违法违章与预警记录列表") + @GetMapping("/get-violation-warn-record-data") + public List getViolationWarnRecordData(RoadMonitorReq req) { + return roadMonitorManage.getViolationWarnRecordData(req); + } + + @ApiOperation(value = "危险行为数据处理", notes = "危险行为数据处理") + @PostMapping("/handle-violation-record") + public String handleViolationRecord(@Valid @RequestBody RoadMonitorHandleReq req) { + return roadMonitorManage.handleViolationRecord(req); + } + + @ApiOperation(value = "数据驾驶舱GPS数据", notes = "数据驾驶舱GPS数据") + @GetMapping("/vehicle-gps-data") + public List getVehicleGpsData(RoadMonitorReq req) { + return roadMonitorManage.getVehicleGpsData(req); + } + + + @GetMapping("/video/download") + @ApiOperation("视频下载") + @WebLog("视频下载") + public void videoDownload(VideoDownloadReq req, HttpServletResponse response){ + roadMonitorManage.videoDownload(req,response); + } + + @GetMapping("/picture/download") + @ApiOperation("图片下载") + @WebLog("图片下载") + public void pictureDownload(VideoDownloadReq req, HttpServletResponse response){ + roadMonitorManage.pictureDownload(req,response); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/manage/RoadMonitorManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/manage/RoadMonitorManage.java new file mode 100644 index 0000000..e6fb689 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/manage/RoadMonitorManage.java @@ -0,0 +1,582 @@ +package com.ningdatech.carapi.road.manage; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; + +import com.ningdatech.carapi.radar.helper.RadarDataHelper; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.homepage.entity.model.NdDataAccessGps; +import com.ningdatech.carapi.homepage.service.IDataAccessGpsService; +import com.ningdatech.carapi.road.constant.*; +import com.ningdatech.carapi.road.model.entity.RoadBehaviorAnalysis; +import com.ningdatech.carapi.road.model.req.RoadMonitorHandleReq; +import com.ningdatech.carapi.road.model.req.RoadMonitorReq; +import com.ningdatech.carapi.road.model.req.VideoDownloadReq; +import com.ningdatech.carapi.road.model.vo.ComprehensiveSituationVO; +import com.ningdatech.carapi.road.model.vo.RoadDangerBehaviorVO; +import com.ningdatech.carapi.road.model.vo.VehicleGpsDataVO; +import com.ningdatech.carapi.road.service.IRoadBehaviorAnalysisService; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; + +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import redis.clients.jedis.Jedis; + +/** + * @author CMM + * @since 2024/10/23 10:11 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class RoadMonitorManage { + + @Value("${spring.redis.host}") + private String redisHost; + + @Value("${spring.redis.port}") + private Integer redisPort; + + @Value("${spring.redis.password}") + private String redisPassword; + + private final IRoadBehaviorAnalysisService roadBehaviorAnalysisService; + private final IDataAccessGpsService dataAccessGpsService; + private final RadarDataHelper radarDataHelper; + + public ComprehensiveSituationVO getComSitData(RoadMonitorReq req) { + Jedis jedis = new Jedis(redisHost,redisPort); + jedis.auth(redisPassword); + // 隧道类型 1 黄山隧道、2 何里隧道、3 两条隧道的汇总(求平均) + Integer tunnel = req.getTunnel(); + // 根据传入的隧道类型 实时从缓存中获取算法分析的结果 + // 分区域分别计算4个指标的分值 比例按照1:1:1:1 加权计算道路安全指数 + // 黄山隧道 包含 1 黄山隧道东阳去向、2 黄山隧道东阳来向、3 黄山隧道义乌去向、4 黄山隧道义乌来向 + if (tunnel == 1){ + List regionList = Lists.newArrayList("1", "2", "3", "4"); + return getCollectDataVo(regionList,jedis,tunnel); + } + // 何里隧道 包含 5 何里隧道兰溪方向、6 何里隧道义乌方向 + else if (tunnel == 2) { + List regionList = Lists.newArrayList("5", "6"); + return getCollectDataVo(regionList,jedis,tunnel); + } else if (tunnel == 3) { + List regionList = Lists.newArrayList("1", "2", "3", "4", "5", "6"); + return getCollectDataVo(regionList, jedis, tunnel); + } + return new ComprehensiveSituationVO(); + } + + private ComprehensiveSituationVO getCollectDataVo(List regionList, Jedis jedis, Integer tunnel) { + ComprehensiveSituationVO vo = new ComprehensiveSituationVO(); + setDefaultScores(vo); + + // 使用Map来存储不同region对应的ComprehensiveSituationVO对象 + Map regionVoMap = new HashMap<>(); + // 初始化所有可能的ComprehensiveSituationVO对象并设置默认值 + ComprehensiveSituationVO hsDyGoVo; + regionVoMap.put("1", hsDyGoVo = new ComprehensiveSituationVO()); + setDefaultScores(hsDyGoVo); + ComprehensiveSituationVO hsDyComeVo; + regionVoMap.put("2", hsDyComeVo = new ComprehensiveSituationVO()); + setDefaultScores(hsDyComeVo); + ComprehensiveSituationVO hsYwGoVo; + regionVoMap.put("3", hsYwGoVo = new ComprehensiveSituationVO()); + setDefaultScores(hsYwGoVo); + ComprehensiveSituationVO hsYwComeVo; + regionVoMap.put("4", hsYwComeVo = new ComprehensiveSituationVO()); + setDefaultScores(hsYwComeVo); + ComprehensiveSituationVO hlLxVo; + regionVoMap.put("5", hlLxVo = new ComprehensiveSituationVO()); + setDefaultScores(hlLxVo); + ComprehensiveSituationVO hlYwVo; + regionVoMap.put("6", hlYwVo = new ComprehensiveSituationVO()); + setDefaultScores(hlYwVo); + + // 遍历regionList获取数据 + for (String region : regionList) { + ComprehensiveSituationVO currentVo = regionVoMap.get(region); + if (currentVo != null) { + switch (region) { + case "1": + getDataVo(TaskConstant.RedisKey.HS_DY_GO_REDIS_ALL_DATA_KEY, currentVo, jedis); + break; + case "2": + getDataVo(TaskConstant.RedisKey.HS_DY_COME_REDIS_ALL_DATA_KEY, currentVo, jedis); + break; + case "3": + getDataVo(TaskConstant.RedisKey.HS_YW_GO_REDIS_ALL_DATA_KEY, currentVo, jedis); + break; + case "4": + getDataVo(TaskConstant.RedisKey.HS_YW_COME_REDIS_ALL_DATA_KEY, currentVo, jedis); + break; + case "5": + getDataVo(TaskConstant.RedisKey.HL_LX_REDIS_ALL_DATA_KEY, currentVo, jedis); + break; + case "6": + getDataVo(TaskConstant.RedisKey.HL_YW_REDIS_ALL_DATA_KEY, currentVo, jedis); + break; + } + } + } + // 汇总数据 + if (tunnel == 1) { + List vos = Lists.newArrayList(hsDyGoVo, hsDyComeVo, hsYwGoVo, hsYwComeVo); + vo = averageScores(vos); + } else if (tunnel == 2) { + List vos = Lists.newArrayList(hlLxVo, hlYwVo); + vo = averageScores(vos); + } else if (tunnel == 3) { + List vos = Lists.newArrayList(hsDyGoVo, hsDyComeVo, hsYwGoVo, hsYwComeVo, hlLxVo, hlYwVo); + vo = averageScores(vos); + } + return vo; + } + + private ComprehensiveSituationVO averageScores(List vos) { + ComprehensiveSituationVO resultVo = new ComprehensiveSituationVO(); + setDefaultScores(resultVo); + if (CollUtil.isNotEmpty(vos)) { + int roadScore = 0, carScore = 0, driverScore = 0, environmentScore = 0, roadSafetyIndex = 0; + for (ComprehensiveSituationVO vo : vos) { + roadScore += vo.getRoadScore(); + carScore += vo.getCarScore(); + driverScore += vo.getDriverScore(); + environmentScore += vo.getEnvironmentScore(); + roadSafetyIndex += vo.getRoadSafetyIndex(); + } + resultVo.setRoadScore(roadScore / vos.size()); + resultVo.setCarScore(carScore / vos.size()); + resultVo.setDriverScore(driverScore / vos.size()); + resultVo.setEnvironmentScore(environmentScore / vos.size()); + resultVo.setRoadSafetyIndex(roadSafetyIndex / vos.size()); + return resultVo; + } + return resultVo; + } + + private void setDefaultScores(ComprehensiveSituationVO vo) { + vo.setRoadScore(100); + vo.setCarScore(100); + vo.setDriverScore(100); + vo.setEnvironmentScore(100); + vo.setRoadSafetyIndex(100); + } + + private void getDataVo(String dataKey, ComprehensiveSituationVO vo, Jedis jedis) { + String allData = jedis.get(dataKey); + + // 解析获取数据 + JSONObject jsonObject = JSON.parseObject(allData); + if (Objects.nonNull(jsonObject)) { + + JSONArray driver = jsonObject.getJSONArray("Driver"); + JSONArray speed = jsonObject.getJSONArray("Speed"); + JSONArray pedestrian = jsonObject.getJSONArray("Pedestrian"); + JSONArray road = jsonObject.getJSONArray("Road"); + JSONArray congestion = jsonObject.getJSONArray("Congestion"); + JSONArray weather = jsonObject.getJSONArray("Weather"); + JSONArray vehicle = jsonObject.getJSONArray("Vehicle"); + JSONArray bicycle = jsonObject.getJSONArray("Bicycle"); + JSONArray offense = jsonObject.getJSONArray("Offense"); + + String time = jsonObject.getString("Time"); + String region = jsonObject.getString("Region"); + + // 计算道路评分: + // Pedestrian(Trespass -50、Traverse -50)、 + // Road(Damaged -10、Debris -10、Slippery -5)、 + // Congestion(Heavy -20、Medium -10、Light -5)、 + // Bicycle(Bicycle_Collisions -50、Motorway_Intrusion -50) + int roadScore = vo.getRoadScore(); + if (CollUtil.isNotEmpty(pedestrian)){ + for (int i = 0; i < driver.size(); i++) { + String driverString = driver.getString(i); + if (driverString.contains("habits")) { + driverString = "Poor_habits"; + } + DriverStatusTypeEnum driverStatusTypeEnum = DriverStatusTypeEnum.valueOf(driverString); + switch (driverStatusTypeEnum){ + case Fatigue: + case Poor_habits: + roadScore -= 50; + break; + } + } + } + if (CollUtil.isNotEmpty(road)){ + for (int i = 0; i < road.size(); i++) { + String roadString = road.getString(i); + RoadStatusTypeEnum roadStatusTypeEnum = RoadStatusTypeEnum.valueOf(roadString); + switch (roadStatusTypeEnum){ + case Damaged: + roadScore -= 10; + break; + case Debris: + roadScore -= 10; + break; + case Slippery: + roadScore -= 5; + break; + } + } + } + if (CollUtil.isNotEmpty(congestion)){ + for (int i = 0; i < congestion.size(); i++) { + String congestionString = congestion.getString(i); + CongestionStatusTypeEnum congestionStatusTypeEnum = CongestionStatusTypeEnum.valueOf(congestionString); + switch (congestionStatusTypeEnum){ + case Heavy: + roadScore -= 20; + break; + case Medium: + roadScore -= 10; + break; + case Light: + roadScore -= 5; + break; + } + } + } + if (CollUtil.isNotEmpty(bicycle)){ + for (int i = 0; i < bicycle.size(); i++) { + String bicycleString = bicycle.getString(i); + if (bicycleString.contains("Collision")){ + bicycleString = "Bicycle_Collisions"; + } else if (bicycleString.contains("Motorway")) { + bicycleString = "Motorway_Intrusion"; + } + BicycleStatusTypeEnum bicycleStatusTypeEnum = BicycleStatusTypeEnum.valueOf(bicycleString); + switch (bicycleStatusTypeEnum){ + case Bicycle_Collisions: + case Motorway_Intrusion: + roadScore -= 50; + break; + } + } + } + vo.setRoadScore(roadScore); + + // 计算车辆评分 + // Speed(Over -5、Low -5、Stop -20、Reverse -50) + // Vehicle(Vehicle_Collisions -50、Overturn -50、Smoke_or_Fire -50、Dropping -10) + // Offense(Running_a_red_light -10、Crossing_the_line -10) + int carScore = vo.getCarScore(); + if (CollUtil.isNotEmpty(speed)){ + for (int i = 0; i < speed.size(); i++) { + String speedString = speed.getString(i); + SpeedStatusTypeEnum speedStatusTypeEnum = SpeedStatusTypeEnum.valueOf(speedString); + switch (speedStatusTypeEnum){ + case Over: + case Low: + carScore -= 5; + break; + case Stop: + carScore -= 20; + break; + case Reverse: + carScore -= 50; + break; + } + } + } + if (CollUtil.isNotEmpty(vehicle)){ + for (int i = 0; i < vehicle.size(); i++) { + String vehicleString = vehicle.getString(i); + if (vehicleString.contains("Collision")){ + vehicleString = "Vehicle_Collisions"; + } else if (vehicleString.contains("Smoke")) { + vehicleString = "Smoke_or_Fire"; + } + VehicleStatusTypeEnum vehicleStatusTypeEnum = VehicleStatusTypeEnum.valueOf(vehicleString); + switch (vehicleStatusTypeEnum){ + case Vehicle_Collisions: + case Overturn: + case Smoke_or_Fire: + carScore -= 50; + break; + case Dropping: + carScore -= 10; + break; + } + } + } + if (CollUtil.isNotEmpty(offense)){ + for (int i = 0; i < offense.size(); i++) { + String offenseString = offense.getString(i); + if (offenseString.contains("red")){ + offenseString = "Running_a_red_light"; + } else if (offenseString.contains("line")) { + offenseString = "Crossing_the_line"; + } + OffenseStatusTypeEnum offenseStatusTypeEnum = OffenseStatusTypeEnum.valueOf(offenseString); + switch (offenseStatusTypeEnum){ + case Running_a_red_light: + case Crossing_the_line: + carScore -= 10; + break; + } + } + } + vo.setCarScore(carScore); + + // 计算驾驶员评分 + // Driver(Fatigue -5、Poor_habits -5) + int driverScore = vo.getDriverScore(); + if (CollUtil.isNotEmpty(driver)){ + for (int i = 0; i < driver.size(); i++) { + String driverString = driver.getString(i); + if (driverString.contains("habits")) { + driverString = "Poor_habits"; + } + DriverStatusTypeEnum driverStatusTypeEnum = DriverStatusTypeEnum.valueOf(driverString); + switch (driverStatusTypeEnum){ + case Fatigue: + case Poor_habits: + driverScore -= 5; + break; + } + } + } + vo.setDriverScore(driverScore); + + // 计算环境评分 + // Weather(Fog -10、Rain -10、Snow -10、Wind -10、Sandstorm -10) + int environmentScore = vo.getEnvironmentScore(); + if (CollUtil.isNotEmpty(weather)){ + for (int i = 0; i < weather.size(); i++) { + String weatherString = weather.getString(i); + WeatherStatusTypeEnum weatherStatusTypeEnum = WeatherStatusTypeEnum.valueOf(weatherString); + switch (weatherStatusTypeEnum){ + case Fog: + case Rain: + case Snow: + case Wind: + case Sandstorm: + environmentScore -= 10; + break; + } + } + } + vo.setEnvironmentScore(environmentScore); + + // 计算道路安全指数 按照1:1:1:1的比例计算 + int roadSafetyIndex = (roadScore + carScore + driverScore + environmentScore) / 4; + vo.setRoadSafetyIndex(roadSafetyIndex); + } + } + + public List getRoadDangerBehaviorData(RoadMonitorReq req) { + List regionList = req.getRegionList(); + // 从列表中查询数据 + List list = roadBehaviorAnalysisService.list(Wrappers.lambdaQuery(RoadBehaviorAnalysis.class) + .in(RoadBehaviorAnalysis::getRegion, regionList) + .like(StringUtils.isNoneBlank(req.getBehavior()),RoadBehaviorAnalysis::getBehavior, req.getBehavior()) + .eq(Objects.nonNull(req.getType()),RoadBehaviorAnalysis::getType, req.getType()) + .ge(Objects.nonNull(req.getStartTime()), RoadBehaviorAnalysis::getBehaviorTime, req.getStartTime()) + .le(Objects.nonNull(req.getEndTime()), RoadBehaviorAnalysis::getBehaviorTime, req.getEndTime()) + .eq(Objects.nonNull(req.getIsWarn()),RoadBehaviorAnalysis::getIsWarn, req.getIsWarn()) + .orderByDesc(RoadBehaviorAnalysis::getBehaviorTime)); + if (CollUtil.isEmpty(list)){ + return Collections.emptyList(); + } + return list.stream().map(roadBehaviorAnalysis -> { + RoadDangerBehaviorVO vo = new RoadDangerBehaviorVO(); + vo.setId(roadBehaviorAnalysis.getId()); + vo.setRecord(roadBehaviorAnalysis.getBehavior()); + vo.setRecordCode(roadBehaviorAnalysis.getBehaviorCode()); + vo.setRecordTime(roadBehaviorAnalysis.getBehaviorTime()); + vo.setRecordType(RoadBehaviorTypeEnum.getDescByCode(roadBehaviorAnalysis.getType())); + vo.setRegion(roadBehaviorAnalysis.getRegion()); + vo.setPicturePath(roadBehaviorAnalysis.getPicturePath()); + vo.setOverspeedPositionInfo(roadBehaviorAnalysis.getOverspeedPositionInfo()); + vo.setIsWarn(roadBehaviorAnalysis.getIsWarn()); + vo.setIsHandled(roadBehaviorAnalysis.getIsHandled()); + return vo; + }).collect(Collectors.toList()); + } + + public void videoDownload(VideoDownloadReq req, HttpServletResponse response) { + + String videoType = req.getVideoType(); + String videoOrder = req.getVideoOrder(); + + File directory = new File(""); + // 拼接对应的filePath + String filePath = null; + // 设置响应内容类型 + // 对于MP4文件 + response.setContentType("video/mp4"); + // 隧道回放视频 + if (StringUtils.equals("1", videoType)){ + filePath = directory.getAbsolutePath() + File.separator + DefValConstants.SUI_DAO_PLAY_BACK + File.separator + videoOrder + ".mp4"; + } + // 驾驶员监控实时视频 + else if (StringUtils.equals("2", videoType)) { + filePath = directory.getAbsolutePath() + File.separator + DefValConstants.DRIVER_REAL_TIME_PLAY_BACK + File.separator + videoOrder + ".mp4"; + } + // 驾驶员监控远程回放 + else if (StringUtils.equals("3", videoType)) { + filePath = directory.getAbsolutePath() + File.separator + DefValConstants.DRIVER_REMOTE_PLAY_BACK + File.separator + videoOrder + ".mp4"; + } + + assert filePath != null; + File file = new File(filePath); + + // 设置文件名(将显示在下载对话框中) + response.setHeader("Content-Disposition", "inline;"); + // 设置文件大小,这样浏览器可以显示下载进度 + response.setContentLengthLong(file.length()); + + // 设置缓存控制头 + response.setHeader("Cache-Control", "public, max-age=31536000"); + + try { + FileInputStream fileInputStream = new FileInputStream(file); + ServletOutputStream servletOutputStream = response.getOutputStream(); + + byte[] buffer = new byte[4096]; + int bytesRead; + while ((bytesRead = fileInputStream.read(buffer)) != -1) { + servletOutputStream.write(buffer, 0, bytesRead); + } + fileInputStream.close(); + servletOutputStream.close(); + } catch (IOException e) { + throw new BizException("文件下载失败! {}",e); + } + } + + public List getViolationWarnRecordData(RoadMonitorReq req) { + // 从列表中查询数据 + List list = roadBehaviorAnalysisService.list(Wrappers.lambdaQuery(RoadBehaviorAnalysis.class) + // 不传类型返回所有需预警数据 + .eq(Objects.nonNull(req.getType()), RoadBehaviorAnalysis::getType, req.getType()) + // 所选隧道包含区域 + .in(RoadBehaviorAnalysis::getRegion, req.getRegionList()) + // 需要预警的数据 + .eq(RoadBehaviorAnalysis::getIsWarn, Boolean.TRUE) + // 查看某个具体区域的数据 + .eq(Objects.nonNull(req.getRegion()),RoadBehaviorAnalysis::getRegion, req.getRegion()) + .orderByDesc(RoadBehaviorAnalysis::getBehaviorTime)); + if (CollUtil.isEmpty(list)){ + return Collections.emptyList(); + } + return list.stream().map(roadBehaviorAnalysis -> { + RoadDangerBehaviorVO vo = new RoadDangerBehaviorVO(); + vo.setId(roadBehaviorAnalysis.getId()); + vo.setRecord(roadBehaviorAnalysis.getBehavior()); + vo.setRecordCode(roadBehaviorAnalysis.getBehaviorCode()); + vo.setRecordTime(roadBehaviorAnalysis.getBehaviorTime()); + vo.setRecordType(RoadBehaviorTypeEnum.getDescByCode(roadBehaviorAnalysis.getType())); + vo.setRegion(roadBehaviorAnalysis.getRegion()); + vo.setPicturePath(roadBehaviorAnalysis.getPicturePath()); + vo.setOverspeedPositionInfo(roadBehaviorAnalysis.getOverspeedPositionInfo()); + vo.setIsWarn(roadBehaviorAnalysis.getIsWarn()); + vo.setIsHandled(roadBehaviorAnalysis.getIsHandled()); + return vo; + }).collect(Collectors.toList()); + } + + @Transactional(rollbackFor = Exception.class) + public String handleViolationRecord(RoadMonitorHandleReq req) { + Long id = req.getId(); + // 获取危险行为数据 + RoadBehaviorAnalysis roadBehaviorAnalysis = roadBehaviorAnalysisService.getById(id); + if (Objects.isNull(roadBehaviorAnalysis)){ + throw new BizException("数据不存在!"); + } + if (Boolean.TRUE.equals(roadBehaviorAnalysis.getIsHandled())){ + throw new BizException("数据已处理!"); + } + // 更新对应数据状态为已处理 + roadBehaviorAnalysis.setIsHandled(Boolean.TRUE); + if (roadBehaviorAnalysisService.updateById(roadBehaviorAnalysis)) { + return "处理成功!"; + }else { + throw new BizException("处理失败!"); + } + } + + public List getVehicleGpsData(RoadMonitorReq req) { + // TODO 暂时不确定隧道的经纬度范围 确定后 需要根据查询的隧道 筛选出对应经纬度范围内的GPS数据 目前返回全部的 + // 只查询最新的5分钟内的数据 + LocalDateTime startTime = LocalDateTime.now().minusMinutes(5); + LocalDateTime endTime = LocalDateTime.now(); + List data = dataAccessGpsService.list(Wrappers.lambdaQuery(NdDataAccessGps.class) + .ge(NdDataAccessGps::getUpdateTime, startTime).le(NdDataAccessGps::getUpdateTime, endTime) + .select(NdDataAccessGps::getCarLongitude, NdDataAccessGps::getCarLatitude, NdDataAccessGps::getCarPlate, + NdDataAccessGps::getCarVelocity, NdDataAccessGps::getCarDirection, NdDataAccessGps::getUpdateTime)); + log.info("最近5分钟 查询到{}条数据", data.size()); + // 如果最近15分钟没有数据(GPS数据不更新了) 取表中最新的5000条数据 + if (CollUtil.isEmpty(data)){ + data = dataAccessGpsService.list(Wrappers.lambdaQuery(NdDataAccessGps.class) + .select(NdDataAccessGps::getCarLongitude, NdDataAccessGps::getCarLatitude, + NdDataAccessGps::getCarPlate,NdDataAccessGps::getCarVelocity, + NdDataAccessGps::getCarDirection, NdDataAccessGps::getUpdateTime) + .orderByDesc(NdDataAccessGps::getUpdateTime).last("limit 5000")); + } + return data.stream().map(d -> { + VehicleGpsDataVO vo = new VehicleGpsDataVO(); + vo.setCarPlate(d.getCarPlate()); + vo.setCarVelocity(d.getCarVelocity()); + vo.setCarDirection(d.getCarDirection()); + vo.setLongitude(d.getCarLongitude()); + vo.setLatitude(d.getCarLatitude()); + vo.setUpdateTime(d.getUpdateTime()); + return vo; + }).collect(Collectors.toList()); + } + + public void pictureDownload(VideoDownloadReq req, HttpServletResponse response) { + + String picturePath = req.getPicturePath(); + // 将路径中的文件分割符替换为系统能够识别的分隔符 + picturePath = picturePath.replace("\\", File.separator); + picturePath = picturePath.replace("/", File.separator); + + File file = new File(picturePath); + + // 设置文件名(将显示在下载对话框中) + response.setHeader("Content-Disposition", "inline;"); + // 设置文件大小,这样浏览器可以显示下载进度 + response.setContentLengthLong(file.length()); + + // 设置缓存控制头 + response.setHeader("Cache-Control", "public, max-age=31536000"); + + try { + FileInputStream fileInputStream = new FileInputStream(file); + ServletOutputStream servletOutputStream = response.getOutputStream(); + + byte[] buffer = new byte[4096]; + int bytesRead; + while ((bytesRead = fileInputStream.read(buffer)) != -1) { + servletOutputStream.write(buffer, 0, bytesRead); + } + fileInputStream.close(); + servletOutputStream.close(); + } catch (IOException e) { + throw new BizException("文件下载失败! {}",e); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/mapper/RoadBehaviorAnalysisMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/mapper/RoadBehaviorAnalysisMapper.java new file mode 100644 index 0000000..3fe96fe --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/mapper/RoadBehaviorAnalysisMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.road.mapper; + +import com.ningdatech.carapi.road.model.entity.RoadBehaviorAnalysis; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2024-10-22 + */ +public interface RoadBehaviorAnalysisMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/mapper/RoadBehaviorAnalysisMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/mapper/RoadBehaviorAnalysisMapper.xml new file mode 100644 index 0000000..33857fb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/mapper/RoadBehaviorAnalysisMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/OverspeedPositionInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/OverspeedPositionInfo.java new file mode 100644 index 0000000..d9f1989 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/OverspeedPositionInfo.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.road.model; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @since 2024/11/08 10:55 + */ +@Data +public class OverspeedPositionInfo { + + @ApiModelProperty("经度") + private String longitude; + @ApiModelProperty("纬度") + private String latitude; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/entity/RoadBehaviorAnalysis.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/entity/RoadBehaviorAnalysis.java new file mode 100644 index 0000000..9306d1e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/entity/RoadBehaviorAnalysis.java @@ -0,0 +1,63 @@ +package com.ningdatech.carapi.road.model.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; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2024-10-22 + */ +@TableName("nd_road_behavior_analysis") +@ApiModel(value = "RoadBehaviorAnalysis对象", description = "") +@Data +public class RoadBehaviorAnalysis implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("异常行为类型 1 驾驶员异常 2 车辆异常 3 道路异常 4 环境异常") + private Integer type; + + @ApiModelProperty("异常行为描述") + private String behavior; + + @ApiModelProperty("异常行为码") + private String behaviorCode; + + @ApiModelProperty("异常行为时间") + private LocalDateTime behaviorTime; + + @ApiModelProperty("区域 1 黄山隧道东阳去向、2 黄山隧道东阳来向、3 黄山隧道义乌去向、4 黄山隧道义乌来向、5 何里隧道兰溪方向、6 何里隧道义乌方向") + private String region; + + @ApiModelProperty("异常记录图片路径") + private String picturePath; + + @ApiModelProperty("超速异常记录位置信息") + private String overspeedPositionInfo; + + @ApiModelProperty("是否需要预警") + private Boolean isWarn = Boolean.FALSE; + + @ApiModelProperty("是否处理") + private Boolean isHandled = Boolean.FALSE; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/req/RoadMonitorHandleReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/req/RoadMonitorHandleReq.java new file mode 100644 index 0000000..9d3e16b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/req/RoadMonitorHandleReq.java @@ -0,0 +1,26 @@ +package com.ningdatech.carapi.road.model.req; + +import java.time.LocalDateTime; +import java.util.List; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @author CMM + * @date 2024/10/23 17:53 + * / + * /** + * @since 2024/10/23 17:53 + */ +@Data +public class RoadMonitorHandleReq { + + @ApiModelProperty("记录ID") + @NotNull(message = "记录ID不能为空!") + private Long id; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/req/RoadMonitorReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/req/RoadMonitorReq.java new file mode 100644 index 0000000..4fbdb8b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/req/RoadMonitorReq.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.road.model.req; + +import java.time.LocalDateTime; +import java.util.List; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; + +/** + * @author CMM + * @author CMM + * @date 2024/10/23 17:53 + * / + * /** + * @since 2024/10/23 17:53 + */ +@Data +public class RoadMonitorReq { + + @ApiModelProperty("区域 1 黄山隧道东阳去向、2 黄山隧道东阳来向、3 黄山隧道义乌去向、4 黄山隧道义乌来向、5 何里隧道兰溪方向、6 何里隧道义乌方向") + private String region; + + @ApiModelProperty("隧道 1 黄山隧道、2 何里隧道、3 两条隧道汇总") + private Integer tunnel; + + @ApiModelProperty("隧道包含的区域 列表") + @NotEmpty(message = "区域不能为空") + private List regionList; + + @ApiModelProperty("行为类型 1 驾驶员、2 车辆、3 道路、4 环境") + private Integer type; + + @ApiModelProperty("危险行为") + private String behavior; + + @ApiModelProperty("开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + private LocalDateTime endTime; + + @ApiModelProperty("是否预警") + private Boolean isWarn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/req/VideoDownloadReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/req/VideoDownloadReq.java new file mode 100644 index 0000000..9b463ff --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/req/VideoDownloadReq.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.road.model.req; + +import javax.validation.constraints.NotBlank; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author CMM + * @author CMM + * @date 2024/10/23 17:53 + * / + * /** + * @since 2024/10/23 17:53 + */ +@Data +public class VideoDownloadReq { + + @ApiModelProperty("1 隧道回放 2 驾驶员监控实时视频 3 驾驶员监控") + private String videoType; + + @ApiModelProperty("1 2 3 4 5 6") + private String videoOrder; + + @ApiModelProperty("图片路径") + private String picturePath; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/vo/ComprehensiveSituationVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/vo/ComprehensiveSituationVO.java new file mode 100644 index 0000000..693d789 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/vo/ComprehensiveSituationVO.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.road.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author CMM + * @since 2024/10/23 10:49 + */ +@Data +@ApiModel(description = "道路安全监综合态势计数据-VO") +@NoArgsConstructor +@AllArgsConstructor +public class ComprehensiveSituationVO { + + @ApiModelProperty("道路安全指数") + private Integer roadSafetyIndex; + + @ApiModelProperty("道路评分") + private Integer roadScore; + + @ApiModelProperty("车辆评分") + private Integer carScore; + + @ApiModelProperty("驾驶员评分") + private Integer driverScore; + + @ApiModelProperty("环境评分") + private Integer environmentScore; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/vo/RoadDangerBehaviorVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/vo/RoadDangerBehaviorVO.java new file mode 100644 index 0000000..42d7380 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/vo/RoadDangerBehaviorVO.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.road.model.vo; + +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author CMM + * @since 2024/10/23 10:49 + */ +@Data +@ApiModel(description = "道路安全监综合态势计数据-VO") +@NoArgsConstructor +@AllArgsConstructor +public class RoadDangerBehaviorVO { + + @ApiModelProperty("危险行为ID") + private Long id; + + @ApiModelProperty("道路异常分析记录") + private String record; + + @ApiModelProperty("道路异常分析记录Code") + private String recordCode; + + @ApiModelProperty("道路异常分析类型") + private String recordType; + + @ApiModelProperty("异常记录时间") + private LocalDateTime recordTime; + + @ApiModelProperty("异常记录区域") + private String region; + + @ApiModelProperty("异常记录图片路径") + private String picturePath; + + @ApiModelProperty("异常记录视频路径") + private String videoPath; + + @ApiModelProperty("超速异常记录位置信息") + private String overspeedPositionInfo; + + @ApiModelProperty("是否需要预警") + private Boolean isWarn = Boolean.FALSE; + + @ApiModelProperty("是否处理") + private Boolean isHandled = Boolean.FALSE; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/vo/VehicleGpsDataVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/vo/VehicleGpsDataVO.java new file mode 100644 index 0000000..030c408 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/vo/VehicleGpsDataVO.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.road.model.vo; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author CMM + * @since 2024/10/23 10:49 + */ +@Data +@ApiModel(description = "数据驾驶舱车辆GPS数据-VO") +@NoArgsConstructor +@AllArgsConstructor +public class VehicleGpsDataVO { + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车速") + private BigDecimal carVelocity; + + @ApiModelProperty("车辆方向") + private BigDecimal carDirection; + + @ApiModelProperty("上报时间") + private LocalDateTime updateTime; + + @ApiModelProperty("经度") + private BigDecimal longitude; + + @ApiModelProperty("纬度") + private BigDecimal latitude; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/service/IRoadBehaviorAnalysisService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/service/IRoadBehaviorAnalysisService.java new file mode 100644 index 0000000..6c8e614 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/service/IRoadBehaviorAnalysisService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.road.service; + +import com.ningdatech.carapi.road.model.entity.RoadBehaviorAnalysis; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2024-10-22 + */ +public interface IRoadBehaviorAnalysisService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/service/impl/RoadBehaviorAnalysisServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/service/impl/RoadBehaviorAnalysisServiceImpl.java new file mode 100644 index 0000000..6e44ebc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/service/impl/RoadBehaviorAnalysisServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.road.service.impl; + +import com.ningdatech.carapi.road.model.entity.RoadBehaviorAnalysis; +import com.ningdatech.carapi.road.mapper.RoadBehaviorAnalysisMapper; +import com.ningdatech.carapi.road.service.IRoadBehaviorAnalysisService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2024-10-22 + */ +@Service +public class RoadBehaviorAnalysisServiceImpl extends ServiceImpl implements IRoadBehaviorAnalysisService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/task/RoadMonitorDataPullTask.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/task/RoadMonitorDataPullTask.java new file mode 100644 index 0000000..c473f61 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/road/task/RoadMonitorDataPullTask.java @@ -0,0 +1,470 @@ +package com.ningdatech.carapi.road.task; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import cn.hutool.core.map.MapUtil; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.road.model.OverspeedPositionInfo; +import org.apache.commons.compress.utils.Lists; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.road.constant.*; +import com.ningdatech.carapi.road.model.entity.RoadBehaviorAnalysis; +import com.ningdatech.carapi.road.service.IRoadBehaviorAnalysisService; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.date.StopWatch; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import redis.clients.jedis.Jedis; + +/** + * @author CMM + * 道路监控实时算法分析数据拉取定时任务 + * @since 2024/10/12 10:39 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class RoadMonitorDataPullTask { + + @Value("${spring.redis.host}") + private String redisHost; + + @Value("${spring.redis.port}") + private Integer redisPort; + + @Value("${spring.redis.password}") + private String redisPassword; + + @Value("${task.switch.is-open}") + private boolean flag; + + private final IRoadBehaviorAnalysisService roadBehaviorAnalysisService; + + // 定时更新道路监控实时算法分析数据 每10分钟一次 + @Scheduled(cron = "0 */10 * * * ?") + public void doTask() { + if (!flag){ + log.info("道路监控实时算法分析数据拉取定时任务未开启!"); + return; + } + log.info("=========== 道路监控实时算法分析数据拉取 ======== 任务开始"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + List dataList; + Map REDIS_KEY_REGION_MAP = getRedisKeyRegionMap(); + try (Jedis jedis = new Jedis(redisHost, redisPort)) { + jedis.auth(redisPassword); + dataList = REDIS_KEY_REGION_MAP.keySet().stream().map(jedis::get) + .filter(StringUtils::isNotBlank) + .collect(Collectors.toList()); + } + if (CollUtil.isNotEmpty(dataList)) { + for (String data : dataList) { + // 解析获取数据 + JSONObject jsonObject = JSON.parseObject(data); + String time = jsonObject.getString("Time"); + String region = jsonObject.getString("Region"); + + // 转换为LocalDateTime类型 + LocalDateTime createTime = LocalDateTimeUtil.parse(time, NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + + // 根据时间 判断数据库中是否存在 不存在 入库 + // 获取当前区域当前数据产生时间 在数据库中是否存入过 + List list = checkDataExists(createTime, region); + + // 如果没有存入过 + if (CollUtil.isEmpty(list)) { + List saveDataList = assembleData(jsonObject); + if (CollUtil.isNotEmpty(saveDataList)){ + log.info("=========== 保存数据条数:{}",saveDataList.size()); + roadBehaviorAnalysisService.saveBatch(saveDataList); + log.info("=========== 保存成功"); + } + } + } + } + stopWatch.stop(); + log.info("=========== 道路监控实时算法分析数据拉取 ======== 任务结束 {}s",stopWatch.getTotalTimeSeconds()); + } + + @FunctionalInterface + interface DataAssembler { + void assemble(JSONArray dataArray, List saveDataList, JSONObject jsonObject); + } + private List assembleData(JSONObject jsonObject) { + List saveDataList = Lists.newArrayList(); + // 定义一个映射,关联JSON数组的键和对应的数据处理方法 + Map assemblerMap = new HashMap<>(); + assemblerMap.put("Driver", this::assemblyDriverData); + assemblerMap.put("Speed", this::assemblySpeedData); + assemblerMap.put("Pedestrian", this::assemblyPedestrianData); + assemblerMap.put("Road", this::assemblyRoadData); + assemblerMap.put("Congestion", this::assemblyCongestionData); + assemblerMap.put("Weather", this::assemblyWeatherData); + assemblerMap.put("Vehicle", this::assemblyVehicleData); + assemblerMap.put("Bicycle", this::assemblyBicycleData); + assemblerMap.put("Offense", this::assemblyOffenseData); + // 遍历映射,处理每个数据集 + assemblerMap.forEach((key, assembler) -> { + JSONArray dataArray = jsonObject.getJSONArray(key); + if (dataArray != null && !dataArray.isEmpty()) { + assembler.assemble(dataArray, saveDataList, jsonObject); + } + }); + return saveDataList; + } + + private List checkDataExists(LocalDateTime createTime, String region) { + return roadBehaviorAnalysisService.list(Wrappers.lambdaQuery(RoadBehaviorAnalysis.class) + .eq(RoadBehaviorAnalysis::getBehaviorTime, createTime) + .eq(RoadBehaviorAnalysis::getRegion, region)); + } + + private static Map getRedisKeyRegionMap() { + Map REDIS_KEY_REGION_MAP = MapUtil.newHashMap(); + REDIS_KEY_REGION_MAP.put(TaskConstant.RedisKey.HS_DY_GO_REDIS_ALL_DATA_KEY, "1"); + REDIS_KEY_REGION_MAP.put(TaskConstant.RedisKey.HS_DY_COME_REDIS_ALL_DATA_KEY, "2"); + REDIS_KEY_REGION_MAP.put(TaskConstant.RedisKey.HS_YW_GO_REDIS_ALL_DATA_KEY, "3"); + REDIS_KEY_REGION_MAP.put(TaskConstant.RedisKey.HS_YW_COME_REDIS_ALL_DATA_KEY, "4"); + REDIS_KEY_REGION_MAP.put(TaskConstant.RedisKey.HL_LX_REDIS_ALL_DATA_KEY, "5"); + REDIS_KEY_REGION_MAP.put(TaskConstant.RedisKey.HL_YW_REDIS_ALL_DATA_KEY, "6"); + return REDIS_KEY_REGION_MAP; + } + + /** + * 车辆违章情况 + * @param offense \ + * @param saveDataList \ + * @param jsonObject \ + */ + private void assemblyOffenseData(JSONArray offense, List saveDataList, JSONObject jsonObject) { + StringBuilder behaviorBuilder = new StringBuilder(); + StringBuilder behaviorCodeBuilder = new StringBuilder(); + for (int i = 0; i < offense.size(); i++) { + String offenseString = offense.getString(i); + if (offenseString.contains("red")){ + offenseString = "Running_a_red_light"; + } else if (offenseString.contains("line")) { + offenseString = "Crossing_the_line"; + } + OffenseStatusTypeEnum offenseStatusTypeEnum = OffenseStatusTypeEnum.valueOf(offenseString); + behaviorBuilder.append(offenseStatusTypeEnum.getDesc()); + if (i != offense.size() - 1) { + behaviorBuilder.append(","); + } + behaviorCodeBuilder.append(offenseStatusTypeEnum.name()); + if (i != offense.size() - 1) { + behaviorCodeBuilder.append(","); + } + } + RoadBehaviorAnalysis roadBehaviorAnalysis = getRoadBehaviorAnalysis(behaviorBuilder, behaviorCodeBuilder, RoadBehaviorTypeEnum.CAR.getCode(), jsonObject); + saveDataList.add(roadBehaviorAnalysis); + } + + /** + * 自行车情况 + * @param bicycle \ + * @param saveDataList \ + * @param jsonObject \ + */ + private void assemblyBicycleData(JSONArray bicycle, List saveDataList, JSONObject jsonObject) { + StringBuilder behaviorBuilder = new StringBuilder(); + StringBuilder behaviorCodeBuilder = new StringBuilder(); + for (int i = 0; i < bicycle.size(); i++) { + String bicycleString = bicycle.getString(i); + if (bicycleString.contains("Collision")){ + bicycleString = "Bicycle_Collisions"; + } else if (bicycleString.contains("Motorway")) { + bicycleString = "Motorway_Intrusion"; + } + BicycleStatusTypeEnum bicycleStatusTypeEnum = BicycleStatusTypeEnum.valueOf(bicycleString); + behaviorBuilder.append(bicycleStatusTypeEnum.getDesc()); + if (i != bicycle.size() - 1) { + behaviorBuilder.append(","); + } + behaviorCodeBuilder.append(bicycleStatusTypeEnum.name()); + if (i != bicycle.size() - 1) { + behaviorCodeBuilder.append(","); + } + } + RoadBehaviorAnalysis roadBehaviorAnalysis = getRoadBehaviorAnalysis(behaviorBuilder, behaviorCodeBuilder, RoadBehaviorTypeEnum.ROAD.getCode(), jsonObject); + saveDataList.add(roadBehaviorAnalysis); + } + + /** + * 车辆情况 + * @param vehicle \ + * @param saveDataList \ + * @param jsonObject \ + */ + private void assemblyVehicleData(JSONArray vehicle, List saveDataList, JSONObject jsonObject) { + StringBuilder behaviorBuilder = new StringBuilder(); + StringBuilder behaviorCodeBuilder = new StringBuilder(); + for (int i = 0; i < vehicle.size(); i++) { + String vehicleString = vehicle.getString(i); + if (vehicleString.contains("Collision")){ + vehicleString = "Vehicle_Collisions"; + } else if (vehicleString.contains("Smoke")) { + vehicleString = "Smoke_or_Fire"; + } + VehicleStatusTypeEnum vehicleStatusTypeEnum = VehicleStatusTypeEnum.valueOf(vehicleString); + behaviorBuilder.append(vehicleStatusTypeEnum.getDesc()); + if (i != vehicle.size() - 1) { + behaviorBuilder.append(","); + } + behaviorCodeBuilder.append(vehicleStatusTypeEnum.name()); + if (i != vehicle.size() - 1) { + behaviorCodeBuilder.append(","); + } + } + RoadBehaviorAnalysis roadBehaviorAnalysis = getRoadBehaviorAnalysis(behaviorBuilder, behaviorCodeBuilder, RoadBehaviorTypeEnum.CAR.getCode(), jsonObject); + saveDataList.add(roadBehaviorAnalysis); + } + + /** + * 天气情况 + * @param weather \ + * @param saveDataList \ + * @param jsonObject \ + */ + private void assemblyWeatherData(JSONArray weather, List saveDataList, JSONObject jsonObject) { + StringBuilder behaviorBuilder = new StringBuilder(); + StringBuilder behaviorCodeBuilder = new StringBuilder(); + for (int i = 0; i < weather.size(); i++) { + String weatherString = weather.getString(i); + WeatherStatusTypeEnum weatherStatusTypeEnum = WeatherStatusTypeEnum.valueOf(weatherString); + behaviorBuilder.append(weatherStatusTypeEnum.getDesc()); + if (i != weather.size() - 1) { + behaviorBuilder.append(","); + } + behaviorCodeBuilder.append(weatherStatusTypeEnum.name()); + if (i != weather.size() - 1) { + behaviorCodeBuilder.append(","); + } + } + RoadBehaviorAnalysis roadBehaviorAnalysis = getRoadBehaviorAnalysis(behaviorBuilder, behaviorCodeBuilder, RoadBehaviorTypeEnum.ENVIRONMENT.getCode(), jsonObject); + saveDataList.add(roadBehaviorAnalysis); + } + + /** + * 拥堵情况 + * @param congestion \ + * @param saveDataList \ + * @param jsonObject \ + */ + private void assemblyCongestionData(JSONArray congestion, List saveDataList, JSONObject jsonObject) { + StringBuilder behaviorBuilder = new StringBuilder(); + StringBuilder behaviorCodeBuilder = new StringBuilder(); + for (int i = 0; i < congestion.size(); i++) { + String congestionString = congestion.getString(i); + CongestionStatusTypeEnum congestionStatusTypeEnum = CongestionStatusTypeEnum.valueOf(congestionString); + behaviorBuilder.append(congestionStatusTypeEnum.getDesc()); + if (i != congestion.size() - 1) { + behaviorBuilder.append(","); + } + behaviorCodeBuilder.append(congestionStatusTypeEnum.name()); + if (i != congestion.size() - 1) { + behaviorCodeBuilder.append(","); + } + } + RoadBehaviorAnalysis roadBehaviorAnalysis = getRoadBehaviorAnalysis(behaviorBuilder, behaviorCodeBuilder, RoadBehaviorTypeEnum.ROAD.getCode(), jsonObject); + saveDataList.add(roadBehaviorAnalysis); + } + + /** + * 道路情况 + * @param road \ + * @param saveDataList \ + * @param jsonObject \ + */ + private void assemblyRoadData(JSONArray road, List saveDataList, JSONObject jsonObject) { + StringBuilder behaviorBuilder = new StringBuilder(); + StringBuilder behaviorCodeBuilder = new StringBuilder(); + for (int i = 0; i < road.size(); i++) { + String roadString = road.getString(i); + RoadStatusTypeEnum roadStatusTypeEnum = RoadStatusTypeEnum.valueOf(roadString); + behaviorBuilder.append(roadStatusTypeEnum.getDesc()); + if (i != road.size() - 1) { + behaviorBuilder.append(","); + } + behaviorCodeBuilder.append(roadStatusTypeEnum.name()); + if (i != road.size() - 1) { + behaviorCodeBuilder.append(","); + } + } + RoadBehaviorAnalysis roadBehaviorAnalysis = getRoadBehaviorAnalysis(behaviorBuilder, behaviorCodeBuilder, RoadBehaviorTypeEnum.ROAD.getCode(),jsonObject); + saveDataList.add(roadBehaviorAnalysis); + } + + /** + * 行人情况 + * @param pedestrian \ + * @param saveDataList \ + * @param jsonObject \ + */ + private void assemblyPedestrianData(JSONArray pedestrian, List saveDataList, JSONObject jsonObject) { + StringBuilder behaviorBuilder = new StringBuilder(); + StringBuilder behaviorCodeBuilder = new StringBuilder(); + for (int i = 0; i < pedestrian.size(); i++) { + String pedestrianString = pedestrian.getString(i); + PedestrianStatusTypeEnum pedestrianStatusTypeEnum = PedestrianStatusTypeEnum.valueOf(pedestrianString); + behaviorBuilder.append(pedestrianStatusTypeEnum.getDesc()); + if (i != pedestrian.size() - 1) { + behaviorBuilder.append(","); + } + behaviorCodeBuilder.append(pedestrianStatusTypeEnum.name()); + if (i != pedestrian.size() - 1) { + behaviorCodeBuilder.append(","); + } + } + RoadBehaviorAnalysis roadBehaviorAnalysis = getRoadBehaviorAnalysis(behaviorBuilder, behaviorCodeBuilder, RoadBehaviorTypeEnum.ROAD.getCode(), jsonObject); + saveDataList.add(roadBehaviorAnalysis); + } + + private RoadBehaviorAnalysis getRoadBehaviorAnalysis(StringBuilder behaviorBuilder, StringBuilder behaviorCodeBuilder, int type, JSONObject jsonObject) { + String behavior = behaviorBuilder.toString(); + String behaviorCode = behaviorCodeBuilder.toString(); + + String time = jsonObject.getString("Time"); + String region = jsonObject.getString("Region"); + + String picturePath = jsonObject.getString("PicturePath"); + JSONArray longitudes = jsonObject.getJSONArray("Longitude"); + JSONArray latitudes = jsonObject.getJSONArray("Latitude"); + + // 转换为LocalDateTime类型 + LocalDateTime createTime = LocalDateTimeUtil.parse(time, NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + + RoadBehaviorAnalysis roadBehaviorAnalysis = new RoadBehaviorAnalysis(); + roadBehaviorAnalysis.setBehavior(behavior); + roadBehaviorAnalysis.setBehaviorCode(behaviorCode); + roadBehaviorAnalysis.setBehaviorTime(createTime); + roadBehaviorAnalysis.setCreateTime(LocalDateTime.now()); + roadBehaviorAnalysis.setUpdateTime(LocalDateTime.now()); + roadBehaviorAnalysis.setRegion(region); + roadBehaviorAnalysis.setType(type); + roadBehaviorAnalysis.setPicturePath(picturePath); + // 获取超速车辆的经纬度数据 + if ((Objects.nonNull(longitudes) && CollUtil.isNotEmpty(longitudes)) && (Objects.nonNull(latitudes) && CollUtil.isNotEmpty(latitudes))){ + List positionInfoList = Lists.newArrayList(); + // 按一对一的关系 拼接经纬度 + for (int i = 0; i < longitudes.size(); i++) { + OverspeedPositionInfo positionInfo = new OverspeedPositionInfo(); + positionInfo.setLongitude(longitudes.getString(i)); + positionInfo.setLatitude(latitudes.getString(i)); + positionInfoList.add(positionInfo); + } + // 转化为Json字符串 + roadBehaviorAnalysis.setOverspeedPositionInfo(JSON.toJSONString(positionInfoList)); + } + roadBehaviorAnalysis.setIsWarn(judgeIsWarn(behaviorCode)); + // 首次保存的数据默认未处理 + roadBehaviorAnalysis.setIsHandled(Boolean.FALSE); + return roadBehaviorAnalysis; + } + + /** + * 判断是否需要预警 + * @param behaviorCode + * @return + */ + private Boolean judgeIsWarn(String behaviorCode) { + // 获取需要预警的behaviorCode + List needWarnBehaviorCodeList = getNeedWarnBehaviorCode(); + if (StringUtils.isNotBlank(behaviorCode)){ + List behaviorCodeList = Arrays.stream(behaviorCode.split(StrPool.COMMA)).collect(Collectors.toList()); + // 判断是否包含需要预警的behaviorCode + return behaviorCodeList.stream().anyMatch(needWarnBehaviorCodeList::contains); + } + return Boolean.FALSE; + } + + private List getNeedWarnBehaviorCode() { + List dataList = Lists.newArrayList(); + // Speed-->Reverse + dataList.add(SpeedStatusTypeEnum.Reverse.name()); + // Pedestrian-->Trespass、Traverse + dataList.add(PedestrianStatusTypeEnum.Trespass.name()); + dataList.add(PedestrianStatusTypeEnum.Traverse.name()); + // Road-->Damaged + dataList.add(RoadStatusTypeEnum.Damaged.name()); + // Congestion-->Heavy + dataList.add(CongestionStatusTypeEnum.Heavy.name()); + // Vehicle-->Vehicle_Collisions、Overturn、Smoke_or_Fire + dataList.add(VehicleStatusTypeEnum.Vehicle_Collisions.name()); + dataList.add(VehicleStatusTypeEnum.Overturn.name()); + dataList.add(VehicleStatusTypeEnum.Smoke_or_Fire.name()); + // Bicycle-->Bicycle_Collisions、Motorway_Intrusion + dataList.add(BicycleStatusTypeEnum.Bicycle_Collisions.name()); + dataList.add(BicycleStatusTypeEnum.Motorway_Intrusion.name()); + return dataList; + } + + /** + * 保存车辆速度异常数据 + * @param speed \ + * @param saveDataList \ + * @param jsonObject \ + */ + private void assemblySpeedData(JSONArray speed, List saveDataList, JSONObject jsonObject) { + StringBuilder behaviorBuilder = new StringBuilder(); + StringBuilder behaviorCodeBuilder = new StringBuilder(); + for (int i = 0; i < speed.size(); i++) { + String speedString = speed.getString(i); + SpeedStatusTypeEnum speedStatusTypeEnum = SpeedStatusTypeEnum.valueOf(speedString); + behaviorBuilder.append(speedStatusTypeEnum.getDesc()); + if (i != speed.size() - 1) { + behaviorBuilder.append(","); + } + behaviorCodeBuilder.append(speedStatusTypeEnum.name()); + if (i != speed.size() - 1) { + behaviorCodeBuilder.append(","); + } + } + RoadBehaviorAnalysis roadBehaviorAnalysis = getRoadBehaviorAnalysis(behaviorBuilder, behaviorCodeBuilder, RoadBehaviorTypeEnum.CAR.getCode(), jsonObject); + saveDataList.add(roadBehaviorAnalysis); + } + + /** + * 保存驾驶员异常行为数据 + * @param driver \ + * @param saveDataList \ + * @param jsonObject \ + */ + private void assemblyDriverData(JSONArray driver, List saveDataList, JSONObject jsonObject) { + StringBuilder behaviorBuilder = new StringBuilder(); + StringBuilder behaviorCodeBuilder = new StringBuilder(); + for (int i = 0; i < driver.size(); i++) { + String driverString = driver.getString(i); + if (driverString.contains("habits")) { + driverString = "Poor_habits"; + } + DriverStatusTypeEnum driverStatusTypeEnum = DriverStatusTypeEnum.valueOf(driverString); + behaviorBuilder.append(driverStatusTypeEnum.getDesc()); + if (i != driver.size() - 1) { + behaviorBuilder.append(","); + } + behaviorCodeBuilder.append(driverStatusTypeEnum.name()); + if (i != driver.size() - 1) { + behaviorCodeBuilder.append(","); + } + } + RoadBehaviorAnalysis roadBehaviorAnalysis = getRoadBehaviorAnalysis(behaviorBuilder, behaviorCodeBuilder, RoadBehaviorTypeEnum.DRIVER.getCode(),jsonObject); + saveDataList.add(roadBehaviorAnalysis); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/constant/AccidentTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/constant/AccidentTypeEnum.java new file mode 100644 index 0000000..ae7ca48 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/constant/AccidentTypeEnum.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.safe.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 事故类型枚举 + * @return + * @author CMM + * @since 2023/05/16 15:32 + */ +@Getter +@AllArgsConstructor +public enum AccidentTypeEnum { + + INJURY(0,"伤人"), + + DEAD(1,"亡人"), + + OTHER(2,"其它"); + + private Integer code; + private String desc; + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(Integer code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (AccidentTypeEnum t : AccidentTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/constant/SecurityContant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/constant/SecurityContant.java new file mode 100644 index 0000000..06ca044 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/constant/SecurityContant.java @@ -0,0 +1,13 @@ +package com.ningdatech.carapi.safe.constant; + +public interface SecurityContant { + + class Commitment { + public static final String COMMITMENT_SOCIAL = "社会"; + public static final String COMMITMENT_EMPLOYEE = "员工"; + public static final String COMMITMENT_GENERAL = "总经理"; + public static final String COMMITMENT_LEADER = "分管领导"; + public static final String COMMITMENT_TEAMLEADER = "车队长"; + public static final String COMMITMENT_DRIVER = "驾驶员"; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/constant/VehicleAccidentReportEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/constant/VehicleAccidentReportEnum.java new file mode 100644 index 0000000..8a5cbee --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/constant/VehicleAccidentReportEnum.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.safe.constant; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author CMM + * @since 2022/12/26 16:52 + */ +@Getter +@AllArgsConstructor +public enum VehicleAccidentReportEnum { + UN_AUDIT(0,"待审核"), + + AUDIT_APPROVED(1,"审核通过"), + + AUDIT_REJECTED(2,"审核不通过"); + + private Integer code; + private String desc; + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(String code) { + if(StringUtils.isBlank(code)){ + return StringUtils.EMPTY; + } + for (VehicleAccidentReportEnum t : VehicleAccidentReportEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/constant/VehicleAccidentReportStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/constant/VehicleAccidentReportStatusEnum.java new file mode 100644 index 0000000..c98c741 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/constant/VehicleAccidentReportStatusEnum.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.safe.constant; + +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @return + * @author CMM + * @since 2022/12/27 10:29 + */ +@Getter +@AllArgsConstructor +public enum VehicleAccidentReportStatusEnum { + UNDER_REPORT(0,"未上报"), + + REPORTED(1,"已上报"); + + private Integer code; + private String desc; + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getDescByCode(Integer code) { + if(Objects.isNull(code)){ + return StringUtils.EMPTY; + } + for (VehicleAccidentReportStatusEnum t : VehicleAccidentReportStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public boolean eq(String val) { + return this.name().equals(val); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/LawEnforcementController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/LawEnforcementController.java new file mode 100644 index 0000000..700d007 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/LawEnforcementController.java @@ -0,0 +1,49 @@ +package com.ningdatech.carapi.safe.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.safe.manage.LawEnforcementManage; +import com.ningdatech.carapi.safe.model.dto.LawEnforcementPageQuery; +import com.ningdatech.carapi.safe.model.vo.LawCertificateVerificationVO; +import com.ningdatech.carapi.safe.model.vo.LawEquipmentInstallVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/safe/law-enforcement") +@Api(value = "LawEnforcement", tags = "安全管理-行政执法") +@RequiredArgsConstructor +public class LawEnforcementController { + + private final LawEnforcementManage lawEnforcementManage; + + @ApiOperation(value = "设备安装", notes = "设备安装") + @GetMapping("/equipment-install") + public PageVo queryEquipmentInstall(@Valid @ModelAttribute LawEnforcementPageQuery lawEnforcementPageQuery) { + return lawEnforcementManage.queryEquipmentInstall(lawEnforcementPageQuery); + } + + @ApiOperation(value = "证件核查", notes = "证件核查") + @GetMapping("/certificate-verification") + public PageVo queryCertificateVerification(@Valid @ModelAttribute LawEnforcementPageQuery lawEnforcementPageQuery) { + return lawEnforcementManage.queryCertificateVerification(lawEnforcementPageQuery); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/NdVehicleAccidentController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/NdVehicleAccidentController.java new file mode 100644 index 0000000..7961171 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/NdVehicleAccidentController.java @@ -0,0 +1,105 @@ +package com.ningdatech.carapi.safe.controller; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.safe.entity.VehicleAccidentReport; +import com.ningdatech.carapi.safe.manage.VehicleAccidentManage; +import com.ningdatech.carapi.safe.model.dto.AccidentAuditDTO; +import com.ningdatech.carapi.safe.model.dto.AccidentPageQuery; +import com.ningdatech.carapi.safe.model.dto.VehicleAccidentReportDTO; +import com.ningdatech.carapi.safe.model.dto.VehicleAccidentReportQueryDTO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentAnalysisVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentDeadVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentReportVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentVO; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import com.ningdatech.log.annotation.WebLog; + +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/safe/accident") +@Api(value = "Accident", tags = "安全管理-事故管理") +@RequiredArgsConstructor +public class NdVehicleAccidentController { + + private final VehicleAccidentManage vehicleAccidentManage; + + private final RegionsCacheHelper regionsCacheHelper; + + @ApiOperation(value = "车辆事故信息", notes = "车辆事故信息") + @GetMapping("/vehicle") + public PageVo queryVehicle(@Valid @ModelAttribute AccidentPageQuery accidentPageQuery) { + return vehicleAccidentManage.queryVehicleAccident(accidentPageQuery); + } + + @ApiOperation(value = "死亡事故资料", notes = "死亡事故资料") + @GetMapping("/dead") + public PageVo queryDead(@Valid @ModelAttribute AccidentPageQuery accidentPageQuery) { + return vehicleAccidentManage.queryDead(accidentPageQuery); + } + + @ApiOperation(value = "事故路段分析", notes = "事故路段分析") + @GetMapping("/analysis") + public PageVo queryAccidentAnalysis(@Valid @ModelAttribute AccidentPageQuery accidentPageQuery) { + return vehicleAccidentManage.queryAccidentAnalysis(accidentPageQuery); + } + + @ApiOperation(value = "事故上报审核列表", notes = "事故上报审核列表") + @GetMapping("/reportList") + public PageVo reportAccidentInfo(@Valid @ModelAttribute AccidentPageQuery accidentPageQuery) { + return vehicleAccidentManage.reportAccidentInfo(accidentPageQuery); + } + + @ApiOperation(value = "上报事故信息",notes = "上报事故信息") + @PostMapping("/save") + public VehicleAccidentReportQueryDTO report(@Valid @RequestBody VehicleAccidentReportDTO data){ + VehicleAccidentReport entity = vehicleAccidentManage.save(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(entity, VehicleAccidentReportQueryDTO.class); + } + + @ApiOperation(value = "获取审核记录详情",notes = "获取审核记录详情") + @GetMapping("/detail/{id}") + public VehicleAccidentReport getDetail(@Valid @PathVariable Long id){ + return vehicleAccidentManage.getDetail(id); + } + + @ApiOperation(value = "删除审核记录",notes = "删除审核记录") + @DeleteMapping("/delete/{id}") + public Boolean delete(@Valid @PathVariable Long id){ + return vehicleAccidentManage.delete(id); + } + + @ApiOperation(value = "审核上报事故信息") + @PostMapping("/audit") + public Boolean audit(@Valid @RequestBody AccidentAuditDTO param){ + return vehicleAccidentManage.audit(param); + } + + @PostMapping("/vehicle/data/export") + @ApiOperation(value = "车辆事故信息导出",notes = "车辆事故信息导出") + @WebLog(value = "车辆事故信息导出", modular = "事故管理-车辆事故信息导出") + public void uploadDataQueryExport(@Valid @RequestBody AccidentPageQuery accidentPageQuery, HttpServletResponse response) { + vehicleAccidentManage.exportVehicleAccidentData(accidentPageQuery,response); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/NdVehicleInsureController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/NdVehicleInsureController.java new file mode 100644 index 0000000..01a4c24 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/NdVehicleInsureController.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.safe.controller; + +import java.io.FileNotFoundException; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.safe.manage.VehicleInsureManage; +import com.ningdatech.carapi.safe.model.dto.InsurePageQuery; +import com.ningdatech.carapi.safe.model.vo.NdInsureInfoVO; +import com.ningdatech.carapi.safe.model.vo.NdInsureOutDangerAnalysisVO; +import com.ningdatech.carapi.safe.model.vo.NdInsureOutDangerVO; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/safe/insure") +@Api(value = "Insure", tags = "安全管理-保险管理") +@RequiredArgsConstructor +public class NdVehicleInsureController { + + private final VehicleInsureManage vehicleInsureManage; + + @ApiOperation(value = "承保信息", notes = "承保信息") + @GetMapping("/underwriting") + public PageVo queryVehicle(@Valid @ModelAttribute InsurePageQuery insurePageQuery) { + return vehicleInsureManage.queryVehicleInsure(insurePageQuery); + } + + @ApiOperation(value = "出险信息", notes = "出险信息") + @GetMapping("/outDanger") + public PageVo queryOutDanger(@Valid @ModelAttribute InsurePageQuery insurePageQuery) { + return vehicleInsureManage.queryOutDanger(insurePageQuery); + } + + @ApiOperation(value = "出险分析", notes = "出险分析") + @GetMapping("/analysis") + public PageVo queryInsureOutDangerAnalysis(@Valid @ModelAttribute InsurePageQuery insurePageQuery) { + return vehicleInsureManage.queryInsureOutDangerAnalysis(insurePageQuery); + } + + @GetMapping("/exportOutDanger") + @ApiOperation("导出出险信息") + public void export(InsurePageQuery req, HttpServletResponse response) { + ExcelDownUtil.downXls(response, req, vehicleInsureManage::exportOutDanger); + } + + + @GetMapping("/importOutDanger") + @ApiOperation("手动导入出险信息") + public void importOutDanger() throws FileNotFoundException { + vehicleInsureManage.importOutDanger(); + } + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/NdVehicleOverspeedController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/NdVehicleOverspeedController.java new file mode 100644 index 0000000..5a41389 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/NdVehicleOverspeedController.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.safe.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.safe.model.dto.OverspeedPageQuery; +import com.ningdatech.carapi.safe.manage.VehicleOverspeedManage; +import com.ningdatech.carapi.safe.model.vo.NdVehicleOverspeedCompanyVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleOverspeedVehicleVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleOverspeedWaysectionVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/safe/overspeed") +@Api(value = "Overspeed", tags = "安全管理-超速管理") +@RequiredArgsConstructor +public class NdVehicleOverspeedController { + + private final VehicleOverspeedManage vehicleOverspeedManage; + + @ApiOperation(value = "企业超速", notes = "企业超速") + @GetMapping("/company") + public PageVo queryCompanyOverspeed(@Valid @ModelAttribute OverspeedPageQuery overspeedPageQuery) { + return vehicleOverspeedManage.queryCompanyOverspeed(overspeedPageQuery); + } + + @ApiOperation(value = "车辆超速", notes = "车辆超速") + @GetMapping("/vehicle") + public PageVo queryVihicleOverspeed(@Valid @ModelAttribute OverspeedPageQuery overspeedPageQuery) { + return vehicleOverspeedManage.queryVihicleOverspeed(overspeedPageQuery); + } + + @ApiOperation(value = "超速路段分析", notes = "超速路段分析") + @GetMapping("/waySection") + public PageVo queryWaySectionOverspeed(@Valid @ModelAttribute OverspeedPageQuery overspeedPageQuery) { + return vehicleOverspeedManage.queryWaySectionOverspeed(overspeedPageQuery); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/NdVehicleViolationController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/NdVehicleViolationController.java new file mode 100644 index 0000000..22a078c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/NdVehicleViolationController.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.safe.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.safe.model.dto.ViolationPageQuery; +import com.ningdatech.carapi.safe.manage.VehicleViolationManage; +import com.ningdatech.carapi.safe.model.vo.NdVehicleViolationVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/safe/violation") +@Api(value = "Violation", tags = "安全管理-违章管理") +@RequiredArgsConstructor +public class NdVehicleViolationController { + + private final VehicleViolationManage vehicleViolationManage; + + @ApiOperation(value = "违章管理", notes = "违章管理-列表") + @GetMapping("/list") + public PageVo query(@Valid @ModelAttribute ViolationPageQuery violationPageQuery) { + return vehicleViolationManage.query(violationPageQuery); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/SecurityAdvisoryController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/SecurityAdvisoryController.java new file mode 100644 index 0000000..d0b1e1b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/SecurityAdvisoryController.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.safe.controller; + +import com.ningdatech.basic.model.IdVo; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.safe.entity.NdSecurityNoticeSaveReq; +import com.ningdatech.carapi.safe.manage.SecurityAdvisoryManage; +import com.ningdatech.carapi.safe.model.dto.SecurityAdvisoryPageQuery; +import com.ningdatech.carapi.safe.model.vo.NdSecurityAdvisoryVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; + +/** + * @Classname SecurityAdvisoryController + * @Description + * @Date 2022/10/19 16:03 + * @Created by PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/safe/security-advisory") +@Api(value = "SecurityAdvisory", tags = "安全管理-安全通报") +@RequiredArgsConstructor +public class SecurityAdvisoryController { + private final SecurityAdvisoryManage securityAdvisoryManage; + + @ApiOperation(value = "安全通报", notes = "安全通报") + @GetMapping("/list") + public PageVo queryList(@Valid @ModelAttribute SecurityAdvisoryPageQuery securityAdvisoryPageQuery) { + CodeUtil.convertRegionCodeToId(securityAdvisoryPageQuery); + return securityAdvisoryManage.buildWrapper(securityAdvisoryPageQuery); + } + + @ApiOperation("新增安全通报") + @PostMapping("/add") + public void save(@RequestBody NdSecurityNoticeSaveReq req){ + securityAdvisoryManage.saveSecurityNotice(req); + } + + @ApiOperation("删除安全通报") + @DeleteMapping("/delete") + public void delete(@RequestBody IdVo id){ + securityAdvisoryManage.deleteSecurityNotice(id.getId()); + } + + @ApiOperation("增加下载次数") + @GetMapping("/incrementDownCount/{id}") + public void incrementDownCount(@PathVariable Long id) { + securityAdvisoryManage.incrementDownCount(id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/SecurityHonestyController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/SecurityHonestyController.java new file mode 100644 index 0000000..4a78cf4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/SecurityHonestyController.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.safe.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.safe.manage.SecurityHonestyManage; +import com.ningdatech.carapi.safe.model.dto.SecurityHonestyPageQuery; +import com.ningdatech.carapi.safe.model.vo.NdSafetyCommitmentVO; +import com.ningdatech.carapi.safe.model.vo.NdSafetyCreditVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + * @Classname SecurityHonestyController + * @Description + * @Date 2022/10/20 16:03 + * @Created by PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/safe/security-honesty") +@Api(value = "SecurityHonesty", tags = "安全管理-安全诚信") +@RequiredArgsConstructor +public class SecurityHonestyController { + + private final SecurityHonestyManage securityHonestyManage; + + @ApiOperation(value = "安全承诺", notes = "安全承诺") + @GetMapping("/commitment") + public PageVo queryCommitment(@Valid @ModelAttribute SecurityHonestyPageQuery securityAdvisoryPageQuery) { + return securityHonestyManage.queryCommitment(securityAdvisoryPageQuery); + } + + @ApiOperation(value = "安全信用", notes = "安全信用") + @GetMapping("/credit") + public PageVo queryCredit(@Valid @ModelAttribute SecurityHonestyPageQuery securityAdvisoryPageQuery) { + return securityHonestyManage.queryCredit(securityAdvisoryPageQuery); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/SecurityManageDataScreenController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/SecurityManageDataScreenController.java new file mode 100644 index 0000000..2a335d2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/controller/SecurityManageDataScreenController.java @@ -0,0 +1,87 @@ +package com.ningdatech.carapi.safe.controller; + +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.safe.model.dto.LongitudeLatitudeDTO; +import com.ningdatech.carapi.safe.service.SecurityManageDataScreenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author PoffyZhang + * @since 2022-10-22 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/safe/data-screen") +@Api(value = "Security", tags = "安全管理-大屏") +@RequiredArgsConstructor +public class SecurityManageDataScreenController { + + private final SecurityManageDataScreenService securityManageDataScreenService; + private static final Integer OUT_DANGER = 1; + private static final Integer INJURIES = 2; + private static final Integer DEATH_TOLL = 3; + + @ApiOperation(value = "近三年出险次数对比", notes = "近三年出险次数对比") + @GetMapping("/out-danger") + public JSONObject outDanger(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return securityManageDataScreenService.getInsureAnalysis(param,OUT_DANGER); + } + + @ApiOperation(value = "近三年受伤人数对比", notes = "近三年受伤人数对比") + @GetMapping("/injuries") + public JSONObject injuries(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return securityManageDataScreenService.getInsureAnalysis(param,INJURIES); + } + + @ApiOperation(value = "近三年死亡人数对比", notes = "近三年死亡人数对比") + @GetMapping("/death") + public JSONObject death(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return securityManageDataScreenService.getInsureAnalysis(param,DEATH_TOLL); + } + + @ApiOperation(value = "浙江省事故分布", notes = "浙江省事故分布") + @GetMapping("/accident-distribute") + public List accidentDistribute(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return securityManageDataScreenService.getAccidentLongitudeLatitude(param); + } + + @ApiOperation(value = "本月累积出险时段统计", notes = "本月累积出险时段统计") + @GetMapping("/out-danger-current-month") + public JSONObject outDangerCurrentMonth(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return securityManageDataScreenService.getOutDangerCurrentMonth(param); + } + + @ApiOperation(value = "近30天超速车辆数", notes = "近30天超速车辆数") + @GetMapping("/overspeed") + public JSONObject overspeed(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return securityManageDataScreenService.getOverSpeedCurrentMonth(param); + } + + @ApiOperation(value = "近三年各城市出险次数", notes = "近三年各城市出险次数") + @GetMapping("/out-danger-city") + public JSONObject outDangerCity(@Valid @ModelAttribute DataScreenParam param) { + CodeUtil.convertRegionCodeToId(param); + return securityManageDataScreenService.getOutDangerCity(param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/AlarmDataPicture.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/AlarmDataPicture.java new file mode 100644 index 0000000..c4eb027 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/AlarmDataPicture.java @@ -0,0 +1,159 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @Classname AlarmDataPicture + * @Description + * @Date 2022/10/28 10:47 + * @Created by PoffyZhang + */ +@Data +@TableName("nd_alarm_data_picture") +@ApiModel(value = "AlarmDataPicture", description = "告警数据 图片") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class AlarmDataPicture extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + *设备上报图片ID + */ + @ApiModelProperty("设备上报图片ID") + @NotBlank(message = "设备上报图片ID不能为空") + private String originPicId; + + /** + *车辆编号 + */ + @ApiModelProperty("车辆编号") + @NotBlank(message = "车辆编号不能为空") + private String vehicleIndexCode; + + /** + *车辆自编号 + */ + @ApiModelProperty("车辆自编号") + private String vehicleSelfNo; + + /** + *监控点编号 + */ + @ApiModelProperty("监控点编号") + @NotBlank(message = "监控点编号不能为空") + private String cameraIndexCode; + + /** + *监控点名称 + */ + @ApiModelProperty("监控点名称") + @NotBlank(message = "监控点名称不能为空") + private String cameraName; + + /** + *上传类型 + */ + @ApiModelProperty("上传类型 2:报警") + @NotNull(message = "上传类型不能为空") + private Integer uploadType; + + /** + * 告警ID + */ + @ApiModelProperty("告警ID") + @NotBlank(message = "告警ID不能为空") + private String alarmId; + + /** + * 事件类型 + */ + @ApiModelProperty("事件类型") + private String alarmType; + + /** + * 事件类型名 + */ + @ApiModelProperty("事件类型名 如:接打电话") + private String alarmTypeName; + + /** + * 抓拍时间 + */ + @ApiModelProperty("抓拍时间") + @NotNull(message = "抓拍时间不能为空") + private String captureTime; + + /** + * 图片地址 + */ + @ApiModelProperty("图片地址") + @NotBlank(message = "图片地址不能为空") + private String url; + + /** + * 缩略图地址 + */ + @ApiModelProperty("缩略图地址") + @NotBlank(message = "缩略图地址不能为空") + private String thumbUrl; + + /** + * 本图片所关联的抓拍图片的唯一标识 + */ + @ApiModelProperty("本图片所关联的抓拍图片的唯一标识") + private String parentPicId; + + /** + * 人脸小图在关联的抓拍图片上的坐标 + */ + @ApiModelProperty("人脸小图在关联的抓拍图片上的坐标") + private String faceRect; + + /** + * 图片类型 + */ + @ApiModelProperty("图片类型 可选项,0x01标识可见光,0x02标识热成像,若没有,则默认为可见光") + private String picType; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @NotBlank(message = "车牌号不能为空") + private String plateNo; + + /** + * 区域编码 + */ + @ApiModelProperty("区域编码") + @NotBlank(message = "区域编码不能为空") + private String regionIndexCode; + + /** + * 区域名称 + */ + @ApiModelProperty("区域名称") + @NotBlank(message = "区域名称不能为空") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/AlarmDataVideo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/AlarmDataVideo.java new file mode 100644 index 0000000..3aa45a5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/AlarmDataVideo.java @@ -0,0 +1,182 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @Classname AlarmDataVideo + * @Description + * @Date 2022/10/28 10:47 + * @Created by PoffyZhang + */ +@Data +@TableName("nd_alarm_data_video") +@ApiModel(value = "AlarmDataVideo", description = "告警数据 短视频") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class AlarmDataVideo extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + *设备上报短视频唯一标识 + */ + @ApiModelProperty("设备上报短视频唯一标识") + @NotBlank(message = "设备上报短视频唯一标识不能为空") + private String orginVideoId; + + /** + *车辆编号 + */ + @ApiModelProperty("车辆编号") + @NotBlank(message = "车辆编号不能为空") + private String vehicleIndexCode; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @NotBlank(message = "车牌号不能为空") + private String plateNo; + + /** + *车辆自编号 + */ + @ApiModelProperty("车辆自编号") + private String vehicleSelfNo; + + /** + * 区域编码 + */ + @ApiModelProperty("区域编码") + @NotBlank(message = "区域编码不能为空") + private String regionIndexCode; + + /** + * 区域名称 + */ + @ApiModelProperty("区域名称") + @NotBlank(message = "区域名称不能为空") + private String regionName; + + /** + *监控点编号 + */ + @ApiModelProperty("监控点编号") + @NotBlank(message = "监控点编号不能为空") + private String cameraIndexCode; + + /** + *监控点名称 + */ + @ApiModelProperty("监控点名称") + @NotBlank(message = "监控点名称不能为空") + private String cameraName; + + /** + *服务编号 + */ + @ApiModelProperty("服务编号") + @NotBlank(message = "服务编号不能为空") + private String serviceIndexCode; + + /** + *开始时间 + */ + @ApiModelProperty("开始时间") + @NotBlank(message = "开始时间不能为空") + private String beginTime; + + /** + *结束时间 + */ + @ApiModelProperty("结束时间") + @NotBlank(message = "结束时间不能为空") + private String endTime; + + /** + *流码开始时间 + */ + @ApiModelProperty("流码开始时间") + @NotBlank(message = "流码开始时间不能为空") + private String streamBeginTime; + + /** + *流码结束时间 + */ + @ApiModelProperty("流码结束时间") + @NotBlank(message = "流码结束时间不能为空") + private String streamEndTime; + + /** + *片段时长 + */ + @ApiModelProperty("片段时长 秒") + @NotNull(message = "片段时长不能为空") + private Integer videoLength; + + /** + * 告警ID + */ + @ApiModelProperty("告警ID") + @NotBlank(message = "告警ID不能为空") + private String alarmId; + + /** + * 告警时间 + */ + @ApiModelProperty("告警时间") + @NotBlank(message = "告警时间不能为空") + private String alarmTime; + + /** + * 事件类型 + */ + @ApiModelProperty("事件类型") + private String alarmType; + + /** + * 事件类型名 + */ + @ApiModelProperty("事件类型名 如:接打电话") + private String alarmTypeName; + + /** + * 片段编号 + */ + @ApiModelProperty("片段编号") + @NotBlank(message = "片段编号不能为空") + private String recordIndexCode; + + /** + * 短视频地址 + */ + @ApiModelProperty("短视频地址") + @NotBlank(message = "短视频地址不能为空") + private String url; + + /** + * 封面url + */ + @ApiModelProperty("封面url") + private String coverUrl; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdInsureInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdInsureInfo.java new file mode 100644 index 0000000..ec1fa49 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdInsureInfo.java @@ -0,0 +1,110 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_insure_info") +@Data +@ApiModel(value = "NdInsureInfo", description = "安全管理-保险管理-承保信息") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdInsureInfo extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 起包时间 + */ + @ApiModelProperty("起包时间") + @TableField(value = "insure_time_start") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime insureTimeStart; + + /** + * 到期时间 + */ + @ApiModelProperty("到期时间") + @TableField(value = "insure_time_end") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime insureTimeEnd; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + @TableField(value = "company_name") + private String companyName; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + @TableField(value = "company_id") + private Long companyId; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @TableField(value = "car_plate") + private String carPlate; + + /** + * 保险公司 + */ + @ApiModelProperty("保险公司") + @TableField(value = "insure_company") + private String insureCompany; + + /** + * 保险公司全称 + */ + @ApiModelProperty("保险公司全称") + @TableField(value = "insure_company_full_name") + private String insureCompanyFullName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdInsureOutDanger.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdInsureOutDanger.java new file mode 100644 index 0000000..67de516 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdInsureOutDanger.java @@ -0,0 +1,138 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_insure_out_danger") +@Data +@ApiModel(value = "NdInsureOutDanger", description = "安全管理-保险管理-出险信息") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdInsureOutDanger extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 事故时间 + */ + @ApiModelProperty("事故时间") + @TableField(value = "accident_time") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime accidentTime; + + /** + * 事故地点 + */ + @ApiModelProperty("事故地点") + @TableField(value = "accident_address") + private String accidentAddress; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + @TableField(value = "company_name") + private String companyName; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + @TableField(value = "company_id") + private Long companyId; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @TableField(value = "car_plate") + private String carPlate; + + /** + * 保险公司 + */ + @ApiModelProperty("保险公司") + @TableField(value = "insure_company") + private String insureCompany; + + /** + * 受伤人数 + */ + @ApiModelProperty("受伤人数") + @TableField(value = "injuries") + private Integer injuries; + + /** + * 死亡人数 + */ + @ApiModelProperty("死亡人数") + @TableField(value = "death_toll") + private Integer deathToll; + + /** + * 理赔金额 + */ + @ApiModelProperty("理赔金额") + @TableField(value = "compensate_amount") + private BigDecimal compensateAmount; + + /** + * 上报状态 + */ + @ApiModelProperty("上报状态") + @TableField(value = "report_status") + private Integer reportStatus; + + /** + * 保险公司全称 + */ + @ApiModelProperty("保险公司全称") + @TableField(value = "insure_company_full_name") + private String insureCompanyFullName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdInsureOutDangerAnalysis.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdInsureOutDangerAnalysis.java new file mode 100644 index 0000000..9a68a12 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdInsureOutDangerAnalysis.java @@ -0,0 +1,94 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_insure_out_danger_analysis") +@Data +@ApiModel(value = "NdInsureOutDangerAnalysis", description = "安全管理-保险管理-出险分析") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdInsureOutDangerAnalysis extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 出险次数 + */ + @ApiModelProperty("出险次数") + @TableField(value = "out_danger_times") + private Integer outDangerTimes; + + /** + * 事故时间 + */ + @ApiModelProperty("事故时间") + @TableField(value = "accident_time") + private LocalDateTime accidentTime; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; + + /** + * 受伤人数 + */ + @ApiModelProperty("受伤人数") + @TableField(value = "injuries") + private Integer injuries; + + /** + * 死亡人数 + */ + @ApiModelProperty("死亡人数") + @TableField(value = "death_toll") + private Integer deathToll; + + /** + * 公司ID + */ + @ApiModelProperty("公司ID") + @TableField(value = "company_id") + private Long companyId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdLawCertificateVerification.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdLawCertificateVerification.java new file mode 100644 index 0000000..5ce75b7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdLawCertificateVerification.java @@ -0,0 +1,149 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_law_certificate_verification") +@Data +@ApiModel(value = "NdLawCertificateVerification", description = "安全管理-行政执法-证件核查") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdLawCertificateVerification extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 驾驶员ID + */ + @ApiModelProperty("驾驶员ID") + @TableField(value = "driver_id") + private Long driverId; + + /** + * 驾驶员名字 + */ + @ApiModelProperty("驾驶员名字") + @TableField(value = "driver_name") + private String driverName; + + /** + * 身份证号 + */ + @ApiModelProperty("身份证号") + @TableField(value = "id_card") + private String idCard; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @TableField(value = "car_plate") + private String carPlate; + + /** + * 检查日期 + */ + @ApiModelProperty("检查日期") + @TableField(value = "check_date") + private LocalDateTime checkDate; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + @TableField(value = "company_id") + private Long companyId; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + @TableField(value = "company_name") + private String companyName; + + /** + * 是否有驾驶证 + */ + @ApiModelProperty("是否有驾驶证 0没有 1有") + @TableField(value = "have_driver_license") + private Integer haveDriverLicense; + + /** + * 是否有行驶证 + */ + @ApiModelProperty("是否有行驶证 0没有 1有") + @TableField(value = "have_driving_license") + private Integer haveDrivingLicense; + + /** + * 检查地址 + */ + @ApiModelProperty("检查地址") + @TableField(value = "check_address") + private String checkAddress; + + /** + * 检查人员 + */ + @ApiModelProperty("检查人员") + @TableField(value = "inspectors") + private String inspectors; + + /** + * 处理结束 + */ + @ApiModelProperty("处理结束") + @TableField(value = "process_result") + private String processResult; + + /** + * 备注 + */ + @ApiModelProperty("备注") + @TableField(value = "remark") + private String remark; + + /** + * 区域id + */ + @ApiModelProperty("区域id") + @TableField(value = "region_id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdLawEquipmentInstall.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdLawEquipmentInstall.java new file mode 100644 index 0000000..027684c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdLawEquipmentInstall.java @@ -0,0 +1,142 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_law_equipment_install") +@Data +@ApiModel(value = "NdLawEquipmentInstall", description = "安全管理-行政执法-设备安装") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdLawEquipmentInstall extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 驾驶员ID + */ + @ApiModelProperty("驾驶员ID") + @TableField(value = "driver_id") + private Long driverId; + + /** + * 驾驶员名字 + */ + @ApiModelProperty("驾驶员名字") + @TableField(value = "driver_name") + private String driverName; + + /** + * 身份证号 + */ + @ApiModelProperty("身份证号") + @TableField(value = "id_card") + private String idCard; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @TableField(value = "car_plate") + private String carPlate; + + /** + * 检查日期 + */ + @ApiModelProperty("检查日期") + @TableField(value = "check_date") + private LocalDateTime checkDate; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + @TableField(value = "company_id") + private Long companyId; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + @TableField(value = "company_name") + private String companyName; + + /** + * 设备名字 + */ + @ApiModelProperty("设备名字") + @TableField(value = "equipment_name") + private String equipmentName; + + /** + * 检查地址 + */ + @ApiModelProperty("检查地址") + @TableField(value = "check_address") + private String checkAddress; + + /** + * 检查人员 + */ + @ApiModelProperty("检查人员") + @TableField(value = "inspectors") + private String inspectors; + + /** + * 处理结束 + */ + @ApiModelProperty("处理结束") + @TableField(value = "process_result") + private String processResult; + + /** + * 备注 + */ + @ApiModelProperty("备注") + @TableField(value = "remark") + private String remark; + + /** + * 区域id + */ + @ApiModelProperty("区域id") + @TableField(value = "region_id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdSafetyCommitment.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdSafetyCommitment.java new file mode 100644 index 0000000..e1bec78 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdSafetyCommitment.java @@ -0,0 +1,127 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_safety_commitment") +@Data +@ApiModel(value = "NdSafetyCommitment", description = "安全管理-安全承诺") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdSafetyCommitment extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; + + /** + * 公司ID + */ + @ApiModelProperty("公司ID") + @TableField(value = "company_id") + private Long companyId; + + /** + * 公司名 + */ + @ApiModelProperty("公司名") + @TableField(value = "company_name") + private String companyName; + + /** + * 公司地址 + */ + @ApiModelProperty("公司地址") + @TableField(value = "company_address") + private String companyAddress; + + /** + * 法人代表 + */ + @ApiModelProperty("法人代表") + @TableField(value = "legal_person") + private String legalPerson; + + /** + * 向社会承诺 + */ + @ApiModelProperty("向社会承诺") + @TableField(value = "commitments_to_social") + private String commitmentsToSocial; + + /** + * 向员工承诺 + */ + @ApiModelProperty("向员工承诺") + @TableField(value = "commitments_to_employee") + private String commitmentsToEmployee; + + /** + * 总经理承诺 + */ + @ApiModelProperty("总经理承诺") + @TableField(value = "general_manager_commitment") + private String generalManagercommitment; + + /** + * 分管总承诺 + */ + @ApiModelProperty("分管总承诺") + @TableField(value = "leader_in_charge_commitment") + private String leaderInChargeCommitment; + + /** + * 车队长承诺 + */ + @ApiModelProperty("车队长承诺") + @TableField(value = "team_leader_commitment") + private String teamLeaderCommitment; + + /** + * 驾驶员承诺 + */ + @ApiModelProperty("驾驶员承诺") + @TableField(value = "driver_commitment") + private String driverCommitment; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdSafetyCredit.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdSafetyCredit.java new file mode 100644 index 0000000..d7fb795 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdSafetyCredit.java @@ -0,0 +1,155 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_safety_credit") +@Data +@ApiModel(value = "NdSafetyCredit", description = "安全管理-安全信用") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdSafetyCredit extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; + + /** + * 公司ID + */ + @ApiModelProperty("公司ID") + @TableField(value = "company_id") + private Long companyId; + + /** + * 公司名 + */ + @ApiModelProperty("公司名") + @TableField(value = "company_name") + private String companyName; + + /** + * 公司地址 + */ + @ApiModelProperty("公司地址") + @TableField(value = "company_address") + private String companyAddress; + + /** + * 法人代表 + */ + @ApiModelProperty("法人代表") + @TableField(value = "legal_person") + private String legalPerson; + + /** + * 死亡事故数量 + */ + @ApiModelProperty("死亡事故数量") + @TableField(value = "fatal_accidents_num") + private Integer fatalAccidentsNum; + + /** + * 安全整治记录 + */ + @ApiModelProperty("安全整治记录") + @TableField(value = "safety_rectification_record") + private String safetyRectificationRecord; + + /** + * 执行监督指令 + */ + @ApiModelProperty("执行监督指令") + @TableField(value = "execute_supervision_instructions") + private String executeSupervisionInstructions; + + /** + * 执行安全处罚 + */ + @ApiModelProperty("执行安全处罚") + @TableField(value = "implement_safety_punishment") + private String implementSafetyPunishment; + + /** + * 报送安全报表 + */ + @ApiModelProperty("报送安全报表") + @TableField(value = "submit_safety_report") + private String submitSafetyReport; + + /** + * 制定救援预案 + */ + @ApiModelProperty("制定救援预案") + @TableField(value = "formulate_rescue_plan") + private String formulateRescuePlan; + + /** + * 安全教育培训 + */ + @ApiModelProperty("安全教育培训") + @TableField(value = "safety_education_training") + private String safetyEducationTraining; + + /** + * 瞒报事故 + */ + @ApiModelProperty("瞒报事故") + @TableField(value = "concealing_accidents") + private String concealingAccidents; + + /** + * 无证生产 + */ + @ApiModelProperty("无证生产") + @TableField(value = "production_no_certificate") + private String productionNoCertificate; + + /** + * 无证驾驶 + */ + @ApiModelProperty("无证驾驶") + @TableField(value = "driving_no_license") + private String drivingNoLicense; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdSecurityAdvisory.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdSecurityAdvisory.java new file mode 100644 index 0000000..604ecb8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdSecurityAdvisory.java @@ -0,0 +1,100 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_security_advisory") +@Data +@ApiModel(value = "NdSecurityAdvisory", description = "安全管理-安全通报") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdSecurityAdvisory extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; + + /** + * 通报日期 + */ + @ApiModelProperty("通报日期") + @TableField(value = "advisory_date") + private LocalDateTime advisoryDate; + + /** + * 通报文件名 + */ + @ApiModelProperty("通报文件名") + @TableField(value = "advisory_file_name") + private String advisoryFileName; + + /** + * 通报文件url + */ + @ApiModelProperty("通报文件url") + @TableField(value = "advisory_file_url") + private String advisoryFileUrl; + + /** + * 通报次数 + */ + @ApiModelProperty("通报次数") + @TableField(value = "download_times") + private Integer downloadTimes; + + /** + * 上传文件id + */ + @ApiModelProperty("文件id") + @TableField(value = "file_id") + private Long fileId; + + /** + * 公司ID + */ + @ApiModelProperty("公司ID") + @TableField(value = "company_id") + private Long companyId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdSecurityNoticeSaveReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdSecurityNoticeSaveReq.java new file mode 100644 index 0000000..f4ee5e5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdSecurityNoticeSaveReq.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.safe.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + + +@Data +@ApiModel(value = "安全通报新增实体") +public class NdSecurityNoticeSaveReq { + + @ApiModelProperty("区域Id") + @NotNull(message = "区域Id不能为空") + private Long regionId; + + @ApiModelProperty("年月") + @NotNull(message = "年月不能为空") + private LocalDateTime yearMonth; + + @ApiModelProperty("文件ID") + @NotNull(message = "文件ID不能为空") + private Long fileId; + + @ApiModelProperty("文件名") + @NotNull(message = "文件名不能为空") + private String fileName; + + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleAccident.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleAccident.java new file mode 100644 index 0000000..f9e959d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleAccident.java @@ -0,0 +1,149 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_vehicle_accident") +@Data +@ApiModel(value = "NdVehicleAccident", description = "安全管理-事故管理-车辆事故") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleAccident extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 事故时间 + */ + @ApiModelProperty("事故时间") + @TableField(value = "accident_time") + private LocalDateTime accidentTime; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @TableField(value = "car_plate") + private String carPlate; + + /** + * 事故驾驶员 + */ + @ApiModelProperty("事故驾驶员") + @TableField(value = "accident_driver") + private String accidentDriver; + + /** + * 事故驾驶员ID + */ + @ApiModelProperty("事故驾驶员ID") + @TableField(value = "driver_id") + private String driverId; + + /** + * 车辆类型 + */ + @ApiModelProperty("车辆类型") + @TableField(value = "vehicle_type") + private Integer vehicleType; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + @TableField(value = "company_name") + private String companyName; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + @TableField(value = "company_id") + private Long companyId; + + /** + * 事故地址 + */ + @ApiModelProperty("事故地址") + @TableField(value = "accident_address") + private String accidentAddress; + + @ApiModelProperty("经度") + private String longitude; + + @ApiModelProperty("纬度") + private String latitude; + + @ApiModelProperty("出险id") + private Long insureOutId; + + @ApiModelProperty("受伤人数") + private Integer injuries; + + @ApiModelProperty("死亡人数") + private Integer deathToll; + + @ApiModelProperty("保险ID") + private Long insureId; + + @ApiModelProperty("上报状态") + private Integer reportStatus; + + @ApiModelProperty("事故类型") + private Integer accidentType; + + @ApiModelProperty("简要案情") + private String briefCase; + + @ApiModelProperty("事故编号") + private String accidentNo; + + @ApiModelProperty("事故责任认定书认定内容") + private String firmContent; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleAccidentAnalysis.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleAccidentAnalysis.java new file mode 100644 index 0000000..cb1ddfc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleAccidentAnalysis.java @@ -0,0 +1,92 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_vehicle_accident_analysis") +@Data +@ApiModel(value = "NdVehicleAccidentAnalysis", description = "安全管理-事故管理-事故分析") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleAccidentAnalysis extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 事故时间 + */ + @ApiModelProperty("事故时间") + @TableField(value = "accident_time") + private LocalDateTime accidentTime; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; + + /** + * 事故驾驶员 + */ + @ApiModelProperty("事故驾驶员") + @TableField(value = "accident_driver") + private String accidentDriver; + + /** + * 经纬度 + */ + @ApiModelProperty("经纬度") + @TableField(value = "longitude_latitude") + private String longitudeLatitude; + + /** + * 事故地点 + */ + @ApiModelProperty("事故地点") + @TableField(value = "accident_address") + private String accidentAddress; + + @ApiModelProperty("公司ID") + @TableField(value = "company_id") + private Long companyId; + + private String carPlate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleAccidentDead.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleAccidentDead.java new file mode 100644 index 0000000..5698485 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleAccidentDead.java @@ -0,0 +1,131 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_vehicle_accident_dead") +@Data +@ApiModel(value = "NdVehicleAccidentDead", description = "安全管理-事故管理-死亡事故") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleAccidentDead extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 事故时间 + */ + @ApiModelProperty("事故时间") + @TableField(value = "accident_time") + private LocalDateTime accidentTime; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @TableField(value = "car_plate") + private String carPlate; + + /** + * 事故驾驶员 + */ + @ApiModelProperty("事故驾驶员") + @TableField(value = "accident_driver") + private String accidentDriver; + + /** + * 事故驾驶员ID + */ + @ApiModelProperty("事故驾驶员ID") + @TableField(value = "driver_id") + private String driverId; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + @TableField(value = "company_name") + private String companyName; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + @TableField(value = "company_id") + private Long companyId; + + /** + * 事故地址 + */ + @ApiModelProperty("事故地址") + @TableField(value = "accident_address") + private String accidentAddress; + + @ApiModelProperty("经度") + private String longitude; + + @ApiModelProperty("纬度") + private String latitude; + + @ApiModelProperty("受伤人数") + private Integer injuries; + + @ApiModelProperty("死亡人数") + private Integer deathToll; + + @ApiModelProperty("上报状态") + private Integer reportStatus; + + @ApiModelProperty("简要案情") + private String briefCase; + + @ApiModelProperty("事故编号") + private String accidentNo; + + @ApiModelProperty("事故责任认定书认定内容") + private String firmContent; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleOverspeedCompany.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleOverspeedCompany.java new file mode 100644 index 0000000..4ad3b63 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleOverspeedCompany.java @@ -0,0 +1,98 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_vehicle_overspeed_company") +@Data +@ApiModel(value = "NdVehicleOverspeedCompany", description = "安全管理-超速管理-企业超速") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleOverspeedCompany extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 超速时间 + */ + @ApiModelProperty("超速时间") + @TableField(value = "overspeed_date") + private LocalDateTime overspeedDate; + + /** + * 超速次数 + */ + @ApiModelProperty("超速次数") + @TableField(value = "overspeed_times") + private Integer overspeedTimes; + + /** + * 最高速率 + */ + @ApiModelProperty("最高速率") + @TableField(value = "max_speed") + private Double maxSpeed; + + /** + * 排名 + */ + @ApiModelProperty("排名") + @TableField(value = "rank") + private Integer rank; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + @TableField(value = "company_name") + private String companyName; + + /** + * 所属市 + */ + @ApiModelProperty("所属市") + @TableField(value = "city") + private String city; + + /** + * 所属区 + */ + @ApiModelProperty("所属区") + @TableField(value = "distinguish") + private String distinguish; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleOverspeedVehicle.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleOverspeedVehicle.java new file mode 100644 index 0000000..80cd10d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleOverspeedVehicle.java @@ -0,0 +1,107 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_vehicle_overspeed_vehicle") +@Data +@ApiModel(value = "NdVehicleOverspeedCompany", description = "安全管理-超速管理-车辆超速") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleOverspeedVehicle extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 超速时间 + */ + @ApiModelProperty("超速时间") + @TableField(value = "overspeed_date") + private LocalDateTime overspeedDate; + + /** + * 超速次数 + */ + @ApiModelProperty("超速次数") + @TableField(value = "overspeed_times") + private Integer overspeedTimes; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @TableField(value = "car_plate") + private String carPlate; + + /** + * 最高速率 + */ + @ApiModelProperty("最高速率") + @TableField(value = "max_speed") + private Double maxSpeed; + + /** + * 排名 + */ + @ApiModelProperty("排名") + @TableField(value = "rank") + private Integer rank; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + @TableField(value = "company_name") + private String companyName; + + /** + * 所属市 + */ + @ApiModelProperty("所属市") + @TableField(value = "city") + private String city; + + /** + * 所属区 + */ + @ApiModelProperty("所属区") + @TableField(value = "distinguish") + private String distinguish; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleOverspeedWaysection.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleOverspeedWaysection.java new file mode 100644 index 0000000..a38c07b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleOverspeedWaysection.java @@ -0,0 +1,121 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_vehicle_overspeed_waysection") +@Data +@ApiModel(value = "NdVehicleOverspeedCompany", description = "安全管理-超速管理-超速路段") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleOverspeedWaysection extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @TableField(value = "car_plate") + private String carPlate; + + /** + * 超速时间 + */ + @ApiModelProperty("超速时间") + @TableField(value = "overspeed_date") + private LocalDateTime overspeedDate; + + /** + * 超速次数 + */ + @ApiModelProperty("超速次数") + @TableField(value = "overspeed_times") + private Integer overspeedTimes; + + /** + * 路段名字 + */ + @ApiModelProperty("路段名字") + @TableField(value = "way_section") + private String waySection; + + /** + * 路段开始名字 + */ + @ApiModelProperty("路段开始名字") + @TableField(value = "way_section_start") + private String waySectionStart; + + /** + * 路段结束名字 + */ + @ApiModelProperty("路段结束名字") + @TableField(value = "way_section_end") + private String waySectionEnd; + + /** + * 排名 + */ + @ApiModelProperty("排名") + @TableField(value = "rank") + private Integer rank; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + @TableField(value = "company_name") + private String companyName; + + /** + * 所属市 + */ + @ApiModelProperty("所属市") + @TableField(value = "city") + private String city; + + /** + * 所属区 + */ + @ApiModelProperty("所属区") + @TableField(value = "distinguish") + private String distinguish; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleViolation.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleViolation.java new file mode 100644 index 0000000..ac4d0bc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/NdVehicleViolation.java @@ -0,0 +1,181 @@ +package com.ningdatech.carapi.safe.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@TableName("nd_vehicle_violation") +@Data +@ApiModel(value = "NdVehicleViolation", description = "安全管理-违章管理") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleViolation extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @TableField(value = "region_name") + private String regionName; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + + /** + * 企业id + */ + @ApiModelProperty("企业id") + @TableField(value = "company_id") + private Long companyId; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + @TableField(value = "company_name") + private String companyName; + + /** + * 驾驶员 + */ + @ApiModelProperty("驾驶员") + @TableField(value = "driver_name") + private String driverName; + + /** + * 驾驶员ID + */ + @ApiModelProperty("驾驶员ID") + @TableField(value = "driver_id") + private Long driverId; + + /** + * 身份证号 + */ + @ApiModelProperty("身份证号") + @TableField(value = "id_card") + private String idCard; + + /** + * 违章时间 + */ + @ApiModelProperty("违章时间") + @TableField(value = "violation_date") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime violationDate; + + /** + * 违章类型 + */ + @ApiModelProperty("违章类型") + @TableField(value = "violation_type") + private Integer violationType; + + /** + * 缺少证件类型 + */ + @ApiModelProperty("缺少证件类型") + @TableField(value = "missing_certificate_type") + private Integer missingCertificateType; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @TableField(value = "car_plate") + private String carPlate; + + /** + * 闯红灯地址 + */ + @ApiModelProperty("闯红灯地址") + @TableField(value = "address_red_light") + private String addressRedLight; + + /** + * 违规路段名 + */ + @ApiModelProperty("违规路段名") + @TableField(value = "way_section") + private String waySection; + + /** + * 违章次数 + */ + @ApiModelProperty("违章次数") + @TableField(value = "violation_times") + private Integer violationTimes; + + /** + * 违章时间段 + */ + @ApiModelProperty("违章时间段") + @TableField(value = "violation_period") + private String violationPeriod; + + /** + * 违章地点 + */ + @ApiModelProperty("违章地点") + @TableField(value = "violation_address") + private String violationAddress; + + /** + * 违章编号 + */ + @ApiModelProperty("违章编号") + @TableField(value = "violation_no") + private String violationNo; + + /** + * 经度 + */ + @ApiModelProperty("经度") + @TableField(value = "longitude") + private String longitude; + + /** + * 经度 + */ + @ApiModelProperty("纬度") + @TableField(value = "latitude") + private String latitude; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/VehicleAccidentReport.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/VehicleAccidentReport.java new file mode 100644 index 0000000..ac065a3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/VehicleAccidentReport.java @@ -0,0 +1,112 @@ +package com.ningdatech.carapi.safe.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2022-12-26 + */ +@Data +@TableName("nd_vehicle_accident_report") +@ApiModel(value = "VehicleAccidentReport对象", description = "安全管理-事故管理-事故上报") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class VehicleAccidentReport 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; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("地区ID") + private Long regionId; + + @ApiModelProperty("地区名") + private String regionName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("事故日期") + private LocalDateTime accidentTime; + + @ApiModelProperty("事故驾驶员") + private String accidentDriver; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("事故地点") + private String accidentAddress; + + @ApiModelProperty("经度") + private String longitude; + + @ApiModelProperty("纬度") + private String latitude; + + @ApiModelProperty("出险id 关联赔付信息") + private Long insureOutId; + + @ApiModelProperty("受伤人数") + private Integer injuries; + + @ApiModelProperty("死亡人数") + private Integer deathToll; + + @ApiModelProperty("驾驶员ID") + private Long driverId; + + @ApiModelProperty("保险ID") + private Long insureId; + + @ApiModelProperty("审核状态 0:待审核,1:审核通过,2:审核不通过") + private Integer auditStatus; + + @ApiModelProperty("审核意见") + private String auditOpinion; + + @ApiModelProperty("审核人") + private String auditor; + + @ApiModelProperty("审核人id") + private Long auditorUserId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/VehicleOverspeedInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/VehicleOverspeedInfo.java new file mode 100644 index 0000000..7e7b668 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/entity/VehicleOverspeedInfo.java @@ -0,0 +1,100 @@ +package com.ningdatech.carapi.safe.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.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 车辆超速信息表 + *

+ * + * @author PoffyZhang + * @since 2022-11-17 + */ +@TableName("nd_vehicle_overspeed_info") +@Data +@ApiModel(value = "VehicleOverspeedInfo对象", description = "车辆超速信息表") +public class VehicleOverspeedInfo 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; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("修改人") + private Long updateBy; + + @ApiModelProperty("超速时间") + private LocalDateTime overspeedDate; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("最高速率") + private BigDecimal maxSpeed; + + @ApiModelProperty("公司名") + private String companyName; + + @ApiModelProperty("所属城市") + private String city; + + @ApiModelProperty("所属县区") + private String distinguish; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名字") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("限速") + private BigDecimal limitSpeed; + + @ApiModelProperty("地点") + private String address; + + @ApiModelProperty("经度") + private BigDecimal longitude; + + @ApiModelProperty("纬度") + private BigDecimal latitude; + + @ApiModelProperty("路段") + private String waySection; + + @ApiModelProperty("开始路段") + private String waySectionStart; + + @ApiModelProperty("结束路段") + private String waySectionEnd; + + private LocalDateTime startTime; + private LocalDateTime endTime; + + private Long alarmMsgSn; + private Long gnssCenterId; + + @ApiModelProperty("是否删除") + private Integer deleted; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/LawEnforcementManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/LawEnforcementManage.java new file mode 100644 index 0000000..4784558 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/LawEnforcementManage.java @@ -0,0 +1,109 @@ +package com.ningdatech.carapi.safe.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.PageVo; +import com.ningdatech.basic.util.CollUtils; +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.safe.entity.NdLawCertificateVerification; +import com.ningdatech.carapi.safe.entity.NdLawEquipmentInstall; +import com.ningdatech.carapi.safe.model.dto.LawEnforcementPageQuery; +import com.ningdatech.carapi.safe.model.vo.LawCertificateVerificationVO; +import com.ningdatech.carapi.safe.model.vo.LawEquipmentInstallVO; +import com.ningdatech.carapi.safe.service.INdLawCertificateVerificationService; +import com.ningdatech.carapi.safe.service.INdLawEquipmentInstallService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Objects; + +/** + * @author PoffyZhang + * @date 2022/10/19 上午11:18 + */ +@Component +@RequiredArgsConstructor +public class LawEnforcementManage { + + private final INdLawEquipmentInstallService equipmentInstallService; + private final INdLawCertificateVerificationService certificateVerificationService; + private final RegionsCacheHelper regionsCacheHelper; + + /** + * 执行 设备安装 查询 + * @param lawEnforcementPageQuery + * @return + */ + public PageVo queryEquipmentInstall(LawEnforcementPageQuery lawEnforcementPageQuery) { + Page page = lawEnforcementPageQuery.page(); + equipmentInstall(page, lawEnforcementPageQuery); + List data = CollUtils.convert(page.getRecords(), e -> { + LawEquipmentInstallVO vo = BeanUtil.copyProperties(e, LawEquipmentInstallVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + /** + * 证件核查 + * @param lawEnforcementPageQuery + * @return + */ + public PageVo queryCertificateVerification(LawEnforcementPageQuery lawEnforcementPageQuery) { + Page page = lawEnforcementPageQuery.page(); + certificateVerification(page, lawEnforcementPageQuery); + List data = CollUtils.convert(page.getRecords(), e -> { + LawCertificateVerificationVO vo = BeanUtil.copyProperties(e, LawCertificateVerificationVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + private void certificateVerification(Page page, LawEnforcementPageQuery lawEnforcementPageQuery) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdLawCertificateVerification.class); + LawEnforcementManage context = (LawEnforcementManage)AopContext.currentProxy(); + context.searchCert(page,wrapper,lawEnforcementPageQuery); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(wrapperIndex = 1,entityIndex = 2) + public void searchCert(Page page, LambdaQueryWrapper wrapper, LawEnforcementPageQuery lawEnforcementPageQuery) { + wrapper.ge(Objects.nonNull(lawEnforcementPageQuery.getStartTime()),NdLawCertificateVerification::getCheckDate, lawEnforcementPageQuery.getStartTime()) + .le(Objects.nonNull(lawEnforcementPageQuery.getEndTime()),NdLawCertificateVerification::getCheckDate, lawEnforcementPageQuery.getEndTime()) + .like(Objects.nonNull(lawEnforcementPageQuery.getCarPlate()),NdLawCertificateVerification::getCarPlate, lawEnforcementPageQuery.getCarPlate()) + .like(StringUtils.isNotBlank(lawEnforcementPageQuery.getCompanyName()),NdLawCertificateVerification::getCompanyName, lawEnforcementPageQuery.getCompanyName()) + .like(StringUtils.isNotBlank(lawEnforcementPageQuery.getDriverName()),NdLawCertificateVerification::getDriverName, lawEnforcementPageQuery.getDriverName()); + wrapper.orderBy(Boolean.TRUE,Boolean.FALSE,NdLawCertificateVerification::getCheckDate); + certificateVerificationService.page(page, wrapper); + } + + + private void equipmentInstall(Page page, LawEnforcementPageQuery lawEnforcementPageQuery) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdLawEquipmentInstall.class); + LawEnforcementManage context = (LawEnforcementManage)AopContext.currentProxy(); + context.searchInstall(page,wrapper,lawEnforcementPageQuery); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public void searchInstall(Page page, LambdaQueryWrapper wrapper, LawEnforcementPageQuery lawEnforcementPageQuery) { + wrapper.ge(Objects.nonNull(lawEnforcementPageQuery.getStartTime()),NdLawEquipmentInstall::getCheckDate, lawEnforcementPageQuery.getStartTime()) + .le(Objects.nonNull(lawEnforcementPageQuery.getEndTime()),NdLawEquipmentInstall::getCheckDate, lawEnforcementPageQuery.getEndTime()) + .eq(StringUtils.isNotBlank(lawEnforcementPageQuery.getEquipmentName()),NdLawEquipmentInstall::getEquipmentName, lawEnforcementPageQuery.getEquipmentName()) + .like(Objects.nonNull(lawEnforcementPageQuery.getCarPlate()),NdLawEquipmentInstall::getCarPlate, lawEnforcementPageQuery.getCarPlate()) + .like(StringUtils.isNotBlank(lawEnforcementPageQuery.getCompanyName()),NdLawEquipmentInstall::getCompanyName, lawEnforcementPageQuery.getCompanyName()) + .like(StringUtils.isNotBlank(lawEnforcementPageQuery.getDriverName()),NdLawEquipmentInstall::getDriverName, lawEnforcementPageQuery.getDriverName()); + wrapper.orderBy(Boolean.TRUE,Boolean.FALSE,NdLawEquipmentInstall::getCheckDate); + equipmentInstallService.page(page, wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/SecurityAdvisoryManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/SecurityAdvisoryManage.java new file mode 100644 index 0000000..0a2c666 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/SecurityAdvisoryManage.java @@ -0,0 +1,119 @@ +package com.ningdatech.carapi.safe.manage; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.springframework.stereotype.Component; + +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.basic.util.CollUtils; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +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.safe.entity.NdSecurityAdvisory; +import com.ningdatech.carapi.safe.entity.NdSecurityNoticeSaveReq; +import com.ningdatech.carapi.safe.model.dto.SecurityAdvisoryPageQuery; +import com.ningdatech.carapi.safe.model.vo.NdSecurityAdvisoryVO; +import com.ningdatech.carapi.safe.service.INdSecurityAdvisoryService; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +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 lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @description + * @since 2022/11/16 16:00 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class SecurityAdvisoryManage { + private final INdSecurityAdvisoryService ndSecurityAdvisoryService; + private final RegionsCacheHelper regionsCacheHelper; + + public PageVo buildWrapper(SecurityAdvisoryPageQuery securityAdvisoryPageQuery) { + // Page page = securityAdvisoryPageQuery.page(); + + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + + Integer pageNumber = securityAdvisoryPageQuery.getPageNumber(); + Integer pageSize = securityAdvisoryPageQuery.getPageSize(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdSecurityAdvisory.class); + // SecurityAdvisoryManage context = (SecurityAdvisoryManage) AopContext.currentProxy(); + List securityAdvisoryList = + ndSecurityAdvisoryService.dataScopeList(wrapper, securityAdvisoryPageQuery); + // 省里上传的文件,下级账号也要能看到 + if (!UserRoleTypeEnum.SYSTEM_ADMIN_ROLE_ID.getId().equals(roleId)) { + List securityAdvisories = ndSecurityAdvisoryService + .list(Wrappers.lambdaQuery(NdSecurityAdvisory.class).isNotNull(NdSecurityAdvisory::getRegionId) + .eq(NdSecurityAdvisory::getRegionId, DefValConstants.ZJREGION_ID) + .eq(Objects.nonNull(securityAdvisoryPageQuery.getAdvisoryDate()),NdSecurityAdvisory::getAdvisoryDate, + securityAdvisoryPageQuery.getAdvisoryDate())); + securityAdvisoryList.addAll(securityAdvisories); + } + + if (CollUtil.isEmpty(securityAdvisoryList)) { + return PageVo.empty(); + } + + List records = securityAdvisoryList.stream() + .skip((long)(pageNumber - 1) * pageSize) + .limit(pageSize).collect(Collectors.toList()); + + // context.searAdvisory(page, wrapper, securityAdvisoryPageQuery); + + List data = CollUtils.convert(records, e -> { + NdSecurityAdvisoryVO vo = BeanUtil.copyProperties(e, NdSecurityAdvisoryVO.class); + CodeUtil.searchRegionName(vo); + return vo; + }); + return PageVo.of(data, securityAdvisoryList.size()); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(wrapperIndex = 1, entityIndex = 2) + public void searAdvisory(Page page, LambdaQueryWrapper wrapper, + SecurityAdvisoryPageQuery securityAdvisoryPageQuery) { + LocalDateTime time = securityAdvisoryPageQuery.getAdvisoryDate(); + if (Objects.nonNull(time)) { + wrapper.ge(NdSecurityAdvisory::getAdvisoryDate, time).lt(NdSecurityAdvisory::getAdvisoryDate, + time.plusMonths(1)); + } + wrapper.orderBy(Boolean.TRUE, Boolean.FALSE, NdSecurityAdvisory::getAdvisoryDate); + ndSecurityAdvisoryService.page(page, wrapper); + } + + public void saveSecurityNotice(NdSecurityNoticeSaveReq req) { + NdSecurityAdvisory ndSecurityAdvisory = BeanUtil.copyProperties(req, NdSecurityAdvisory.class); + ndSecurityAdvisory.setCreateBy(LoginUserUtil.getUserId()); + ndSecurityAdvisory.setCreateOn(LocalDateTime.now()); + ndSecurityAdvisory.setRegionId(req.getRegionId()); + ndSecurityAdvisory.setRegionName(regionsCacheHelper.getDisplayName(req.getRegionId())); + ndSecurityAdvisory.setAdvisoryDate(req.getYearMonth()); + ndSecurityAdvisory.setFileId(req.getFileId()); + ndSecurityAdvisory.setAdvisoryFileName(req.getFileName()); + ndSecurityAdvisory.setCompanyId(LoginUserUtil.loginUserDetail().getCompanyId()); + ndSecurityAdvisoryService.save(ndSecurityAdvisory); + } + + public void deleteSecurityNotice(Long id) { + ndSecurityAdvisoryService.deleteById(id); + } + + public void incrementDownCount(Long id) { + ndSecurityAdvisoryService.incrementDownCount(id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/SecurityHonestyManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/SecurityHonestyManage.java new file mode 100644 index 0000000..23e1a1b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/SecurityHonestyManage.java @@ -0,0 +1,163 @@ +package com.ningdatech.carapi.safe.manage; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +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.basic.util.CollUtils; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.company.entity.CompanySecurityCommitment; +import com.ningdatech.carapi.company.service.ICompanySecurityCommitmentService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.safe.constant.SecurityContant; +import com.ningdatech.carapi.safe.entity.NdSafetyCommitment; +import com.ningdatech.carapi.safe.entity.NdSafetyCredit; +import com.ningdatech.carapi.safe.model.dto.SecurityHonestyPageQuery; +import com.ningdatech.carapi.safe.model.vo.NdSafetyCommitmentVO; +import com.ningdatech.carapi.safe.model.vo.NdSafetyCreditVO; +import com.ningdatech.carapi.safe.service.INdSafetyCommitmentService; +import com.ningdatech.carapi.safe.service.INdSafetyCreditService; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.manage.CompanyManage; +import com.ningdatech.carapi.sys.service.CompanyService; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author CMM + * @description SecurityHonestyManage + * @since 2022/11/16 16:00 + */ +@Component +@RequiredArgsConstructor +public class SecurityHonestyManage { + private final INdSafetyCommitmentService safetyCommitmentService; + private final INdSafetyCreditService safetyCreditService; + + private final CompanyService companyService; + + private final ICompanySecurityCommitmentService commitmentService; + + public PageVo queryCommitment(SecurityHonestyPageQuery param) { + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Company.class) + .ne(Company::getCompanyType,0); + companyService.pageDataScope(page,wrapper,param); + if(0L == page.getTotal()){ + return PageVo.empty(); + } + + List companyIds = page.getRecords().stream().map(Company::getId).collect(Collectors.toList()); + //去查出 安全承诺 列表 + List commitments = commitmentService.list(Wrappers.lambdaQuery(CompanySecurityCommitment.class) + .in(CompanySecurityCommitment::getCompanyId,companyIds)); + //分组 map + Map> dataMap = commitments.stream().collect(Collectors.groupingBy(CompanySecurityCommitment::getCompanyId)); + + final Long[] index = {1L}; + List data = CollUtils.convert(page.getRecords(), e -> { + NdSafetyCommitmentVO vo = BeanUtil.copyProperties(e, NdSafetyCommitmentVO.class); + vo.setId(index[0]); + vo.setCompanyId(e.getId()); + vo.setCompanyAddress(e.getAddress()); + CodeUtil.searchCompanyNameAndRegionName(vo); + countCommitment(vo,dataMap.get(e.getId())); + index[0]++; + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + //统计 安全承诺数 + private void countCommitment(NdSafetyCommitmentVO vo, List companySecurityCommitments) { + if(CollUtil.isEmpty(companySecurityCommitments)){ + return; + } + //向社会承诺 + Integer commitmentsToSocial = 0; + //向员工承诺 + Integer commitmentsToEmployee = 0; + //总经理承诺 + Integer generalManagercommitment = 0; + //分管总承诺 + Integer leaderInChargeCommitment = 0; + //车队长承诺 + Integer teamLeaderCommitment = 0; + //驾驶员承诺 + Integer driverCommitment = 0; + for(CompanySecurityCommitment commitment : companySecurityCommitments){ + if(SecurityContant.Commitment.COMMITMENT_SOCIAL.equals( + commitment.getCommitmentTarget())){ + commitmentsToSocial++; + }else if(SecurityContant.Commitment.COMMITMENT_EMPLOYEE.equals( + commitment.getCommitmentTarget())){ + commitmentsToEmployee++; + }else if(SecurityContant.Commitment.COMMITMENT_GENERAL.equals( + commitment.getPromisee())){ + generalManagercommitment++; + }else if(SecurityContant.Commitment.COMMITMENT_LEADER.equals( + commitment.getPromisee())){ + leaderInChargeCommitment++; + }else if(SecurityContant.Commitment.COMMITMENT_TEAMLEADER.equals( + commitment.getPromisee())){ + teamLeaderCommitment++; + }else if(SecurityContant.Commitment.COMMITMENT_DRIVER.equals( + commitment.getPromisee())){ + driverCommitment++; + } + } + vo.setCommitmentsToSocial(commitmentsToSocial); + vo.setCommitmentsToEmployee(commitmentsToEmployee); + vo.setGeneralManagercommitment(generalManagercommitment); + vo.setLeaderInChargeCommitment(leaderInChargeCommitment); + vo.setDriverCommitment(driverCommitment); + vo.setTeamLeaderCommitment(teamLeaderCommitment); + } + + public void buildCommitmentWrapper(Page page, SecurityHonestyPageQuery securityAdvisoryPageQuery) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdSafetyCommitment.class); + SecurityHonestyManage context = (SecurityHonestyManage)AopContext.currentProxy(); + context.searchCommitment(page,wrapper,securityAdvisoryPageQuery); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public void searchCommitment(Page page, LambdaQueryWrapper wrapper, SecurityHonestyPageQuery securityAdvisoryPageQuery) { + wrapper.like(StringUtils.isNotBlank(securityAdvisoryPageQuery.getCompanyName()),NdSafetyCommitment::getCompanyName,securityAdvisoryPageQuery.getCompanyName()); + wrapper.orderBy(Boolean.TRUE,Boolean.FALSE,NdSafetyCommitment::getUpdateOn); + safetyCommitmentService.page(page, wrapper); + } + + public PageVo queryCredit(SecurityHonestyPageQuery securityAdvisoryPageQuery) { + Page page = securityAdvisoryPageQuery.page(); + buildCreditWrapper(page, securityAdvisoryPageQuery); + List data = CollUtils.convert(page.getRecords(), e -> { + NdSafetyCreditVO vo = BeanUtil.copyProperties(e, NdSafetyCreditVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + public void buildCreditWrapper(Page page, SecurityHonestyPageQuery securityAdvisoryPageQuery) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdSafetyCredit.class); + SecurityHonestyManage context = (SecurityHonestyManage)AopContext.currentProxy(); + context.searchCredit(page, wrapper, securityAdvisoryPageQuery); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public void searchCredit(Page page, LambdaQueryWrapper wrapper, SecurityHonestyPageQuery securityAdvisoryPageQuery) { + wrapper.like(StringUtils.isNotBlank(securityAdvisoryPageQuery.getCompanyName()),NdSafetyCredit::getCompanyName,securityAdvisoryPageQuery.getCompanyName()); + wrapper.orderBy(Boolean.TRUE,Boolean.FALSE,NdSafetyCredit::getUpdateOn); + safetyCreditService.page(page, wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/VehicleAccidentManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/VehicleAccidentManage.java new file mode 100644 index 0000000..4b9a07a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/VehicleAccidentManage.java @@ -0,0 +1,665 @@ +package com.ningdatech.carapi.safe.manage; + +import java.io.*; +import java.net.URLEncoder; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.aop.framework.AopContext; +import org.springframework.context.ApplicationContext; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.NdDateUtils; +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.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.report.constants.ReportConstant; +import com.ningdatech.carapi.safe.constant.AccidentTypeEnum; +import com.ningdatech.carapi.safe.constant.VehicleAccidentReportEnum; +import com.ningdatech.carapi.safe.constant.VehicleAccidentReportStatusEnum; +import com.ningdatech.carapi.safe.entity.NdVehicleAccident; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentAnalysis; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentDead; +import com.ningdatech.carapi.safe.entity.VehicleAccidentReport; +import com.ningdatech.carapi.safe.model.dto.AccidentAuditDTO; +import com.ningdatech.carapi.safe.model.dto.AccidentPageQuery; +import com.ningdatech.carapi.safe.model.dto.NdVehicleAccidentDTO; +import com.ningdatech.carapi.safe.model.dto.VehicleAccidentReportDTO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentAnalysisVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentDeadVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentReportVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleAccidentVO; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentAnalysisService; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentDeadService; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentService; +import com.ningdatech.carapi.safe.service.IVehicleAccidentReportService; +import com.ningdatech.carapi.scheduler.enums.DataTypeEnum; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.TemplateExportParams; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.poi.excel.ExcelUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author PoffyZhang + * @date 2022/10/19 上午11:18 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class VehicleAccidentManage { + + private final INdVehicleAccidentService vehicleAccidentService; + private final INdVehicleAccidentDeadService vehicleAccidentDeadService; + private final INdVehicleAccidentAnalysisService vehicleAccidentAnalysisService; + private final IVehicleAccidentReportService vehicleAccidentReportService; + private final ApplicationContext applicationContext; + private final OperatorsCacheHelper operatorsCacheHelper; + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final CompaniesCacheHelper companiesCacheHelper; + private final RegionsCacheHelper regionsCacheHelper; + + public PageVo queryVehicleAccident(AccidentPageQuery accidentPageQuery) { + ((VehicleAccidentManage) AopContext.currentProxy()).queryAccident(); + // 以车辆事故维度 + Page page = accidentPageQuery.page(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 查询出该运营商下所有车辆 + List baseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)); + List carPlateList = baseInfoList.stream().map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + accidentPageQuery.setCarPlateList(carPlateList); + } + + vehicleAccident(page, accidentPageQuery); + List data = CollUtils.convert(page.getRecords(), e -> { + NdVehicleAccidentVO vo = BeanUtil.copyProperties(e, NdVehicleAccidentVO.class); + + String desc = VehicleTypeEnum.getDescByCode(vo.getVehicleType()); + Integer injuries = e.getInjuries(); + Integer deathToll = e.getDeathToll(); + vo.setInjuries(injuries); + vo.setDeathToll(deathToll); + vo.setAccidentType(e.getAccidentType()); + vo.setAccidentTypeName(AccidentTypeEnum.getDescByCode(e.getAccidentType())); + vo.setBriefCase(e.getBriefCase()); + vo.setFirmContent(e.getFirmContent()); + //if (injuries == 0 && deathToll == 0){ + // vo.setAccidentType(AccidentTypeEnum.OTHER.getCode()); + // vo.setAccidentTypeName(AccidentTypeEnum.OTHER.getDesc()); + //}else if (injuries != 0 && deathToll == 0){ + // vo.setAccidentType(AccidentTypeEnum.INJURY.getCode()); + // vo.setAccidentTypeName(AccidentTypeEnum.INJURY.getDesc()); + //}else { + // vo.setAccidentType(AccidentTypeEnum.DEAD.getCode()); + // vo.setAccidentTypeName(AccidentTypeEnum.DEAD.getDesc()); + //} + vo.setVehicleTypeName(desc); + vo.setReportStatusName(VehicleAccidentReportStatusEnum.getDescByCode(e.getReportStatus())); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + public PageVo queryVehicleAccidentOpen(AccidentPageQuery accidentPageQuery) { + ((VehicleAccidentManage) AopContext.currentProxy()).queryAccident(); + // 以车辆事故维度 + Page page = accidentPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleAccident.class); + searchVehicleAccidentWrapper(wrapper, accidentPageQuery); + vehicleAccidentService.page(page, wrapper); + List data = CollUtils.convert(page.getRecords(), e -> { + NdVehicleAccidentVO vo = BeanUtil.copyProperties(e, NdVehicleAccidentVO.class); + String desc = VehicleTypeEnum.getDescByCode(vo.getVehicleType()); + vo.setVehicleTypeName(desc); + vo.setReportStatusName(VehicleAccidentReportStatusEnum.getDescByCode(e.getReportStatus())); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + @Async + protected void queryAccident() { + log.info("查询时车辆出险上报校对"); + //获取事故上报审核列表中通过审核的上报信息 + List reportList = vehicleAccidentReportService.list(Wrappers.lambdaQuery(VehicleAccidentReport.class) + .select(VehicleAccidentReport::getCarPlate, VehicleAccidentReport::getAccidentTime) + .eq(VehicleAccidentReport::getAuditStatus, VehicleAccidentReportEnum.AUDIT_APPROVED.getCode())); + Map> carPlateMapDate = reportList.stream() + .collect(Collectors.groupingBy(VehicleAccidentReport::getCarPlate, + Collectors.mapping(w -> w.getAccidentTime().toLocalDate(), Collectors.toSet()))); + //获取车辆事故信息表中的所有数据 + List records = vehicleAccidentService.list(Wrappers.lambdaQuery(NdVehicleAccident.class) + .select(NdVehicleAccident::getCarPlate, NdVehicleAccident::getAccidentTime)); + //对比两个列表中的数据,更新车辆事故信息表中的上报状态 + List reported = records.stream().filter(w -> { + Set dates = carPlateMapDate.get(w.getCarPlate()); + if (CollUtil.isNotEmpty(dates)) { + return dates.contains(w.getAccidentTime().toLocalDate()); + } + return false; + }).map(NdVehicleAccident::getId).collect(Collectors.toList()); + if (!reported.isEmpty()) { + LambdaUpdateWrapper update = Wrappers.lambdaUpdate(NdVehicleAccident.class) + .set(NdVehicleAccident::getReportStatus, VehicleAccidentReportStatusEnum.REPORTED.getCode()) + .in(NdVehicleAccident::getId, reported); + vehicleAccidentService.update(update); + } + } + + public PageVo queryDead(AccidentPageQuery accidentPageQuery) { + ((VehicleAccidentManage) AopContext.currentProxy()).queryAccidentDead(); + //以死亡事故为维度 + Page page = accidentPageQuery.page(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 查询出该运营商下所有车辆 + List baseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)); + List carPlateList = baseInfoList.stream().map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + accidentPageQuery.setCarPlateList(carPlateList); + } + + vehicleAccidentDead(page, accidentPageQuery); + List data = CollUtils.convert(page.getRecords(), e -> { + NdVehicleAccidentDeadVO vo = BeanUtil.copyProperties(e, NdVehicleAccidentDeadVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + vo.setReportStatusName(VehicleAccidentReportStatusEnum.getDescByCode(e.getReportStatus())); + vo.setBriefCase(e.getBriefCase()); + vo.setFirmContent(e.getFirmContent()); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + public PageVo queryDeadOpen(AccidentPageQuery accidentPageQuery) { + ((VehicleAccidentManage) AopContext.currentProxy()).queryAccidentDead(); + //以死亡事故为维度 + Page page = accidentPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleAccidentDead.class); + searchvehicleAccidentDeadWrapper(page, wrapper, accidentPageQuery); + List data = CollUtils.convert(page.getRecords(), e -> { + NdVehicleAccidentDeadVO vo = BeanUtil.copyProperties(e, NdVehicleAccidentDeadVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + vo.setReportStatusName(VehicleAccidentReportStatusEnum.getDescByCode(e.getReportStatus())); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + @Async + protected void queryAccidentDead() { + log.info("查询时车辆出险上报校对"); + //获取事故上报审核列表中通过审核的上报信息 + List reportList = vehicleAccidentReportService.list(Wrappers.lambdaQuery(VehicleAccidentReport.class) + .select(VehicleAccidentReport::getCarPlate, VehicleAccidentReport::getAccidentTime) + .eq(VehicleAccidentReport::getAuditStatus, VehicleAccidentReportEnum.AUDIT_APPROVED.getCode())); + Map> carPlateMapDate = reportList.stream() + .collect(Collectors.groupingBy(VehicleAccidentReport::getCarPlate, + Collectors.mapping(w -> w.getAccidentTime().toLocalDate(), Collectors.toSet()))); + //获取车辆死亡事故信息表中的所有数据 + List records = vehicleAccidentDeadService.list(Wrappers.lambdaQuery(NdVehicleAccidentDead.class) + .select(NdVehicleAccidentDead::getCarPlate, NdVehicleAccidentDead::getAccidentTime)); + //对比两个列表中的数据,更新车辆死亡事故信息表中的上报状态 + List reported = records.stream().filter(w -> { + Set dates = carPlateMapDate.get(w.getCarPlate()); + if (CollUtil.isNotEmpty(dates)) { + return dates.contains(w.getAccidentTime().toLocalDate()); + } + return false; + }).map(NdVehicleAccidentDead::getId).collect(Collectors.toList()); + if (!reported.isEmpty()) { + LambdaUpdateWrapper update = Wrappers.lambdaUpdate(NdVehicleAccidentDead.class) + .set(NdVehicleAccidentDead::getReportStatus, VehicleAccidentReportStatusEnum.REPORTED.getCode()) + .in(NdVehicleAccidentDead::getId, reported); + vehicleAccidentDeadService.update(update); + } + } + + public PageVo queryAccidentAnalysis(AccidentPageQuery accidentPageQuery) { + //事故分析 + Page page = accidentPageQuery.page(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 查询出该运营商下所有车辆 + List baseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)); + List carPlateList = baseInfoList.stream().map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + accidentPageQuery.setCarPlateList(carPlateList); + } + + vehicleAccidentAnalysisService.pageAnalysis(page, accidentPageQuery); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List data = CollUtils.convert(page.getRecords(), e -> { + NdVehicleAccidentAnalysisVO vo = BeanUtil.copyProperties(e, NdVehicleAccidentAnalysisVO.class); + CodeUtil.searchRegionName(vo); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + public PageVo queryAccidentAnalysisOpen(AccidentPageQuery accidentPageQuery) { + //事故分析 + Page page = accidentPageQuery.page(); + vehicleAccidentAnalysisService.pageAnalysisOpen(page, accidentPageQuery); + if (0L == page.getTotal()) { + return PageVo.empty(); + } + List data = CollUtils.convert(page.getRecords(), e -> { + NdVehicleAccidentAnalysisVO vo = BeanUtil.copyProperties(e, NdVehicleAccidentAnalysisVO.class); + CodeUtil.searchRegionName(vo); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + public void vehicleAccident(Page page, AccidentPageQuery accidentPageQuery) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleAccident.class); + VehicleAccidentManage clazz = (VehicleAccidentManage) AopContext.currentProxy(); + clazz.searchVehicleAccidentWrapper(wrapper, accidentPageQuery); + vehicleAccidentService.page(page,wrapper); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public void searchVehicleAccidentWrapper(LambdaQueryWrapper wrapper, AccidentPageQuery param) { + wrapper.ge(Objects.nonNull(param.getStartTime()), NdVehicleAccident::getAccidentTime, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), NdVehicleAccident::getAccidentTime, param.getEndTime()) + .like(Objects.nonNull(param.getCarPlate()), NdVehicleAccident::getCarPlate, param.getCarPlate()) + .like(StringUtils.isNotBlank(param.getCompanyName()), NdVehicleAccident::getCompanyName, param.getCompanyName()) + .eq(Objects.nonNull(param.getVehicleType()), NdVehicleAccident::getVehicleType, param.getVehicleType()) + .in(CollUtil.isNotEmpty(param.getCarPlateList()),NdVehicleAccident::getCarPlate,param.getCarPlateList()) + .eq(Objects.nonNull(param.getAccidentType()),NdVehicleAccident::getAccidentType,param.getAccidentType()) + .eq(Objects.nonNull(param.getReportStatus()), NdVehicleAccident::getReportStatus, param.getReportStatus()); + wrapper.orderBy(Boolean.TRUE, Boolean.FALSE, NdVehicleAccident::getAccidentTime); + } + + public void vehicleAccidentDead(Page page, AccidentPageQuery accidentPageQuery) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleAccidentDead.class); + VehicleAccidentManage clazz = (VehicleAccidentManage) AopContext.currentProxy(); + clazz.searchvehicleAccidentDeadWrapper(page, wrapper, accidentPageQuery); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2, wrapperIndex = 1) + public void searchvehicleAccidentDeadWrapper(Page page, LambdaQueryWrapper wrapper, AccidentPageQuery param) { + wrapper.ge(Objects.nonNull(param.getStartTime()), NdVehicleAccidentDead::getAccidentTime, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), NdVehicleAccidentDead::getAccidentTime, param.getEndTime()) + .like(Objects.nonNull(param.getCarPlate()), NdVehicleAccidentDead::getCarPlate, param.getCarPlate()) + .like(StringUtils.isNotBlank(param.getCompanyName()), NdVehicleAccidentDead::getCompanyName, param.getCompanyName()) + .eq(Objects.nonNull(param.getReportStatus()), NdVehicleAccidentDead::getReportStatus, param.getReportStatus()); + wrapper.orderBy(Boolean.TRUE, Boolean.FALSE, NdVehicleAccidentDead::getAccidentTime); + vehicleAccidentDeadService.page(page, wrapper); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2, wrapperIndex = 1) + public void searchvehicleAccidentAnalysisWrapper(Page page, LambdaQueryWrapper wrapper, AccidentPageQuery param) { + wrapper.ge(Objects.nonNull(param.getStartTime()), NdVehicleAccidentAnalysis::getAccidentTime, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), NdVehicleAccidentAnalysis::getAccidentTime, param.getEndTime()); + wrapper.orderBy(Boolean.TRUE, Boolean.FALSE, NdVehicleAccidentAnalysis::getAccidentTime); + vehicleAccidentAnalysisService.page(page, wrapper); + } + + public PageVo reportAccidentInfo(AccidentPageQuery accidentPageQuery) { + Page page = accidentPageQuery.page(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 查询出该运营商下所有车辆所在的所有企业 + List baseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)); + List carPlateList = baseInfoList.stream().map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + accidentPageQuery.setCarPlateList(carPlateList); + } + + vehicleAccidentReport(page, accidentPageQuery); + List data = CollUtils.convert(page.getRecords(), e -> { + NdVehicleAccidentReportVO vo = BeanUtil.copyProperties(e, NdVehicleAccidentReportVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + String createTime = LocalDateTimeUtil.format(e.getCreateOn(), "yyyy-MM-dd HH:mm"); + vo.setCreateTime(createTime); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + private void vehicleAccidentReport(Page page, AccidentPageQuery accidentPageQuery) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(VehicleAccidentReport.class); + VehicleAccidentManage clazz = (VehicleAccidentManage) AopContext.currentProxy(); + clazz.searchvehicleAccidentReportWrapper(page, wrapper, accidentPageQuery); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2, wrapperIndex = 1) + public void searchvehicleAccidentReportWrapper(Page page, LambdaQueryWrapper wrapper, AccidentPageQuery param) { + wrapper.ge(Objects.nonNull(param.getStartTime()), VehicleAccidentReport::getAccidentTime, param.getStartTime()) + .le(Objects.nonNull(param.getEndTime()), VehicleAccidentReport::getAccidentTime, param.getEndTime()) + .like(Objects.nonNull(param.getCarPlate()), VehicleAccidentReport::getCarPlate, param.getCarPlate()) + .in(CollUtil.isNotEmpty(param.getCarPlateList()),VehicleAccidentReport::getCarPlate,param.getCarPlateList()) + .eq(Objects.nonNull(param.getAuditStatus()), VehicleAccidentReport::getAuditStatus, param.getAuditStatus()); + wrapper.orderBy(Boolean.TRUE, Boolean.FALSE, VehicleAccidentReport::getCreateOn); + vehicleAccidentReportService.page(page, wrapper); + } + + @Transactional(rollbackFor = Exception.class) + public VehicleAccidentReport save(VehicleAccidentReportDTO data, Long userId) { + //获取登录用户信息 + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + //获取入参信息 + Long vehicleAccidentReportId = data.getId(); + VehicleAccidentReport vehicleAccidentReport; + if (Objects.isNull(vehicleAccidentReportId)) { + vehicleAccidentReport = new VehicleAccidentReport(); + BeanUtil.copyProperties(data, vehicleAccidentReport); + vehicleAccidentReport.setRegionId(userInfoDetails.getRegionId()); + vehicleAccidentReport.setRegionName(userInfoDetails.getRegionName()); + vehicleAccidentReport.setCompanyId(userInfoDetails.getCompanyId()); + vehicleAccidentReport.setCompanyName(userInfoDetails.getCompanyName()); + vehicleAccidentReport.setCreateOn(LocalDateTime.now()); + vehicleAccidentReport.setCreateBy(userId); + vehicleAccidentReport.setUpdateBy(userId); + vehicleAccidentReport.setUpdateOn(LocalDateTime.now()); + vehicleAccidentReport.setAuditStatus(VehicleAccidentReportEnum.UN_AUDIT.getCode()); + vehicleAccidentReportService.save(vehicleAccidentReport); + } else { + vehicleAccidentReport = vehicleAccidentReportService.getById(vehicleAccidentReportId); + BeanUtil.copyProperties(data, vehicleAccidentReport); + vehicleAccidentReport.setRegionId(userInfoDetails.getRegionId()); + vehicleAccidentReport.setRegionName(userInfoDetails.getRegionName()); + vehicleAccidentReport.setCompanyId(userInfoDetails.getCompanyId()); + vehicleAccidentReport.setCompanyName(userInfoDetails.getCompanyName()); + vehicleAccidentReport.setUpdateBy(userId); + vehicleAccidentReport.setUpdateOn(LocalDateTime.now()); + vehicleAccidentReport.setAuditStatus(VehicleAccidentReportEnum.UN_AUDIT.getCode()); + vehicleAccidentReportService.updateById(vehicleAccidentReport); + } + return vehicleAccidentReport; + } + + public VehicleAccidentReport getDetail(Long id) { + return vehicleAccidentReportService.getById(id); + } + + public Boolean delete(Long id) { + VehicleAccidentReport vehicleAccidentReport = vehicleAccidentReportService.getById(id); + Long companyId = vehicleAccidentReport.getCompanyId(); + CompanyDTO companyDto = companiesCacheHelper.getById(companyId); + // 判断上报数据的企业所在的区域是否在登录用户所属的区域权限下 + Long countryRegionId = companyDto.getRegionId(); + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId = userDetail.getRegionId(); + List childList = regionsCacheHelper.listChildRegionId(regionId, true, true); + // 不在本级及下级区域的上报数据,不允许删除 + if (!childList.contains(countryRegionId)){ + return Boolean.FALSE; + } + return vehicleAccidentReportService.removeById(id); + } + + public Boolean audit(AccidentAuditDTO param) { + + VehicleAccidentReport vehicleAccidentReport = vehicleAccidentReportService.getById(param.getId()); + Long companyId = vehicleAccidentReport.getCompanyId(); + CompanyDTO companyDto = companiesCacheHelper.getById(companyId); + // 判断上报数据的企业所在的区域是否在登录用户所属的区域权限下 + Long countryRegionId = companyDto.getRegionId(); + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long regionId = userDetail.getRegionId(); + List childList = regionsCacheHelper.listChildRegionId(regionId, true, true); + // 不在本级及下级区域的上报数据,不允许审核 + if (!childList.contains(countryRegionId)){ + return Boolean.FALSE; + } + + if (Objects.isNull(vehicleAccidentReport)) { + throw new BizException("审核记录不存在!"); + } + if (!VehicleAccidentReportEnum.UN_AUDIT.getCode().equals(vehicleAccidentReport.getAuditStatus())) { + throw new BizException("只能审核待审核的上报信息!"); + } + vehicleAccidentReport.setAuditStatus(param.getAuditStatus()); + vehicleAccidentReport.setAuditOpinion(param.getAuditOpinion()); + vehicleAccidentReport.setAuditor(LoginUserUtil.getUsername()); + vehicleAccidentReport.setAuditorUserId(LoginUserUtil.getUserId()); + vehicleAccidentReport.setUpdateOn(LocalDateTime.now()); + boolean result = vehicleAccidentReportService.updateById(vehicleAccidentReport); + Integer injuries = vehicleAccidentReport.getInjuries(); + Integer deathToll = vehicleAccidentReport.getDeathToll(); + + // 如果审核通过 + if (VehicleAccidentReportEnum.AUDIT_APPROVED.getCode().equals(param.getAuditStatus())){ + // 判断该数据是否在车辆事故信息表和车辆死亡事故信息中,如果不在要发布事件 + LocalDateTime accidentTime = vehicleAccidentReport.getAccidentTime(); + LocalDateTime startTime = accidentTime.minusMinutes(5L); + LocalDateTime endTime = accidentTime.plusMinutes(5L); + String startTimeFormat = NdDateUtils.format(startTime, "yyyy-MM-dd HH:mm:00"); + String endTimeFormat = NdDateUtils.format(endTime, "yyyy-MM-dd HH:mm:59"); + LocalDateTime queryStartTime = LocalDateTimeUtil.parse(startTimeFormat,"yyyy-MM-dd HH:mm:00"); + LocalDateTime queryEndTime = LocalDateTimeUtil.parse(endTimeFormat,"yyyy-MM-dd HH:mm:59"); + + NdVehicleAccident vehicleAccident = vehicleAccidentService.getOne(Wrappers.lambdaQuery(NdVehicleAccident.class) + .eq(NdVehicleAccident::getCarPlate, vehicleAccidentReport.getCarPlate()) + .eq(NdVehicleAccident::getAccidentTime, vehicleAccidentReport.getAccidentTime()) + .ge(NdVehicleAccident::getAccidentTime,queryStartTime) + .le(NdVehicleAccident::getAccidentTime,queryEndTime) + .eq(NdVehicleAccident::getAccidentDriver, vehicleAccidentReport.getAccidentDriver())); + + NdVehicleAccidentDead vehicleAccidentDead = vehicleAccidentDeadService.getOne(Wrappers.lambdaQuery(NdVehicleAccidentDead.class) + .eq(NdVehicleAccidentDead::getCarPlate, vehicleAccidentReport.getCarPlate()) + .eq(NdVehicleAccidentDead::getAccidentDriver, vehicleAccidentReport.getAccidentDriver()) + .ge(NdVehicleAccidentDead::getAccidentTime,queryStartTime) + .le(NdVehicleAccidentDead::getAccidentTime,queryEndTime) + .eq(NdVehicleAccidentDead::getDeathToll, vehicleAccidentReport.getDeathToll())); + + // 既没有受伤人数也没有死亡人数,不发布事件 + if (injuries == 0 && deathToll == 0){ + return result; + } + } + return result; + } + + public void exportVehicleAccidentData(AccidentPageQuery accidentPageQuery, HttpServletResponse response) { + ((VehicleAccidentManage) AopContext.currentProxy()).queryAccident(); + // 以车辆事故维度 + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 查询出该运营商下所有车辆 + List baseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)); + List carPlateList = baseInfoList.stream().map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + accidentPageQuery.setCarPlateList(carPlateList); + } + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleAccident.class); + VehicleAccidentManage clazz = (VehicleAccidentManage) AopContext.currentProxy(); + clazz.searchVehicleAccidentWrapper(wrapper, accidentPageQuery); + List accidents = vehicleAccidentService.list(wrapper); + + List data = CollUtils.convert(accidents, e -> { + NdVehicleAccidentDTO vo = BeanUtil.copyProperties(e, NdVehicleAccidentDTO.class); + vo.setCarPlate(e.getCarPlate()); + vo.setAccidentTime(NdDateUtils.format(e.getAccidentTime(),NdDateUtils.DEFAULT_DATE_TIME_FORMAT)); + String desc = VehicleTypeEnum.getDescByCode(e.getVehicleType()); + Integer injuries = e.getInjuries(); + Integer deathToll = e.getDeathToll(); + vo.setInjuries(injuries); + vo.setDeathToll(deathToll); + vo.setAccidentTypeName(AccidentTypeEnum.getDescByCode(e.getAccidentType())); + vo.setBriefCase(e.getBriefCase()); + vo.setAccidentNo(e.getAccidentNo()); + vo.setFirmContent(e.getFirmContent()); + vo.setVehicleTypeName(desc); + vo.setReportStatusName(VehicleAccidentReportStatusEnum.getDescByCode(e.getReportStatus())); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + + File directory = new File(""); + String templateName; + String templatePath; + List dtoList = Lists.newArrayList(); + if (CollUtil.isNotEmpty(data)) { + templateName = ReportConstant.VEHICLE_ACCIDENT_DATA_TEMPLATE; + List dataList = new ArrayList<>(); + data.forEach(m -> { + LinkedHashMap dataMap = new LinkedHashMap<>(); + dataMap.put("regionName",m.getRegionName()); + dataMap.put("carPlate",m.getCarPlate()); + dataMap.put("accidentTime",m.getAccidentTime()); + dataMap.put("accidentDriver",m.getAccidentDriver()); + dataMap.put("vehicleTypeName",m.getVehicleTypeName()); + dataMap.put("companyName",m.getCompanyName()); + dataMap.put("accidentAddress",m.getAccidentAddress()); + dataMap.put("injuries",m.getInjuries()); + dataMap.put("deathToll",m.getDeathToll()); + dataMap.put("reportStatusName",m.getReportStatusName()); + dataMap.put("accidentTypeName",m.getAccidentTypeName()); + dataMap.put("briefCase",m.getBriefCase()); + dataMap.put("accidentNo",m.getAccidentNo()); + dataMap.put("firmContent",m.getFirmContent()); + dataList.add(dataMap); + }); + dtoList = dataList; + }else { + templateName = ReportConstant.VEHICLE_ACCIDENT_DATA_TEMPLATE_EMPTY; + } + templatePath = directory.getAbsolutePath() + File.separator + "template" + File.separator + templateName + ".xlsx"; + // 获取本地目录的Excel模板 + TemplateExportParams temp = new TemplateExportParams(templatePath); + temp.setSheetNum(new Integer[] {0}); + temp.setSheetName(new String[] {templateName}); + Map map = new HashMap<>(4); + map.put("mapList", dtoList); + Workbook workbook = ExcelExportUtil.exportExcel(temp, map); + Sheet sheet = workbook.getSheet(templateName); + sheet.autoSizeColumn(0); + // 设置所有列宽自适应 + for (int colnum = 0; colnum < 13; colnum++) { + sheet.autoSizeColumn(colnum); + } + if (CollUtil.isEmpty(dtoList)) { + // 输出空模板 + // 获取本地目录的空Excel模板 + try { + InputStream templateInputStream = this.getClass().getClassLoader().getResourceAsStream("template" + File.separator + templateName + ".xlsx"); + OutputStream outputStream = response.getOutputStream(); + // 设置要下载的文件的名称 + ExcelDownUtil.setFileName(templateName, response); + // 设置文件的MIME类型 + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); + + byte[] b = new byte[2048]; + int len; + while ((len = templateInputStream.read(b)) != -1) { + outputStream.write(b, 0, len); + } + templateInputStream.close(); + outputStream.flush(); + outputStream.close(); + } catch (IOException e) { + throw new BizException("读取模板失败!"); + } + return; + } + if (workbook == null){ + throw new BizException("读取编辑表模板失败!"); + } + // 重置响应对象 + response.reset(); + try { + response.setHeader("Content-disposition", + "attachment;filename*=utf-8''" + URLEncoder.encode(Objects.requireNonNull(templateName), "UTF-8") + ".xlsx"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + response.setContentType(ExcelUtil.XLS_CONTENT_TYPE); + response.setHeader("Pragma", "no-cache"); + response.setHeader("Cache-Control", "no-cache"); + response.setDateHeader("Expires", 0); + // 写出数据输出流到页面 + try { + OutputStream output = response.getOutputStream(); + BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output); + workbook.write(bufferedOutPut); + bufferedOutPut.flush(); + bufferedOutPut.close(); + output.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/VehicleInsureManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/VehicleInsureManage.java new file mode 100644 index 0000000..74b68ce --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/VehicleInsureManage.java @@ -0,0 +1,415 @@ +package com.ningdatech.carapi.safe.manage; + +import java.io.*; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.aop.framework.AopContext; +import org.springframework.context.event.EventListener; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.read.listener.ReadListener; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.ValidUtil; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.common.util.ExcelDownUtil; +import com.ningdatech.carapi.common.util.ExcelExportStyle; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.industry.model.dto.LabAcceptanceCertificateImportDto; +import com.ningdatech.carapi.safe.constant.VehicleAccidentReportEnum; +import com.ningdatech.carapi.safe.constant.VehicleAccidentReportStatusEnum; +import com.ningdatech.carapi.safe.entity.NdInsureInfo; +import com.ningdatech.carapi.safe.entity.NdInsureOutDanger; +import com.ningdatech.carapi.safe.entity.VehicleAccidentReport; +import com.ningdatech.carapi.safe.model.dto.InsurePageQuery; +import com.ningdatech.carapi.safe.model.dto.NdInsureOutDangerImportDTO; +import com.ningdatech.carapi.safe.model.po.NdInsureOutDangerAnalysisPO; +import com.ningdatech.carapi.safe.model.vo.NdInsureInfoVO; +import com.ningdatech.carapi.safe.model.vo.NdInsureOutDangerAnalysisVO; +import com.ningdatech.carapi.safe.model.vo.NdInsureOutDangerVO; +import com.ningdatech.carapi.safe.service.INdInsureInfoService; +import com.ningdatech.carapi.safe.service.INdInsureOutDangerAnalysisService; +import com.ningdatech.carapi.safe.service.INdInsureOutDangerService; +import com.ningdatech.carapi.safe.service.IVehicleAccidentReportService; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.event.ImportDataEvent; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.VehiclesCacheHelper; +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.lang.Assert; +import cn.hutool.core.util.StrUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @author PoffyZhang + * @date 2022/10/19 上午11:18 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class VehicleInsureManage { + + private final INdInsureInfoService insureInfoService; + private final INdInsureOutDangerService insureOutDangerService; + private final INdInsureOutDangerAnalysisService insureOutDangerAnalysisService; + private final CompaniesCacheHelper companiesCacheHelper; + private final CompanyService companyService; + private final IVehicleAccidentReportService vehicleAccidentReportService; + private final VehiclesCacheHelper vehiclesCacheHelper; + private final INdInsureOutDangerService outDangerService; + + + public PageVo queryVehicleInsure(InsurePageQuery insurePageQuery) { + //承保信息 + Page page = insurePageQuery.page(); + insureInfo(page, insurePageQuery); + List data = CollUtils.convert(page.getRecords(), e -> { + NdInsureInfoVO vo = BeanUtil.copyProperties(e, NdInsureInfoVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + public PageVo queryOutDanger(InsurePageQuery insurePageQuery) { + ((VehicleInsureManage) AopContext.currentProxy()). queryOutDanger(); + //出险信息 + Page page = insurePageQuery.page(); + insureOutDanger(page, insurePageQuery); + List data = CollUtils.convert(page.getRecords(), e -> { + NdInsureOutDangerVO vo = BeanUtil.copyProperties(e, NdInsureOutDangerVO.class); + CodeUtil.searchCompanyNameAndRegionName(vo); + vo.setReportStatusName(VehicleAccidentReportStatusEnum.getDescByCode(e.getReportStatus())); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + @Async() + protected void queryOutDanger() { + log.info("查询时车辆出险上报校对"); + //获取事故上报审核列表中通过审核的上报信息 + List reportList = vehicleAccidentReportService.list(Wrappers.lambdaQuery(VehicleAccidentReport.class) + .select(VehicleAccidentReport::getCarPlate, VehicleAccidentReport::getAccidentTime) + .eq(VehicleAccidentReport::getAuditStatus, VehicleAccidentReportEnum.AUDIT_APPROVED.getCode())); + Map> carPlateMapDate = reportList.stream() + .collect(Collectors.groupingBy(VehicleAccidentReport::getCarPlate, + Collectors.mapping(w -> w.getAccidentTime().toLocalDate(), Collectors.toSet()))); + //获取车辆出险信息表中的所有数据 + List records = insureOutDangerService.list(Wrappers.lambdaQuery(NdInsureOutDanger.class) + .select(NdInsureOutDanger::getCarPlate, NdInsureOutDanger::getAccidentTime)); + //对比两个列表中的数据,更新车辆出险信息表中的上报状态 + List reported = records.stream().filter(w -> { + Set dates = carPlateMapDate.get(w.getCarPlate()); + if (CollUtil.isNotEmpty(dates)) { + return dates.contains(w.getAccidentTime().toLocalDate()); + } + return false; + }).map(NdInsureOutDanger::getId).collect(Collectors.toList()); + if (!reported.isEmpty()) { + LambdaUpdateWrapper update = Wrappers.lambdaUpdate(NdInsureOutDanger.class) + .set(NdInsureOutDanger::getReportStatus, VehicleAccidentReportStatusEnum.REPORTED.getCode()) + .in(NdInsureOutDanger::getId, reported); + insureOutDangerService.update(update); + } + } + + public PageVo queryInsureOutDangerAnalysis(InsurePageQuery insurePageQuery) { + //出险分析 + Page page = insurePageQuery.page(); + analysis(page, insurePageQuery); + List data = CollUtils.convert(page.getRecords(), + e -> { + NdInsureOutDangerAnalysisVO vo = BeanUtil.copyProperties(e, NdInsureOutDangerAnalysisVO.class); + CodeUtil.searchRegionName(vo); + return vo; + }); + return PageVo.of(data, page.getTotal()); + } + + public void insureInfo(Page page, InsurePageQuery insurePageQuery) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdInsureInfo.class); + VehicleInsureManage clazz = (VehicleInsureManage) AopContext.currentProxy(); + clazz.searchInsureInfo(page, wrapper, insurePageQuery); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2, wrapperIndex = 1) + public void searchInsureInfo(Page page, LambdaQueryWrapper wrapper, InsurePageQuery insurePageQuery) { + wrapper.ge(Objects.nonNull(insurePageQuery.getQibaoStartTime()), NdInsureInfo::getInsureTimeStart, insurePageQuery.getQibaoStartTime()) + .le(Objects.nonNull(insurePageQuery.getQibaoEndTime()), NdInsureInfo::getInsureTimeStart, insurePageQuery.getQibaoEndTime()) + .ge(Objects.nonNull(insurePageQuery.getDaoqiStartTime()), NdInsureInfo::getInsureTimeEnd, insurePageQuery.getDaoqiStartTime()) + .le(Objects.nonNull(insurePageQuery.getDaoqiEndTime()), NdInsureInfo::getInsureTimeEnd, insurePageQuery.getDaoqiEndTime()) + .like(Objects.nonNull(insurePageQuery.getCarPlate()), NdInsureInfo::getCarPlate, insurePageQuery.getCarPlate()) + .like(StringUtils.isNotBlank(insurePageQuery.getCompanyName()), NdInsureInfo::getCompanyName, insurePageQuery.getCompanyName()); + wrapper.orderBy(Boolean.TRUE, Boolean.FALSE, NdInsureInfo::getUpdateOn); + insureInfoService.page(page, wrapper); + } + + public void insureOutDanger(Page page, InsurePageQuery insurePageQuery) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdInsureOutDanger.class); + VehicleInsureManage clazz = (VehicleInsureManage) AopContext.currentProxy(); + clazz.searchInsureOutDanger(page, wrapper, insurePageQuery); + } + + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(entityIndex = 2, wrapperIndex = 1) + public void searchInsureOutDanger(Page page, LambdaQueryWrapper wrapper, InsurePageQuery insurePageQuery) { + wrapper.like(Objects.nonNull(insurePageQuery.getCarPlate()), NdInsureOutDanger::getCarPlate, insurePageQuery.getCarPlate()); + wrapper.eq(Objects.nonNull(insurePageQuery.getReportStatus()),NdInsureOutDanger::getReportStatus,insurePageQuery.getReportStatus()); + wrapper.orderBy(Boolean.TRUE, Boolean.FALSE, NdInsureOutDanger::getUpdateOn); + insureOutDangerService.page(page, wrapper); + } + + public void analysis(Page page, InsurePageQuery insurePageQuery) { + VehicleInsureManage clazz = (VehicleInsureManage) AopContext.currentProxy(); + clazz.searchInsureAnalysis(page, insurePageQuery); + } + + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public void searchInsureAnalysis(Page page, InsurePageQuery param) { + insureOutDangerAnalysisService.pageAnalysis(page, param); + } + + @EventListener(condition = "event.getTemplate() == T(com.ningdatech.carapi.sys.entity.enumeration.ImportTemplateEnum).INSURE_OUT_DANGER") + public void importDataListener(ImportDataEvent event) throws IOException { + MultipartFile file = (MultipartFile) event.getSource(); + EasyExcel.read(file.getInputStream(), LabAcceptanceCertificateImportDto.class, + new ReadListener() { + + final List insert = new ArrayList<>(); + + @Override + public void invoke(NdInsureOutDangerImportDTO data, AnalysisContext context) { + String s = ValidUtil.validFast(data); + Assert.isTrue(StrUtil.isBlank(s), s); + insert.add(data); + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + log.info("所有数据读取完成:{}", insert.size()); + importDataSave(insert); + } + }).sheet(0).doRead(); + } + + private void importDataSave(List records) { + Long userId = LoginUserUtil.getUserId(); + LocalDateTime now = LocalDateTime.now(); + List companyNames = CollUtils.fieldList(records, NdInsureOutDangerImportDTO::getCompanyName); + List companies = companyService.listCompanyByCompanyNames(companyNames); + Map companyMap = CollUtils.listToMap(companies, Company::getName); + List list = new ArrayList<>(); + records.forEach(w -> { + Company company = companyMap.get(w.getCompanyName()); + if (company == null) { + return; + } + NdInsureOutDanger outDanger = new NdInsureOutDanger(); + outDanger.setAccidentAddress(w.getAccidentAddress()); + outDanger.setCompanyId(company.getId()); + outDanger.setCompanyName(company.getName()); + outDanger.setRegionId(company.getRegionId()); + outDanger.setRegionName(company.getRegionName()); + outDanger.setAccidentTime(w.getAccidentTime()); + outDanger.setInjuries(w.getInjuries()); + outDanger.setInsureCompany(w.getInsureCompany()); + outDanger.setCarPlate(w.getCarPlate()); + outDanger.setDeathToll(w.getDeathToll()); + outDanger.setCompensateAmount(w.getCompensateAmount()); + outDanger.setCreateBy(userId); + outDanger.setCreateOn(now); + outDanger.setUpdateBy(userId); + outDanger.setUpdateOn(now); + list.add(outDanger); + }); + insureOutDangerService.saveBatch(list); + } + + //================================================================================================================== + + public void exportOutDanger(HttpServletResponse response, InsurePageQuery insurePageQuery) { + insurePageQuery.page(CommonConstant.EXPORT_PAGE_NUMBER, CommonConstant.EXPORT_PAGE_SIZE); + Page page = insurePageQuery.page(); + insureOutDanger(page, insurePageQuery); + List collect = page.getRecords().stream().map(w -> { + NdInsureOutDangerVO vo = BeanUtil.copyProperties(w, NdInsureOutDangerVO.class); + return vo; + }).collect(Collectors.toList()); + String fileName = "出险信息"; + ExcelDownUtil.setFileName(fileName, response); + // 数据导出处理函数 + try { + EasyExcel.write(response.getOutputStream(), NdInsureOutDangerVO.class) + .autoCloseStream(false) + .registerWriteHandler(ExcelExportStyle.formalStyle()) + .sheet(fileName) + .doWrite(collect); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void saveOrUpdate(NdInsureOutDangerVO req) { + Long userId = LoginUserUtil.getUserId(); + LocalDateTime now = LocalDateTime.now(); + NdInsureOutDanger insert = BeanUtil.copyProperties(req, NdInsureOutDanger.class); + insert.setUpdateBy(userId); + insert.setUpdateOn(now); + insert.setRegionId(companiesCacheHelper.getById(req.getCompanyId()).getRegionId()); + if (insert.getId() == null) { + insert.setCreateBy(userId); + insert.setUpdateOn(now); + } + insureOutDangerService.saveOrUpdate(insert); + } + + public void importOutDanger() throws FileNotFoundException { + + // 获取所有出险数据信息 + Map> insureMap = insureOutDangerService.list().stream().collect(Collectors.groupingBy(NdInsureOutDanger::getCarPlate)); + File directory = new File(""); + // 临时文件存储路径 + String filePath = directory.getAbsolutePath() + File.separator + "outInsure"; + File file = new File(filePath + File.separator + "保险出险数据.xlsx"); + Workbook wb = readExcel(new FileInputStream(file),file.getName()); + Row row = null; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i outDangers = insureMap.get(carPlate); + List dangers = Lists.newArrayList(); + if (CollUtil.isNotEmpty(outDangers)) { + // 去重 + HashSet hashSet = new HashSet<>(); + dangers = outDangers.stream() + .filter(c -> hashSet.add(c.getAccidentTime() + c.getAccidentAddress())) + .collect(Collectors.toList()); + } + if (CollUtil.isNotEmpty(dangers)) { + Map dangerMap = dangers.stream() + .collect(Collectors.toMap(w -> w.getAccidentTime() + w.getAccidentAddress(), w -> w)); + LocalDateTime accidentTime = NdDateUtils.date2LocalDateTime(outDangerTime); + String key = accidentTime + address; + // 只插入新增的 + if (!dangerMap.containsKey(key)) { + NdInsureOutDanger outDanger = new NdInsureOutDanger(); + outDanger.setCarPlate(carPlate); + outDanger.setInsureCompany(insureCompany); + outDanger.setAccidentTime(accidentTime); + + outDanger.setCompanyId(car.getCompanyId()); + CompanyDTO company = companiesCacheHelper.getById(car.getCompanyId()); + outDanger.setCompanyName(Objects.nonNull(company) ? company.getName() : StringUtils.EMPTY); + outDanger.setRegionId(car.getRegionId()); + + outDanger.setDeathToll(Double.valueOf(deathToll).intValue()); + outDanger.setInjuries(Double.valueOf(injuies).intValue()); + outDanger.setCompensateAmount(compensateAmount); + outDanger.setAccidentAddress(address); + outDangerService.save(outDanger); + log.info("准备插入 " + i + "条:" + JSON.toJSONString(outDanger)); + } + } + } + } + } + + public static Workbook readExcel(InputStream is, String extString){ + Workbook wb = null; + extString = extString.substring(extString.lastIndexOf(".")); + try { + if(".xls".equals(extString)){ + return wb = new HSSFWorkbook(is); + }else if(".xlsx".equals(extString)){ + return wb = new XSSFWorkbook(is); + }else { + return wb = null; + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wb; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/VehicleOverspeedManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/VehicleOverspeedManage.java new file mode 100644 index 0000000..f92cef1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/VehicleOverspeedManage.java @@ -0,0 +1,189 @@ +package com.ningdatech.carapi.safe.manage; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +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.basic.util.CollUtils; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedVehicle; +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedWaysection; +import com.ningdatech.carapi.safe.entity.VehicleOverspeedInfo; +import com.ningdatech.carapi.safe.model.dto.OverspeedPageQuery; +import com.ningdatech.carapi.safe.model.po.NdVehicleOverspeedWaysectionPO; +import com.ningdatech.carapi.safe.model.po.VehicleOverspeedCompanyPO; +import com.ningdatech.carapi.safe.model.po.VehicleOverspeedVehiclePO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleOverspeedCompanyVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleOverspeedVehicleVO; +import com.ningdatech.carapi.safe.model.vo.NdVehicleOverspeedWaysectionVO; +import com.ningdatech.carapi.safe.service.INdVehicleOverspeedCompanyService; +import com.ningdatech.carapi.safe.service.INdVehicleOverspeedVehicleService; +import com.ningdatech.carapi.safe.service.INdVehicleOverspeedWaysectionService; +import com.ningdatech.carapi.safe.service.IVehicleOverspeedInfoService; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +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 lombok.RequiredArgsConstructor; + +/** + * @author PoffyZhang + * @date 2022/10/19 上午11:18 + */ +@Component +@RequiredArgsConstructor +public class VehicleOverspeedManage { + + private final INdVehicleOverspeedCompanyService overspeedCompanyService; + private final INdVehicleOverspeedVehicleService overspeedVehicleService; + private final INdVehicleOverspeedWaysectionService overspeedWaysectionService; + private final RegionsCacheHelper regionsCacheHelper; + private final IVehicleOverspeedInfoService vehicleOverspeedInfoService; + private final OperatorsCacheHelper operatorsCacheHelper; + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final CompaniesCacheHelper companiesCacheHelper; + + public PageVo queryCompanyOverspeed(OverspeedPageQuery overspeedPageQuery) { + + //以企业为维度 + Page page = overspeedPageQuery.page(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 查询出该运营商下所有车辆所在的所有企业 + List companyIds = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)) + .stream().map(NdVehicleBaseInfo::getCompanyId).collect(Collectors.toList()); + HashSet set = new HashSet<>(); + List companyIdList = companyIds.stream().filter(c -> set.add(c)).collect(Collectors.toList()); + // 过滤掉不在这些企业下的数据 + overspeedPageQuery.setCompanyIds(companyIdList); + } + vehicleOverspeedInfoService.pageGroupCompany(page, overspeedPageQuery); + Map> listMap = vehicleOverspeedInfoService.list(Wrappers.lambdaQuery(VehicleOverspeedInfo.class) + .isNotNull(VehicleOverspeedInfo::getCompanyName).isNotNull(VehicleOverspeedInfo::getOverspeedDate) + .select(VehicleOverspeedInfo::getOverspeedDate,VehicleOverspeedInfo::getCompanyId)) + .stream().collect(Collectors.groupingBy(VehicleOverspeedInfo::getCompanyId)); + List data = page.getRecords().stream().map(e -> { + NdVehicleOverspeedCompanyVO vo = new NdVehicleOverspeedCompanyVO(); + BeanUtil.copyProperties(e, vo); + CompanyDTO companyDto = companiesCacheHelper.getById(vo.getCompanyId()); + Long regionId = companyDto.getRegionId(); + String displayName = regionsCacheHelper.getDisplayName(regionId); + vo.setRegionId(regionId); + vo.setRegionName(displayName); + List infoList = listMap.get(e.getCompanyId()); + if (CollUtil.isNotEmpty(infoList)) { + Optional time = infoList.stream().map(VehicleOverspeedInfo::getOverspeedDate).max(LocalDateTime::compareTo); + if (time.isPresent()) { + LocalDateTime maxTime = time.get(); + Date date = NdDateUtils.localDateTime2Date(maxTime); + vo.setOverspeedDate(date); + } + } + return vo; + }).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + public PageVo queryVihicleOverspeed(OverspeedPageQuery overspeedPageQuery) { + //以车辆为维度 + Page page = overspeedPageQuery.page(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 获取运营商下的所有与车辆 + List vehicleBaseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)); + List carPlateList = vehicleBaseInfoList.stream().map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + // 过滤掉不在登录运营商下的车辆 + overspeedPageQuery.setCarPlateList(carPlateList); + } + vehicleOverspeedInfoService.pageGroupVehicle(page, overspeedPageQuery); + List data = CollUtils.convert(page.getRecords(), + e -> BeanUtil.copyProperties(e, NdVehicleOverspeedVehicleVO.class)); + return PageVo.of(data, page.getTotal()); + } + + public PageVo queryWaySectionOverspeed(OverspeedPageQuery overspeedPageQuery) { + //以路段分析为维度 + Page page = overspeedPageQuery.page(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 获取运营商下的所有与车辆 + List vehicleBaseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)); + List carPlateList = vehicleBaseInfoList.stream().map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + // 过滤掉不在登录运营商下的车辆 + overspeedPageQuery.setCarPlateList(carPlateList); + } + + vehicleOverspeedInfoService.pageGroupWaysection(page, overspeedPageQuery); + List data = CollUtils.convert(page.getRecords(), + e -> BeanUtil.copyProperties(e, NdVehicleOverspeedWaysectionVO.class)); + return PageVo.of(data, page.getTotal()); + } + + public void vehicleOverspeed(Page page, OverspeedPageQuery overspeedPageQuery) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleOverspeedVehicle.class); + wrapper.ge(Objects.nonNull(overspeedPageQuery.getStartTime()), NdVehicleOverspeedVehicle::getOverspeedDate, overspeedPageQuery.getStartTime()) + .le(Objects.nonNull(overspeedPageQuery.getEndTime()), NdVehicleOverspeedVehicle::getOverspeedDate, overspeedPageQuery.getEndTime()) + .le(Objects.nonNull(overspeedPageQuery.getRank()), NdVehicleOverspeedVehicle::getRank, overspeedPageQuery.getRank()); + wrapper.orderBy(Boolean.TRUE, Boolean.TRUE, NdVehicleOverspeedVehicle::getRank); + overspeedVehicleService.page(page, wrapper); + } + + public void waysectionOverspeedSearch(Page page, OverspeedPageQuery overspeedPageQuery) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleOverspeedWaysection.class); + if (Objects.nonNull(overspeedPageQuery.getRegionId())) { + List regionIds = regionsCacheHelper.listChildRegionId(overspeedPageQuery.getRegionId()); + wrapper.in(CollUtil.isNotEmpty(regionIds), NdVehicleOverspeedWaysection::getRegionId, regionIds); + } + wrapper.ge(Objects.nonNull(overspeedPageQuery.getStartTime()), NdVehicleOverspeedWaysection::getOverspeedDate, overspeedPageQuery.getStartTime()) + .le(Objects.nonNull(overspeedPageQuery.getEndTime()), NdVehicleOverspeedWaysection::getOverspeedDate, overspeedPageQuery.getEndTime()) + .le(Objects.nonNull(overspeedPageQuery.getRank()), NdVehicleOverspeedWaysection::getRank, overspeedPageQuery.getRank()) + .like(StringUtils.isNotBlank(overspeedPageQuery.getWaySection()), NdVehicleOverspeedWaysection::getWaySection, overspeedPageQuery.getWaySection()) + .like(StringUtils.isNotBlank(overspeedPageQuery.getCarPlate()), NdVehicleOverspeedWaysection::getCarPlate, overspeedPageQuery.getCarPlate()) + .like(StringUtils.isNotBlank(overspeedPageQuery.getCompanyName()), NdVehicleOverspeedWaysection::getCompanyName, overspeedPageQuery.getCompanyName()); + wrapper.orderBy(Boolean.TRUE, Boolean.TRUE, NdVehicleOverspeedWaysection::getRank); + overspeedWaysectionService.page(page, wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/VehicleViolationManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/VehicleViolationManage.java new file mode 100644 index 0000000..d6b2e35 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/manage/VehicleViolationManage.java @@ -0,0 +1,188 @@ +package com.ningdatech.carapi.safe.manage; + +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +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.basic.util.CollUtils; +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.constant.MissCertEnum; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.constant.ViolationTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.safe.entity.NdVehicleViolation; +import com.ningdatech.carapi.safe.model.dto.ViolationPageQuery; +import com.ningdatech.carapi.safe.model.vo.NdVehicleViolationVO; +import com.ningdatech.carapi.safe.service.INdVehicleViolationService; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; + +/** + * @author PoffyZhang + * @date 2022/10/19 上午11:18 + */ +@Component +@RequiredArgsConstructor +public class VehicleViolationManage { + + private final INdVehicleViolationService vehicleViolationService; + private final OperatorsCacheHelper operatorsCacheHelper; + private final IVehicleBaseInfoService vehicleBaseInfoService; + + public PageVo query(ViolationPageQuery violationPageQuery) { + Page page = violationPageQuery.page(); + Integer pageNumber = violationPageQuery.getPageNumber(); + Integer pageSize = violationPageQuery.getPageSize(); + Integer violationType = violationPageQuery.getViolationType(); + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商ID + Long operatorId = operatorQueryDTO.getId(); + // 查询出该运营商下所有车辆所在的所有企业 + List baseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getOperatorId, operatorId)); + List companyIds = baseInfoList.stream() + .map(NdVehicleBaseInfo::getCompanyId) + .collect(Collectors.toList()); + List carPlateList = baseInfoList.stream().map(NdVehicleBaseInfo::getCarPlate).collect(Collectors.toList()); + HashSet set = new HashSet<>(); + List companyIdList = companyIds.stream().filter(c -> set.add(c)).collect(Collectors.toList()); + // 若为无证驾驶列表,过滤掉不在这些企业下的数据,否则根据车牌号筛选 + if (ViolationTypeEnum.MISS_CERT.getCode().equals(violationPageQuery.getViolationType())) { + violationPageQuery.setCompanyIds(companyIdList); + }else { + violationPageQuery.setCarPlateList(carPlateList); + } + } + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleViolation.class); + List violationList = ((VehicleViolationManage) AopContext.currentProxy()).commonSearch(page, wrapper, violationPageQuery); + // 对结果进行去重,并统计对应违章次数 + List data = removeDuplicate(violationList,violationType); + if (CollUtil.isEmpty(data)){ + return PageVo.empty(); + } + List records = data.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + List results = CollUtils.convert(records, e -> { + NdVehicleViolationVO vo = new NdVehicleViolationVO(); + BeanUtils.copyProperties(e,vo); + if(Objects.nonNull(vo.getViolationType())){ + vo.setViolationTypeName(ViolationTypeEnum.getDescByCode(vo.getViolationType())); + } + if(Objects.nonNull(vo.getMissingCertificateType())){ + vo.setMissingCertificateTypeName(MissCertEnum.getDescByCode(vo.getMissingCertificateType())); + } + CodeUtil.searchCompanyNameAndRegionName(vo); + return vo; + }); + return PageVo.of(results, records.size()); + } + + private List removeDuplicate(List violationList, Integer violationType) { + List data; + switch (violationType) { + // 无证驾驶 + case 1: + HashSet missCertSet = new HashSet<>(); + data = violationList.stream().filter(v -> + missCertSet.add(v.getDriverName() + v.getCarPlate() + + v.getViolationDate() + v.getMissingCertificateType())) + .collect(Collectors.toList()); + break; + // 闯红灯 + case 2: + HashSet redLightSet = new HashSet<>(); + data = violationList.stream().filter(v -> + redLightSet.add(v.getDriverName() + v.getCarPlate() + + v.getViolationDate() + v.getAddressRedLight())) + .collect(Collectors.toList()); + break; + // 超载 + case 3: + HashSet overLoadSet = new HashSet<>(); + data = violationList.stream().filter(v -> + overLoadSet.add(v.getDriverName() + v.getCarPlate() + + v.getViolationTimes() + v.getViolationDate())) + .collect(Collectors.toList()); + countViolationTimes(data); + break; + // 闯禁行路段 + case 4: + HashSet sectionSet = new HashSet<>(); + data = violationList.stream().filter(v -> + sectionSet.add(v.getDriverName() + v.getCarPlate() + + v.getWaySection() + v.getViolationTimes() + + v.getViolationDate())) + .collect(Collectors.toList()); + countViolationTimes(data); + break; + // 闯禁行时间 + case 5: + HashSet periodSet = new HashSet<>(); + data = violationList.stream().filter(v -> + periodSet.add(v.getDriverName() + v.getCarPlate() + + v.getViolationPeriod() + v.getViolationTimes())) + .collect(Collectors.toList()); + countViolationTimes(data); + break; + default: + throw new IllegalStateException("Unexpected value: " + violationType); + } + return data; + } + + private void countViolationTimes(List data) { + data.forEach(d -> { + String carPlate = d.getCarPlate(); + if (StringUtils.isNotBlank(carPlate)) { + List violations = data.stream() + .filter(c -> carPlate.equals(c.getCarPlate())) + .collect(Collectors.toList()); + d.setViolationTimes(violations.size()); + } + }); + } + + @BuildChildrenRegionWrapper(entityIndex = 2,wrapperIndex = 1) + public List commonSearch(Page page,LambdaQueryWrapper wrapper, ViolationPageQuery violationPageQuery) { + wrapper.ge(Objects.nonNull(violationPageQuery.getStartTime()), NdVehicleViolation::getViolationDate, violationPageQuery.getStartTime()) + .le(Objects.nonNull(violationPageQuery.getEndTime()), NdVehicleViolation::getViolationDate, violationPageQuery.getEndTime()) + .like(Objects.nonNull(violationPageQuery.getDriverName()), NdVehicleViolation::getDriverName, violationPageQuery.getDriverName()) + .like(StringUtils.isNotBlank(violationPageQuery.getCompanyName()), NdVehicleViolation::getCompanyName, violationPageQuery.getCompanyName()) + .like(Objects.nonNull(violationPageQuery.getIdCard()), NdVehicleViolation::getIdCard, violationPageQuery.getIdCard()) + .like(Objects.nonNull(violationPageQuery.getCarPlate()), NdVehicleViolation::getCarPlate, violationPageQuery.getCarPlate()) + .eq(Objects.nonNull(violationPageQuery.getViolationType()), NdVehicleViolation::getViolationType, violationPageQuery.getViolationType()) + // 过滤掉不在这些运营商下车辆关联企业下的数据 + .in(CollUtil.isNotEmpty(violationPageQuery.getCompanyIds()),NdVehicleViolation::getCompanyId,violationPageQuery.getCompanyIds()) + .in(CollUtil.isNotEmpty(violationPageQuery.getCarPlateList()),NdVehicleViolation::getCarPlate,violationPageQuery.getCarPlateList()) + .orderBy(Boolean.TRUE, Boolean.FALSE, NdVehicleViolation::getViolationDate); + + return vehicleViolationService.pageDataScope(page, wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/AlarmDataPictureMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/AlarmDataPictureMapper.java new file mode 100644 index 0000000..c9190c1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/AlarmDataPictureMapper.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.safe.entity.AlarmDataPicture; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface AlarmDataPictureMapper extends BaseMapper { + + /** + * 批量保存用sql + * @param list + * @return + */ + boolean saveBatchForSql(@Param("list") List list); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/AlarmDataPictureMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/AlarmDataPictureMapper.xml new file mode 100644 index 0000000..07904c0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/AlarmDataPictureMapper.xml @@ -0,0 +1,50 @@ + + + + + + INSERT INTO nd_alarm_data_picture + (origin_pic_id, + vehicle_index_code, + vehicle_self_no, + camera_index_code, + camera_name, + upload_type, + alarm_id, + alarm_type, + alarm_type_name, + capture_time, + url, + thumb_url, + parent_pic_id, + face_rect, + pic_type, + plate_no, + region_index_code, + region_name + ) + values + + ( + #{item.originPicId}, + #{item.vehicleIndexCode}, + #{item.vehicleSelfNo}, + #{item.cameraIndexCode}, + #{item.cameraName}, + #{item.uploadType}, + #{item.alarmId}, + #{item.alarmType}, + #{item.alarmTypeName}, + #{item.captureTime}, + #{item.url}, + #{item.thumbUrl}, + #{item.parentPicId}, + #{item.faceRect}, + #{item.picType}, + #{item.plateNo}, + #{item.regionIndexCode}, + #{item.regionName} + ) + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/AlarmDataVideoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/AlarmDataVideoMapper.java new file mode 100644 index 0000000..06dac8a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/AlarmDataVideoMapper.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.safe.entity.AlarmDataVideo; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface AlarmDataVideoMapper extends BaseMapper { + /** + * 批量保存用sql + * @param list + * @return + */ + boolean saveBatchForSql(List list); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/AlarmDataVideoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/AlarmDataVideoMapper.xml new file mode 100644 index 0000000..710d885 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/AlarmDataVideoMapper.xml @@ -0,0 +1,56 @@ + + + + + + INSERT INTO nd_alarm_data_video + (orgin_video_id, + vehicle_index_code, + plate_no, + vehicle_self_no, + region_index_code, + region_name, + camera_index_code, + camera_name, + service_index_code, + begin_time, + end_time, + stream_begin_time, + stream_end_time, + video_length, + alarm_id, + alarm_time, + alarm_type, + alarm_type_name, + record_index_code, + url, + cover_url + ) + values + + ( + #{item.orginVideoId}, + #{item.vehicleIndexCode}, + #{item.plateNo}, + #{item.vehicleSelfNo}, + #{item.regionIndexCode}, + #{item.regionName}, + #{item.cameraIndexCode}, + #{item.cameraName}, + #{item.serviceIndexCode}, + #{item.beginTime}, + #{item.endTime}, + #{item.streamBeginTime}, + #{item.streamEndTime}, + #{item.videoLength}, + #{item.alarmId}, + #{item.alarmTime}, + #{item.alarmType}, + #{item.alarmTypeName}, + #{item.recordIndexCode}, + #{item.url}, + #{item.coverUrl} + ) + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureInfoMapper.java new file mode 100644 index 0000000..51d119f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureInfoMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.safe.entity.NdInsureInfo; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdInsureInfoMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureOutDangerAnalysisMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureOutDangerAnalysisMapper.java new file mode 100644 index 0000000..75e9939 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureOutDangerAnalysisMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.safe.entity.NdInsureOutDanger; +import com.ningdatech.carapi.safe.entity.NdInsureOutDangerAnalysis; +import com.ningdatech.carapi.safe.model.dto.InsurePageQuery; +import com.ningdatech.carapi.safe.model.po.NdInsureOutDangerAnalysisPO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdInsureOutDangerAnalysisMapper extends BaseMapper { + + Page pageAnalysis(Page page, @Param("po") InsurePageQuery param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureOutDangerAnalysisMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureOutDangerAnalysisMapper.xml new file mode 100644 index 0000000..4983a0a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureOutDangerAnalysisMapper.xml @@ -0,0 +1,45 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureOutDangerMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureOutDangerMapper.java new file mode 100644 index 0000000..0e8c7c3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureOutDangerMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.po.OverspeedStatisticsPO; +import com.ningdatech.carapi.safe.entity.NdInsureInfo; +import com.ningdatech.carapi.safe.entity.NdInsureOutDanger; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdInsureOutDangerMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureOutDangerMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureOutDangerMapper.xml new file mode 100644 index 0000000..2a38695 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdInsureOutDangerMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdLawCertificateVerificationMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdLawCertificateVerificationMapper.java new file mode 100644 index 0000000..a9c4fa3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdLawCertificateVerificationMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.safe.entity.NdLawCertificateVerification; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdLawCertificateVerificationMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdLawEquipmentInstallMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdLawEquipmentInstallMapper.java new file mode 100644 index 0000000..0fd9386 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdLawEquipmentInstallMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.safe.entity.NdLawEquipmentInstall; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdLawEquipmentInstallMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdSafetyCommitmentMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdSafetyCommitmentMapper.java new file mode 100644 index 0000000..06b8f1d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdSafetyCommitmentMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.safe.entity.NdSafetyCommitment; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdSafetyCommitmentMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdSafetyCreditMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdSafetyCreditMapper.java new file mode 100644 index 0000000..c31f3db --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdSafetyCreditMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.safe.entity.NdSafetyCredit; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdSafetyCreditMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdSecurityAdvisoryMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdSecurityAdvisoryMapper.java new file mode 100644 index 0000000..ba1f715 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdSecurityAdvisoryMapper.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.safe.entity.NdSecurityAdvisory; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdSecurityAdvisoryMapper extends BaseMapper { + + int incrementDownCount(Long id); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdSecurityAdvisoryMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdSecurityAdvisoryMapper.xml new file mode 100644 index 0000000..e6e4056 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdSecurityAdvisoryMapper.xml @@ -0,0 +1,9 @@ + + + + + update nd_security_advisory set download_times = download_times + 1 where id = #{id} + + \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentAnalysisMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentAnalysisMapper.java new file mode 100644 index 0000000..99acf80 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentAnalysisMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentAnalysis; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentDead; +import com.ningdatech.carapi.safe.model.dto.AccidentPageQuery; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdVehicleAccidentAnalysisMapper extends BaseMapper { + + Page pageAnalysis(Page page, + @Param("param") AccidentPageQuery accidentPageQuery); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentAnalysisMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentAnalysisMapper.xml new file mode 100644 index 0000000..060df1e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentAnalysisMapper.xml @@ -0,0 +1,102 @@ + + + + + \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentDeadMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentDeadMapper.java new file mode 100644 index 0000000..5086b20 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentDeadMapper.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.company.entity.po.ResCompanyTotalPO; +import com.ningdatech.carapi.safe.entity.NdVehicleAccident; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentDead; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdVehicleAccidentDeadMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentDeadMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentDeadMapper.xml new file mode 100644 index 0000000..90efd85 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentDeadMapper.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentMapper.java new file mode 100644 index 0000000..e0f2b9a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleAccidentMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.safe.entity.NdVehicleAccident; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdVehicleAccidentMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleOverspeedCompanyMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleOverspeedCompanyMapper.java new file mode 100644 index 0000000..d01b444 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleOverspeedCompanyMapper.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedCompany; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdVehicleOverspeedCompanyMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleOverspeedCompanyMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleOverspeedCompanyMapper.xml new file mode 100644 index 0000000..4a2a714 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleOverspeedCompanyMapper.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleOverspeedVehicleMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleOverspeedVehicleMapper.java new file mode 100644 index 0000000..2e71e47 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleOverspeedVehicleMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedVehicle; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdVehicleOverspeedVehicleMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleOverspeedWaysectionMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleOverspeedWaysectionMapper.java new file mode 100644 index 0000000..61b6db8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleOverspeedWaysectionMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedWaysection; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdVehicleOverspeedWaysectionMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleViolationMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleViolationMapper.java new file mode 100644 index 0000000..a09874d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/NdVehicleViolationMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.safe.entity.NdVehicleViolation; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface NdVehicleViolationMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/SecurityManageDataScreenMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/SecurityManageDataScreenMapper.java new file mode 100644 index 0000000..a95d726 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/SecurityManageDataScreenMapper.java @@ -0,0 +1,26 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.safe.model.po.*; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Classname SecurityManageDataScreenMapper + * @Description + * @Date 2022/10/26 15:03 + * @Created by PoffyZhang + */ +public interface SecurityManageDataScreenMapper { + + List getOutDangerAnalysis(@Param("param") DataScreenParam param); + + List getOverspeedAnalysis(@Param("param") DataScreenParam param); + + OutDangerPeriodTimePO getOutDangerPeriodTime(@Param("param") DataScreenParam param); + + List getOverSpeedCurrentMonth(@Param("param") DataScreenParam param); + + List getOutDangerRegions(@Param("param") DataScreenParam param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/SecurityManageDataScreenMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/SecurityManageDataScreenMapper.xml new file mode 100644 index 0000000..058db56 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/SecurityManageDataScreenMapper.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/VehicleAccidentReportMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/VehicleAccidentReportMapper.java new file mode 100644 index 0000000..21b8083 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/VehicleAccidentReportMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.ningdatech.carapi.safe.entity.VehicleAccidentReport; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2022-12-26 + */ +public interface VehicleAccidentReportMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/VehicleAccidentReportMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/VehicleAccidentReportMapper.xml new file mode 100644 index 0000000..3917f5c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/VehicleAccidentReportMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/VehicleOverspeedInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/VehicleOverspeedInfoMapper.java new file mode 100644 index 0000000..d5964cf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/VehicleOverspeedInfoMapper.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.safe.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedCompany; +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedWaysection; +import com.ningdatech.carapi.safe.entity.VehicleOverspeedInfo; +import com.ningdatech.carapi.safe.model.dto.OverspeedPageQuery; +import com.ningdatech.carapi.safe.model.po.NdVehicleOverspeedWaysectionPO; +import com.ningdatech.carapi.safe.model.po.VehicleOverspeedCompanyPO; +import com.ningdatech.carapi.safe.model.po.VehicleOverspeedVehiclePO; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 车辆超速信息表 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-17 + */ +public interface VehicleOverspeedInfoMapper extends BaseMapper { + + Long countDailyToll(@Param("regionIds") List regionIds, @Param("startTime") LocalDateTime todayStart, + @Param("endTime") LocalDateTime todayEnd); + + Page pageGroupCompany(Page page, + @Param("ov") OverspeedPageQuery overspeedPageQuery); + + Page pageGroupVehicle(Page page, + @Param("ov") OverspeedPageQuery overspeedPageQuery); + + Page pageGroupWaysection(Page page, + @Param("ov") OverspeedPageQuery overspeedPageQuery); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/VehicleOverspeedInfoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/VehicleOverspeedInfoMapper.xml new file mode 100644 index 0000000..7352d16 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/mapper/VehicleOverspeedInfoMapper.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/AccidentAuditDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/AccidentAuditDTO.java new file mode 100644 index 0000000..d6a85a2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/AccidentAuditDTO.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.safe.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @author CMM + * @since 2022/12/26 18:23 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "AccidentAuditDTO", description = "事故审核") +public class AccidentAuditDTO { + + @ApiModelProperty("id") + @NotNull(message = "请传入审核记录id!") + private Long id; + + @ApiModelProperty("审核结果") + @NotNull(message = "审核结果不能为空!") + private Integer auditStatus; + + @ApiModelProperty("审核意见") + @NotBlank(message = "审核意见不能为空!") + @Length(max = 200) + private String auditOpinion; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/AccidentPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/AccidentPageQuery.java new file mode 100644 index 0000000..e2e8547 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/AccidentPageQuery.java @@ -0,0 +1,95 @@ +package com.ningdatech.carapi.safe.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 事故管理 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "AccidentPageQuery", description = "事故管理") +public class AccidentPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 开始时间 + */ + @ApiModelProperty("开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty("结束时间") + private String endTime; + + /** + * 区域code 拼接 code,level + */ + @ApiModelProperty("区域id") + private Long regionId; + /** + * 区域ID集合 + */ + private List regionIds; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + /** + * 车牌号集合 + */ + @ApiModelProperty("车牌号集合") + private List carPlateList; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 车辆类型 + */ + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + /** + * 审核状态 + */ + @ApiModelProperty(notes = "审核状态",allowableValues = "0 待审核, 1 审核通过, 2 审核不通过") + private Integer auditStatus; + + /** + * 上报状态 + */ + @ApiModelProperty(notes = "上报状态",allowableValues = "0 未上报, 1 已上报") + private Integer reportStatus; + + @ApiModelProperty(notes = "事故类型") + private Integer accidentType; + + + + private String dataScopeSql; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/InsurePageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/InsurePageQuery.java new file mode 100644 index 0000000..014dc8a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/InsurePageQuery.java @@ -0,0 +1,103 @@ +package com.ningdatech.carapi.safe.model.dto; + +import java.io.Serializable; +import java.util.List; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + *

+ * 实体类 + * 保险管理 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "InsurePageQuery", description = "保险管理") +public class InsurePageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 起包开始时间 + */ + @ApiModelProperty("起包开始时间") + private String qibaoStartTime; + + /** + * 起包结束时间 + */ + @ApiModelProperty("起包结束时间") + private String qibaoEndTime; + + /** + * 到期开始时间 + */ + @ApiModelProperty("到期开始时间") + private String daoqiStartTime; + + /** + * 到期结束时间 + */ + @ApiModelProperty("到期结束时间") + private String daoqiEndTime; + + /** + * 开始时间 + */ + @ApiModelProperty("开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty("结束时间") + private String endTime; + + + /** + * 区域code 拼接 code,level + */ + @ApiModelProperty("区域id") + private Long regionId; + @ApiModelProperty("区域IDs") + private List regionIds; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 出险次数排名 + */ + @ApiModelProperty("出险次数排名") + private Integer outDangerRank; + + /** + * 上报状态 + */ + @ApiModelProperty(value = "上报状态",allowableValues = "0 未上报,1 已上报") + private Integer reportStatus; + + private String dataScopeSql; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/LawEnforcementPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/LawEnforcementPageQuery.java new file mode 100644 index 0000000..493a1d4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/LawEnforcementPageQuery.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.safe.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 实体类 + * 行政执法query + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "LawEnforcementPageQuery", description = "行政执法query") +public class LawEnforcementPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 开始时间 + */ + @ApiModelProperty("开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty("结束时间") + private String endTime; + + /** + * 区域code 拼接 code,level + */ + @ApiModelProperty("区域id") + private Long regionId; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 驾驶员名 + */ + @ApiModelProperty("驾驶员名") + private String driverName; + + /** + * 设备名 + */ + @ApiModelProperty("设备名") + private String equipmentName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/LongitudeLatitudeDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/LongitudeLatitudeDTO.java new file mode 100644 index 0000000..600fa28 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/LongitudeLatitudeDTO.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.safe.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Classname LongitudeLatitudeDTO + * @Description + * @Date 2022/10/27 11:19 + * @Created by PoffyZhang + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "LongitudeLatitudeDTO", description = "经纬度") +public class LongitudeLatitudeDTO { + @ApiModelProperty("经度") + private String longitude; + + @ApiModelProperty("纬度") + private String latitude; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/NdInsureOutDangerImportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/NdInsureOutDangerImportDTO.java new file mode 100644 index 0000000..1e607ac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/NdInsureOutDangerImportDTO.java @@ -0,0 +1,117 @@ +package com.ningdatech.carapi.safe.model.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdInsureOutDangerImportDTO", description = "安全管理-保险管理-出险信息") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdInsureOutDangerImportDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + @ExcelProperty("id") + private Long id; + + /** + * 事故时间 + */ + @ApiModelProperty("事故时间") + @ExcelProperty("事故时间") + private LocalDateTime accidentTime; + + /** + * 事故地点 + */ + @ApiModelProperty("事故地点") + @ExcelProperty("事故地点") + private String accidentAddress; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @ExcelProperty("区域ID") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + @ExcelProperty("区域名") + private String regionName; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + @ExcelProperty("企业名") + private String companyName; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + @ExcelProperty("企业ID") + private Long companyId; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @ExcelProperty("车牌号") + private String carPlate; + + /** + * 保险公司 + */ + @ApiModelProperty("保险公司") + @ExcelProperty("保险公司") + private String insureCompany; + + /** + * 受伤人数 + */ + @ApiModelProperty("受伤人数") + @ExcelProperty("受伤人数") + private Integer injuries; + + /** + * 死亡人数 + */ + @ApiModelProperty("死亡人数") + @ExcelProperty("死亡人数") + private Integer deathToll; + + /** + * 理赔金额 + */ + @ApiModelProperty("理赔金额") + @ExcelProperty("理赔金额") + private BigDecimal compensateAmount; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/NdVehicleAccidentDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/NdVehicleAccidentDTO.java new file mode 100644 index 0000000..bad5cd2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/NdVehicleAccidentDTO.java @@ -0,0 +1,118 @@ +package com.ningdatech.carapi.safe.model.dto; + +import java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdVehicleAccidentDTO", description = "安全管理-事故管理-车辆事故") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleAccidentDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 事故时间 + */ + @ApiModelProperty("事故时间") + private String accidentTime; + + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 事故驾驶员 + */ + @ApiModelProperty("事故驾驶员") + private String accidentDriver; + + + /** + * 车辆类型名 + */ + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 事故地址 + */ + @ApiModelProperty("事故地址") + private String accidentAddress; + + /** + * 上报状态名称 + */ + @ApiModelProperty("上报状态名称") + private String reportStatusName; + + /** + * 事故类型名称 + */ + @ApiModelProperty("事故类型名称") + private String accidentTypeName; + + /** + * 伤人数 + */ + @ApiModelProperty("伤人数") + private Integer injuries; + + /** + * 亡人数 + */ + @ApiModelProperty("亡人数") + private Integer deathToll; + + /** + * 简要案情 + */ + @ApiModelProperty("简要案情") + private String briefCase; + + /** + * 事故编号 + */ + @ApiModelProperty("事故编号") + private String accidentNo; + + /** + * 事故责任认定书认定内容 + */ + @ApiModelProperty("事故责任认定书认定内容") + private String firmContent; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/OverspeedPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/OverspeedPageQuery.java new file mode 100644 index 0000000..6c1a68f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/OverspeedPageQuery.java @@ -0,0 +1,87 @@ +package com.ningdatech.carapi.safe.model.dto; + +import java.io.Serializable; +import java.util.List; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + *

+ * 实体类 + * 超速管理 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "OverspeedPageQuery", description = "超速管理") +public class OverspeedPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 开始时间 + */ + @ApiModelProperty("开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty("结束时间") + private String endTime; + + /** + * 区域code 拼接 code,level + */ + @ApiModelProperty("区域id") + private Long regionId; + private List regionIds; + + /** + * 排名 + */ + @ApiModelProperty("排名") + private Integer rank; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + /** + * 企业ID列表 + */ + @ApiModelProperty("企业列表") + private List companyIds; + + /** + * 车辆 车牌号 + */ + @ApiModelProperty("车辆 车牌号") + private String carPlate; + /** + * 车辆 车牌号列表 + */ + @ApiModelProperty("车辆 车牌号列表") + private List carPlateList; + + /** + * 路段名 + */ + @ApiModelProperty("路段名") + private String waySection; + + private String dataScopeSql; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/SecurityAdvisoryPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/SecurityAdvisoryPageQuery.java new file mode 100644 index 0000000..8ca8697 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/SecurityAdvisoryPageQuery.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.safe.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 实体类 + * 安全通报query + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "SecurityAdvisoryPageQuery", description = "安全通报query") +public class SecurityAdvisoryPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 通报年月 + */ + @ApiModelProperty("通报年月") + private LocalDateTime advisoryDate; + + /** + * 区域code 拼接 code,level + */ + @ApiModelProperty("区域id") + private Long regionId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/SecurityHonestyPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/SecurityHonestyPageQuery.java new file mode 100644 index 0000000..bd56cb1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/SecurityHonestyPageQuery.java @@ -0,0 +1,43 @@ +package com.ningdatech.carapi.safe.model.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 实体类 + * 安全诚信q + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "SecurityHonestyPageQuery", description = "安全诚信query") +public class SecurityHonestyPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 所属企业 + */ + @ApiModelProperty("所属企业") + private String companyName; + + /** + * 区域code 拼接 code,level + */ + @ApiModelProperty("区域id") + private Long regionId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/VehicleAccidentReportDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/VehicleAccidentReportDTO.java new file mode 100644 index 0000000..a945b48 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/VehicleAccidentReportDTO.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.safe.model.dto; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +import org.hibernate.validator.constraints.Length; +import org.hibernate.validator.constraints.Range; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * @author CMM + * @since 2022/12/26 15:28 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "VehicleAccidentReportDTO", description = "车辆事故上报信息保存") +public class VehicleAccidentReportDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + private Long id; + + @ApiModelProperty("车牌号") + @NotBlank(message = "请输入车牌号!") + private String carPlate; + + @ApiModelProperty("事故驾驶员") + @NotBlank(message = "请输入驾驶员姓名!") + private String accidentDriver; + + @ApiModelProperty("事故日期") + @NotNull(message = "请输入事故发生时间!") + private LocalDateTime accidentTime; + + @ApiModelProperty("事故地点") + @NotBlank(message = "请填写事故地点!") + @Length(max = 100) + private String accidentAddress; + + @ApiModelProperty("受伤人数") + @NotNull(message = "请填写受伤人数!") + @Range(min = 0,max = 100) + private Integer injuries; + + @ApiModelProperty("死亡人数") + @NotNull(message = "请填写死亡人数!") + @Range(min = 0,max = 100) + private Integer deathToll; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/VehicleAccidentReportQueryDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/VehicleAccidentReportQueryDTO.java new file mode 100644 index 0000000..34a71a0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/VehicleAccidentReportQueryDTO.java @@ -0,0 +1,92 @@ +package com.ningdatech.carapi.safe.model.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @author CMM + * @since 2022/12/26 15:25 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +public class VehicleAccidentReportQueryDTO 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; + + @ApiModelProperty("最后修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("最后修改人") + private Long updateBy; + + @ApiModelProperty("地区ID") + private Long regionId; + + @ApiModelProperty("地区名") + private String regionName; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("事故日期") + private LocalDateTime accidentTime; + + @ApiModelProperty("事故驾驶员") + private String accidentDriver; + + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + @ApiModelProperty("企业名") + private String companyName; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("事故地点") + private String accidentAddress; + + @ApiModelProperty("经度") + private String longitude; + + @ApiModelProperty("纬度") + private String latitude; + + @ApiModelProperty("出险id 关联赔付信息") + private Long insureOutId; + + @ApiModelProperty("受伤人数") + private Integer injuries; + + @ApiModelProperty("死亡人数") + private Integer deathToll; + + @ApiModelProperty("驾驶员ID") + private Long driverId; + + @ApiModelProperty("保险ID") + private Long insureId; + + @ApiModelProperty("审核状态 0:待审核,1:审核通过,2:审核不通过") + private Integer auditStatus; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/ViolationPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/ViolationPageQuery.java new file mode 100644 index 0000000..9cdcb71 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/dto/ViolationPageQuery.java @@ -0,0 +1,91 @@ +package com.ningdatech.carapi.safe.model.dto; + +import java.io.Serializable; +import java.util.List; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + *

+ * 实体类 + * 违章管理 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "ViolationPageQuery", description = "违章管理") +public class ViolationPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 开始时间 + */ + @ApiModelProperty("开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty("结束时间") + private String endTime; + + /** + * 区域code 拼接 code,level + */ + @ApiModelProperty("区域id") + private Long regionId; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 企业ID集合 + */ + @ApiModelProperty("企业ID集合") + private List companyIds; + + /** + * 车辆 车牌号 + */ + @ApiModelProperty("车辆 车牌号") + private String carPlate; + /** + * 车辆 车牌号集合 + */ + @ApiModelProperty("车辆 车牌号集合") + private List carPlateList; + + /** + * 身份证号 + */ + @ApiModelProperty("身份证号") + private String idCard; + + /** + * 驾驶员名字 + */ + @ApiModelProperty("驾驶员名字") + private String driverName; + + /** + * 违章类型 + */ + @ApiModelProperty("违章类型 1.无证驾驶 2.闯红灯 3.超载 4.违规路段行驶 5.违规时间行驶") + private Integer violationType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/NdInsureOutDangerAnalysisPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/NdInsureOutDangerAnalysisPO.java new file mode 100644 index 0000000..54e9479 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/NdInsureOutDangerAnalysisPO.java @@ -0,0 +1,83 @@ +package com.ningdatech.carapi.safe.model.po; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdInsureOutDangerAnalysisPO", description = "安全管理-保险管理-出险分析") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdInsureOutDangerAnalysisPO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 出险次数 + */ + @ApiModelProperty("出险次数") + private Integer outDangerTimes; + + /** + * 事故时间 + */ + @ApiModelProperty("事故时间") + private String accidentTime; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; + + /** + * 受伤人数 + */ + @ApiModelProperty("受伤人数") + private Integer injuries; + + /** + * 死亡人数 + */ + @ApiModelProperty("死亡人数") + private Integer deathToll; + + private Integer rank; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/NdVehicleOverspeedWaysectionPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/NdVehicleOverspeedWaysectionPO.java new file mode 100644 index 0000000..aff1a39 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/NdVehicleOverspeedWaysectionPO.java @@ -0,0 +1,105 @@ +package com.ningdatech.carapi.safe.model.po; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdVehicleOverspeedWaysectionPO", description = "安全管理-超速管理-超速路段") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleOverspeedWaysectionPO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 超速时间 + */ + @ApiModelProperty("超速时间") + private LocalDateTime overspeedDate; + + /** + * 超速次数 + */ + @ApiModelProperty("超速次数") + private Integer overspeedTimes; + + /** + * 路段名字 + */ + @ApiModelProperty("路段名字") + private String waySection; + + /** + * 排名 + */ + @ApiModelProperty("排名") + private Integer rank; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 企业id + */ + @ApiModelProperty("企业id") + private Long companyId; + + /** + * 所属市 + */ + @ApiModelProperty("所属市") + private String city; + + /** + * 所属区 + */ + @ApiModelProperty("所属区") + private String distinguish; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域ID + */ + @ApiModelProperty("区域") + private String regionName; + + @ApiModelProperty("开始路段") + private String waySectionStart; + + @ApiModelProperty("结束路段") + private String waySectionEnd; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OutDangerAnalysisPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OutDangerAnalysisPO.java new file mode 100644 index 0000000..e31dc72 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OutDangerAnalysisPO.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.safe.model.po; + +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; + +/** + * @author PoffyZhang + * @date 2022/10/25 + */ +@Data +@ApiModel("统计次数PO") +public class OutDangerAnalysisPO { + + @ApiModelProperty("出险次数") + private Integer outDangerTimes; + + @ApiModelProperty("受伤人数") + private Integer injuries; + + @ApiModelProperty("死亡人数") + private Integer deathToll; + + @ApiModelProperty("年份") + private String year; + + @ApiModelProperty("月份") + private String month; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OutDangerCityPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OutDangerCityPO.java new file mode 100644 index 0000000..b7b014e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OutDangerCityPO.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.safe.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/10/25 + */ +@Data +@ApiModel("城市出险PO") +public class OutDangerCityPO { + + @ApiModelProperty("城市名") + private String regionName; + + @ApiModelProperty("地区CODE") + private String regionCode; + + @ApiModelProperty("地区ID") + private Long regionId; + + @ApiModelProperty("前年出险次数") + private Integer beforeOutDanger; + + @ApiModelProperty("去年出险次数") + private Integer lastOutDanger; + + @ApiModelProperty("前年出险次数") + private Integer currentOutDanger; + + @ApiModelProperty("总数") + private Integer total; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OutDangerPeriodTimePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OutDangerPeriodTimePO.java new file mode 100644 index 0000000..a16df6d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OutDangerPeriodTimePO.java @@ -0,0 +1,50 @@ +package com.ningdatech.carapi.safe.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/10/25 + */ +@Data +@ApiModel("时间段出险次数PO") +public class OutDangerPeriodTimePO { + + @ApiModelProperty("第一时间段出险次数") + private Integer firstPeriodTime; + + @ApiModelProperty("第二时间段") + private Integer secondPeriodTime; + + @ApiModelProperty("第三时间段") + private Integer thirdPeriodTime; + + @ApiModelProperty("第四时间段") + private Integer fourthPeriodTime; + + @ApiModelProperty("第五时间段") + private Integer fifthPeriodTime; + + @ApiModelProperty("第六时间段") + private Integer sixthPeriodTime; + + @ApiModelProperty("第七时间段") + private Integer seventhPeriodTime; + + @ApiModelProperty("第八时间段") + private Integer eighthPeriodTime; + + @ApiModelProperty("第九时间段") + private Integer ninthPeriodTime; + + @ApiModelProperty("第十时间段") + private Integer tenthPeriodTime; + + @ApiModelProperty("第十一时间段") + private Integer eleventhPeriodTime; + + @ApiModelProperty("最后时间段") + private Integer lastPeriodTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OverspeedAnalysisPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OverspeedAnalysisPO.java new file mode 100644 index 0000000..47cddfd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OverspeedAnalysisPO.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.safe.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/11/17 + */ +@Data +@ApiModel("统计超速次数PO") +public class OverspeedAnalysisPO { + + @ApiModelProperty("超速次数") + private Integer times; + + @ApiModelProperty("年份") + private String year; + + @ApiModelProperty("月份") + private String month; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OverspeedTimesPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OverspeedTimesPO.java new file mode 100644 index 0000000..9564f3f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/OverspeedTimesPO.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.safe.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @date 2022/10/25 + */ +@Data +@ApiModel("超速次数PO") +public class OverspeedTimesPO { + + @ApiModelProperty("月份日期") + private String monthDay; + + @ApiModelProperty("超速次数") + private Integer overspeedTimes; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/VehicleOverspeedCompanyPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/VehicleOverspeedCompanyPO.java new file mode 100644 index 0000000..9f8cd87 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/VehicleOverspeedCompanyPO.java @@ -0,0 +1,104 @@ +package com.ningdatech.carapi.safe.model.po; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "VehicleOverspeedCompanyPO", description = "安全管理-超速管理-企业超速") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class VehicleOverspeedCompanyPO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 超速时间 + */ + @ApiModelProperty("超速时间") + @TableField(value = "overspeed_date") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date overspeedDate; + + /** + * 超速次数 + */ + @ApiModelProperty("超速次数") + @TableField(value = "overspeed_times") + private Integer overspeedTimes; + + /** + * 最高速率 + */ + @ApiModelProperty("最高速率") + @TableField(value = "max_speed") + private Double maxSpeed; + + /** + * 排名 + */ + @ApiModelProperty("排名") + @TableField(value = "rank") + private Integer rank; + + /** + * 企业名 + */ + @ApiModelProperty("企业id") + @TableField(value = "company_id") + private Long companyId; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + @TableField(value = "company_name") + private String companyName; + + /** + * 所属市 + */ + @ApiModelProperty("所属市") + @TableField(value = "city") + private String city; + + /** + * 所属区 + */ + @ApiModelProperty("所属区") + @TableField(value = "distinguish") + private String distinguish; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/VehicleOverspeedVehiclePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/VehicleOverspeedVehiclePO.java new file mode 100644 index 0000000..24f52d3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/po/VehicleOverspeedVehiclePO.java @@ -0,0 +1,104 @@ +package com.ningdatech.carapi.safe.model.po; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @author CMM + * @description + * @since 2022/11/18 15:50 + */ +@Data +@ApiModel(value = "VehicleOverspeedVehiclePO", description = "安全管理-超速管理-车辆超速") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class VehicleOverspeedVehiclePO extends BaseEntity implements Serializable { + + + private static final long serialVersionUID = 970486512217363874L; + + /** + * 超速时间 + */ + @ApiModelProperty("超速时间") + @TableField(value = "overspeed_date") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime overspeedDate; + + /** + * 超速次数 + */ + @ApiModelProperty("超速次数") + @TableField(value = "overspeed_times") + private Integer overspeedTimes; + + /** + * 最高速率 + */ + @ApiModelProperty("最高速率") + @TableField(value = "max_speed") + private Double maxSpeed; + + /** + * 排名 + */ + @ApiModelProperty("排名") + @TableField(value = "rank") + private Integer rank; + + /** + * 企业id + */ + @ApiModelProperty("企业id") + @TableField(value = "company_id") + private Long companyId; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + @TableField(value = "company_name") + private String companyName; + + /** + * 所属市 + */ + @ApiModelProperty("所属市") + @TableField(value = "city") + private String city; + + /** + * 所属区 + */ + @ApiModelProperty("所属区") + @TableField(value = "distinguish") + private String distinguish; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + @TableField(value = "region_id") + private Long regionId; + private String regionName; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + @TableField(value = "car_plate") + private String carPlate ; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/LawCertificateVerificationVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/LawCertificateVerificationVO.java new file mode 100644 index 0000000..3dbb579 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/LawCertificateVerificationVO.java @@ -0,0 +1,128 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdLawCertificateVerification", description = "安全管理-行政执法-证件核查") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class LawCertificateVerificationVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 驾驶员ID + */ + @ApiModelProperty("驾驶员ID") + private Long driverId; + + /** + * 驾驶员名字 + */ + @ApiModelProperty("驾驶员名字") + private String driverName; + + /** + * 身份证号 + */ + @ApiModelProperty("身份证号") + private String idCard; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 检查日期 + */ + @ApiModelProperty("检查日期") + private LocalDateTime checkDate; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + private Long companyId; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 是否有驾驶证 + */ + @ApiModelProperty("是否有驾驶证 0没有 1有") + private Integer haveDriverLicense; + + /** + * 是否有行驶证 + */ + @ApiModelProperty("是否有行驶证 0没有 1有") + private Integer haveDrivingLicense; + + /** + * 检查地址 + */ + @ApiModelProperty("检查地址") + private String checkAddress; + + /** + * 检查人员 + */ + @ApiModelProperty("检查人员") + private String inspectors; + + /** + * 处理结束 + */ + @ApiModelProperty("处理结束") + private String processResult; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String remark; + + /** + * 区域id + */ + @ApiModelProperty("区域id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/LawEquipmentInstallVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/LawEquipmentInstallVO.java new file mode 100644 index 0000000..f2443c8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/LawEquipmentInstallVO.java @@ -0,0 +1,122 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "LawEquipmentInstallVO", description = "安全管理-行政执法-设备安装") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class LawEquipmentInstallVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 驾驶员ID + */ + @ApiModelProperty("驾驶员ID") + private Long driverId; + + /** + * 驾驶员名字 + */ + @ApiModelProperty("驾驶员名字") + private String driverName; + + /** + * 身份证号 + */ + @ApiModelProperty("身份证号") + private String idCard; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 检查日期 + */ + @ApiModelProperty("检查日期") + private LocalDateTime checkDate; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + private Long companyId; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 设备名字 + */ + @ApiModelProperty("设备名字") + private String equipmentName; + + /** + * 检查地址 + */ + @ApiModelProperty("检查地址") + private String checkAddress; + + /** + * 检查人员 + */ + @ApiModelProperty("检查人员") + private String inspectors; + + /** + * 处理结束 + */ + @ApiModelProperty("处理结束") + private String processResult; + + /** + * 备注 + */ + @ApiModelProperty("备注") + private String remark; + + /** + * 区域id + */ + @ApiModelProperty("区域id") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdInsureInfoVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdInsureInfoVO.java new file mode 100644 index 0000000..e53d5bf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdInsureInfoVO.java @@ -0,0 +1,89 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdInsureInfoVO", description = "安全管理-保险管理-承保信息") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdInsureInfoVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 起包时间 + */ + @ApiModelProperty("起包时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime insureTimeStart; + + /** + * 到期时间 + */ + @ApiModelProperty("到期时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime insureTimeEnd; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + private Long companyId; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 保险公司 + */ + @ApiModelProperty("保险公司") + private String insureCompany; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdInsureOutDangerAnalysisVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdInsureOutDangerAnalysisVO.java new file mode 100644 index 0000000..feb581a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdInsureOutDangerAnalysisVO.java @@ -0,0 +1,74 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdInsureOutDangerAnalysisVO", description = "安全管理-保险管理-出险分析") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdInsureOutDangerAnalysisVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 出险次数 + */ + @ApiModelProperty("出险次数") + private Integer outDangerTimes; + + /** + * 事故时间 + */ + @ApiModelProperty("事故时间") + private String accidentTime; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; + + /** + * 受伤人数 + */ + @ApiModelProperty("受伤人数") + private Integer injuries; + + /** + * 死亡人数 + */ + @ApiModelProperty("死亡人数") + private Integer deathToll; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdInsureOutDangerVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdInsureOutDangerVO.java new file mode 100644 index 0000000..c835085 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdInsureOutDangerVO.java @@ -0,0 +1,122 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@TableName("nd_insure_out_danger") +@ApiModel(value = "NdInsureOutDangerVO", description = "安全管理-保险管理-出险信息") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdInsureOutDangerVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 事故时间 + */ + @ApiModelProperty("事故时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime accidentTime; + + /** + * 事故地点 + */ + @ApiModelProperty("事故地点") + private String accidentAddress; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + private Long companyId; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 保险公司 + */ + @ApiModelProperty("保险公司") + private String insureCompany; + + /** + * 受伤人数 + */ + @ApiModelProperty("受伤人数") + private Integer injuries; + + /** + * 死亡人数 + */ + @ApiModelProperty("死亡人数") + private Integer deathToll; + + /** + * 理赔金额 + */ + @ApiModelProperty("理赔金额") + private BigDecimal compensateAmount; + + /** + * 上报状态 + */ + @ApiModelProperty("上报状态") + private Integer reportStatus; + + /** + * 上报状态名称 + */ + @ApiModelProperty("上报状态名称") + private String reportStatusName; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdSafetyCommitmentVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdSafetyCommitmentVO.java new file mode 100644 index 0000000..5cf8377 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdSafetyCommitmentVO.java @@ -0,0 +1,113 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdSafetyCommitment", description = "安全管理-安全承诺") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdSafetyCommitmentVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; + + /** + * 公司ID + */ + @ApiModelProperty("公司ID") + private Long companyId; + + /** + * 公司名 + */ + @ApiModelProperty("公司名") + private String companyName; + + /** + * 公司地址 + */ + @ApiModelProperty("公司地址") + private String companyAddress; + + /** + * 法人代表 + */ + @ApiModelProperty("法人代表") + private String legalPerson; + + /** + * 向社会承诺 + */ + @ApiModelProperty("向社会承诺") + private Integer commitmentsToSocial = 0; + + /** + * 向员工承诺 + */ + @ApiModelProperty("向员工承诺") + private Integer commitmentsToEmployee = 0; + + /** + * 总经理承诺 + */ + @ApiModelProperty("总经理承诺") + private Integer generalManagercommitment = 0; + + /** + * 分管总承诺 + */ + @ApiModelProperty("分管总承诺") + private Integer leaderInChargeCommitment = 0; + + /** + * 车队长承诺 + */ + @ApiModelProperty("车队长承诺") + private Integer teamLeaderCommitment = 0; + + /** + * 驾驶员承诺 + */ + @ApiModelProperty("驾驶员承诺") + private Integer driverCommitment = 0; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdSafetyCreditVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdSafetyCreditVO.java new file mode 100644 index 0000000..bc586c6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdSafetyCreditVO.java @@ -0,0 +1,137 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdSafetyCredit", description = "安全管理-安全信用") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdSafetyCreditVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; + + /** + * 公司ID + */ + @ApiModelProperty("公司ID") + private Long companyId; + + /** + * 公司名 + */ + @ApiModelProperty("公司名") + private String companyName; + + /** + * 公司地址 + */ + @ApiModelProperty("公司地址") + private String companyAddress; + + /** + * 法人代表 + */ + @ApiModelProperty("法人代表") + private String legalPerson; + + /** + * 死亡事故数量 + */ + @ApiModelProperty("死亡事故数量") + private Integer fatalAccidentsNum; + + /** + * 安全整治记录 + */ + @ApiModelProperty("安全整治记录") + private String safetyRectificationRecord; + + /** + * 执行监督指令 + */ + @ApiModelProperty("执行监督指令") + private String executeSupervisionInstructions; + + /** + * 执行安全处罚 + */ + @ApiModelProperty("执行安全处罚") + private String implementSafetyPunishment; + + /** + * 报送安全报表 + */ + @ApiModelProperty("报送安全报表") + private String submitSafetyReport; + + /** + * 制定救援预案 + */ + @ApiModelProperty("制定救援预案") + private String formulateRescuePlan; + + /** + * 安全教育培训 + */ + @ApiModelProperty("安全教育培训") + private String safetyEducationTraining; + + /** + * 瞒报事故 + */ + @ApiModelProperty("瞒报事故") + private String concealingAccidents; + + /** + * 无证生产 + */ + @ApiModelProperty("无证生产") + private String productionNoCertificate; + + /** + * 无证驾驶 + */ + @ApiModelProperty("无证驾驶") + private String drivingNoLicense; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdSecurityAdvisoryVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdSecurityAdvisoryVO.java new file mode 100644 index 0000000..11667f9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdSecurityAdvisoryVO.java @@ -0,0 +1,80 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdSecurityAdvisory", description = "安全管理-安全通报") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdSecurityAdvisoryVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; + + /** + * 通报日期 + */ + @ApiModelProperty("通报日期") + private LocalDateTime advisoryDate; + + /** + * 通报文件名 + */ + @ApiModelProperty("通报文件名") + private String advisoryFileName; + + /** + * 通报文件url + */ + @ApiModelProperty("通报文件url") + private String advisoryFileUrl; + + /** + * 通报次数 + */ + @ApiModelProperty("通报次数") + private Integer downloadTimes; + + /** + * 文件Id + */ + @ApiModelProperty("文件ID") + private Long fileId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleAccidentAnalysisVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleAccidentAnalysisVO.java new file mode 100644 index 0000000..ff2136c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleAccidentAnalysisVO.java @@ -0,0 +1,82 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdVehicleAccidentAnalysisVO", description = "安全管理-事故管理-事故分析") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleAccidentAnalysisVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 事故时间 + */ + @ApiModelProperty("事故时间") + private LocalDateTime accidentTime; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; + + /** + * 事故驾驶员 + */ + @ApiModelProperty("事故驾驶员") + private String accidentDriver; + + /** + * 驾驶员ID + */ + @ApiModelProperty("驾驶员ID") + private String driverId; + + /** + * 经纬度 + */ + @ApiModelProperty("经纬度") + private String longitudeLatitude; + + /** + * 事故地点 + */ + @ApiModelProperty("事故地点") + private String accidentAddress; + + private String carPlate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleAccidentDeadVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleAccidentDeadVO.java new file mode 100644 index 0000000..abf8764 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleAccidentDeadVO.java @@ -0,0 +1,119 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdVehicleAccidentDeadVO", description = "安全管理-事故管理-死亡事故") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleAccidentDeadVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 事故时间 + */ + @ApiModelProperty("事故时间") + private LocalDateTime accidentTime; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 事故驾驶员 + */ + @ApiModelProperty("事故驾驶员") + private String accidentDriver; + + /** + * 驾驶员ID + */ + @ApiModelProperty("驾驶员ID") + private String driverId; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + private Long companyId; + + /** + * 事故地址 + */ + @ApiModelProperty("事故地址") + private String accidentAddress; + + @ApiModelProperty("死亡人数") + private Long deathToll; + + /** + * 上报状态 + */ + @ApiModelProperty("上报状态") + private Integer reportStatus; + + /** + * 上报状态名称 + */ + @ApiModelProperty("上报状态名称") + private String reportStatusName; + + /** + * 简要案情 + */ + @ApiModelProperty("简要案情") + private String briefCase; + + /** + * 事故责任认定书认定内容 + */ + @ApiModelProperty("事故责任认定书认定内容") + private String firmContent; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleAccidentReportVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleAccidentReportVO.java new file mode 100644 index 0000000..b0c35a4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleAccidentReportVO.java @@ -0,0 +1,113 @@ +package com.ningdatech.carapi.safe.model.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.ningdatech.carapi.common.base.BaseEntity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +/** + * @author CMM + * @since 2022/12/26 13:47 + */ +@Data +@ApiModel(value = "NdVehicleAccidentReportVO", description = "安全管理-事故管理-事故上报") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleAccidentReportVO extends BaseEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + private Long companyId; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 事故车辆 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 驾驶员ID + */ + @ApiModelProperty("驾驶员ID") + private String driverId; + + /** + * 事故驾驶员 + */ + @ApiModelProperty("事故驾驶员") + private String accidentDriver; + + /** + * 事故日期 + */ + @ApiModelProperty("事故时间") + private LocalDateTime accidentTime; + + /** + * 事故地址 + */ + @ApiModelProperty("事故地址") + private String accidentAddress; + + /** + * 死亡人数 + */ + @ApiModelProperty("死亡人数") + private Long deathToll; + + /** + * 受伤人数 + */ + @ApiModelProperty("受伤人数") + private Long injuries; + + /** + * 审核状态 + */ + @ApiModelProperty(notes = "审核状态",allowableValues = "0 待审核, 1 审核通过, 2 审核不通过") + private Integer auditStatus; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + private String createTime; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleAccidentVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleAccidentVO.java new file mode 100644 index 0000000..2d35321 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleAccidentVO.java @@ -0,0 +1,160 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdVehicleAccidentVO", description = "安全管理-事故管理-车辆事故") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleAccidentVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 事故时间 + */ + @ApiModelProperty("事故时间") + private LocalDateTime accidentTime; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 驾驶员ID + */ + @ApiModelProperty("驾驶员ID") + private String driverId; + + /** + * 事故驾驶员 + */ + @ApiModelProperty("事故驾驶员") + private String accidentDriver; + + /** + * 车辆类型 + */ + @ApiModelProperty("车辆类型") + private Integer vehicleType; + + /** + * 车辆类型名 + */ + @ApiModelProperty("车辆类型名") + private String vehicleTypeName; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 企业ID + */ + @ApiModelProperty("企业ID") + private Long companyId; + + /** + * 事故地址 + */ + @ApiModelProperty("事故地址") + private String accidentAddress; + + /** + * 上报状态 + */ + @ApiModelProperty("上报状态") + private Integer reportStatus; + + /** + * 上报状态名称 + */ + @ApiModelProperty("上报状态名称") + private String reportStatusName; + + /** + * 事故类型 + */ + @ApiModelProperty("事故类型") + private Integer accidentType; + + /** + * 事故类型名称 + */ + @ApiModelProperty("事故类型名称") + private String accidentTypeName; + + /** + * 伤人数 + */ + @ApiModelProperty("伤人数") + private Integer injuries; + + /** + * 亡人数 + */ + @ApiModelProperty("亡人数") + private Integer deathToll; + + /** + * 简要案情 + */ + @ApiModelProperty("简要案情") + private String briefCase; + + /** + * 事故编号 + */ + @ApiModelProperty("事故编号") + private String accidentNo; + + /** + * 事故责任认定书认定内容 + */ + @ApiModelProperty("事故责任认定书认定内容") + private String firmContent; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleOverspeedCompanyVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleOverspeedCompanyVO.java new file mode 100644 index 0000000..175e911 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleOverspeedCompanyVO.java @@ -0,0 +1,99 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdVehicleOverspeedCompanyVO", description = "安全管理-超速管理-企业超速") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleOverspeedCompanyVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 超速时间 + */ + @ApiModelProperty("超速时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date overspeedDate; + + /** + * 超速次数 + */ + @ApiModelProperty("超速次数") + private Integer overspeedTimes; + + /** + * 最高速率 + */ + @ApiModelProperty("最高速率") + private Double maxSpeed; + + /** + * 排名 + */ + @ApiModelProperty("排名") + private Integer rank; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 企业Id + */ + @ApiModelProperty("企业ID") + private Long companyId; + + /** + * 所属市 + */ + @ApiModelProperty("所属市") + private String city; + + /** + * 所属区 + */ + @ApiModelProperty("所属区") + private String distinguish; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域名称 + */ + @ApiModelProperty("区域名称") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleOverspeedVehicleVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleOverspeedVehicleVO.java new file mode 100644 index 0000000..7d8e3f9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleOverspeedVehicleVO.java @@ -0,0 +1,100 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdVehicleOverspeedCompany", description = "安全管理-超速管理-车辆超速") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleOverspeedVehicleVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 超速时间 + */ + @ApiModelProperty("超速时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime overspeedDate; + + /** + * 超速次数 + */ + @ApiModelProperty("超速次数") + private Integer overspeedTimes; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 最高速率 + */ + @ApiModelProperty("最高速率") + private Double maxSpeed; + + /** + * 排名 + */ + @ApiModelProperty("排名") + private Integer rank; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 所属市 + */ + @ApiModelProperty("所属市") + private String city; + + /** + * 所属区 + */ + @ApiModelProperty("所属区") + private String distinguish; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域名称 + */ + @ApiModelProperty("区域名称") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleOverspeedWaysectionVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleOverspeedWaysectionVO.java new file mode 100644 index 0000000..732daf4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleOverspeedWaysectionVO.java @@ -0,0 +1,116 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdVehicleOverspeedCompany", description = "安全管理-超速管理-超速路段") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleOverspeedWaysectionVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 超速时间 + */ + @ApiModelProperty("超速时间") + private LocalDateTime overspeedDate; + + /** + * 超速次数 + */ + @ApiModelProperty("超速次数") + private Integer overspeedTimes; + + /** + * 路段名字 + */ + @ApiModelProperty("路段名字") + private String waySection; + + /** + * 路段开始名字 + */ + @ApiModelProperty("路段开始名字") + private String waySectionStart; + + /** + * 路段结束名字 + */ + @ApiModelProperty("路段结束名字") + private String waySectionEnd; + + /** + * 排名 + */ + @ApiModelProperty("排名") + private Integer rank; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 企业id + */ + @ApiModelProperty("企业id") + private Long companyId; + + /** + * 所属市 + */ + @ApiModelProperty("所属市") + private String city; + + /** + * 所属区 + */ + @ApiModelProperty("所属区") + private String distinguish; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 区域 + */ + @ApiModelProperty("区域") + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleViolationVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleViolationVO.java new file mode 100644 index 0000000..c01743b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/model/vo/NdVehicleViolationVO.java @@ -0,0 +1,165 @@ +package com.ningdatech.carapi.safe.model.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.carapi.common.base.BaseEntity; +import com.ningdatech.carapi.common.constant.MissCertEnum; +import com.ningdatech.carapi.common.constant.ViolationTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; +import org.apache.commons.lang3.StringUtils; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Data +@ApiModel(value = "NdVehicleViolation", description = "安全管理-违章管理") +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@AllArgsConstructor +public class NdVehicleViolationVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty("id") + private Long id; + + /** + * 区域名 + */ + @ApiModelProperty("区域名") + private String regionName; + + /** + * 区域ID + */ + @ApiModelProperty("区域ID") + private Long regionId; + + /** + * 企业 + */ + @ApiModelProperty("企业") + private Long companyId; + + /** + * 企业名 + */ + @ApiModelProperty("企业名") + private String companyName; + + /** + * 驾驶员 + */ + @ApiModelProperty("驾驶员") + private String driverName; + + /** + * 驾驶员ID + */ + @ApiModelProperty("驾驶员ID") + private String driverId; + + /** + * 身份证号 + */ + @ApiModelProperty("身份证号") + private String idCard; + + /** + * 违章时间 + */ + @ApiModelProperty("违章时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime violationDate; + + /** + * 违章类型 + */ + @ApiModelProperty("违章类型") + private Integer violationType; + + /** + * 违章类型 + */ + @ApiModelProperty("违章类型") + private String violationTypeName; + + /** + * 缺少证件类型 + */ + @ApiModelProperty("缺少证件类型") + private Integer missingCertificateType; + + /** + * 缺少证件类型 + */ + @ApiModelProperty("缺少证件类型名") + private String missingCertificateTypeName; + + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String carPlate; + + /** + * 闯红灯地址 + */ + @ApiModelProperty("闯红灯地址") + private String addressRedLight; + + /** + * 违规路段名 + */ + @ApiModelProperty("违规路段名") + private String waySection; + + /** + * 违章次数 + */ + @ApiModelProperty("违章次数") + private Integer violationTimes; + + /** + * 违章时间段 + */ + @ApiModelProperty("违章时间段") + private String violationPeriod; + + public String getViolationTypeName(){ + if(Objects.nonNull(this.violationType)){ + this.violationTypeName = ViolationTypeEnum.getDescByCode(this.violationType); + return this.violationTypeName; + } + return StringUtils.EMPTY; + } + public String getMissingCertificateTypeName(){ + if(Objects.nonNull(this.missingCertificateType)){ + this.missingCertificateTypeName = MissCertEnum.getDescByCode(this.missingCertificateType); + return this.missingCertificateTypeName; + } + return StringUtils.EMPTY; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/IAlarmDataPictureService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/IAlarmDataPictureService.java new file mode 100644 index 0000000..8c99819 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/IAlarmDataPictureService.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.AlarmDataPicture; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface IAlarmDataPictureService extends IService { + + boolean saveBatchForSql(List queue); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/IAlarmDataVideoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/IAlarmDataVideoService.java new file mode 100644 index 0000000..8107978 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/IAlarmDataVideoService.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.AlarmDataVideo; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface IAlarmDataVideoService extends IService { + + boolean saveBatchForSql(List queue); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdInsureInfoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdInsureInfoService.java new file mode 100644 index 0000000..c5247cb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdInsureInfoService.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.NdInsureInfo; + +import java.util.Collection; +import java.util.Map; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdInsureInfoService extends IService { + + Map listInsureCompanyByCompanyIds(Collection companyIds); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdInsureOutDangerAnalysisService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdInsureOutDangerAnalysisService.java new file mode 100644 index 0000000..222502a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdInsureOutDangerAnalysisService.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.NdInsureOutDanger; +import com.ningdatech.carapi.safe.entity.NdInsureOutDangerAnalysis; +import com.ningdatech.carapi.safe.model.dto.InsurePageQuery; +import com.ningdatech.carapi.safe.model.po.NdInsureOutDangerAnalysisPO; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdInsureOutDangerAnalysisService extends IService { + + Page pageAnalysis(Page page, InsurePageQuery param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdInsureOutDangerService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdInsureOutDangerService.java new file mode 100644 index 0000000..42561ba --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdInsureOutDangerService.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.po.OverspeedStatisticsPO; +import com.ningdatech.carapi.safe.entity.NdInsureOutDanger; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdInsureOutDangerService extends IService { + + Long countStatistics(List regionIds, LocalDateTime yearStart, LocalDateTime yearEnd); + + List statistics(List regionIds, LocalDateTime yearStart, LocalDateTime yearEnd); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdLawCertificateVerificationService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdLawCertificateVerificationService.java new file mode 100644 index 0000000..6ea892d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdLawCertificateVerificationService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.NdLawCertificateVerification; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdLawCertificateVerificationService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdLawEquipmentInstallService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdLawEquipmentInstallService.java new file mode 100644 index 0000000..cca4cbb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdLawEquipmentInstallService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.NdLawEquipmentInstall; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdLawEquipmentInstallService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdSafetyCommitmentService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdSafetyCommitmentService.java new file mode 100644 index 0000000..b63cee1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdSafetyCommitmentService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.NdSafetyCommitment; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdSafetyCommitmentService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdSafetyCreditService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdSafetyCreditService.java new file mode 100644 index 0000000..40bf3e3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdSafetyCreditService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.NdSafetyCredit; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdSafetyCreditService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdSecurityAdvisoryService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdSecurityAdvisoryService.java new file mode 100644 index 0000000..e41ceb8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdSecurityAdvisoryService.java @@ -0,0 +1,25 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.NdSecurityAdvisory; +import com.ningdatech.carapi.safe.model.dto.SecurityAdvisoryPageQuery; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdSecurityAdvisoryService extends IService { + + boolean incrementDownCount(Long id); + + void deleteById(Long id); + + List dataScopeList(LambdaQueryWrapper wrapper, SecurityAdvisoryPageQuery securityAdvisoryPageQuery); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleAccidentAnalysisService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleAccidentAnalysisService.java new file mode 100644 index 0000000..9094fe1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleAccidentAnalysisService.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentAnalysis; +import com.ningdatech.carapi.safe.model.dto.AccidentPageQuery; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdVehicleAccidentAnalysisService extends IService { + + Page pageAnalysis(Page page, AccidentPageQuery accidentPageQuery); + + Page pageAnalysisOpen(Page page, AccidentPageQuery accidentPageQuery); + +} + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleAccidentDeadService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleAccidentDeadService.java new file mode 100644 index 0000000..d6c551d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleAccidentDeadService.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.company.entity.po.ResCompanyTotalPO; +import com.ningdatech.carapi.safe.entity.NdVehicleAccident; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentDead; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdVehicleAccidentDeadService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleAccidentService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleAccidentService.java new file mode 100644 index 0000000..58663f9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleAccidentService.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.NdVehicleAccident; +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedVehicle; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdVehicleAccidentService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleOverspeedCompanyService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleOverspeedCompanyService.java new file mode 100644 index 0000000..3b2210d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleOverspeedCompanyService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedCompany; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdVehicleOverspeedCompanyService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleOverspeedVehicleService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleOverspeedVehicleService.java new file mode 100644 index 0000000..54e4a53 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleOverspeedVehicleService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedVehicle; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdVehicleOverspeedVehicleService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleOverspeedWaysectionService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleOverspeedWaysectionService.java new file mode 100644 index 0000000..3deaf82 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleOverspeedWaysectionService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedWaysection; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdVehicleOverspeedWaysectionService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleViolationService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleViolationService.java new file mode 100644 index 0000000..43d8211 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/INdVehicleViolationService.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.NdVehicleViolation; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface INdVehicleViolationService extends IService { + Long countStatistics(List regionIds, LocalDateTime start, LocalDateTime end); + + List pageDataScope(Page page, LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/IVehicleAccidentReportService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/IVehicleAccidentReportService.java new file mode 100644 index 0000000..a3410eb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/IVehicleAccidentReportService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.safe.service; + +import com.ningdatech.carapi.safe.entity.VehicleAccidentReport; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2022-12-26 + */ +public interface IVehicleAccidentReportService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/IVehicleOverspeedInfoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/IVehicleOverspeedInfoService.java new file mode 100644 index 0000000..123a4e8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/IVehicleOverspeedInfoService.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.safe.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedWaysection; +import com.ningdatech.carapi.safe.entity.VehicleOverspeedInfo; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.safe.entity.VehicleOverspeedInfo; +import com.ningdatech.carapi.safe.model.dto.OverspeedPageQuery; +import com.ningdatech.carapi.safe.model.po.NdVehicleOverspeedWaysectionPO; +import com.ningdatech.carapi.safe.model.po.VehicleOverspeedCompanyPO; +import com.ningdatech.carapi.safe.model.po.VehicleOverspeedVehiclePO; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 车辆超速信息表 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-17 + */ +public interface IVehicleOverspeedInfoService extends IService { + Long countStatistics(List regionIds, LocalDateTime todayStart, LocalDateTime todayEnd); + + Page pageGroupCompany(Page page, OverspeedPageQuery overspeedPageQuery); + + Page pageGroupVehicle(Page page, OverspeedPageQuery overspeedPageQuery); + + Page pageGroupWaysection(Page page, OverspeedPageQuery overspeedPageQuery); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/SecurityManageDataScreenService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/SecurityManageDataScreenService.java new file mode 100644 index 0000000..6e35408 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/SecurityManageDataScreenService.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.safe.service; + + +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.safe.model.dto.LongitudeLatitudeDTO; +import com.ningdatech.carapi.safe.model.po.OutDangerAnalysisPO; +import com.ningdatech.carapi.safe.model.po.OverspeedAnalysisPO; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +public interface SecurityManageDataScreenService { + + JSONObject getInsureAnalysis(DataScreenParam param,Integer type); + + List getAccidentLongitudeLatitude(DataScreenParam param); + + JSONObject getOutDangerCurrentMonth(DataScreenParam param); + + JSONObject getOverSpeedCurrentMonth(DataScreenParam param); + + JSONObject getOutDangerCity(DataScreenParam param); + + List getOutDangerAnalysis(DataScreenParam param); + + List getOverspeedAnalysis(DataScreenParam param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/AlarmDataPictureServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/AlarmDataPictureServiceImpl.java new file mode 100644 index 0000000..ce2c009 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/AlarmDataPictureServiceImpl.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.safe.entity.AlarmDataPicture; +import com.ningdatech.carapi.safe.mapper.AlarmDataPictureMapper; +import com.ningdatech.carapi.safe.service.IAlarmDataPictureService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +@RequiredArgsConstructor +public class AlarmDataPictureServiceImpl extends ServiceImpl + implements IAlarmDataPictureService { + + private final AlarmDataPictureMapper alarmDataPictureMapper; + + @Override + public boolean saveBatchForSql(List list) { + return alarmDataPictureMapper.saveBatchForSql(list); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/AlarmDataVideoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/AlarmDataVideoServiceImpl.java new file mode 100644 index 0000000..434bd5a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/AlarmDataVideoServiceImpl.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.safe.entity.AlarmDataVideo; +import com.ningdatech.carapi.safe.mapper.AlarmDataVideoMapper; +import com.ningdatech.carapi.safe.service.IAlarmDataVideoService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +@RequiredArgsConstructor +public class AlarmDataVideoServiceImpl extends ServiceImpl + implements IAlarmDataVideoService { + + private final AlarmDataVideoMapper alarmDataVideoMapper; + @Override + public boolean saveBatchForSql(List list) { + return alarmDataVideoMapper.saveBatchForSql(list); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdAccidentServiceAnalysisImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdAccidentServiceAnalysisImpl.java new file mode 100644 index 0000000..017151a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdAccidentServiceAnalysisImpl.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentAnalysis; +import com.ningdatech.carapi.safe.mapper.NdVehicleAccidentAnalysisMapper; +import com.ningdatech.carapi.safe.model.dto.AccidentPageQuery; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentAnalysisService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +@RequiredArgsConstructor +public class NdAccidentServiceAnalysisImpl extends ServiceImpl + implements INdVehicleAccidentAnalysisService { + + private final NdVehicleAccidentAnalysisMapper mapper; + + @Override + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public Page pageAnalysis(Page page, AccidentPageQuery accidentPageQuery) { + return mapper.pageAnalysis(page,accidentPageQuery); + } + + @Override + public Page pageAnalysisOpen(Page page, AccidentPageQuery accidentPageQuery) { + return mapper.pageAnalysis(page,accidentPageQuery); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdAccidentServiceDeadImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdAccidentServiceDeadImpl.java new file mode 100644 index 0000000..bf2adb8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdAccidentServiceDeadImpl.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.company.entity.po.ResCompanyTotalPO; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentDead; +import com.ningdatech.carapi.safe.mapper.NdVehicleAccidentDeadMapper; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentDeadService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +@RequiredArgsConstructor +public class NdAccidentServiceDeadImpl extends ServiceImpl + implements INdVehicleAccidentDeadService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdAccidentServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdAccidentServiceImpl.java new file mode 100644 index 0000000..3525670 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdAccidentServiceImpl.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.safe.entity.NdVehicleAccident; +import com.ningdatech.carapi.safe.mapper.NdVehicleAccidentMapper; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +public class NdAccidentServiceImpl extends ServiceImpl + implements INdVehicleAccidentService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdInsureInfoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdInsureInfoServiceImpl.java new file mode 100644 index 0000000..a4161a7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdInsureInfoServiceImpl.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.safe.entity.NdInsureInfo; +import com.ningdatech.carapi.safe.mapper.NdInsureInfoMapper; +import com.ningdatech.carapi.safe.service.INdInsureInfoService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +public class NdInsureInfoServiceImpl extends ServiceImpl + implements INdInsureInfoService { + + @Override + public Map listInsureCompanyByCompanyIds(Collection companyIds) { + if(CollectionUtils.isEmpty(companyIds)){ + return Collections.emptyMap(); + } + List ndInsureInfos = list(Wrappers.lambdaQuery(NdInsureInfo.class) + .in(NdInsureInfo::getCompanyId, companyIds)); + return CollUtils.listToMap(ndInsureInfos,NdInsureInfo::getCompanyId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdInsureOutDangerAnalysisServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdInsureOutDangerAnalysisServiceImpl.java new file mode 100644 index 0000000..ea7def4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdInsureOutDangerAnalysisServiceImpl.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.safe.entity.NdInsureOutDangerAnalysis; +import com.ningdatech.carapi.safe.mapper.NdInsureOutDangerAnalysisMapper; +import com.ningdatech.carapi.safe.model.dto.InsurePageQuery; +import com.ningdatech.carapi.safe.model.po.NdInsureOutDangerAnalysisPO; +import com.ningdatech.carapi.safe.service.INdInsureOutDangerAnalysisService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +@RequiredArgsConstructor +public class NdInsureOutDangerAnalysisServiceImpl extends ServiceImpl + implements INdInsureOutDangerAnalysisService { + + private final NdInsureOutDangerAnalysisMapper mapper; + + @Override + public Page pageAnalysis(Page page, InsurePageQuery param) { + return mapper.pageAnalysis(page,param); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdInsureOutDangerServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdInsureOutDangerServiceImpl.java new file mode 100644 index 0000000..3579eb5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdInsureOutDangerServiceImpl.java @@ -0,0 +1,65 @@ +package com.ningdatech.carapi.safe.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.datascreen.model.po.OverspeedStatisticsPO; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.safe.entity.NdInsureOutDanger; +import com.ningdatech.carapi.safe.mapper.NdInsureOutDangerMapper; +import com.ningdatech.carapi.safe.service.INdInsureOutDangerService; +import lombok.RequiredArgsConstructor; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +@RequiredArgsConstructor +public class NdInsureOutDangerServiceImpl extends ServiceImpl + implements INdInsureOutDangerService { + + private final NdInsureOutDangerMapper insureOutDangerMapper; + + @Override + public Long countStatistics(List regionIds, LocalDateTime start, LocalDateTime end) { + NdInsureOutDangerServiceImpl contex = (NdInsureOutDangerServiceImpl)AopContext.currentProxy(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdInsureOutDanger.class); + contex.searchStatisticsCount(wrapper,regionIds,start,end); + return count(); + } + + @LambdaDataScope + public void searchStatisticsCount(LambdaQueryWrapper wrapper, List regionIds, LocalDateTime start, LocalDateTime end) { + wrapper.in(CollUtil.isNotEmpty(regionIds),NdInsureOutDanger::getRegionId, regionIds) + .ge(NdInsureOutDanger::getAccidentTime, start) + .le(NdInsureOutDanger::getAccidentTime, end); + } + + @Override + public List statistics(List regionIds, LocalDateTime start, LocalDateTime end) { + NdInsureOutDangerServiceImpl contex = (NdInsureOutDangerServiceImpl)AopContext.currentProxy(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdInsureOutDanger.class); + contex.searchStatistics(wrapper,regionIds,start,end); + return list(wrapper); + } + + @LambdaDataScope + public void searchStatistics(LambdaQueryWrapper wrapper, List regionIds, LocalDateTime start, LocalDateTime end) { + wrapper.in(CollUtil.isNotEmpty(regionIds),NdInsureOutDanger::getRegionId, regionIds) + .ge(NdInsureOutDanger::getAccidentTime, start) + .le(NdInsureOutDanger::getAccidentTime, end); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdLawCertificateVerificationServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdLawCertificateVerificationServiceImpl.java new file mode 100644 index 0000000..56e5b7f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdLawCertificateVerificationServiceImpl.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.safe.entity.NdLawCertificateVerification; +import com.ningdatech.carapi.safe.mapper.NdLawCertificateVerificationMapper; +import com.ningdatech.carapi.safe.service.INdLawCertificateVerificationService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +public class NdLawCertificateVerificationServiceImpl extends ServiceImpl + implements INdLawCertificateVerificationService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdLawEquipmentInstallServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdLawEquipmentInstallServiceImpl.java new file mode 100644 index 0000000..dea0345 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdLawEquipmentInstallServiceImpl.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.safe.entity.NdLawEquipmentInstall; +import com.ningdatech.carapi.safe.mapper.NdLawEquipmentInstallMapper; +import com.ningdatech.carapi.safe.service.INdLawEquipmentInstallService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +public class NdLawEquipmentInstallServiceImpl extends ServiceImpl + implements INdLawEquipmentInstallService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdSafetyCommitmentServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdSafetyCommitmentServiceImpl.java new file mode 100644 index 0000000..28e5e27 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdSafetyCommitmentServiceImpl.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.safe.entity.NdSafetyCommitment; +import com.ningdatech.carapi.safe.mapper.NdSafetyCommitmentMapper; +import com.ningdatech.carapi.safe.service.INdSafetyCommitmentService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +public class NdSafetyCommitmentServiceImpl extends ServiceImpl + implements INdSafetyCommitmentService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdSafetyCreditServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdSafetyCreditServiceImpl.java new file mode 100644 index 0000000..ac3fe72 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdSafetyCreditServiceImpl.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.safe.entity.NdSafetyCredit; +import com.ningdatech.carapi.safe.mapper.NdSafetyCreditMapper; +import com.ningdatech.carapi.safe.service.INdSafetyCreditService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +public class NdSafetyCreditServiceImpl extends ServiceImpl + implements INdSafetyCreditService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdSecurityAdvisoryServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdSecurityAdvisoryServiceImpl.java new file mode 100644 index 0000000..4e29ad9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdSecurityAdvisoryServiceImpl.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.safe.entity.NdSecurityAdvisory; +import com.ningdatech.carapi.safe.mapper.NdSecurityAdvisoryMapper; +import com.ningdatech.carapi.safe.model.dto.SecurityAdvisoryPageQuery; +import com.ningdatech.carapi.safe.service.INdSecurityAdvisoryService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +public class NdSecurityAdvisoryServiceImpl extends ServiceImpl + implements INdSecurityAdvisoryService { + + @Override + public boolean incrementDownCount(Long id) { + return baseMapper.incrementDownCount(id) > 0; + } + + @Override + public void deleteById(Long id) { + baseMapper.deleteById(id); + } + + @Override + @LambdaDataScope + @BuildChildrenRegionWrapper + public List dataScopeList(LambdaQueryWrapper wrapper, SecurityAdvisoryPageQuery securityAdvisoryPageQuery) { + wrapper.eq(Objects.nonNull(securityAdvisoryPageQuery.getAdvisoryDate()),NdSecurityAdvisory::getAdvisoryDate,securityAdvisoryPageQuery.getAdvisoryDate()); + wrapper.eq(Objects.nonNull(securityAdvisoryPageQuery.getRegionId()),NdSecurityAdvisory::getRegionId,securityAdvisoryPageQuery.getRegionId()); + wrapper.orderBy(Boolean.TRUE,Boolean.FALSE,NdSecurityAdvisory::getUpdateOn); + return baseMapper.selectList(wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdVehicleOverspeedCompanyServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdVehicleOverspeedCompanyServiceImpl.java new file mode 100644 index 0000000..4887bfe --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdVehicleOverspeedCompanyServiceImpl.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedCompany; +import com.ningdatech.carapi.safe.mapper.NdVehicleOverspeedCompanyMapper; +import com.ningdatech.carapi.safe.service.INdVehicleOverspeedCompanyService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +@RequiredArgsConstructor +public class NdVehicleOverspeedCompanyServiceImpl extends ServiceImpl + implements INdVehicleOverspeedCompanyService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdVehicleOverspeedVehicleServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdVehicleOverspeedVehicleServiceImpl.java new file mode 100644 index 0000000..d2a61b2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdVehicleOverspeedVehicleServiceImpl.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedVehicle; +import com.ningdatech.carapi.safe.mapper.NdVehicleOverspeedCompanyMapper; +import com.ningdatech.carapi.safe.mapper.NdVehicleOverspeedVehicleMapper; +import com.ningdatech.carapi.safe.service.INdVehicleOverspeedVehicleService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +public class NdVehicleOverspeedVehicleServiceImpl extends ServiceImpl implements INdVehicleOverspeedVehicleService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdVehicleOverspeedWaysectionServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdVehicleOverspeedWaysectionServiceImpl.java new file mode 100644 index 0000000..ac4cb65 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdVehicleOverspeedWaysectionServiceImpl.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.safe.entity.NdVehicleOverspeedWaysection; +import com.ningdatech.carapi.safe.mapper.NdVehicleOverspeedWaysectionMapper; +import com.ningdatech.carapi.safe.service.INdVehicleOverspeedWaysectionService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +public class NdVehicleOverspeedWaysectionServiceImpl extends ServiceImpl + implements INdVehicleOverspeedWaysectionService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdVehicleViolationServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdVehicleViolationServiceImpl.java new file mode 100644 index 0000000..8edcae3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/NdVehicleViolationServiceImpl.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.safe.service.impl; + +import java.time.LocalDateTime; +import java.util.List; + +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.safe.entity.NdVehicleViolation; +import com.ningdatech.carapi.safe.mapper.NdVehicleViolationMapper; +import com.ningdatech.carapi.safe.service.INdVehicleViolationService; + +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +@RequiredArgsConstructor +public class NdVehicleViolationServiceImpl extends ServiceImpl + implements INdVehicleViolationService { + + private final NdVehicleViolationMapper mapper; + + @Override + public Long countStatistics(List regionIds, LocalDateTime start, LocalDateTime end) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleViolation.class); + NdVehicleViolationServiceImpl context = (NdVehicleViolationServiceImpl)AopContext.currentProxy(); + context.dataScopeCount(wrapper,regionIds,start,end); + return count(wrapper); + } + + @LambdaDataScope + public void dataScopeCount(LambdaQueryWrapper wrapper, List regionIds, LocalDateTime start, LocalDateTime end) { + wrapper.in(CollUtil.isNotEmpty(regionIds),NdVehicleViolation::getRegionId, regionIds) + .ge(NdVehicleViolation::getViolationDate, start) + .le(NdVehicleViolation::getViolationDate, end); + } + + @Override + @LambdaDataScope(wrapperIndex = 1,type = LambdaDataScopeTypeEnum.ALL) + public List pageDataScope(Page page, LambdaQueryWrapper wrapper) { + return mapper.selectList(wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/SecurityManageDataScreenServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/SecurityManageDataScreenServiceImpl.java new file mode 100644 index 0000000..f35913d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/SecurityManageDataScreenServiceImpl.java @@ -0,0 +1,308 @@ +package com.ningdatech.carapi.safe.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Maps; +import com.ningdatech.basic.model.DateRange; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.DateRangeUtil; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +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.aop.XmlDataScope; +import com.ningdatech.carapi.safe.entity.NdVehicleAccident; +import com.ningdatech.carapi.safe.entity.NdVehicleAccidentDead; +import com.ningdatech.carapi.safe.mapper.SecurityManageDataScreenMapper; +import com.ningdatech.carapi.safe.model.dto.LongitudeLatitudeDTO; +import com.ningdatech.carapi.safe.model.po.*; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentDeadService; +import com.ningdatech.carapi.safe.service.INdVehicleAccidentService; +import com.ningdatech.carapi.safe.service.SecurityManageDataScreenService; +import com.ningdatech.carapi.safe.utils.InitDataUtil; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import lombok.RequiredArgsConstructor; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-10-12 + */ +@Service +@RequiredArgsConstructor +public class SecurityManageDataScreenServiceImpl implements SecurityManageDataScreenService { + + private final RegionsCacheHelper regionsCacheHelper; + private final SecurityManageDataScreenMapper securityManageDataScreenMapper; + private final INdVehicleAccidentService accidentService; + private final INdVehicleAccidentDeadService accidentDeadService; + + private final String FIRST_PERIOD_TIME = "0:00-02:00"; + private final String SECOND_PERIOD_TIME = "2:00-4:00"; + private final String THIRD_PERIOD_TIME = "4:00-6:00"; + private final String FOURTH_PERIOD_TIME = "6:00-8:00"; + private final String FIFTH_PERIOD_TIME = "8:00-10:00"; + private final String SIXTH_PERIOD_TIME = "10:00-12:00"; + private final String SEVENTH_PERIOD_TIME = "12:00-14:00"; + private final String EIGHTH_PERIOD_TIME = "14:00-16:00"; + private final String NINTH_PERIOD_TIME = "16:00-18:00"; + private final String TENTH_PERIOD_TIME = "18:00-20:00"; + private final String ELEVENTH_PERIOD_TIME = "20:00-22:00"; + private final String LAST_PERIOD_TIME = "22:00-24:00"; + + /** + * 近三年保险分析对比 + * + * @param param + * @return + */ + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public JSONObject getInsureAnalysis(DataScreenParam param, Integer type) { + param.setType(type); + List times = securityManageDataScreenMapper.getOutDangerAnalysis(param); + return convert(times, type); + } + + /** + * 浙江省事故 经纬度分布 + * + * @param param + * @return + */ + @Override + public List getAccidentLongitudeLatitude(DataScreenParam param) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleAccident.class); + LambdaQueryWrapper wrapperDead = Wrappers.lambdaQuery(NdVehicleAccidentDead.class); + SecurityManageDataScreenServiceImpl context = (SecurityManageDataScreenServiceImpl) AopContext.currentProxy(); + List searchAccidents = context.searchAccidents(wrapper, param); + List accidentDeads = context.searchAccidentDeads(wrapperDead, param); + List accidents = searchAccidents.stream().map(accident -> new LongitudeLatitudeDTO(accident.getLongitude(), accident.getLatitude())).collect(Collectors.toList()); + List deads = accidentDeads.stream().map(dead -> new LongitudeLatitudeDTO(dead.getLongitude(), dead.getLatitude())).collect(Collectors.toList()); + return Stream.of(accidents, deads).flatMap(Collection::stream).distinct().collect(Collectors.toList()); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public List searchAccidents(LambdaQueryWrapper wrapper, DataScreenParam param) { + return accidentService.list(wrapper); + } + + @LambdaDataScope + @BuildChildrenRegionWrapper + public List searchAccidentDeads(LambdaQueryWrapper wrapper, DataScreenParam param) { + return accidentDeadService.list(wrapper); + } + + /** + * 本月 各时段出险 + * + * @param param + * @return + */ + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public JSONObject getOutDangerCurrentMonth(DataScreenParam param) { + JSONObject res = new JSONObject(); + if (param.getStartTime() == null || param.getEndTime() == null) { + // 默认查询上月数据 + DateRange monthRange = DateRangeUtil.monthsAgo(1); + param.setStartTime(monthRange.getStart().atStartOfDay()); + param.setEndTime(monthRange.getEnd().atTime(LocalTime.MAX)); + } + OutDangerPeriodTimePO outDangerPeriodTime = securityManageDataScreenMapper.getOutDangerPeriodTime(param); + return convertJson(outDangerPeriodTime, res); + } + + /** + * 超速本月数据 + * + * @param param + * @return + */ + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public JSONObject getOverSpeedCurrentMonth(DataScreenParam param) { + JSONObject res = new JSONObject(); + List overspeedTimes = securityManageDataScreenMapper.getOverSpeedCurrentMonth(param); + return convertOverspeedJson(overspeedTimes, res); + } + + /** + * 近三年各城市出险次数 + * + * @param param + * @return + */ + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public JSONObject getOutDangerCity(DataScreenParam param) { + JSONObject res = new JSONObject(); + CodeUtil.buildRegionLevel(param); + List outDangers = securityManageDataScreenMapper.getOutDangerRegions(param); + complementaryRegion(outDangers, param.getRegionId()); + return convertCityOutDangerJson(outDangers, res); + } + + @Override + @XmlDataScope + public List getOutDangerAnalysis(DataScreenParam param) { + return securityManageDataScreenMapper.getOutDangerAnalysis(param); + } + + @Override + @XmlDataScope + public List getOverspeedAnalysis(DataScreenParam param) { + return securityManageDataScreenMapper.getOverspeedAnalysis(param); + } + + private JSONObject convertCityOutDangerJson(List outDangerCities, JSONObject res) { + if (CollUtil.isEmpty(outDangerCities)) { + return res; + } + JSONObject total = new JSONObject(); + JSONObject data = new JSONObject(true); + Integer beforeTotal = 0; + Integer lastTotal = 0; + Integer currentTotal = 0; + for (OutDangerCityPO po : outDangerCities) { + beforeTotal += po.getBeforeOutDanger(); + lastTotal += po.getLastOutDanger(); + currentTotal += po.getCurrentOutDanger(); + JSONObject innerData = new JSONObject(); + innerData.put(String.valueOf(LocalDateTime.now().minusYears(2).getYear()), po.getBeforeOutDanger()); + innerData.put(String.valueOf(LocalDateTime.now().minusYears(1).getYear()), po.getLastOutDanger()); + innerData.put(String.valueOf(LocalDateTime.now().getYear()), po.getCurrentOutDanger()); + data.put(po.getRegionName(), innerData); + } + total.put(String.valueOf(LocalDateTime.now().minusYears(2).getYear()), beforeTotal); + total.put(String.valueOf(LocalDateTime.now().minusYears(1).getYear()), lastTotal); + total.put(String.valueOf(LocalDateTime.now().getYear()), currentTotal); + res.put("total", total); + res.put("data", data); + return res; + } + + private JSONObject convertOverspeedJson(List overspeedTimes, JSONObject res) { + Map dataMap = CollUtils.listToMap(overspeedTimes, o -> o.getMonthDay()); + TreeMap innerData = new TreeMap(); + for (int i = 30; i >= 0; i--) { + String dateStr = NdDateUtils.format(LocalDateTime.now().minusDays(i), DatePattern.NORM_DATE_PATTERN); + if (dataMap.containsKey(dateStr)) { + innerData.put(dataMap.get(dateStr).getMonthDay(), dataMap.get(dateStr).getOverspeedTimes()); + } else { + innerData.put(dateStr, 0); + } + } + + res.put("total", overspeedTimes.stream().mapToInt(overspeedTime -> overspeedTime.getOverspeedTimes()).sum()); + res.put("data", innerData); + return res; + } + + private JSONObject convertJson(OutDangerPeriodTimePO po, JSONObject res) { + if (Objects.isNull(po)) { + return res; + } + res.put(FIRST_PERIOD_TIME, po.getFirstPeriodTime()); + res.put(SECOND_PERIOD_TIME, po.getSecondPeriodTime()); + res.put(THIRD_PERIOD_TIME, po.getThirdPeriodTime()); + res.put(FOURTH_PERIOD_TIME, po.getFourthPeriodTime()); + res.put(FIFTH_PERIOD_TIME, po.getFifthPeriodTime()); + res.put(SIXTH_PERIOD_TIME, po.getSixthPeriodTime()); + res.put(SEVENTH_PERIOD_TIME, po.getSeventhPeriodTime()); + res.put(EIGHTH_PERIOD_TIME, po.getEighthPeriodTime()); + res.put(NINTH_PERIOD_TIME, po.getNinthPeriodTime()); + res.put(TENTH_PERIOD_TIME, po.getTenthPeriodTime()); + res.put(ELEVENTH_PERIOD_TIME, po.getEleventhPeriodTime()); + res.put(LAST_PERIOD_TIME, po.getLastPeriodTime()); + return res; + } + + private JSONObject convert(List outDangerTimes, Integer type) { + Map> yearMap = InitDataUtil.initThreeYears(); + for (OutDangerAnalysisPO outDangerTime : outDangerTimes) { + if (yearMap.containsKey(outDangerTime.getYear())) { + Map monthMap = yearMap.get(outDangerTime.getYear()); + if (monthMap.containsKey(outDangerTime.getMonth())) { + switch (type) { + case 1: + monthMap.put(outDangerTime.getMonth(), outDangerTime.getOutDangerTimes()); + break; + case 2: + monthMap.put(outDangerTime.getMonth(), outDangerTime.getInjuries()); + break; + case 3: + monthMap.put(outDangerTime.getMonth(), outDangerTime.getDeathToll()); + break; + default: + monthMap.put(outDangerTime.getMonth(), outDangerTime.getOutDangerTimes()); + } + } + } + } + Map total = countTotal(yearMap); + yearMap.put("total", total); + return JSONObject.parseObject(JSON.toJSONString(yearMap)); + } + + private Map countTotal(Map> yearMap) { + Map total = Maps.newHashMap(); + Map currentMap = yearMap.get(String.valueOf(LocalDateTime.now().getYear())); + int currentSum = currentMap.values().stream().mapToInt(o -> Integer.parseInt(String.valueOf(o))).sum(); + total.put(String.valueOf(LocalDateTime.now().getYear()), currentSum); + Map lastMap = yearMap.get(String.valueOf(LocalDateTime.now().minusYears(1).getYear())); + int lastSum = lastMap.values().stream().mapToInt(o -> Integer.parseInt(String.valueOf(o))).sum(); + total.put(String.valueOf(LocalDateTime.now().minusYears(1).getYear()), lastSum); + Map beforeMap = yearMap.get(String.valueOf(LocalDateTime.now().minusYears(2).getYear())); + int beforeSum = beforeMap.values().stream().mapToInt(o -> Integer.parseInt(String.valueOf(o))).sum(); + total.put(String.valueOf(LocalDateTime.now().minusYears(2).getYear()), beforeSum); + return total; + } + + public void complementaryRegion(List list, Long regionId) { + Map dataMap = CollUtils.listToMap(list, OutDangerCityPO::getRegionId); + List regions = regionsCacheHelper.listChildOnly(regionId, true); + List tmpList = new ArrayList<>(); + regions.forEach(w -> { + OutDangerCityPO odc = dataMap.get(w.getId()); + if (odc == null) { + odc = new OutDangerCityPO(); + odc.setRegionId(w.getId()); + odc.setRegionName(w.getRegionName()); + odc.setRegionName(w.getRegionName()); + odc.setRegionCode(w.getRegionCode()); + odc.setTotal(0); + odc.setLastOutDanger(0); + odc.setCurrentOutDanger(0); + odc.setBeforeOutDanger(0); + } + tmpList.add(odc); + }); + list.clear(); + list.addAll(tmpList); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/VehicleAccidentReportServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/VehicleAccidentReportServiceImpl.java new file mode 100644 index 0000000..3d35f55 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/VehicleAccidentReportServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.safe.service.impl; + +import com.ningdatech.carapi.safe.entity.VehicleAccidentReport; +import com.ningdatech.carapi.safe.mapper.VehicleAccidentReportMapper; +import com.ningdatech.carapi.safe.service.IVehicleAccidentReportService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2022-12-26 + */ +@Service +public class VehicleAccidentReportServiceImpl extends ServiceImpl implements IVehicleAccidentReportService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/VehicleOverspeedInfoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/VehicleOverspeedInfoServiceImpl.java new file mode 100644 index 0000000..35639c0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/service/impl/VehicleOverspeedInfoServiceImpl.java @@ -0,0 +1,131 @@ +package com.ningdatech.carapi.safe.service.impl; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Service; + +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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.car.vehicle.mapper.VehicleBaseInfoMapper; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.safe.entity.VehicleOverspeedInfo; +import com.ningdatech.carapi.safe.mapper.VehicleOverspeedInfoMapper; +import com.ningdatech.carapi.safe.model.dto.OverspeedPageQuery; +import com.ningdatech.carapi.safe.model.po.NdVehicleOverspeedWaysectionPO; +import com.ningdatech.carapi.safe.model.po.VehicleOverspeedCompanyPO; +import com.ningdatech.carapi.safe.model.po.VehicleOverspeedVehiclePO; +import com.ningdatech.carapi.safe.service.IVehicleOverspeedInfoService; + +import cn.hutool.core.collection.CollUtil; +import lombok.RequiredArgsConstructor; + +/** + *

+ * 车辆超速信息表 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-17 + */ +@Service +@RequiredArgsConstructor +public class VehicleOverspeedInfoServiceImpl extends ServiceImpl implements IVehicleOverspeedInfoService { + + private final VehicleOverspeedInfoMapper vehicleOverspeedInfoMapper; + private final VehicleBaseInfoMapper vehicleBaseInfoMapper; + + + @Override + public Long countStatistics(List regionIds,LocalDateTime todayStart, LocalDateTime todayEnd) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(VehicleOverspeedInfo.class); + VehicleOverspeedInfoServiceImpl contex = (VehicleOverspeedInfoServiceImpl)AopContext.currentProxy(); + contex.dataScopeCount(wrapper,regionIds,todayStart,todayEnd); + // 根据车辆类型,过滤出真实超速的 + Map baseInfoMap = vehicleBaseInfoMapper.selectList(Wrappers.lambdaQuery(NdVehicleBaseInfo.class)).stream() + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + List overspeedInfos = vehicleOverspeedInfoMapper.selectList(wrapper); + List list = overspeedInfos.stream().filter(v -> { + NdVehicleBaseInfo baseInfo = baseInfoMap.get(v.getCarPlate()); + if (Objects.nonNull(baseInfo)) { + if (Boolean.TRUE.equals(checkIsOverSpeed(v, baseInfo))){ + return true; + } + } + return false; + }).collect(Collectors.toList()); + return (long) list.size(); + } + + @LambdaDataScope + public void dataScopeCount(LambdaQueryWrapper wrapper, List regionIds, LocalDateTime todayStart, LocalDateTime todayEnd) { + wrapper.in(CollUtil.isNotEmpty(regionIds),VehicleOverspeedInfo::getRegionId, regionIds) + .ge(VehicleOverspeedInfo::getOverspeedDate, todayStart) + .le(VehicleOverspeedInfo::getOverspeedDate, todayEnd); + } + + @Override + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public Page pageGroupCompany(Page page, OverspeedPageQuery overspeedPageQuery) { + vehicleOverspeedInfoMapper.pageGroupCompany(page, overspeedPageQuery); + CodeUtil.searchCompanyNamesAndRegionNames(page.getRecords()); + return page; + } + + @Override + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public Page pageGroupVehicle(Page page, OverspeedPageQuery overspeedPageQuery) { + vehicleOverspeedInfoMapper.pageGroupVehicle(page, overspeedPageQuery); + CodeUtil.searchCompanyNamesAndRegionNames(page.getRecords()); + return page; + } + + @Override + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public Page pageGroupWaysection(Page page, OverspeedPageQuery overspeedPageQuery) { + vehicleOverspeedInfoMapper.pageGroupWaysection(page, overspeedPageQuery); + CodeUtil.searchCompanyNamesAndRegionNames(page.getRecords()); + return page; + } + + private Boolean checkIsOverSpeed(VehicleOverspeedInfo overspeedInfo, NdVehicleBaseInfo baseInfo) { + // 混凝土和移动泵车 是50 + Integer vehicleType = baseInfo.getVehicleType(); + VehicleTypeEnum enumByValue = VehicleTypeEnum.getEnumByValue(vehicleType); + if (VehicleTypeEnum.OTHER.equals(enumByValue)) { + if (overspeedInfo.getMaxSpeed().compareTo(BigDecimal.valueOf(80)) > 0) { + return Boolean.TRUE; + } + } else if (VehicleTypeEnum.KRHP.equals(enumByValue)) { + if (overspeedInfo.getMaxSpeed().compareTo(BigDecimal.valueOf(50)) > 0) { + return Boolean.TRUE; + } + } else if (VehicleTypeEnum.MIXER.equals(enumByValue)) { + if (overspeedInfo.getMaxSpeed().compareTo(BigDecimal.valueOf(50)) > 0) { + return Boolean.TRUE; + } + } else if (VehicleTypeEnum.BULK_CEMENT_TRUCK.equals(enumByValue)) { + if (overspeedInfo.getMaxSpeed().compareTo(BigDecimal.valueOf(80)) > 0) { + return Boolean.TRUE; + } + } else if (VehicleTypeEnum.READY_MIXED_MORTAR_TRUC.equals(enumByValue)) { + return overspeedInfo.getMaxSpeed().compareTo(BigDecimal.valueOf(80)) > 0; + } + return Boolean.FALSE; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/utils/InitDataUtil.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/utils/InitDataUtil.java new file mode 100644 index 0000000..0421b19 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/safe/utils/InitDataUtil.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.safe.utils; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.google.common.collect.Maps; + +import java.time.LocalDateTime; +import java.util.Map; + +/** + * @Classname InitDataUtil + * @Description + * @Date 2022/10/26 15:42 + * @Created by PoffyZhang + */ +public class InitDataUtil { + private static JSONObject MONTHS = JSON.parseObject("{\"01\":0,\"02\":0,\"03\":0,\"04\":0,\"05\":0,\"06\":0" + + ",\"07\":0,\"08\":0,,\"09\":0,\"10\":0,\"11\":0,\"12\":0}"); + + public static Map> initThreeYears(){ + Map> res = Maps.newHashMap(); + res.put(String.valueOf(LocalDateTime.now().minusYears(2).getYear()),BeanUtil.beanToMap(MONTHS)); + res.put(String.valueOf(LocalDateTime.now().minusYears(1).getYear()),BeanUtil.beanToMap(MONTHS)); + res.put(String.valueOf(LocalDateTime.now().getYear()),BeanUtil.beanToMap(MONTHS)); + return res; + } + + public static Map> initTwoYears(){ + Map> res = Maps.newHashMap(); + res.put(String.valueOf(LocalDateTime.now().minusYears(1).getYear()),BeanUtil.beanToMap(MONTHS)); + res.put(String.valueOf(LocalDateTime.now().getYear()),BeanUtil.beanToMap(MONTHS)); + return res; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/contants/TaskConstant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/contants/TaskConstant.java new file mode 100644 index 0000000..3db2b2b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/contants/TaskConstant.java @@ -0,0 +1,157 @@ +package com.ningdatech.carapi.scheduler.contants; + +import java.math.BigDecimal; + +/** + * @author PoffyZhang + * @Classname TaskContant + * @Description + * @Date 2022/12/7 11:00 + */ +public interface TaskConstant { + class Host { + public static final String HOST_ZPF = "LAPTOP-NQGEQP03"; + public static final String HOST_CMM2 = "DESKTOP-KN1L6HL"; + public static final String HOST_CMM = "LAPTOP-PCISPN2O"; + + public static final String HOST_207 = "iZbp13nwyvib53j4j1p2xoZ"; + } + + class DataField { + + public static final String GPS = "GPS"; + + public static final String ADAS = "ADAS"; + public static final String ROAD_SIGN_TYPE = "roadSignType"; + public static final String ROAD_SIGN_DATA = "roadSignData"; + public static final String LONGITUDE = "longitude"; + + public static final String LATITUDE = "latitude"; + } + + class Data{ + public static final Integer ROAD_SIGN_TYPE_OVERSPEED = 1; + public static final Integer STAR_NUMBER_RANGE_ZERO = 0; + public static final Integer STAR_NUMBER_RANGE_TWENTY = 20; + public static final Integer STAR_NUMBER_RANGE_FORTY = 40; + public static final Integer STAR_NUMBER_RANGE_SIXTY = 60; + public static final Integer STAR_NUMBER_RANGE_EIGHTY = 80; + + public static final Integer DRIVER_STAR_DATA_CNT_ONE = 1; + + public static final Integer OPERATOR_ASSESSMENT_SCORE_ZERO = 0; + public static final Integer OPERATOR_ASSESSMENT_SCORE_HUNDRED = 100; + + public static final Integer MONTH_VALUE_ONE = 1; + public static final Integer MONTH_VALUE_TWO = 2; + public static final Integer MONTH_VALUE_THREE = 3; + public static final Integer MONTH_VALUE_FOUR = 4; + public static final Integer MONTH_VALUE_FIVE = 5; + public static final Integer MONTH_VALUE_SIX = 6; + public static final Integer MONTH_VALUE_SEVEN = 7; + public static final Integer MONTH_VALUE_EIGHT = 8; + public static final Integer MONTH_VALUE_NINE = 9; + public static final Integer MONTH_VALUE_TEN = 10; + public static final Integer MONTH_VALUE_ELEVEN = 11; + public static final Integer MONTH_VALUE_TWELVE = 12; + + public static final Integer SUB_LIST_SIZE = 2000; + public static final Integer VIOLATION_TIME_SEVEN = 7; + public static final Integer VIOLATION_TIME_NINE = 9; + public static final Integer VIOLATION_TIME_SIXTEEN = 16; + public static final Integer VIOLATION_TIME_EIGHTEEN = 18; + public static final String VIOLATION_TIME_AM_START = "7:00"; + public static final String VIOLATION_TIME_AM_END = "9:00"; + public static final String VIOLATION_TIME_PM_START = "16:30"; + public static final String VIOLATION_TIME_PM_END = "18:30"; + public static final String VIOLATION_TIME_HALF = ":30"; + public static final String VIOLATION_TIME_START = ":00"; + public static final Integer GPS_TIME_BUCKET = 5; + + } + + class RedisKey { + public static final String OVERSPEED_TASK_LOCK = "cm:task:overspeed:task_lock"; + + public static final String OVERSPEED_ALARM_DATA_INDEX = "cm:task:overspeed:alarm_data_index"; + public static final String OVERSPEED_GPS_DATA_INDEX = "cm:task:overspeed:gps_data_index"; + + public static final String DRIVER_STAR_MANAGE_OUT_DANGER = "cm:task:driver:star_manage_out_danger_index"; + + public static final String DRIVER_BLACK_LIST = "cm:task:driver:black_list_index"; + + public static final String COMPANY_VEHICLE_NOT_GET_ON = "cm:task:company:not_get_on_index"; + + public static final String DRIVER_STAR_MANAGE_ACCIDENT = "cm:task:driver:star_manage_accident_index"; + + public static final String DRIVER_STAR_MANAGE_DEATH_ACCIDENT = "cm:task:driver:star_manage_death_accident_index"; + + public static final String DRIVER_ABNORMAL_BEHAVIOR_ANALYSIS = "cm:task:driver:driver_abnormal_behavior_analysis_index"; + + public static final String VEHICLE_ALARM_DATA_INDEX = "cm:task:vehicle:alarm_data_index"; + + public static final String OPERATOR_ASSESSMENT_SCORE = "cm:task:operator:operator_assessment_score_index"; + public static final String ACCIDENT_QUERY_IRS = "cm:task:irs:accident_query_irs_index"; + public static final String VEHICLE_ILLEGAL_QUERY_IRS = "cm:task:irs:vehicle_illegal_query_irs_index"; + public static final String DRIVING_LICENCE_IRS = "cm:task:irs:driving_license_irs_index"; + public static final String VEHICLE_LICENSE_IRS = "cm:task:irs:vehicle_license_irs_index"; + public static final String IRS_VEHICLE_ILLEGAL_REQUEST_SECRET = "cm:task:irs:irs_vehicle_illegal_request_secret_index"; + public static final String IRS_VEHICLE_ILLEGAL_REFRESH_SECRET = "cm:task:irs:irs_vehicle_illegal_refresh_secret_index"; + public static final String IRS_VEHICLE_LICENSE_REQUEST_SECRET = "cm:task:irs:irs_vehicle_license_request_secret_index"; + public static final String IRS_VEHICLE_LICENSE_REFRESH_SECRET = "cm:task:irs:irs_vehicle_license_refresh_secret_index"; + public static final String IRS_ACCIDENT_QUERY_REQUEST_SECRET = "cm:task:irs:irs_accident_query_request_secret_index"; + public static final String IRS_ACCIDENT_QUERY_REFRESH_SECRET = "cm:task:irs:irs_accident_query_refresh_secret_index"; + public static final String IRS_ACCIDENT_DUTY_REQUEST_SECRET = "cm:task:irs:irs_accident_duty_request_secret_index"; + public static final String IRS_ACCIDENT_DUTY_REFRESH_SECRET = "cm:task:irs:irs_accident_duty_refresh_secret_index"; + + public static final String IRS_ACCIDENT_QUERY_REQUEST_SECRET_TEST = "cm:task:irs:irs_accident_query_request_secret_test_index"; + public static final String IRS_ACCIDENT_QUERY_REFRESH_SECRET_TEST = "cm:task:irs:irs_accident_query_refresh_secret_test_index"; + + public static final Integer IRS_SECRET_TIME_INTERVAL = 10; + + public static final String GPS_DATA_PULL_MAX_BIZ_ID = "cm:task:gps:gps_data_pull_max_biz_id"; + + // 黄山隧道东阳去向 + public static final String HS_DY_GO_REDIS_ALL_DATA_KEY = "yw:algorithm:redis:hs_dy_go_all_data_key"; + // 黄山隧道东阳来向 + public static final String HS_DY_COME_REDIS_ALL_DATA_KEY = "yw:algorithm:redis:hs_dy_come_all_data_key"; + // 黄山隧道义乌去向 + public static final String HS_YW_GO_REDIS_ALL_DATA_KEY = "yw:algorithm:redis:hs_yw_go_all_data_key"; + // 黄山隧道义乌来向 + public static final String HS_YW_COME_REDIS_ALL_DATA_KEY = "yw:algorithm:redis:hs_yw_come_all_data_key"; + // 何里隧道兰溪方向 + public static final String HL_LX_REDIS_ALL_DATA_KEY = "yw:algorithm:redis:hl_lx_all_data_key"; + // 何里隧道义乌方向 + public static final String HL_YW_REDIS_ALL_DATA_KEY = "yw:algorithm:redis:hl_yw_all_data_key"; + } + + class Math { + public static final BigDecimal LONGITUDE_UNITS = BigDecimal.valueOf(1000000); + + public static final BigDecimal SPEED_UNITS = BigDecimal.valueOf(0.036); + + public static final BigDecimal ALTITUDE_UNITS = BigDecimal.valueOf(100); + + public static final BigDecimal DIRECTION_UNITS = BigDecimal.valueOf(10); + } + + + class Msg { + public static final String REDIS_KEY_NOT_FOUND = "redis key {} not found 请查找原因!"; + public static final String REFRESH_KEY_FREQUENTLY = "请求过于频繁,请稍候再试"; + } + + class Code { + public static final String REFRESH_KEY_FREQUENTLY_CODE = "88"; + } + + class Star{ + public static final Double ONE_STAR = 1.0; + public static final Double TWO_STAR = 2.0; + public static final Double THREE_STAR = 3.0; + public static final Double FOUR_STAR = 4.0; + public static final Double FIVE_STAR = 5.0; + + + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/contants/VehicleTaskContant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/contants/VehicleTaskContant.java new file mode 100644 index 0000000..45071c8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/contants/VehicleTaskContant.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.scheduler.contants; + +/** + * @Classname VehicleTaskContant + * @Description + * @Date 2022/11/29 10:48 + * @Created by PoffyZhang + */ +public interface VehicleTaskContant { + /** + * GPS 状态的二进制 位数 0 是ACC点火状态 22是车辆是否行驶 + */ + + public static final Integer GPS_STATUS_ACC = 0; + public static final Integer GPS_STATUS_MOVING = 22; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/entity/GpsData.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/entity/GpsData.java new file mode 100644 index 0000000..7fa55af --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/entity/GpsData.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.scheduler.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * @author CMM + * @description + * @since 2022/12/07 15:19 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class GpsData { + @ApiModelProperty("高度") + private BigDecimal altitude; + + @ApiModelProperty("方向") + private BigDecimal direction; + + @ApiModelProperty("纬度") + private BigDecimal latitude; + + @ApiModelProperty("精度") + private BigDecimal longitude; + + @ApiModelProperty("速度") + private BigDecimal speed; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/entity/VehicleOnlineStatusDay.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/entity/VehicleOnlineStatusDay.java new file mode 100644 index 0000000..e20cc2f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/entity/VehicleOnlineStatusDay.java @@ -0,0 +1,74 @@ +package com.ningdatech.carapi.scheduler.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 统计车辆上线状态 按天 + *

+ * + * @author PoffyZhang + * @since 2022-12-18 + */ +@TableName("nd_vehicle_online_status_day") +@ApiModel(value = "VehicleOnlineStatusDay对象", description = "统计车辆上线状态 按天") +@Data +public class VehicleOnlineStatusDay 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; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("修改人") + private Long updateBy; + + @ApiModelProperty("0离线 1在线 2异常") + private Integer status; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("年") + private String year; + + @ApiModelProperty("月") + private String month; + + @ApiModelProperty("日") + private String day; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("0未删除1已删除") + private Boolean deleted; + + @ApiModelProperty("在线时间") + private LocalDateTime onlineTime; + + @ApiModelProperty("距离上次在线时间间隔") + private Integer onlineTimeInterval; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/entity/VehicleOnlineStatusHour.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/entity/VehicleOnlineStatusHour.java new file mode 100644 index 0000000..a310c62 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/entity/VehicleOnlineStatusHour.java @@ -0,0 +1,74 @@ +package com.ningdatech.carapi.scheduler.entity; + +import java.io.Serializable; +import java.time.LocalDateTime; + +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; + +/** + *

+ * 统计车辆上线状态 按小时 + *

+ * + * @author PoffyZhang + * @since 2022-11-29 + */ +@TableName("nd_vehicle_online_status_hour") +@ApiModel(value = "VehicleOnlineStatusHour对象", description = "统计车辆上线状态 按小时") +@Data +public class VehicleOnlineStatusHour 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; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("修改人") + private Long updateBy; + + @ApiModelProperty("0离线 1在线 2异常") + private Integer status; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("年") + private String year; + + @ApiModelProperty("月") + private String month; + + @ApiModelProperty("日") + private String day; + + @ApiModelProperty("小时") + private String hour; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("在线时间") + private LocalDateTime onlineTime; + + @ApiModelProperty("距离上次在线时间间隔") + private Integer onlineTimeInterval; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/enums/DataTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/enums/DataTypeEnum.java new file mode 100644 index 0000000..ac0bb77 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/enums/DataTypeEnum.java @@ -0,0 +1,15 @@ +package com.ningdatech.carapi.scheduler.enums; + +public enum DataTypeEnum { + /** + * 数据类型 + */ + EMPLOYEE, + VEHICLE, + COMPANY, + DRIVER_ACCIDENT, + DRIVER_DEAD_ACCIDENT, + DRIVER_OUT_DANGER, + + DRIVER_ACCIDENT_REPORT_REVIEW; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/enums/OperatorTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/enums/OperatorTypeEnum.java new file mode 100644 index 0000000..51f4c24 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/enums/OperatorTypeEnum.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.scheduler.enums; + +public enum OperatorTypeEnum { + /** + * 操作类型 + */ + ADD, + + UPDATE, + + DELETE, + + /** + * 车辆状态 + */ + ONLINE, + + OFFLINE, + + EXCEPTION; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/OverSpeedGpsDataMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/OverSpeedGpsDataMapper.java new file mode 100644 index 0000000..cb872bd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/OverSpeedGpsDataMapper.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.scheduler.mapper; + +import java.time.LocalDateTime; +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.ningdatech.carapi.scheduler.model.dto.GpsSpeedDataDTO; +import com.ningdatech.carapi.scheduler.model.dto.OverSpeedGpsDataDTO; + +/** + * @return + * @author CMM + * @since 2023/05/29 16:06 + */ +public interface OverSpeedGpsDataMapper { + + + /** + * 从每天的GPS数据表中获取车辆GPS速度数据 + * @param date + * @param startIndex + * @param endIndex + * @return + */ + List getOverSpeedDataInGps(@Param("date") String date , @Param("startIndex") Long startIndex, @Param("endIndex") Long endIndex); + + /** + * 获取超速报警时刻5分钟后的GPS数据 + * @param carPlate + * @param warnTime + * @param date + * @param timeBucket + * @return + */ + List getDataInGps(@Param("carPlate") String carPlate, @Param("warnTime") LocalDateTime warnTime, @Param("date") String date, @Param("timeBucket") Integer timeBucket); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/OverSpeedGpsDataMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/OverSpeedGpsDataMapper.xml new file mode 100644 index 0000000..cb6c6fb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/OverSpeedGpsDataMapper.xml @@ -0,0 +1,41 @@ + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleOnlineStatusDayMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleOnlineStatusDayMapper.java new file mode 100644 index 0000000..6fdc905 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleOnlineStatusDayMapper.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.scheduler.mapper; + +import java.util.List; +import java.util.Set; + +import org.apache.ibatis.annotations.Param; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.scheduler.entity.VehicleOnlineStatusDay; + +/** + *

+ * 统计车辆上线状态 按天 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-12-18 + */ +public interface VehicleOnlineStatusDayMapper extends BaseMapper { + Integer countTable(@Param("tableName") String tableName); + + VehicleOnlineStatusDay selectOneByTable(@Param("tableName") String tableName, @Param("statusDay") VehicleOnlineStatusDay statusDay); + + Integer createTable(@Param("tableName") String tableName); + + Boolean saveByReqInMonthTable(@Param("tableName") String tableName,@Param("statusDay") VehicleOnlineStatusDay statusDay); + + Boolean updateByReqInMonthTable(@Param("tableName") String tableName,@Param("statusDay") VehicleOnlineStatusDay statusDay); + + Set selectOnlineCarPlatesInMonthTable(@Param("tableName") String tableName, @Param("date") String date); + + List listByTable(@Param("tableName") String tableName, @Param("statusDay") VehicleOnlineStatusDay statusDay); + + Boolean batchSave(@Param("tableName") String tableName,@Param("statusDays") List statusDays); + + Boolean batchDelete(@Param("tableName") String tableName, @Param("recordIdList") List recordIdList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleOnlineStatusDayMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleOnlineStatusDayMapper.xml new file mode 100644 index 0000000..5711f85 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleOnlineStatusDayMapper.xml @@ -0,0 +1,100 @@ + + + + + DELETE FROM ${tableName} WHERE record_id IN + + #{recordId} + + + + + + + + + + + + CREATE TABLE ${tableName} ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` bigint(20) DEFAULT NULL COMMENT '创建人', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', + `update_by` bigint(20) DEFAULT NULL COMMENT '修改人', + `status` tinyint(2) DEFAULT NULL COMMENT '0离线 1在线 2异常', + `car_plate` varchar(32) DEFAULT NULL COMMENT '车牌号', + `year` varchar(16) DEFAULT NULL COMMENT '年', + `month` varchar(16) DEFAULT NULL COMMENT '月', + `day` varchar(16) DEFAULT NULL COMMENT '日', + `company_id` bigint(20) DEFAULT NULL COMMENT '公司ID', + `region_id` bigint(20) DEFAULT NULL COMMENT '区域ID', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0未删除1已删除', + `online_time` datetime DEFAULT NULL COMMENT '车辆在线时间', + `online_time_interval` int(11) DEFAULT NULL COMMENT '距离上次在线时间间隔', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `uk_car_plate_day` (`deleted`,`year`,`month`,`day`,`car_plate`) USING BTREE + ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='统计车辆上线状态 按天 月份表'; + + + + insert into ${tableName} + (status,car_plate,year, + month,day,company_id,region_id) + values + (#{statusDay.status},#{statusDay.carPlate},#{statusDay.year}, + #{statusDay.month},#{statusDay.day}, + #{statusDay.companyId},#{statusDay.regionId}) + + + + update ${tableName} + set status = #{statusDay.status} + where id = #{statusDay.id} + + + + INSERT INTO ${tableName} + (status,car_plate,year, + month,day,company_id,region_id,online_time,online_time_interval) + values + + (#{statusDay.status},#{statusDay.carPlate},#{statusDay.year}, + #{statusDay.month},#{statusDay.day}, + #{statusDay.companyId},#{statusDay.regionId}, + #{statusDay.onlineTime},#{statusDay.onlineTimeInterval}) + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleOnlineStatusHourMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleOnlineStatusHourMapper.java new file mode 100644 index 0000000..88bb372 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleOnlineStatusHourMapper.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.scheduler.mapper; + +import com.ningdatech.carapi.scheduler.entity.VehicleOnlineStatusHour; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 统计车辆上线状态 按小时 Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-29 + */ +public interface VehicleOnlineStatusHourMapper extends BaseMapper { + + Integer countTable(@Param("tableName") String tableName); + + VehicleOnlineStatusHour selectOneByTable(@Param("tableName") String tableName, @Param("statusHour") VehicleOnlineStatusHour statusHour); + + Integer createTable(@Param("tableName") String tableName); + + Boolean saveByReqInMonthTable(@Param("tableName") String tableName,@Param("statusHour") VehicleOnlineStatusHour statusHour); + + Boolean updateByReqInMonthTable(@Param("tableName") String tableName,@Param("statusHour") VehicleOnlineStatusHour statusHour); + + List listByTable(@Param("tableName") String tableName,@Param("statusHour") VehicleOnlineStatusHour statusHour); + + Boolean batchSave(@Param("tableName") String tableName, @Param("statusHours")List batchOnlineStatusHourToAdd); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleOnlineStatusHourMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleOnlineStatusHourMapper.xml new file mode 100644 index 0000000..21a4379 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleOnlineStatusHourMapper.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + CREATE TABLE ${tableName} ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` bigint(20) DEFAULT NULL COMMENT '创建人', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', + `update_by` bigint(20) DEFAULT NULL COMMENT '修改人', + `status` tinyint(2) DEFAULT NULL COMMENT '0离线 1在线 2异常', + `car_plate` varchar(32) DEFAULT NULL COMMENT '车牌号', + `year` varchar(16) DEFAULT NULL COMMENT '年', + `month` varchar(16) DEFAULT NULL COMMENT '月', + `day` varchar(16) DEFAULT NULL COMMENT '日', + `hour` varchar(16) DEFAULT NULL COMMENT '小时', + `company_id` bigint(20) DEFAULT NULL COMMENT '公司ID', + `region_id` bigint(20) DEFAULT NULL COMMENT '区域ID', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0未删除1已删除', + `online_time` datetime DEFAULT NULL COMMENT '车辆在线时间', + `online_time_interval` int(11) DEFAULT NULL COMMENT '距离上次在线时间间隔', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `uk_car_plate_hour` (`deleted`,`year`,`month`,`day`,`hour`,`car_plate`) USING BTREE + ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='统计车辆上线状态 按小时 月份表'; + + + + insert into ${tableName} + (status,car_plate,year, + month,day,hour,company_id,region_id) + values + (#{statusHour.status},#{statusHour.carPlate},#{statusHour.year}, + #{statusHour.month},#{statusHour.day},#{statusHour.hour}, + #{statusHour.companyId},#{statusHour.regionId}) + + + + update ${tableName} + set status = #{statusHour.status} + where id = #{statusHour.id} + + + + INSERT INTO ${tableName} + (status,car_plate,year, + month,day,hour,company_id,region_id,online_time,online_time_interval) + values + + (#{statusHour.status},#{statusHour.carPlate},#{statusHour.year}, + #{statusHour.month},#{statusHour.day},#{statusHour.hour}, + #{statusHour.companyId},#{statusHour.regionId}, + #{statusHour.onlineTime},#{statusHour.onlineTimeInterval}) + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleStatusMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleStatusMapper.java new file mode 100644 index 0000000..1745cc4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleStatusMapper.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.scheduler.mapper; + +import com.ningdatech.carapi.scheduler.model.dto.VehicleStatusDTO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Classname VehicleStatusMapper + * @Description + * @Date 2022/11/22 14:15 + * @Created by PoffyZhang + */ +public interface VehicleStatusMapper { + + List getVehicleStatusInGps(@Param("date") String date , @Param("timeScope") int timeScope); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleStatusMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleStatusMapper.xml new file mode 100644 index 0000000..1f44d4a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/mapper/VehicleStatusMapper.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/model/dto/AccidentQueryDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/model/dto/AccidentQueryDTO.java new file mode 100644 index 0000000..4aed18e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/model/dto/AccidentQueryDTO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.scheduler.model.dto; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 事故查询入参实体 + * + * @author CMM + * @since 2023/04/28 10:09 + */ +@Data +public class AccidentQueryDTO { + + @ApiModelProperty("事故编号") + private String sgbh; + + @ApiModelProperty("登记编号") + private String djbh; + + @ApiModelProperty("车牌号") + private String carNo; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/model/dto/GpsSpeedDataDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/model/dto/GpsSpeedDataDTO.java new file mode 100644 index 0000000..71b62ef --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/model/dto/GpsSpeedDataDTO.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.scheduler.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @return + * @author CMM + * @since 2023/05/29 15:54 + */ +@Data +public class GpsSpeedDataDTO { + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("速度") + private Integer speed; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/model/dto/OverSpeedGpsDataDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/model/dto/OverSpeedGpsDataDTO.java new file mode 100644 index 0000000..79cfb82 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/model/dto/OverSpeedGpsDataDTO.java @@ -0,0 +1,49 @@ +package com.ningdatech.carapi.scheduler.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @return + * @author CMM + * @since 2023/05/29 15:54 + */ +@Data +public class OverSpeedGpsDataDTO { + + @ApiModelProperty("GPS数据ID") + private Long id; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("经度") + private BigDecimal longitude; + + @ApiModelProperty("纬度") + private BigDecimal latitude; + + @ApiModelProperty("速度") + private BigDecimal speed; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("公司名称") + private String companyName; + + @ApiModelProperty("超速时间") + private LocalDateTime overSpeedTime; + + @ApiModelProperty("运营商ID") + private String operatorId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/model/dto/VehicleStatusDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/model/dto/VehicleStatusDTO.java new file mode 100644 index 0000000..ed59b56 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/model/dto/VehicleStatusDTO.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.scheduler.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @Classname VehicleStatusDTO + * @Description + * @Date 2022/11/22 14:09 + * @Created by PoffyZhang + */ +@Data +public class VehicleStatusDTO { + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("GPS的状态值") + private Long status; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("创建时间") + private LocalDateTime updateTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/IVehicleOnlineStatusDayService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/IVehicleOnlineStatusDayService.java new file mode 100644 index 0000000..a4eec36 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/IVehicleOnlineStatusDayService.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.scheduler.service; + +import java.util.List; +import java.util.Set; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.scheduler.entity.VehicleOnlineStatusDay; +import com.ningdatech.carapi.scheduler.entity.VehicleOnlineStatusHour; + +/** + *

+ * 统计车辆上线状态 按天 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-12-18 + */ +public interface IVehicleOnlineStatusDayService extends IService { + + VehicleOnlineStatusDay getOneByReqInMonthTable(VehicleOnlineStatusDay statusDay); + + Boolean saveByReqInMonthTable(VehicleOnlineStatusDay statusDay); + + Boolean updateByReqInMonthTable(VehicleOnlineStatusDay statusDay); + + Set getOnlineCarPlatesInMonthTables(); + + List listByReqInMonthTable(VehicleOnlineStatusDay statusDay); + + Boolean batchSave(List batchOnlineStatusDayToAdd); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/IVehicleOnlineStatusHourService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/IVehicleOnlineStatusHourService.java new file mode 100644 index 0000000..a574eac --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/IVehicleOnlineStatusHourService.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.scheduler.service; + +import com.ningdatech.carapi.scheduler.entity.VehicleOnlineStatusHour; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 统计车辆上线状态 按小时 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-29 + */ +public interface IVehicleOnlineStatusHourService extends IService { + + VehicleOnlineStatusHour getOneByReqInMonthTable(VehicleOnlineStatusHour statusHour); + + List listByReqInMonthTable(VehicleOnlineStatusHour statusHour); + + Boolean saveByReqInMonthTable(VehicleOnlineStatusHour statusHour); + + Boolean updateByReqInMonthTable(VehicleOnlineStatusHour oldValue); + + Boolean batchSave(List batchOnlineStatusHourToAdd); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/OverSpeedGpsDataService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/OverSpeedGpsDataService.java new file mode 100644 index 0000000..bdb2d59 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/OverSpeedGpsDataService.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.scheduler.service; + +import java.time.LocalDateTime; +import java.util.List; + +import com.ningdatech.carapi.scheduler.model.dto.GpsSpeedDataDTO; +import com.ningdatech.carapi.scheduler.model.dto.OverSpeedGpsDataDTO; + +/** + * @return + * @author CMM + * @since 2023/05/29 15:52 + */ +public interface OverSpeedGpsDataService { + + /** + * 获取GPS数据中的车辆速度信息 + * @param date + * @param startIndex + * @param endIndex + * @return + */ + List getDataInGps(String date, Long startIndex, Long endIndex); + + + /** + * 获取超速报警时刻5分钟后的GPS数据 + * @param carPlate + * @param timeBucket + * @param warnTime + * @return 返回数据列表 + * @author CMM + * @since 2023/06/01 14:59 + */ + List getDataInGps(String carPlate, LocalDateTime warnTime, Integer timeBucket); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/VehicleStatusService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/VehicleStatusService.java new file mode 100644 index 0000000..b25f2f6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/VehicleStatusService.java @@ -0,0 +1,10 @@ +package com.ningdatech.carapi.scheduler.service; + +import com.ningdatech.carapi.scheduler.model.dto.VehicleStatusDTO; + +import java.util.List; + +public interface VehicleStatusService { + + List getVehicleStatusInGps(); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/impl/OverSpeedGpsDataServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/impl/OverSpeedGpsDataServiceImpl.java new file mode 100644 index 0000000..b02908c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/impl/OverSpeedGpsDataServiceImpl.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.scheduler.service.impl; + +import java.time.LocalDateTime; +import java.util.List; + +import org.springframework.stereotype.Service; + +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.scheduler.mapper.OverSpeedGpsDataMapper; +import com.ningdatech.carapi.scheduler.model.dto.GpsSpeedDataDTO; +import com.ningdatech.carapi.scheduler.model.dto.OverSpeedGpsDataDTO; +import com.ningdatech.carapi.scheduler.service.OverSpeedGpsDataService; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @return + * @author CMM + * @since 2023/05/29 16:04 + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class OverSpeedGpsDataServiceImpl implements OverSpeedGpsDataService { + + private final OverSpeedGpsDataMapper overSpeedGpsDataMapper; + + @Override + public List getDataInGps(String date, Long startIndex, Long endIndex) { + return overSpeedGpsDataMapper.getOverSpeedDataInGps(date, startIndex, endIndex); + } + + @Override + public List getDataInGps(String carPlate, LocalDateTime warnTime, Integer timeBucket) { + return overSpeedGpsDataMapper.getDataInGps(carPlate,warnTime, NdDateUtils.format(LocalDateTime.now(),"yyyy_MM_dd"),timeBucket); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/impl/VehicleOnlineStatusDayServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/impl/VehicleOnlineStatusDayServiceImpl.java new file mode 100644 index 0000000..5e341b4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/impl/VehicleOnlineStatusDayServiceImpl.java @@ -0,0 +1,84 @@ +package com.ningdatech.carapi.scheduler.service.impl; + +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.carapi.scheduler.entity.VehicleOnlineStatusDay; +import com.ningdatech.carapi.scheduler.entity.VehicleOnlineStatusHour; +import com.ningdatech.carapi.scheduler.mapper.VehicleOnlineStatusDayMapper; +import com.ningdatech.carapi.scheduler.service.IVehicleOnlineStatusDayService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.Date; +import java.util.List; +import java.util.Set; + +/** + *

+ * 统计车辆上线状态 按天 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-12-18 + */ +@Service +@AllArgsConstructor +@Slf4j +public class VehicleOnlineStatusDayServiceImpl extends ServiceImpl implements IVehicleOnlineStatusDayService { + + private final VehicleOnlineStatusDayMapper mapper; + + @Override + public VehicleOnlineStatusDay getOneByReqInMonthTable(VehicleOnlineStatusDay statusDay) { + String tableName = "nd_vehicle_online_status_day_" + NdDateUtils.format(new Date(),"yyyy_MM"); + if(mapper.countTable(tableName) == 0){ + mapper.createTable(tableName); + } + return mapper.selectOneByTable(tableName,statusDay); + } + + @Override + public Boolean saveByReqInMonthTable(VehicleOnlineStatusDay statusDay) { + String tableName = "nd_vehicle_online_status_day_" + NdDateUtils.format(new Date(),"yyyy_MM"); + if(mapper.countTable(tableName) == 0){ + mapper.createTable(tableName); + } + return mapper.saveByReqInMonthTable(tableName,statusDay); + } + + @Override + public Boolean updateByReqInMonthTable(VehicleOnlineStatusDay statusDay) { + String tableName = "nd_vehicle_online_status_day_" + NdDateUtils.format(new Date(),"yyyy_MM"); + if(mapper.countTable(tableName) == 0){ + mapper.createTable(tableName); + } + return mapper.updateByReqInMonthTable(tableName,statusDay); + } + + @Override + public Set getOnlineCarPlatesInMonthTables() { + String tableName = "nd_vehicle_online_status_day_" + NdDateUtils.format(new Date(),"yyyy_MM"); + String date = NdDateUtils.format(LocalDateTime.now(),NdDateUtils.DEFAULT_DATE_TIME_START_FORMAT); + return mapper.selectOnlineCarPlatesInMonthTable(tableName,date); + } + + @Override + public List listByReqInMonthTable(VehicleOnlineStatusDay statusDay) { + String tableName = "nd_vehicle_online_status_day_" + NdDateUtils.format(new Date(),"yyyy_MM"); + if(mapper.countTable(tableName) == 0){ + mapper.createTable(tableName); + } + return mapper.listByTable(tableName,statusDay); + } + + @Override + public Boolean batchSave(List statusDays) { + String tableName = "nd_vehicle_online_status_day_" + NdDateUtils.format(new Date(),"yyyy_MM"); + if(mapper.countTable(tableName) == 0){ + mapper.createTable(tableName); + } + return mapper.batchSave(tableName,statusDays); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/impl/VehicleOnlineStatusHourServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/impl/VehicleOnlineStatusHourServiceImpl.java new file mode 100644 index 0000000..1063c13 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/impl/VehicleOnlineStatusHourServiceImpl.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.scheduler.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.scheduler.entity.VehicleOnlineStatusHour; +import com.ningdatech.carapi.scheduler.mapper.VehicleOnlineStatusHourMapper; +import com.ningdatech.carapi.scheduler.service.IVehicleOnlineStatusHourService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.Date; +import java.util.List; + +/** + *

+ * 统计车辆上线状态 按小时 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-29 + */ +@Service +@Slf4j +@AllArgsConstructor +public class VehicleOnlineStatusHourServiceImpl extends ServiceImpl implements IVehicleOnlineStatusHourService { + + private final VehicleOnlineStatusHourMapper mapper; + + @Override + public VehicleOnlineStatusHour getOneByReqInMonthTable(VehicleOnlineStatusHour statusHour) { + String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + if(mapper.countTable(tableName) == 0){ + mapper.createTable(tableName); + } + return mapper.selectOneByTable(tableName,statusHour); + } + + @Override + public List listByReqInMonthTable(VehicleOnlineStatusHour statusHour) { + String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + if(mapper.countTable(tableName) == 0){ + mapper.createTable(tableName); + } + return mapper.listByTable(tableName,statusHour); + } + + @Override + public Boolean saveByReqInMonthTable(VehicleOnlineStatusHour statusHour) { + String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + if(mapper.countTable(tableName) == 0){ + mapper.createTable(tableName); + } + return mapper.saveByReqInMonthTable(tableName,statusHour); + } + + @Override + public Boolean updateByReqInMonthTable(VehicleOnlineStatusHour oldValue) { + String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + if(mapper.countTable(tableName) == 0){ + mapper.createTable(tableName); + } + return mapper.updateByReqInMonthTable(tableName,oldValue); + } + + @Override + public Boolean batchSave(List batchOnlineStatusHourToAdd) { + String tableName = "nd_vehicle_online_status_hour_" + NdDateUtils.format(new Date(),"yyyy_MM"); + if(mapper.countTable(tableName) == 0){ + mapper.createTable(tableName); + } + return mapper.batchSave(tableName,batchOnlineStatusHourToAdd); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/impl/VehicleStatusServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/impl/VehicleStatusServiceImpl.java new file mode 100644 index 0000000..738bdb6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/service/impl/VehicleStatusServiceImpl.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.scheduler.service.impl; + +import cn.hutool.core.date.DatePattern; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.scheduler.model.dto.VehicleStatusDTO; +import com.ningdatech.carapi.scheduler.service.VehicleStatusService; +import com.ningdatech.carapi.scheduler.mapper.VehicleStatusMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @Classname VehicleStatusServiceImpl + * @Description + * @Date 2022/11/22 13:46 + * @Created by PoffyZhang + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class VehicleStatusServiceImpl implements VehicleStatusService { + + private final VehicleStatusMapper vehicleStatusMapper; + + @Override + public List getVehicleStatusInGps(){ + //设置 10分内 的GPS + int timeScope = 10; + return vehicleStatusMapper.getVehicleStatusInGps(NdDateUtils.format(LocalDateTime.now(),"yyyy_MM_dd"),timeScope); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/task/GpsDataPullTask.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/task/GpsDataPullTask.java new file mode 100644 index 0000000..f5c9732 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/task/GpsDataPullTask.java @@ -0,0 +1,11 @@ +package com.ningdatech.carapi.scheduler.task; + +/** + * @description: GPS数据拉取任务 + * @author CMM + * @since 2024/10/08 10:55 + */ + +public class GpsDataPullTask { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/util/DriverScoreUtils.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/util/DriverScoreUtils.java new file mode 100644 index 0000000..8d56e98 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/util/DriverScoreUtils.java @@ -0,0 +1,134 @@ +package com.ningdatech.carapi.scheduler.util; + +import java.lang.reflect.Field; +import java.time.LocalDateTime; +import java.util.Objects; + +import javax.annotation.PostConstruct; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.carapi.archives.enums.DriverRelationConstant; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.driver.constant.ScoreOperateType; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.entity.DriverScoreInfo; +import com.ningdatech.carapi.driver.entity.DriverScoreRecord; +import com.ningdatech.carapi.driver.entity.StarManage; +import com.ningdatech.carapi.driver.helper.DriverBehaviorScoreHelper; +import com.ningdatech.carapi.driver.model.bo.CodingRuleBO; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.driver.service.IDriverScoreInfoService; +import com.ningdatech.carapi.driver.service.IDriverScoreRecordService; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; +import com.ningdatech.carapi.sys.entity.enumeration.CodingRuleBehaviorTypeEnum; + +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2022/12/17 17:49 + */ +@Component +@Slf4j +public class DriverScoreUtils { + + @Autowired + private DriverBehaviorScoreHelper driverBehaviorScoreHelper; + @Autowired + private IDriverScoreInfoService iDriverScoreInfoService; + @Autowired + private IDriverScoreRecordService iDriverScoreRecordService; + + @Autowired + private IDriverInfoService driverInfoService; + + private static DriverScoreUtils driverScoreUtils; + + @PostConstruct + public void init(){ + driverScoreUtils = this; + driverScoreUtils.driverBehaviorScoreHelper = this.driverBehaviorScoreHelper; + driverScoreUtils.iDriverScoreInfoService = this.iDriverScoreInfoService; + driverScoreUtils.iDriverScoreRecordService = this.iDriverScoreRecordService; + driverScoreUtils.driverInfoService = this.driverInfoService; + } + + public static void updateDriverScoreAndRecord(T entity, CodingRuleBehaviorTypeEnum codingRuleBehaviorTypeEnum, VehicleTypeEnum vehicleTypeEnum){ + Class aClass = entity.getClass(); + Long driverId = null; + try { + Field driverIdField = aClass.getDeclaredField("driverId"); + driverIdField.setAccessible(Boolean.TRUE); + driverId = Objects.nonNull(driverIdField.get(entity)) ? (Long)driverIdField.get(entity) : null; + } catch (Exception e) { + log.error("成员变量不存在!"); + } + + CodingRuleBO codingRuleBehaviorScore = driverScoreUtils.driverBehaviorScoreHelper + .getCodingRuleBehaviorScore(codingRuleBehaviorTypeEnum,vehicleTypeEnum); + //获取对应行为类型的操作分 + Integer operationScore = codingRuleBehaviorScore.getOperationScore(); + //根据驾驶员ID获取驾驶员分数 + DriverScoreInfo driverScoreInfo = driverScoreUtils.iDriverScoreInfoService.getOne(Wrappers.lambdaQuery(DriverScoreInfo.class) + .eq(DriverScoreInfo::getDriverId,driverId).last(DefValConstants.LIMIT_1)); + DriverInfo driverInfo = driverScoreUtils.driverInfoService.getById(driverId); + if (Objects.isNull(driverInfo)){ + log.info("当前更新分数驾驶员信息不存在!"); + return; + } + if (Objects.isNull(driverScoreInfo)) { + driverScoreInfo = new DriverScoreInfo(); + driverScoreInfo.setDriverId(driverInfo.getId()); + driverScoreInfo.setUserId(driverInfo.getUserId()); + driverScoreInfo.setCreateOn(LocalDateTime.now()); + driverScoreInfo.setDriverScore(DriverRelationConstant.DRIVER_FULL_SCORE - operationScore); + } else { + Integer driverScore = driverScoreInfo.getDriverScore() - operationScore; + if (driverScore < 0){ + driverScore = 0; + } + driverScoreInfo.setDriverScore(driverScore); + } + driverScoreInfo.setUpdateOn(LocalDateTime.now()); + driverScoreUtils.iDriverScoreInfoService.saveOrUpdate(driverScoreInfo); + + DriverScoreRecord saveRecord = new DriverScoreRecord(); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setDriverId(driverInfo.getId()); + saveRecord.setOperateReason("驾驶员异常行为扣分"); + saveRecord.setOperateScore(DriverRelationConstant.DRIVER_FULL_SCORE); + saveRecord.setOperateType(ScoreOperateType.reduce.name()); + saveRecord.setUserId(driverInfo.getUserId()); + driverScoreUtils.iDriverScoreRecordService.save(saveRecord); + } + + public static void getCurrentStar(StarManage starManage) { + DriverScoreInfo scoreInfo = driverScoreUtils.iDriverScoreInfoService.getOne(Wrappers.lambdaQuery(DriverScoreInfo.class) + .eq(DriverScoreInfo::getDriverId, starManage.getDriverId())); + if (Objects.isNull(scoreInfo)){ + return; + } + Integer driverScore = scoreInfo.getDriverScore(); + if (driverScore >= TaskConstant.Data.STAR_NUMBER_RANGE_ZERO && driverScore < TaskConstant.Data.STAR_NUMBER_RANGE_TWENTY){ + starManage.setCurrentScore(driverScore); + starManage.setCurrentStar(TaskConstant.Star.ONE_STAR); + } else if (driverScore >= TaskConstant.Data.STAR_NUMBER_RANGE_TWENTY && driverScore < TaskConstant.Data.STAR_NUMBER_RANGE_FORTY) { + starManage.setCurrentScore(driverScore); + starManage.setCurrentStar(TaskConstant.Star.TWO_STAR); + }else if (driverScore >= TaskConstant.Data.STAR_NUMBER_RANGE_FORTY && driverScore < TaskConstant.Data.STAR_NUMBER_RANGE_SIXTY){ + starManage.setCurrentScore(driverScore); + starManage.setCurrentStar(TaskConstant.Star.THREE_STAR); + }else if (driverScore >= TaskConstant.Data.STAR_NUMBER_RANGE_SIXTY && driverScore < TaskConstant.Data.STAR_NUMBER_RANGE_EIGHTY){ + starManage.setCurrentScore(driverScore); + starManage.setCurrentStar(TaskConstant.Star.FOUR_STAR); + }else if (driverScore >= TaskConstant.Data.STAR_NUMBER_RANGE_EIGHTY){ + starManage.setCurrentScore(driverScore); + starManage.setCurrentStar(TaskConstant.Star.FIVE_STAR); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/util/GpsUtils.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/util/GpsUtils.java new file mode 100644 index 0000000..c1d582a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/util/GpsUtils.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.scheduler.util; + +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.carapi.common.constant.GPSDataEnum; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; +import com.ningdatech.carapi.scheduler.entity.GpsData; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Optional; + +/** + * @author CMM + * @description + * @since 2022/12/07 15:23 + */ +public class GpsUtils { + + private GpsUtils() { + } + + public static GpsData getGpsData(JSONObject gpsJson) { + GpsData gpsData = new GpsData(); + BigDecimal altitudeTemp = gpsJson.getBigDecimal(GPSDataEnum.ALTITUDE.getDesc()); + Optional altitudeBigDecimal = Optional.ofNullable(altitudeTemp).map(a -> a.divide(TaskConstant.Math.ALTITUDE_UNITS, RoundingMode.HALF_UP)); + if (altitudeBigDecimal.isPresent()) { + BigDecimal altitude = altitudeBigDecimal.get().setScale(2, RoundingMode.HALF_UP); + gpsData.setAltitude(altitude); + } + + BigDecimal longitudeTemp = gpsJson.getBigDecimal(GPSDataEnum.LONGITUDE.getDesc()); + Optional longitudeOptional = Optional.ofNullable(longitudeTemp).map(l -> l.divide(TaskConstant.Math.LONGITUDE_UNITS, RoundingMode.HALF_UP)); + if (longitudeOptional.isPresent()) { + BigDecimal longitude = longitudeOptional.get().setScale(6, RoundingMode.HALF_UP); + gpsData.setLongitude(longitude); + } + BigDecimal latitudeTemp = gpsJson.getBigDecimal(GPSDataEnum.LATITUDE.getDesc()); + Optional latitudeOptional = Optional.ofNullable(latitudeTemp).map(l -> l.divide(TaskConstant.Math.LONGITUDE_UNITS, RoundingMode.HALF_UP)); + if (latitudeOptional.isPresent()) { + BigDecimal latitude = latitudeOptional.get().setScale(6, RoundingMode.HALF_UP); + gpsData.setLatitude(latitude); + } + BigDecimal speedTemp = gpsJson.getBigDecimal(GPSDataEnum.SPEED.getDesc()); + Optional speedOptional = Optional.ofNullable(speedTemp).map(s -> s.multiply(TaskConstant.Math.SPEED_UNITS)); + if (speedOptional.isPresent()) { + BigDecimal speed = speedOptional.get().setScale(2, RoundingMode.HALF_UP); + gpsData.setSpeed(speed); + } + + BigDecimal directionTemp = gpsJson.getBigDecimal(GPSDataEnum.DIRECTION.getDesc()); + Optional directionOptional = Optional.ofNullable(directionTemp).map(s -> s.divide(TaskConstant.Math.DIRECTION_UNITS, RoundingMode.HALF_UP)); + if (directionOptional.isPresent()) { + BigDecimal direction = directionOptional.get().setScale(2, RoundingMode.HALF_UP); + gpsData.setDirection(direction); + } + return gpsData; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/util/SplitListUtils.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/util/SplitListUtils.java new file mode 100644 index 0000000..3a633b7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/scheduler/util/SplitListUtils.java @@ -0,0 +1,74 @@ +package com.ningdatech.carapi.scheduler.util; + +import com.google.common.collect.Lists; +import org.apache.commons.collections.CollectionUtils; + +import java.util.List; + +/** + * 拆分结合工具类 + * + * @author shiwen + */ +public class SplitListUtils { + + /** + * 拆分集合 + * + * @param 泛型对象 + * @param resList 需要拆分的集合 + * @param subListLength 每个子集合的元素个数 + * @return 返回拆分后的各个集合组成的列表 + * 代码里面用到了guava和common的结合工具类 + **/ + public static List> split(List resList, int subListLength) { + if (CollectionUtils.isEmpty(resList) || subListLength <= 0) { + return Lists.newArrayList(); + } + List> ret = Lists.newArrayList(); + + int size = resList.size(); + if (size <= subListLength) { + // 数据量不足 subListLength 指定的大小 + ret.add(resList); + } else { + int pre = size / subListLength; + int last = size % subListLength; + // 前面pre个集合,每个大小都是 subListLength 个元素 + for (int i = 0; i < pre; i++) { + List itemList = Lists.newArrayList(); + for (int j = 0; j < subListLength; j++) { + itemList.add(resList.get(i * subListLength + j)); + } + ret.add(itemList); + } + + // last的进行处理 + if (last > 0) { + List itemList = Lists.newArrayList(); + for (int i = 0; i < last; i++) { + itemList.add(resList.get(pre * subListLength + i)); + } + ret.add(itemList); + } + } + return ret; + } + + // 运行代码 + public static void main(String[] args) { + List list = Lists.newArrayList(); + int size = 1099; + for (int i = 0; i < size; i++) { + list.add("hello-" + i); + } + // 大集合里面包含多个小集合 + List> temps = split(list, 100); + int j = 0; + // 对大集合里面的每一个小集合进行操作 + for (List obj : temps) { + System.out.println(String.format("row:%s -> size:%s,data:%s", ++j, obj.size(), obj)); + } + } + +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/contants/RegionContant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/contants/RegionContant.java new file mode 100644 index 0000000..82deee3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/contants/RegionContant.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.sys.contants; + +/** + * @Classname RegionContant + * @Description + * @Date 2022/11/24 9:37 + * @Created by PoffyZhang + */ +public interface RegionContant { + + public static final Integer FIRST_LEVEL = 1; + + public static final Integer SECOND_LEVEL = 2; + + public static final Integer THIRD_LEVEL = 3; + + public static final Long EMPTY_PARENT_ID = 0L; + + public static final Long ZJ_REGION_ID = 77L; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/contants/UserLoginConstant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/contants/UserLoginConstant.java new file mode 100644 index 0000000..0279b19 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/contants/UserLoginConstant.java @@ -0,0 +1,15 @@ +package com.ningdatech.carapi.sys.contants; + +/** + * @author CMM + * @since 2023/01/06 10:18 + */ + +public interface UserLoginConstant { + class RedisKey { + public static final String USER_LOGIN = "cm:user:user_login_index"; + } + + String VERIFICATION_CODE = "123456"; + String LOGIN_PASSWORD = "123456Aa"; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/CodingRuleController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/CodingRuleController.java new file mode 100644 index 0000000..57c4bc2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/CodingRuleController.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.sys.controller; + + +import com.ningdatech.carapi.sys.entity.req.ReqCodingRulePO; +import com.ningdatech.carapi.sys.entity.vo.ResCodingRuleVO; +import com.ningdatech.carapi.sys.manage.CodingRuleManage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + *

+ * 前端控制器 + *

+ * + * @author Liuxinxin + * @since 2022-10-20 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/coding-rule") +@Api(tags = "赋码规则") +@RequiredArgsConstructor +public class CodingRuleController { + + private final CodingRuleManage codingRuleManage; + + @ApiOperation(value = "获取赋码规则") + @PostMapping("/get") + public ResCodingRuleVO getCodingRule() { + return codingRuleManage.getCodingRule(); + } + + @ApiOperation(value = "保存赋码规则") + @PostMapping("/save") + public void saveCodingRule(@Valid @RequestBody ReqCodingRulePO request) { + codingRuleManage.saveCodingRule(request); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/CompanyController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/CompanyController.java new file mode 100644 index 0000000..f657255 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/CompanyController.java @@ -0,0 +1,123 @@ +package com.ningdatech.carapi.sys.controller; + +import java.util.List; +import java.util.Map; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.dto.*; +import com.ningdatech.carapi.sys.entity.vo.CompanyVO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.manage.CompanyManage; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import com.ningdatech.log.annotation.WebLog; + +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * 前端控制器 + * 企业管理 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/company") +@Api(value = "Company", tags = "系统管理-企业") +@RequiredArgsConstructor +public class CompanyController { + + private final CompanyManage companyManage; + private final CompanyService companyService; + private final CompaniesCacheHelper companiesCacheHelper; + + @GetMapping("/testCache") + public CompanyDTO testCache(@Valid @RequestParam Long id) { + return companiesCacheHelper.getById(id); + } + + @GetMapping("/asMap") + public Map testCache() { + return companiesCacheHelper.asMap(); + } + + @GetMapping("/refresh") + public String refresh() { + companiesCacheHelper.afterPropertiesSet(); + return "success"; + } + + @ApiOperation(value = "根据地区ID集合 查询企业ID集合", notes = "根据地区ID集合 查询企业ID集合") + @PostMapping("/getIdsByRegionIds") + public List getIdsByRegionIds(@Valid @RequestBody List regionIds) { + return companyManage.getIdsByRegionIds(regionIds); + } + + @ApiOperation(value = "企业类型级联", notes = "企业类型级联") + @GetMapping("/types") + public List queryTypes() { + return companyManage.queryCompanyTypes(); + } + + @ApiOperation(value = "企业列表查询", notes = "企业列表查询") + @GetMapping("/list") + public PageVo queryList(@Valid @ModelAttribute CompanyPageQuery companyPageQuery) { + return companyManage.queryList(companyPageQuery); + } + + @ApiOperation(value = "使用企业列表查询", notes = "使用企业列表查询") + @GetMapping("/useCompanyList") + public PageVo queryUseCompanyList(@Valid @ModelAttribute CompanyPageQuery companyPageQuery) { + return companyManage.queryUseCompanyList(companyPageQuery); + } + + /** + * 查询企业详情 + * + * @param id 主键id + * @return 查询结果 + */ + @ApiOperation(value = "查询企业详情", notes = "查询企业详情") + @GetMapping("/details") + public CompanyQueryDTO getDetails(@Valid @RequestParam Long id) { + return companyManage.getDetails(id); + } + + @ApiOperation(value = "保存新企业", notes = "保存新企业") + @PostMapping("/save") + @WebLog(value = "新增企业", modular = "系统管理-企业管理") + public CompanyVO handlerSave(@Valid @RequestBody CompanySaveDTO data) { + Company company = companyManage.save(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(company, CompanyVO.class); + } + + @ApiOperation(value = "编辑企业", notes = "编辑企业") + @PostMapping("/modify") + @WebLog(value = "编辑企业", modular = "系统管理-企业管理") + public CompanyVO handlerUpdate(@Valid @RequestBody CompanyUpdateDTO data) { + Company company = companyManage.update(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(company, CompanyVO.class); + } + + @ApiOperation(value = "删除企业", notes = "删除企业") + @PostMapping("/remove") + @WebLog(value = "删除企业", modular = "系统管理-企业管理") + public Boolean handlerDelete(@Valid @RequestBody List ids) { + return companyManage.removeByIdWithCache(ids); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/ImportTemplateDownController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/ImportTemplateDownController.java new file mode 100644 index 0000000..dd0ada0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/ImportTemplateDownController.java @@ -0,0 +1,66 @@ +package com.ningdatech.carapi.sys.controller; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.poi.excel.ExcelUtil; +import cn.hutool.poi.excel.ExcelWriter; +import com.ningdatech.basic.util.SpringUtils; +import com.ningdatech.carapi.sys.entity.constant.ImportTemplateConstant; +import com.ningdatech.carapi.sys.entity.enumeration.ImportTemplateEnum; +import com.ningdatech.carapi.sys.event.ImportDataEvent; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.poi.ss.usermodel.BorderStyle; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.FillPatternType; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.List; + +/** + *

+ * ImportTemplateDownController + *

+ * + * @author WendyYang + * @since 16:50 2022/10/15 + */ +@RestController +@Api(tags = "导入模版下载") +@RequestMapping("/api/v1/importTemplate") +public class ImportTemplateDownController { + + @GetMapping("/down/{template}") + @ApiOperation("导入模板下载") + public void down(@PathVariable ImportTemplateEnum template, HttpServletResponse response) throws IOException { + ExcelWriter writer = ExcelUtil.getWriter(); + List colList = ImportTemplateConstant.getTemplateTitle(template); + writer.writeHeadRow(colList); + writer.getStyleSet().setBorder(BorderStyle.NONE, IndexedColors.AUTOMATIC); + CellStyle cellStyle = writer.getHeadCellStyle(); + cellStyle.setFillForegroundColor(IndexedColors.LIGHT_GREEN.getIndex()); + cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); + response.setContentType("application/vnd.ms-excel;charset=utf-8"); + String fileName = URLEncoder.encode(template.getValue() + "模板", CharsetUtil.UTF_8); + response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName + ".xls"); + ServletOutputStream out = response.getOutputStream(); + writer.flush(out, true); + writer.close(); + IoUtil.close(out); + } + + @PostMapping("/import") + @ApiOperation("通用导入数据") + public void importData(@RequestParam ImportTemplateEnum template, MultipartFile file) throws IOException { + ImportDataEvent event = new ImportDataEvent(file); + event.setTemplate(template); + SpringUtils.publishEvent(event); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/MenuController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/MenuController.java new file mode 100644 index 0000000..4ef6743 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/MenuController.java @@ -0,0 +1,116 @@ +package com.ningdatech.carapi.sys.controller; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.carapi.sys.entity.Menu; +import com.ningdatech.carapi.sys.entity.RoleMenu; +import com.ningdatech.carapi.sys.entity.dto.MenuQueryDTO; +import com.ningdatech.carapi.sys.entity.dto.MenuSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.MenuUpdateDTO; +import com.ningdatech.carapi.sys.entity.vo.MenuRoleVO; +import com.ningdatech.carapi.sys.entity.vo.MenuVO; +import com.ningdatech.carapi.sys.manage.MenuManage; +import com.ningdatech.carapi.sys.service.IRoleMenuService; +import com.ningdatech.carapi.sys.service.MenuService; +import com.ningdatech.carapi.sys.utils.TreeUtil; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import com.ningdatech.log.annotation.WebLog; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + *

+ * 前端控制器 + * 菜单 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +@Slf4j +@Validated +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/menu") +@Api(value = "Menu", tags = "系统管理-菜单") +public class MenuController { + + private final MenuService menuService; + private final MenuManage menuManage; + private final IRoleMenuService roleMenuService; + + /** + * 查询系统中所有的的菜单树结构, 不用缓存,因为该接口很少会使用,就算使用,也会管理员维护菜单时使用 + */ + @ApiOperation(value = "查询系统所有的菜单", notes = "查询系统所有的菜单") + @GetMapping("/list") + public List allTree(@Valid @RequestParam(required = false,value = "title") String title) { + List list = menuService.list(Wrappers.lambdaQuery(Menu.class).orderByAsc(Menu::getSort)); + return TreeUtil.buildTree(list,title); + } + + @ApiOperation(value = "查询当前登录用户的菜单", notes = "查询当前登录用户的菜单") + @GetMapping("/current_user_menu") + public List currentUserMenu() { + List list = menuService.list(Wrappers.lambdaQuery(Menu.class).orderByAsc(Menu::getSort)); + return menuManage.buildUserMenu(list, LoginUserUtil.loginUserDetail()); + } + + /** + * 查询某个菜单 + * + * @param id 主键id + * @return 查询结果 + */ + @ApiOperation(value = "查询菜单", notes = "查询菜单") + @GetMapping("/details") + public MenuQueryDTO getDetails(@RequestParam Long id) { + Menu menu = menuService.getById(id); + MenuQueryDTO query = BeanUtil.toBean(menu, MenuQueryDTO.class); + return query; + } + + @ApiOperation(value = "保存新菜单", notes = "保存新菜单") + @PostMapping("/save") + @WebLog(value = "新增菜单", modular = "系统管理-菜单管理") + public MenuVO handlerSave(@RequestBody MenuSaveDTO data) { + menuService.save(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(data, MenuVO.class); + } + + @ApiOperation(value = "编辑菜单", notes = "编辑菜单") + @PostMapping("/modify") + @WebLog(value = "编辑菜单", modular = "系统管理-菜单管理") + public MenuVO handlerUpdate(@RequestBody MenuUpdateDTO data) { + menuService.update(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(data, MenuVO.class); + } + + @ApiOperation(value = "删除菜单", notes = "删除菜单") + @PostMapping("/remove") + @WebLog(value = "删除菜单", modular = "系统管理-菜单管理") + public Boolean handlerDelete(@RequestBody List ids) { + // 判断登录用户是否有菜单管理的权限 + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + List menuIdList = roleMenuService.list(Wrappers.lambdaQuery(RoleMenu.class).eq(RoleMenu::getRoleId, roleId)).stream().map(RoleMenu::getMenuId).collect(Collectors.toList()); + Menu menu = menuService.getOne(Wrappers.lambdaQuery(Menu.class).eq(Menu::getTitle, "菜单管理")); + if (Objects.isNull(menu)){ + return false; + } + if (!menuIdList.contains(menu.getId())){ + return false; + } + return menuService.removeByIdWithCache(ids); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/OperatorController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/OperatorController.java new file mode 100644 index 0000000..848fe91 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/OperatorController.java @@ -0,0 +1,106 @@ +package com.ningdatech.carapi.sys.controller; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.sys.entity.Menu; +import com.ningdatech.carapi.sys.entity.RoleMenu; +import com.ningdatech.carapi.sys.entity.dto.OperatorPageQuery; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.entity.dto.OperatorSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.OperatorUpdateDTO; +import com.ningdatech.carapi.sys.entity.vo.OperatorVO; +import com.ningdatech.carapi.sys.manage.OperatorManage; +import com.ningdatech.carapi.sys.service.IRoleMenuService; +import com.ningdatech.carapi.sys.service.MenuService; +import com.ningdatech.carapi.sys.service.OperatorService; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import com.ningdatech.log.annotation.WebLog; + +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * 前端控制器 + * 运营商管理 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/operator") +@Api(value = "Operator", tags = "系统管理-运营商") +@RequiredArgsConstructor +public class OperatorController { + + private final OperatorManage operatorManage; + private final OperatorService operatorService; + private final IRoleMenuService roleMenuService; + private final MenuService menuService; + + @ApiOperation(value = "运营商列表查询", notes = "运营商列表查询") + @GetMapping("/list") + public PageVo queryList(@ModelAttribute OperatorPageQuery operatorPageQuery) { + return operatorManage.queryList(operatorPageQuery); + } + + /** + * 查询运营商详情 + * + * @param id 主键id + * @return 查询结果 + */ + @ApiOperation(value = "查询运营商详情", notes = "查询运营商详情") + @GetMapping("/details") + public OperatorQueryDTO getDetails(@RequestParam Long id) { + return operatorManage.getDetails(id); + } + + @ApiOperation(value = "保存新运营商", notes = "保存新运营商") + @PostMapping("/save") + @WebLog(value = "保存运营商信息", modular = "运营商管理") + public OperatorVO handlerSave(@RequestBody OperatorSaveDTO data) { + operatorService.save(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(data, OperatorVO.class); + } + + @ApiOperation(value = "编辑运营商", notes = "编辑运营商") + @PostMapping("/modify") + @WebLog(value = "编辑运营商信息", modular = "运营商管理") + public OperatorVO handlerUpdate(@RequestBody OperatorUpdateDTO data) { + operatorService.update(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(data, OperatorVO.class); + } + + @ApiOperation(value = "删除运营商", notes = "删除运营商") + @PostMapping("/remove") + @WebLog(value = "删除运营商信息", modular = "运营商管理") + public Boolean handlerDelete(@RequestBody List ids) { + // 判断登录用户是否有运营商管理的菜单权限 + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + List menuIdList = roleMenuService.list(Wrappers.lambdaQuery(RoleMenu.class).eq(RoleMenu::getRoleId, roleId)).stream().map(RoleMenu::getMenuId).collect(Collectors.toList()); + Menu menu = menuService.getOne(Wrappers.lambdaQuery(Menu.class).eq(Menu::getTitle, "运营商管理")); + if (Objects.isNull(menu)){ + return false; + } + if (!menuIdList.contains(menu.getId())){ + return false; + } + return operatorService.removeByIdWithCache(ids); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/RegionController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/RegionController.java new file mode 100644 index 0000000..6c347d6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/RegionController.java @@ -0,0 +1,75 @@ +package com.ningdatech.carapi.sys.controller; + + +import com.ningdatech.carapi.sys.entity.req.RegionDeleteReq; +import com.ningdatech.carapi.sys.entity.req.RegionTreeReq; +import com.ningdatech.carapi.sys.entity.vo.CompanyCarInfoVO; +import com.ningdatech.carapi.sys.entity.vo.RegionCompanyCarTreeVo; +import com.ningdatech.carapi.sys.entity.vo.RegionTreeVO; +import com.ningdatech.carapi.sys.manage.RegionManage; +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 javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author LiuXinXin + * @since 2022-10-08 + */ +@Validated +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/region") +@Api(tags = "系统管理-地域管理") +public class RegionController { + + private final RegionManage regionManage; + + @PostMapping("/tree") + @ApiOperation("获取区域编码的树状结构") + public List getRegionTree(@RequestBody(required = false) RegionTreeReq req) { + return regionManage.getRegionTree(req); + } + + @GetMapping("/tree/getCompanyCarInfo") + @ApiOperation("获取区域下的企业车辆树状结构") + public CompanyCarInfoVO getCompanyCarInfo(RegionTreeReq req) { + return regionManage.getCompanyCarInfo(req); + } + + @PostMapping("/regionCompanyCarNoTree") + @ApiOperation("获取区域编码的树状结构(子节点信息同名)") + public List getRegionCompanyCarNoTree(@RequestBody(required = false) RegionTreeReq req) { + return regionManage.getRegionCompanyCarNoTree(req); + } + + @PostMapping("/regionCompanyTree") + @ApiOperation("获取区域企业的树状结构") + public List getRegionCompanyTree(@RequestBody(required = false) RegionTreeReq req) { + return regionManage.getRegionCompanyTree(req); + } + + @PostMapping("/save") + @ApiOperation("保存或修改地域信息") + @WebLog(value = "保存/修改地域信息", modular = "地域管理") + public void saveRegion(@RequestBody @Valid RegionTreeVO region) { + regionManage.saveOrUpdate(region); + } + + @DeleteMapping("/delete") + @ApiOperation("删除地域信息") + @WebLog(value = "删除地域信息", modular = "地域管理") + public void deleteRegion(@RequestBody @Valid RegionDeleteReq req) { + regionManage.remove(req.getId(), req.getLevel()); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/RoleController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/RoleController.java new file mode 100644 index 0000000..44008c8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/RoleController.java @@ -0,0 +1,141 @@ +package com.ningdatech.carapi.sys.controller; + +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.datascope.model.DataScopeDto; +import com.ningdatech.carapi.sys.entity.Menu; +import com.ningdatech.carapi.sys.entity.Role; +import com.ningdatech.carapi.sys.entity.RoleMenu; +import com.ningdatech.carapi.sys.entity.dto.RolePageQuery; +import com.ningdatech.carapi.sys.entity.dto.RoleSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.RoleUpdateDTO; +import com.ningdatech.carapi.sys.entity.vo.RoleVO; +import com.ningdatech.carapi.sys.manage.RoleManage; +import com.ningdatech.carapi.sys.service.IRoleMenuService; +import com.ningdatech.carapi.sys.service.MenuService; +import com.ningdatech.carapi.sys.service.RoleService; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import com.ningdatech.log.annotation.WebLog; + +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * 前端控制器 + * 角色 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/role") +@Api(value = "Role", tags = "系统管理-角色") +@RequiredArgsConstructor +public class RoleController { + + private final RoleService roleService; + + private final RoleManage roleManage; + private final IRoleMenuService roleMenuService; + private final MenuService menuService; + + @GetMapping("/test") + public Optional query() { + Optional currentUserDataScoper = roleManage.getCurrentUserDataScoper(); + return currentUserDataScoper; + } + + @ApiOperation(value = "角色列表查询", notes = "角色列表查询") + @GetMapping("/list") + public PageVo query(@Valid @ModelAttribute RolePageQuery rolePageQuery) { + return roleManage.queryList(rolePageQuery); + } + + /** + * 查询角色 + * + * @param id 主键id + * @return 查询结果 + */ + @ApiOperation(value = "查询角色", notes = "查询角色") + @GetMapping("/details") + public RoleVO getDetails(@Valid @RequestParam Long id) { + + // 判断登录用户是否有角色管理的权限 + if (!checkMenuPower()) { + return null; + } + + Role role = roleService.getById(id); + if (Objects.isNull(role)){ + return null; + } + RoleVO query = BeanUtil.toBean(role, RoleVO.class); + if(Objects.isNull(query)){ + return null; + } + //菜单 + roleManage.buildMenu(query); + return query; + } + + @ApiOperation(value = "保存新角色", notes = "保存新角色") + @PostMapping("/save") + @WebLog(value = "新增角色", modular = "系统管理-角色管理") + public RoleVO handlerSave(@Valid @RequestBody RoleSaveDTO data) { + roleService.saveRole(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(data, RoleVO.class); + } + + @ApiOperation(value = "编辑角色", notes = "编辑角色") + @PostMapping("/modify") + @WebLog(value = "编辑角色", modular = "系统管理-角色管理") + public RoleVO handlerUpdate(@Valid @RequestBody RoleUpdateDTO data) { + roleService.updateRole(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(data, RoleVO.class); + } + + @ApiOperation(value = "删除角色", notes = "删除角色") + @PostMapping("/remove") + @WebLog(value = "删除角色", modular = "系统管理-角色管理") + public Boolean handlerDelete(@Valid @RequestBody List ids) { + // 判断登录用户是否有角色管理的权限 + if (!checkMenuPower()) { + return false; + } + return roleService.removeByIdWithCache(ids); + } + + private boolean checkMenuPower() { + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + Long roleId = userInfoDetails.getRoleId(); + List menuIdList = roleMenuService.list(Wrappers.lambdaQuery(RoleMenu.class).eq(RoleMenu::getRoleId, roleId)).stream().map(RoleMenu::getMenuId).collect(Collectors.toList()); + Menu menu = menuService.getOne(Wrappers.lambdaQuery(Menu.class).eq(Menu::getTitle, "角色管理")); + if (Objects.isNull(menu)){ + return true; + } + if (menuIdList.contains(menu.getId())){ + return true; + } + return false; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/UserController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/UserController.java new file mode 100644 index 0000000..008637c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/controller/UserController.java @@ -0,0 +1,85 @@ +package com.ningdatech.carapi.sys.controller; + +import cn.hutool.core.bean.BeanUtil; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.carapi.sys.entity.dto.UserPageQuery; +import com.ningdatech.carapi.sys.entity.dto.UserSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.UserUpdateDTO; +import com.ningdatech.carapi.sys.entity.vo.UserInfoVO; +import com.ningdatech.carapi.sys.manage.UserManage; +import com.ningdatech.carapi.user.util.LoginUserUtil; +import com.ningdatech.log.annotation.WebLog; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + *

+ * 前端控制器 + * 用户 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/user") +@Api(value = "User", tags = "系统管理-用户管理") +@RequiredArgsConstructor +public class UserController { + + private final UserManage userManage; + + @ApiOperation(value = "用户列表查询", notes = "用户列表查询") + @GetMapping("/list") + @WebLog(value = "用户列表查询", modular = "系统管理-用户管理") + public PageVo query(@Valid @ModelAttribute UserPageQuery userPageQuery) { + return userManage.queryUserList(userPageQuery); + } + + /** + * 查询用户 + * + * @param id 主键id + * @return 查询结果 + */ + @ApiOperation(value = "查询用户", notes = "查询用户") + @GetMapping("/details") + @WebLog(value = "查询用户", modular = "系统管理-用户管理") + public UserInfoVO getDetails(@Valid @RequestParam Long id) { + return userManage.queryDetails(id); + } + + + @ApiOperation(value = "保存新用户", notes = "保存新用户") + @PostMapping("/save") + @WebLog(value = "保存新用户", modular = "系统管理-用户管理") + public UserInfoVO handlerSave(@Valid @RequestBody UserSaveDTO data) { + userManage.save(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(data, UserInfoVO.class); + } + + @ApiOperation(value = "编辑用户", notes = "编辑用户") + @PostMapping("/modify") + @WebLog(value = "编辑用户", modular = "系统管理-用户管理") + public UserInfoVO handlerUpdate(@Valid @RequestBody UserUpdateDTO data) { + userManage.update(data, LoginUserUtil.getUserId()); + return BeanUtil.toBean(data, UserInfoVO.class); + } + + @ApiOperation(value = "删除用户", notes = "删除用户") + @PostMapping("/remove") + @WebLog(value = "删除用户", modular = "系统管理-用户管理") + public Boolean handlerDelete(@Valid @RequestBody List ids) { + return userManage.remove(ids); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/convert/RegionConverter.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/convert/RegionConverter.java new file mode 100644 index 0000000..6769d34 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/convert/RegionConverter.java @@ -0,0 +1,196 @@ +package com.ningdatech.carapi.sys.convert; + +import java.util.*; +import java.util.stream.Collectors; + +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.tuple.Pair; + +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.car.equipment.model.DataAccessDevices; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentChannels; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentInfo; +import com.ningdatech.carapi.sys.entity.Region; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.entity.dto.RegionTreeDTO; +import com.ningdatech.carapi.sys.entity.vo.CarVO; +import com.ningdatech.carapi.sys.entity.vo.RegionCompanyCarTreeVo; +import com.ningdatech.carapi.sys.entity.vo.RegionTreeCompanyVO; +import com.ningdatech.carapi.sys.entity.vo.RegionTreeVO; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; + +/** + *

+ * RegionConverter + *

+ * + * @author WendyYang + * @since 10:31 2022/10/12 + */ +public class RegionConverter { + + public static RegionDTO toRegionDTO(Region region) { + RegionDTO dto = new RegionDTO(); + dto.setRegionLevel(region.getLevel()); + dto.setRegionName(region.getName()); + dto.setParentCode(region.getParentCode()); + dto.setRegionCode(region.getRegionCode()); + dto.setId(region.getId()); + dto.setMapData(region.getMapData()); + dto.setDeleted(region.getDeleted()); + dto.setGovUnit(region.getGovUnit()); + dto.setParentId(region.getParentId()); + dto.unionCode(); + return dto; + } + + public static List toRegionTreeDTOList(List regionDTOList) { + if (CollectionUtils.isEmpty(regionDTOList)) { + return new ArrayList<>(); + } + return regionDTOList.stream().map(RegionConverter::toRegionTreeDTO).collect(Collectors.toList()); + } + + public static RegionTreeDTO toRegionTreeDTO(RegionDTO regionDTO) { + RegionTreeDTO treeDto = new RegionTreeDTO(); + treeDto.setLevel(regionDTO.getRegionLevel()); + treeDto.setName(regionDTO.getRegionName()); + treeDto.setParentCode(regionDTO.getParentCode()); + treeDto.setRegionCode(regionDTO.getRegionCode()); + treeDto.setUnionCode(regionDTO.getUnionCode()); + treeDto.setId(regionDTO.getId()); + treeDto.setMapData(regionDTO.getMapData()); + treeDto.setDeleted(regionDTO.getDeleted()); + treeDto.setGovUnit(regionDTO.getGovUnit()); + return treeDto; + } + + public static List toRegionTree(Long parentId, Map> regions, + boolean showDeleted, Map> carNoList, Map> companyMap) { + List treeList = new ArrayList<>(); + List children = regions.getOrDefault(parentId, Collections.emptyList()); + for (RegionDTO region : children) { + if (!showDeleted && region.getDeleted()) { + continue; + } + RegionTreeVO treeNode = new RegionTreeVO(); + treeNode.setLevel(region.getRegionLevel()); + treeNode.setName(region.getRegionName()); + treeNode.setParentCode(region.getParentCode()); + treeNode.setRegionCode(region.getRegionCode()); + List regionList = regions.get(region.getId()); + if (CollectionUtils.isNotEmpty(regionList)) { + treeNode.setChildren(toRegionTree(region.getId(), regions, showDeleted, carNoList, companyMap)); + } + + if (companyMap != null) { + List companyList = companyMap.get(region.getId()); + treeNode.setCompanyList(ObjectUtil.defaultIfNull(companyList, Collections.emptyList())); + if (treeNode.getCompanyList().size() > 0 && carNoList != null) { + treeNode.getCompanyList().forEach(company -> { + List carNos = carNoList.getOrDefault(company.getId(), Collections.emptyList()); + company.setCarNoList(carNos); + }); + } + } + treeNode.setMapData(region.getMapData()); + treeNode.setId(region.getId()); + treeNode.setUnionCode(region.getUnionCode()); + treeNode.setGovUnit(region.getGovUnit()); + treeList.add(treeNode); + } + return treeList; + } + + public static List toRegionCompanyCarNoTree(Long parentId, + Map> regions, boolean showDeleted, Map>> carNoList, + Map> companyMap, Map deviceMap, + Map> equipmentMap, Map channelsMap) { + List treeList = new ArrayList<>(); + List children = regions.getOrDefault(parentId, Collections.emptyList()); + for (RegionDTO region : children) { + if (!showDeleted && region.getDeleted()) { + continue; + } + RegionCompanyCarTreeVo regionNode = new RegionCompanyCarTreeVo(); + regionNode.setCode(region.getId()); + regionNode.setValue(region.getRegionName()); + regionNode.setType(RegionCompanyCarTreeVo.Type.REGION); + regionNode.setLevel(region.getRegionLevel()); + regionNode.setUnique(); + if (companyMap != null) { + List companies = null; + List companyList = companyMap.get(region.getId()); + boolean hasCompany = CollectionUtils.isNotEmpty(companyList); + if (hasCompany) { + companies = CollUtils.convert(companyList, w -> { + RegionCompanyCarTreeVo company = new RegionCompanyCarTreeVo(); + company.setCode(w.getId()); + company.setValue(w.getName()); + company.setType(RegionCompanyCarTreeVo.Type.COMPANY); + company.setUnique(); + return company; + }); + regionNode.getChildren().addAll(companies); + } + if (hasCompany && carNoList != null) { + companies.forEach(company -> { + List> carNos = carNoList.get(company.getCode()); + if (CollectionUtils.isNotEmpty(carNos)) { + List carNodes = CollUtils.convert(carNos, w -> { + CarVO car = w.getValue(); + RegionCompanyCarTreeVo carNo = new RegionCompanyCarTreeVo(); + carNo.setCode(w.getKey()); + carNo.setValue(car.getCarPlate()); + carNo.setStatus(car.getStatus()); + carNo.setMoving(car.getMoving()); + carNo.setType(RegionCompanyCarTreeVo.Type.CAR_NO); + carNo.setUnique(); + return carNo; + }); + company.getChildren().addAll(carNodes); + + carNodes.forEach(car -> { + List equipmentInfos = equipmentMap.get(car.getValue()); + if (CollUtil.isNotEmpty(equipmentInfos)) { + List equipNodes = CollUtils.convert(equipmentInfos, e -> { + RegionCompanyCarTreeVo equip = new RegionCompanyCarTreeVo(); + equip.setDeviceId(e.getEquipmentNo()); + NdVehicleEquipmentChannels channels = + channelsMap.get((e.getId())); + equip.setValue(channels.getName()); + // 根据平台ID和视频设备编号判断视频是否可以播放 + DataAccessDevices devices = + deviceMap.get(e.getEquipmentNo() + e.getPlatformId()); + if (Objects.nonNull(devices) && devices.getStatus() != null + && !StrPool.EMPTY.equals(devices.getStatus())) { + equip.setVideoStatus(devices.getStatus()); + } else { + equip.setVideoStatus("OFF"); + } + equip.setUnique(); + equip.setType(RegionCompanyCarTreeVo.Type.CAR_VIDEO); + return equip; + }); + car.getChildren().addAll(equipNodes); + } + }); + } + }); + + } + } + // 设置子节点信息 + List regionList = regions.get(region.getId()); + if (CollectionUtils.isNotEmpty(regionList)) { + regionNode.getChildren().addAll(toRegionCompanyCarNoTree(region.getId(), regions, showDeleted, + carNoList, companyMap, deviceMap, equipmentMap, channelsMap)); + } + treeList.add(regionNode); + } + return treeList; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/convert/UserAuthConverter.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/convert/UserAuthConverter.java new file mode 100644 index 0000000..5321965 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/convert/UserAuthConverter.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.sys.convert; + +import java.util.List; +import java.util.Objects; + +import com.ningdatech.carapi.sys.entity.dto.UserQueryDTO; +import com.ningdatech.carapi.sys.entity.vo.UserInfoVO; +import com.ningdatech.carapi.user.entity.NdUserAuth; + +import cn.hutool.core.collection.CollUtil; + +/** + * @Classname UserAuthConverter + * @Description + * @Date 2022/10/9 10:30 + * @Created by PoffyZhang + */ +public class UserAuthConverter { + + public static UserInfoVO convert(UserInfoVO user, List auths) { + if(Objects.isNull(user) || Objects.isNull(user.getId())){ + return user; + } + if(CollUtil.isNotEmpty(auths)){ + auths.forEach(auth -> { + if(user.getId().equals(auth.getUserId()) && Boolean.TRUE.equals(auth.getIsAvailable())){ + user.setAccount(auth.getIdentifier()); + } + }); + } + return user; + } + + public static UserQueryDTO convert(UserQueryDTO user, List auths) { + if(Objects.isNull(user) || Objects.isNull(user.getId())){ + return user; + } + if(CollUtil.isNotEmpty(auths)){ + auths.forEach(auth -> { + if(user.getId().equals(auth.getUserId())){ + user.setAccount(auth.getIdentifier()); + user.setPassword(auth.getCredential()); + } + }); + } + return user; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/convert/UserCompanyConverter.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/convert/UserCompanyConverter.java new file mode 100644 index 0000000..2a73851 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/convert/UserCompanyConverter.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.sys.convert; + +import cn.hutool.core.collection.CollUtil; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.dto.UserQueryDTO; +import com.ningdatech.carapi.sys.entity.vo.UserInfoVO; +import com.ningdatech.carapi.user.entity.NdUserInfo; + +import java.util.List; +import java.util.Objects; + +/** + * @Classname UserCompanyConverter + * @Description + * @Date 2022/10/9 10:30 + * @Created by PoffyZhang + */ +public class UserCompanyConverter { + + public static UserInfoVO convert(UserInfoVO user, List companies) { + if(Objects.isNull(user) || Objects.isNull(user.getId())){ + return user; + } + if(CollUtil.isNotEmpty(companies)){ + companies.forEach(company -> { + if(user.getCompanyId().equals(company.getId())){ + user.setCompanyName(company.getName()); + } + }); + } + return user; + } + + public static UserQueryDTO convert(UserQueryDTO user, List companies) { + if(Objects.isNull(user) || Objects.isNull(user.getId())){ + return user; + } + if(CollUtil.isNotEmpty(companies)){ + companies.forEach(company -> { + if(user.getCompanyId().equals(company.getId())){ + user.setCompanyName(company.getName()); + } + }); + } + return user; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/convert/UserRoleConverter.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/convert/UserRoleConverter.java new file mode 100644 index 0000000..3947ff7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/convert/UserRoleConverter.java @@ -0,0 +1,76 @@ +package com.ningdatech.carapi.sys.convert; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import com.google.common.collect.Lists; +import com.ningdatech.carapi.sys.entity.Role; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.entity.dto.UserQueryDTO; +import com.ningdatech.carapi.sys.entity.vo.UserInfoVO; + +import cn.hutool.core.collection.CollUtil; + +/** + * @Classname UserRoleConverter + * @Description + * @Date 2022/10/9 10:30 + * @Created by PoffyZhang + */ +public class UserRoleConverter { + + public static UserInfoVO convert(UserInfoVO user, List roles) { + if(Objects.isNull(user) || Objects.isNull(user.getId())){ + return user; + } + if(CollUtil.isNotEmpty(roles)){ + roles.forEach(role -> { + if(user.getRole().equals(role.getId())){ + user.setRoleName(role.getName()); + } + }); + } + return user; + } + + public static UserInfoVO convert(UserInfoVO user, List userRoles, List roles) { + if(Objects.isNull(user) || Objects.isNull(user.getId())){ + return user; + } + if(CollUtil.isNotEmpty(userRoles) && CollUtil.isNotEmpty(roles)){ + List roleNames = Lists.newArrayList(); + roles.forEach(role -> { + userRoles.forEach(userRole -> { + if(userRole.getRoleId().equals(role.getId()) && + userRole.getUserId().equals(user.getId())){ + roleNames.add(role.getName()); + user.setRole(role.getId()); + } + }); + }); + user.setRoleName(roleNames.stream().collect(Collectors.joining(","))); + } + return user; + } + + public static UserQueryDTO convert(UserQueryDTO user, List userRoles, List roles) { + if(Objects.isNull(user) || Objects.isNull(user.getId())){ + return user; + } + if(CollUtil.isNotEmpty(userRoles) && CollUtil.isNotEmpty(roles)){ + List roleNames = Lists.newArrayList(); + roles.forEach(role -> { + userRoles.forEach(userRole -> { + if(userRole.getRoleId().equals(role.getId()) && + userRole.getUserId().equals(user.getId())){ + roleNames.add(role.getName()); + user.setRole(role.getId()); + } + }); + }); + user.setRoleName(roleNames.stream().collect(Collectors.joining(","))); + } + return user; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/BonusPointsRule.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/BonusPointsRule.java new file mode 100644 index 0000000..97c7395 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/BonusPointsRule.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.sys.entity; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/24 下午3:22 + */ +@ApiModel("加分规则") +@Data +public class BonusPointsRule { + + private List codingRuleInfoList; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CodingRule.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CodingRule.java new file mode 100644 index 0000000..c092bb9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CodingRule.java @@ -0,0 +1,61 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.sys.entity.enumeration.CodingRuleBehaviorTypeEnum; +import com.ningdatech.carapi.sys.entity.enumeration.CodingRuleVehicleType; +import com.ningdatech.carapi.sys.entity.enumeration.RuleOperationTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-20 + */ +@Data +@TableName("nd_coding_rule") +@ApiModel(value = "CodingRule对象", description = "") +public class CodingRule implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + /** + * {@link RuleOperationTypeEnum} + */ + @ApiModelProperty("加分减分") + private String ruleOperationType; + + /** + * {@link CodingRuleVehicleType} + */ + @ApiModelProperty("车辆类型") + private String vehicleType; + + /** + * {@link CodingRuleBehaviorTypeEnum} + */ + @ApiModelProperty("行为类型") + private String behaviorType; + + @ApiModelProperty("操作分数") + private Integer operationScore; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CodingRuleInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CodingRuleInfo.java new file mode 100644 index 0000000..f0b16a9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CodingRuleInfo.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.sys.entity; + +import com.ningdatech.carapi.sys.entity.enumeration.CodingRuleBehaviorTypeEnum; +import com.ningdatech.carapi.sys.entity.enumeration.RuleOperationTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author liuxinxin + * @date 2022/10/24 下午3:05 + */ +@Data +@ApiModel("规则") +public class CodingRuleInfo { + + @ApiModelProperty("加分减分") + @NotNull + private RuleOperationTypeEnum ruleOperationType; + + @ApiModelProperty("行为类型") + @NotNull + private CodingRuleBehaviorTypeEnum codingRuleBehaviorType; + + @ApiModelProperty("操作分数") + @NotNull + private Integer operationScore; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Company.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Company.java new file mode 100644 index 0000000..532c007 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Company.java @@ -0,0 +1,252 @@ +package com.ningdatech.carapi.sys.entity; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +import java.time.LocalDateTime; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + *

+ * 实体类 + * 企业 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("nd_company_info") +@ApiModel(value = "Company", description = "企业") +@AllArgsConstructor +@Builder +public class Company extends BaseEntity { + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业名称") + @NotEmpty(message = "企业名称不能为空") + @Size(max = 30, message = "企业名称长度不能超过30") + @TableField(value = "name", condition = LIKE) + private String name; + + /** + * 车辆数 + */ + @ApiModelProperty(value = "车辆数") + @TableField("vehicle_num") + private Long vehicleNum; + + /** + * 地区ID + */ + @ApiModelProperty(value = "地区id") + @TableField("region_id") + private Long regionId; + + /** + * 地区名 + */ + @ApiModelProperty(value = "地区名") + @TableField("region_name") + private String regionName; + + /** + * 运营商ID + */ + @ApiModelProperty(value = "运营商ID") + @TableField("operator_id") + private Long operatorId; + + /** + * 传真 + */ + @ApiModelProperty(value = "传真") + @Size(max = 50, message = "传真长度不能超过50") + @TableField(value = "fax") + private String fax; + + /** + * email + */ + @ApiModelProperty(value = "email") + @TableField(value = "email") + private String email; + + /** + * 地址 + */ + @ApiModelProperty(value = "地址") + @Size(max = 200, message = "地址长度不能超过200") + @TableField(value = "address", condition = LIKE) + private String address; + + /** + * 联系人 + */ + @ApiModelProperty(value = "联系人") + @Size(max = 200, message = "联系人长度不能超过200") + @TableField(value = "contact_person", condition = LIKE) + private String contactPerson; + + /** + * 联系方式 + */ + @ApiModelProperty(value = "联系方式") + @Size(max = 50, message = "联系方式长度不能超过50") + @TableField(value = "contact_phone", condition = LIKE) + private String contactPhone; + + /** + * 法人 + */ + @ApiModelProperty(value = "法人") + @Size(max = 200, message = "法人长度不能超过200") + @TableField(value = "legal_person", condition = LIKE) + private String legalPerson; + + /** + * 法人联系电话 + */ + @ApiModelProperty(value = "法人联系电话") + @Size(max = 50, message = "法人联系电话长度不能超过50") + @TableField(value = "legal_person_phone", condition = LIKE) + private String legalPersonPhone; + + /** + * 公司类型 + */ + @ApiModelProperty(value = "公司类型") + @TableField("company_type") + private Integer companyType; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + @Size(max = 200, message = "备注不能超过200") + @TableField(value = "remark", condition = LIKE) + private String remark; + + @ApiModelProperty(value = "营业执照编号") + @TableField(value = "business_license", condition = LIKE) + private String businessLicense; + + @ApiModelProperty(value = "企业简称") + @TableField(value = "sort_name", condition = LIKE) + private String sortName; + + @ApiModelProperty(value = "员工数量") + @TableField("employees_num") + private Long employeesNum; + + @ApiModelProperty(value = "开户银行") + @TableField(value = "bank_name", condition = LIKE) + private String bankName; + + @ApiModelProperty(value = "税号") + @TableField(value = "duty_paragraph", condition = LIKE) + private String dutyParagraph; + + @ApiModelProperty(value = "银行账户") + @TableField(value = "bank_card_no", condition = LIKE) + private String bankCardNo; + + @ApiModelProperty(value = "法人邮箱") + @TableField(value = "legal_person_email", condition = LIKE) + private String legalPersonEmail; + + @ApiModelProperty(value = "企业状态") + @TableField(value = "company_status") + private Integer companyStatus; + + @ApiModelProperty(value = "注册资金") + @TableField(value = "registered_capital", condition = LIKE) + private String registeredCapital; + + @ApiModelProperty(value = "车辆企业类型") + @TableField(value = "car_company_type", condition = LIKE) + private String carCompanyType; + + @ApiModelProperty(value = "失信情况") + @TableField(value = "black_list") + private Boolean blackList; + + @ApiModelProperty(value = "经度") + @TableField(value = "longitude", condition = LIKE) + private String longitude; + + @ApiModelProperty(value = "纬度") + @TableField(value = "latitude", condition = LIKE) + private String latitude; + + @ApiModelProperty(value = "原始数据公司id 导数据使用,项目中无使用场景") + @TableField(value = "firm_id") + private Long firmId; + + @ApiModelProperty(value = "在线车辆数") + @TableField(value = "online_vehicle_num") + private Long onlineVehicleNum; + + @ApiModelProperty(value = "离线车辆数") + @TableField(value = "offline_vehicle_num") + private Long offlineVehicleNum; + + @ApiModelProperty(value = "异常车辆数") + @TableField(value = "exception_vehicle_num") + private Long exceptionVehicleNum; + + @ApiModelProperty(value = "区县管理员审核状态") + @TableField(value = "region_audit_status") + private Integer regionAuditStatus; + + @ApiModelProperty(value = "市管理员审核状态") + @TableField(value = "city_audit_status") + private Integer cityAuditStatus; + + @ApiModelProperty(value = "区县审核人") + @TableField(value = "region_audit_by") + private Long regionAuditBy; + + @ApiModelProperty(value = "市散办审核人") + @TableField(value = "city_audit_by") + private Long cityAuditBy; + + @ApiModelProperty(value = "区县审核意见") + @TableField(value = "region_audit_mind") + private String regionAuditMind; + + @ApiModelProperty(value = "市散办审核意见") + @TableField(value = "city_audit_mind") + private String cityAuditMind; + + @ApiModelProperty(value = "区县审核时间") + @TableField(value = "region_audit_time") + private LocalDateTime regionAuditTime; + + @ApiModelProperty(value = "市散办审核时间") + @TableField(value = "city_audit_time") + private LocalDateTime cityAuditTime; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CompanyJoin.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CompanyJoin.java new file mode 100644 index 0000000..cc8c285 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CompanyJoin.java @@ -0,0 +1,216 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * 实体类 + * 企业 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("nd_company_info") +@ApiModel(value = "Company", description = "企业") +@AllArgsConstructor +@Builder +public class CompanyJoin extends BaseEntity { + + @TableId(value = "id",type = IdType.AUTO) + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业名称") + @NotEmpty(message = "企业名称不能为空") + @Size(max = 30, message = "企业名称长度不能超过30") + @TableField(value = "name", condition = LIKE) + private String name; + + /** + * 车辆数 + */ + @ApiModelProperty(value = "车辆数") + @TableField("vehicle_num") + private Long vehicleNum; + + /** + * 地区ID + */ + @ApiModelProperty(value = "地区id") + @TableField("region_id") + private Long regionId; + + /** + * 地区 + */ + @ApiModelProperty(value = "地区") + @TableField(exist = false) + private String regionName; + + /** + * 运营商ID + */ + @ApiModelProperty(value = "运营商ID") + @TableField("operator_id") + private Long operatorId; + + /** + * 运营商 + */ + @ApiModelProperty(value = "运营商") +// @TableField(exist = false) + private String operatorName; + + /** + * 传真 + */ + @ApiModelProperty(value = "传真") + @Size(max = 50, message = "传真长度不能超过50") + @TableField(value = "fax") + private String fax; + + /** + * email + */ + @ApiModelProperty(value = "email") + @TableField(value = "email") + private String email; + + /** + * 地址 + */ + @ApiModelProperty(value = "地址") + @Size(max = 200, message = "地址长度不能超过200") + @TableField(value = "address", condition = LIKE) + private String address; + + /** + * 联系人 + */ + @ApiModelProperty(value = "联系人") + @Size(max = 200, message = "联系人长度不能超过200") + @TableField(value = "contact_person", condition = LIKE) + private String contactPerson; + + /** + * 联系方式 + */ + @ApiModelProperty(value = "联系方式") + @Size(max = 50, message = "联系方式长度不能超过50") + @TableField(value = "contact_phone", condition = LIKE) + private String contactPhone; + + /** + * 法人 + */ + @ApiModelProperty(value = "法人") + @Size(max = 200, message = "法人长度不能超过200") + @TableField(value = "legal_person", condition = LIKE) + private String legalPerson; + + /** + * 法人联系电话 + */ + @ApiModelProperty(value = "法人联系电话") + @Size(max = 50, message = "法人联系电话长度不能超过50") + @TableField(value = "legal_person_phone", condition = LIKE) + private String legalPersonPhone; + + /** + * 公司类型 + */ + @ApiModelProperty(value = "公司类型") + @TableField("company_type") + private Integer companyType; + + /** + * 公司类型名 + */ + @ApiModelProperty(value = "公司类型名") + @TableField(exist = false) + private String companyTypeName; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + @Size(max = 200, message = "备注不能超过200") + @TableField(value = "remark", condition = LIKE) + private String remark; + + @ApiModelProperty(value = "营业执照编号") + @TableField(value = "business_license", condition = LIKE) + private String businessLicense; + + @ApiModelProperty(value = "企业简称") + @TableField(value = "sort_name", condition = LIKE) + private String sortName; + + @ApiModelProperty(value = "员工数量") + @TableField("employees_num") + private Integer employeesNum; + + @ApiModelProperty(value = "开户银行") + @TableField(value = "bank_name", condition = LIKE) + private String bankName; + + @ApiModelProperty(value = "税号") + @TableField(value = "duty_paragraph", condition = LIKE) + private String dutyParagraph; + + @ApiModelProperty(value = "银行账户") + @TableField(value = "bank_card_no", condition = LIKE) + private String bankCardNo; + + @ApiModelProperty(value = "法人邮箱") + @TableField(value = "legal_person_email", condition = LIKE) + private String legalPersonEmail; + + @ApiModelProperty(value = "企业状态") + @TableField(value = "company_status") + private Integer companyStatus; + + @ApiModelProperty(value = "注册资金") + @TableField(value = "registered_capital", condition = LIKE) + private String registeredCapital; + + @ApiModelProperty(value = "车辆企业类型") + @TableField(value = "car_company_type", condition = LIKE) + private String carCompanyType; + + @ApiModelProperty(value = "失信情况") + @TableField(value = "black_list") + private Boolean blackList; + + @ApiModelProperty(value = "经度") + @TableField(value = "longitude", condition = LIKE) + private String longitude; + + @ApiModelProperty(value = "纬度") + @TableField(value = "latitude", condition = LIKE) + private String latitude; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CompanyType.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CompanyType.java new file mode 100644 index 0000000..7608038 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CompanyType.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; +import java.io.Serializable; +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + * @Classname CompanyType + * @Description + * @Date 2022/11/2 13:54 + * @Created by PoffyZhang + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@TableName("nd_company_type") +@ApiModel(value = "CompanyType", description = "企业类型") +@AllArgsConstructor +@Builder +public class CompanyType implements Serializable { + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业类型名称") + @TableField(value = "name", condition = LIKE) + private String name; + + /** + * 父节点 + */ + @ApiModelProperty(value = "父节点") + @TableField(value = "pid") + private Long pid; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CompanyTypeRelated.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CompanyTypeRelated.java new file mode 100644 index 0000000..dbebbe3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/CompanyTypeRelated.java @@ -0,0 +1,41 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; +import java.io.Serializable; + +/** + * @Classname CompanyTypeRelated + * @Description + * @Date 2022/11/2 13:54 + * @Created by PoffyZhang + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@TableName("nd_company_type_related") +@ApiModel(value = "CompanyTypeRelated", description = "企业类型关系表") +@AllArgsConstructor +@Builder +public class CompanyTypeRelated implements Serializable { + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "企业ID") + @TableField(value = "company_id") + private Long companyId; + + @ApiModelProperty(value = "类型的id") + @TableField(value = "company_type_id") + private Long companyTypeId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/ExamRule.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/ExamRule.java new file mode 100644 index 0000000..dad0bf5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/ExamRule.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.driver.constant.QuestionTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-20 + */ +@Data +@TableName("nd_exam_rule") +@ApiModel(value = "ExamRule对象", description = "") +public class ExamRule implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + private Long updateBy; + + @ApiModelProperty("每题分数") + private Integer perQuestionScore; + + /** + * {@link QuestionTypeEnum} + */ + @ApiModelProperty("题目类型") + private String questionType; + + @ApiModelProperty("题目需要数量") + private Integer questionCnt; + + @ApiModelProperty("所属区域") + private Long regionId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Menu.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Menu.java new file mode 100644 index 0000000..d8f4a25 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Menu.java @@ -0,0 +1,88 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; +import org.apache.commons.lang3.StringUtils; + +import javax.validation.constraints.Size; +import java.time.LocalDateTime; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * 实体类 + * 菜单 + *

+ * + * @author PoffyZhang + * @since 2022-9-30 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("nd_menu") +@ApiModel(value = "Menu", description = "菜单") +@AllArgsConstructor +public class Menu extends TreeEntity { + + private static final long serialVersionUID = 1L; + + /** + * 权限" + */ + @ApiModelProperty(value = "权限") + @Size(max = 200, message = "权限长度不能超过200") + @TableField(value = "permission", condition = LIKE) + private String permission; + /** + * 类型;[0-菜单 1-目录 2-按钮] + */ + @ApiModelProperty(value = "类型") + @TableField(value = "type") + private Integer type; + + /** + * 组件 + */ + @ApiModelProperty(value = "组件") + @Size(max = 255, message = "组件长度不能超过255") + @TableField(value = "component", condition = LIKE) + private String component; + + /** + * 菜单图标 + */ + @ApiModelProperty(value = "菜单图标") + @Size(max = 255, message = "菜单图标长度不能超过255") + @TableField(value = "icon", condition = LIKE) + private String icon; + + /** + * 子菜单数目 + */ + @ApiModelProperty(value = "是否隐藏") + @TableField(value = "`hidden`") + private Integer hidden; + + /** + * activeMenu + */ + @ApiModelProperty(value = "activeMenu") + @TableField(value = "`active_menu`") + private String activeMenu; + + + /** + * 跳转 + */ + @ApiModelProperty(value = "跳转") + @TableField(value = "redirect") + private String redirect; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/MetaApply.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/MetaApply.java new file mode 100644 index 0000000..6a2320c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/MetaApply.java @@ -0,0 +1,83 @@ +package com.ningdatech.carapi.sys.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; + +/** + *

+ * + *

+ * + * @author Liuxinxin + * @since 2022-10-15 + */ +@TableName("nd_meta_apply") +@Data +@ApiModel(value = "MetaApply对象", description = "") +public class MetaApply implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + @ApiModelProperty("审核记录所属用户id") + private Long userId; + + @ApiModelProperty("审核类型") + private String applyType; + + @ApiModelProperty("审核状态") + private String applyStatus; + + @ApiModelProperty("发起审核时间") + private LocalDateTime applyTime; + + @ApiModelProperty("审核时间") + private LocalDateTime reviewTime; + + @ApiModelProperty("审核意见") + private String auditOpinion; + + @ApiModelProperty("审核员id") + private Long approverUserId; + + @ApiModelProperty("审核员姓名(冗余字段)") + private String approver; + + @ApiModelProperty("发起审核人id") + private Long applicantId; + + @ApiModelProperty("发起审核人姓名") + private String applicant; + + @ApiModelProperty("额外材料") + private String extraMaterial; + + @ApiModelProperty("是否展示") + private String displayEnable; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("公司ID") + private Long companyId; + + @ApiModelProperty("申请类型") + private Integer applicantType; + + @ApiModelProperty("意向跳槽企业ID") + private Long jobChangeCompanyId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Operator.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Operator.java new file mode 100644 index 0000000..2548c8b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Operator.java @@ -0,0 +1,61 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.time.LocalDateTime; +import java.util.List; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * 实体类 + * 运营商 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("nd_operator_info") +@ApiModel(value = "Operator", description = "运营商") +@AllArgsConstructor +@Builder +public class Operator extends BaseEntity { + + @TableId(value = "id",type = IdType.AUTO) + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 运营商名称 + */ + @ApiModelProperty(value = "运营商名称") + @NotEmpty(message = "运营商名称不能为空") + @Size(max = 50, message = "运营商名称长度不能超过50") + @TableField(value = "name", condition = LIKE) + private String name; + + /** + * 运营商备注 + */ + @ApiModelProperty(value = "备注") + @Size(max = 250, message = "备注长度不能超过250") + @TableField(value = "remark", condition = LIKE) + private String remark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/OperatorRegionHead.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/OperatorRegionHead.java new file mode 100644 index 0000000..51f972a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/OperatorRegionHead.java @@ -0,0 +1,83 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.time.LocalDateTime; +import java.util.List; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * 实体类 + * 运营商区域负责人 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("nd_operator_region_head") +@ApiModel(value = "OperatorRegionHead", description = "运营商区域负责人") +@AllArgsConstructor +@Builder +public class OperatorRegionHead extends BaseEntity { + + @TableId(value = "id",type = IdType.AUTO) + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 区域负责人 + */ + @ApiModelProperty(value = "区域负责人") + @NotEmpty(message = "区域负责人不能为空") + @Size(max = 50, message = "区域负责人长度不能超过50") + @TableField(value = "regional_head", condition = LIKE) + private String regionalHead; + + /** + * 区域id + */ + @ApiModelProperty(value = "区域id") + @TableField(value = "region_id") + private Long regionId; + + /** + * 区域名字 + */ + @ApiModelProperty(value = "区域名") + @TableField(exist = false) + private String regionName; + + /** + *运营商ID + */ + @ApiModelProperty(value = "运营商ID") + @TableField(value = "operator_id") + private Long operatorId; + + /** + * 联系电话 + */ + @ApiModelProperty(value = "联系电话") + @Size(max = 20, message = "联系电话长度不能超过20") + @TableField(value = "mobile", condition = LIKE) + private String mobile; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Region.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Region.java new file mode 100644 index 0000000..8e25382 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Region.java @@ -0,0 +1,52 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * Region - 地域实体 + *

+ * + * @author WendyYang + * @since 10:33 2022/10/12 + */ +@Data +@TableName("nd_region") +public class Region implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private String regionCode; + + private String name; + + private Integer level; + + private String govUnit; + + private String parentCode; + + private Long parentId; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long createBy; + + private Long updateBy; + + private Boolean deleted; + + private String mapData; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Resource.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Resource.java new file mode 100644 index 0000000..37762e6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Resource.java @@ -0,0 +1,95 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.time.LocalDateTime; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * 实体类 + * 资源 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("c_resource") +@ApiModel(value = "Resource", description = "资源") +@AllArgsConstructor +public class Resource extends BaseEntity { + + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 编码 + */ + @ApiModelProperty(value = "编码") + @Size(max = 500, message = "编码长度不能超过500") + @TableField(value = "code", condition = LIKE) + private String code; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotEmpty(message = "名称不能为空") + @Size(max = 255, message = "名称长度不能超过255") + @TableField(value = "name", condition = LIKE) + private String name; + + /** + * 菜单ID + * #c_menu + */ + @ApiModelProperty(value = "菜单ID") + @TableField("menu_id") + private Long menuId; + + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + @Size(max = 255, message = "描述长度不能超过255") + @TableField(value = "describe_", condition = LIKE) + private String describe; + + /** + * 内置 + */ + @ApiModelProperty(value = "内置") + @TableField("readonly_") + private Boolean readonly; + + + @Builder + public Resource(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, + String code, String name, Long menuId, String describe, Boolean readonly) { + this.id = id; + this.createBy = createdBy; + this.createOn = createTime; + this.updateBy = updatedBy; + this.updateOn = updateTime; + this.code = code; + this.name = name; + this.menuId = menuId; + this.describe = describe; + this.readonly = readonly; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Role.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Role.java new file mode 100644 index 0000000..14308e1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/Role.java @@ -0,0 +1,69 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.time.LocalDateTime; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * 实体类 + * 角色 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("nd_role") +@ApiModel(value = "Role", description = "角色") +@AllArgsConstructor +public class Role extends BaseEntity { + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotEmpty(message = "名称不能为空") + @Size(max = 30, message = "名称长度不能超过30") + @TableField(value = "name", condition = LIKE) + private String name; + + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + @Size(max = 100, message = "描述长度不能超过100") + @TableField(value = "describe_", condition = LIKE) + private String describe; + + /** + * 数据范围 + */ + @ApiModelProperty(value = "数据范围 1全部 2本区域 3本区域以及下区域 4本公司") + private Integer dataScope; + + @ApiModelProperty("角色排序") + private Integer sort; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/RoleAuthority.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/RoleAuthority.java new file mode 100644 index 0000000..dcdd630 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/RoleAuthority.java @@ -0,0 +1,76 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import com.ningdatech.carapi.sys.entity.enumeration.AuthorizeType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + *

+ * 实体类 + * 角色的资源 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("nd_role_authority") +@ApiModel(value = "RoleAuthority", description = "角色的资源") +@AllArgsConstructor +public class RoleAuthority extends BaseEntity { + + private static final long serialVersionUID = 1L; + + private Long id; + + /** + * 资源id + * #c_resource #c_menu + */ + @ApiModelProperty(value = "资源id") + @NotNull(message = "资源id不能为空") + @TableField("authority_id") + private Long authorityId; + + /** + * 权限类型 + * #AuthorizeType{MENU:菜单;RESOURCE:资源;} + */ + @ApiModelProperty(value = "权限类型") + @NotNull(message = "权限类型不能为空") + @TableField("authority_type") + private AuthorizeType authorityType; + + /** + * 角色id + * #c_role + */ + @ApiModelProperty(value = "角色id") + @NotNull(message = "角色id不能为空") + @TableField("role_id") + private Long roleId; + + + @Builder + public RoleAuthority(Long id, LocalDateTime createTime, Long createdBy, + Long authorityId, AuthorizeType authorityType, Long roleId) { + this.id = id; + this.createOn = createTime; + this.createBy = createdBy; + this.authorityId = authorityId; + this.authorityType = authorityType; + this.roleId = roleId; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/RoleMenu.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/RoleMenu.java new file mode 100644 index 0000000..5c1761e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/RoleMenu.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-11-11 + */ +@TableName("nd_role_menu") +@Data +@ApiModel(value = "RoleMenu对象", description = "") +@AllArgsConstructor +@NoArgsConstructor +public class RoleMenu implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("menu_id") + private Long menuId; + + @ApiModelProperty("role_id") + private Long roleId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/ScoreDeductionRule.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/ScoreDeductionRule.java new file mode 100644 index 0000000..ae76bfd --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/ScoreDeductionRule.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.sys.entity; + +import com.ningdatech.carapi.sys.entity.enumeration.CodingRuleVehicleType; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/24 下午3:23 + */ +@ApiModel("扣分规则") +@Data +public class ScoreDeductionRule { + private CodingRuleVehicleType vehicleType; + private List codingRuleInfoList; +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/TreeEntity.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/TreeEntity.java new file mode 100644 index 0000000..4a02141 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/TreeEntity.java @@ -0,0 +1,131 @@ +package com.ningdatech.carapi.sys.entity; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.Comparator; +import java.util.Set; +import java.util.TreeSet; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + * 包括id、create_time、created_by、updated_by、update_time、label、parent_id、sort_value 字段的表继承的树形实体 + * + * @author PoffyZhang + * @since 2022/09/30 + */ +@Getter +@Setter +@Accessors(chain = true) +@ToString(callSuper = true) +public class TreeEntity, T extends Serializable> extends BaseEntity { + + @TableId(value = "id", type = IdType.AUTO) + protected Long id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotEmpty(message = "名称不能为空") + @Size(max = 255, message = "名称长度不能超过255") + @TableField(value = "name", condition = LIKE) + protected String name; + + /** + * 菜单标题 + */ + @ApiModelProperty(value = "菜单标题") + @NotEmpty(message = "菜单标题不能为空") + @Size(max = 255, message = "菜单标题长度不能超过255") + @TableField(value = "title", condition = LIKE) + protected String title; + + /** + * 父菜单ID + */ + @ApiModelProperty(value = "父ID") + @TableField(value = "pid") + protected Long pid; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序号") + @TableField(value = "sort") + protected Integer sort; + + /** + * 顶层菜单 + */ + @ApiModelProperty(value = "顶层菜单") + @TableField(exist = false) + protected String topMenu; + + /** + * 路径 + */ + @ApiModelProperty(value = "路径") + @Size(max = 255, message = "路径长度不能超过255") + @TableField(value = "path", condition = LIKE) + protected String path; + + + @ApiModelProperty(value = "子节点", hidden = true) + @TableField(exist = false) + protected Set children; + + + /** + * 层级 + */ + @ApiModelProperty(value = "层级") + @TableField(exist = false) + protected Integer level = 1; + + + /** + * 初始化子类 + */ + @JsonIgnore + public void initChildren() { + if (getChildren() == null) { + Comparator> comparator = Comparator.comparing(w -> ObjectUtil.defaultIfNull(w.getSort(), 0)); + comparator = comparator.thenComparing(TreeEntity::getId); + this.setChildren(new TreeSet<>(comparator)); + } + } + + @JsonIgnore + public void addChildren(E child) { + initChildren(); + children.add(child); + } + + public Integer getSize() { + if (CollUtil.isNotEmpty(getChildren())) { + return getChildren().size(); + } + return 0; + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/UserRole.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/UserRole.java new file mode 100644 index 0000000..e8a0f41 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/UserRole.java @@ -0,0 +1,63 @@ +package com.ningdatech.carapi.sys.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + *

+ * 实体类 + * 角色分配 + * 账号角色绑定 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@TableName("nd_user_role") +@ApiModel(value = "UserRole", description = "角色分配") +public class UserRole { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 角色ID + * #c_role + */ + @ApiModelProperty(value = "角色ID") + @NotNull(message = "角色ID不能为空") + @TableField("role_id") + private Long roleId; + + /** + * 用户ID + * #c_user + */ + @ApiModelProperty(value = "用户ID") + @NotNull(message = "用户ID不能为空") + @TableField("user_id") + private Long userId; + + + @Builder + public UserRole(Long roleId, Long userId) { + this.roleId = roleId; + this.userId = userId; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/constant/ImportTemplateConstant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/constant/ImportTemplateConstant.java new file mode 100644 index 0000000..0e995ae --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/constant/ImportTemplateConstant.java @@ -0,0 +1,51 @@ +package com.ningdatech.carapi.sys.entity.constant; + +import com.ningdatech.carapi.sys.entity.enumeration.ImportTemplateEnum; + +import java.util.*; + +/** + *

+ * ImportTemplateEnumConstant + *

+ * + * @author WendyYang + * @since 20:11 2022/11/4 + */ +public class ImportTemplateConstant { + + public static final List VEHICLE_VIOLATION_COL_LIST = Arrays.asList("序号","城市","区(县)","企业名称","车牌号","车架号","行驶里程", "总累计违章次数", "万公里违章次数", "风险评估","备注"); + + public static final List VEHICLE_ACCIDENT_COL_LIST = Arrays.asList("序号","城市","区(县)","企业名称","车牌号","车架号","行驶里程", "总累计出险次数", "万公里出险次数", "风险评估","备注"); + + public static final List VEHICLE_OVER_SPEED_COL_LIST = Arrays.asList("序号","城市","区(县)","企业名称","车牌号","车架号","行驶里程", "总累计超速次数", "万公里超速次数", "风险评估","备注"); + + private static final List LAB_WORKER_CERTIFICATE = Arrays.asList("企业完整名称", "姓名", "性别", "身份证号码", "证照编号", "有效开始日期", "有效结束日期", "备注"); + + private static final List LAB_ACCEPTANCE_CERTIFICATE = Arrays.asList("证书编号", "企业完整名称", "备案项目", "执行标准", "发证机关", "发证日期", "备注", "换证日期"); + + // private fileout final List LAB_ACCEPTANCE_CERTIFICATE = Arrays.asList("证书编号", "企业名称", "备案项目", "生产能力", "执行标准", "有限期限", "发证机关", "发证日期", "备注", "换证日期"); + + public static final List VEHICLE_OUT_DANGER_COL_LIST = Arrays.asList("序号","所属区域","车牌号", "保險公司", "企业名称", "事故地点", "事故时间","受伤人数","死亡人数","理赔金额"); + + public static final List DRIVER_ARCHIVES_COL_LIST = Arrays.asList("姓名","性别","身份证号(必填)","出生年月","籍贯","手机号码","健康状况","住址","驾驶证号","准驾车型","驾驶证初次申领时间","拟驾车型","违法违规信息"); + + private static final Map> IMPORT_TEMPLATE_MAP; + + static { + IMPORT_TEMPLATE_MAP = new HashMap<>(ImportTemplateEnum.values().length); + IMPORT_TEMPLATE_MAP.put(ImportTemplateEnum.VEHICLE_ACCIDENT, VEHICLE_ACCIDENT_COL_LIST); + IMPORT_TEMPLATE_MAP.put(ImportTemplateEnum.VEHICLE_VIOLATION, VEHICLE_VIOLATION_COL_LIST); + IMPORT_TEMPLATE_MAP.put(ImportTemplateEnum.VEHICLE_OVER_SPEED, VEHICLE_OVER_SPEED_COL_LIST); + IMPORT_TEMPLATE_MAP.put(ImportTemplateEnum.LAB_WORKER_CERTIFICATE_QUA, LAB_WORKER_CERTIFICATE); + IMPORT_TEMPLATE_MAP.put(ImportTemplateEnum.LAB_WORKER_CERTIFICATE_EDU, LAB_WORKER_CERTIFICATE); + IMPORT_TEMPLATE_MAP.put(ImportTemplateEnum.LAB_ACCEPTANCE_CERTIFICATE, LAB_ACCEPTANCE_CERTIFICATE); + IMPORT_TEMPLATE_MAP.put(ImportTemplateEnum.INSURE_OUT_DANGER, VEHICLE_OUT_DANGER_COL_LIST); + IMPORT_TEMPLATE_MAP.put(ImportTemplateEnum.DRIVER_ARCHIVES,DRIVER_ARCHIVES_COL_LIST); + } + + public static List getTemplateTitle(ImportTemplateEnum template) { + return IMPORT_TEMPLATE_MAP.getOrDefault(template, Collections.emptyList()); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CascadeCodeDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CascadeCodeDTO.java new file mode 100644 index 0000000..7098536 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CascadeCodeDTO.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + *

+ * 级联字典实体 + *

+ * + * @author PoffyZhang + * @since 2023/5/11 + **/ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@ApiModel(value = "CascadeCodeDTO", description = "用于级联返回") +public class CascadeCodeDTO { + + public static CascadeCodeDTO of(String code, String name) { + return new CascadeCodeDTO(code, name, null); + } + + public static CascadeCodeDTO of(String code, String name, List list) { + return new CascadeCodeDTO(code, name, list); + } + + private String code; + + private String name; + + private List children; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CascadeDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CascadeDTO.java new file mode 100644 index 0000000..f4360d1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CascadeDTO.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import lombok.*; +import lombok.experimental.Accessors; + +import java.util.Collections; +import java.util.List; + +/** + * @Classname CascadeDTO + * @Description + * @Date 2022/11/2 13:50 + * @Created by PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "CascadeDTO", description = "用于级联返回") +public class CascadeDTO { + + public static CascadeDTO of(Long id,String name,List list){ + return new CascadeDTO(id,name,list); + } + + private Long id; + + private String name; + + private List children; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanyDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanyDTO.java new file mode 100644 index 0000000..d0deb48 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanyDTO.java @@ -0,0 +1,134 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + *

+ * 值对象 + * 企业 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "CompanyDTO", description = "企业") +@AllArgsConstructor +@Builder +public class CompanyDTO extends BaseEntity { + + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业名称") + private String name; + + /** + * 车辆数 + */ + @ApiModelProperty(value = "车辆数") + private Long vehicleNum; + + /** + * 地区ID + */ + @ApiModelProperty(value = "地区id") + private Long regionId; + + /** + * 地区 + */ + @ApiModelProperty(value = "地区") + private String regionName; + + /** + * 运营商ID + */ + @ApiModelProperty(value = "运营商ID") + private Long operatorId; + + /** + * 运营商 + */ + @ApiModelProperty(value = "运营商") + private String operatorName; + + /** + * 传真 + */ + @ApiModelProperty(value = "传真") + private String fax; + + /** + * email + */ + @ApiModelProperty(value = "email") + private String email; + + /** + * 地址 + */ + @ApiModelProperty(value = "地址") + private String address; + + /** + * 联系人 + */ + @ApiModelProperty(value = "联系人") + private String contactPerson; + + /** + * 联系方式 + */ + @ApiModelProperty(value = "联系方式") + private String contactPhone; + + /** + * 法人 + */ + @ApiModelProperty(value = "法人") + private String legalPerson; + + /** + * 法人联系电话 + */ + @ApiModelProperty(value = "法人联系电话") + private String legalPersonPhone; + + /** + * 公司类型 + */ + @ApiModelProperty(value = "公司类型") + private Integer companyType; + + /** + * 公司类型名 + */ + @ApiModelProperty(value = "公司类型名") + private String companyTypeName; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty("经度") + private String longitude; + + @ApiModelProperty("维度") + private String latitude; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanyPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanyPageQuery.java new file mode 100644 index 0000000..4b3d360 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanyPageQuery.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import java.io.Serializable; +import java.util.List; + +import com.ningdatech.basic.model.PagePo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + *

+ * 实体类 + * 企业 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "CompanyPageQuery", description = "企业") +public class CompanyPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业名称 模糊查询") + private String name; + + /** + * 所属区域id + */ + @ApiModelProperty(value = "所属区域id") + private Long regionId; + + /** + * 运营商 + */ + @ApiModelProperty(value = "运营商名字模糊查询") + private String operatorName; + + @ApiModelProperty(value = "是否失信") + private Boolean blackList; + + @ApiModelProperty(value = "公司类型 0管理企业 1生产企业 2物流企业 3其他") + private Integer companyType; + + @ApiModelProperty(value = "公司类型 0管理企业 1生产企业 2物流企业 3其他") + private List companyTypeList; + + @ApiModelProperty(value = "生产企业类型 2预拌砂浆生产企业 3预拌混凝土生产企业 4水泥生产企业") + private Integer productCompanyType; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanyQueryDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanyQueryDTO.java new file mode 100644 index 0000000..3c7d77c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanyQueryDTO.java @@ -0,0 +1,146 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; +import java.io.Serializable; +import java.util.List; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * 实体类 + * 企业 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "CompanyQueryDTO", description = "企业") +public class CompanyQueryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业名称") + private String name; + + /** + * 车辆数 + */ + @ApiModelProperty(value = "车辆数") + private Long vehicleNum; + + /** + * 地区ID + */ + @ApiModelProperty(value = "地区ID") + private Long regionId; + + /** + * 地区 + */ + @ApiModelProperty(value = "地区") + private String regionName; + + /** + * 运营商ID + */ + @ApiModelProperty(value = "运营商ID") + private Long operatorId; + + /** + * 运营商 + */ + @ApiModelProperty(value = "运营商") + private String operatorName; + + /** + * 传真 + */ + @ApiModelProperty(value = "传真") + private String fax; + + /** + * email + */ + @ApiModelProperty(value = "email") + private String email; + + /** + * 地址 + */ + @ApiModelProperty(value = "地址") + private String address; + + /** + * 联系人 + */ + @ApiModelProperty(value = "联系人") + private String contactPerson; + + /** + * 联系方式 + */ + @ApiModelProperty(value = "联系方式") + private String contactPhone; + + /** + * 法人 + */ + @ApiModelProperty(value = "法人") + private String legalPerson; + + /** + * 法人联系电话 + */ + @ApiModelProperty(value = "法人联系电话") + private String legalPersonPhone; + + /** + * 公司类型 + */ + @ApiModelProperty(value = "公司类型") + private Integer companyType; + + /** + * 公司类型名 + */ + @ApiModelProperty(value = "公司类型名") + private String companyTypeName; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 企业类型 + */ + @ApiModelProperty(value = "企业类型") + private List enterpriseTypes; + private String enterpriseTypesName; + + @ApiModelProperty(value = "营业执照编号") + private String businessLicense; + + @ApiModelProperty(value = "经度") + private String longitude; + + @ApiModelProperty(value = "纬度") + private String latitude; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanySaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanySaveDTO.java new file mode 100644 index 0000000..fcfc270 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanySaveDTO.java @@ -0,0 +1,125 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 企业 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "CompanySaveDTO", description = "企业") +public class CompanySaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业名称") + @NotEmpty(message = "请输入企业名称!") + private String name; + + /** + * 车辆数 + */ + @ApiModelProperty(value = "车辆数") + private Long vehicleNum; + + /** + * 地区id + */ + @ApiModelProperty(value = "地区id") + @NotNull(message = "请选择地区!") + private Long regionId; + + /** + * 运营商ID + */ + @ApiModelProperty(value = "运营商ID") +// @NotNull(message = "请选择运营商!") + private Long operatorId; + + /** + * 传真 + */ + @ApiModelProperty(value = "传真") + private String fax; + + /** + * email + */ + @ApiModelProperty(value = "email") + private String email; + + /** + * 地址 + */ + @ApiModelProperty(value = "地址") + private String address; + + /** + * 联系人 + */ + @ApiModelProperty(value = "联系人") + private String contactPerson; + + /** + * 联系方式 + */ + @ApiModelProperty(value = "联系方式") + private String contactPhone; + + /** + * 法人 + */ + @ApiModelProperty(value = "法人") + private String legalPerson; + + /** + * 法人联系电话 + */ + @ApiModelProperty(value = "法人联系电话") + private String legalPersonPhone; + + /** + * 公司类型 + */ + @ApiModelProperty(value = "公司类型") + private Integer companyType; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "生产企业类型") + private List enterpriseTypes; + + @ApiModelProperty(value = "营业执照编号") + private String businessLicense; + + @ApiModelProperty(value = "经度") + private String longitude; + + @ApiModelProperty(value = "纬度") + private String latitude; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanyUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanyUpdateDTO.java new file mode 100644 index 0000000..1b02dde --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/CompanyUpdateDTO.java @@ -0,0 +1,131 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 企业 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "CompanyUpdateDTO", description = "企业") +public class CompanyUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + @NotNull(message = "请传id") + private Long id; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业名称") + private String name; + + /** + * 车辆数 + */ + @ApiModelProperty(value = "车辆数") + private Long vehicleNum; + + /** + * 地区id + */ + @ApiModelProperty(value = "地区id") + private Long regionId; + + /** + * 运营商ID + */ + @ApiModelProperty(value = "运营商ID") + private Long operatorId; + + /** + * 传真 + */ + @ApiModelProperty(value = "传真") + private String fax; + + /** + * email + */ + @ApiModelProperty(value = "email") + private String email; + + /** + * 地址 + */ + @ApiModelProperty(value = "地址") + private String address; + + /** + * 联系人 + */ + @ApiModelProperty(value = "联系人") + private String contactPerson; + + /** + * 联系方式 + */ + @ApiModelProperty(value = "联系方式") + private String contactPhone; + + /** + * 法人 + */ + @ApiModelProperty(value = "法人") + private String legalPerson; + + /** + * 法人联系电话 + */ + @ApiModelProperty(value = "法人联系电话") + private String legalPersonPhone; + + /** + * 公司类型 + */ + @ApiModelProperty(value = "公司类型") + private Integer companyType; + + /** + * 公司类型名 + */ + @ApiModelProperty(value = "公司类型名") + private String companyTypeName; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "生产企业类型") + private List enterpriseTypes; + + @ApiModelProperty(value = "营业执照编号") + private String businessLicense; + + @ApiModelProperty(value = "经度") + private String longitude; + + @ApiModelProperty(value = "纬度") + private String latitude; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/GlobalUserPageDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/GlobalUserPageDTO.java new file mode 100644 index 0000000..92bb2c5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/GlobalUserPageDTO.java @@ -0,0 +1,65 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + *

+ * 实体类 + * 全局账号 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "GlobalUserSaveDTO", description = "全局账号") +public class GlobalUserPageDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 租户编号 + */ + @ApiModelProperty(value = "租户编号") + @NotEmpty(message = "租户编号不能为空") + @Size(max = 10, message = "租户编号长度不能超过10") + private String tenantCode; + /** + * 账号 + */ + @ApiModelProperty(value = "账号") + @NotEmpty(message = "账号不能为空") + @Size(max = 30, message = "账号长度不能超过30") + private String account; + /** + * 手机 + */ + @ApiModelProperty(value = "手机") + @Size(max = 20, message = "手机长度不能超过20") + private String mobile; + /** + * 姓名 + */ + @ApiModelProperty(value = "姓名") + @Size(max = 50, message = "姓名长度不能超过20") + private String name; + /** + * 邮箱 + */ + @ApiModelProperty(value = "邮箱") + @Size(max = 255, message = "邮箱长度不能超过255") + private String email; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/MenuQueryDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/MenuQueryDTO.java new file mode 100644 index 0000000..e630ea4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/MenuQueryDTO.java @@ -0,0 +1,99 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 实体类 + * 菜单 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "MenuQueryDTO", description = "菜单") +public class MenuQueryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String name; + + /** + * 标题 + */ + @ApiModelProperty(value = "标题") + private String title; + + /** + * 类型 + */ + @ApiModelProperty(value = "类型") + private Integer type; + + /** + * 页面路径 + */ + @ApiModelProperty(value = "页面路径") + private String path; + + /** + * 图标 + */ + @ApiModelProperty(value = "图标") + private String icon; + + /** + * 组件 + */ + @ApiModelProperty(value = "组件") + private String component; + + /** + * 权限 + */ + @ApiModelProperty(value = "权限") + private String permission; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + private Integer sort; + + /** + * 父菜单ID + */ + @ApiModelProperty(value = "父菜单ID") + private Long pid; + + /** + * activeMenu + */ + @ApiModelProperty(value = "activeMenu") + private String activeMenu; + + /** + * 跳转 + */ + @ApiModelProperty(value = "跳转") + private String redirect; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/MenuSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/MenuSaveDTO.java new file mode 100644 index 0000000..51e1354 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/MenuSaveDTO.java @@ -0,0 +1,99 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 实体类 + * 菜单 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "MenuSaveDTO", description = "菜单") +public class MenuSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String name; + + /** + * 标题 + */ + @ApiModelProperty(value = "标题") + @NotEmpty(message = "请输入菜单标题") + private String title; + + /** + * 类型 + */ + @ApiModelProperty(value = "类型") + @NotNull(message = "请选择类型") + private Integer type; + + /** + * 页面路径 + */ + @ApiModelProperty(value = "页面路径") + private String path; + + /** + * 图标 + */ + @ApiModelProperty(value = "图标") + private String icon; + + /** + * 组件 + */ + @ApiModelProperty(value = "组件") + private String component; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + private Integer sort; + + /** + * 父菜单ID + */ + @ApiModelProperty(value = "父菜单ID") + private Long pid; + + /** + * 是否隐藏 0不隐藏 1隐藏 + */ + @ApiModelProperty(value = "是否隐藏") + private Integer hidden; + + /** + * activeMenu + */ + @ApiModelProperty(value = "activeMenu") + private String activeMenu; + + /** + * 跳转 + */ + @ApiModelProperty(value = "跳转") + private String redirect; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/MenuUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/MenuUpdateDTO.java new file mode 100644 index 0000000..e1ce2c0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/MenuUpdateDTO.java @@ -0,0 +1,101 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 实体类 + * 菜单 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "MenuUpdateDTO", description = "菜单") +public class MenuUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + @NotNull(message = "请传id") + private Long id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String name; + + /** + * 标题 + */ + @ApiModelProperty(value = "标题") + private String title; + + /** + * 类型 + */ + @ApiModelProperty(value = "类型") + private Integer type; + + /** + * 页面路径 + */ + @ApiModelProperty(value = "页面路径") + private String path; + + /** + * 图标 + */ + @ApiModelProperty(value = "图标") + private String icon; + + /** + * 组件 + */ + @ApiModelProperty(value = "组件") + private String component; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序") + private Integer sort; + + /** + * 父菜单ID + */ + @ApiModelProperty(value = "父菜单ID") + private Long pid; + + /** + * 是否隐藏 0不隐藏 1隐藏 + */ + @ApiModelProperty(value = "是否隐藏") + private Integer hidden; + + /** + * activeMenu + */ + @ApiModelProperty(value = "activeMenu") + private String activeMenu; + + /** + * 跳转 + */ + @ApiModelProperty(value = "跳转") + private String redirect; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorPageQuery.java new file mode 100644 index 0000000..26a6c2d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorPageQuery.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 实体类 + * 运营商 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "OperatorPageQuery", description = "运营商") +public class OperatorPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 运营商名称 + */ + @ApiModelProperty(value = "运营商名称") + private String name; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorQueryDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorQueryDTO.java new file mode 100644 index 0000000..04de177 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorQueryDTO.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.ningdatech.carapi.sys.entity.OperatorRegionHead; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 实体类 + * 运营商 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "OperatorQueryDTO", description = "运营商") +public class OperatorQueryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + /** + * 运营商名称 + */ + @ApiModelProperty(value = "运营商名称") + private String name; + + /** + * 运营商备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 区域负责人 + */ + @ApiModelProperty(value = "区域负责人") + private List operatorRegionHeads; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private LocalDateTime createOn; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorRegionHeadSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorRegionHeadSaveDTO.java new file mode 100644 index 0000000..1f04c1d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorRegionHeadSaveDTO.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; +import java.io.Serializable; + +/** + *

+ * 实体类 + * 运营商 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "OperatorRegionHeadSaveDTO", description = "运营商") +public class OperatorRegionHeadSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 区域负责人 + */ + @ApiModelProperty(value = "区域负责人") + private String regionalHead; + + /** + * 区域id + */ + @ApiModelProperty(value = "区域id") + private Long regionId; + + /** + *联系电话 + */ + @ApiModelProperty(value = "联系电话") + private String mobile; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorSaveDTO.java new file mode 100644 index 0000000..3a57ef6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorSaveDTO.java @@ -0,0 +1,50 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 运营商 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "OperatorSaveDTO", description = "运营商") +public class OperatorSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 运营商名称 + */ + @ApiModelProperty(value = "运营商名称") + @NotEmpty(message = "请输入运营商名称!") + private String name; + + /** + * 运营商备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 运营商区域负责人 + */ + @ApiModelProperty(value = "运营商区域负责人") + private List operatorRegionHeads; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorUpdateDTO.java new file mode 100644 index 0000000..e3df750 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/OperatorUpdateDTO.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 运营商 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "OperatorUpdateDTO", description = "运营商") +public class OperatorUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + @NotNull(message = "请传id") + private Long id; + + /** + * 运营商名称 + */ + @ApiModelProperty(value = "运营商名称") + private String name; + + /** + * 运营商备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 运营商区域负责人 + */ + @ApiModelProperty(value = "运营商区域负责人") + private List operatorRegionHeads; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/PageParamsDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/PageParamsDTO.java new file mode 100644 index 0000000..cca5197 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/PageParamsDTO.java @@ -0,0 +1,87 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotNull; +import java.util.HashMap; +import java.util.Map; + +/** + * 分页参数 + * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@ApiModel(value = "PageParams", description = "分页参数") +public class PageParamsDTO { + + @NotNull(message = "查询对象model不能为空") + @ApiModelProperty(value = "查询参数", required = true) + private T model; + + @ApiModelProperty(value = "页面大小", example = "10") + private Long size = 10L; + + @ApiModelProperty(value = "当前页", example = "1") + private Long current = 1L; + + @ApiModelProperty(value = "排序规则, 默认descending", allowableValues = "descending,ascending", example = "descending") + private String order = "descending"; + + @ApiModelProperty("扩展参数") + private Map extra = new HashMap<>(16); + + + public PageParamsDTO(long current, long size) { + this.size = size; + this.current = current; + } + + /** + * 构建分页对象 + * + * @return 分页对象 + */ + @JsonIgnore + public IPage buildPage() { + PageParamsDTO params = this; + return new Page<>(params.getCurrent(), params.getSize()); + } + + /** + * 计算当前分页偏移量 + */ + @JsonIgnore + public long offset() { + long current = this.current; + if (current <= 1L) { + return 0L; + } + return (current - 1) * this.size; + } + + @JsonIgnore + public PageParamsDTO put(String key, Object value) { + if (this.extra == null) { + this.extra = new HashMap<>(16); + } + this.extra.put(key, value); + return this; + } + + @JsonIgnore + public PageParamsDTO putAll(Map extra) { + if (this.extra == null) { + this.extra = new HashMap<>(16); + } + this.extra.putAll(extra); + return this; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RegionDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RegionDTO.java new file mode 100644 index 0000000..ee4fd63 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RegionDTO.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Tolerate; + +/** + * @author liuxinxin + * @date 2022/7/22 上午9:12 + */ +@Data +@Builder +public class RegionDTO { + + @Tolerate + public RegionDTO() { + } + + /** + * 区域码 + */ + private String regionCode; + + /** + * 地区名 + */ + private String regionName; + + /** + * 地区级别 + */ + private Integer regionLevel; + + /** + * 地区父级code 当parent_code 为 -1 时为顶级区域 + */ + private String parentCode; + + /** + * 唯一编码:regionCode##regionName##regionLevel + */ + private String unionCode; + + private Long id; + + private String mapData; + + private Boolean deleted; + + private String govUnit; + + private Long parentId; + + public void unionCode() { + this.unionCode = String.format("%s##%s##%s", this.regionCode, this.regionName, this.regionLevel); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RegionInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RegionInfo.java new file mode 100644 index 0000000..059723b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RegionInfo.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/9 上午10:46 + */ +@Data +@ApiModel(description = "区域信息") +public class RegionInfo { + + @ApiModelProperty("区域code") + private String regionCode; + + @ApiModelProperty("区域级别") + private Integer regionLevel; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RegionMapKey.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RegionMapKey.java new file mode 100644 index 0000000..c97565a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RegionMapKey.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import lombok.Data; + +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2022/7/22 上午10:07 + */ +@Data +public class RegionMapKey { + + /** + * 区域码 + */ + private String regionCode; + /** + * 地区级别 + */ + private Integer regionLevel; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RegionMapKey key = (RegionMapKey) o; + return regionCode.equals(key.getRegionCode()) && regionLevel.equals(key.getRegionLevel()); + } + + @Override + public int hashCode() { + return Objects.hash(regionCode, regionLevel); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RegionTreeDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RegionTreeDTO.java new file mode 100644 index 0000000..1109ae4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RegionTreeDTO.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/7/22 上午9:08 + */ +@Data +public class RegionTreeDTO { + + /** + * 区域码 + */ + private String regionCode; + + /** + * 地区名 + */ + private String name; + + /** + * 地区级别 + */ + private Integer level; + + /** + * 地区父级code 当parent_code 为 -1 时为顶级区域 + */ + private String parentCode; + + private String unionCode; + + private List children; + + private Long id; + + private String mapData; + + private Boolean deleted; + + private String govUnit; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/ResourceQueryDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/ResourceQueryDTO.java new file mode 100644 index 0000000..451eb92 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/ResourceQueryDTO.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.sys.entity.dto; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 资源 查询DTO + * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@ApiModel(value = "ResourceQueryDTO", description = "资源查询") +public class ResourceQueryDTO { + + /** + * 父资源id, 用于查询按钮 + */ + @ApiModelProperty(value = "菜单id", notes = "指定菜单id") + private Long menuId; + /** + * 登录人用户id + */ + @ApiModelProperty(value = "指定用户id", notes = "指定用户id,前端不传则自动获取") + private Long userId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/ResourceSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/ResourceSaveDTO.java new file mode 100644 index 0000000..bb19287 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/ResourceSaveDTO.java @@ -0,0 +1,63 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + *

+ * 实体类 + * 资源 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "ResourceSaveDTO", description = "资源") +public class ResourceSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 编码 + */ + @ApiModelProperty(value = "编码") + @Size(max = 500, message = "编码长度不能超过500") + private String code; + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotEmpty(message = "名称不能为空") + @Size(max = 255, message = "名称长度不能超过255") + private String name; + /** + * 菜单ID + * #c_menu + */ + @ApiModelProperty(value = "菜单ID") + private Long menuId; + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + @Size(max = 255, message = "描述长度不能超过255") + private String describe; + /** + * 内置 + */ + @ApiModelProperty(value = "内置") + private Boolean readonly; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/ResourceUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/ResourceUpdateDTO.java new file mode 100644 index 0000000..0fcbb95 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/ResourceUpdateDTO.java @@ -0,0 +1,68 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.baomidou.mybatisplus.core.conditions.update.Update; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + *

+ * 实体类 + * 资源 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "ResourceUpdateDTO", description = "资源") +public class ResourceUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @NotNull(message = "id不能为空", groups = Update.class) + private Long id; + + /** + * 编码 + */ + @ApiModelProperty(value = "编码") + @Size(max = 500, message = "编码长度不能超过500") + private String code; + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotEmpty(message = "名称不能为空") + @Size(max = 255, message = "名称长度不能超过255") + private String name; + /** + * 菜单ID + * #c_menu + */ + @ApiModelProperty(value = "菜单ID") + private Long menuId; + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + @Size(max = 255, message = "描述长度不能超过255") + private String describe; + /** + * 内置 + */ + @ApiModelProperty(value = "内置") + private Boolean readonly; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleAuthoritySaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleAuthoritySaveDTO.java new file mode 100644 index 0000000..a5e6b5a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleAuthoritySaveDTO.java @@ -0,0 +1,53 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 角色的资源 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "RoleAuthoritySaveDTO", description = "角色的资源") +public class RoleAuthoritySaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 菜单ID + * #c_menu + */ + @ApiModelProperty(value = "资源ID") + private List menuIdList; + + /** + * 资源id + * #c_resource + */ + private List resourceIdList; + + /** + * 角色id + * #c_role + */ + @ApiModelProperty(value = "角色id") + @NotNull(message = "角色id不能为空") + private Long roleId; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RolePageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RolePageQuery.java new file mode 100644 index 0000000..f7d91bf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RolePageQuery.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + *

+ * 实体类 + * 角色 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "RolePageQuery", description = "角色") +public class RolePageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String name; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleQueryDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleQueryDTO.java new file mode 100644 index 0000000..797b7b8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleQueryDTO.java @@ -0,0 +1,49 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 角色 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "RoleQueryDTO", description = "角色") +public class RoleQueryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + @ApiModelProperty(value = "ID") + private Long id; + + /** + * 角色名称 + */ + @ApiModelProperty(value = "角色名称") + private String name; + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + private String describe; + + /** + * 数据范围 + */ + @ApiModelProperty(value = "数据范围") + private Integer dataScope; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleSaveDTO.java new file mode 100644 index 0000000..67ec975 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleSaveDTO.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 角色 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "RoleSaveDTO", description = "角色") +public class RoleSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @NotEmpty(message = "名称不能为空") + @Size(max = 50, message = "名称长度不能超过50") + private String name; + + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + @Size(max = 200, message = "描述长度不能超过200") + private String describe; + + /** + * 数据范围 + */ + @ApiModelProperty(value = "数据范围 1全部 2本区域 3本区域以及下区域 4本公司") + @NotNull(message = "请选择数据范围") + private Integer dataScope; + + + /** + * 菜单id + */ + @ApiModelProperty(value = "菜单id") + private List menuIds; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleUpdateDTO.java new file mode 100644 index 0000000..29eb666 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleUpdateDTO.java @@ -0,0 +1,64 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.baomidou.mybatisplus.core.conditions.update.Update; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 角色 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "RoleUpdateDTO", description = "角色") +public class RoleUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + @NotNull(message = "id不能为空", groups = Update.class) + private Long id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + @Size(max = 50, message = "名称长度不能超过30") + private String name; + + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + @Size(max = 200, message = "描述长度不能超过200") + private String describe; + + /** + * 数据范围 + */ + @ApiModelProperty(value = "数据范围 1全部 2本区域 3本区域以及下区域 4本公司") + private Integer dataScope; + + /** + * 菜单id + */ + @ApiModelProperty(value = "菜单id") + private List menuIds; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleUserSaveVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleUserSaveVO.java new file mode 100644 index 0000000..10ab420 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/RoleUserSaveVO.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 角色下的员工 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "RoleUserSaveVO", description = "给角色分配员工") +public class RoleUserSaveVO implements Serializable { + + private static final long serialVersionUID = 1L; + @ApiModelProperty(value = "绑定或取消") + @NotNull(message = "请填写绑定或取消参数") + private Boolean flag; + /** + * 角色;#c_role + */ + @ApiModelProperty(value = "角色") + @NotNull(message = "请选择角色") + private Long roleId; + /** + * 用户;#c_user + */ + @ApiModelProperty(value = "用户") + @Size(min = 1, message = "请选择用户") + private List userIdList; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserPageQuery.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserPageQuery.java new file mode 100644 index 0000000..f09ca8a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserPageQuery.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.ningdatech.basic.model.PagePo; +import com.ningdatech.basic.model.PageVo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 用户 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "UserPageQuery", description = "用户") +public class UserPageQuery extends PagePo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户姓名 + */ + @ApiModelProperty(value = "用户姓名") + private String username; + + /** + * 登录帐号 + */ + @ApiModelProperty(value = "登录帐号") + private String account; + + /** + * 用户角色id + */ + @ApiModelProperty(value = "用户角色id") + private Long roleId; + + /** + * 所属企业 + */ + @ApiModelProperty(value = "所属企业") + private String companyName; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserQueryDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserQueryDTO.java new file mode 100644 index 0000000..aec07f1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserQueryDTO.java @@ -0,0 +1,132 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * 实体类 + * 用户 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "UserQueryDTO", description = "用户") +public class UserQueryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + /** + * 账号 + */ + @ApiModelProperty(value = "账号") + private String account; + + /** + * 用户姓名 + */ + @ApiModelProperty(value = "用户姓名") + private String username; + + /** + * 角色 + */ + @ApiModelProperty(value = "角色") + private Long role; + + /** + * 角色名称 + */ + @ApiModelProperty(value = "角色名称") + private String roleName; + + /** + * 企业 + */ + @ApiModelProperty(value = "企业id") + private Long companyId; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业名称") + private String companyName; + + /** + * 公司行业 + */ + @ApiModelProperty(value = "行业id") + private Long industry; + + /** + * 行业名称 + */ + @ApiModelProperty(value = "行业名称") + private String industryName; + + /** + * 手机 + */ + @ApiModelProperty(value = "手机") + private String mobile; + + /** + * 密码 + */ + @ApiModelProperty(value = "密码") + private String password; + + /** + * 最后登录时间 + */ + @ApiModelProperty(value = "最后登录时间") + private LocalDateTime lastLoginTime; + + /** + * 职位 + */ + @ApiModelProperty(value = "职位") + private String position; + + /** + * 科室 + */ + @ApiModelProperty(value = "科室") + private String sectionOffice; + + /** + * 昵称 + */ + @ApiModelProperty(value = "昵称") + private String nickName; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserRoleSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserRoleSaveDTO.java new file mode 100644 index 0000000..e2122cc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserRoleSaveDTO.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 实体类 + * 角色分配 + * 账号角色绑定 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "UserRoleSaveDTO", description = "角色分配 账号角色绑定") +public class UserRoleSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 角色ID + * #c_role + */ + @ApiModelProperty(value = "角色ID") + @NotNull(message = "请选择角色") + private Long roleId; + /** + * 用户ID + * #c_user + */ + @ApiModelProperty(value = "用户ID") + private List userIdList; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserSaveDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserSaveDTO.java new file mode 100644 index 0000000..f033bcb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserSaveDTO.java @@ -0,0 +1,111 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * 实体类 + * 用户 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "UserSaveDTO", description = "用户") +public class UserSaveDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 账号 + */ + @ApiModelProperty(value = "账号") + @NotEmpty(message = "请输入账号!") + @Size(max = 50, message = "账号长度不能超过30") + private String account; + + /** + * 用户姓名 + */ + @ApiModelProperty(value = "用户姓名") + @NotEmpty(message = "请输入用户姓名!") + @Size(max = 50, message = "用户姓名长度不能超过50") + private String username; + + /** + * 角色 + */ + @ApiModelProperty(value = "角色") + @NotNull(message = "请选择角色") + private Long role; + + /** + * 企业 + */ + @ApiModelProperty(value = "企业id") + @NotNull(message = "请选择企业") + private Long companyId; + + /** + * 公司行业 + */ + @ApiModelProperty(value = "行业id") + private Long industry; + + /** + * 手机 + */ + @ApiModelProperty(value = "手机") + @NotBlank(message = "手机号不能为空") + @Size(max = 20, message = "手机长度不能超过20") + private String mobile; + + /** + * 密码 + */ + @ApiModelProperty(value = "密码") + @NotEmpty(message = "密码不能为空") + @Size(max = 50, message = "密码长度不能超过64") + private String password; + + /** + * 职位 + */ + @ApiModelProperty(value = "职位") + @Size(max = 50, message = "职位长度不能超过50") + private String position; + + /** + * 科室 + */ + @ApiModelProperty(value = "科室") + @Size(max = 50, message = "科室长度不能超过50") + private String sectionOffice; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + @Size(max = 200, message = "备注不能超过200") + private String remark; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserUpdateDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserUpdateDTO.java new file mode 100644 index 0000000..63cc9f6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/dto/UserUpdateDTO.java @@ -0,0 +1,113 @@ +package com.ningdatech.carapi.sys.entity.dto; + +import com.baomidou.mybatisplus.core.conditions.update.Update; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 实体类 + * 用户 + *

+ * + * @author PoffyZhang + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = false) +@Builder +@ApiModel(value = "UserUpdateDTO", description = "用户") +public class UserUpdateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + @NotNull(message = "id不能为空") + private Long id; + + /** + * 账号 + */ + @ApiModelProperty(value = "账号") + @Size(max = 50, message = "账号长度不能超过30") + private String account; + + /** + * 密码 + */ + @ApiModelProperty(value = "密码") + @Size(max = 50, message = "密码长度不能超过50") + private String password; + + /** + * 用户姓名 + */ + @ApiModelProperty(value = "用户姓名") + @Size(max = 50, message = "用户姓名长度不能超过50") + private String username; + + /** + * 角色 + */ + @ApiModelProperty(value = "角色") + private Long role; + + /** + * 企业 + */ + @ApiModelProperty(value = "企业id") + private Long companyId; + + /** + * 公司行业 + */ + @ApiModelProperty(value = "行业id") + private Long industry; + + /** + * 手机 + */ + @ApiModelProperty(value = "手机") + @Size(max = 20, message = "手机长度不能超过20") + private String mobile; + + /** + * 最后登录时间 + */ + @ApiModelProperty(value = "最后登录时间") + private LocalDateTime lastLoginTime; + + /** + * 职位 + */ + @ApiModelProperty(value = "职位") + @Size(max = 50, message = "职位长度不能超过50") + private String position; + + /** + * 科室 + */ + @ApiModelProperty(value = "科室") + @Size(max = 50, message = "科室长度不能超过50") + private String sectionOffice; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + @Size(max = 200, message = "备注不能超过200") + private String remark; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/AuthorizeType.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/AuthorizeType.java new file mode 100644 index 0000000..e0ec9a3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/AuthorizeType.java @@ -0,0 +1,61 @@ +package com.ningdatech.carapi.sys.entity.enumeration; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.stream.Stream; + +/** + *

+ * 实体注释中生成的类型枚举 + * 角色的资源 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "AuthorizeType", description = "权限类型-枚举") +public enum AuthorizeType { + + /** + * MENU="菜单" + */ + MENU("菜单"), + DATA("数据"), + /** + * RESOURCE="资源" + */ + RESOURCE("资源"), + ; + + @ApiModelProperty(value = "描述") + private String desc; + + + /** + * 根据当前枚举的name匹配 + */ + public static AuthorizeType match(String val, AuthorizeType def) { + return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def); + } + + public static AuthorizeType get(String val) { + return match(val, null); + } + + public boolean eq(AuthorizeType val) { + return val != null && getCode().equals(val.name()); + } + + @ApiModelProperty(value = "编码", allowableValues = "MENU,RESOURCE", example = "MENU") + public String getCode() { + return this.name(); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/BooleanDisplayEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/BooleanDisplayEnum.java new file mode 100644 index 0000000..3df3375 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/BooleanDisplayEnum.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.sys.entity.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/7/26 上午9:21 + */ +@AllArgsConstructor +@Getter +public enum BooleanDisplayEnum { + + /** + * true + */ + Y, + + /** + * false + */ + N; + + public static Boolean judgeBoolean(String key) { + return Y.name().equals(key); + } + + public static BooleanDisplayEnum judgeBoolean(Boolean key) { + return key ? Y : N; + } + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/CodingRuleBehaviorTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/CodingRuleBehaviorTypeEnum.java new file mode 100644 index 0000000..eb20651 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/CodingRuleBehaviorTypeEnum.java @@ -0,0 +1,144 @@ +package com.ningdatech.carapi.sys.entity.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/20 上午11:31 + * 赋码规则行为类型 + */ +@AllArgsConstructor +@Getter +public enum CodingRuleBehaviorTypeEnum { + + /** + * 加分项 + */ + // 观看视频 + watch_video, + // 观看材料 + watch_profile, + // 完成考试 + complete_the_exam, + + /** + * 扣分项 + */ + + //驾驶员异常行为扣分 + //主动抓拍事件 + adas_initiative_capture_events, + + //前向碰撞报警 + forward_collision_warning, + + //车道偏离(左)报警 + lane_departure_left_warning, + + //车道偏离(右)报警 + lane_departure_right_warning, + + //频繁变道报警 + change_lanes_frequently_warning, + + //车距过近(前车)报警 + distance_too_close_warning, + + //行人碰撞报警 + pedestrian_collisions_warning, + + //不礼让行人 + no_comity_pedestrian, + + //道路标志识别事件 + road_sign_recognition_event, + + //道路标识超速报警 + road_signs_overspeed_warning, + + //路口快速通过报警 + crossroads_quickly_through_warning, + + //DSM主动抓拍事件 + dsm_initiative_capture_events, + + //探头遮挡报警 + probe_cover_alarm, + + //驾驶员人脸身份识别事件 + driver_face_identification_events, + + //换人驾驶报警 + substitution_driving_alarm, + + //超时驾驶报警 + driver_timeout_alarm, + + //疲劳驾驶报警 + fatigue_driving_alarm, + + //接打手持电话报警 + holding_a_call_alarm, + + //抽烟报警 + smoke_alarm, + + //分神驾驶报警 + distracted_driving_alarm, + + //驾驶员状态异常报警 + driver_abnormal_state_alarm, + + //未系安全带报警 + not_wearing_seatbelt_alarm, + + //驾驶员身份异常报警 + driver_abnormal_status_alarm, + + //后方接近报警 + close_behind_alarm, + + //左侧后方接近 + left_rear_near_alarm, + + //右侧后方接近报警 + right_rear_near_alarm, + + //死亡出险 + death_out_danger, + //受伤出险 + injured_out_danger, + //死亡事故 + death_accident, + //受伤事故 + injured_accident, + + //// 疲劳驾驶 + //fatigue_driving, + //// 接打电话 + //answer_and_make_calls, + //// 抽烟驾驶 + //smoking_driving, + //// 分神驾驶 + //distracted_driving, + //// 超速驾驶 + //overspeed_driving, + //// 闯禁行区域 + //breaking_the_forbidden_area, + //// 闯红灯 + //running_a_red_light, + //// 驾驶员异常 + //driver_abnormal, + //// 探头遮挡 + //probe_shielding, + //// 未系安全带 + //not_wearing_seat_belt, + //// 双手脱离方向盘 + //get_your_hands_off_the_steering_wheel, + //// 伤人事故 + //injuries, + //// 闯禁行时段 + //time_for_breaking_the_ban; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/CodingRuleVehicleType.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/CodingRuleVehicleType.java new file mode 100644 index 0000000..d2c3875 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/CodingRuleVehicleType.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.sys.entity.enumeration; + +/** + * @author liuxinxin + * @date 2022/10/24 下午2:09 + * 赋码规则车辆类型 + */ +public enum CodingRuleVehicleType { + + // 散装水泥运输车 + BULK_CEMENT_TRUCK, + + // 预拌砂浆运输车 + READY_MIXED_MORTAR_TRUC, + + // 混凝土搅拌车 + MIXER, + + // 移动泵车 + KRHP + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/ImportTemplateEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/ImportTemplateEnum.java new file mode 100644 index 0000000..704baba --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/ImportTemplateEnum.java @@ -0,0 +1,40 @@ +package com.ningdatech.carapi.sys.entity.enumeration; + +import lombok.Getter; + +/** + *

+ * 导入模版枚举 + *

+ * + * @author WendyYang + * @since 2022-11-04 + */ +@Getter +public enum ImportTemplateEnum { + + /** + * 通用导入模版枚举 + */ + VEHICLE_ACCIDENT("车辆出险情况"), + + VEHICLE_VIOLATION("车辆违章情况"), + + VEHICLE_OVER_SPEED("车辆超速情况"), + + LAB_WORKER_CERTIFICATE_QUA("实验室人员从业资格证"), + LAB_WORKER_CERTIFICATE_EDU("实验室人员继续教育合格证"), + + LAB_ACCEPTANCE_CERTIFICATE("实验室验收合格证"), + + INSURE_OUT_DANGER("保险出险导入"), + + DRIVER_ARCHIVES("驾驶员档案导入"); + + private final String value; + + ImportTemplateEnum(String value) { + this.value = value; + } + +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/MenuTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/MenuTypeEnum.java new file mode 100644 index 0000000..927b55c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/MenuTypeEnum.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.sys.entity.enumeration; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 资源类型 + * + * @author PoffyZhang + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value = "MenuTypeEnum", description = "资源类型-枚举") +public enum MenuTypeEnum { + /** + * 菜单 + */ + MENU(0, "菜单"), + + /** + * 按钮 + */ + BUTTON(1, "按钮"); + + /** + * 资源类型 + */ + private Integer code; + + /** + * 资源描述 + */ + private String desc; + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + @ApiModelProperty(value = "编码", allowableValues = "0,1", example = "0") + public Integer getCode() { + return this.code; + } + + + public boolean eq(String val) { + return this.name().equals(val); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/MetaApplyStatusEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/MetaApplyStatusEnum.java new file mode 100644 index 0000000..89bc92a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/MetaApplyStatusEnum.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.sys.entity.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/15 下午2:37 + */ +@AllArgsConstructor +@Getter +public enum MetaApplyStatusEnum { + + /** + * 材料初审中 + */ + FIRST_TRIAL_UNDER_REVIEW, + + /** + * 材料复核中 + */ + REEXAMINATION_UNDER_REVIEW, + + + /** + * 材料初审通过 + */ + FIRST_TRIAL_APPROVED, + + /** + * 材料复核通过 + */ + REEXAMINATION_APPROVED, + + /** + * 材料初审驳回 + */ + FIRST_TRIAL_APPROVAL_REJECTION, + + /** + * 材料复核驳回 + */ + REEXAMINATION_APPROVAL_REJECTION + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/MetaApplyTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/MetaApplyTypeEnum.java new file mode 100644 index 0000000..3842d4f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/MetaApplyTypeEnum.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.sys.entity.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/10/15 下午2:37 + */ +@AllArgsConstructor +@Getter +public enum MetaApplyTypeEnum { + + /** + * 初审审核 + */ + PRELIMINARY_REVIEW, + + /** + * 复审审核 + */ + IN_REVIEW +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/RoleEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/RoleEnum.java new file mode 100644 index 0000000..3c90bd4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/RoleEnum.java @@ -0,0 +1,34 @@ +package com.ningdatech.carapi.sys.entity.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +/** + * @author liuxinxin + * @date 2022/10/17 上午11:15 + */ + +@AllArgsConstructor +@Getter +public enum RoleEnum { + /** + * 駕駛員 + */ + DRIVER("DRIVER"); + + private final String key; + + public static boolean contains(String key) { + if (StringUtils.isBlank(key)) { + return false; + } + for (RoleEnum roleEnum : RoleEnum.values()) { + if (roleEnum.key.equals(key)) { + return true; + } + } + return false; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/RuleOperationTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/RuleOperationTypeEnum.java new file mode 100644 index 0000000..450f211 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/enumeration/RuleOperationTypeEnum.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.sys.entity.enumeration; + +/** + * @author liuxinxin + * @date 2022/10/24 下午2:03 + * 赋码规则 + */ + +public enum RuleOperationTypeEnum { + + // 加分 + bonus_points, + + // 减分 + score_deduction; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/req/RegionDeleteReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/req/RegionDeleteReq.java new file mode 100644 index 0000000..ba4a55e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/req/RegionDeleteReq.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.sys.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * RegionDeleteReq + *

+ * + * @author WendyYang + * @since 14:37 2022/10/12 + */ +@Data +@ApiModel(description = "地区删除参数实体") +public class RegionDeleteReq { + + @ApiModelProperty("id") + @NotNull(message = "id不能为空") + private Long id; + + @ApiModelProperty("地区级别") + @NotNull(message = "地区级别不能为空") + private Integer level; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/req/RegionTreeReq.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/req/RegionTreeReq.java new file mode 100644 index 0000000..029dece --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/req/RegionTreeReq.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.sys.entity.req; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + *

+ * RegionTreeReq + *

+ * + * @author WendyYang + * @since 20:12 2022/10/31 + */ +@Data +public class RegionTreeReq { + + /** + * 是否返回公司信息 + */ + private Boolean withCompany = false; + + /** + * 是否返回车牌号信息 + */ + private Boolean withCarNo = false; + + private Boolean withDevice = false; + + @ApiModelProperty("所选区域Id") + private Long regionId; + + @ApiModelProperty("所选区域Id列表") + private List regionIdList; + + @ApiModelProperty("查询车牌号") + private String carPlate; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/req/ReqCodingRulePO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/req/ReqCodingRulePO.java new file mode 100644 index 0000000..541ca0d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/req/ReqCodingRulePO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.sys.entity.req; + +import com.ningdatech.carapi.sys.entity.BonusPointsRule; +import com.ningdatech.carapi.sys.entity.ScoreDeductionRule; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/24 下午3:01 + */ +@Data +@ApiModel("赋码规则VO") +public class ReqCodingRulePO { + + @ApiModelProperty("加分规则") + public BonusPointsRule bonusPointsRule; + + @ApiModelProperty("减分规则") + public List scoreDeductionRuleList; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/CarInfoVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/CarInfoVO.java new file mode 100644 index 0000000..68fabc2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/CarInfoVO.java @@ -0,0 +1,37 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.util.List; +import java.util.Map; + +/** + *

+ * RegionTreeVO + *

+ * + * @author WendyYang + * @since 10:35 2022/10/12 + */ +@Data +@ToString(callSuper = true) +@ApiModel(value = "CarInfoVO", description = "车辆树状结构VO") +public class CarInfoVO { + + @ApiModelProperty("车辆所属企业ID") + private Long companyId; + + @ApiModelProperty("车牌号") + private String carPlate; + + @ApiModelProperty("车辆状态") + private Integer moving; + + @ApiModelProperty("车辆所属设备信息") + private Map> equipmentInfoMap; + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/CarVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/CarVO.java new file mode 100644 index 0000000..fc15909 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/CarVO.java @@ -0,0 +1,22 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author PoffyZhang + * @Classname CarVO + * @Description + * @Date 2022/12/5 15:22 + */ +@Data +public class CarVO { + @ApiModelProperty(value = "车牌号") + private String carPlate; + + @ApiModelProperty("车辆状态 0离线 1在线 2异常") + private Integer status; + + @ApiModelProperty("车辆是否行驶 0没有行驶 1行驶中") + private Integer moving; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/CompanyCarInfoVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/CompanyCarInfoVO.java new file mode 100644 index 0000000..01a4444 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/CompanyCarInfoVO.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import java.util.List; +import java.util.Map; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +/** + *

+ * RegionTreeVO + *

+ * + * @author WendyYang + * @since 10:35 2022/10/12 + */ +@Data +@ToString(callSuper = true) +@ApiModel(value = "CompanyCarInfoVO", description = "企业车辆树状结构VO") +public class CompanyCarInfoVO { + + @ApiModelProperty("所选区域Id") + private Long regionId; + + @ApiModelProperty("企业信息列表") + private List companyList; + + @ApiModelProperty("企业下车辆信息") + private Map> carInfoMap; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/CompanyVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/CompanyVO.java new file mode 100644 index 0000000..34ea016 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/CompanyVO.java @@ -0,0 +1,162 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import java.util.List; + +import com.ningdatech.carapi.common.base.BaseEntity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + *

+ * 实体类 + * 企业 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "CompanyVO", description = "企业") +@AllArgsConstructor +@Builder +public class CompanyVO extends BaseEntity { + + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业名称") + private String name; + + /** + * 车辆数 + */ + @ApiModelProperty(value = "车辆数") + private Long vehicleNum; + + private Long employeesNum; + + /** + * 地区ID + */ + @ApiModelProperty(value = "地区id") + private Long regionId; + + /** + * 地区 + */ + @ApiModelProperty(value = "地区") + private String regionName; + + /** + * 运营商ID + */ + @ApiModelProperty(value = "运营商ID") + private Long operatorId; + + /** + * 运营商 + */ + @ApiModelProperty(value = "运营商") + private String operatorName; + + /** + * 传真 + */ + @ApiModelProperty(value = "传真") + private String fax; + + /** + * email + */ + @ApiModelProperty(value = "email") + private String email; + + /** + * 地址 + */ + @ApiModelProperty(value = "地址") + private String address; + + /** + * 联系人 + */ + @ApiModelProperty(value = "联系人") + private String contactPerson; + + /** + * 联系方式 + */ + @ApiModelProperty(value = "联系方式") + private String contactPhone; + + /** + * 法人 + */ + @ApiModelProperty(value = "法人") + private String legalPerson; + + /** + * 法人联系电话 + */ + @ApiModelProperty(value = "法人联系电话") + private String legalPersonPhone; + + /** + * 公司类型 + */ + @ApiModelProperty(value = "公司类型") + private Integer companyType; + + /** + * 公司类型名 + */ + @ApiModelProperty(value = "公司类型名") + private String companyTypeName; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 是否失信 + */ + @ApiModelProperty(value = "是否失信") + private Boolean blackList; + + /** + * 营业执照 + */ + @ApiModelProperty(value = "营业执照") + private String businessLicense; + + /** + * 企业类型ids + */ + @ApiModelProperty(value = "企业类型ids") + private List companyTypeIds; + + @ApiModelProperty(value = "经度") + private String longitude; + + @ApiModelProperty(value = "纬度") + private String latitude; + + @ApiModelProperty("企业风险等级") + private String dangerLevel; + + @ApiModelProperty("企业风险名称") + private String dangerLevelName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/EquipmentInfoVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/EquipmentInfoVO.java new file mode 100644 index 0000000..316a4f3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/EquipmentInfoVO.java @@ -0,0 +1,33 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +/** + *

+ * RegionTreeVO + *

+ * + * @author WendyYang + * @since 10:35 2022/10/12 + */ +@Data +@ToString(callSuper = true) +@ApiModel(value = "EquipmentInfoVO", description = "车辆设备树状结构VO") +public class EquipmentInfoVO { + + @ApiModelProperty("设备所属车辆车牌号") + private String carPlate; + + @ApiModelProperty("设备视频状态") + private String videoStatus; + + @ApiModelProperty("设备ID") + private String deviceId; + + @ApiModelProperty("设备名称") + private String deviceName; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/MenuResourceTreeVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/MenuResourceTreeVO.java new file mode 100644 index 0000000..4210eba --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/MenuResourceTreeVO.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ningdatech.carapi.sys.entity.TreeEntity; +import com.ningdatech.carapi.sys.entity.enumeration.AuthorizeType; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import javax.validation.constraints.Size; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + * menuList + * 菜单资源树 + * + * @author PoffyZhang + */ +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class MenuResourceTreeVO extends TreeEntity { + + private AuthorizeType type; + private String code; + private String icon; + private Boolean isDef; + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + @Size(max = 200, message = "描述长度不能超过200") + @TableField(value = "describe_", condition = LIKE) + private String describe; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/MenuRoleVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/MenuRoleVO.java new file mode 100644 index 0000000..bde50af --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/MenuRoleVO.java @@ -0,0 +1,77 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ningdatech.carapi.sys.entity.TreeEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + *

+ * 实体类 + * 菜单 + *

+ * + * @author PoffyZhang + * @since 2022-9-30 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "RoleMenuVO", description = "菜单") +@AllArgsConstructor +public class MenuRoleVO extends TreeEntity { + + private static final long serialVersionUID = 1L; + + /** + * 权限" + */ + @ApiModelProperty(value = "权限") + private String permission; + /** + * 类型;[0-菜单 1-目录 2-按钮] + */ + @ApiModelProperty(value = "类型") + private Integer type; + + /** + * 组件 + */ + @ApiModelProperty(value = "组件") + private String component; + + /** + * 菜单图标 + */ + @ApiModelProperty(value = "菜单图标") + private String icon; + + /** + * 是否隐藏 + */ + @ApiModelProperty(value = "是否隐藏") + private Integer hidden; + + /** + * 是否有权限 + */ + @ApiModelProperty(value = "是否有权限 0没有 1有") + private Integer hasPermission = 0; + + /** + * activeMenu + */ + @ApiModelProperty(value = "activeMenu") + private String activeMenu; + + /** + * 跳转 + */ + @ApiModelProperty(value = "跳转") + @TableField(value = "redirect") + private String redirect; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/MenuVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/MenuVO.java new file mode 100644 index 0000000..833aab5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/MenuVO.java @@ -0,0 +1,71 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + *

+ * 实体类 + * 菜单 + *

+ * + * @author PoffyZhang + * @since 2022-9-30 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "MenuVO", description = "菜单") +@AllArgsConstructor +@Builder +public class MenuVO extends TreeVO { + + private static final long serialVersionUID = 1L; + + /** + * 权限" + */ + @ApiModelProperty(value = "权限") + private String permission; + /** + * 类型;[0-菜单 1按钮] + */ + @ApiModelProperty(value = "类型") + private Integer type; + + /** + * 组件 + */ + @ApiModelProperty(value = "组件") + private String component; + + /** + * 菜单图标 + */ + @ApiModelProperty(value = "菜单图标") + private String icon; + + /** + * 子菜单数目 + */ + @ApiModelProperty(value = "是否隐藏") + private Integer hidden; + + /** + * activeMenu + */ + @ApiModelProperty(value = "activeMenu") + private String activeMenu; + + /** + * 跳转 + */ + @ApiModelProperty(value = "跳转") + @TableField(value = "redirect") + private String redirect; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/OperatorVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/OperatorVO.java new file mode 100644 index 0000000..e534b2f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/OperatorVO.java @@ -0,0 +1,62 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import com.ningdatech.carapi.sys.entity.OperatorRegionHead; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.time.LocalDateTime; +import java.util.List; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * 实体类 + * 运营商 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "Operator", description = "运营商") +@AllArgsConstructor +@Builder +public class OperatorVO extends BaseEntity { + + @TableId(value = "id",type = IdType.AUTO) + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 运营商名称 + */ + @ApiModelProperty(value = "运营商名称") + private String name; + + /** + * 运营商备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 区域负责人 + */ + @ApiModelProperty(value = "区域负责人") + private List operatorRegionHeads; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RegionCompanyCarTreeVo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RegionCompanyCarTreeVo.java new file mode 100644 index 0000000..7e6fa6e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RegionCompanyCarTreeVo.java @@ -0,0 +1,50 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import com.ningdatech.basic.util.StrPool; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * BaseTreeVo + *

+ * + * @author WendyYang + * @since 15:39 2022/11/1 + */ +@Data +public class RegionCompanyCarTreeVo { + + public interface Type { + int REGION = 1; + int COMPANY = 2; + int CAR_NO = 3; + int CAR_VIDEO = 4; + } + + + private Long code; + + private String value; + + private Integer status; + + private Integer moving; + + private String unique; + + private Integer level; + + private Integer type; + private String videoStatus; + private String deviceId; + + private List children = new ArrayList<>(); + + public void setUnique() { + this.unique = this.code + StrPool.HASH + this.type; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RegionTreeCompanyVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RegionTreeCompanyVO.java new file mode 100644 index 0000000..c1fabe4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RegionTreeCompanyVO.java @@ -0,0 +1,119 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + *

+ * 值对象 + * 企业 + *

+ * + * @author PoffyZhang + * @since 2022-10-09 + */ +@Data +@ApiModel(value = "CompanyDTO", description = "企业") +public class RegionTreeCompanyVO { + + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业名称") + private String name; + + /** + * 车辆数 + */ + @ApiModelProperty(value = "车辆数") + private Long vehicleNum; + + /** + * 地区ID + */ + @ApiModelProperty(value = "地区id") + private Long regionId; + + /** + * 地区 + */ + @ApiModelProperty(value = "地区") + private String regionName; + + /** + * 运营商ID + */ + @ApiModelProperty(value = "运营商ID") + private Long operatorId; + + /** + * 运营商 + */ + @ApiModelProperty(value = "运营商") + private String operatorName; + + /** + * 传真 + */ + @ApiModelProperty(value = "传真") + private String fax; + + /** + * email + */ + @ApiModelProperty(value = "email") + private String email; + + /** + * 地址 + */ + @ApiModelProperty(value = "地址") + private String address; + + /** + * 联系人 + */ + @ApiModelProperty(value = "联系人") + private String contactPerson; + + /** + * 联系方式 + */ + @ApiModelProperty(value = "联系方式") + private String contactPhone; + + /** + * 法人 + */ + @ApiModelProperty(value = "法人") + private String legalPerson; + + /** + * 法人联系电话 + */ + @ApiModelProperty(value = "法人联系电话") + private String legalPersonPhone; + + /** + * 公司类型 + */ + @ApiModelProperty(value = "公司类型") + private Integer companyType; + + /** + * 公司类型名 + */ + @ApiModelProperty(value = "公司类型名") + private String companyTypeName; + + @ApiModelProperty("车牌号集合") + private List carNoList; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RegionTreeVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RegionTreeVO.java new file mode 100644 index 0000000..3f4722e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RegionTreeVO.java @@ -0,0 +1,60 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + *

+ * RegionTreeVO + *

+ * + * @author WendyYang + * @since 10:35 2022/10/12 + */ +@Data +@ToString(callSuper = true) +@ApiModel(value = "RegionTreeVO", description = "区域树状结构VO") +public class RegionTreeVO { + + private Long id; + + @ApiModelProperty("区域码") + @NotBlank(message = "地区编码不能为空") + private String regionCode; + + @ApiModelProperty("地区名") + @NotBlank(message = "地区名称不能为空") + private String name; + + @ApiModelProperty("级别") + @NotNull(message = "级别不能为空") + private Integer level; + + @ApiModelProperty("区域级别") + @NotBlank(message = "区域级别不能为空") + private String govUnit; + + @ApiModelProperty("地区父级编码:-1为顶级区域") + @NotBlank(message = "地区父级编码不能为空") + private String parentCode; + + @ApiModelProperty("子区域") + private List children; + + @ApiModelProperty("唯一编码:regionCode##name##level") + private String unionCode; + + @ApiModelProperty("地图数据") + @NotBlank(message = "地图数据不能为空") + private String mapData; + + @ApiModelProperty("企业信息") + private List companyList; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/ResCodingRuleVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/ResCodingRuleVO.java new file mode 100644 index 0000000..fd6f066 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/ResCodingRuleVO.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import com.ningdatech.carapi.sys.entity.BonusPointsRule; +import com.ningdatech.carapi.sys.entity.ScoreDeductionRule; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/10/24 下午3:01 + */ +@Data +@ApiModel("赋码规则VO") +public class ResCodingRuleVO { + + @ApiModelProperty("加分规则") + public BonusPointsRule bonusPointsRule; + + @ApiModelProperty("减分规则") + public List scoreDeductionRuleList; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RoleMenuVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RoleMenuVO.java new file mode 100644 index 0000000..95dbc13 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RoleMenuVO.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author PoffyZhang + * @since 2022-11-11 + */ +@Data +@ApiModel(value = "RoleMenu对象", description = "") +public class RoleMenuVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("menu_id") + private Long menuId; + + @ApiModelProperty("role_id") + private Long roleId; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RoleVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RoleVO.java new file mode 100644 index 0000000..38b0c9a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/RoleVO.java @@ -0,0 +1,67 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import com.ningdatech.carapi.sys.entity.Menu; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.time.LocalDateTime; +import java.util.List; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * 实体类 + * 角色 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "Role", description = "角色") +@AllArgsConstructor +@Builder +public class RoleVO extends BaseEntity { + + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String name; + + /** + * 描述 + */ + @ApiModelProperty(value = "描述") + private String describe; + + /** + * 数据范围 + */ + @ApiModelProperty(value = "数据范围 1全部 2本区域 3本区域以及下区域 4本公司") + private Integer dataScope; + + /** + * 菜单 + */ + @ApiModelProperty(value = "菜单") + private List menu; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/TreeVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/TreeVO.java new file mode 100644 index 0000000..9b5a44a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/TreeVO.java @@ -0,0 +1,103 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + * 包括id、create_time、created_by、updated_by、update_time、label、parent_id、sort_value 字段的表继承的树形实体 + * + * @author PoffyZhang + * @since 2022/09/30 + */ +@Getter +@Setter +@Accessors(chain = true) +@ToString(callSuper = true) +public class TreeVO extends BaseEntity { + + protected Long id; + + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + protected String name; + + /** + * 菜单标题 + */ + @ApiModelProperty(value = "菜单标题") + protected String title; + + /** + * 父菜单ID + */ + @ApiModelProperty(value = "父ID") + protected Long pid; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序号") + protected Integer sort; + + /** + * 顶层菜单 + */ + @ApiModelProperty(value = "顶层菜单") + protected String topMenu; + + /** + * 路径 + */ + @ApiModelProperty(value = "路径") + protected String path; + + + @ApiModelProperty(value = "子节点", hidden = true) + protected List children; + + /** + * 层级 + */ + @ApiModelProperty(value = "层级") + protected Integer level = 1; + + + /** + * 初始化子类 + */ + @JsonIgnore + public void initChildren() { + if (getChildren() == null) { + this.setChildren(new ArrayList<>()); + } + } + + @JsonIgnore + public void addChildren(E child) { + initChildren(); + children.add(child); + } + + @Override + public Object clone() throws CloneNotSupportedException{ + return super.clone(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/UserInfoVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/UserInfoVO.java new file mode 100644 index 0000000..05b1131 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/entity/vo/UserInfoVO.java @@ -0,0 +1,120 @@ +package com.ningdatech.carapi.sys.entity.vo; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.ningdatech.carapi.common.base.BaseEntity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * + *

+ * + * @author Zpf + * @since 2022-10-17 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@AllArgsConstructor +@Builder +public class UserInfoVO extends BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + /** + * 账号 + */ + @ApiModelProperty(value = "账号") + private String account; + + /** + * 用户姓名 + */ + @ApiModelProperty(value = "用户姓名") + private String username; + + /** + * 角色 + */ + @ApiModelProperty(value = "角色") + private Long role; + + /** + * 角色名称 + */ + @ApiModelProperty(value = "角色名称") + private String roleName; + + /** + * 企业 + */ + @ApiModelProperty(value = "企业id") + private Long companyId; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业名称") + private String companyName; + + /** + * 公司行业 + */ + @ApiModelProperty(value = "行业id") + private Long industry; + + /** + * 行业名称 + */ + @ApiModelProperty(value = "行业名称") + private String industryName; + + /** + * 手机 + */ + @ApiModelProperty(value = "手机") + private String mobile; + + /** + * 最后登录时间 + */ + @ApiModelProperty(value = "最后登录时间") + private LocalDateTime lastLoginTime; + + /** + * 职位 + */ + @ApiModelProperty(value = "职位") + private String position; + + /** + * 科室 + */ + @ApiModelProperty(value = "科室") + private String sectionOffice; + + /** + * 昵称 + */ + @ApiModelProperty(value = "昵称") + private String nickName; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 用户是否可登录 + */ + @ApiModelProperty(value = "用户是否可登录") + private Boolean canLogin; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/event/ImportDataEvent.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/event/ImportDataEvent.java new file mode 100644 index 0000000..be7770c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/event/ImportDataEvent.java @@ -0,0 +1,31 @@ +package com.ningdatech.carapi.sys.event; + +import com.ningdatech.carapi.sys.entity.enumeration.ImportTemplateEnum; +import org.springframework.context.ApplicationEvent; +import org.springframework.web.multipart.MultipartFile; + +/** + *

+ * ImportDataEvent - 模版数据导入事件 + *

+ * + * @author WendyYang + * @since 20:20 2022/11/4 + */ +public class ImportDataEvent extends ApplicationEvent { + + private ImportTemplateEnum template; + + public ImportDataEvent(MultipartFile source) { + super(source); + } + + public ImportTemplateEnum getTemplate() { + return template; + } + + public void setTemplate(ImportTemplateEnum template) { + this.template = template; + } + +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/CompaniesCacheHelper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/CompaniesCacheHelper.java new file mode 100644 index 0000000..98ae80a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/CompaniesCacheHelper.java @@ -0,0 +1,196 @@ +package com.ningdatech.carapi.sys.helper; + +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; +import java.util.stream.Collectors; + +import javax.annotation.Resource; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.lang.NonNull; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.benmanes.caffeine.cache.CacheLoader; +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.google.common.collect.Maps; +import com.ningdatech.carapi.sys.entity.CompanyJoin; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.service.CompanyJoinService; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * CompaniesCacheHelper + *

+ * + * @author PoffyZhang + * @since 09:01 2022/10/18 + */ +@Slf4j +@Component +public class CompaniesCacheHelper implements InitializingBean { + + private LoadingCache companyCache; + + // ================================================================================================================== + + private final CompanyJoinService companyService; + + @Resource + private RegionsCacheHelper regionsCacheHelper; + + private Map companyNameMap = Maps.newHashMap(); + + public CompaniesCacheHelper(CompanyJoinService companyService) { + this.companyService = companyService; + } + + @Override + public void afterPropertiesSet() { + companyCache = Caffeine.newBuilder() + // 需避免刷新过于频繁 + .refreshAfterWrite(10, TimeUnit.MINUTES).build(new CacheLoader() { + + @Override + public CompanyDTO load(@NonNull Long companyId) { + CompanyJoin company = companyService + .oneJoin(Wrappers.lambdaQuery(CompanyJoin.class).eq(CompanyJoin::getId, companyId)); + if (Objects.isNull(company)) { + log.info("加载企业信息失败: 企业{} 信息为空为空", companyId); + return null; + } + // 查询区域 + searchRegion(company); + return BeanUtil.copyProperties(company, CompanyDTO.class); + } + + @Override + public @NonNull Map loadAll(@NonNull Iterable keys) { + List companies = + companyService.listJoin(Wrappers.lambdaQuery(CompanyJoin.class).in(CompanyJoin::getId, keys)); + if (CollUtil.isEmpty(companies)) { + log.info("加载企业信息失败: 企业信息为空为空"); + return Collections.emptyMap(); + } + // 查询区域 + searchRegions(companies); + return companies.stream().map(c -> BeanUtil.copyProperties(c, CompanyDTO.class)) + .collect(Collectors.toMap(CompanyDTO::getId, Function.identity())); + } + + }); + + List companies = companyService.listJoin(Wrappers.lambdaQuery(CompanyJoin.class)); + if (CollUtil.isEmpty(companies)) { + log.info("加载企业信息失败: 企业为空"); + return; + } + // 查询区域 + searchRegions(companies); + companies.forEach(c -> { + CompanyDTO company = BeanUtil.copyProperties(c, CompanyDTO.class); + companyCache.put(company.getId(), company); + companyNameMap.put(company.getName(), company); + }); + } + + public Collection all() { + return companyCache.asMap().values(); + } + + private void searchRegions(List companyJoins) { + if (CollUtil.isEmpty(companyJoins)) { + return; + } + companyJoins.forEach(this::searchRegion); + } + + private void searchRegion(CompanyJoin company) { + if (Objects.isNull(company)) { + return; + } + if (Objects.nonNull(company.getRegionId())) { + List regions = + regionsCacheHelper.listParents(Long.valueOf(String.valueOf(company.getRegionId()))); + if (CollUtil.isNotEmpty(regions)) { + company.setRegionName(regions.stream().map(RegionDTO::getRegionName).collect(Collectors.joining("-"))); + } + } + } + + /** + * 获取当前企业信息 + * + * @param companyId + * 企业ID + * @return + */ + public CompanyDTO getById(Long companyId) { + CompanyDTO companyDTO = companyCache.get(companyId); + return Optional.ofNullable(companyDTO).orElse(new CompanyDTO()); + } + + public String getNameById(Long companyId) { + CompanyDTO dto = companyCache.get(companyId); + if (Objects.nonNull(dto)) { + return dto.getName(); + } + return StringUtils.EMPTY; + } + + public String getNameById(Long companyId, String oldName) { + CompanyDTO dto = companyCache.get(companyId); + if (Objects.nonNull(dto)) { + return dto.getName(); + } + return oldName; + } + + /** + * 获取当前企业信息 + * + * @param companyName + * 企业ID + * @return + */ + public CompanyDTO getByName(String companyName) { + return companyNameMap.get(companyName); + } + + /** + * 获取当前企业信息 + * + * @return + */ + public Map asMap() { + return companyCache.asMap(); + } + + public void refresh(Long id) { + companyCache.refresh(id); + CompanyDTO data = companyCache.get(id); + if (Objects.nonNull(data)) { + companyNameMap.put(data.getName(), data); + } + } + + public void refresh(List ids) { + if (CollUtil.isNotEmpty(ids)) { + ids.forEach(id -> { + companyCache.refresh(id); + CompanyDTO data = companyCache.get(id); + if (Objects.nonNull(data)) { + companyNameMap.put(data.getName(), data); + } + }); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/OperatorsCacheHelper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/OperatorsCacheHelper.java new file mode 100644 index 0000000..f1b6110 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/OperatorsCacheHelper.java @@ -0,0 +1,153 @@ +package com.ningdatech.carapi.sys.helper; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.benmanes.caffeine.cache.CacheLoader; +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.google.common.collect.Maps; +import com.ningdatech.carapi.sys.entity.Operator; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.manage.OperatorManage; +import com.ningdatech.carapi.sys.mapper.OperatorMapper; +import com.ningdatech.carapi.sys.service.OperatorService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + *

+ * OperatorsCacheHelper + *

+ * + * @author PoffyZhang + * @since 09:01 2022/11/29 + */ +@Slf4j +@Component +public class OperatorsCacheHelper implements InitializingBean { + + private LoadingCache operatorCache; + + //================================================================================================================== + + @Autowired + private OperatorMapper operatorMapper; + + + private Map operatorNameMap = Maps.newHashMap(); + + @Override + public void afterPropertiesSet() { + operatorCache = Caffeine.newBuilder() + //需避免刷新过于频繁 + .refreshAfterWrite(30, TimeUnit.MINUTES) + .maximumSize(500) + .build(new CacheLoader() { + + @Override + public OperatorQueryDTO load(Long operatorId) throws Exception { + Operator operator = operatorMapper.selectById(operatorId); + if(Objects.isNull(operator)){ + log.info("加载运营商信息失败: 运营商{} 信息为空为空",operatorId); + return null; + } + return BeanUtil.copyProperties(operator, OperatorQueryDTO.class); + } + + @Override + public Map loadAll(Iterable keys) throws Exception { + List operators = operatorMapper.selectList(Wrappers.lambdaQuery(Operator.class).in(Operator::getId,keys)); + if(CollUtil.isEmpty(operators)){ + log.info("加载运营商信息失败: 运营商信息为空为空"); + return Collections.emptyMap(); + } + Map map = operators.stream().map(c->BeanUtil.copyProperties(c, OperatorQueryDTO.class)) + .collect(Collectors.toMap(OperatorQueryDTO::getId,c -> c)); + return map; + } + }); + + List operators = operatorMapper.selectList(Wrappers.lambdaQuery(Operator.class)); + if(CollUtil.isEmpty(operators)){ + log.info("加载运营商信息失败: 运营商为空"); + return; + } + operators.stream().forEach(c -> { + OperatorQueryDTO operator = BeanUtil.copyProperties(c, OperatorQueryDTO.class); + operatorCache.put(operator.getId(),operator); + operatorNameMap.put(operator.getName(),operator); + }); + } + + public Collection all(){ + return operatorCache.asMap().values(); + } + + /** + * 获取当前运营商信息 + * @param id + * @return + */ + public OperatorQueryDTO getById(Long id) { + return operatorCache.get(id); + } + + public void refresh(Long id) { + operatorCache.refresh(id); + OperatorQueryDTO data = operatorCache.get(id); + if(Objects.nonNull(data)){ + operatorNameMap.put(data.getName(),data); + } + } + + public void refresh(List ids) { + if(CollUtil.isNotEmpty(ids)){ + ids.forEach(id -> { + operatorCache.refresh(id); + OperatorQueryDTO data = operatorCache.get(id); + if(Objects.nonNull(data)){ + operatorNameMap.put(data.getName(),data); + } + }); + } + } + + /** + * 获取当前运营商名字 + * @param id + * @return + */ + public String getNameById(Long id) { + if(Objects.isNull(id)){ + return StringUtils.EMPTY; + } + if(Objects.nonNull(operatorCache.get(id))){ + return operatorCache.get(id).getName(); + } + return id + StringUtils.EMPTY; + } + + /** + * 获取当前运营商信息 + * @param name + * @return + */ + public OperatorQueryDTO getByName(String name) { + return operatorNameMap.get(name); + } + + /** + * 获取运营商信息s + * @return + */ + public Map asMap() { + return operatorCache.asMap(); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/RegionsCacheHelper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/RegionsCacheHelper.java new file mode 100644 index 0000000..8376cdf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/RegionsCacheHelper.java @@ -0,0 +1,440 @@ +package com.ningdatech.carapi.sys.helper; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ArrayUtil; +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.datascope.model.DataScopeDto; +import com.ningdatech.carapi.sys.contants.RegionContant; +import com.ningdatech.carapi.sys.convert.RegionConverter; +import com.ningdatech.carapi.sys.entity.Region; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.service.IRegionService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +/** + *

+ * RegionsCacheHelper + *

+ * + * @author WendyYang + * @since 12:12 2022/10/12 + */ +@Slf4j +@Component +public class RegionsCacheHelper implements InitializingBean { + + /** + * 当前支持最大层级 + */ + public static final int MAX_LEVEL = 3; + + public static final Long ROOT_PARENT_ID = 0L; + + public static final String ROOT_PARENT_CODE = "-1"; + + private LoadingCache regionsCache; + + private final Map regionCodeMapId = new ConcurrentHashMap<>(256); + private final Map regionsMap = new ConcurrentHashMap<>(256); + + //================================================================================================================== + + private final IRegionService regionService; + + public RegionsCacheHelper(IRegionService regionService) { + this.regionService = regionService; + } + + /** + * 刷新地域信息 + * + * @param regionId 地域编码 + **/ + public void refresh(Long regionId) { + log.info("刷新区域信息:{}", regionId); + regionsCache.refresh(regionId); + } + + public Long getIdByCode(String regionCode) { + if(StringUtils.isBlank(regionCode)){ + return 0L; + } + return regionCodeMapId.getOrDefault(regionCode, 0L); + } + + public void put(Long regionId, Region region) { + regionsCache.put(regionId, RegionConverter.toRegionDTO(region)); + } + + public RegionDTO getByRegionId(Long regionId) { + return regionsCache.get(regionId); + } + + @Override + public void afterPropertiesSet() { + regionsCache = Caffeine.newBuilder() + .refreshAfterWrite(7, TimeUnit.DAYS) + .build(key -> { + log.info("加载区域信息:regionLevel = {}", key); + // 查询全部 + Region region = regionService.getById(key); + if (Objects.isNull(region)) { + return null; + } + if (!region.getRegionCode().equals(region.getParentCode())) { + regionCodeMapId.put(region.getRegionCode(), region.getId()); + regionsMap.put(region.getId(), RegionConverter.toRegionDTO(region)); + } + return RegionConverter.toRegionDTO(region); + }); + warmUp(); + } + + /** + * 或许所有区域信息 + * + * @return 所有区域信息 + */ + public Collection getAll() { + return regionsCache.asMap().values(); + } + + public List listChildRegionId(Long regionId) { + return listChildRegionId(regionId, true, false); + } + + public List listChildRegionId(Long regionId, boolean containsSelf, boolean skipThisLevel) { + Map> groupByPid = CollUtils.group(getAll(), RegionDTO::getParentId); + List childIds = childrenId(regionId, groupByPid, skipThisLevel); + if (containsSelf) { + childIds.add(regionId); + } + return childIds; + } + + private List childrenId(Long regionId, Map> regionMap) { + return childrenId(regionId, regionMap, false); + } + + /** + * 获取当前区域所有下级区域 + * + * @param regionId 区域ID + * @param regionMap 区域信息 + * @param skipThisLevel 是否跳过本级 + * @return 子区域ID + * @author WendyYang + **/ + private List childrenId(Long regionId, Map> regionMap, boolean skipThisLevel) { + List childIds = new ArrayList<>(); + List children = regionMap.get(regionId); + if (children != null) { + children.forEach(w -> { + if (skipThisLevel && w.getRegionCode().equals(w.getParentCode())) { + return; + } + childIds.add(w.getId()); + childIds.addAll(childrenId(w.getId(), regionMap)); + }); + } + return childIds; + } + + /** + * 根据传入的地区ID获取所有上层地区集合 + * 按照level升序排列 + * + * @param regionId 地区ID + * @return 所有父级区域集合 + * @author WendyYang + **/ + public List listParents(Long regionId) { + List result = new ArrayList<>(); + RegionDTO region = regionsCache.get(regionId); + if (region != null) { + result.add(region); + if (region.getParentId() > 0) { + result.addAll(0, listParents(region.getParentId())); + } + } + return result; + } + + + private void warmUp() { + List regions = regionService.list(); + + for (Region region : regions) { + if (!region.getRegionCode().equals(region.getParentCode())) { + regionCodeMapId.put(region.getRegionCode(), region.getId()); + regionsMap.put(region.getId(), RegionConverter.toRegionDTO(region)); + } + } + + Map mapByRegionId = CollUtils.listToMap(regions, Region::getId, RegionConverter::toRegionDTO); + regionsCache.putAll(mapByRegionId); + } + + + /** + * 获取展示的区域名称 + */ + public String getDisplayName(Long regionId) { + if (Objects.isNull(regionId)) { + return StringUtils.EMPTY; + } + String displayRegionName = null; + List regions = listParents(regionId); + if (CollUtil.isNotEmpty(regions)) { + displayRegionName = CollUtils.join(regions, RegionDTO::getRegionName, StrPool.DASH); + } + return displayRegionName; + } + + /** + * 查询区域请使用{@link #listChildRegionId(Long)} + * + * @param regionCode 区域编码 + * @param regionLevel 区域级别 + * @return 子区域集合 + */ + @Deprecated + public List listChildRegionCode(String regionCode, int regionLevel) { + return Collections.emptyList(); + } + + /** + * 获取当前区域的下级区域信息 + * + * @param regionId 区域ID + * @param skipThisLevel 是否包含本级 + * @return 子区域map + */ + public Map> getChildrenMap(Long regionId, Boolean... skipThisLevel) { + boolean notSkip = ArrayUtil.isNotEmpty(skipThisLevel) ? skipThisLevel[0] : false; + Map> result = new TreeMap<>(Comparator.comparing(RegionDTO::getRegionCode)); + for (RegionDTO region : getAll()) { + if (notSkip && region.getRegionCode().equals(region.getParentCode())) { + continue; + } + if (region.getParentId().equals(regionId)) { + result.put(region, listChildRegionId(region.getId())); + } + } + result.put(getByRegionId(regionId), listChildRegionId(regionId)); + return result; + } + + /** + * 获取当前区域的下一级区域ID集合 + * + * @param regionId + * @return + */ + public List listChild(Long regionId) { + List result = new ArrayList<>(); + for (RegionDTO region : getAll()) { + if (region.getParentId().equals(regionId) && region.getDeleted() == false) { + result.add(region.getId()); + } + } + return result; + } + + /** + * 获取当前区域的下一级区域集合 + * + * @param regionId / + * @return / + */ + public List listChildOnly(Long regionId) { + return listChildOnly(regionId, false); + } + + public List listChildOnly(Long regionId, boolean skipThisLevel) { + List result = new ArrayList<>(); + for (RegionDTO region : getAll()) { + if (skipThisLevel && region.getRegionCode().equals(region.getParentCode())) { + continue; + } + if (Objects.nonNull(regionId) && regionId.equals(region.getParentId()) && !region.getDeleted()) { + result.add(region); + } + } + if (!result.isEmpty()) { + result.sort(Comparator.comparing(RegionDTO::getRegionCode)); + } + return result; + } + + /** + * 去获取菜单 有权限判断 + * + * @param dataScope + * @param companiesCacheHelper + * @return + */ + public Collection getAllWithRole(Optional dataScope, CompaniesCacheHelper companiesCacheHelper) { + if (!dataScope.isPresent() || (CollUtil.isEmpty(dataScope.get().getRegionIds()) && + CollUtil.isEmpty(dataScope.get().getCompanyIds()))) { + return regionsCache.asMap().values(); + } + + List dataScopeRegionIds = dataScope.get().getRegionIds(); + + //1.企业逻辑 + if (CollUtil.isNotEmpty(dataScope.get().getCompanyIds())) { + //其实只有一个企业 + Long companyId = dataScope.get().getCompanyIds().get(0); + CompanyDTO company = companiesCacheHelper.getById(companyId); + dataScopeRegionIds = new ArrayList() { + { + this.add(company.getRegionId()); + } + }; + } + + Collection<@NonNull RegionDTO> regions = regionsCache.asMap().values(); + if (dataScopeRegionIds.size() == regions.size()) { + return regions; + } + + //2.区域逻辑 + List finalDataScopeRegionIds = dataScopeRegionIds; + AtomicInteger index = new AtomicInteger(0); + Collection res = regions.stream().filter(region -> finalDataScopeRegionIds.contains(region.getId())) + .map(region -> { + RegionDTO resDto = BeanUtil.copyProperties(region, RegionDTO.class); + if (0 == index.get()) { + processFirst(region, resDto); + } + index.incrementAndGet(); + return resDto; + }).collect(Collectors.toList()); + return res; + } + + /** + * 角色数据权限筛选后的菜单 最顶部的 要装饰上省市 目标实体 resDto + * + * @param region + * @param resDto + */ + private void processFirst(RegionDTO region, RegionDTO resDto) { + if (region.getRegionLevel().equals(RegionContant.SECOND_LEVEL)) { + resDto.setRegionName(regionsCache.get(region.getParentId()).getRegionName() + region.getRegionName()); + } else if (region.getRegionLevel().equals(RegionContant.THIRD_LEVEL)) { + RegionDTO parent = regionsCache.get(region.getParentId()); + RegionDTO grandParent = regionsCache.get(parent.getParentId()); + resDto.setRegionName(grandParent.getRegionName() + parent.getRegionName() + region.getRegionName()); + } + resDto.setParentId(RegionContant.EMPTY_PARENT_ID); + } + + /** + * 获取到 此区域ID的省份 + * + * @param regionId + * @return + */ + public String getProvince(Long regionId) { + if (Objects.isNull(regionId)) { + return StringUtils.EMPTY; + } + RegionDTO regionDto = this.getByRegionId(regionId); + if (Objects.isNull(regionDto)) { + return StringUtils.EMPTY; + } + if (regionDto.getRegionLevel().equals(RegionContant.THIRD_LEVEL)) { + RegionDTO parent = getByRegionId(regionDto.getParentId()); + if (Objects.isNull(parent)) { + return StringUtils.EMPTY; + } + RegionDTO parentD = getByRegionId(parent.getParentId()); + if (Objects.isNull(parentD)) { + return StringUtils.EMPTY; + } + return parentD.getRegionName(); + } else if (regionDto.getRegionLevel().equals(RegionContant.SECOND_LEVEL)) { + RegionDTO parent = getByRegionId(regionDto.getParentId()); + if (Objects.isNull(parent)) { + return StringUtils.EMPTY; + } + return parent.getRegionName(); + } else if (regionDto.getRegionLevel().equals(RegionContant.FIRST_LEVEL)) { + return regionDto.getRegionName(); + } + return StringUtils.EMPTY; + } + + /** + * 获取到 此区域ID的城市 + * + * @param regionId + * @return + */ + public String getCity(Long regionId) { + if (Objects.isNull(regionId)) { + return StringUtils.EMPTY; + } + RegionDTO regionDto = this.getByRegionId(regionId); + if (Objects.isNull(regionDto)) { + return StringUtils.EMPTY; + } + if (regionDto.getRegionLevel().equals(RegionContant.THIRD_LEVEL)) { + RegionDTO parent = getByRegionId(regionDto.getParentId()); + if (Objects.isNull(parent)) { + return StringUtils.EMPTY; + } + return parent.getRegionName(); + } else if (regionDto.getRegionLevel().equals(RegionContant.SECOND_LEVEL)) { + return regionDto.getRegionName(); + } + return StringUtils.EMPTY; + } + + /** + * 获取到 此区域ID的区县 + * + * @param regionId + * @return + */ + public String getDistinguish(Long regionId) { + if (Objects.isNull(regionId)) { + return StringUtils.EMPTY; + } + RegionDTO regionDto = this.getByRegionId(regionId); + if (Objects.isNull(regionDto)) { + return StringUtils.EMPTY; + } + if (regionDto.getRegionLevel().equals(RegionContant.THIRD_LEVEL)) { + return regionDto.getRegionName(); + } + return StringUtils.EMPTY; + } + + public List listByLevel(Integer level) { + if (Objects.isNull(level)) { + return Collections.emptyList(); + } + return regionsCache.asMap().values().stream() + .filter(r -> Objects.nonNull(r.getRegionLevel()) && level.equals(r.getRegionLevel()) && !r.getDeleted()) + .collect(Collectors.toList()); + } + +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/UserCacheHelper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/UserCacheHelper.java new file mode 100644 index 0000000..b6ceac7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/UserCacheHelper.java @@ -0,0 +1,124 @@ +package com.ningdatech.carapi.sys.helper; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.benmanes.caffeine.cache.CacheLoader; +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.google.common.collect.Maps; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.mapper.NdUserInfoMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + *

+ * UserCacheHelper + *

+ * + * @author PoffyZhang + * @since 09:01 2022/11/29 + */ +@Slf4j +@Component +public class UserCacheHelper implements InitializingBean { + + private LoadingCache userCache; + + //================================================================================================================== + + private Map userMap = Maps.newHashMap(); + + @Resource + private NdUserInfoMapper userInfoMapper; + + @Override + public void afterPropertiesSet() { + userCache = Caffeine.newBuilder() + // 需避免刷新过于频繁 + .refreshAfterWrite(10, TimeUnit.MINUTES) +// .maximumSize(50000) + .build(new CacheLoader() { + + @Override + public NdUserInfo load(Long id) throws Exception { + NdUserInfo user = userInfoMapper.selectById(id); + if(Objects.isNull(user)){ + log.info("加载用户信息失败: {}",id); + return null; + } + return user; + } + + @Override + public Map loadAll(Iterable keys) throws Exception { + List users = userInfoMapper.selectList(Wrappers.lambdaQuery(NdUserInfo.class).in(NdUserInfo::getId,keys)); + if(CollUtil.isEmpty(users)){ + log.info("加载用户信息失败: 信息为空"); + return Collections.emptyMap(); + } + Map map = users.stream() + .collect(Collectors.toMap(c -> c.getId(),c -> c)); + return map; + } + + + }); + + List users = userInfoMapper.selectList(Wrappers.lambdaQuery(NdUserInfo.class)); + if(CollUtil.isEmpty(users)){ + log.info("加载用户信息失败: 为空"); + return; + } + users.stream().forEach(u -> { + userCache.put(u.getId(),u); + userMap.put(u.getId(),u); + }); + } + + public Collection all(){ + return userCache.asMap().values(); + } + + /** + * 获取信息 + * @param id + * @return + */ + public NdUserInfo getById(Long id) { + if(Objects.isNull(id)){ + return null; + } + return userCache.get(id); + } + + /** + * 获取当前信息 + * @return + */ + public Map asMap() { + return userCache.asMap(); + } + + public void refresh(Long id) { + userCache.refresh(id); + NdUserInfo userInfo = userCache.get(id); + if(Objects.nonNull(userInfo)){ + userMap.put(userInfo.getId(),userInfo); + } + } + + public void refresh(List ids) { + if(CollUtil.isNotEmpty(ids)){ + ids.forEach(id -> { + refresh(id); + }); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/VehiclesCacheHelper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/VehiclesCacheHelper.java new file mode 100644 index 0000000..6121bfa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/helper/VehiclesCacheHelper.java @@ -0,0 +1,145 @@ +package com.ningdatech.carapi.sys.helper; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.benmanes.caffeine.cache.CacheLoader; +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.google.common.collect.Maps; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.mapper.VehicleBaseInfoMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + *

+ * VehiclesCacheHelper + *

+ * + * @author PoffyZhang + * @since 09:01 2022/11/29 + */ +@Slf4j +@Component +public class VehiclesCacheHelper implements InitializingBean { + + private LoadingCache vehicleCache; + + //================================================================================================================== + + private Map vehicleMap = Maps.newHashMap(); + private Map carPlateMap = Maps.newHashMap(); + + @Resource + private VehicleBaseInfoMapper vehicleBaseInfoMapper; + + @Override + public void afterPropertiesSet() { + vehicleCache = Caffeine.newBuilder() + // 需避免刷新过于频繁 + .refreshAfterWrite(10, TimeUnit.MINUTES) +// .maximumSize(50000) + .build(new CacheLoader() { + + @Override + public NdVehicleBaseInfo load(Long id) throws Exception { + NdVehicleBaseInfo vehicle = vehicleBaseInfoMapper.selectById(id); + if(Objects.isNull(vehicle)){ + log.info("加载车辆信息失败: 车辆{} 信息为空为空",id); + return null; + } + return vehicle; + } + + @Override + public Map loadAll(Iterable keys) throws Exception { + List vehicles = vehicleBaseInfoMapper.selectList(Wrappers.lambdaQuery(NdVehicleBaseInfo.class).in(NdVehicleBaseInfo::getId,keys)); + if(CollUtil.isEmpty(vehicles)){ + log.info("加载车辆信息失败: 车辆信息为空为空"); + return Collections.emptyMap(); + } + Map map = vehicles.stream() + .collect(Collectors.toMap(c -> c.getId(),c -> c)); + return map; + } + + + }); + + List vehicles = vehicleBaseInfoMapper.selectList(Wrappers.lambdaQuery(NdVehicleBaseInfo.class)); + if(CollUtil.isEmpty(vehicles)){ + log.info("加载车辆信息失败: 车辆为空"); + return; + } + vehicles.stream().forEach(v -> { + vehicleCache.put(v.getId(),v); + vehicleMap.put(v.getCompanyId() + v.getCarPlate(),v); + carPlateMap.put(v.getCarPlate(),v); + }); + } + + public Collection all(){ + return vehicleCache.asMap().values(); + } + + /** + * 获取当前车辆信息 + * @param id + * @return + */ + public NdVehicleBaseInfo getById(Long id) { + return vehicleCache.get(id); + } + + /** + * 获取当前车辆信息 企业ID和车牌号 + * @param companyCarPlate + * @return + */ + public NdVehicleBaseInfo getByCompanyCarPlate(String companyCarPlate) { + return vehicleMap.get(companyCarPlate); + } + public NdVehicleBaseInfo getByCarPlate(String carPlate) { + return carPlateMap.get(carPlate); + } + + public Boolean isExits(String carPlate) { + return carPlateMap.containsKey(carPlate); + } + + /** + * 获取当前车辆信息 + * @return + */ + public Map asMap() { + return vehicleCache.asMap(); + } + + public void refresh(Long id) { + vehicleCache.refresh(id); + NdVehicleBaseInfo vehicleBaseInfo = vehicleCache.get(id); + if(Objects.nonNull(vehicleBaseInfo)){ + vehicleMap.put(vehicleBaseInfo.getCompanyId() + vehicleBaseInfo.getCarPlate(),vehicleBaseInfo); + carPlateMap.put(vehicleBaseInfo.getCarPlate(),vehicleBaseInfo); + } + } + + public void refresh(List ids) { + if(CollUtil.isNotEmpty(ids)){ + ids.forEach(id -> { + vehicleCache.refresh(id); + NdVehicleBaseInfo vehicleBaseInfo = vehicleCache.get(id); + if(Objects.nonNull(vehicleBaseInfo)){ + vehicleMap.put(vehicleBaseInfo.getCompanyId() + vehicleBaseInfo.getCarPlate(),vehicleBaseInfo); + carPlateMap.put(vehicleBaseInfo.getCarPlate(),vehicleBaseInfo); + } + }); + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/CodingRuleManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/CodingRuleManage.java new file mode 100644 index 0000000..467a0fc --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/CodingRuleManage.java @@ -0,0 +1,135 @@ +package com.ningdatech.carapi.sys.manage; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.carapi.sys.entity.BonusPointsRule; +import com.ningdatech.carapi.sys.entity.CodingRule; +import com.ningdatech.carapi.sys.entity.CodingRuleInfo; +import com.ningdatech.carapi.sys.entity.ScoreDeductionRule; +import com.ningdatech.carapi.sys.entity.enumeration.CodingRuleBehaviorTypeEnum; +import com.ningdatech.carapi.sys.entity.enumeration.CodingRuleVehicleType; +import com.ningdatech.carapi.sys.entity.enumeration.RuleOperationTypeEnum; +import com.ningdatech.carapi.sys.entity.req.ReqCodingRulePO; +import com.ningdatech.carapi.sys.entity.vo.ResCodingRuleVO; +import com.ningdatech.carapi.sys.service.ICodingRuleService; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.collection.CollectionUtil; +import lombok.RequiredArgsConstructor; + +/** + * @author liuxinxin + * @date 2022/10/24 下午2:01 + */ +@Component +@RequiredArgsConstructor +public class CodingRuleManage { + + private final ICodingRuleService iCodingRuleService; + + public ResCodingRuleVO getCodingRule() { + ResCodingRuleVO resCodingRuleVO = new ResCodingRuleVO(); + + List codingRuleList = iCodingRuleService.list(); + Map> operationCodingRuleMap = codingRuleList.stream().collect(Collectors.groupingBy(CodingRule::getRuleOperationType)); + // 装配加分规则 + List codingRuleInfoList = new ArrayList<>(); + List bonusPointsCodingRuleList = operationCodingRuleMap.get(RuleOperationTypeEnum.bonus_points.name()); + if (CollectionUtil.isNotEmpty(bonusPointsCodingRuleList)) { + for (CodingRule codingRule : bonusPointsCodingRuleList) { + CodingRuleInfo codingRuleInfo = new CodingRuleInfo(); + codingRuleInfo.setRuleOperationType(RuleOperationTypeEnum.valueOf(codingRule.getRuleOperationType())); + codingRuleInfo.setOperationScore(codingRule.getOperationScore()); + codingRuleInfo.setCodingRuleBehaviorType(CodingRuleBehaviorTypeEnum.valueOf(codingRule.getBehaviorType())); + codingRuleInfoList.add(codingRuleInfo); + } + } + BonusPointsRule bonusPointsRule = new BonusPointsRule(); + bonusPointsRule.setCodingRuleInfoList(codingRuleInfoList); + resCodingRuleVO.setBonusPointsRule(bonusPointsRule); + + // 装配扣分规则 + List scoreDeductionCodingRuleList = operationCodingRuleMap.get(RuleOperationTypeEnum.score_deduction.name()); + + List scoreDeductionRuleList = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(scoreDeductionCodingRuleList)) { + Map> vehicleMap = scoreDeductionCodingRuleList.stream() + .collect(Collectors.groupingBy(CodingRule::getVehicleType)); + for (String vehicleTypeStr : vehicleMap.keySet()) { + ScoreDeductionRule scoreDeductionRule = new ScoreDeductionRule(); + scoreDeductionRule.setVehicleType(CodingRuleVehicleType.valueOf(vehicleTypeStr)); + List vehicleTypeCodingRuleInfoList = new ArrayList<>(); + + List vehicleCodingRuleList = vehicleMap.get(vehicleTypeStr); + if (CollectionUtil.isNotEmpty(vehicleCodingRuleList)) { + for (CodingRule codingRule : vehicleCodingRuleList) { + CodingRuleInfo codingRuleInfo = new CodingRuleInfo(); + codingRuleInfo.setRuleOperationType(RuleOperationTypeEnum.valueOf(codingRule.getRuleOperationType())); + codingRuleInfo.setOperationScore(codingRule.getOperationScore()); + codingRuleInfo.setCodingRuleBehaviorType(CodingRuleBehaviorTypeEnum.valueOf(codingRule.getBehaviorType())); + vehicleTypeCodingRuleInfoList.add(codingRuleInfo); + } + } + scoreDeductionRule.setCodingRuleInfoList(vehicleTypeCodingRuleInfoList); + scoreDeductionRuleList.add(scoreDeductionRule); + } + } + resCodingRuleVO.setScoreDeductionRuleList(scoreDeductionRuleList); + return resCodingRuleVO; + } + + @Transactional(rollbackFor = Exception.class) + public void saveCodingRule(ReqCodingRulePO request) { + Long userId = LoginUserUtil.getUserId(); + BonusPointsRule bonusPointsRule = request.getBonusPointsRule(); + List scoreDeductionRuleList = request.getScoreDeductionRuleList(); + // 保存加分规则 + List bonusPointsRuleInfoList = bonusPointsRule.getCodingRuleInfoList(); + for (CodingRuleInfo bonusPointsRuleInfo : bonusPointsRuleInfoList) { + CodingRule codingRule = iCodingRuleService.getOne(Wrappers.lambdaQuery(CodingRule.class) + .eq(CodingRule::getBehaviorType, bonusPointsRuleInfo.getCodingRuleBehaviorType().name())); + if (Objects.isNull(codingRule)) { + codingRule = new CodingRule(); + codingRule.setCreateOn(LocalDateTime.now()); + codingRule.setCreateBy(userId); + } + codingRule.setUpdateOn(LocalDateTime.now()); + codingRule.setOperationScore(bonusPointsRuleInfo.getOperationScore()); + codingRule.setRuleOperationType(bonusPointsRuleInfo.getRuleOperationType().name()); + codingRule.setBehaviorType(bonusPointsRuleInfo.getCodingRuleBehaviorType().name()); + iCodingRuleService.saveOrUpdate(codingRule); + } + + // 保存扣分规则 + for (ScoreDeductionRule scoreDeductionRule : scoreDeductionRuleList) { + CodingRuleVehicleType vehicleType = scoreDeductionRule.getVehicleType(); + List codingRuleInfoList = scoreDeductionRule.getCodingRuleInfoList(); + for (CodingRuleInfo codingRuleInfo : codingRuleInfoList) { + CodingRule codingRule = iCodingRuleService.getOne(Wrappers.lambdaQuery(CodingRule.class) + .eq(CodingRule::getBehaviorType, codingRuleInfo.getCodingRuleBehaviorType().name()) + .eq(CodingRule::getVehicleType, vehicleType.name())); + + if (Objects.isNull(codingRule)) { + codingRule = new CodingRule(); + codingRule.setCreateOn(LocalDateTime.now()); + codingRule.setCreateBy(userId); + codingRule.setVehicleType(vehicleType.name()); + } + codingRule.setUpdateOn(LocalDateTime.now()); + codingRule.setOperationScore(codingRuleInfo.getOperationScore()); + codingRule.setRuleOperationType(codingRuleInfo.getRuleOperationType().name()); + codingRule.setBehaviorType(codingRuleInfo.getCodingRuleBehaviorType().name()); + iCodingRuleService.saveOrUpdate(codingRule); + } + } + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/CompanyManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/CompanyManage.java new file mode 100644 index 0000000..29fc3d1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/CompanyManage.java @@ -0,0 +1,499 @@ +package com.ningdatech.carapi.sys.manage; + +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BaseUncheckedException; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.StrPool; +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.company.entity.NdCompanyCreditLevel; +import com.ningdatech.carapi.company.enumeration.CompanyCreditLevelEnum; +import com.ningdatech.carapi.company.enumeration.CompanyTypeEnum; +import com.ningdatech.carapi.company.enumeration.ProductCompanyType; +import com.ningdatech.carapi.company.service.INdCompanyCreditLevelService; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.CompanyType; +import com.ningdatech.carapi.sys.entity.CompanyTypeRelated; +import com.ningdatech.carapi.sys.entity.dto.*; +import com.ningdatech.carapi.sys.entity.vo.CompanyVO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.sys.service.CompanyTypeRelatedService; +import com.ningdatech.carapi.sys.service.CompanyTypeService; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.http.HttpStatus; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname CompanyManage + * @Description + * @Date 2022/10/12 11:26 + * @Created by PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class CompanyManage { + + private final CompanyService companyService; + private final RegionsCacheHelper regionsCacheHelper; + + private final CompanyTypeService companyTypeService; + private final CompanyTypeRelatedService companyTypeRelatedService; + + private final CompaniesCacheHelper companiesCacheHelper; + private final IDriverInfoService driverInfoService; + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final INdCompanyCreditLevelService companyCreditLevelService; + private final INdUserInfoService userInfoService; + private final INdUserAuthService userAuthService; + + /** + * 公司列表查询 + * @param companyPageQuery + * @return + */ + public PageVo queryList(CompanyPageQuery companyPageQuery) { + Integer pageNumber = companyPageQuery.getPageNumber(); + Integer pageSize = companyPageQuery.getPageSize(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Company.class); + // 未传入筛选条件时,筛选掉管理企业 + if (CollUtil.isEmpty(companyPageQuery.getCompanyTypeList())) { + companyPageQuery.setCompanyTypeList(Lists.newArrayList(1, 2, 3)); + } + ((CompanyManage)AopContext.currentProxy()).buildQueryWrapper(wrapper, companyPageQuery); + + // 获取所有符合传入条件的企业列表 + List companyList = companyService.list(wrapper); + + // 筛选出非管理企业的企业(根据传入的企业类型可筛选出生产企业、物流企业、其他企业) + List companyIdList = companyList.stream().map(Company::getId).collect(Collectors.toList()); + + Map> listMap = companyCreditLevelService.list().stream() + .filter(c -> companyIdList.contains(c.getCompanyId())) + .collect(Collectors.groupingBy(NdCompanyCreditLevel::getCompanyId)); + + Map> companyTypeRelatedMap = companyTypeRelatedService.list().stream() + .collect(Collectors.groupingBy(CompanyTypeRelated::getCompanyId)); + + List dataList = Lists.newArrayList(); + Integer companyType = companyPageQuery.getCompanyType(); + Integer productCompanyType = companyPageQuery.getProductCompanyType(); + // 如果是生产企业列表具体生产企业类型的筛选 + if (CompanyTypeEnum.PRODUCT_BU.getCode().equals(companyType) + && Objects.nonNull(productCompanyType)){ + // 关联表中筛选出对应类型的生产企业 + List relatedCompanyIds = companyTypeRelatedService.list(Wrappers.lambdaQuery(CompanyTypeRelated.class) + .in(CompanyTypeRelated::getCompanyId, companyIdList) + .eq(CompanyTypeRelated::getCompanyTypeId, productCompanyType)) + .stream().map(CompanyTypeRelated::getCompanyId).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(relatedCompanyIds)) { + dataList = companyList.stream() + .filter(c -> relatedCompanyIds.contains(c.getId())) + .collect(Collectors.toList()); + } + }else { + // 非生产企业类型的列表筛选,就根据企业类型返回对应的数据 + dataList = companyList; + } + + List data = CollUtils.convert(dataList, c -> { + CompanyVO vo = new CompanyVO(); + BeanUtils.copyProperties(c, vo); + CodeUtil.searchRegionName(vo); + // 根据企业ID获取企业信用等级 + Long companyId = c.getId(); + List creditLevelList = listMap.get(companyId); + if (CollUtil.isNotEmpty(creditLevelList)) { + // 过滤出当前时间年份的信用等级 + String year = String.valueOf(LocalDateTime.now().getYear()); + List levels = + creditLevelList.stream().filter(d -> year.equals(d.getYear())).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(levels)) { + NdCompanyCreditLevel creditLevel = levels.get(0); + vo.setDangerLevel(creditLevel.getLevel()); + vo.setDangerLevelName(CompanyCreditLevelEnum.getDescByCode(creditLevel.getLevel())); + } + } else { + log.info("该企业{}不在企业信用等级列表中", companyId); + // 默认赋红码 + vo.setDangerLevel(CompanyCreditLevelEnum.E.getCode()); + vo.setDangerLevelName(CompanyCreditLevelEnum.E.getDesc()); + } + + // 如果是生产企业类型列表,要展示具体的生产企业类型 + if (Objects.nonNull(vo.getCompanyType())) { + if (CompanyTypeEnum.PRODUCT_BU.getCode().equals(vo.getCompanyType())) { + List relatedList = companyTypeRelatedMap.get(vo.getId()); + if (CollUtil.isNotEmpty(relatedList)) { + List nameList = relatedList.stream() + .map(r -> ProductCompanyType.getDescByCode(r.getCompanyTypeId())) + .collect(Collectors.toList()); + String typeName = nameList.stream().collect(Collectors.joining(StrPool.COMMA)); + vo.setCompanyTypeName(typeName); + } + } else { + vo.setCompanyTypeName(CompanyTypeEnum.getDescByCode(vo.getCompanyType())); + } + } + return vo; + }); + + // 分页 + List vos = data.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize).collect(Collectors.toList()); + + return PageVo.of(vos, data.size()); + } + + /** + * 查询详情 + * @param id + * @return + */ + public CompanyQueryDTO getDetails(Long id) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Company.class); + CompanyManage context = (CompanyManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + Company company = companyService.getOne(wrapper); + if (Objects.isNull(company)){ + return null; + } + //Company company = companyService.getById(id); + + CompanyQueryDTO query = BeanUtil.toBean(company, CompanyQueryDTO.class); + query.setCompanyTypeName(CompanyTypeEnum.getDescByCode(company.getCompanyType())); + //查询区域 + CodeUtil.searchRegionName(query); + //查询企业类型 + List companyTypeRelateds = searchEnterpriseType(query.getId()); + if(CollUtil.isNotEmpty(companyTypeRelateds)){ + query.setEnterpriseTypes(companyTypeRelateds.stream().map(CompanyTypeRelated::getCompanyTypeId).collect(Collectors.toList())); + query.setEnterpriseTypesName(companyTypeRelateds.stream().map(r -> { + Long companyTypeId = r.getCompanyTypeId(); + CompanyType companyType = companyTypeService.getById(companyTypeId); + return Objects.nonNull(companyType) ? companyType.getName() : StringUtils.EMPTY; + }).filter(StringUtils::isNotBlank).collect(Collectors.joining(StrPool.COMMA))); + } + return query; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ONLY_REGION) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(Company::getId,id); + } + + /** + * 查询 此企业的类型 + * @param companyId + */ + public List searchEnterpriseType(Long companyId) { + return companyTypeRelatedService.list(Wrappers.lambdaQuery(CompanyTypeRelated.class).eq(CompanyTypeRelated::getCompanyId, companyId)); + } + + /** + * 企业类型 + * @return + */ + public List queryCompanyTypes() { + List companyTypes = companyTypeService.list(); + + return buildCompanyChildren(companyTypes); + } + + private List buildCompanyChildren(List companyTypes) { + if(CollUtil.isEmpty(companyTypes)){ + return Collections.emptyList(); + } + List res = Lists.newArrayList(); + + for(CompanyType companyType: companyTypes){ + // 获取生产企业的子菜单 + if(companyType.getPid().equals(Long.valueOf(CompanyTypeEnum.PRODUCT_BU.getCode()))){ + CascadeDTO cascade = CascadeDTO.of(companyType.getId(), companyType.getName(),null); + res.add(cascade); + } + } + + return res; + } + + + /** + * 处理地区 + * @param wrapper + * @param companyPageQuery + */ + @BuildChildrenRegionWrapper + @LambdaDataScope(type = LambdaDataScopeTypeEnum.COMPANY_TABLE) + public void buildQueryWrapper(LambdaQueryWrapper wrapper, CompanyPageQuery companyPageQuery) { + wrapper.like(StringUtils.isNotBlank(companyPageQuery.getName()),Company::getName, companyPageQuery.getName()) + .eq(Objects.nonNull(companyPageQuery.getBlackList()),Company::getBlackList,companyPageQuery.getBlackList()) + // 根据传入的企业类型获取相对应的企业(信息管理列表要筛选掉管理企业) + .in(CollUtil.isNotEmpty(companyPageQuery.getCompanyTypeList()),Company::getCompanyType,companyPageQuery.getCompanyTypeList()) + .eq(Objects.nonNull(companyPageQuery.getCompanyType()),Company::getCompanyType, companyPageQuery.getCompanyType()) + //// 区县、市散办审核通过的企业才展示 + //.eq(Company::getRegionAuditStatus, AuditStateEnum.AUDIT_SUCESS.getCode()) + //.eq(Company::getCityAuditStatus,AuditStateEnum.AUDIT_SUCESS.getCode()) + .orderBy(Boolean.TRUE,Boolean.TRUE,Company::getName); + } + + /** + * 使用企业列表查询 + * @param wrapper + * @param companyPageQuery + */ + public void buildUseQueryWrapper(LambdaQueryWrapper wrapper, CompanyPageQuery companyPageQuery) { + wrapper.like(StringUtils.isNotBlank(companyPageQuery.getName()),Company::getName, companyPageQuery.getName()) + .eq(Objects.nonNull(companyPageQuery.getBlackList()),Company::getBlackList,companyPageQuery.getBlackList()) + // 根据传入的企业类型获取相对应的企业(信息管理列表要筛选掉管理企业) + .in(CollUtil.isNotEmpty(companyPageQuery.getCompanyTypeList()),Company::getCompanyType,companyPageQuery.getCompanyTypeList()) + .eq(Objects.nonNull(companyPageQuery.getCompanyType()),Company::getCompanyType, companyPageQuery.getCompanyType()) + .orderBy(Boolean.TRUE,Boolean.TRUE,Company::getName); + } + + /** + * 获取企业ids 用区域ids + * @param regionIds + * @return + */ + public List getIdsByRegionIds(List regionIds) { + List regionArr = Lists.newArrayList(); + + if (CollUtil.isEmpty(regionIds)) { + return Collections.emptyList(); + } + + regionIds.stream().forEach(regionId -> { + List regions = regionsCacheHelper.listChildRegionId(regionId); + if (CollUtil.isNotEmpty(regions)) { + regionArr.addAll(regions); + } + }); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Company.class); + wrapper.in(Company::getRegionId, regionArr); + List companies = companyService.list(wrapper); + + if (CollUtil.isEmpty(companies)) { + return Collections.emptyList(); + } + + return companies.stream().map(Company::getId).collect(Collectors.toList()); + } + + public Company save(CompanySaveDTO data, Long userId) { + Company company = companyService.save(data, userId); + companiesCacheHelper.refresh(company.getId()); + return company; + } + + public Company update(CompanyUpdateDTO data, Long userId) { + Company old = companyService.getById(data.getId()); + if (Objects.isNull(old)) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK, String.format("修改企业{} 不存在", data.getId())); + } + if (StringUtils.isNotBlank(data.getName())) { + Assert.isFalse(companyService.check(data.getName(), old.getId()), "企业名{} 已经存在", + data.getName()); + } + Company company = companyService.update(data, userId); + companiesCacheHelper.refresh(company.getId()); + + // 更新企业登录账号所关联的企业法人、法人手机号、登录账号(企业名称)等信息 + // 根据企业名称和企业ID获取原来企业信息员的用户信息 + NdUserInfo companyUserInfo = userInfoService.getOne(Wrappers.lambdaQuery(NdUserInfo.class) + .eq(NdUserInfo::getCompanyId, old.getId()) + .eq(NdUserInfo::getUsername, old.getName())); + if (Objects.nonNull(companyUserInfo)) { + // 更新了企业名称、法人联系电话 + companyUserInfo.setUsername(data.getName()); + companyUserInfo.setMobile(data.getLegalPersonPhone()); + try { + userInfoService.updateById(companyUserInfo); + } catch (Exception e) { + throw new BizException("该法人手机号绑定的用户已存在!"); + } + // 更新登录账号为修改后的企业名称 + Long companyUserId = companyUserInfo.getId(); + NdUserAuth companyUserAuth = userAuthService.getOne(Wrappers.lambdaQuery(NdUserAuth.class) + .eq(NdUserAuth::getUserId, companyUserId)); + companyUserAuth.setIdentifier(companyUserInfo.getUsername()); + userAuthService.updateById(companyUserAuth); + } + + List enterpriseTypes = data.getEnterpriseTypes(); + if (CollUtil.isNotEmpty(enterpriseTypes)){ + // 先删除原来关联的信息,再保存 + companyTypeRelatedService.remove(Wrappers.lambdaQuery(CompanyTypeRelated.class) + .eq(CompanyTypeRelated::getCompanyId,company.getId())); + for (Long enterpriseType : enterpriseTypes) { + CompanyTypeRelated companyTypeRelated = new CompanyTypeRelated(); + companyTypeRelated.setCompanyId(company.getId()); + companyTypeRelated.setCompanyTypeId(enterpriseType); + companyTypeRelatedService.save(companyTypeRelated); + } + } + + // 查询出驾驶员档案中所属公司为该企业的所有驾驶员 + List driverInfoList = driverInfoService.list(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getCompanyId, company.getId())); + driverInfoList.forEach(driverInfo -> driverInfo.setRegionId(data.getRegionId())); + // 更新驾驶员档案信息中所属公司为该企业的所属区域 + driverInfoService.updateBatchById(driverInfoList); + // 查询出车辆档案信息中所属公司为该企业的所有车辆 + List ndVehicleBaseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getCompanyId, company.getId())); + ndVehicleBaseInfoList.forEach(v -> { + v.setRegionId(data.getRegionId()); + v.setRegionName(regionsCacheHelper.getDisplayName(data.getRegionId())); + }); + // 更新车辆档案信息中所属公司为该企业的所属区域 + vehicleBaseInfoService.updateBatchById(ndVehicleBaseInfoList); + return company; + } + + public Boolean removeByIdWithCache(List ids) { + List list = Lists.newArrayList(); + CompanyManage context = (CompanyManage) AopContext.currentProxy(); + for (Long id : ids) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Company.class); + context.buildQuery(wrapper, id); + Company company = companyService.getOne(wrapper); + if (Objects.nonNull(company)) { + list.add(company.getId()); + } + } + Boolean res = companyService.removeByIdWithCache(list); + companiesCacheHelper.refresh(list); + return res; + } + + public PageVo queryUseCompanyList(CompanyPageQuery companyPageQuery) { + Integer pageNumber = companyPageQuery.getPageNumber(); + Integer pageSize = companyPageQuery.getPageSize(); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Company.class); + // 未传入筛选条件时,筛选掉管理企业 + if (CollUtil.isEmpty(companyPageQuery.getCompanyTypeList())) { + companyPageQuery.setCompanyTypeList(Lists.newArrayList(1, 2, 3)); + } + buildUseQueryWrapper(wrapper, companyPageQuery); + + // 获取所有符合传入条件的企业列表 + List companyList = companyService.list(wrapper); + + // 筛选出非管理企业的企业(根据传入的企业类型可筛选出生产企业、物流企业、其他企业) + List companyIdList = companyList.stream().map(Company::getId).collect(Collectors.toList()); + + Map> listMap = companyCreditLevelService.list().stream() + .filter(c -> companyIdList.contains(c.getCompanyId())) + .collect(Collectors.groupingBy(NdCompanyCreditLevel::getCompanyId)); + + Map> companyTypeRelatedMap = companyTypeRelatedService.list().stream() + .collect(Collectors.groupingBy(CompanyTypeRelated::getCompanyId)); + + List dataList = Lists.newArrayList(); + Integer companyType = companyPageQuery.getCompanyType(); + Integer productCompanyType = companyPageQuery.getProductCompanyType(); + // 如果是生产企业列表具体生产企业类型的筛选 + if (CompanyTypeEnum.PRODUCT_BU.getCode().equals(companyType) + && Objects.nonNull(productCompanyType)){ + // 关联表中筛选出对应类型的生产企业 + List relatedCompanyIds = companyTypeRelatedService.list(Wrappers.lambdaQuery(CompanyTypeRelated.class) + .in(CompanyTypeRelated::getCompanyId, companyIdList) + .eq(CompanyTypeRelated::getCompanyTypeId, productCompanyType)) + .stream().map(CompanyTypeRelated::getCompanyId).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(relatedCompanyIds)) { + dataList = companyList.stream() + .filter(c -> relatedCompanyIds.contains(c.getId())) + .collect(Collectors.toList()); + } + }else { + // 非生产企业类型的列表筛选,就根据企业类型返回对应的数据 + dataList = companyList; + } + + List data = CollUtils.convert(dataList, c -> { + CompanyVO vo = new CompanyVO(); + BeanUtils.copyProperties(c, vo); + CodeUtil.searchRegionName(vo); + // 根据企业ID获取企业信用等级 + Long companyId = c.getId(); + List creditLevelList = listMap.get(companyId); + if (CollUtil.isNotEmpty(creditLevelList)) { + // 过滤出当前时间年份的信用等级 + String year = String.valueOf(LocalDateTime.now().getYear()); + List levels = + creditLevelList.stream().filter(d -> year.equals(d.getYear())).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(levels)) { + NdCompanyCreditLevel creditLevel = levels.get(0); + vo.setDangerLevel(creditLevel.getLevel()); + vo.setDangerLevelName(CompanyCreditLevelEnum.getDescByCode(creditLevel.getLevel())); + } + } else { + log.info("该企业{}不在企业信用等级列表中", companyId); + // 默认赋红码 + vo.setDangerLevel(CompanyCreditLevelEnum.E.getCode()); + vo.setDangerLevelName(CompanyCreditLevelEnum.E.getDesc()); + } + + // 如果是生产企业类型列表,要展示具体的生产企业类型 + if (Objects.nonNull(vo.getCompanyType())) { + if (CompanyTypeEnum.PRODUCT_BU.getCode().equals(vo.getCompanyType())) { + List relatedList = companyTypeRelatedMap.get(vo.getId()); + if (CollUtil.isNotEmpty(relatedList)) { + List nameList = relatedList.stream() + .map(r -> ProductCompanyType.getDescByCode(r.getCompanyTypeId())) + .collect(Collectors.toList()); + String typeName = nameList.stream().collect(Collectors.joining(StrPool.COMMA)); + vo.setCompanyTypeName(typeName); + } + } else { + vo.setCompanyTypeName(CompanyTypeEnum.getDescByCode(vo.getCompanyType())); + } + } + return vo; + }); + + // 分页 + List vos = data.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize).collect(Collectors.toList()); + + return PageVo.of(vos, data.size()); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/MenuManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/MenuManage.java new file mode 100644 index 0000000..61233e6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/MenuManage.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.sys.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.sys.entity.Menu; +import com.ningdatech.carapi.sys.entity.RoleMenu; +import com.ningdatech.carapi.sys.entity.vo.MenuRoleVO; +import com.ningdatech.carapi.sys.service.IRoleMenuService; +import com.ningdatech.carapi.sys.utils.TreeUtil; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * @Classname MenuManage + * @Description + * @Date 2022/11/12 11:26 + * @Created by PoffyZhang + */ +@Component +@RequiredArgsConstructor +public class MenuManage { + private final IRoleMenuService roleMenuService; + + public List buildUserMenu(List list, UserInfoDetails loginUser) { + if (Objects.isNull(loginUser) || Objects.isNull(loginUser.getRoleId())) { + return Collections.emptyList(); + } + //查出当前用户的角色菜单 + List roleMenus = roleMenuService.list(Wrappers.lambdaQuery(RoleMenu.class).eq(RoleMenu::getRoleId, loginUser.getRoleId())); + //单一用户 menuId应该是唯一的 可以做成map + Map roleMenuMap = CollUtils.listToMap(roleMenus,r -> r.getMenuId()); + List menuRoles = CollUtils.convert(list, w -> BeanUtil.copyProperties(w, MenuRoleVO.class)); + return TreeUtil.buildUserTree(menuRoles, roleMenuMap); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/OperatorManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/OperatorManage.java new file mode 100644 index 0000000..7033465 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/OperatorManage.java @@ -0,0 +1,125 @@ +package com.ningdatech.carapi.sys.manage; + +import java.util.List; +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; +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.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +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.industry.service.IOperatorIndexScoreInfoService; +import com.ningdatech.carapi.sys.entity.Operator; +import com.ningdatech.carapi.sys.entity.OperatorRegionHead; +import com.ningdatech.carapi.sys.entity.dto.OperatorPageQuery; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.entity.vo.OperatorVO; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +import com.ningdatech.carapi.sys.service.IOperatorScoreInfoService; +import com.ningdatech.carapi.sys.service.OperatorRegionHeadService; +import com.ningdatech.carapi.sys.service.OperatorService; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname OperatorManage + * @Description + * @Date 2022/10/12 11:26 + * @Created by PoffyZhang + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class OperatorManage { + + private final OperatorService operatorService; + private final OperatorRegionHeadService operatorRegionHeadService; + private final IOperatorScoreInfoService operatorScoreInfoService; + + private final IOperatorIndexScoreInfoService operatorIndexScoreInfoService; + private final OperatorsCacheHelper operatorsCacheHelper; + + /** + * 查询列表 + * @param operatorPageQuery + * @return + */ + public PageVo queryList(OperatorPageQuery operatorPageQuery) { + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商id + Long operatorId = operatorQueryDTO.getId(); + Page page = operatorPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Operator.class); + wrapper.like(StringUtils.isNotBlank(operatorPageQuery.getName()), Operator::getName, operatorPageQuery.getName()) + .eq(Operator::getId,operatorId) + .orderBy(Boolean.TRUE, Boolean.FALSE, Operator::getUpdateOn); + operatorService.page(page, wrapper); + List data = CollUtils.convert(page.getRecords(), c -> BeanUtil.copyProperties(c, OperatorVO.class)); + return PageVo.of(data, page.getTotal()); + }else { + Page page = operatorPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Operator.class); + wrapper.like(StringUtils.isNotBlank(operatorPageQuery.getName()), Operator::getName, operatorPageQuery.getName()) + .orderBy(Boolean.TRUE, Boolean.FALSE, Operator::getUpdateOn); + operatorService.page(page, wrapper); + List data = CollUtils.convert(page.getRecords(), c -> BeanUtil.copyProperties(c, OperatorVO.class)); + return PageVo.of(data, page.getTotal()); + } + } + + + /** + * 查询详情 + * @param id + * @return + */ + public OperatorQueryDTO getDetails(Long id) { + Operator operator = operatorService.getById(id); + OperatorQueryDTO query = BeanUtil.toBean(operator, OperatorQueryDTO.class); + fillRegionHead(query); + return query; + } + + /** + * 放入区域负责人 + * @param query + */ + public void fillRegionHead(OperatorQueryDTO query) { + if(Objects.nonNull(query)){ + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(OperatorRegionHead.class); + List regionHeads = getOperatorRegionHeads(query, wrapper); + CodeUtil.searchRegionNames(regionHeads); + query.setOperatorRegionHeads(regionHeads); + } + } + + public List getOperatorRegionHeads(OperatorQueryDTO query, LambdaQueryWrapper wrapper) { + OperatorManage context = (OperatorManage) AopContext.currentProxy(); + context.buildQuery(wrapper, query.getId()); + List regionHeads = operatorRegionHeadService.list(wrapper); + return regionHeads; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ONLY_REGION) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.in(OperatorRegionHead::getOperatorId, id); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/RegionManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/RegionManage.java new file mode 100644 index 0000000..f5a9af9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/RegionManage.java @@ -0,0 +1,663 @@ +package com.ningdatech.carapi.sys.manage; + +import static com.ningdatech.carapi.sys.helper.RegionsCacheHelper.ROOT_PARENT_ID; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.tuple.Pair; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Assert; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.archives.enums.AuditStateEnum; +import com.ningdatech.carapi.car.equipment.manage.VehicleEquipmentManage; +import com.ningdatech.carapi.car.equipment.model.DataAccessDevices; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentChannels; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentInfo; +import com.ningdatech.carapi.car.equipment.model.VehicleEquipmentNo; +import com.ningdatech.carapi.car.equipment.model.dto.VehicleEquipmentPageQuery; +import com.ningdatech.carapi.car.equipment.model.vo.VehicleEquipmentVO; +import com.ningdatech.carapi.car.equipment.service.IDataAccessDevicesService; +import com.ningdatech.carapi.car.equipment.service.INdVehicleEquipmentChannelsService; +import com.ningdatech.carapi.car.equipment.service.INdVehicleEquipmentInfoService; +import com.ningdatech.carapi.car.equipment.service.IVehicleEquipmentNoService; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.constant.DeletedEnum; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.constant.VehicleEquipFuncEnum; +import com.ningdatech.carapi.company.enumeration.CompanyTypeEnum; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.model.DataScopeDto; +import com.ningdatech.carapi.datascope.provider.DataScopeContext; +import com.ningdatech.carapi.sys.convert.RegionConverter; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.Region; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.entity.req.RegionTreeReq; +import com.ningdatech.carapi.sys.entity.vo.*; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.sys.service.IRegionService; +import com.ningdatech.carapi.sys.utils.DataScopeCacheFilterUtil; +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.date.StopWatch; +import cn.hutool.core.map.MapUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * RegionManage + *

+ * + * @author WendyYang + * @since 10:39 2022/10/12 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class RegionManage { + + private final RegionsCacheHelper regionsCacheHelper; + private final CompaniesCacheHelper companiesCacheHelper; + private final IRegionService regionService; + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final VehicleEquipmentManage equipmentManage; + private final INdVehicleEquipmentInfoService vehicleEquipmentInfoService; + private final IDataAccessDevicesService dataAccessDevicesService; + private final INdVehicleEquipmentChannelsService vehicleEquipmentChannelsService; + private final CompanyService companyService; + private final OperatorsCacheHelper operatorsCacheHelper; + private final IVehicleEquipmentNoService vehicleEquipmentNoService; + + public List getRegionTree(RegionTreeReq req) { + Map> companyMap = null; + Map> carNoGroup = null; + Optional dataScope = DataScopeContext.getDataScope(LoginUserUtil.loginUserDetail().getDataScope()); + if (req != null) { + if (req.getWithCarNo() || req.getWithCompany()) { + companyMap = companiesCacheHelper.all().stream() + .map(w -> BeanUtil.copyProperties(w, RegionTreeCompanyVO.class)) + .filter(c -> DataScopeCacheFilterUtil.dataScopeFilter(c, dataScope)) + .collect(Collectors.groupingBy(RegionTreeCompanyVO::getRegionId)); + } + if (req.getWithCarNo()) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + //数据权限 + ((RegionManage) AopContext.currentProxy()).wrapperDataScope(wrapper); + carNoGroup = vehicleBaseInfoService.list(wrapper) + .stream() + .collect(Collectors.groupingBy(NdVehicleBaseInfo::getCompanyId, + Collectors.mapping(car -> convertCar(car), Collectors.toList()))); + } + } + Map> regionMap = CollUtils.group(regionsCacheHelper.getAllWithRole(dataScope, companiesCacheHelper), RegionDTO::getParentId); + return RegionConverter.toRegionTree(ROOT_PARENT_ID, regionMap, false, carNoGroup, companyMap); + } + + public List getRegionCompanyCarNoTree(RegionTreeReq req) { + Map> companyMap = null; + Map>> carNoGroup = null; + Optional dataScope = DataScopeContext.getDataScope(LoginUserUtil.loginUserDetail().getDataScope()); + if (req != null) { + if (req.getWithCarNo() || req.getWithCompany()) { + companyMap = companiesCacheHelper.all().stream() + .map(w -> BeanUtil.copyProperties(w, RegionTreeCompanyVO.class)) + .filter(c -> DataScopeCacheFilterUtil.dataScopeFilter(c, dataScope)) + // 过滤掉管理企业 + .filter(c -> !CompanyTypeEnum.MANAGE_BU.getCode().equals(c.getCompanyType())) + .filter(item -> Objects.nonNull(item.getRegionId())) + .collect(Collectors.groupingBy(RegionTreeCompanyVO::getRegionId)); + } + if (req.getWithCarNo()) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + //数据权限 + ((RegionManage) AopContext.currentProxy()).wrapperDataScope(wrapper); + if(req.getWithDevice()){ + List withDeviceCars = null; + VehicleEquipmentPageQuery vehicleEquipmentPageQuery = new VehicleEquipmentPageQuery(); + vehicleEquipmentPageQuery.setPageNumber(1); + vehicleEquipmentPageQuery.setPageSize(200000); + PageVo ePage = equipmentManage.queryAdded(vehicleEquipmentPageQuery); + if(ePage.getTotal() > 0L){ + withDeviceCars = ePage.getRecords().stream().map(VehicleEquipmentVO::getCarPlate).collect(Collectors.toList()); + if(CollUtil.isNotEmpty(withDeviceCars)){ + wrapper.in(NdVehicleBaseInfo::getCarPlate,withDeviceCars); + } + } + } + carNoGroup = vehicleBaseInfoService.list(wrapper) + .stream() + .collect(Collectors.groupingBy(NdVehicleBaseInfo::getCompanyId, + Collectors.mapping(w -> Pair.of(w.getId(), convertCar(w)), Collectors.toList()))); + } + } + Map> regionMap = CollUtils.group(regionsCacheHelper.getAllWithRole(dataScope, companiesCacheHelper), RegionDTO::getParentId); + // 以车牌号分组,获取所有视频设备信息 + Map> equipmentMap = vehicleEquipmentInfoService.list().stream() + .filter(c -> VehicleEquipFuncEnum.video.name().equals(c.getEquipmentFunction())) + .collect(Collectors.groupingBy(NdVehicleEquipmentInfo::getCarPlate)); + // 获取设备的开启状态信息 + Map devicesMap = dataAccessDevicesService.list().stream() + .collect(Collectors.toMap(c -> c.getPlatformId() + c.getDeviceId(), c -> c)); + + // 获取设备通道信息 + Map channelsMap = vehicleEquipmentChannelsService.list().stream() + .collect(Collectors.toMap(NdVehicleEquipmentChannels::getEquipmentId, e -> e)); + return RegionConverter.toRegionCompanyCarNoTree(ROOT_PARENT_ID, regionMap, false, carNoGroup, companyMap,devicesMap,equipmentMap,channelsMap); + } + + @LambdaDataScope + public LambdaQueryWrapper wrapperDataScope(LambdaQueryWrapper wrapper) { + return wrapper.select(NdVehicleBaseInfo::getCarPlate,NdVehicleBaseInfo::getStatus,NdVehicleBaseInfo::getMoving, NdVehicleBaseInfo::getCompanyId) + .eq(NdVehicleBaseInfo::getDeleted, DeletedEnum.NO_DELETED.getCode()) + .eq(NdVehicleBaseInfo::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()); + } + + + public LambdaQueryWrapper buildRegionWrapper(LambdaQueryWrapper wrapper) { + return wrapper.select(NdVehicleBaseInfo::getCarPlate,NdVehicleBaseInfo::getStatus,NdVehicleBaseInfo::getMoving, NdVehicleBaseInfo::getCompanyId) + .eq(NdVehicleBaseInfo::getDeleted, DeletedEnum.NO_DELETED.getCode()) + .eq(NdVehicleBaseInfo::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()); + } + + public synchronized void saveOrUpdate(RegionTreeVO req) { + if (req.getId() == null) { + if (req.getLevel() > RegionsCacheHelper.MAX_LEVEL) { + throw new BizException("暂不支持添加第四级区域"); + } + if (req.getParentCode().equals(RegionsCacheHelper.ROOT_PARENT_CODE)) { + boolean exists = regionService.getBaseMapper().exists(Wrappers.lambdaQuery(Region.class) + .eq(Region::getParentCode, req.getParentCode()) + .eq(Region::getDeleted, false)); + Assert.isFalse(exists, "顶级区域已存在"); + } + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(Region.class) + .eq(Region::getRegionCode, req.getRegionCode()) + .last("limit 1"); + Region region = regionService.getOne(query); + if (region != null) { + if (!region.getRegionCode().equals(req.getParentCode())) { + if (req.getId() == null || !req.getId().equals(region.getId())) { + throw new BizException("地区编码已存在"); + } + } + } + Long parentId = 0L; + if (req.getLevel() > 1) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Region.class) + .eq(Region::getRegionCode, req.getParentCode()) + .eq(Region::getLevel, req.getLevel() - 1); + Region parent = regionService.getOne(wrapper); + parentId = parent.getId(); + } + Region regionNew = BeanUtil.copyProperties(req, Region.class); + regionNew.setDeleted(false); + regionNew.setParentId(parentId); + regionNew.setUpdateBy(LoginUserUtil.getUserId()); + regionNew.setUpdateOn(LocalDateTime.now()); + if (req.getId() == null) { + regionNew.setCreateBy(regionNew.getUpdateBy()); + regionNew.setCreateOn(regionNew.getUpdateOn()); + } + if (regionService.saveOrUpdate(regionNew)) { + regionsCacheHelper.refresh(regionNew.getId()); + } + } + + public void remove(Long id, Integer level) { + LambdaUpdateWrapper updater = Wrappers.lambdaUpdate(Region.class) + .set(Region::getDeleted, true) + .eq(Region::getDeleted, false) + .eq(Region::getId, id); + if (regionService.update(updater)) { + regionsCacheHelper.refresh(id); + } + } + + private CarVO convertCar(NdVehicleBaseInfo car) { + CarVO res = new CarVO(); + res.setCarPlate(car.getCarPlate()); + res.setStatus(car.getStatus()); + res.setMoving(car.getMoving()); + return res; + } + + public List getRegionInfo() { + + Map regionInfoMap = regionService.list().stream().collect(Collectors.toMap(Region::getId, RegionConverter::toRegionDTO)); + Collection<@NonNull RegionDTO> regions = regionInfoMap.values(); + Map> regionMap = CollUtils.group(regions, RegionDTO::getParentId); + return RegionConverter.toRegionTree(ROOT_PARENT_ID, regionMap, false, null, null); + } + + public CompanyCarInfoVO getCompanyCarInfo(RegionTreeReq req) { + + // 按照登录用户,如果是运营商账号登录,删选出该运营商关联的车辆信息 + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + Long roleId = userDetail.getRoleId(); + + Long regionId = req.getRegionId(); + String carPlate = req.getCarPlate(); + CompanyCarInfoVO companyCarInfoVo = new CompanyCarInfoVO(); + + StopWatch stopWatch = new StopWatch(); + StopWatch stopWatch2 = new StopWatch(); + StopWatch stopWatch3 = new StopWatch(); + StopWatch stopWatch4 = new StopWatch(); + + // 0.09 + Map> companyCarMap = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(Objects.nonNull(regionId),NdVehicleBaseInfo::getRegionId,regionId)).stream() + .filter(v -> Objects.nonNull(v.getCompanyId())) + .collect(Collectors.groupingBy(NdVehicleBaseInfo::getCompanyId)); + + // 0.046 + Map carStatusMap = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(Objects.nonNull(regionId),NdVehicleBaseInfo::getRegionId,regionId) + .eq(NdVehicleBaseInfo::getDeleted,DeletedEnum.NO_DELETED.getCode()) + .eq(NdVehicleBaseInfo::getAuditState,AuditStateEnum.AUDIT_SUCCESS.getCode()) + .select(NdVehicleBaseInfo::getCarPlate, NdVehicleBaseInfo::getMoving)) + .stream().collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, NdVehicleBaseInfo::getMoving)); + + + //// 0.5 + //stopWatch.start(); + //// 以车牌号分组,获取所有视频设备信息 + //Map> equipmentMap = vehicleEquipmentInfoService.list(Wrappers.lambdaQuery(NdVehicleEquipmentInfo.class) + // .select(NdVehicleEquipmentInfo::getVehicleId, NdVehicleEquipmentInfo::getId,NdVehicleEquipmentInfo::getEquipmentNo,NdVehicleEquipmentInfo::getPlatformId) + // .eq(NdVehicleEquipmentInfo::getEquipmentFunction,VehicleEquipFuncEnum.video.name())) + // .stream() + // .collect(Collectors.groupingBy(NdVehicleEquipmentInfo::getVehicleId)); + //stopWatch.stop(); + //log.info("设备信息查询 耗时 {}s", stopWatch.getTotalTimeSeconds()); + //// 获取设备的开启状态信息 + //// 0.6 + //stopWatch2.start(); + //Map devicesMap = dataAccessDevicesService.list(Wrappers.lambdaQuery(DataAccessDevices.class) + // .select(DataAccessDevices::getPlatformId,DataAccessDevices::getDeviceId,DataAccessDevices::getStatus)).stream() + // .collect(Collectors.toMap(c -> c.getPlatformId() + c.getDeviceId(), DataAccessDevices::getStatus)); + //stopWatch2.stop(); + //log.info("设备在线信息查询 耗时 {}s", stopWatch2.getTotalTimeSeconds()); + //// 获取设备通道信息 + //// 0.98 + //stopWatch3.start(); + //Map channelsMap = vehicleEquipmentChannelsService.list().stream().filter(v -> Objects.nonNull(v.getName())) + // .collect(Collectors.toMap(NdVehicleEquipmentChannels::getEquipmentId, NdVehicleEquipmentChannels::getName)); + //stopWatch3.stop(); + //log.info("设备通道信息查询 耗时 {}s", stopWatch2.getTotalTimeSeconds()); + + Map> carEquipmentNoMap = vehicleEquipmentNoService.list().stream() + .collect(Collectors.groupingBy(VehicleEquipmentNo::getCarPlate)); + + // 直接查询车牌号 + if (Objects.nonNull(carPlate)){ + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoService.getOne(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getCarPlate, carPlate)); + if (Objects.nonNull(vehicleBaseInfo)) { + Long baseInfoRegionId = vehicleBaseInfo.getRegionId(); + Long vehicleId = vehicleBaseInfo.getId(); + if (Objects.nonNull(baseInfoRegionId)) { + companyCarInfoVo.setRegionId(baseInfoRegionId); + List companyVos = Lists.newArrayList(); + CompanyVO companyVo = new CompanyVO(); + CompanyDTO companyDto = companiesCacheHelper.getById(vehicleBaseInfo.getCompanyId()); + if (Objects.isNull(companyDto)){ + throw new BizException("查询车辆所属企业不存在!"); + } + companyVo.setId(companyDto.getId()); + companyVo.setName(companyDto.getName()); + companyVo.setRegionId(companyDto.getRegionId()); + companyVos.add(companyVo); + companyCarInfoVo.setCompanyList(companyVos); + List carInfoList = Lists.newArrayList(); + HashMap> carInfoMap = MapUtil.newHashMap(); + CarInfoVO carInfoVo = new CarInfoVO(); + carInfoVo.setCompanyId(vehicleBaseInfo.getCompanyId()); + carInfoVo.setCarPlate(carPlate); + carInfoVo.setMoving(vehicleBaseInfo.getMoving()); + + List vehicleEquipmentNos = carEquipmentNoMap.get(carPlate); + HashMap> equipmentInfoMap = MapUtil.newHashMap(); + if (CollUtil.isNotEmpty(vehicleEquipmentNos)) { + List equipmentInfoList = Lists.newArrayList(); + for (VehicleEquipmentNo equipmentInfo : vehicleEquipmentNos) { + EquipmentInfoVO equipmentInfoVo = new EquipmentInfoVO(); + equipmentInfoVo.setCarPlate(carPlate); + equipmentInfoVo.setDeviceId(equipmentInfo.getDeviceId()); + equipmentInfoVo.setDeviceName(equipmentInfo.getDeviceName()); + String videoStatus = equipmentInfo.getStatus(); + if (Objects.nonNull(videoStatus)) { + equipmentInfoVo.setVideoStatus(videoStatus); + }else { + equipmentInfoVo.setVideoStatus("OFF"); + } + equipmentInfoList.add(equipmentInfoVo); + } + equipmentInfoMap.put(carPlate,equipmentInfoList); + } + carInfoVo.setEquipmentInfoMap(equipmentInfoMap); + carInfoList.add(carInfoVo); + carInfoMap.put(companyDto.getId(),carInfoList); + companyCarInfoVo.setCarInfoMap(carInfoMap); + return companyCarInfoVo; + } + }else { + throw new BizException("查询车辆不存在!"); + } + + } + + //// 直接查询车牌号 + //if (Objects.nonNull(carPlate)){ + // NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoService.getOne(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + // .eq(NdVehicleBaseInfo::getCarPlate, carPlate)); + // if (Objects.nonNull(vehicleBaseInfo)) { + // Long baseInfoRegionId = vehicleBaseInfo.getRegionId(); + // Long vehicleId = vehicleBaseInfo.getId(); + // if (Objects.nonNull(baseInfoRegionId)) { + // companyCarInfoVo.setRegionId(baseInfoRegionId); + // List companyVos = Lists.newArrayList(); + // CompanyVO companyVo = new CompanyVO(); + // CompanyDTO companyDto = companiesCacheHelper.getById(vehicleBaseInfo.getCompanyId()); + // if (Objects.isNull(companyDto)){ + // throw new BizException("查询车辆所属企业不存在!"); + // } + // companyVo.setId(companyDto.getId()); + // companyVo.setName(companyDto.getName()); + // companyVo.setRegionId(companyDto.getRegionId()); + // companyVos.add(companyVo); + // companyCarInfoVo.setCompanyList(companyVos); + // List carInfoList = Lists.newArrayList(); + // HashMap> carInfoMap = MapUtil.newHashMap(); + // CarInfoVO carInfoVo = new CarInfoVO(); + // carInfoVo.setCompanyId(vehicleBaseInfo.getCompanyId()); + // carInfoVo.setCarPlate(carPlate); + // carInfoVo.setMoving(vehicleBaseInfo.getMoving()); + // List equipmentInfos = equipmentMap.get(vehicleId); + // HashMap> equipmentInfoMap = MapUtil.newHashMap(); + // if (CollUtil.isNotEmpty(equipmentInfos)) { + // List equipmentInfoList = Lists.newArrayList(); + // for (NdVehicleEquipmentInfo equipmentInfo : equipmentInfos) { + // EquipmentInfoVO equipmentInfoVo = new EquipmentInfoVO(); + // equipmentInfoVo.setCarPlate(carPlate); + // equipmentInfoVo.setDeviceId(equipmentInfo.getEquipmentNo()); + // String deviceName = channelsMap.get(equipmentInfo.getId()); + // equipmentInfoVo.setDeviceName(deviceName); + // String videoStatus = devicesMap.get(equipmentInfo.getPlatformId() + equipmentInfo.getEquipmentNo()); + // if (Objects.nonNull(videoStatus)) { + // equipmentInfoVo.setVideoStatus(videoStatus); + // }else { + // equipmentInfoVo.setVideoStatus("OFF"); + // } + // equipmentInfoList.add(equipmentInfoVo); + // } + // equipmentInfoMap.put(carPlate,equipmentInfoList); + // } + // carInfoVo.setEquipmentInfoMap(equipmentInfoMap); + // carInfoList.add(carInfoVo); + // carInfoMap.put(companyDto.getId(),carInfoList); + // companyCarInfoVo.setCarInfoMap(carInfoMap); + // return companyCarInfoVo; + // } + // }else { + // throw new BizException("查询车辆不存在!"); + // } + // + //} + + HashMap> carInfoMap = MapUtil.newHashMap(); + // 获取单个区域的数据 + if (CollUtil.isEmpty(req.getRegionIdList())) { + List companyVoList = Lists.newArrayList(); + List companyList = Lists.newArrayList(); + // 如果登录用户是企业用户 + if (UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId().equals(roleId)) { + Long companyId = userDetail.getCompanyId(); + String companyName = userDetail.getCompanyName(); + Long regId = userDetail.getRegionId(); + CompanyVO companyVo = new CompanyVO(); + companyVo.setId(companyId); + companyVo.setName(companyName); + companyVo.setRegionId(regId); + companyVoList.add(companyVo); + companyList.add(companyService.getById(companyId)); + }else { + // 获取该区域下的所有企业 + companyList = companyService.list(Wrappers.lambdaQuery(Company.class) + .in(Company::getCompanyType, Lists.newArrayList(1, 2, 3)) + .eq(Company::getRegionId, regionId)); + companyVoList = companyList.stream().map(c -> { + CompanyVO companyVo = new CompanyVO(); + companyVo.setId(c.getId()); + companyVo.setName(c.getName()); + companyVo.setRegionId(c.getRegionId()); + return companyVo; + }).collect(Collectors.toList()); + } + companyCarInfoVo.setCompanyList(companyVoList); + stopWatch4.start(); + for (Company company : companyList) { + List carInfoList = Lists.newArrayList(); + List vehicleBaseInfos = companyCarMap.get(company.getId()); + // 该企业下没有车,直接跳过 + if (CollUtil.isEmpty(vehicleBaseInfos)) { + continue; + } + // 如果登录用户是运营商,只过滤出运营商下的车辆 + if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String companyName = userDetail.getCompanyName(); + // 暂时控制运营商名称和运营商所在企业名称相同 + OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // 获取运营商id + Long operatorId = operatorQueryDTO.getId(); + vehicleBaseInfos = vehicleBaseInfos.stream().filter(v -> operatorId.equals(v.getOperatorId())) + .collect(Collectors.toList()); + } + // 如果登录用户是企业用户 + else if (UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId().equals(roleId)) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + wrapper.and(w -> w.eq(NdVehicleBaseInfo::getCompanyId, company.getId()).or().eq(NdVehicleBaseInfo::getUseCompanyId, company.getId())); + vehicleBaseInfos = vehicleBaseInfoService.list(wrapper); + } + for (NdVehicleBaseInfo vehicleBaseInfo : vehicleBaseInfos) { + String carNo = vehicleBaseInfo.getCarPlate(); + Long vehicleId = vehicleBaseInfo.getId(); + CarInfoVO carInfoVo = new CarInfoVO(); + carInfoVo.setCompanyId(company.getId()); + carInfoVo.setCarPlate(carNo); + Integer moving = carStatusMap.get(carNo); + carInfoVo.setMoving(moving); + List vehicleEquipmentNos = carEquipmentNoMap.get(carNo); + HashMap> equipmentInfoMap = MapUtil.newHashMap(); + if (CollUtil.isNotEmpty(vehicleEquipmentNos)) { + List equipmentInfoList = Lists.newArrayList(); + for (VehicleEquipmentNo equipmentInfo : vehicleEquipmentNos) { + EquipmentInfoVO equipmentInfoVo = new EquipmentInfoVO(); + equipmentInfoVo.setCarPlate(carNo); + equipmentInfoVo.setDeviceId(equipmentInfo.getDeviceId()); + equipmentInfoVo.setDeviceName(equipmentInfo.getDeviceName()); + String videoStatus = equipmentInfo.getStatus(); + if (Objects.nonNull(videoStatus)) { + equipmentInfoVo.setVideoStatus(videoStatus); + } else { + equipmentInfoVo.setVideoStatus("OFF"); + } + equipmentInfoList.add(equipmentInfoVo); + } + equipmentInfoMap.put(carNo, equipmentInfoList); + carInfoVo.setEquipmentInfoMap(equipmentInfoMap); + } + carInfoList.add(carInfoVo); + carInfoMap.put(company.getId(), carInfoList); + } + } + stopWatch4.stop(); + log.info("装配车辆信息 耗时 {}s", stopWatch2.getTotalTimeSeconds()); + + }else { + // 获取多个区域的企业数据 + List companyList = companyService.list(Wrappers.lambdaQuery(Company.class) + .in(Company::getCompanyType, Lists.newArrayList(1, 2, 3)) + .in(Company::getRegionId, req.getRegionIdList())); + List companyVoList = companyList.stream().map(c -> { + CompanyVO companyVo = new CompanyVO(); + companyVo.setId(c.getId()); + companyVo.setName(c.getName()); + companyVo.setRegionId(c.getRegionId()); + return companyVo; + }).collect(Collectors.toList()); + companyCarInfoVo.setCompanyList(companyVoList); + } + + + //// 获取单个区域的数据 + //if (CollUtil.isEmpty(req.getRegionIdList())) { + // List companyVoList = Lists.newArrayList(); + // List companyList = Lists.newArrayList(); + // // 如果登录用户是企业用户 + // if (UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId().equals(roleId)) { + // Long companyId = userDetail.getCompanyId(); + // String companyName = userDetail.getCompanyName(); + // Long regId = userDetail.getRegionId(); + // CompanyVO companyVo = new CompanyVO(); + // companyVo.setId(companyId); + // companyVo.setName(companyName); + // companyVo.setRegionId(regId); + // companyVoList.add(companyVo); + // companyList.add(companyService.getById(companyId)); + // }else { + // // 获取该区域下的所有企业 + // companyList = companyService.list(Wrappers.lambdaQuery(Company.class) + // .in(Company::getCompanyType, Lists.newArrayList(1, 2, 3)) + // .eq(Company::getRegionId, regionId)); + // companyVoList = companyList.stream().map(c -> { + // CompanyVO companyVo = new CompanyVO(); + // companyVo.setId(c.getId()); + // companyVo.setName(c.getName()); + // companyVo.setRegionId(c.getRegionId()); + // return companyVo; + // }).collect(Collectors.toList()); + // } + // companyCarInfoVo.setCompanyList(companyVoList); + // stopWatch4.start(); + // for (Company company : companyList) { + // List carInfoList = Lists.newArrayList(); + // List vehicleBaseInfos = companyCarMap.get(company.getId()); + // // 该企业下没有车,直接跳过 + // if (CollUtil.isEmpty(vehicleBaseInfos)) { + // continue; + // } + // // 如果登录用户是运营商,只过滤出运营商下的车辆 + // if (UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + // String companyName = userDetail.getCompanyName(); + // // 暂时控制运营商名称和运营商所在企业名称相同 + // OperatorQueryDTO operatorQueryDTO = operatorsCacheHelper.getByName(companyName); + // // 获取运营商id + // Long operatorId = operatorQueryDTO.getId(); + // vehicleBaseInfos = vehicleBaseInfos.stream().filter(v -> operatorId.equals(v.getOperatorId())) + // .collect(Collectors.toList()); + // } + // // 如果登录用户是企业用户 + // else if (UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId().equals(roleId)) { + // LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + // wrapper.and(w -> w.eq(NdVehicleBaseInfo::getCompanyId, company.getId()).or().eq(NdVehicleBaseInfo::getUseCompanyId, company.getId())); + // vehicleBaseInfos = vehicleBaseInfoService.list(wrapper); + // } + // for (NdVehicleBaseInfo vehicleBaseInfo : vehicleBaseInfos) { + // String carNo = vehicleBaseInfo.getCarPlate(); + // Long vehicleId = vehicleBaseInfo.getId(); + // CarInfoVO carInfoVo = new CarInfoVO(); + // carInfoVo.setCompanyId(company.getId()); + // carInfoVo.setCarPlate(carNo); + // Integer moving = carStatusMap.get(carNo); + // carInfoVo.setMoving(moving); + // List equipmentInfos = equipmentMap.get(vehicleId); + // HashMap> equipmentInfoMap = MapUtil.newHashMap(); + // if (CollUtil.isNotEmpty(equipmentInfos)) { + // List equipmentInfoList = Lists.newArrayList(); + // for (NdVehicleEquipmentInfo equipmentInfo : equipmentInfos) { + // EquipmentInfoVO equipmentInfoVo = new EquipmentInfoVO(); + // equipmentInfoVo.setCarPlate(carNo); + // equipmentInfoVo.setDeviceId(equipmentInfo.getEquipmentNo()); + // String deviceName = channelsMap.get(equipmentInfo.getId()); + // equipmentInfoVo.setDeviceName(deviceName); + // String videoStatus = + // devicesMap.get(equipmentInfo.getPlatformId() + equipmentInfo.getEquipmentNo()); + // if (Objects.nonNull(videoStatus)) { + // equipmentInfoVo.setVideoStatus(videoStatus); + // } else { + // equipmentInfoVo.setVideoStatus("OFF"); + // } + // equipmentInfoList.add(equipmentInfoVo); + // } + // equipmentInfoMap.put(carNo, equipmentInfoList); + // carInfoVo.setEquipmentInfoMap(equipmentInfoMap); + // } + // carInfoList.add(carInfoVo); + // carInfoMap.put(company.getId(), carInfoList); + // } + // } + // stopWatch4.stop(); + // log.info("装配车辆信息 耗时 {}s", stopWatch2.getTotalTimeSeconds()); + // + //}else { + // // 获取多个区域的企业数据 + // List companyList = companyService.list(Wrappers.lambdaQuery(Company.class) + // .in(Company::getCompanyType, Lists.newArrayList(1, 2, 3)) + // .in(Company::getRegionId, req.getRegionIdList())); + // List companyVoList = companyList.stream().map(c -> { + // CompanyVO companyVo = new CompanyVO(); + // companyVo.setId(c.getId()); + // companyVo.setName(c.getName()); + // companyVo.setRegionId(c.getRegionId()); + // return companyVo; + // }).collect(Collectors.toList()); + // companyCarInfoVo.setCompanyList(companyVoList); + //} + + companyCarInfoVo.setCarInfoMap(carInfoMap); + companyCarInfoVo.setRegionId(regionId); + return companyCarInfoVo; + } + + public List getRegionCompanyTree(RegionTreeReq req) { + + Map> companyMap = null; + Optional dataScope = DataScopeContext.getDataScope(LoginUserUtil.loginUserDetail().getDataScope()); + if (req != null) { + if (req.getWithCompany()) { + companyMap = companiesCacheHelper.all().stream() + .map(w -> BeanUtil.copyProperties(w, RegionTreeCompanyVO.class)) + .filter(c -> DataScopeCacheFilterUtil.dataScopeFilter(c, dataScope)) + // 过滤掉管理企业 + .filter(c -> !CompanyTypeEnum.MANAGE_BU.getCode().equals(c.getCompanyType())) + .filter(item -> Objects.nonNull(item.getRegionId())) + .collect(Collectors.groupingBy(RegionTreeCompanyVO::getRegionId)); + } + } + Map> regionMap = CollUtils.group(regionsCacheHelper.getAllWithRole(dataScope, companiesCacheHelper), RegionDTO::getParentId); + + return RegionConverter.toRegionCompanyCarNoTree(ROOT_PARENT_ID, regionMap, false, null, companyMap,null,null,null); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/RoleManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/RoleManage.java new file mode 100644 index 0000000..c46e0f6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/RoleManage.java @@ -0,0 +1,92 @@ +package com.ningdatech.carapi.sys.manage; + +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +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.basic.util.CollUtils; +import com.ningdatech.carapi.datascope.model.DataScopeDto; +import com.ningdatech.carapi.datascope.provider.DataScopeContext; +import com.ningdatech.carapi.sys.entity.Menu; +import com.ningdatech.carapi.sys.entity.Role; +import com.ningdatech.carapi.sys.entity.RoleMenu; +import com.ningdatech.carapi.sys.entity.dto.RolePageQuery; +import com.ningdatech.carapi.sys.entity.vo.MenuRoleVO; +import com.ningdatech.carapi.sys.entity.vo.RoleVO; +import com.ningdatech.carapi.sys.entity.vo.UserInfoVO; +import com.ningdatech.carapi.sys.service.IRoleMenuService; +import com.ningdatech.carapi.sys.service.MenuService; +import com.ningdatech.carapi.sys.service.RoleService; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import lombok.RequiredArgsConstructor; + +/** + * @Classname UserRepository + * @Description + * @Date 2022/10/12 11:26 + * @Created by PoffyZhang + */ +@Component +@RequiredArgsConstructor +public class RoleManage { + + private final UserManage userManage; + private final RoleService roleService; + private final MenuService menuService; + + private final IRoleMenuService roleMenuService; + + public PageVo queryList(RolePageQuery rolePageQuery) { + Page page = rolePageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Role.class); + searchList(page, wrapper, rolePageQuery); + List data = CollUtils.convert(page.getRecords(), w -> BeanUtil.copyProperties(w, RoleVO.class)); + return PageVo.of(data, page.getTotal()); + } + + public void searchList(Page page, LambdaQueryWrapper wrapper, RolePageQuery rolePageQuery) { + wrapper.like(StringUtils.isNotBlank(rolePageQuery.getName()), Role::getName, rolePageQuery.getName()) + .orderByAsc(Role::getSort); + roleService.page(page, wrapper); + } + + public Optional getCurrentUserDataScoper() { + UserInfoVO userInfoVO = userManage.queryDetails(LoginUserUtil.getUserId()); + //即便是多个 暂时取一个 + if (Objects.isNull(userInfoVO) || Objects.isNull(userInfoVO.getRole())) { + return Optional.empty(); + } + Role role = roleService.getById(userInfoVO.getRole()); + if (Objects.isNull(role) || Objects.isNull(role.getDataScope())) { + return Optional.empty(); + } + return DataScopeContext.getDataScope(role.getDataScope()); + } + + public void buildMenu(RoleVO query) { + //改成直接返回有权限的 + List list = menuService.list(Wrappers.lambdaQuery(Menu.class).orderByAsc(Menu::getSort)); + List roleMenus = roleMenuService.list(Wrappers.lambdaQuery(RoleMenu.class).eq(RoleMenu::getRoleId, query.getId())); +// List menuRoleVOS = CollUtils.convert(list, w -> BeanUtil.copyProperties(w,MenuRoleVO.class)); +// List menus = TreeUtil.buildTree(menuRoleVOS,roleMenus); + List menus = list.stream().map(menu -> { + for (RoleMenu roleMenu : roleMenus) { + if (roleMenu.getMenuId().equals(menu.getId())) { + return BeanUtil.copyProperties(menu, MenuRoleVO.class); + } + } + return null; + }).filter(Objects::nonNull).collect(Collectors.toList()); + query.setMenu(menus); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/UserManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/UserManage.java new file mode 100644 index 0000000..ad45639 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/manage/UserManage.java @@ -0,0 +1,354 @@ +package com.ningdatech.carapi.sys.manage; + +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.stereotype.Component; + +import com.alibaba.fastjson.JSONObject; +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.google.common.collect.Lists; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.basic.util.NdJsonUtil; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.driver.constant.DriverRegistrationStatusEnum; +import com.ningdatech.carapi.driver.constant.DriverStatusEnum; +import com.ningdatech.carapi.driver.constant.TrainingRegistrationTypeEnum; +import com.ningdatech.carapi.driver.constant.UserCanLoginEnum; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.entity.TrainingRegistrationReview; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.driver.service.ITrainingRegistrationReviewService; +import com.ningdatech.carapi.sys.convert.UserAuthConverter; +import com.ningdatech.carapi.sys.convert.UserRoleConverter; +import com.ningdatech.carapi.sys.entity.MetaApply; +import com.ningdatech.carapi.sys.entity.Role; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.entity.dto.UserPageQuery; +import com.ningdatech.carapi.sys.entity.dto.UserSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.UserUpdateDTO; +import com.ningdatech.carapi.sys.entity.enumeration.BooleanDisplayEnum; +import com.ningdatech.carapi.sys.entity.enumeration.MetaApplyStatusEnum; +import com.ningdatech.carapi.sys.entity.enumeration.MetaApplyTypeEnum; +import com.ningdatech.carapi.sys.entity.vo.UserInfoVO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.service.IMetaApplyService; +import com.ningdatech.carapi.sys.service.RoleService; +import com.ningdatech.carapi.sys.service.UserRoleService; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.entity.NdUserInfoJoin; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoJoinService; +import com.ningdatech.carapi.user.service.INdUserInfoService; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.DesensitizedUtil; +import lombok.RequiredArgsConstructor; + +/** + * @Classname UserRepository + * @Description + * @Date 2022/10/12 11:26 + * @Created by PoffyZhang + */ +@Component +@RequiredArgsConstructor +public class UserManage { + private final INdUserInfoService userInfoService; + private final INdUserInfoJoinService userInfoJoinService; + private final INdUserAuthService userAuthService; + private final UserRoleService userRoleService; + private final RoleService roleService; + private final INdUserInfoService userService; + private final CompaniesCacheHelper companiesCacheHelper; + private final IDriverInfoService driverInfoService; + private final IMetaApplyService iMetaApplyService; + private final ITrainingRegistrationReviewService iTrainingRegistrationReviewService; + private final INdUserInfoService ndUserInfoService; + + public PageVo queryUserList(UserPageQuery userPageQuery){ + Page page = userPageQuery.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdUserInfoJoin.class); + wrapper.like(StringUtils.isNotBlank(userPageQuery.getUsername()),NdUserInfoJoin::getUsername, userPageQuery.getUsername()) + .like(StringUtils.isNotBlank(userPageQuery.getAccount()),NdUserInfoJoin::getAccount, userPageQuery.getAccount()) + .in(Objects.nonNull(userPageQuery.getRoleId()),NdUserInfoJoin::getRoleId, userPageQuery.getRoleId()) + .eq(Boolean.TRUE,NdUserInfoJoin::getCanLogin,UserCanLoginEnum.CAN_LOGIN.getCode()) + .like(StringUtils.isNotBlank(userPageQuery.getCompanyName()),NdUserInfoJoin::getCompanyName, userPageQuery.getCompanyName()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdUserInfoJoin::getUpdateOn); + userInfoJoinService.pageJoin(page, wrapper); + List data = CollUtils.convert(page.getRecords(), w -> BeanUtil.copyProperties(w, UserInfoVO.class)); + // 查出可登录的帐号 + List resVos = searchAuth(data); + // 查出角色名 + searchRoleName(resVos); + return PageVo.of(resVos, page.getTotal()); + } + + public UserInfoVO queryDetails(Long id) { + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdUserInfo.class); + UserManage context = (UserManage) AopContext.currentProxy(); + context.buildQuery(wrapper, id); + NdUserInfo user = userInfoService.getOne(wrapper); + if (Objects.isNull(user)) { + return null; + } + + UserInfoVO query = BeanUtil.toBean(user, UserInfoVO.class); + //查出帐号 + searchAuth(query); + //查出角色 + searchRoleName(query); + return query; + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.ONLY_COMPANY) + public void buildQuery(LambdaQueryWrapper wrapper, Long id) { + wrapper.eq(NdUserInfo::getId,id); + } + + private List searchAuth(List userInfos) { + List results = null; + if(CollUtil.isEmpty(userInfos)){ + return Collections.emptyList(); + } + //查出帐号 + List userIds = userInfos.stream().map(UserInfoVO::getId).collect(Collectors.toList()); + Map userRoleMap = userRoleService.list(Wrappers.lambdaQuery(UserRole.class).in(UserRole::getUserId, userIds)) + .stream().collect(Collectors.toMap(UserRole::getUserId, r -> r)); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdUserAuth.class); + wrapper.in(NdUserAuth::getUserId, userIds); + List auths = userAuthService.list(wrapper); + if(CollUtil.isNotEmpty(auths)){ + results = userInfos.stream() + .map(user -> { + UserInfoVO vo = UserAuthConverter.convert(user, auths); + // 如果用户角色不为企业和运营商,需对账号(手机号)进行脱敏 + Long userId = user.getId(); + UserRole userRole = userRoleMap.get(userId); + if (Objects.nonNull(userRole)) { + Long roleId = userRole.getRoleId(); + if (!UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId().equals(roleId) && + !UserRoleTypeEnum.OPERATOR_ROLE_ID.getId().equals(roleId)) { + String account = user.getAccount(); + String encryptPhone = DesensitizedUtil.mobilePhone(account); + vo.setAccount(encryptPhone); + } + } + return vo; + }) + .collect(Collectors.toList()); + } + return results; + } + + private void searchRoleName(List userInfos) { + if(CollUtil.isEmpty(userInfos)){ + return; + } + //查出角色名 + List userIds = userInfos.stream().map(UserInfoVO::getId).collect(Collectors.toList()); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(UserRole.class); + wrapper.in(UserRole::getUserId, userIds); + List userRoles = userRoleService.list(wrapper); + if(CollUtil.isEmpty(userRoles)){ + return; + } + List roleIds = userRoles.stream() + .map(UserRole::getRoleId) + .distinct() + .collect(Collectors.toList()); + List roles = roleService.listByIds(roleIds); + if(CollUtil.isNotEmpty(roles)){ + userInfos.stream() + .map(user -> UserRoleConverter.convert(user,userRoles,roles)) + .collect(Collectors.toList()); + } + } + + private void searchAuth(UserInfoVO user) { + if(Objects.isNull(user)){ + return; + } + //查出帐号 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdUserAuth.class); + wrapper.in(NdUserAuth::getUserId, user.getId()); + List auths = userAuthService.list(wrapper); + if(CollUtil.isNotEmpty(auths)){ + UserAuthConverter.convert(user,auths); + } + } + + private void searchRoleName(UserInfoVO user) { + if(Objects.isNull(user)){ + return; + } + //查出角色名 + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(UserRole.class); + wrapper.in(UserRole::getUserId, user.getId()); + List userRoles = userRoleService.list(wrapper); + if(CollUtil.isEmpty(userRoles)){ + return; + } + List roleIds = userRoles.stream().map(UserRole::getRoleId).distinct().collect(Collectors.toList()); + List roles = roleService.listByIds(roleIds); + if(CollUtil.isNotEmpty(roles)){ + UserRoleConverter.convert(user,userRoles,roles); + } + } + + public void save(UserSaveDTO data, Long userId) { + // 创建系统用户信息 + userService.save(data, LoginUserUtil.getUserId()); + // 当新增用户角色为驾驶员时,新增驾驶员档案信息,并默认驾驶员材料复审通过(该驾驶员可参加培训考试) + Long roleId = data.getRole(); + if (UserRoleTypeEnum.DRIVER_ROLE_ID.getId().equals(roleId)){ + // 获取对应的驾驶员用户信息 + NdUserInfo ndUserInfo = userInfoService.getOne(Wrappers.lambdaQuery(NdUserInfo.class) + .eq(NdUserInfo::getMobile, data.getMobile())); + // 将该驾驶员用户设置为不可登录状态 + ndUserInfo.setCanLogin(UserCanLoginEnum.CAN_NOT_LOGIN.getCode()); + // 更新信息 + ndUserInfoService.updateById(ndUserInfo); + DriverInfo driverInfo = new DriverInfo(); + driverInfo.setDriverName(data.getUsername()); + driverInfo.setCompanyId(data.getCompanyId()); + CompanyDTO companyDTO = companiesCacheHelper.getById(data.getCompanyId()); + driverInfo.setCompanyName(companyDTO.getName()); + driverInfo.setPhoneNo(data.getMobile()); + driverInfo.setUserId(ndUserInfo.getId()); + driverInfo.setDriverStatus(DriverStatusEnum.induction.name()); + driverInfo.setDriverRegistrationStatus(DriverRegistrationStatusEnum.exam_training_stage.name()); + driverInfo.setInductionTime(LocalDateTime.now()); + driverInfo.setCreateOn(LocalDateTime.now()); + driverInfo.setUpdateOn(LocalDateTime.now()); + driverInfoService.save(driverInfo); + + // 创建空的取证培训初审、复审审核记录 + Long driverId = driverInfo.getId(); + // 获取录入用户信息 + UserInfoDetails loginUser = LoginUserUtil.loginUserDetail(); + // 补充初审审核信息 + MetaApply metaApply = new MetaApply(); + assemblyMetaApplyInfo(ndUserInfo, driverId, loginUser, metaApply); + metaApply.setApplyType(MetaApplyTypeEnum.PRELIMINARY_REVIEW.name()); + metaApply.setApplyStatus(MetaApplyStatusEnum.FIRST_TRIAL_APPROVED.name()); + iMetaApplyService.save(metaApply); + + // 补充驾驶员报名初审审核表信息 + TrainingRegistrationReview trainingRegistrationReviewSaveRecord = new TrainingRegistrationReview(); + assemblyTrainingRegistrationReviewInfo(data, ndUserInfo, companyDTO, driverId, loginUser, metaApply, trainingRegistrationReviewSaveRecord); + trainingRegistrationReviewSaveRecord.setMetaApplyType(MetaApplyTypeEnum.PRELIMINARY_REVIEW.name()); + trainingRegistrationReviewSaveRecord.setRegistrationType(TrainingRegistrationTypeEnum.FORENSIC_REGISTRATION.name()); + trainingRegistrationReviewSaveRecord.setApprovalStatus(MetaApplyStatusEnum.FIRST_TRIAL_APPROVED.name()); + iTrainingRegistrationReviewService.save(trainingRegistrationReviewSaveRecord); + + // 补充复审审核信息 + MetaApply inReviewMetaApply = new MetaApply(); + assemblyMetaApplyInfo(ndUserInfo, driverId, loginUser, inReviewMetaApply); + inReviewMetaApply.setApplyType(MetaApplyTypeEnum.IN_REVIEW.name()); + inReviewMetaApply.setApplyStatus(MetaApplyStatusEnum.REEXAMINATION_APPROVED.name()); + iMetaApplyService.save(inReviewMetaApply); + + // 补充驾驶员报名复审审核表信息 + TrainingRegistrationReview trainingRegistrationReviewSaveRecord2 = new TrainingRegistrationReview(); + assemblyTrainingRegistrationReviewInfo(data, ndUserInfo, companyDTO, driverId, loginUser, inReviewMetaApply, trainingRegistrationReviewSaveRecord2); + trainingRegistrationReviewSaveRecord2.setPreliminaryReviewAssociatedId(trainingRegistrationReviewSaveRecord.getId()); + trainingRegistrationReviewSaveRecord2.setMetaApplyType(MetaApplyTypeEnum.IN_REVIEW.name()); + trainingRegistrationReviewSaveRecord2.setRegistrationType(TrainingRegistrationTypeEnum.FORENSIC_REGISTRATION.name()); + trainingRegistrationReviewSaveRecord2.setApprovalStatus(MetaApplyStatusEnum.REEXAMINATION_APPROVED.name()); + iTrainingRegistrationReviewService.save(trainingRegistrationReviewSaveRecord2); + + } + } + + private void assemblyTrainingRegistrationReviewInfo(UserSaveDTO data, NdUserInfo ndUserInfo, CompanyDTO companyDTO, Long driverId, UserInfoDetails loginUser, MetaApply inReviewMetaApply, TrainingRegistrationReview trainingRegistrationReviewSaveRecord2) { + trainingRegistrationReviewSaveRecord2.setMetaApplyId(inReviewMetaApply.getId()); + trainingRegistrationReviewSaveRecord2.setCompanyId(data.getCompanyId()); + trainingRegistrationReviewSaveRecord2.setCompanyName(companyDTO.getName()); + trainingRegistrationReviewSaveRecord2.setRegionId(companyDTO.getRegionId()); + trainingRegistrationReviewSaveRecord2.setDriverUserId(ndUserInfo.getId()); + trainingRegistrationReviewSaveRecord2.setDriverId(driverId); + trainingRegistrationReviewSaveRecord2.setDriverName(data.getUsername()); + trainingRegistrationReviewSaveRecord2.setDriverPhoneNo(data.getMobile()); + trainingRegistrationReviewSaveRecord2.setCreateBy(loginUser.getUserId()); + trainingRegistrationReviewSaveRecord2.setCreateOn(LocalDateTime.now()); + trainingRegistrationReviewSaveRecord2.setUpdateOn(LocalDateTime.now()); + } + + private void assemblyMetaApplyInfo(NdUserInfo ndUserInfo, Long driverId, UserInfoDetails loginUser, MetaApply metaApply) { + metaApply.setCreateOn(LocalDateTime.now()); + metaApply.setUpdateOn(LocalDateTime.now()); + metaApply.setUserId(ndUserInfo.getId()); + metaApply.setApplyTime(LocalDateTime.now()); + metaApply.setApplicantId(loginUser.getUserId()); + metaApply.setApplicant(loginUser.getNickName()); + metaApply.setRegionId(loginUser.getRegionId()); + metaApply.setCompanyId(loginUser.getCompanyId()); + JSONObject extraMaterial = new JSONObject(); + extraMaterial.put("driverInfoId", driverId); + metaApply.setExtraMaterial(NdJsonUtil.toJson(extraMaterial)); + metaApply.setDisplayEnable(BooleanDisplayEnum.Y.name()); + } + + public void update(UserUpdateDTO data, Long userId) { + Long roleId = data.getRole(); + // 当编辑用户角色为驾驶员时,更新驾驶员档案信息 + if (UserRoleTypeEnum.DRIVER_ROLE_ID.getId().equals(roleId)){ + Long userInfoId = data.getId(); + DriverInfo driverInfo = driverInfoService.getOne(Wrappers.lambdaQuery(DriverInfo.class).eq(DriverInfo::getUserId, userInfoId)); + if(Objects.nonNull(driverInfo)){ + driverInfo.setDriverName(data.getUsername()); + CompanyDTO companyDTO = companiesCacheHelper.getById(data.getCompanyId()); + driverInfo.setCompanyName(companyDTO.getName()); + driverInfo.setCompanyId(data.getCompanyId()); + driverInfo.setPhoneNo(data.getMobile()); + driverInfoService.updateById(driverInfo); + } + } + userService.update(data, LoginUserUtil.getUserId()); + } + + public Boolean remove(List ids) { + + ids.forEach(userId ->{ + UserRole userRole = userRoleService.getOne(Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getUserId, userId)); + Long roleId = userRole.getRoleId(); + // 当删除用户角色为驾驶员时,删除驾驶员档案信息 + if (UserRoleTypeEnum.DRIVER_ROLE_ID.getId().equals(roleId)){ + driverInfoService.remove(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getUserId,userId)); + } + }); + + UserManage context = (UserManage) AopContext.currentProxy(); + List list = Lists.newArrayList(); + for (Long id : ids) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(NdUserInfo.class); + context.buildQuery(wrapper, id); + NdUserInfo userInfo = userService.getOne(wrapper); + if (Objects.nonNull(userInfo)) { + list.add(userInfo.getId()); + } + } + + return userService.removeByIdWithCache(list); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CodingRuleMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CodingRuleMapper.java new file mode 100644 index 0000000..ec8ee88 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CodingRuleMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.ningdatech.carapi.sys.entity.CodingRule; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-20 + */ +public interface CodingRuleMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CodingRuleMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CodingRuleMapper.xml new file mode 100644 index 0000000..41aa5e5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CodingRuleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyJoinMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyJoinMapper.java new file mode 100644 index 0000000..b4e2735 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyJoinMapper.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.sys.entity.CompanyJoin; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + * 企业 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface CompanyJoinMapper extends BaseMapper { + String QUERY_SQL = "SELECT c.*, o.name as operator_name FROM nd_company_info AS c " + + "LEFT JOIN nd_operator_info AS o ON c.operator_id = o.id "; + String WRAPPER_SQL = "SELECT * from ( " + QUERY_SQL + " ) AS q ${ew.customSqlSegment}"; + + @Select(WRAPPER_SQL) + Page pageJoin(Page page, @Param("ew") LambdaQueryWrapper wrapper); + + @Select(WRAPPER_SQL) + List listJoin(@Param("ew") LambdaQueryWrapper wrapper); + + @Select(WRAPPER_SQL) + CompanyJoin oneJoin(@Param("ew") LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyMapper.java new file mode 100644 index 0000000..6d61b31 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyMapper.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.sys.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherOnlineVehiclesPO; +import com.ningdatech.carapi.company.entity.po.ResCompanyTotalPO; +import com.ningdatech.carapi.sys.entity.Company; + +/** + *

+ * Mapper 接口 + * 企业 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface CompanyMapper extends BaseMapper { + + Page pageVehicleNum(Page page,@Param("param") RptOtherParamDTO param); + + List countByRegion(@Param("param") DataScreenParam param); + + List countEnterpriseType(@Param("param") DataScreenParam param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyMapper.xml new file mode 100644 index 0000000..f55efe7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyMapper.xml @@ -0,0 +1,106 @@ + + + + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyTypeMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyTypeMapper.java new file mode 100644 index 0000000..35ccdc1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyTypeMapper.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.sys.entity.CompanyType; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + * 企业 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface CompanyTypeMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyTypeRelatedMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyTypeRelatedMapper.java new file mode 100644 index 0000000..bc1536b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/CompanyTypeRelatedMapper.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.sys.entity.CompanyTypeRelated; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + * 企业 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface CompanyTypeRelatedMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/ExamRuleMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/ExamRuleMapper.java new file mode 100644 index 0000000..692793e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/ExamRuleMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.ningdatech.carapi.sys.entity.ExamRule; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-20 + */ +public interface ExamRuleMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/ExamRuleMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/ExamRuleMapper.xml new file mode 100644 index 0000000..eed86b5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/ExamRuleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/MenuMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/MenuMapper.java new file mode 100644 index 0000000..79aab08 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/MenuMapper.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.sys.entity.Menu; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + * 菜单 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface MenuMapper extends BaseMapper { + + /** + * 查询用户可用菜单 + * + * @param userId 用户id + * @return 菜单 + */ + List findVisibleMenu(@Param("userId") Long userId); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/MenuMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/MenuMapper.xml new file mode 100644 index 0000000..e171881 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/MenuMapper.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id,label,sort_value,parent_id,created_by,create_time,updated_by,update_time, tree_grade, tree_path, + describe_, is_general, path, component, state, icon, group_, readonly_, resource_type, is_def, custom_class, data_scope + + + + + + id, label, path, component, state, sort_value, icon, group_, parent_id, resource_type, tree_grade, tree_path + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/MetaApplyMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/MetaApplyMapper.java new file mode 100644 index 0000000..3b00f3c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/MetaApplyMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.ningdatech.carapi.sys.entity.MetaApply; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Liuxinxin + * @since 2022-10-15 + */ +public interface MetaApplyMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/MetaApplyMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/MetaApplyMapper.xml new file mode 100644 index 0000000..04bb05d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/MetaApplyMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorMapper.java new file mode 100644 index 0000000..050aec3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorMapper.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.sys.entity.Operator; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + * 运营商 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface OperatorMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorMapper.xml new file mode 100644 index 0000000..90a5b0d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorRegionHeadMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorRegionHeadMapper.java new file mode 100644 index 0000000..2464895 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorRegionHeadMapper.java @@ -0,0 +1,18 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.sys.entity.OperatorRegionHead; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + * 运营商 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface OperatorRegionHeadMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorRegionHeadMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorRegionHeadMapper.xml new file mode 100644 index 0000000..130d85b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorRegionHeadMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorScoreInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorScoreInfoMapper.java new file mode 100644 index 0000000..308f4a3 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorScoreInfoMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.ningdatech.carapi.industry.entity.OperatorScoreInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-01-04 + */ +public interface OperatorScoreInfoMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorScoreInfoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorScoreInfoMapper.xml new file mode 100644 index 0000000..a4d4aa4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/OperatorScoreInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RegionMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RegionMapper.java new file mode 100644 index 0000000..caafa0d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RegionMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.ningdatech.carapi.sys.entity.Region; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author LiuXinXin + * @since 2022-10-08 + */ +public interface RegionMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RegionMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RegionMapper.xml new file mode 100644 index 0000000..388ab2c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RegionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/ResourceMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/ResourceMapper.java new file mode 100644 index 0000000..f3f2ba6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/ResourceMapper.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.sys.entity.Resource; +import com.ningdatech.carapi.sys.entity.dto.ResourceQueryDTO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + * 资源 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface ResourceMapper extends BaseMapper { + /** + * 查询 拥有的资源 + * + * @param resource 查询参数 + * @return 可用资源 + */ + List findVisibleResource(ResourceQueryDTO resource); + + /** + * 根据唯一索引 保存或修改资源 + * + * @param resource 资源 + * @return 操作条数 + */ + int saveOrUpdateUnique(Resource resource); + + /** + * 根据资源id查询菜单id + * + * @param resourceIdList 资源id + * @return 菜单id + */ + List findMenuIdByResourceId(@Param("resourceIdList") List resourceIdList); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/ResourceMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/ResourceMapper.xml new file mode 100644 index 0000000..5c565eb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/ResourceMapper.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + id,created_by,create_time,updated_by,update_time, + code, name, menu_id, describe_, readonly_ + + + + + + + insert into c_resource ( id, created_by, create_time, updated_by, update_time, + code, name, menu_id, describe_) + values (#{id,jdbcType=BIGINT}, #{createUser,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},#{updateUser,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, + #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{menuId,jdbcType=BIGINT}, #{tags,jdbcType=VARCHAR}, #{describe,jdbcType=VARCHAR} ) + ON DUPLICATE KEY UPDATE + name = #{name,jdbcType=VARCHAR}, + describe_ = #{describe,jdbcType=VARCHAR}, + updated_by = #{updateUser,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=TIMESTAMP} + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleAuthorityMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleAuthorityMapper.java new file mode 100644 index 0000000..9d6cdf9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleAuthorityMapper.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.sys.entity.RoleAuthority; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + * 角色的资源 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface RoleAuthorityMapper extends BaseMapper { + + /** + * 根据用户-角色-数据权限关系,查询可用的数据权限ID + *

+ * 角色被禁用后,用户不在拥有此角色的权限 + * + * @param userId 用户ID + * @param category 角色类别 + * @return + */ + List selectDataScopeIdFromRoleByUserId(@Param("userId") Long userId, @Param("category") String category); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleAuthorityMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleAuthorityMapper.xml new file mode 100644 index 0000000..6836f5c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleAuthorityMapper.xml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleMapper.java new file mode 100644 index 0000000..cbf1a72 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleMapper.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.sys.entity.Role; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + *

+ * Mapper 接口 + * 角色 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface RoleMapper extends BaseMapper { + /** + * 查询用户拥有的角色 + * + * @param userId 用户id + * @return 角色 + */ + List findRoleByUserId(@Param("userId") Long userId); + + /** + * 根据角色编码查询用户ID + * + * @param codes 角色编码 + * @return 用户id + */ + List findUserIdByCode(@Param("codes") String[] codes); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleMapper.xml new file mode 100644 index 0000000..e58ef95 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleMapper.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + id,created_by,create_time,updated_by,update_time, category, + name, code, describe_, state, readonly_ + + + + + r.id, r.name, r.code, r.describe_, r.state, r.readonly_, r.category + + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleMenuMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleMenuMapper.java new file mode 100644 index 0000000..5345160 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleMenuMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.ningdatech.carapi.sys.entity.RoleMenu; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-11-11 + */ +public interface RoleMenuMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleMenuMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleMenuMapper.xml new file mode 100644 index 0000000..e4122a5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/RoleMenuMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/UserRoleMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/UserRoleMapper.java new file mode 100644 index 0000000..6fed11f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/UserRoleMapper.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi.sys.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.carapi.sys.entity.UserRole; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + * 角色分配 + * 账号角色绑定 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface UserRoleMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/UserRoleMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/UserRoleMapper.xml new file mode 100644 index 0000000..5a8cdb6 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/mapper/UserRoleMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/CompanyJoinService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/CompanyJoinService.java new file mode 100644 index 0000000..4ba9efe --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/CompanyJoinService.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.sys.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.sys.entity.CompanyJoin; + +import java.util.List; + +/** + *

+ * 企业 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +public interface CompanyJoinService extends IService { + Page pageJoin(Page page, LambdaQueryWrapper wrapper); + + List listJoin(LambdaQueryWrapper wrapper); + + CompanyJoin oneJoin(LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/CompanyService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/CompanyService.java new file mode 100644 index 0000000..0bcef97 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/CompanyService.java @@ -0,0 +1,73 @@ +package com.ningdatech.carapi.sys.service; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherOnlineVehiclesPO; +import com.ningdatech.carapi.company.entity.po.ResCompanyTotalPO; +import com.ningdatech.carapi.safe.model.dto.SecurityHonestyPageQuery; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.dto.CompanySaveDTO; +import com.ningdatech.carapi.sys.entity.dto.CompanyUpdateDTO; + +/** + *

+ * 企业 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +public interface CompanyService extends IService { + + + /** + * 根据ID删除 + * + * @param ids id + * @return 是否成功 + */ + boolean removeByIdWithCache(List ids); + + /** + * 保存企业 + * + * @param data 企业 + * @param userId 用户id + */ + Company save(CompanySaveDTO data, Long userId); + + /** + * 修改 + * + * @param data 企业 + * @param userId 用户id + */ + Company update(CompanyUpdateDTO data, Long userId); + + Boolean check(String name); + + Boolean check(String name, Long id); + + Map listCompanyByIds(Collection ids); + + List listCompanyByCompanyNames(Collection names); + + Company getCompanyByCompanyNames(String companyName); + + List findCompanyIdsByRegionId(DataScreenParam param); + + Page pageVehicleNum(Page page, RptOtherParamDTO param); + + List countByRegion(DataScreenParam param); + + List countEnterpriseType(DataScreenParam param); + + Page pageDataScope(Page page, LambdaQueryWrapper wrapper, SecurityHonestyPageQuery param); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/CompanyTypeRelatedService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/CompanyTypeRelatedService.java new file mode 100644 index 0000000..e0fdd73 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/CompanyTypeRelatedService.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.sys.entity.CompanyTypeRelated; + +/** + *

+ * 企业类型关系 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +public interface CompanyTypeRelatedService extends IService { + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/CompanyTypeService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/CompanyTypeService.java new file mode 100644 index 0000000..5ccee9a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/CompanyTypeService.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.sys.entity.CompanyType; + +/** + *

+ * 企业类型 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +public interface CompanyTypeService extends IService { + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/ICodingRuleService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/ICodingRuleService.java new file mode 100644 index 0000000..67e18ab --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/ICodingRuleService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.sys.service; + +import com.ningdatech.carapi.sys.entity.CodingRule; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-20 + */ +public interface ICodingRuleService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IExamRuleService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IExamRuleService.java new file mode 100644 index 0000000..369505c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IExamRuleService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.sys.service; + +import com.ningdatech.carapi.sys.entity.ExamRule; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-20 + */ +public interface IExamRuleService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IMetaApplyService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IMetaApplyService.java new file mode 100644 index 0000000..256ed9f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IMetaApplyService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.sys.service; + +import com.ningdatech.carapi.sys.entity.MetaApply; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author Liuxinxin + * @since 2022-10-15 + */ +public interface IMetaApplyService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IOperatorScoreInfoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IOperatorScoreInfoService.java new file mode 100644 index 0000000..f2cd26c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IOperatorScoreInfoService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.sys.service; + +import com.ningdatech.carapi.industry.entity.OperatorScoreInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-01-04 + */ +public interface IOperatorScoreInfoService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IRegionService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IRegionService.java new file mode 100644 index 0000000..aa2516f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IRegionService.java @@ -0,0 +1,51 @@ +package com.ningdatech.carapi.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.sys.entity.Region; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; + +import java.util.List; + +/** + *

+ * 地域管理 服务类 + *

+ * + * @author LiuXinXin + * @since 2022-10-08 + */ +public interface IRegionService extends IService { + + /** + * 查询所有区域 + * + * @return 所有区域 + */ + List queryAll(); + + /** + * 查询大于等与该级别的所有区域 + * + * @param regionLevel + * @return 区域集合 + */ + List listGeLevel(int regionLevel); + + /** + * 是否为父节点 + * + * @param regionId 区域ID + * @return boolean + **/ + boolean isParentRegion(Long regionId); + + /** + * 获取当前区域的本级 + * + * @param parentId 区域ID + * @param regionCode 区域code + * @return 区域ID + **/ + Long getRegionIdByParentIdWithSameRegionCode(Long parentId, String regionCode); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IRoleMenuService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IRoleMenuService.java new file mode 100644 index 0000000..c607c9f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/IRoleMenuService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.sys.service; + +import com.ningdatech.carapi.sys.entity.RoleMenu; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author PoffyZhang + * @since 2022-11-11 + */ +public interface IRoleMenuService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/MenuService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/MenuService.java new file mode 100644 index 0000000..c8e7010 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/MenuService.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.sys.entity.Menu; +import com.ningdatech.carapi.sys.entity.dto.MenuSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.MenuUpdateDTO; +import com.ningdatech.carapi.sys.entity.vo.MenuResourceTreeVO; + +import java.util.List; + +/** + *

+ * 业务接口 + * 菜单 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +public interface MenuService extends IService { + + /** + * 根据ID删除 + * + * @param ids id + * @return 是否成功 + */ + boolean removeByIdWithCache(List ids); + + /** + * 修改菜单 + * + * @param menu 菜单 + * @return 是否成功 + */ + boolean update(MenuUpdateDTO menu, Long userId); + + /** + * 保存菜单 + * + * @param menu 菜单 + * @return 是否成功 + */ + boolean save(MenuSaveDTO menu, Long userId); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/OperatorRegionHeadService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/OperatorRegionHeadService.java new file mode 100644 index 0000000..cc71b75 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/OperatorRegionHeadService.java @@ -0,0 +1,41 @@ +package com.ningdatech.carapi.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.sys.entity.OperatorRegionHead; +import com.ningdatech.carapi.sys.entity.dto.OperatorRegionHeadSaveDTO; + +import java.util.List; + +/** + *

+ * 运营商区域负责人 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +public interface OperatorRegionHeadService extends IService { + + + /** + * 根据ID删除 + * @param ids id + * @return 是否成功 + */ + boolean removeByIdWithCache(List ids); + + /** + * 根据运营商ID删除区域负责人 + * @param operatorId + * @return 是否成功 + */ + boolean removeByRegionId(Long operatorId); + + /** + * 保存企业 + * + * @param datas 运营商区域负责人 + * @param userId 用户id + */ + void saveBatch(List datas,Long operatorId, Long userId); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/OperatorService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/OperatorService.java new file mode 100644 index 0000000..1f45bbb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/OperatorService.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.sys.entity.Operator; +import com.ningdatech.carapi.sys.entity.dto.OperatorSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.OperatorUpdateDTO; + +import java.util.List; + +/** + *

+ * 运营商 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +public interface OperatorService extends IService { + + + /** + * 根据ID删除 + * @param ids id + * @return 是否成功 + */ + boolean removeByIdWithCache(List ids); + + /** + * 保存企业 + * + * @param data 运营商 + * @param userId 用户id + */ + void save(OperatorSaveDTO data, Long userId); + + /** + * 修改 + * + * @param data 运营商 + * @param userId 用户id + */ + void update(OperatorUpdateDTO data, Long userId); + + Boolean check(String name); + Boolean check(String name, Long id); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/ResourceService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/ResourceService.java new file mode 100644 index 0000000..96128bb --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/ResourceService.java @@ -0,0 +1,58 @@ +package com.ningdatech.carapi.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.sys.entity.Resource; + +import java.util.List; + +/** + *

+ * 业务接口 + * 资源 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +public interface ResourceService extends IService { + + /** + * 根据ID删除 + * + * @param ids id + * @return 是否成功 + */ + boolean removeByIdWithCache(List ids); + + /** + * 保存 + * + * @param resource 资源 + * @return 是否成功 + */ + boolean saveWithCache(Resource resource); + + + /** + * 根据菜单id删除资源 + * + * @param menuIds 菜单id + */ + void removeByMenuIdWithCache(List menuIds); + + /** + * 根据资源id 查询菜单id + * + * @param resourceIdList 资源id + * @return 菜单id + */ + List findMenuIdByResourceId(List resourceIdList); + + /** + * 检测资源编码是否可用 + * + * @param id 资源id + * @param code 资源编码 + */ + Boolean check(Long id, String code); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/RoleAuthorityService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/RoleAuthorityService.java new file mode 100644 index 0000000..4bfbd74 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/RoleAuthorityService.java @@ -0,0 +1,71 @@ +package com.ningdatech.carapi.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.sys.entity.RoleAuthority; +import com.ningdatech.carapi.sys.entity.dto.RoleAuthoritySaveDTO; +import com.ningdatech.carapi.sys.entity.dto.RoleUserSaveVO; +import com.ningdatech.carapi.sys.entity.dto.UserRoleSaveDTO; + +import java.util.List; + +/** + *

+ * 业务接口 + * 角色的资源 + *

+ * + * @author PoffyZhang + */ +public interface RoleAuthorityService extends IService { + /** + * 根据用户-角色-数据权限关系,查询可用的数据权限ID + *

+ * 角色被禁用后,用户不在拥有此角色的权限 + * + * @param userId 用户ID + * @param category 角色类别 + * @return + */ + List selectDataScopeIdFromRoleByUserId(Long userId, String category); + + /** + * 给用户分配角色 + * + * @param userRole 用于角色 + * @return 是否成功 + */ + boolean saveUserRole(UserRoleSaveDTO userRole); + + /** + * 给角色绑定用户 + * + * @param roleUser 用于角色 + * @return 是否成功 + */ + List saveRoleUser(RoleUserSaveVO roleUser); + + /** + * 根据角色查找用户 + * + * @param roleId 角色ID + * @return + */ + List findUserIdByRoleId(Long roleId); + + /** + * 给角色重新分配 权限(资源/菜单) + * + * @param roleAuthoritySaveDTO 角色授权信息 + * @return 是否成功 + */ + boolean saveRoleAuthority(RoleAuthoritySaveDTO roleAuthoritySaveDTO); + + /** + * 根据权限id 删除 + * + * @param ids id + * @return 是否成功 + */ + boolean removeByAuthorityId(List ids); + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/RoleService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/RoleService.java new file mode 100644 index 0000000..35960c2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/RoleService.java @@ -0,0 +1,78 @@ +package com.ningdatech.carapi.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.sys.entity.Role; +import com.ningdatech.carapi.sys.entity.dto.RoleSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.RoleUpdateDTO; + +import java.util.List; + +/** + *

+ * 业务接口 + * 角色 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +public interface RoleService extends IService { + + + /** + * 根据ID删除 + * + * @param ids id + * @return 是否成功 + */ + boolean removeByIdWithCache(List ids); + + /** + * 判断用户是否 租户系统的超级管理员 + * + * @param code 角色编码 + * @return 是否成功 + */ + boolean isPtAdmin(String code); + + /** + * 查询用户拥有的角色 + * + * @param userId 用户id + * @return 角色 + */ + List findRoleByUserId(Long userId); + + /** + * 保存角色 + * + * @param data 角色 + * @param userId 用户id + */ + void saveRole(RoleSaveDTO data, Long userId); + + /** + * 修改 + * + * @param role 角色 + * @param userId 用户id + */ + void updateRole(RoleUpdateDTO role, Long userId); + + /** + * 根据角色编码查询用户ID + * + * @param codes 角色编码 + * @return 用户id + */ + List findUserIdByCode(String[] codes); + + /** + * 检测角色名重复 + * + * @param name + * @return 存在返回真 + */ + Boolean check(String name); + Boolean check(String name,Long id); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/UserRoleService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/UserRoleService.java new file mode 100644 index 0000000..3ebcc45 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/UserRoleService.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.sys.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.sys.entity.UserRole; + +/** + *

+ * 业务接口 + * 角色分配 + * 账号角色绑定 + *

+ * + * @author PoffyZhang + */ +public interface UserRoleService extends IService { + /** + * 初始化超级管理员角色 权限 + * + * @param userId 用户id + * @return 是否正确 + */ + boolean initAdmin(Long userId); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CodingRuleServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CodingRuleServiceImpl.java new file mode 100644 index 0000000..7ab6e98 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CodingRuleServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.sys.service.impl; + +import com.ningdatech.carapi.sys.entity.CodingRule; +import com.ningdatech.carapi.sys.mapper.CodingRuleMapper; +import com.ningdatech.carapi.sys.service.ICodingRuleService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-20 + */ +@Service +public class CodingRuleServiceImpl extends ServiceImpl implements ICodingRuleService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CompanyJoinServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CompanyJoinServiceImpl.java new file mode 100644 index 0000000..9d7dcbf --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CompanyJoinServiceImpl.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.sys.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.sys.entity.CompanyJoin; +import com.ningdatech.carapi.sys.mapper.CompanyJoinMapper; +import com.ningdatech.carapi.sys.service.CompanyJoinService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 业务实现类 + * 企业 + *

+ * + * @author PoffyZhang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class CompanyJoinServiceImpl extends ServiceImpl implements CompanyJoinService { + + private final CompanyJoinMapper companyJoinMapper; + + @Override + @LambdaDataScope(wrapperIndex = 1,type = LambdaDataScopeTypeEnum.COMPANY_TABLE) + public Page pageJoin(Page page, LambdaQueryWrapper wrapper) { + return companyJoinMapper.pageJoin(page,wrapper); + } + + @Override + public List listJoin(LambdaQueryWrapper wrapper){ + return companyJoinMapper.listJoin(wrapper); + } + + @Override + public CompanyJoin oneJoin(LambdaQueryWrapper wrapper) { + return companyJoinMapper.oneJoin(wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CompanyServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CompanyServiceImpl.java new file mode 100644 index 0000000..426cb3c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CompanyServiceImpl.java @@ -0,0 +1,346 @@ +package com.ningdatech.carapi.sys.service.impl; + +import java.util.*; +import java.util.stream.Collectors; + +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.aop.framework.AopContext; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.exception.BaseUncheckedException; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.archives.enums.AuditStateEnum; +import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam; +import com.ningdatech.carapi.car.rpt.model.dto.RptOtherParamDTO; +import com.ningdatech.carapi.car.rpt.model.po.RptOtherOnlineVehiclesPO; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionEntity; +import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.company.entity.po.ResCompanyTotalPO; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.datascope.aop.XmlDataScope; +import com.ningdatech.carapi.datascope.contants.LambdaDataScopeTypeEnum; +import com.ningdatech.carapi.driver.constant.UserCanLoginEnum; +import com.ningdatech.carapi.safe.model.dto.SecurityHonestyPageQuery; +import com.ningdatech.carapi.sys.contants.UserLoginConstant; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.CompanyType; +import com.ningdatech.carapi.sys.entity.CompanyTypeRelated; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.entity.dto.CompanySaveDTO; +import com.ningdatech.carapi.sys.entity.dto.CompanyUpdateDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.helper.UserCacheHelper; +import com.ningdatech.carapi.sys.mapper.CompanyMapper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.sys.service.CompanyTypeRelatedService; +import com.ningdatech.carapi.sys.service.CompanyTypeService; +import com.ningdatech.carapi.sys.service.UserRoleService; +import com.ningdatech.carapi.sys.utils.AuthCacheKeyUtils; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.mapper.NdUserInfoMapper; +import com.ningdatech.carapi.user.security.auth.constant.AuthTypeEnum; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpStatus; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + *

+ * 业务实现类 + * 企业 + *

+ * + * @author PoffyZhang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class CompanyServiceImpl extends ServiceImpl implements CompanyService { + + private final CompanyMapper companyMapper; + private final NdUserInfoMapper userInfoMapper; + + private final CompanyTypeService companyTypeService; + private final CompanyTypeRelatedService companyTypeRelatedService; + private final RegionsCacheHelper regionsCacheHelper; + private final CompaniesCacheHelper companiesCacheHelper; + private final INdUserInfoService userInfoService; + private final UserCacheHelper userCacheHelper; + private final PasswordEncoder passwordEncoder; + private final INdUserAuthService ndUserAuthService; + private final UserRoleService userRoleService; + private final IVehicleBaseInfoService vehicleBaseInfoService; + private final CachePlusOps cachePlusOps; + + /** + * + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean removeByIdWithCache(List ids) { + if (ids.isEmpty()) { + return true; + } + + // 获取企业名称 + List companyNameList = companyMapper.selectList(Wrappers.lambdaQuery(Company.class).in(Company::getId, ids)).stream() + .map(Company::getName).collect(Collectors.toList()); + // 删除企业 + boolean removeFlag = removeByIds(ids); + if(removeFlag){ + companiesCacheHelper.refresh(ids); + // 删除该企业用户及用户关联的角色、账号密码等信息 + List userInfos = userInfoService.list(Wrappers.lambdaQuery(NdUserInfo.class) + .in(NdUserInfo::getUsername, companyNameList)); + for (NdUserInfo userInfo : userInfos) { + Long id = userInfo.getId(); + UserRole userRole = userRoleService.getOne(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getUserId, id)); + if (Objects.nonNull(userRole)) { + Long roleId = userRole.getRoleId(); + if (UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId().equals(roleId)) { + // 删除企业用户 + userInfoService.removeById(userInfo); + //删除关联表和缓存 + ndUserAuthService.remove(Wrappers.lambdaQuery(NdUserAuth.class).eq(NdUserAuth::getUserId, id)); + userRoleService.remove(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getUserId, id)); + cachePlusOps.del(AuthCacheKeyUtils.userResourceCacheKey(id)); + userCacheHelper.refresh(id); + } + } + } + + // 车辆关联的这些企业与区域信息置为空 + List vehicleBaseInfoList = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .in(NdVehicleBaseInfo::getCompanyId, ids)); + + for (NdVehicleBaseInfo vehicleBaseInfo : vehicleBaseInfoList) { + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(NdVehicleBaseInfo.class); + updateWrapper.set(NdVehicleBaseInfo::getCompanyId,null) + .set(NdVehicleBaseInfo::getUseCompanyId,null) + .set(NdVehicleBaseInfo::getUseCompanyName,null) + .set(NdVehicleBaseInfo::getRegionId,null) + .set(NdVehicleBaseInfo::getRegionName,null) + .eq(NdVehicleBaseInfo::getCarPlate,vehicleBaseInfo.getCarPlate()); + vehicleBaseInfoService.update(updateWrapper); + } + } + + //删除前要判断是否企业下还有用户 + //ids.forEach(entId -> { + // if (userInfoMapper.selectCount(Wrappers.lambdaQuery(NdUserInfo.class).eq(NdUserInfo::getCompanyId, entId)) > 0) { + // throw new BaseUncheckedException(HttpStatus.HTTP_OK, "删除失败!企业下还有用户存在 {}", + // entId); + // } + //}); + + // 企业 + return removeFlag; + } + + + /** + * 保存用户 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Company save(CompanySaveDTO data, Long userId) { + if (StrUtil.isNotBlank(data.getName()) + && check(data.getName())) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "企业名{} 已经存在", + data.getName()); + } + Company company = BeanUtil.toBean(data, Company.class); + + //创建人 最后修改人 + company.setCreateBy(userId); + company.setUpdateBy(userId); + company.setRegionName(regionsCacheHelper.getDisplayName(data.getRegionId())); + // 默认新增的企业为待审核 + company.setRegionAuditStatus(AuditStateEnum.AUDIT.getCode()); + company.setCityAuditStatus(AuditStateEnum.AUDIT.getCode()); + if(save(company)){ + companiesCacheHelper.refresh(company.getId()); + } + // 公司类型 + if (CollUtil.isNotEmpty(data.getEnterpriseTypes())) { + // 先删除原来关联的信息,再保存 + companyTypeRelatedService.remove(Wrappers.lambdaQuery(CompanyTypeRelated.class) + .eq(CompanyTypeRelated::getCompanyId,company.getId())); + for (Long enterpriseType : data.getEnterpriseTypes()) { + CompanyTypeRelated companyTypeRelated = new CompanyTypeRelated(); + companyTypeRelated.setCompanyId(company.getId()); + companyTypeRelated.setCompanyTypeId(enterpriseType); + companyTypeRelatedService.save(companyTypeRelated); + } + } + + // 新增企业后,直接创建企业信息员账号 + NdUserInfo user = new NdUserInfo(); + user.setUsername(company.getName()); + user.setCompanyId(company.getId()); + // 登录用户手机号使用企业法人电话 + user.setMobile(company.getLegalPersonPhone()); + user.setNickName(company.getName()); + user.setCanLogin(UserCanLoginEnum.CAN_LOGIN.getCode()); + + //创建人 最后修改人 + user.setCreateBy(userId); + user.setUpdateBy(userId); + if (checkMobile(company)){ + throw new BizException("该法人手机号绑定的企业用户已存在,请更换法人手机号!"); + } + boolean save = userInfoService.save(user); + if(save){ + userCacheHelper.refresh(user.getId()); + } + + NdUserAuth userAuth = new NdUserAuth(); + userAuth.setUserId(user.getId()); + // 登录账号使用企业全称 + userAuth.setIdentifier(company.getName()); + // 初始密码使用123456Aa + userAuth.setCredential(passwordEncoder.encode(UserLoginConstant.LOGIN_PASSWORD)); + userAuth.setAuthType(AuthTypeEnum.ACCOUNT_PASSWORD.getKey()); + ndUserAuthService.save(userAuth); + + UserRole userRole = new UserRole(); + userRole.setUserId(user.getId()); + // 用户角色设置为企业信息员 + userRole.setRoleId(UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId()); + userRoleService.save(userRole); + return company; + } + + private Boolean checkMobile(Company company) { + return userInfoService.count(Wrappers.lambdaQuery(NdUserInfo.class) + .eq(NdUserInfo::getMobile, company.getLegalPersonPhone())) > 0; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Company update(CompanyUpdateDTO data, Long userId) { + Company company = BeanUtil.toBean(data, Company.class); + //最后修改人 + company.setUpdateBy(userId); + company.setRegionName(regionsCacheHelper.getDisplayName(data.getRegionId())); + if(updateById(company)){ + companiesCacheHelper.refresh(company.getId()); + } + //公司类型 + if (CollUtil.isNotEmpty(data.getEnterpriseTypes())) { + companyTypeRelatedService.remove(Wrappers.lambdaQuery(CompanyTypeRelated.class).eq(CompanyTypeRelated::getCompanyId, company.getId())); + for (Long enterpriseType : data.getEnterpriseTypes()) { + CompanyType companyType = companyTypeService.getById(enterpriseType); + if (Objects.nonNull(companyType)) { + companyTypeRelatedService.save(new CompanyTypeRelated(null, company.getId(), companyType.getId())); + } + } + } + return company; + } + + @Override + public Boolean check(String name) { + return super.count(Wrappers.lambdaQuery(Company.class).eq(Company::getName, name)) > 0; + } + + @Override + public Boolean check(String name, Long id) { + return super.count(Wrappers.lambdaQuery(Company.class).ne(Company::getId, id) + .eq(Company::getName, name)) > 0; + } + + @Override + public Map listCompanyByIds(Collection ids) { + if (CollectionUtils.isEmpty(ids)) { + return Collections.emptyMap(); + } + List companyList = list(Wrappers.lambdaQuery(Company.class) + .in(Company::getId, ids)); + return CollUtils.listToMap(companyList, Company::getId); + } + + @Override + public List listCompanyByCompanyNames(Collection names) { + if (CollectionUtils.isEmpty(names)) { + return Collections.emptyList(); + } + LambdaQueryWrapper query = Wrappers.lambdaQuery(Company.class); + query.in(Company::getName, names); + return list(query); + } + + @Override + public Company getCompanyByCompanyNames(String companyName) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(Company.class); + query.eq(Company::getName, companyName); + return getOne(query); + } + + @Override + public List findCompanyIdsByRegionId(DataScreenParam param) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Company.class); + CompanyServiceImpl context = (CompanyServiceImpl)AopContext.currentProxy(); + List list = context.searchCompanyIdsByRegionId(wrapper,param); + return list.stream().map(v -> String.valueOf(v.getId())).collect(Collectors.toList()); + } + + @Override + @XmlDataScope(entityIndex = 1) + @BuildChildrenRegionEntity(entityIndex = 1) + public Page pageVehicleNum(Page page, RptOtherParamDTO param) { + CodeUtil.buildRegionLevel(param); + return companyMapper.pageVehicleNum(page,param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List countByRegion(DataScreenParam param) { + CodeUtil.buildRegionLevel(param); + return companyMapper.countByRegion(param); + } + + @Override + @XmlDataScope + @BuildChildrenRegionEntity + public List countEnterpriseType(DataScreenParam param) { + CodeUtil.buildRegionLevel(param); + return companyMapper.countEnterpriseType(param); + } + + @Override + @LambdaDataScope(wrapperIndex = 1) + @BuildChildrenRegionWrapper(wrapperIndex = 1,entityIndex = 2) + public Page pageDataScope(Page page, LambdaQueryWrapper wrapper, SecurityHonestyPageQuery param) { + return page(page,wrapper); + } + + @LambdaDataScope(type = LambdaDataScopeTypeEnum.COMPANY_TABLE) + @BuildChildrenRegionWrapper + public List searchCompanyIdsByRegionId(LambdaQueryWrapper wrapper, DataScreenParam param) { + log.info(param.toString()); + return list(wrapper); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CompanyTypeRelatedServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CompanyTypeRelatedServiceImpl.java new file mode 100644 index 0000000..d0f0b6c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CompanyTypeRelatedServiceImpl.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.sys.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.sys.entity.CompanyTypeRelated; +import com.ningdatech.carapi.sys.mapper.CompanyTypeRelatedMapper; +import com.ningdatech.carapi.sys.service.CompanyTypeRelatedService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + *

+ * 业务实现类 + *

+ * + * @author PoffyZhang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class CompanyTypeRelatedServiceImpl extends ServiceImpl implements CompanyTypeRelatedService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CompanyTypeServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CompanyTypeServiceImpl.java new file mode 100644 index 0000000..3094f3c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/CompanyTypeServiceImpl.java @@ -0,0 +1,23 @@ +package com.ningdatech.carapi.sys.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.carapi.sys.entity.CompanyType; +import com.ningdatech.carapi.sys.mapper.CompanyTypeMapper; +import com.ningdatech.carapi.sys.service.CompanyTypeService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + *

+ * 业务实现类 + *

+ * + * @author PoffyZhang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class CompanyTypeServiceImpl extends ServiceImpl implements CompanyTypeService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/ExamRuleServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/ExamRuleServiceImpl.java new file mode 100644 index 0000000..983b898 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/ExamRuleServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.sys.service.impl; + +import com.ningdatech.carapi.sys.entity.ExamRule; +import com.ningdatech.carapi.sys.mapper.ExamRuleMapper; +import com.ningdatech.carapi.sys.service.IExamRuleService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-20 + */ +@Service +public class ExamRuleServiceImpl extends ServiceImpl implements IExamRuleService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/MenuServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/MenuServiceImpl.java new file mode 100644 index 0000000..e324197 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/MenuServiceImpl.java @@ -0,0 +1,182 @@ +package com.ningdatech.carapi.sys.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpStatus; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BaseUncheckedException; +import com.ningdatech.basic.util.ValidatorUtil; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.sys.entity.Menu; +import com.ningdatech.carapi.sys.entity.dto.MenuSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.MenuUpdateDTO; +import com.ningdatech.carapi.sys.entity.enumeration.MenuTypeEnum; +import com.ningdatech.carapi.sys.mapper.MenuMapper; +import com.ningdatech.carapi.sys.service.MenuService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import static com.ningdatech.basic.util.StrPool.DEF_PARENT_ID; + + +/** + *

+ * 业务实现类 + * 菜单 + *

+ * + * @author PoffyZhang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class MenuServiceImpl extends ServiceImpl implements MenuService { + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean removeByIdWithCache(List ids) { + if (ids.isEmpty()) { + return true; + } + + List lastIds = Lists.newArrayList(); + lastIds.addAll(ids); + + //子菜单id + subMenus(ids,lastIds); + + boolean result = this.removeByIds(lastIds); + return result; + } + + private void subMenus(List ids, List lastIds) { + if(CollUtil.isEmpty(ids)){ + return; + } + + ids.forEach(id -> { + List subMenus = list(Wrappers.lambdaQuery(Menu.class).eq(Menu::getPid, id)); + if(CollUtil.isNotEmpty(subMenus)){ + //添加子菜单ID + List subIds = subMenus.stream().map(Menu::getId).collect(Collectors.toList()); + lastIds.addAll(subIds); + //递归 + subMenus(subIds,lastIds); + } + }); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean update(MenuUpdateDTO data, Long userId) { + if (MenuTypeEnum.MENU.getCode().equals(data.getType())) { + if(StrUtil.isBlank(data.getPath())){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【地址栏路径】不能为空"); + } + if(StrUtil.isBlank(data.getComponent())){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【页面路径】不能为空"); + } + if (!ValidatorUtil.isUrl(data.getPath())) { + if(checkPath(data.getId(), data.getPath())){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK,"【地址栏路径】:{}重复", data.getPath()); + } + } + } + Menu old = getById(data); + if(Objects.isNull(old)){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK,"您修改的菜单已不存在"); + } + Menu menu = BeanUtil.toBean(data, Menu.class); + menu.setUpdateBy(userId); + return this.updateById(menu); + } + + public Boolean checkPath(Long id, String path) { + return baseMapper.selectCount(Wrappers.lambdaQuery(Menu.class).ne(Menu::getId, id).eq(Menu::getPath, path)) > 0; + } + + public Boolean checkTitle(Long id, String title) { + return baseMapper.selectCount(Wrappers.lambdaQuery(Menu.class).ne(Menu::getId, id) + .in(Menu::getType, MenuTypeEnum.MENU.getCode()).eq(Menu::getTitle, title)) > 0; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean save(MenuSaveDTO data, Long userId) { + if (MenuTypeEnum.MENU.getCode().equals(data.getType())) { + if(StrUtil.isBlank(data.getPath())){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【地址栏路径】不能为空"); + } + if(StrUtil.isBlank(data.getComponent())){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "【页面路径】不能为空"); + } + if (!ValidatorUtil.isUrl(data.getPath())) { + if(checkPath(null, data.getPath())){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK,"【地址栏路径】:{}重复", data.getPath()); + } + } + } + data.setPid(Convert.toLong(data.getPid(), DEF_PARENT_ID)); + + Menu menu = BeanUtil.toBean(data, Menu.class); + menu.setCreateBy(userId); + menu.setUpdateBy(userId); + save(menu); + return Boolean.TRUE; + } + + private void checkGeneral(Menu data, boolean isUpdate) { +// if (data.getIsGeneral() == null) { +// return; +// } +// +// if (data.getIsGeneral()) { +// // isGeneral 子节点 改成是,父节点全是 +// if (!TreeUtil.isRoot(data.getParentId())) { +// Menu parent = getById(data.getParentId()); +// Assert.notNull(parent, "父节点不存在"); +// Assert.isTrue(parent.getIsGeneral(), "请先将父节点{} “公共资源”字段修改为:“是”,在修改本节点", parent.getLabel()); +// } +// return; +// } + +// if (isUpdate) { +// // isGeneral 父节点 改成否,子节点全否 +// List childrenList = findChildrenByParentId(data.getId()); +// if (CollUtil.isNotEmpty(childrenList)) { +// childrenList.forEach(item -> { +// Assert.isFalse(item.getIsGeneral(), String.format("请先将子节点%s “公共资源”字段修改为:“否”,在修改本节点", item.getLabel())); +// }); +// } +// } + } + + public List findChildrenByParentId(Long pid) { + if(Objects.isNull(pid)){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "pid 不能为空"); + } + return list(Wrappers.lambdaQuery(Menu.class).in(Menu::getPid, pid).orderByAsc(Menu::getSort)); + } + + private void fill(Menu resource) { + if (resource.getPid() == null || resource.getPid() <= 0) { + resource.setPid(DefValConstants.PARENT_ID); + } else { + Menu parent = getById(resource.getPid()); + if(Objects.isNull(parent)){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "请正确填写父级"); + } + } + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/MetaApplyServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/MetaApplyServiceImpl.java new file mode 100644 index 0000000..a910486 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/MetaApplyServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.sys.service.impl; + +import com.ningdatech.carapi.sys.entity.MetaApply; +import com.ningdatech.carapi.sys.mapper.MetaApplyMapper; +import com.ningdatech.carapi.sys.service.IMetaApplyService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author Liuxinxin + * @since 2022-10-15 + */ +@Service +public class MetaApplyServiceImpl extends ServiceImpl implements IMetaApplyService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/OperatorRegionHeadServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/OperatorRegionHeadServiceImpl.java new file mode 100644 index 0000000..fb0dc4c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/OperatorRegionHeadServiceImpl.java @@ -0,0 +1,84 @@ +package com.ningdatech.carapi.sys.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Maps; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.sys.entity.OperatorRegionHead; +import com.ningdatech.carapi.sys.entity.dto.OperatorRegionHeadSaveDTO; +import com.ningdatech.carapi.sys.mapper.OperatorRegionHeadMapper; +import com.ningdatech.carapi.sys.service.OperatorRegionHeadService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *

+ * 业务实现类 + * 运营商区域负责人 + *

+ * + * @author PoffyZhang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class OperatorRegionHeadServiceImpl extends ServiceImpl + implements OperatorRegionHeadService { + + private final CachePlusOps cachePlusOps; + private final OperatorRegionHeadMapper operatorRegionHeadMapper; + + /** + * + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean removeByIdWithCache(List ids) { + if (ids.isEmpty()) { + return true; + } + // 运营商 + boolean removeFlag = removeByIds(ids); + + return removeFlag; + } + + @Override + public boolean removeByRegionId(Long operatorId) { + if (Objects.isNull(operatorId)) { + return Boolean.FALSE; + } + + Map columnsMap = Maps.newHashMap(); + columnsMap.put("operator_id",operatorId); + removeByMap(columnsMap); + + return Boolean.TRUE; + } + + + /** + * 保存用户 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void saveBatch(List datas,Long operatorId, Long userId) { + if(CollUtil.isEmpty(datas)){ + return; + } + datas.forEach(data -> { + OperatorRegionHead operatorRegionHead = BeanUtil.toBean(data, OperatorRegionHead.class); + operatorRegionHead.setOperatorId(operatorId); + //创建人 最后修改人 + operatorRegionHead.setCreateBy(userId); + operatorRegionHead.setUpdateBy(userId); + save(operatorRegionHead); + }); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/OperatorScoreInfoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/OperatorScoreInfoServiceImpl.java new file mode 100644 index 0000000..0befff4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/OperatorScoreInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.sys.service.impl; + +import com.ningdatech.carapi.industry.entity.OperatorScoreInfo; +import com.ningdatech.carapi.sys.mapper.OperatorScoreInfoMapper; +import com.ningdatech.carapi.sys.service.IOperatorScoreInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-01-04 + */ +@Service +public class OperatorScoreInfoServiceImpl extends ServiceImpl implements IOperatorScoreInfoService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/OperatorServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/OperatorServiceImpl.java new file mode 100644 index 0000000..2f07159 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/OperatorServiceImpl.java @@ -0,0 +1,128 @@ +package com.ningdatech.carapi.sys.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpStatus; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.exception.BaseUncheckedException; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.sys.entity.Operator; +import com.ningdatech.carapi.sys.entity.OperatorRegionHead; +import com.ningdatech.carapi.sys.entity.dto.OperatorSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.OperatorUpdateDTO; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +import com.ningdatech.carapi.sys.mapper.OperatorMapper; +import com.ningdatech.carapi.sys.service.OperatorRegionHeadService; +import com.ningdatech.carapi.sys.service.OperatorService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 业务实现类 + * 运营商 + *

+ * + * @author PoffyZhang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class OperatorServiceImpl extends ServiceImpl implements OperatorService { + + private final CachePlusOps cachePlusOps; + private final OperatorMapper operatorMapper; + private final OperatorRegionHeadService operatorRegionHeadService; + + private final OperatorsCacheHelper operatorsCacheHelper; + + /** + * + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean removeByIdWithCache(List ids) { + if (ids.isEmpty()) { + return true; + } + // 运营商 + boolean removeFlag = removeByIds(ids); + operatorsCacheHelper.refresh(ids); + //删除区域负责人 + operatorRegionHeadService.remove(Wrappers.lambdaQuery(OperatorRegionHead.class) + .in(OperatorRegionHead::getOperatorId, ids)); + return removeFlag; + } + + + /** + * 保存用户 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void save(OperatorSaveDTO data, Long userId) { + if(StrUtil.isNotBlank(data.getName()) + && check(data.getName())){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "运营商{} 已经存在", + data.getName()); + } + Operator operator = BeanUtil.toBean(data, Operator.class); + //创建人 最后修改人 + operator.setCreateBy(userId); + operator.setUpdateBy(userId); + if(save(operator)){ + operatorsCacheHelper.refresh(operator.getId()); + } + if(CollUtil.isNotEmpty(data.getOperatorRegionHeads())){ + //先删除 再批量添加 + operatorRegionHeadService.removeByRegionId(operator.getId()); + operatorRegionHeadService.saveBatch(data.getOperatorRegionHeads(),operator.getId(),userId); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(OperatorUpdateDTO data, Long userId) { + Operator old = operatorMapper.selectById(data.getId()); + if(Objects.isNull(old)){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK,String.format("修改运营商{} 不存在",data.getId())); + } + + if(StringUtils.isNotBlank(data.getName())){ + Assert.isFalse(check(data.getName(),old.getId()), "运营商名{} 已经存在", + data.getName()); + } + + Operator operator = BeanUtil.toBean(data, Operator.class); + //最后修改人 + operator.setUpdateBy(userId); + if(updateById(operator)){ + operatorsCacheHelper.refresh(operator.getId()); + } + if(CollUtil.isNotEmpty(data.getOperatorRegionHeads())){ + //先删除 再批量添加 + operatorRegionHeadService.removeByRegionId(operator.getId()); + operatorRegionHeadService.saveBatch(data.getOperatorRegionHeads(),operator.getId(),userId); + } + } + + @Override + public Boolean check(String name) { + return super.count(Wrappers.lambdaQuery(Operator.class).eq(Operator::getName, name)) > 0; + } + + @Override + public Boolean check(String name,Long id) { + return super.count(Wrappers.lambdaQuery(Operator.class).ne(Operator::getId,id) + .eq(Operator::getName, name)) > 0; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/RegionServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/RegionServiceImpl.java new file mode 100644 index 0000000..8dafb2b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/RegionServiceImpl.java @@ -0,0 +1,56 @@ +package com.ningdatech.carapi.sys.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.carapi.sys.convert.RegionConverter; +import com.ningdatech.carapi.sys.entity.Region; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.mapper.RegionMapper; +import com.ningdatech.carapi.sys.service.IRegionService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author LiuXinXin + * @since 2022-10-08 + */ +@Service +public class RegionServiceImpl extends ServiceImpl implements IRegionService { + + @Override + public List queryAll() { + List allRegions = this.lambdaQuery().ne(Region::getId, -1).list(); + return CollUtils.convert(allRegions, RegionConverter::toRegionDTO); + } + + @Override + public List listGeLevel(int regionLevel) { + List regionsByLevel = lambdaQuery().ne(Region::getId, -1) + .le(Region::getLevel, regionLevel).list(); + return CollUtils.convert(regionsByLevel, RegionConverter::toRegionDTO); + } + + @Override + public boolean isParentRegion(Long regionId) { + return baseMapper.exists(Wrappers.lambdaQuery(Region.class) + .eq(Region::getParentId, regionId) + .eq(Region::getDeleted, false)); + } + + @Override + public Long getRegionIdByParentIdWithSameRegionCode(Long parentId, String regionCode) { + return baseMapper.selectOne(Wrappers.lambdaQuery(Region.class) + .eq(Region::getParentId, parentId) + .eq(Region::getRegionCode, regionCode) + .eq(Region::getDeleted, false)) + .getId(); + } + + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/ResourceServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/ResourceServiceImpl.java new file mode 100644 index 0000000..d4542d1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/ResourceServiceImpl.java @@ -0,0 +1,85 @@ +package com.ningdatech.carapi.sys.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpStatus; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.exception.BaseUncheckedException; +import com.ningdatech.carapi.sys.entity.Resource; +import com.ningdatech.carapi.sys.mapper.ResourceMapper; +import com.ningdatech.carapi.sys.service.ResourceService; +import com.ningdatech.carapi.sys.service.RoleAuthorityService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 业务实现类 + * 资源 + *

+ * + * @author PoffyZhang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class ResourceServiceImpl extends ServiceImpl implements ResourceService { + + private final RoleAuthorityService roleAuthorityService; + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean removeByIdWithCache(List ids) { + boolean result = this.removeByIds(ids); + + // 删除角色的权限 + roleAuthorityService.removeByAuthorityId(ids); + return result; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void removeByMenuIdWithCache(List menuIds) { + List resources = super.list(Wrappers.lambdaQuery(Resource.class).in(Resource::getMenuId, menuIds)); + if (resources.isEmpty()) { + return; + } + List resourceIdList = resources.stream().mapToLong(Resource::getId).boxed().collect(Collectors.toList()); + this.removeByIds(resourceIdList); + + List allIds = CollUtil.newArrayList(menuIds); + allIds.addAll(resourceIdList); + // 删除角色的权限 + roleAuthorityService.removeByAuthorityId(allIds); + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean saveWithCache(Resource resource) { + resource.setCode(StrUtil.blankToDefault(resource.getCode(), RandomUtil.randomString(8))); + if (check(null, resource.getCode())) { + throw new BaseUncheckedException(HttpStatus.HTTP_BAD_REQUEST,String.format("编码[%s]重复", resource.getCode())); + } + + this.save(resource); + return true; + } + + @Override + public List findMenuIdByResourceId(List resourceIdList) { + return baseMapper.findMenuIdByResourceId(resourceIdList); + } + + @Override + public Boolean check(Long id, String code) { + return super.count(Wrappers.lambdaQuery(Resource.class).ne(Resource::getId, id).eq(Resource::getCode, code)) > 0; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/RoleAuthorityServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/RoleAuthorityServiceImpl.java new file mode 100644 index 0000000..699433d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/RoleAuthorityServiceImpl.java @@ -0,0 +1,192 @@ +package com.ningdatech.carapi.sys.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.lang.Assert; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.sys.entity.RoleAuthority; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.entity.dto.RoleAuthoritySaveDTO; +import com.ningdatech.carapi.sys.entity.dto.RoleUserSaveVO; +import com.ningdatech.carapi.sys.entity.dto.UserRoleSaveDTO; +import com.ningdatech.carapi.sys.entity.enumeration.AuthorizeType; +import com.ningdatech.carapi.sys.mapper.ResourceMapper; +import com.ningdatech.carapi.sys.mapper.RoleAuthorityMapper; +import com.ningdatech.carapi.sys.service.RoleAuthorityService; +import com.ningdatech.carapi.sys.service.UserRoleService; +import com.ningdatech.carapi.sys.utils.AuthCacheKeyUtils; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * 业务实现类 + * 角色的资源 + *

+ * + * @author PoffyZhang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class RoleAuthorityServiceImpl extends ServiceImpl implements RoleAuthorityService { + + private final UserRoleService userRoleService; + private final ResourceMapper resourceMapper; + private final CachePlusOps cachePlusOps; + + @Override + public List selectDataScopeIdFromRoleByUserId(Long userId, String category) { + return baseMapper.selectDataScopeIdFromRoleByUserId(userId, category); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public List saveRoleUser(RoleUserSaveVO saveVO) { + Assert.notEmpty(saveVO.getUserIdList(), "请选择用户"); + if (saveVO.getFlag() == null) { + saveVO.setFlag(true); + } + + userRoleService.remove(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getRoleId, saveVO.getRoleId()).in(UserRole::getUserId, saveVO.getUserIdList())); + if (saveVO.getFlag()) { + List list = saveVO.getUserIdList().stream().map(employeeId -> + UserRole.builder().userId(employeeId).roleId(saveVO.getRoleId()).build()).collect(Collectors.toList()); + userRoleService.saveBatch(list); + } + return findUserIdByRoleId(saveVO.getRoleId()); + } + + @Override + public List findUserIdByRoleId(Long roleId) { + return userRoleService.listObjs(Wrappers.lambdaQuery(UserRole.class) + .select(UserRole::getUserId).eq(UserRole::getRoleId, roleId), + Convert::toLong); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean saveUserRole(UserRoleSaveDTO userRole) { + List oldUserRoleList = userRoleService.list(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getRoleId, userRole.getRoleId())); + userRoleService.remove(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getRoleId, userRole.getRoleId())); + + Set delIdList = new HashSet<>(); + if (CollUtil.isNotEmpty(userRole.getUserIdList())) { + List list = userRole.getUserIdList() + .stream() + .map(userId -> UserRole.builder() + .userId(userId) + .roleId(userRole.getRoleId()) + .build()) + .collect(Collectors.toList()); + userRoleService.saveBatch(list); + delIdList.addAll(userRole.getUserIdList()); + } + + /* 角色A -> u1 u2 + 修改成 + 角色A -> u3 u2 + 所以, 应该清除 u1、u2、u3 的角色、菜单、资源 + */ + + if (!oldUserRoleList.isEmpty()) { + delIdList.addAll(oldUserRoleList.stream().map(UserRole::getUserId).collect(Collectors.toSet())); + } + delUserAuthority(delIdList); + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean saveRoleAuthority(RoleAuthoritySaveDTO dto) { + Assert.notNull(dto.getRoleId(), "请选择角色"); + + //删除角色和资源的关联 + super.remove(Wrappers.lambdaQuery(RoleAuthority.class).eq(RoleAuthority::getRoleId, dto.getRoleId())); + + List list = new ArrayList<>(); + if (dto.getResourceIdList() != null && !dto.getResourceIdList().isEmpty()) { + List menuIdList = resourceMapper.findMenuIdByResourceId(dto.getResourceIdList()); + if (dto.getMenuIdList() == null || dto.getMenuIdList().isEmpty()) { + dto.setMenuIdList(menuIdList); + } else { + dto.getMenuIdList().addAll(menuIdList); + } + + //保存授予的资源resourceMapper + List resourceList = new HashSet<>(dto.getResourceIdList()) + .stream() + .map(resourceId -> RoleAuthority.builder() + .authorityType(AuthorizeType.RESOURCE) + .authorityId(resourceId) + .roleId(dto.getRoleId()) + .build()) + .collect(Collectors.toList()); + list.addAll(resourceList); + } + if (dto.getMenuIdList() != null && !dto.getMenuIdList().isEmpty()) { + //保存授予的菜单 + List menuList = new HashSet<>(dto.getMenuIdList()) + .stream() + .map(menuId -> RoleAuthority.builder() + .authorityType(AuthorizeType.MENU) + .authorityId(menuId) + .roleId(dto.getRoleId()) + .build()) + .collect(Collectors.toList()); + list.addAll(menuList); + } + super.saveBatch(list); + + // 角色下的所有用户 + List userIdList = userRoleService.listObjs( + Wrappers.lambdaQuery(UserRole.class) + .select(UserRole::getUserId) + .eq(UserRole::getRoleId, dto.getRoleId()), + Convert::toLong); + + delUserAuthority(userIdList); + cachePlusOps.del(AuthCacheKeyUtils.roleResourceCacheKey(dto.getRoleId())); + cachePlusOps.del(AuthCacheKeyUtils.roleResourceCacheKey((dto.getRoleId()))); + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean removeByAuthorityId(List ids) { + List roleIds = listObjs( + Wrappers.lambdaQuery(RoleAuthority.class) + .select(RoleAuthority::getRoleId) + .in(RoleAuthority::getAuthorityId, ids), + Convert::toLong); + + if (!roleIds.isEmpty()) { + remove(Wrappers.lambdaQuery(RoleAuthority.class).in(RoleAuthority::getAuthorityId, ids)); + List userIdList = userRoleService.listObjs( + Wrappers.lambdaQuery(UserRole.class).select(UserRole::getUserId).in(UserRole::getRoleId, roleIds), + Convert::toLong); + + delUserAuthority(userIdList); + roleIds.forEach(roleId -> { + cachePlusOps.del(AuthCacheKeyUtils.roleResourceCacheKey(roleId)); + cachePlusOps.del(AuthCacheKeyUtils.roleMenuCacheKey(roleId)); + }); + } + return true; + } + + private void delUserAuthority(Collection collections) { + collections.forEach(userId -> { + cachePlusOps.del(AuthCacheKeyUtils.userResourceCacheKey(userId)); + cachePlusOps.del(AuthCacheKeyUtils.userMenuCacheKey(userId)); + cachePlusOps.del(AuthCacheKeyUtils.userRoleCacheKey(userId)); + }); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/RoleMenuServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/RoleMenuServiceImpl.java new file mode 100644 index 0000000..1453392 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/RoleMenuServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.sys.service.impl; + +import com.ningdatech.carapi.sys.entity.RoleMenu; +import com.ningdatech.carapi.sys.mapper.RoleMenuMapper; +import com.ningdatech.carapi.sys.service.IRoleMenuService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author PoffyZhang + * @since 2022-11-11 + */ +@Service +public class RoleMenuServiceImpl extends ServiceImpl implements IRoleMenuService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/RoleServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/RoleServiceImpl.java new file mode 100644 index 0000000..9b5da73 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/RoleServiceImpl.java @@ -0,0 +1,207 @@ +package com.ningdatech.carapi.sys.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpStatus; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.exception.BaseUncheckedException; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.exception.code.ExceptionCode; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.sys.entity.Menu; +import com.ningdatech.carapi.sys.entity.Role; +import com.ningdatech.carapi.sys.entity.RoleMenu; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.entity.dto.RoleSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.RoleUpdateDTO; +import com.ningdatech.carapi.sys.mapper.RoleMapper; +import com.ningdatech.carapi.sys.service.*; +import com.ningdatech.carapi.sys.utils.AuthCacheKeyUtils; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +/** + *

+ * 业务实现类 + * 角色 + *

+ * + * @author PoffyZhang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class RoleServiceImpl extends ServiceImpl implements RoleService { + private final RoleAuthorityService roleAuthorityService; + private final UserRoleService userRoleService; + private final RoleMapper roleMapper; + + private final CachePlusOps cachePlusOps; + + private final IRoleMenuService roleMenuService; + + private final MenuService menuService; + + private static final String SUPER_ADMIN = "SUPER_ADMIN"; + + @Override + public boolean isPtAdmin(String code) { + return SUPER_ADMIN.equals(code); + } + + + /** + * 删除角色时,需要级联删除跟角色相关的一切资源: + * 1,角色本身 + * 2,角色-组织: + * 3,角色-权限(菜单和按钮): + * 4,角色-用户:角色拥有的用户 + * 5,用户-权限: + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean removeByIdWithCache(List ids) { + if (ids.isEmpty()) { + return true; + } + + if(userRoleService.count(Wrappers.lambdaQuery(UserRole.class).select(UserRole::getUserId) + .in(UserRole::getRoleId, ids)) > 0){ + throw new BizException(ExceptionCode.OPERATION_EX.getCode(), "该角色下还有用户 不能随意删除!"); + } + + // 角色 + boolean removeFlag = removeByIds(ids); + + //角色拥有的用户 + userRoleService.remove(Wrappers.lambdaQuery(UserRole.class).in(UserRole::getRoleId, ids)); + if(removeFlag){ + // 角色绑定了那些用户 + if(roleMenuService.remove(Wrappers.lambdaQuery(RoleMenu.class).in(RoleMenu::getRoleId, ids))){ + return Boolean.TRUE; + } + } + return removeFlag; + } + + /** + * 1、根据 {tenant}:USER_ROLE:{userId} 查询用户拥有的角色ID集合 + * 2、缓存中有,则根据角色ID集合查询 角色集合 + * 3、缓存中有查不到,则从DB查询,并写入缓存, 立即返回 + * + * @param userId 用户id + */ + @Override + public List findRoleByUserId(Long userId) { + String cacheKey = AuthCacheKeyUtils.userRoleCacheKey(userId); + List roleList = new ArrayList<>(); + List list = (List) cachePlusOps.get(cacheKey); + if (list == null) { + roleList.addAll(baseMapper.findRoleByUserId(userId)); + list = roleList.stream().map(Role::getId).collect(Collectors.toList()); + } + if (roleList.isEmpty()) { + return listByIds(list); + } + return roleList; + } + + /** + * 1,保存角色 + * 2,保存 与组织的关系 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void saveRole(RoleSaveDTO data, Long userId) { + if(StrUtil.isNotBlank(data.getName()) && check(data.getName())){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "角色名称{} 已存在", data.getName()); + } + Role role = BeanUtil.toBean(data, Role.class); + role.setCreateBy(userId); + role.setUpdateBy(userId); + save(role); + saveRoleMenu(data.getMenuIds(),role.getId()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateRole(RoleUpdateDTO data, Long userId) { + Role roleOld = roleMapper.selectById(data.getId()); + if(Objects.isNull(roleOld)){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK,String.format("修改用户%d 为空",data.getId())); + } + + if(StringUtils.isNotBlank(data.getName())){ + Assert.isFalse(check(data.getName(),roleOld.getId()), "角色名{} 已经存在", + data.getName()); + } + Role role = BeanUtil.toBean(data, Role.class); + role.setUpdateBy(userId); + updateById(role); + saveRoleMenu(data.getMenuIds(),role.getId()); + + cachePlusOps.del(AuthCacheKeyUtils.userResourceCacheKey(userId)); + } + + @Override + public List findUserIdByCode(String[] codes) { + return baseMapper.findUserIdByCode(codes); + } + + @Override + public Boolean check(String name) { + return super.count(Wrappers.lambdaQuery(Role.class).eq(Role::getName, name)) > 0; + } + + @Override + public Boolean check(String name,Long id) { + return super.count(Wrappers.lambdaQuery(Role.class).ne(Role::getId,id) + .eq(Role::getName, name)) > 0; + } + + private void saveRoleMenu(List menuIds, Long roleId) { + if(CollUtil.isNotEmpty(menuIds)){ + roleMenuService.remove(Wrappers.lambdaQuery(RoleMenu.class).eq(RoleMenu::getRoleId, roleId)); + Set toAddMenus = new HashSet<>(); + for(Long menuId : menuIds){ + Menu menu = menuService.getById(menuId); + if(Objects.isNull(menu)){ + continue; + } + RoleMenu roleMenu = new RoleMenu(null,menuId,roleId); + toAddMenus.add(roleMenu); + //父级菜单 +// addParent(toAddMenus,menu,roleId); + } + if(CollUtil.isNotEmpty(toAddMenus)){ + roleMenuService.saveBatch(toAddMenus); + } + } + } + + private void addParent(Set toAddMenus, Menu menu,Long roleId) { + if(Objects.isNull(menu.getPid()) || menu.getPid().equals(0)){ + return; + } + Menu parant = menuService.getById(menu.getPid()); + if(Objects.isNull(parant)){ + return; + } + RoleMenu roleMenu = new RoleMenu(null,parant.getId(),roleId); + toAddMenus.add(roleMenu); + addParent(toAddMenus,parant,roleId); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/UserRoleServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/UserRoleServiceImpl.java new file mode 100644 index 0000000..f82345e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/service/impl/UserRoleServiceImpl.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.sys.service.impl; + +import cn.hutool.http.HttpStatus; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.exception.BaseUncheckedException; +import com.ningdatech.carapi.sys.entity.Role; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.mapper.RoleMapper; +import com.ningdatech.carapi.sys.mapper.UserRoleMapper; +import com.ningdatech.carapi.sys.service.UserRoleService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + *

+ * 业务实现类 + * 角色分配 + * 账号角色绑定 + *

+ * + * @author PoffyZhang + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class UserRoleServiceImpl extends ServiceImpl implements UserRoleService { + + private static final String INIT_ROLE_CODE = "SUPER_ADMIN"; + + private final RoleMapper roleMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean initAdmin(Long userId) { + Role role = roleMapper.selectOne(Wrappers.lambdaQuery(Role.class).eq(Role::getName, INIT_ROLE_CODE)); + if (role == null) { + throw new BaseUncheckedException(HttpStatus.HTTP_OK,String.format("初始化用户角色失败, 无法查询到内置角色:%s", INIT_ROLE_CODE)); + } + UserRole userRole = UserRole.builder() + .userId(userId).roleId(role.getId()) + .build(); + + return super.save(userRole); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/utils/AuthCacheKeyUtils.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/utils/AuthCacheKeyUtils.java new file mode 100644 index 0000000..1673aa0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/utils/AuthCacheKeyUtils.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.sys.utils; + +/** + *

+ * AuthCacheKeyUtils + *

+ * + * @author PoffyZhang + */ +public class AuthCacheKeyUtils { + + private static final String USER_RESOURCE_CKP = "user_resource:"; + private static final String USER_MENU_CKP = "user_menu:"; + private static final String USER_ROLE_CKP = "user_role:"; + private static final String ROLE_RESOURCE_CKP = "role_resource:"; + private static final String ROLE_MENU_CKP = "role_menu:"; + + public static String roleResourceCacheKey(Long roleId) { + return ROLE_RESOURCE_CKP + roleId; + } + + public static String roleMenuCacheKey(Long roleId) { + return ROLE_MENU_CKP + roleId; + } + + public static String userResourceCacheKey(Long userId) { + return USER_RESOURCE_CKP + userId; + } + + public static String userMenuCacheKey(Long userId) { + return USER_MENU_CKP + userId; + } + + public static String userRoleCacheKey(Long userId) { + return USER_ROLE_CKP + userId; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/utils/DataScopeCacheFilterUtil.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/utils/DataScopeCacheFilterUtil.java new file mode 100644 index 0000000..76f78f2 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/utils/DataScopeCacheFilterUtil.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.sys.utils; + +import cn.hutool.core.collection.CollUtil; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.datascope.model.DataScopeDto; +import com.ningdatech.carapi.sys.entity.vo.RegionTreeCompanyVO; + +import java.util.Optional; + +/** + * @Classname DataScopeCacheFilterUtil + * @Description + * @Date 2022/11/21 16:48 + * @Created by PoffyZhang + */ +public class DataScopeCacheFilterUtil { + + public static boolean dataScopeFilter(NdVehicleBaseInfo v, Optional dataScope) { + if(!dataScope.isPresent()){ + return Boolean.TRUE; + } + + if(CollUtil.isNotEmpty(dataScope.get().getRegionIds())){ + if(dataScope.get().getRegionIds().contains(v.getRegionId())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }else if(CollUtil.isNotEmpty(dataScope.get().getCompanyIds())){ + if(dataScope.get().getCompanyIds().contains(v.getId())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + } + return Boolean.TRUE; + } + + public static boolean dataScopeFilter(RegionTreeCompanyVO v, Optional dataScope) { + if(!dataScope.isPresent()){ + return Boolean.TRUE; + } + + if(CollUtil.isNotEmpty(dataScope.get().getRegionIds())){ + if(dataScope.get().getRegionIds().contains(v.getRegionId())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + }else if(CollUtil.isNotEmpty(dataScope.get().getCompanyIds())){ + if(dataScope.get().getCompanyIds().contains(v.getId())){ + return Boolean.TRUE; + } + return Boolean.FALSE; + } + return Boolean.TRUE; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/utils/HttpUtils.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/utils/HttpUtils.java new file mode 100644 index 0000000..4a83978 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/utils/HttpUtils.java @@ -0,0 +1,310 @@ +package com.ningdatech.carapi.sys.utils; + +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; +import org.apache.http.client.HttpClient; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.conn.ClientConnectionManager; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.message.BasicNameValuePair; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class HttpUtils { + /** + * get + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @return + * @throws Exception + */ + public static HttpResponse doGet(String host, String path, String method, + Map headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpGet request = new HttpGet(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + /** + * post form + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param bodys + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + Map bodys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (bodys != null) { + List nameValuePairList = new ArrayList(); + + for (String key : bodys.keySet()) { + nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key))); + } + UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8"); + formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8"); + request.setEntity(formEntity); + } + + return httpClient.execute(request); + } + + /** + * Post String + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Post stream + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Put String + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Put stream + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Delete + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @return + * @throws Exception + */ + public static HttpResponse doDelete(String host, String path, String method, + Map headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpDelete request = new HttpDelete(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + private static String buildUrl(String host, String path, Map querys) throws UnsupportedEncodingException { + StringBuilder sbUrl = new StringBuilder(); + sbUrl.append(host); + if (!StringUtils.isBlank(path)) { + sbUrl.append(path); + } + if (null != querys) { + StringBuilder sbQuery = new StringBuilder(); + for (Map.Entry query : querys.entrySet()) { + if (0 < sbQuery.length()) { + sbQuery.append("&"); + } + if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) { + sbQuery.append(query.getValue()); + } + if (!StringUtils.isBlank(query.getKey())) { + sbQuery.append(query.getKey()); + if (!StringUtils.isBlank(query.getValue())) { + sbQuery.append("="); + sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8")); + } + } + } + if (0 < sbQuery.length()) { + sbUrl.append("?").append(sbQuery); + } + } + + return sbUrl.toString(); + } + + private static HttpClient wrapClient(String host) { + HttpClient httpClient = new DefaultHttpClient(); + if (host.startsWith("https://")) { + sslClient(httpClient); + } + + return httpClient; + } + + private static void sslClient(HttpClient httpClient) { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); + X509TrustManager tm = new X509TrustManager() { + public X509Certificate[] getAcceptedIssuers() { + return null; + } + public void checkClientTrusted(X509Certificate[] xcs, String str) { + + } + public void checkServerTrusted(X509Certificate[] xcs, String str) { + + } + }; + ctx.init(null, new TrustManager[] { tm }, null); + SSLSocketFactory ssf = new SSLSocketFactory(ctx); + ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); + ClientConnectionManager ccm = httpClient.getConnectionManager(); + SchemeRegistry registry = ccm.getSchemeRegistry(); + registry.register(new Scheme("https", 443, ssf)); + } catch (KeyManagementException ex) { + throw new RuntimeException(ex); + } catch (NoSuchAlgorithmException ex) { + throw new RuntimeException(ex); + } + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/utils/TreeUtil.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/utils/TreeUtil.java new file mode 100644 index 0000000..7a2f60a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/sys/utils/TreeUtil.java @@ -0,0 +1,318 @@ +package com.ningdatech.carapi.sys.utils; + +import cn.hutool.core.collection.CollUtil; +import com.google.common.collect.Maps; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.sys.entity.RoleMenu; +import com.ningdatech.carapi.sys.entity.TreeEntity; +import com.ningdatech.carapi.sys.entity.vo.MenuRoleVO; +import org.apache.commons.lang3.StringUtils; + +import java.io.Serializable; +import java.util.*; +import java.util.stream.Collectors; + +/** + * list列表 转换成tree列表 + * + * @author PoffyZhang + */ +public final class TreeUtil { + private TreeUtil() { + } + + /** + * 判断id是否为根节点 + * + * @param id + * @return + */ + public static boolean isRoot(Long id) { + return id == null || StrPool.DEF_PARENT_ID.equals(id); + } + + + public static String getTreePath(String parentTreePath, Long parentId) { + return StrPool.COMMA + parentId + parentTreePath; + } + + /** + * 构建Tree结构 + * + * @param treeList 待转换的集合 + * @return 树结构 + */ + public static > List buildTree(List treeList) { + if (CollUtil.isEmpty(treeList)) { + return treeList; + } + //记录自己是自己的父节点的id集合 + List selfIdEqSelfParent = new ArrayList<>(); + + // 遍历两次 + foreachNodes(treeList, selfIdEqSelfParent); + foreachNodesWithTopMenu(treeList); + + // 找出根节点集合 + List trees = new ArrayList<>(); + + List allIds = treeList.stream().map(node -> node.getId()).collect(Collectors.toList()); + for (E baseNode : treeList) { + if (!allIds.contains(baseNode.getPid()) || selfIdEqSelfParent.contains(baseNode.getPid())) { + baseNode.setPid(null); + baseNode.setTopMenu(baseNode.getName()); + trees.add(baseNode); + } + } + return trees; + } + + /** + * 构建Tree结构 + * + * @param treeList 待转换的集合 + * @param title 菜单名 + * @return 树结构 + */ + public static > List buildTree(List treeList, String title) { + if (CollUtil.isEmpty(treeList)) { + return treeList; + } + //记录自己是自己的父节点的id集合 + List selfIdEqSelfParent = new ArrayList<>(); + + // 遍历两次 + foreachNodes(treeList, selfIdEqSelfParent); + foreachNodesWithTopMenu(treeList); + + // 找出根节点集合 + List trees = new ArrayList<>(); + + List allIds = treeList.stream().map(node -> node.getId()).collect(Collectors.toList()); + for (E baseNode : treeList) { + if (!allIds.contains(baseNode.getPid()) || selfIdEqSelfParent.contains(baseNode.getPid())) { + baseNode.setPid(null); + baseNode.setTopMenu(baseNode.getName()); + trees.add(baseNode); + } + } +// checkTitle(trees,title); + return trees; + } + + private static > + void foreachNodes(List treeList, List selfIdEqSelfParent) { + for (E parent : treeList) { + Serializable id = parent.getId(); + for (E children : treeList) { + if (parent != children) { + //parent != children 这个来判断自己的孩子不允许是自己,因为有时候,根节点的parent会被设置成为自己 + if (id.equals(children.getPid())) { + parent.initChildren(); + if (0L == parent.getPid()) { + children.setTopMenu(parent.getName()); + children.setLevel(2); + } else { + children.setTopMenu(parent.getTopMenu()); + children.setLevel(parent.getLevel() + 1); + } + parent.getChildren().add(children); + } + } else if (id.equals(parent.getPid())) { + selfIdEqSelfParent.add(id); + } + } + } + } + + private static > void foreachNodesWithTopMenu(List treeList) { + for (E parent : treeList) { + Serializable id = parent.getId(); + for (E children : treeList) { + if (parent != children) { + if (id.equals(children.getPid())) { + if (0L == parent.getPid()) { + children.setTopMenu(parent.getName()); + children.setLevel(2); + } else { + children.setTopMenu(parent.getTopMenu()); + children.setLevel(parent.getLevel() + 1); + } + } + } + } + } + } + + /** + * 生成当前用户的菜单列表 + * + * @param treeList + * @param roleMenuMap + * @return + */ + public static List buildUserTree(List treeList, Map roleMenuMap) { + if (CollUtil.isEmpty(treeList)) { + return Collections.emptyList(); + } + //记录自己是自己的父节点的id集合 + List selfIdEqSelfParent = new ArrayList<>(); + + // 遍历两次 + foreachNodesCheckRole(treeList, selfIdEqSelfParent, roleMenuMap); + foreachNodesWithTopMenu(treeList); + + // 找出根节点集合 + List trees = new ArrayList<>(); + + List allIds = treeList.stream().map(TreeEntity::getId).collect(Collectors.toList()); + for (MenuRoleVO baseNode : treeList) { + if (!allIds.contains(baseNode.getPid()) || selfIdEqSelfParent.contains(baseNode.getPid())) { + baseNode.setPid(null); + if (roleMenuMap.containsKey(baseNode.getId())) { + baseNode.setTopMenu(baseNode.getName()); + checkRedirect(baseNode); + trees.add(baseNode); + } else { + if (baseNode.getSize() > 0) { + baseNode.setTopMenu(baseNode.getName()); + checkRedirect(baseNode); + trees.add(baseNode); + } + } + } + } + return trees; + } + + //判断角色权限用 不用父级 + private static void foreachNodesCheckRoleWithoutParent(List treeList, List selfIdEqSelfParent, Map roleMenuMap) { + for (MenuRoleVO parent : treeList) { + Serializable id = parent.getId(); + for (MenuRoleVO children : treeList) { + if (parent != children) { + //parent != children 这个来判断自己的孩子不允许是自己,因为有时候,根节点的parent会被设置成为自己 + if (id.equals(children.getPid())) { + parent.initChildren(); + + if (!roleMenuMap.containsKey(children.getId())) { + continue; + } + + if (0L == parent.getPid()) { + children.setTopMenu(parent.getName()); + children.setLevel(2); + } else { + children.setTopMenu(parent.getTopMenu()); + children.setLevel(parent.getLevel() + 1); + } + parent.getChildren().add(children); + } + } else if (id.equals(parent.getPid())) { + selfIdEqSelfParent.add(id); + } + + if (roleMenuMap.containsKey(children.getId())) { + children.setHasPermission(1); + } + } + } + } + + //判断当前登录权限用 + private static void foreachNodesCheckRole(List treeList, List selfIdEqSelfParent, Map roleMenuMap) { + for (MenuRoleVO parent : treeList) { + Serializable id = parent.getId(); + for (MenuRoleVO children : treeList) { + if (parent != children) { + //parent != children 这个来判断自己的孩子不允许是自己,因为有时候,根节点的parent会被设置成为自己 + if (id.equals(children.getPid())) { + parent.initChildren(); + + if (!roleMenuMap.containsKey(children.getId())) { + continue; + } + + if (0L == parent.getPid()) { + children.setTopMenu(parent.getName()); + children.setLevel(2); + } else { + children.setTopMenu(parent.getTopMenu()); + children.setLevel(parent.getLevel() + 1); + } + parent.getChildren().add(children); + } + } else if (id.equals(parent.getPid())) { + selfIdEqSelfParent.add(id); + } + } + + //1层 2层 再加一下 + for (MenuRoleVO children : treeList) { + if (parent != children) { + if (id.equals(children.getPid())) { + + if (parent.getChildren().contains(children) || + children.getSize() == 0) { + continue; + } + + if (0L == parent.getPid()) { + children.setTopMenu(parent.getName()); + children.setLevel(2); + } else { + children.setTopMenu(parent.getTopMenu()); + children.setLevel(parent.getLevel() + 1); + } + parent.getChildren().add(children); + } + } + } + } + } + + /** + * 动态判断redirect + * + * @param baseNode + */ + private static void checkRedirect(MenuRoleVO baseNode) { + checkMenuRedirect(baseNode, baseNode.getChildren()); + } + + /** + * 判断菜单是否需要跳转 + * + * @param baseNode / + * @param menus / + * @return / + */ + private static Boolean checkMenuRedirect(MenuRoleVO baseNode, Set menus) { + if (baseNode.getSize() > 0) { + for (MenuRoleVO menu : menus) { + //如果是大屏类型的 2层-3层 直接跳转 + if (menu.getPath().endsWith("Datav")) { + baseNode.setRedirect(menu.getComponent()); + return Boolean.TRUE; + } + + //如果是不隐藏 和 没有子菜单 跳转 + if (menu.getSize() == 0 && 0 == menu.getHidden()) { + baseNode.setRedirect(menu.getComponent()); + return Boolean.TRUE; + } + } + + //一轮没有合适的菜单 去三级菜单找 + for (MenuRoleVO menu : menus) { + if (menu.getSize() > 0) { + if (checkMenuRedirect(baseNode, menu.getChildren())) { + return Boolean.TRUE; + } + } + } + } + + return Boolean.FALSE; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/controller/UserAuthController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/controller/UserAuthController.java new file mode 100644 index 0000000..09521a1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/controller/UserAuthController.java @@ -0,0 +1,95 @@ +package com.ningdatech.carapi.user.controller; + +import java.io.IOException; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ningdatech.basic.model.ApiResponse; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.user.security.auth.constant.SessionTimeConstant; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + * @author LiuXinXin + * @date 2022/9/29 下午3:26 + */ + +@RestController +@RequestMapping("/api/v1/user/auth") +@Api(tags = {"用户鉴权-相关接口"}) +@RequiredArgsConstructor +public class UserAuthController { + + private final ObjectMapper objectMapper; + + @Value("${login.public-key}") + private String publicKey; + + //@PostMapping(value = "/login/password", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + //@ApiOperation(value = "账号密码的登陆方式") + //@ApiImplicitParams({ + // @ApiImplicitParam(name = "username", value = "用户名", required = true, paramType = "form", dataType = "String"), + // @ApiImplicitParam(name = "password", value = "密码", required = true, paramType = "form", dataType = "String")}) + //public void loginByUsernameAndPassword(@RequestParam("username") String username, + // @RequestParam("password") String password) { + // // 不实现任何内容,只是为了出api文档 + //} + + @PostMapping(value = "/login/password", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + @ApiOperation(value = "账号密码验证码的登陆方式") + @ApiImplicitParams({ + @ApiImplicitParam(name = "username", value = "用户名", required = true, paramType = "form", dataType = "String"), + @ApiImplicitParam(name = "password", value = "密码", required = true, paramType = "form", dataType = "String"), + @ApiImplicitParam(name = "verificationCode",value = "验证码",required = true,paramType = "form",dataType = "String")}) + public void loginByUsernameAndPasswordAndVerificationCode(@RequestParam("username") String username, + @RequestParam("password") String password,@RequestParam("verificationCode") String verificationCode) { + // 不实现任何内容,只是为了出api文档 + } + + /** + * 当需要身份认证时,跳转到这里 + * + * @param response + * @return + * @throws IOException + */ + @RequestMapping("/auth-require") + @CrossOrigin(originPatterns = "*", allowCredentials = "true", maxAge = 3600) + public void requireAuthentication(HttpServletRequest request, HttpServletResponse response) throws IOException { + response.setContentType("application/json;charset=UTF-8"); + response.setStatus(401); + response.getWriter().write(objectMapper.writeValueAsString( + ApiResponse.of(401, "用户未登录", null))); + } + + @RequestMapping("/invalid-session") + @CrossOrigin(originPatterns = "*", allowCredentials = "true", maxAge = 3600) + public void invalidSession(HttpServletRequest request, HttpServletResponse response) throws IOException { + response.setContentType("application/json;charset=UTF-8"); + Cookie cookie = new Cookie(CommonConstant.COOKIE_KEY, null); + String cookiePath = request.getContextPath() + "/"; + cookie.setPath(cookiePath); + cookie.setMaxAge(SessionTimeConstant.SESSION_TIME_SECONDS); + response.addCookie(cookie); + response.setStatus(401); + response.getWriter().write(objectMapper.writeValueAsString(ApiResponse.of(401, "用户未登录", null))); + } + + @ApiOperation(value = "获取登录信息加密公钥", notes = "获取登录信息加密公钥") + @GetMapping("/get-public-key") + public String getPublicKey(){ + return publicKey; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/controller/UserInfoController.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/controller/UserInfoController.java new file mode 100644 index 0000000..e63e6b8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/controller/UserInfoController.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.user.controller; + +import com.ningdatech.carapi.user.manage.UserInfoManage; +import com.ningdatech.carapi.user.model.vo.UserBasicInfoVO; +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.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author liuxinxin + * @date 2022/10/24 下午2:14 + */ + +@RestController +@RequestMapping("/api/v1/user/info") +@Api(tags = {"用户信息-相关接口"}) +@RequiredArgsConstructor +public class UserInfoController { + private final UserInfoManage userInfoManage; + + + @ApiOperation(value = "获取用户基本信息") + @PostMapping("/get/basic-info") + public UserBasicInfoVO getUserBasicInfo() { + return userInfoManage.getUserBasicInfo(); + } + + @ApiOperation(value = "创建企业信息员账号信息") + @GetMapping("/create/companyUser") + public String createCompanyUser() { + return userInfoManage.createCompanyUser(); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/entity/NdUserAuth.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/entity/NdUserAuth.java new file mode 100644 index 0000000..6f22724 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/entity/NdUserAuth.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.user.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @author LiuXinXin + * @since 2022-09-30 + */ +@TableName("nd_user_auth") +@Data +public class NdUserAuth implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long userId; + + private String authType; + + private String identifier; + + private String credential; + + private Boolean isAvailable; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/entity/NdUserInfo.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/entity/NdUserInfo.java new file mode 100644 index 0000000..0b31e5c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/entity/NdUserInfo.java @@ -0,0 +1,128 @@ +package com.ningdatech.carapi.user.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.time.LocalDateTime; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * + *

+ * + * @author LiuXinXin + * @since 2022-09-30 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("nd_user_info") +@ApiModel(value = "User", description = "用户") +@AllArgsConstructor +@Builder +public class NdUserInfo extends BaseEntity implements Serializable { + + @TableId(value = "id",type = IdType.AUTO) + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 用户姓名 + */ + @ApiModelProperty(value = "用户姓名") + @NotEmpty(message = "用户姓名不能为空") + @Size(max = 50, message = "用户姓名长度不能超过50") + @TableField(value = "username", condition = LIKE) + private String username; + + /** + * 企业 + */ + @ApiModelProperty(value = "企业id") + @TableField("company_id") + private Long companyId; + + /** + * 公司行业 + */ + @ApiModelProperty(value = "行业id") + @TableField("industry") + private Long industry; + + /** + * 手机 + */ + @ApiModelProperty(value = "手机") + @Size(max = 20, message = "手机长度不能超过20") + @TableField(value = "mobile", condition = LIKE) + private String mobile; + + /** + * 最后登录时间 + */ + @ApiModelProperty(value = "最后登录时间") + @TableField("last_login_time") + private LocalDateTime lastLoginTime; + + /** + * 职位 + */ + @ApiModelProperty(value = "职位") + @Size(max = 50, message = "职位长度不能超过50") + @TableField(value = "position", condition = LIKE) + private String position; + + /** + * 科室 + */ + @ApiModelProperty(value = "科室") + @Size(max = 50, message = "科室长度不能超过50") + @TableField(value = "section_office", condition = LIKE) + private String sectionOffice; + + /** + * 昵称 + */ + @ApiModelProperty(value = "昵称") + @Size(max = 50, message = "昵称长度不能超过50") + @TableField(value = "nick_name", condition = LIKE) + private String nickName; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + @Size(max = 200, message = "备注不能超过200") + @TableField(value = "remark", condition = LIKE) + private String remark; + + /** + * 用户是否可登录 + */ + @ApiModelProperty(value = "用户是否可登录") + @TableField("can_login") + private Integer canLogin; + + /** + * 用户登录验证码 + */ + @ApiModelProperty(value = "用户登录验证码") + @TableField("verification_code") + private String verificationCode; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/entity/NdUserInfoJoin.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/entity/NdUserInfoJoin.java new file mode 100644 index 0000000..db6ec7b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/entity/NdUserInfoJoin.java @@ -0,0 +1,148 @@ +package com.ningdatech.carapi.user.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.time.LocalDateTime; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * + *

+ * + * @author LiuXinXin + * @since 2022-09-30 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("nd_user_info") +@ApiModel(value = "User", description = "用户") +@AllArgsConstructor +@Builder +public class NdUserInfoJoin extends BaseEntity implements Serializable { + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 用户姓名 + */ + @ApiModelProperty(value = "用户姓名") + @NotEmpty(message = "用户姓名不能为空") + @Size(max = 50, message = "用户姓名长度不能超过50") + @TableField(value = "username", condition = LIKE) + private String username; + + /** + * 帐号 + */ + @ApiModelProperty(value = "帐号") +// @TableField(exist = false) + private String account; + + /** + * 角色ID + */ + @ApiModelProperty(value = "角色ID") +// @TableField(exist = false) + private Long roleId; + + /** + * 企业 + */ + @ApiModelProperty(value = "企业id") + @TableField("company_id") + private Long companyId; + + /** + * 区域id + */ + @ApiModelProperty(value = "区域id") + @TableField("region_id") + private Long regionId; + + /** + * 企业名称 + */ + @ApiModelProperty(value = "企业名称") + private String companyName; + + /** + * 公司行业 + */ + @ApiModelProperty(value = "行业id") + @TableField("industry") + private Long industry; + + /** + * 手机 + */ + @ApiModelProperty(value = "手机") + @Size(max = 20, message = "手机长度不能超过20") + @TableField(value = "mobile", condition = LIKE) + private String mobile; + + /** + * 最后登录时间 + */ + @ApiModelProperty(value = "最后登录时间") + @TableField("last_login_time") + private LocalDateTime lastLoginTime; + + /** + * 职位 + */ + @ApiModelProperty(value = "职位") + @Size(max = 50, message = "职位长度不能超过50") + @TableField(value = "position", condition = LIKE) + private String position; + + /** + * 科室 + */ + @ApiModelProperty(value = "科室") + @Size(max = 50, message = "科室长度不能超过50") + @TableField(value = "section_office", condition = LIKE) + private String sectionOffice; + + /** + * 昵称 + */ + @ApiModelProperty(value = "昵称") + @Size(max = 50, message = "昵称长度不能超过50") + @TableField(value = "nick_name", condition = LIKE) + private String nickName; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + @Size(max = 200, message = "备注不能超过200") + @TableField(value = "remark", condition = LIKE) + private String remark; + + /** + * 用户是否可登录 + */ + @ApiModelProperty(value = "用户是否可登录") + @TableField("can_login") + private Integer canLogin; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/entity/ReqCreateAccountPO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/entity/ReqCreateAccountPO.java new file mode 100644 index 0000000..27b1159 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/entity/ReqCreateAccountPO.java @@ -0,0 +1,48 @@ +package com.ningdatech.carapi.user.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/9 上午9:31 + */ +@Data +@ApiModel(description = "新建账号入参") +public class ReqCreateAccountPO { + + @ApiModelProperty("用户姓名") + private String nickName; + + @ApiModelProperty("所属企业") + private String companyName; + + @ApiModelProperty("所属企业唯一标识") + private String companyId; + + @ApiModelProperty("公司行业") + private String corporateIndustry; + + @ApiModelProperty("用户角色") + private String role; + + @ApiModelProperty("登陆账号") + private String userName; + + @ApiModelProperty("登陆密码") + private String password; + + @ApiModelProperty("职位") + private String position; + + @ApiModelProperty("科室") + private String department; + + @ApiModelProperty("手机号码") + private String phoneNo; + + @ApiModelProperty("备注") + private String remark; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/manage/UserInfoManage.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/manage/UserInfoManage.java new file mode 100644 index 0000000..c5cc3f1 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/manage/UserInfoManage.java @@ -0,0 +1,113 @@ +package com.ningdatech.carapi.user.manage; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.company.enumeration.CompanyTypeEnum; +import com.ningdatech.carapi.datascope.model.DataScopeDto; +import com.ningdatech.carapi.datascope.provider.DataScopeContext; +import com.ningdatech.carapi.driver.constant.UserCanLoginEnum; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.sys.service.UserRoleService; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.model.vo.UserBasicInfoVO; +import com.ningdatech.carapi.user.security.auth.constant.AuthTypeEnum; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; +import com.ningdatech.carapi.user.util.LoginUserUtil; + +import lombok.RequiredArgsConstructor; + +/** + * @author liuxinxin + * @date 2022/10/24 下午2:15 + */ +@Component +@RequiredArgsConstructor +public class UserInfoManage { + + private final IDriverInfoService iDriverInfoService; + + private final CompanyService companyService; + + private final INdUserInfoService userInfoService; + + private final PasswordEncoder passwordEncoder; + private final INdUserAuthService ndUserAuthService; + private final UserRoleService userRoleService; + + public UserBasicInfoVO getUserBasicInfo() { + UserBasicInfoVO userBasicInfoVO = new UserBasicInfoVO(); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + Long userId = user.getUserId(); + Long roleId = user.getRoleId(); + Optional dataScope = DataScopeContext.getDataScope(user.getDataScope()); + if(dataScope.isPresent()){ + userBasicInfoVO.setMaxRegion(dataScope.get().getMaxRegion()); + } + userBasicInfoVO.setNickName(user.getNickName()); + // 获取驾驶员信息 + DriverInfo driverInfo = iDriverInfoService.getOne(Wrappers.lambdaQuery(DriverInfo.class) + .eq(DriverInfo::getUserId, userId)); + if (Objects.nonNull(driverInfo)) { + userBasicInfoVO.setDriverId(driverInfo.getId()); + } + userBasicInfoVO.setUserId(userId); + userBasicInfoVO.setRoleId(roleId); + userBasicInfoVO.setCompanyId(user.getCompanyId()); + userBasicInfoVO.setCompanyName(user.getCompanyName()); + userBasicInfoVO.setRegionId(user.getRegionId()); + userBasicInfoVO.setRegionName(user.getRegionName()); + + return userBasicInfoVO; + } + + public String createCompanyUser() { + // 创建各企业企业信息员账号 + Map companyMap = companyService.list().stream().collect(Collectors.toMap(Company::getId, c -> c)); + List companyList = companyService.list().stream().filter(c -> c.getCompanyType().equals(CompanyTypeEnum.PRODUCT_BU.getCode()) + || c.getCompanyType().equals(CompanyTypeEnum.LOGISTICS_BU.getCode()) + || c.getCompanyType().equals(CompanyTypeEnum.OTHER.getCode())).collect(Collectors.toList()); + for (Company company : companyList) { + Long companyId = company.getId(); + Company companyInfo = companyMap.get(companyId); + NdUserInfo userInfo = new NdUserInfo(); + userInfo.setCanLogin(UserCanLoginEnum.CAN_LOGIN.getCode()); + userInfo.setUsername(companyInfo.getName()); + userInfo.setCompanyId(companyId); + userInfo.setCreateOn(LocalDateTime.now()); + userInfo.setUpdateOn(LocalDateTime.now()); + userInfoService.save(userInfo); + + Long userId = userInfo.getId(); + NdUserAuth userAuth = new NdUserAuth(); + userAuth.setUserId(userId); + userAuth.setIdentifier(companyInfo.getName()); + userAuth.setCredential(passwordEncoder.encode("123456Aa")); + userAuth.setAuthType(AuthTypeEnum.ACCOUNT_PASSWORD.getKey()); + userAuth.setIsAvailable(true); + ndUserAuthService.save(userAuth); + + UserRole userRole = new UserRole(); + userRole.setUserId(userId); + userRole.setRoleId(UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId()); + userRoleService.save(userRole); + } + return "创建完成"; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserAuthMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserAuthMapper.java new file mode 100644 index 0000000..6a7af5d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserAuthMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.user.mapper; + +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author LiuXinXin + * @since 2022-09-30 + */ +public interface NdUserAuthMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserAuthMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserAuthMapper.xml new file mode 100644 index 0000000..fd275df --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserAuthMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserInfoJoinMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserInfoJoinMapper.java new file mode 100644 index 0000000..05a4805 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserInfoJoinMapper.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.user.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.user.entity.NdUserInfoJoin; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +public interface NdUserInfoJoinMapper extends BaseMapper { + + String QUERY_SQL = "SELECT u.*, c.name as company_name,c.region_id, " + + " a.identifier as account,ur.role_id FROM nd_user_info AS u " + + " LEFT JOIN nd_company_info AS c ON u.company_id = c.id " + + " LEFT JOIN nd_user_role AS ur ON u.id = ur.user_id " + + " LEFT JOIN nd_user_auth AS a ON u.id = a.user_id "; + String WRAPPER_SQL = "SELECT * from ( " + QUERY_SQL + " ) AS q ${ew.customSqlSegment}"; + + @Select(WRAPPER_SQL) + Page pageJoin(Page page, @Param("ew") LambdaQueryWrapper wrapper); + + @Select(WRAPPER_SQL) + NdUserInfoJoin oneJoin(@Param("ew") LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserInfoMapper.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserInfoMapper.java new file mode 100644 index 0000000..3b59e62 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserInfoMapper.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.user.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.sys.entity.dto.GlobalUserPageDTO; +import com.ningdatech.carapi.sys.entity.dto.PageParamsDTO; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + * @since 2022-09-30 + */ +public interface NdUserInfoMapper extends BaseMapper { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserInfoMapper.xml b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserInfoMapper.xml new file mode 100644 index 0000000..88751b5 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/mapper/NdUserInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/model/vo/NdUserInfoVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/model/vo/NdUserInfoVO.java new file mode 100644 index 0000000..4b2fb97 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/model/vo/NdUserInfoVO.java @@ -0,0 +1,99 @@ +package com.ningdatech.carapi.user.model.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ningdatech.carapi.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.time.LocalDateTime; + +import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; + +/** + *

+ * + *

+ * + * @author LiuXinXin + * @since 2022-09-30 + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "User", description = "用户") +@AllArgsConstructor +@Builder +public class NdUserInfoVO extends BaseEntity implements Serializable { + + @TableId(value = "id",type = IdType.AUTO) + private Long id; + + private static final long serialVersionUID = 1L; + + /** + * 用户姓名 + */ + @ApiModelProperty(value = "用户姓名") + private String username; + + /** + * 企业 + */ + @ApiModelProperty(value = "企业id") + private Long companyId; + + /** + * 公司行业 + */ + @ApiModelProperty(value = "行业id") + private Long industry; + + /** + * 手机 + */ + @ApiModelProperty(value = "手机") + private String mobile; + + /** + * 最后登录时间 + */ + @ApiModelProperty(value = "最后登录时间") + private LocalDateTime lastLoginTime; + + /** + * 职位 + */ + @ApiModelProperty(value = "职位") + private String position; + + /** + * 科室 + */ + @ApiModelProperty(value = "科室") + private String sectionOffice; + + /** + * 昵称 + */ + @ApiModelProperty(value = "昵称") + private String nickName; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "数据范围") + private Integer dataScope; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/model/vo/UserBasicInfoVO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/model/vo/UserBasicInfoVO.java new file mode 100644 index 0000000..42c4ae4 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/model/vo/UserBasicInfoVO.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.user.model.vo; + +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2022/10/24 下午2:21 + */ +@ApiModel("用户基础信息VO") +@Data +public class UserBasicInfoVO { + + @ApiModelProperty("用户id") + private Long userId; + + @ApiModelProperty("角色id") + private Long roleId; + + @ApiModelProperty("用户昵称") + private String nickName; + + @ApiModelProperty("驾驶员id(只有驾驶员信息时才有)") + private Long driverId; + + @ApiModelProperty("企业ID") + private Long companyId; + + @ApiModelProperty("企业名称") + private String companyName; + + @ApiModelProperty("区域ID") + private Long regionId; + + @ApiModelProperty("区域名称") + private String regionName; + + @ApiModelProperty("该用户所能看到的最大区域 权限") + private RegionDTO maxRegion; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/AuthProperties.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/AuthProperties.java new file mode 100644 index 0000000..465814d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/AuthProperties.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.user.security.auth; + +import com.ningdatech.basic.factory.PropertySourceFactory; +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @Author LiuXinXin + * @Date 2020/8/1 6:06 下午 + * @Version 1.0 + **/ +@Configuration +@PropertySource(value = "classpath:security/auth-${spring.profiles.active}.yml" + , encoding = "utf-8", factory = PropertySourceFactory.class) +@ConfigurationProperties(prefix = "security.auth") +@Component +@Data +public class AuthProperties { + + private String authRequireUrl; + + private String invalidSessionUrl; + + private String passwordLoginUrl; + + private String logoutUrl; + + private List ignoreAuthUrls; + + private List ignoreCsrfUrls; + + public String[] getIgnoreAuthUrlsArray() { + String[] stringArray = new String[ignoreAuthUrls.size()]; + return ignoreAuthUrls.toArray(stringArray); + } + + public String[] getIgnoreCsrfUrlsArray() { + String[] stringArray = new String[ignoreCsrfUrls.size()]; + return ignoreCsrfUrls.toArray(stringArray); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/AuthenticationBeanConfig.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/AuthenticationBeanConfig.java new file mode 100644 index 0000000..c276b0f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/AuthenticationBeanConfig.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.user.security.auth; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.core.session.SessionRegistry; +import org.springframework.security.core.session.SessionRegistryImpl; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; + +/** + * @Author LiuXinXin + * @Date 2020/7/28 1:00 下午 + * @Version 1.0 + **/ +@Configuration +public class AuthenticationBeanConfig { + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } + + @Bean + public SessionRegistry sessionRegistry() { + return new SessionRegistryImpl(); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/WebSecurityConfig.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/WebSecurityConfig.java new file mode 100644 index 0000000..e8c18aa --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/WebSecurityConfig.java @@ -0,0 +1,81 @@ +package com.ningdatech.carapi.user.security.auth; + +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.user.security.auth.handler.DefaultExpiredSessionStrategy; +import com.ningdatech.carapi.user.security.auth.password.UsernamePasswordAuthSecurityConfig; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; +import org.springframework.security.web.csrf.CookieCsrfTokenRepository; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; + +import java.util.Collections; + +/** + * @Author LiuXinXin + * @Date 2020/7/28 4:14 下午 + * @Version 1.0 + */ +@Configuration +public class WebSecurityConfig extends WebSecurityConfigurerAdapter { + + @Autowired + private AuthProperties authProperties; + + @Autowired + private UsernamePasswordAuthSecurityConfig usernamePasswordAuthSecurityConfig; + + @Autowired + @Qualifier(value = "defaultLogoutSuccessHandler") + private LogoutSuccessHandler logoutSuccessHandler; + + @Autowired + private DefaultExpiredSessionStrategy defaultExpiredSessionStrategy; + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.formLogin() + .loginPage(authProperties.getAuthRequireUrl()) + .and().apply(usernamePasswordAuthSecurityConfig) + .and() + .authorizeRequests().antMatchers(authProperties.getIgnoreAuthUrlsArray()).permitAll().anyRequest() + .authenticated().and() + // 防止固定会话攻击,Spring security的默认配置就是如此: + // 登陆成功之后会创建一个新的会话,然后将旧的session信息复制到新的session中(客户端的sessionId变了) + .sessionManagement().invalidSessionUrl(authProperties.getInvalidSessionUrl()).sessionFixation() + .migrateSession() + // .invalidSessionStrategy(defaultInvalidSessionStrategy) + .maximumSessions(10) + .maxSessionsPreventsLogin(true) + .expiredSessionStrategy(defaultExpiredSessionStrategy) + .and().and() + .logout().logoutUrl(authProperties.getLogoutUrl()).logoutSuccessHandler(logoutSuccessHandler) + .deleteCookies(CommonConstant.COOKIE_KEY) + .and().headers().frameOptions().sameOrigin() + // .and() + // .cors().configurationSource(corsConfigurationSource()) + .and() + // .csrf().disable(); + // 开启csrf验证,需要前端同步传入token + //.csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()) + .csrf().csrfTokenRepository(new CookieCsrfTokenRepository()) + .ignoringAntMatchers(authProperties.getIgnoreCsrfUrlsArray()); + // http.anonymous().authenticationFilter(availableUserAuthenticationFilter); + + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + CorsConfiguration corsConfiguration = new CorsConfiguration(); + corsConfiguration.setAllowedHeaders(Collections.singletonList("*")); + corsConfiguration.setAllowedMethods(Collections.singletonList("*")); +// corsConfiguration.setAllowedOrigins(Collections.singletonList("*")); + corsConfiguration.setAllowedOriginPatterns(Collections.singletonList("*")); + corsConfiguration.setMaxAge(3600L); + corsConfiguration.setAllowCredentials(true); + source.registerCorsConfiguration("/**", corsConfiguration); + http.cors().configurationSource(source); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/config/RedisSessionConfig.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/config/RedisSessionConfig.java new file mode 100644 index 0000000..930f41f --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/config/RedisSessionConfig.java @@ -0,0 +1,57 @@ +package com.ningdatech.carapi.user.security.auth.config; + +import cn.hutool.core.util.StrUtil; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.common.constant.CommonConstant; +import com.ningdatech.carapi.user.security.auth.constant.SessionTimeConstant; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.session.data.redis.RedisIndexedSessionRepository; +import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; +import org.springframework.session.web.http.CookieHttpSessionIdResolver; +import org.springframework.session.web.http.DefaultCookieSerializer; + +/** + *

+ * 设置session的过期时间为一天 + *

+ * + * @Author LiuXinXin + * @Date 2020/7/29 9:46 上午 + * @Version 1.0 + **/ +@Configuration +@EnableRedisHttpSession( + maxInactiveIntervalInSeconds = RedisSessionConfig.SESSION_TIMEOUT, + redisNamespace = RedisSessionConfig.REDIS_NAMESPACE +) +public class RedisSessionConfig { + + static final int SESSION_TIMEOUT = 24 * 60 * 60 * 10; + + static final String REDIS_NAMESPACE = "#{redisSessionConfig.getRedisNamespace()}"; + + @Value("${nd.cache.def.keyPrefix:}") + private String keyPrefix; + + public String getRedisNamespace() { + return (StrUtil.isBlank(keyPrefix) ? StrPool.EMPTY : keyPrefix + StrPool.COLON) + RedisIndexedSessionRepository.DEFAULT_NAMESPACE; + } + + + @Bean + public CookieHttpSessionIdResolver sessionIdResolver() { + // 创建 CookieHttpSessionIdResolver 对象 + CookieHttpSessionIdResolver sessionIdResolver = new CookieHttpSessionIdResolver(); + + // 创建 DefaultCookieSerializer 对象 + DefaultCookieSerializer cookieSerializer = new DefaultCookieSerializer(); + + // 设置到 sessionIdResolver 中 + sessionIdResolver.setCookieSerializer(cookieSerializer); + cookieSerializer.setCookieName(CommonConstant.COOKIE_KEY); + cookieSerializer.setCookieMaxAge(SessionTimeConstant.SESSION_TIME_SECONDS); + return sessionIdResolver; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/constant/AuthTypeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/constant/AuthTypeEnum.java new file mode 100644 index 0000000..6d9c5b7 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/constant/AuthTypeEnum.java @@ -0,0 +1,47 @@ +package com.ningdatech.carapi.user.security.auth.constant; + +/** + * @author LiuXinXin + * @date 2021/7/30 下午2:10 + */ + +public enum AuthTypeEnum { + + /** + * 手机 + 密码的认证方式 + */ + PHONE_PASSWORD("phone_password"), + + /** + * 子账号 账号 + 密码的认证方式 + */ + ACCOUNT_PASSWORD("account_password"); + + private final String key; + + AuthTypeEnum(String key) { + this.key = key; + } + + public static boolean contains(String key) { + for (AuthTypeEnum value : AuthTypeEnum.values()) { + if (key.equals(value.getKey())) { + return true; + } + } + return false; + } + + public String getKey() { + return key; + } + + public static AuthTypeEnum of(String key) { + for (AuthTypeEnum value : AuthTypeEnum.values()) { + if (key.equals(value.getKey())) { + return value; + } + } + throw new RuntimeException(String.format("invalid AuthTypeEnum = %s", key)); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/constant/SessionTimeConstant.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/constant/SessionTimeConstant.java new file mode 100644 index 0000000..be45f0d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/constant/SessionTimeConstant.java @@ -0,0 +1,12 @@ +package com.ningdatech.carapi.user.security.auth.constant; + +/** + * @Author LiuXinXin + * @Date 2022/2/17 12:59 上午 + * @Version 1.0 + **/ +public class SessionTimeConstant { + + public static final Integer SESSION_TIME_SECONDS = 24 * 60 * 60 * 10; + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/errorcode/AuthErrorCodeEnum.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/errorcode/AuthErrorCodeEnum.java new file mode 100644 index 0000000..df57286 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/errorcode/AuthErrorCodeEnum.java @@ -0,0 +1,36 @@ +package com.ningdatech.carapi.user.security.auth.errorcode; + + +import com.ningdatech.carapi.common.exception.AppErrorCode; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author LiuXinXin + * @date 2021/7/30 上午10:59 + */ + +@AllArgsConstructor +@Getter +public enum AuthErrorCodeEnum { + /** + * 登录用户名 + */ + USERNAME_OR_PASSWORD_ERROR(AppErrorCode.AUTH.getCode() + "100000" + , "登陆时用户名或者密码错误"), + + ACCOUNT_ALREADY_EXIST_WHEN_REGISTER(AppErrorCode.AUTH.getCode() + "100001" + , "账号已经存在"), + + SESSION_EXPIRED(AppErrorCode.AUTH.getCode() + "100002" + ,"用户session过期,登陆状态失效"); + + + private final String code; + + private final String msg; + + public Integer getCode() { + return Integer.valueOf(code); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/facade/UserAuthLoginFacade.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/facade/UserAuthLoginFacade.java new file mode 100644 index 0000000..775f752 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/facade/UserAuthLoginFacade.java @@ -0,0 +1,55 @@ +package com.ningdatech.carapi.user.security.auth.facade; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.security.auth.constant.AuthTypeEnum; +import com.ningdatech.carapi.user.security.auth.model.dto.UserFullInfoDTO; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.Objects; + +/** + * @author LiuXinXin + * @date 2022/9/30 上午9:54 + */ +@Component +@RequiredArgsConstructor +public class UserAuthLoginFacade { + private final INdUserAuthService iNdUserAuthService; + private final INdUserInfoService iNdUserInfoService; + + private final CompaniesCacheHelper companiesCacheHelper; + + public UserFullInfoDTO queryUserInfoInPasswordAuth(String username) { + // 获取用户鉴权信息 + NdUserAuth userAuth = iNdUserAuthService.getOne(Wrappers.lambdaQuery(NdUserAuth.class) + .eq(NdUserAuth::getIdentifier, username) + .eq(NdUserAuth::getAuthType, AuthTypeEnum.ACCOUNT_PASSWORD.getKey())); + if (Objects.isNull(userAuth)) { + return null; + } + + // 获取用户详情信息 + NdUserInfo userInfo = iNdUserInfoService.getOne(Wrappers.lambdaQuery(NdUserInfo.class) + .eq(NdUserInfo::getId, userAuth.getUserId())); + UserFullInfoDTO userFullInfoDto = new UserFullInfoDTO(); + userFullInfoDto.setUserId(userInfo.getId()); + userFullInfoDto.setNickName(userInfo.getUsername()); + userFullInfoDto.setIdentifier(userAuth.getIdentifier()); + userFullInfoDto.setCredential(userAuth.getCredential()); + userFullInfoDto.setCompanyId(userInfo.getCompanyId()); + CompanyDTO company = companiesCacheHelper.getById(userInfo.getCompanyId()); + if(Objects.nonNull(company)){ + userFullInfoDto.setCompanyName(company.getName()); + userFullInfoDto.setRegionId(company.getRegionId()); + userFullInfoDto.setRegionName(company.getRegionName()); + } + return userFullInfoDto; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/handler/DefaultExpiredSessionStrategy.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/handler/DefaultExpiredSessionStrategy.java new file mode 100644 index 0000000..0d089b0 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/handler/DefaultExpiredSessionStrategy.java @@ -0,0 +1,41 @@ +package com.ningdatech.carapi.user.security.auth.handler; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ningdatech.basic.model.ApiResponse; +import com.ningdatech.carapi.user.security.auth.errorcode.AuthErrorCodeEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.web.session.SessionInformationExpiredEvent; +import org.springframework.security.web.session.SessionInformationExpiredStrategy; +import org.springframework.stereotype.Component; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @Author LiuXinXin + * @Date 2020/8/20 11:15 上午 + * @Version 1.0 + **/ +@Component +public class DefaultExpiredSessionStrategy implements SessionInformationExpiredStrategy { + + public static final Logger LOG = LoggerFactory.getLogger(DefaultExpiredSessionStrategy.class); + + @Autowired + private ObjectMapper objectMapper; + + @Override + public void onExpiredSessionDetected(SessionInformationExpiredEvent sessionInformationExpiredEvent) + throws IOException, ServletException { + if (LOG.isInfoEnabled()) { + LOG.info("session已经过期"); + } + HttpServletResponse response = sessionInformationExpiredEvent.getResponse(); + response.setContentType("application/json;charset=UTF-8"); + response.getWriter().write(objectMapper.writeValueAsString( + ApiResponse.of(AuthErrorCodeEnum.SESSION_EXPIRED.getCode(), AuthErrorCodeEnum.SESSION_EXPIRED.getMsg(), null))); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/handler/DefaultLoginFailureHandler.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/handler/DefaultLoginFailureHandler.java new file mode 100644 index 0000000..a225d62 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/handler/DefaultLoginFailureHandler.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.user.security.auth.handler; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ningdatech.basic.model.ApiResponse; +import com.ningdatech.carapi.user.security.auth.errorcode.AuthErrorCodeEnum; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; +import org.springframework.stereotype.Component; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:32 下午 + * @Version 1.0 + **/ +@Component("defaultLoginFailureHandler") +public class DefaultLoginFailureHandler extends SimpleUrlAuthenticationFailureHandler { + + private final ObjectMapper objectMapper = new ObjectMapper(); + + @Override + public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, + AuthenticationException exception) throws IOException, ServletException { + response.setContentType("application/json;charset=UTF-8"); + int errorCode; + String errorMsg; + // 所有的认证异常都可以在这里添加,目前只支持用户名密码错误异常 + if (exception instanceof BadCredentialsException || exception instanceof UsernameNotFoundException) { + errorCode = AuthErrorCodeEnum.USERNAME_OR_PASSWORD_ERROR.getCode(); + errorMsg = "帐号密码错误"; + } else { + errorCode = ApiResponse.ERROR_CODE; + errorMsg = exception.getMessage(); + } + response.setStatus(400); + response.getWriter() + .write(objectMapper.writeValueAsString(ApiResponse.of(errorCode, errorMsg, null))); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/handler/DefaultLoginSuccessHandler.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/handler/DefaultLoginSuccessHandler.java new file mode 100644 index 0000000..f156e0d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/handler/DefaultLoginSuccessHandler.java @@ -0,0 +1,38 @@ +package com.ningdatech.carapi.user.security.auth.handler; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ningdatech.basic.model.ApiResponse; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Primary; +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; +import org.springframework.stereotype.Component; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:32 下午 + * @Version 1.0 + **/ +@Component("defaultLoginSuccessHandler") +@Primary +public class DefaultLoginSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler { + + @Autowired + private ObjectMapper objectMapper; + + @Override + public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, + Authentication authentication) throws IOException, ServletException { + response.setContentType("application/json;charset=UTF-8"); + //设置cookie + UserInfoDetails principal = (UserInfoDetails) authentication.getPrincipal(); + response.getWriter().write(objectMapper.writeValueAsString(ApiResponse.ofSuccess())); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/handler/DefaultLogoutSuccessHandler.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/handler/DefaultLogoutSuccessHandler.java new file mode 100644 index 0000000..07791e9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/handler/DefaultLogoutSuccessHandler.java @@ -0,0 +1,28 @@ +package com.ningdatech.carapi.user.security.auth.handler; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ningdatech.basic.model.ApiResponse; +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * 默认的退出成功处理器 + */ +@Component("defaultLogoutSuccessHandler") +public class DefaultLogoutSuccessHandler implements LogoutSuccessHandler { + + private final ObjectMapper objectMapper = new ObjectMapper(); + + @Override + public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) + throws IOException { + // 退出成功后返回 和前端约定的Json + response.setContentType("application/json;charset=UTF-8"); + response.getWriter().write(objectMapper.writeValueAsString(ApiResponse.ofSuccess())); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/model/UserInfoDetails.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/model/UserInfoDetails.java new file mode 100644 index 0000000..4b7653b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/model/UserInfoDetails.java @@ -0,0 +1,69 @@ +package com.ningdatech.carapi.user.security.auth.model; + +import com.ningdatech.basic.auth.AbstractLoginUser; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * @author LiuXinXin + * @date 2022/8/1 下午3:32 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class UserInfoDetails extends AbstractLoginUser implements UserDetails { + + private static final long serialVersionUID = 1L; + + private String nickName; + + private String password; + + private List roleList; + + private Integer dataScope; + + private Long roleId; + + private Long companyId; + + private String companyName; + + private Long regionId; + + private String regionName; + + /** + * 获取用户权限 + */ + @Override + public Collection getAuthorities() { + return new ArrayList<>(); + } + + @Override + public boolean isAccountNonExpired() { + return true; + } + + @Override + public boolean isAccountNonLocked() { + return true; + } + + @Override + public boolean isCredentialsNonExpired() { + return true; + } + + @Override + public boolean isEnabled() { + return true; + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/model/dto/UserFullInfoDTO.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/model/dto/UserFullInfoDTO.java new file mode 100644 index 0000000..b1c614c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/model/dto/UserFullInfoDTO.java @@ -0,0 +1,30 @@ +package com.ningdatech.carapi.user.security.auth.model.dto; + +import lombok.Data; + +/** + * @author LiuXinXin + * @date 2022/9/30 上午10:10 + */ +@Data +public class UserFullInfoDTO { + + /** + * userId + */ + private Long userId; + + private String nickName; + + private String identifier; + + private String credential; + + private Long companyId; + + private String companyName; + + private Long regionId; + + private String regionName; +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/PasswordLoginUserDetailServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/PasswordLoginUserDetailServiceImpl.java new file mode 100644 index 0000000..5325dd9 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/PasswordLoginUserDetailServiceImpl.java @@ -0,0 +1,68 @@ +package com.ningdatech.carapi.user.security.auth.password; + +import java.util.ArrayList; +import java.util.Objects; + +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +import com.ningdatech.carapi.common.helper.UserInfoHelper; +import com.ningdatech.carapi.sys.entity.Role; +import com.ningdatech.carapi.sys.entity.vo.UserInfoVO; +import com.ningdatech.carapi.sys.manage.UserManage; +import com.ningdatech.carapi.sys.service.RoleService; +import com.ningdatech.carapi.user.security.auth.facade.UserAuthLoginFacade; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.carapi.user.security.auth.model.dto.UserFullInfoDTO; + +import lombok.RequiredArgsConstructor; + +/** + * @author LiuXinXin + * @date 2022/9/30 上午9:49 + */ + +@Service("passwordLoginUserDetailService") +@RequiredArgsConstructor +public class PasswordLoginUserDetailServiceImpl implements UserDetailsService { + + private final UserAuthLoginFacade userAuthLoginFacade; + private final UserManage userManage; + private final RoleService roleService; + private final UserInfoHelper userInfoHelper; + + @Override + public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { + UserFullInfoDTO userFullInfoDTO = userAuthLoginFacade.queryUserInfoInPasswordAuth(username); + if (Objects.isNull(userFullInfoDTO)) { + throw new UsernameNotFoundException(String.format("%s user not exist", username)); + } + + UserInfoDetails userInfoDetails = new UserInfoDetails(); + userInfoDetails.setUserId(userFullInfoDTO.getUserId()); + userInfoDetails.setNickName(userFullInfoDTO.getNickName()); + userInfoDetails.setUsername(userFullInfoDTO.getNickName()); + userInfoDetails.setIdentifier(userFullInfoDTO.getIdentifier()); + userInfoDetails.setPassword(userFullInfoDTO.getCredential()); + userInfoDetails.setCompanyId(userFullInfoDTO.getCompanyId()); + userInfoDetails.setCompanyName(userFullInfoDTO.getCompanyName()); + userInfoDetails.setRoleList(new ArrayList<>()); + userInfoDetails.setRegionId(userFullInfoDTO.getRegionId()); + userInfoDetails.setRegionName(userFullInfoDTO.getRegionName()); + + //UserInfoVO userInfoVO = userManage.queryDetails(userFullInfoDTO.getUserId()); + UserInfoVO userInfoVO = userInfoHelper.getUserDetailByUserId(userFullInfoDTO.getUserId()); + //即便是多个 暂时取一个 + if(Objects.isNull(userInfoVO) || Objects.isNull(userInfoVO.getRole())){ + return userInfoDetails; + } + userInfoDetails.setRoleId(userInfoVO.getRole()); + Role role = roleService.getById(userInfoVO.getRole()); + if(Objects.isNull(role) || Objects.isNull(role.getDataScope())){ + return userInfoDetails; + } + userInfoDetails.setDataScope(role.getDataScope()); + return userInfoDetails; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/UsernamePasswordAuthFilter.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/UsernamePasswordAuthFilter.java new file mode 100644 index 0000000..21ec46e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/UsernamePasswordAuthFilter.java @@ -0,0 +1,87 @@ +package com.ningdatech.carapi.user.security.auth.password; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpMethod; +import org.springframework.security.authentication.AuthenticationServiceException; +import org.springframework.security.authentication.InternalAuthenticationServiceException; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; + +import cn.hutool.crypto.asymmetric.KeyType; +import cn.hutool.crypto.asymmetric.RSA; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:46 下午 + * @Version 1.0 + **/ + +public class UsernamePasswordAuthFilter extends AbstractAuthenticationProcessingFilter { + + private String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAPhUV8sdOC5MB0m6qHAIJfI0vhkO+wZpO8srcmiMjbzCoaCSznlxZKLVv8MXMB5fgEHqTlrXThZlmCXHJRdZvIpBLNCYu5dd8T0NlmxuioiOVH3dU7Cd1a78B901oZ0NJ5TdcmtQQQQNIq/eKdeOpb+x9NGCLBy7vaOJtYYPTKQIDAQAB"; + + private String privateKey = "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIA+FRXyx04LkwHSbqocAgl8jS+GQ77Bmk7yytyaIyNvMKhoJLOeXFkotW/wxcwHl+AQepOWtdOFmWYJcclF1m8ikEs0Ji7l13xPQ2WbG6KiI5Ufd1TsJ3VrvwH3TWhnQ0nlN1ya1BBBA0ir94p146lv7H00YIsHLu9o4m1hg9MpAgMBAAECgYBdgueFNZ62/iGX9oXTbNDfcf7RZKoJcsq+PrRF3+83a2CjrCz2/MaCDPkgQwU4HWFVdS6sZ/z13Dla+hAKn+4X2v2pL3ryrcjlY35yreB6NlCjbsRbEACZEvhaps/taLu4IkZ/CQ6msCz8XHkBOMlWDF36kIxS3BFRmu3mWjHCcQJBAMAfZfKZxWX6lJBWLSy3QhV8jIo9+e+kk4VQRZUXgLJf1IwkxcHMmp4OSgcJp5do1YcoBlPQNdaWta0bt7TQL0cCQQCq4X+jc8Ikn/fxeeIpE75CqveHiF86KU7HKVfpjqiZATIeIbBe8eeC1pXlgX6TmMTWFQSRHWVzmVSwRaRhuYIPAkBd5jquksdu60T3MpdLtpm+5KvP2TCyFq7fRndrwhvtknbQtBxPdw/O1k8KF4bosp1CPKazCh12LxzGabikz+d7AkA0iKbo5UmmYNelEUeKQVuYu17l9/LuuoxRhlBUqVsDzu5NfSXvyobWHopuyGTVk33QIx4ITvVFmLoEhySGNrXZAkBktQR+kMStI0SlcMKYFKmQXu78W97p8soVvhP1AndvPiI9keO3UxO7cUjcPRROmcGUU39yGHYlJvu1Krj6+GI1"; + + private boolean postOnly = true; + + private final String SMS_VERIFICATION_CODE_FEILD = "verificationCode"; + + // ~ Constructors + // =================================================================================================== + + public UsernamePasswordAuthFilter(String processingUrl) { + super(new AntPathRequestMatcher(processingUrl, "POST")); + } + // ~ Methods + // ======================================================================================================== + + @Override + public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) + throws AuthenticationException { + + if (postOnly && !HttpMethod.POST.toString().equals(request.getMethod())) { + throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod()); + } + RSA rsa = new RSA(privateKey, publicKey); + String usernameParameter = "username"; + String username = request.getParameter(usernameParameter); + // 将获取到的经过RSA公钥加密后的用户名解密 + String userName = rsa.decryptStr(username, KeyType.PrivateKey); + + String passwordParameter = "password"; + String password = request.getParameter(passwordParameter); + // 将获取到的经过RSA公钥加密后的密码解密 + String pwd = rsa.decryptStr(password, KeyType.PrivateKey); + String verificationCode = request.getParameter(SMS_VERIFICATION_CODE_FEILD); + // 将获取到的经过RSA公钥加密后的验证码解密 + String verifyCode = rsa.decryptStr(verificationCode, KeyType.PrivateKey); + + if (StringUtils.isBlank(userName) || StringUtils.isBlank(pwd)) { + throw new UsernameNotFoundException("帐号密码不能为空!"); + } + userName = userName.trim(); + pwd = pwd.trim(); + verifyCode = verifyCode.trim(); + + try { + UsernamePasswordAuthToken authRequest = new UsernamePasswordAuthToken(userName, pwd, verifyCode); + // Allow subclasses to set the "details" property + setDetails(request, authRequest); + return this.getAuthenticationManager().authenticate(authRequest); + } catch (AuthenticationException e) { + throw e; + } catch (Exception e) { + throw new InternalAuthenticationServiceException(e.getMessage(), e); + } + } + + protected void setDetails(HttpServletRequest request, UsernamePasswordAuthToken authRequest) { + authRequest.setDetails(authenticationDetailsSource.buildDetails(request)); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/UsernamePasswordAuthProvider.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/UsernamePasswordAuthProvider.java new file mode 100644 index 0000000..587769a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/UsernamePasswordAuthProvider.java @@ -0,0 +1,149 @@ +package com.ningdatech.carapi.user.security.auth.password; + +import java.util.Objects; + +import org.springframework.security.authentication.AuthenticationProvider; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.InternalAuthenticationServiceException; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.password.PasswordEncoder; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.sys.contants.UserLoginConstant; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:55 下午 + * @Version 1.0 + **/ +public class UsernamePasswordAuthProvider implements AuthenticationProvider { + + private UserDetailsService userDetailsService; + private PasswordEncoder passwordEncoder; + private INdUserInfoService ndUserInfoService; + + private INdUserAuthService ndUserAuthService; + + private CachePlusOps cachePlusOps; + + private Boolean smsCheck; + + public UsernamePasswordAuthProvider() { + } + + @Override + public Authentication authenticate(Authentication authentication) throws AuthenticationException { + if (!(authentication instanceof UsernamePasswordAuthToken)) { + throw new RuntimeException("CustomAuthProvider 只支持 CustomAuthToken"); + } + UsernamePasswordAuthToken authenticationToken = (UsernamePasswordAuthToken)authentication; + // 获取用户名信息 + String userName = (String) authenticationToken.getPrincipal(); + + //验证短信验证码 + if(smsCheck){ + smsCheck(authenticationToken, userName); + } + + UserDetails user = userDetailsService.loadUserByUsername((String)authenticationToken.getPrincipal()); + if (user == null) { + throw new InternalAuthenticationServiceException("获取不到用户信息!"); + } + additionalAuthenticationChecks(user, authenticationToken); + // 将用户定义的user放入token中,这样可以在session中查询到所有自定义的用户信息 + return new UsernamePasswordAuthToken(user, user.getPassword(), user.getAuthorities(),null); + } + + private void smsCheck(UsernamePasswordAuthToken authenticationToken, String userName) { + String code = authenticationToken.getVerificationCode(); + + if (Objects.isNull(code)){ + throw new BizException("验证码未传!"); + } + code = code.trim(); + + // 将用户输入的验证码与redis中对应手机号的验证码做比较,判断验证码是否过期 + CacheKey key = new CacheKey(UserLoginConstant.RedisKey.USER_LOGIN + userName); + String verificationCode = cachePlusOps.get(key); + + if (Objects.isNull(verificationCode)){ + throw new BizException("验证码失效,请重新获取!"); + } + + if (!code.equals(verificationCode)){ + throw new BizException("验证码输入错误,请重新输入!"); + } + } + + protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthToken authentication) + throws AuthenticationException { + String presentedUsername = authentication.getPrincipal().toString(); + NdUserAuth userAuth = ndUserAuthService.getOne(Wrappers.lambdaQuery(NdUserAuth.class) + .eq(NdUserAuth::getIdentifier, presentedUsername)); + if (!userAuth.getIsAvailable()){ + throw new BizException("账号已被禁用,禁止登录!"); + } + + if (authentication.getCredentials() == null) { + throw new BadCredentialsException("login fail! password is null"); + } + String presentedPassword = authentication.getCredentials().toString(); + if (!passwordEncoder.matches(presentedPassword, userDetails.getPassword())) { + throw new BadCredentialsException("login fail! password is error"); + } + } + + @Override + public boolean supports(Class authentication) { + return UsernamePasswordAuthToken.class.isAssignableFrom(authentication); + } + + public void setUserDetailsService(UserDetailsService userDetailsService) { + this.userDetailsService = userDetailsService; + } + + public void setPasswordEncoder(PasswordEncoder passwordEncoder) { + this.passwordEncoder = passwordEncoder; + } + + public void setNdUserInfoService(INdUserInfoService ndUserInfoService) { + this.ndUserInfoService = ndUserInfoService; + } + + public void setCachePlusOps(CachePlusOps cachePlusOps) { + this.cachePlusOps = cachePlusOps; + } + + public INdUserInfoService getNdUserInfoService() { + return ndUserInfoService; + } + + public CachePlusOps getCachePlusOps() { + return cachePlusOps; + } + + public INdUserAuthService getNdUserAuthService() { + return ndUserAuthService; + } + + public void setNdUserAuthService(INdUserAuthService ndUserAuthService) { + this.ndUserAuthService = ndUserAuthService; + } + + public Boolean getSmsCheck() { + return smsCheck; + } + + public void setSmsCheck(Boolean smsCheck) { + this.smsCheck = smsCheck; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/UsernamePasswordAuthSecurityConfig.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/UsernamePasswordAuthSecurityConfig.java new file mode 100644 index 0000000..b108c3e --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/UsernamePasswordAuthSecurityConfig.java @@ -0,0 +1,84 @@ +package com.ningdatech.carapi.user.security.auth.password; + +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.user.security.auth.AuthProperties; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.SecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.DefaultSecurityFilterChain; +import org.springframework.security.web.authentication.AuthenticationFailureHandler; +import org.springframework.security.web.authentication.AuthenticationSuccessHandler; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.stereotype.Component; + +/** + * 账号密码登陆的认证配置 + */ +@Component +public class UsernamePasswordAuthSecurityConfig + extends SecurityConfigurerAdapter { + + @Autowired + @Qualifier(value = "defaultLoginSuccessHandler") + protected AuthenticationSuccessHandler defaultLoginSuccessHandler; + + @Autowired + @Qualifier(value = "defaultLoginFailureHandler") + protected AuthenticationFailureHandler defaultLoginFailureHandler; + + @Autowired + @Qualifier(value = "passwordLoginUserDetailService") + private UserDetailsService passwordLoginUserDetailService; + + @Autowired + private INdUserInfoService ndUserInfoService; + + @Autowired + private CachePlusOps cachePlusOps; + + @Autowired + private INdUserAuthService ndUserAuthService; + + @Autowired + private PasswordEncoder passwordEncoder; + + @Autowired + private AuthProperties authProperties; + + private AuthenticationManager authenticationManager; + + @Value("${login.sms-check}") + private boolean smsChcek; + + @Override + public void configure(HttpSecurity http) throws Exception { + UsernamePasswordAuthFilter usernamePasswordAuthFilter = + new UsernamePasswordAuthFilter(authProperties.getPasswordLoginUrl()); + authenticationManager = http.getSharedObject(AuthenticationManager.class); + usernamePasswordAuthFilter.setAuthenticationManager(authenticationManager); + usernamePasswordAuthFilter.setAuthenticationSuccessHandler(defaultLoginSuccessHandler); + usernamePasswordAuthFilter.setAuthenticationFailureHandler(defaultLoginFailureHandler); + + UsernamePasswordAuthProvider authenticationProvider = new UsernamePasswordAuthProvider(); + authenticationProvider.setUserDetailsService(passwordLoginUserDetailService); + authenticationProvider.setNdUserInfoService(ndUserInfoService); + authenticationProvider.setCachePlusOps(cachePlusOps); + authenticationProvider.setNdUserAuthService(ndUserAuthService); + authenticationProvider.setSmsCheck(smsChcek); + // 确保对密码进行加密的encoder和解密的encoder相同 + authenticationProvider.setPasswordEncoder(passwordEncoder); + http.authenticationProvider(authenticationProvider).addFilterAfter(usernamePasswordAuthFilter, + UsernamePasswordAuthenticationFilter.class); + } + + public AuthenticationManager getAuthenticationManager() { + return authenticationManager; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/UsernamePasswordAuthToken.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/UsernamePasswordAuthToken.java new file mode 100644 index 0000000..7505a5d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/security/auth/password/UsernamePasswordAuthToken.java @@ -0,0 +1,75 @@ +package com.ningdatech.carapi.user.security.auth.password; + +import java.util.Collection; + +import org.springframework.security.authentication.AbstractAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.SpringSecurityCoreVersion; + +/** + * @Author LiuXinXin + * @Date 2020/8/3 8:52 下午 + * @Version 1.0 + **/ +public class UsernamePasswordAuthToken extends AbstractAuthenticationToken { + + private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; + + private final Object principal; + + private final Object credentials; + + private final String verificationCode; + + /** + * This constructor can be safely used by any code that wishes to create a + * UsernamePasswordAuthenticationToken, as the {@link #isAuthenticated()} will return + * false. + */ + public UsernamePasswordAuthToken(String principal, String credentials, String verificationCode) { + super(null); + this.principal = principal; + this.credentials = credentials; + this.verificationCode = verificationCode; + setAuthenticated(false); + } + + public UsernamePasswordAuthToken(Object principal, Object credentials, + Collection authorities, String verificationCode) { + super(authorities); + this.principal = principal; + this.credentials = credentials; + this.verificationCode = verificationCode; + // must use super, as we override + super.setAuthenticated(true); + } + + public Object getCredentials() { + return this.credentials; + } + + @Override + public Object getPrincipal() { + return this.principal; + } + + public String getVerificationCode() { + return verificationCode; + } + + + @Override + public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { + if (isAuthenticated) { + throw new IllegalArgumentException( + "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); + } + super.setAuthenticated(false); + } + + @Override + public void eraseCredentials() { + super.eraseCredentials(); + } + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/INdUserAuthService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/INdUserAuthService.java new file mode 100644 index 0000000..5e77a8a --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/INdUserAuthService.java @@ -0,0 +1,16 @@ +package com.ningdatech.carapi.user.service; + +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author LiuXinXin + * @since 2022-09-30 + */ +public interface INdUserAuthService extends IService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/INdUserInfoJoinService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/INdUserInfoJoinService.java new file mode 100644 index 0000000..0304c2c --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/INdUserInfoJoinService.java @@ -0,0 +1,24 @@ +package com.ningdatech.carapi.user.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.carapi.sys.entity.dto.UserSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.UserUpdateDTO; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.entity.NdUserInfoJoin; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author LiuXinXin + * @since 2022-09-30 + */ +public interface INdUserInfoJoinService extends IService { + + Page pageJoin(Page page,LambdaQueryWrapper wrapper); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/INdUserInfoService.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/INdUserInfoService.java new file mode 100644 index 0000000..5b04cc8 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/INdUserInfoService.java @@ -0,0 +1,45 @@ +package com.ningdatech.carapi.user.service; + +import com.ningdatech.carapi.sys.entity.dto.UserSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.UserUpdateDTO; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author LiuXinXin + * @since 2022-09-30 + */ +public interface INdUserInfoService extends IService { + + /** + * 根据ID删除 + * + * @param ids id + * @return 是否成功 + */ + boolean removeByIdWithCache(List ids); + + /** + * 保存用户 + * + * @param data 用户 + * @param userId 用户id + */ + void save(UserSaveDTO data, Long userId); + + /** + * 修改 + * + * @param data 用户 + * @param userId 用户id + */ + void update(UserUpdateDTO data, Long userId); + + Boolean check(String account,String mobile); +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/impl/NdUserAuthServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/impl/NdUserAuthServiceImpl.java new file mode 100644 index 0000000..3ad7f85 --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/impl/NdUserAuthServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.carapi.user.service.impl; + +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.mapper.NdUserAuthMapper; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author LiuXinXin + * @since 2022-09-30 + */ +@Service +public class NdUserAuthServiceImpl extends ServiceImpl implements INdUserAuthService { + +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/impl/NdUserInfoJoinServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/impl/NdUserInfoJoinServiceImpl.java new file mode 100644 index 0000000..492fb5b --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/impl/NdUserInfoJoinServiceImpl.java @@ -0,0 +1,59 @@ +package com.ningdatech.carapi.user.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpStatus; +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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.basic.exception.BaseUncheckedException; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.datascope.aop.LambdaDataScope; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.entity.dto.UserSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.UserUpdateDTO; +import com.ningdatech.carapi.sys.service.UserRoleService; +import com.ningdatech.carapi.sys.utils.AuthCacheKeyUtils; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.entity.NdUserInfoJoin; +import com.ningdatech.carapi.user.mapper.NdUserInfoJoinMapper; +import com.ningdatech.carapi.user.mapper.NdUserInfoMapper; +import com.ningdatech.carapi.user.security.auth.constant.AuthTypeEnum; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoJoinService; +import com.ningdatech.carapi.user.service.INdUserInfoService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 服务实现类 + *

+ * + * @author LiuXinXin + * @since 2022-09-30 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class NdUserInfoJoinServiceImpl extends ServiceImpl + implements INdUserInfoJoinService { + + private final NdUserInfoJoinMapper userInfoJoinMapper; + + @Override + @LambdaDataScope(wrapperIndex = 1) + public Page pageJoin(Page page, LambdaQueryWrapper wrapper) { + return userInfoJoinMapper.pageJoin(page,wrapper); + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/impl/NdUserInfoServiceImpl.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/impl/NdUserInfoServiceImpl.java new file mode 100644 index 0000000..0b3383d --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/service/impl/NdUserInfoServiceImpl.java @@ -0,0 +1,196 @@ +package com.ningdatech.carapi.user.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpStatus; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BaseUncheckedException; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.exception.code.ExceptionCode; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.driver.constant.UserCanLoginEnum; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.entity.dto.UserSaveDTO; +import com.ningdatech.carapi.sys.entity.dto.UserUpdateDTO; +import com.ningdatech.carapi.sys.helper.UserCacheHelper; +import com.ningdatech.carapi.sys.service.UserRoleService; +import com.ningdatech.carapi.sys.utils.AuthCacheKeyUtils; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.mapper.NdUserInfoMapper; +import com.ningdatech.carapi.user.security.auth.constant.AuthTypeEnum; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 服务实现类 + *

+ * + * @author LiuXinXin + * @since 2022-09-30 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class NdUserInfoServiceImpl extends ServiceImpl implements INdUserInfoService { + private final CachePlusOps cachePlusOps; + private final NdUserInfoMapper userMapper; + private final INdUserAuthService ndUserAuthService; + private final UserRoleService userRoleService; + private final PasswordEncoder passwordEncoder; + + private final UserCacheHelper userCacheHelper; + + private static final String SUPER_ADMIN = "SUPER_ADMIN"; + + /** + * 删除用户时,需要级联删除跟角色相关的一切资源: + * 1,角色本身 + * 2,角色-组织: + * 3,角色-权限(菜单和按钮): + * 4,角色-用户:角色拥有的用户 + * 5,用户-权限: + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean removeByIdWithCache(List ids) { + if (ids.isEmpty()) { + return true; + } + // 用户 + boolean removeFlag = removeByIds(ids); + + //用户 + ids.forEach(userId -> { + //删除关联表和缓存 + ndUserAuthService.remove(Wrappers.lambdaQuery(NdUserAuth.class).eq(NdUserAuth::getUserId,userId)); + userRoleService.remove(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getUserId,userId)); + cachePlusOps.del(AuthCacheKeyUtils.userResourceCacheKey(userId)); + userCacheHelper.refresh(userId); + }); + + return removeFlag; + } + + + /** + * 保存用户 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void save(UserSaveDTO data, Long userId) { + if(StrUtil.isNotBlank(data.getAccount()) && StrUtil.isNotBlank(data.getMobile()) + && check(data.getAccount(),data.getMobile())){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK, "帐号{},或者手机号{} 输入有误或已经存在", + data.getAccount(),data.getMobile()); + } + + NdUserInfo user = BeanUtil.toBean(data, NdUserInfo.class); + //创建人 最后修改人 + user.setCreateBy(userId); + user.setUpdateBy(userId); + user.setCanLogin(UserCanLoginEnum.CAN_LOGIN.getCode()); + if(save(user)){ + userCacheHelper.refresh(user.getId()); + } + + NdUserAuth userAuth = new NdUserAuth(); + userAuth.setUserId(user.getId()); + userAuth.setIdentifier(data.getAccount()); + userAuth.setCredential(passwordEncoder.encode(data.getPassword())); + userAuth.setAuthType(AuthTypeEnum.ACCOUNT_PASSWORD.getKey()); + ndUserAuthService.save(userAuth); + + UserRole userRole = new UserRole(); + userRole.setUserId(user.getId()); + userRole.setRoleId(data.getRole()); + userRoleService.save(userRole); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(UserUpdateDTO data, Long userId) { + NdUserInfo userOld = userMapper.selectById(data.getId()); + if(Objects.isNull(userOld)){ + throw new BaseUncheckedException(HttpStatus.HTTP_OK,String.format("修改用户%d 为空",data.getId())); + } + + if(StringUtils.isNotBlank(data.getAccount())){ + Assert.isFalse(checkAccount(data.getAccount(),userOld.getId()), "帐号{} 已经存在",data.getAccount()); + } + + if(StringUtils.isNotBlank(data.getMobile())){ + Assert.isFalse(checkMobile(data.getMobile(),userOld.getId()), "手机号{} 已经存在",data.getMobile()); + } + + NdUserInfo user = BeanUtil.toBean(data, NdUserInfo.class); + //最后修改人 + user.setUpdateBy(userId); + if(updateById(user)){ + userCacheHelper.refresh(userId); + } + + if(StringUtils.isNotBlank(data.getAccount()) + || StringUtils.isNotBlank(data.getPassword())){ + NdUserAuth authOld = ndUserAuthService.getOne(Wrappers.lambdaQuery(NdUserAuth.class) + .eq(NdUserAuth::getUserId, user.getId())); + if(Objects.isNull(authOld)){ + //去新增个auth + if(StringUtils.isBlank(data.getAccount()) + || StringUtils.isBlank(data.getPassword())){ + throw new BizException(ExceptionCode.BASE_VALID_PARAM.getCode(),String.format("修改auth用户%d 号码密码必填",data.getId())); + } + NdUserAuth userAuth = new NdUserAuth(); + userAuth.setUserId(user.getId()); + userAuth.setIdentifier(data.getAccount()); + userAuth.setCredential(passwordEncoder.encode(data.getPassword())); + userAuth.setAuthType(AuthTypeEnum.ACCOUNT_PASSWORD.getKey()); + ndUserAuthService.save(userAuth); + }else{ + if(StringUtils.isNotBlank(data.getAccount())){ + authOld.setIdentifier(data.getAccount()); + } + if(StringUtils.isNotBlank(data.getPassword())){ + authOld.setCredential(passwordEncoder.encode(data.getPassword())); + } + authOld.setAuthType(AuthTypeEnum.ACCOUNT_PASSWORD.getKey()); + ndUserAuthService.updateById(authOld); + } + } + + if(Objects.nonNull(data.getRole())){ + userRoleService.remove(Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getUserId, user.getId())); + UserRole userRole = new UserRole(); + userRole.setUserId(user.getId()); + userRole.setRoleId(data.getRole()); + userRoleService.save(userRole); + } + } + + @Override + public Boolean check(String account,String mobile) { + return ndUserAuthService.count(Wrappers.lambdaQuery(NdUserAuth.class).eq(NdUserAuth::getIdentifier, account)) > 0 || + super.count(Wrappers.lambdaQuery(NdUserInfo.class).eq(NdUserInfo::getMobile,mobile)) > 0; + } + + private Boolean checkMobile(String mobile,Long id) { + return super.count(Wrappers.lambdaQuery(NdUserInfo.class).ne(NdUserInfo::getId,id).eq(NdUserInfo::getMobile,mobile)) > 0; + } + private Boolean checkAccount(String account,Long id) { + return ndUserAuthService.count(Wrappers.lambdaQuery(NdUserAuth.class).ne(NdUserAuth::getUserId,id) + .eq(NdUserAuth::getIdentifier, account)) > 0; + } +} diff --git a/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/util/LoginUserUtil.java b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/util/LoginUserUtil.java new file mode 100644 index 0000000..8e274af --- /dev/null +++ b/ningda-yw-api/src/main/java/com/ningdatech/carapi/user/util/LoginUserUtil.java @@ -0,0 +1,17 @@ +package com.ningdatech.carapi.user.util; + +import com.ningdatech.basic.auth.AbstractLoginUserUtil; +import com.ningdatech.carapi.user.security.auth.model.UserInfoDetails; + +/** + * @Author liuxinxin + * @Date 2022/9/30 12:26 下午 + * @Version 1.0 + **/ +public class LoginUserUtil extends AbstractLoginUserUtil { + + public static UserInfoDetails loginUserDetail() { + return getLoginUserPrincipal(); + } + +} diff --git a/ningda-yw-api/src/main/resources/application-dev.yml b/ningda-yw-api/src/main/resources/application-dev.yml new file mode 100644 index 0000000..ee32fd4 --- /dev/null +++ b/ningda-yw-api/src/main/resources/application-dev.yml @@ -0,0 +1,162 @@ +server: + port: 28088 + servlet: + context-path: /yw + session: + cookie: + http-only: true + tomcat: + connection-timeout: 600000 +logging: + config: classpath:logback-spring.xml + file: + path: logs +spring: + mvc: + pathmatch: + matching-strategy: ant_path_matcher + session: + store-type: redis + redis: + namespace: "spring:session" + redis: + timeout: 15000 + host: 47.98.125.47 + port: 26379 + database: 5 + password: Ndkj@1104! + jedis: + pool: + max-active: 200 + max-idle: 500 + min-idle: 8 + max-wait: 10000 + application: + name: cm + jackson: + default-property-inclusion: non_null + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + datasource: + type: com.zaxxer.hikari.HikariDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://47.98.125.47:3306/nd-yw-road?serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false + username: root + password: Ndkj@1104 + hikari: + minimum-idle: 5 + maximum-pool-size: 100 + aop: + proxy-target-class: true + auto: true + mqtt: + url: tcp://202.107.206.254:1883 + username: artemis_22874416_1F3PANKD + password: GKIII7GJ + cleansession: false + clientid: 52dba0a1d3804a5e920afea8f8c06070 + timeout: 1000 + keepalive: 10 + completionTimeout: 3000 + default_topic: artemis/event_msa_alarm/5201154049/admin + servlet: + multipart: + max-file-size: 100MB + +mybatis-plus: + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + +swagger: + enabled: true +# redis相关配置 +nd: + cache: + type: REDIS + serializerType: ProtoStuff + cacheNullVal: true + def: + keyPrefix: cm + timeToLive: PT5M + + # 文件存储 + file: + storage-type: ALI_OSS + ali: + protocol: https:// + bucket: devplat + urlPrefix: oss-cn-hangzhou.aliyuncs.com + endpoint: oss-cn-hangzhou.aliyuncs.com + accessKeyId: LTAI4GL7uypycnBjiRn55rMG + accessKeySecret: qwYC7bW9bkStsko7qkLVnToAzj0Y98 + log: + enabled: true + type: DB +task: + host: iZbp13nwyvib53j4j1p2xoZ + switch: + is-open: false #开关 + gps-data-pull: + domain: https://jtjdhcweb.z1l1.com:7443 + real-time-data-url: /talent/gps/datalist + key: Gps@!@163. + + corn: + task-corn: 0/30 * * * * ? #每隔30秒统计一次车辆在线数 + driver-abnormal-behavior-task-corn: 0 0/1 * * * ? #每隔1分钟更新一次驾驶员异常行为数据 + vehicle-status-task-corn: 0 0/1 * * * ? +sms: + user: hzndkj + siid: HZNDKJYXGS + secretKey: hzndkj12!@ + url: http://115.239.134.217/smsservice/httpservices/capService + interfaceKey: szc2_sms + transmitUrl: http://shuiniche.ningdatech.com/sms/open/api/sms/send-sms-code +car: + interfaceKey: szc2_car_position +open-api: + app-key-secret: + test: test +error-warn: + url: https://oapi.dingtalk.com/robot/send?access_token=bc6b4c0deb3299a045bc511b61cfb0bd516af0c1d1ca221e3bcc97b9d69c2637 +# 日志文件配置 +log: + path: ./logs + info: + file-size: 50MB + max-size: 5 + total-size: 200MB + error: + file-size: 10MB + max-size: 5 + total-size: 50MB + backup: + url: https://claqgz.zcom.gov.cn/cm/open/api/log/backup/download +# url: http://shuiniche.ningdatech.com/cm/open/api/log/backup/download + +login: + sms-check: false + public-key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAPhUV8sdOC5MB0m6qHAIJfI0vhkO+wZpO8srcmiMjbzCoaCSznlxZKLVv8MXMB5fgEHqTlrXThZlmCXHJRdZvIpBLNCYu5dd8T0NlmxuioiOVH3dU7Cd1a78B901oZ0NJ5TdcmtQQQQNIq/eKdeOpb+x9NGCLBy7vaOJtYYPTKQIDAQAB + private-key: MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIA+FRXyx04LkwHSbqocAgl8jS+GQ77Bmk7yytyaIyNvMKhoJLOeXFkotW/wxcwHl+AQepOWtdOFmWYJcclF1m8ikEs0Ji7l13xPQ2WbG6KiI5Ufd1TsJ3VrvwH3TWhnQ0nlN1ya1BBBA0ir94p146lv7H00YIsHLu9o4m1hg9MpAgMBAAECgYBdgueFNZ62/iGX9oXTbNDfcf7RZKoJcsq+PrRF3+83a2CjrCz2/MaCDPkgQwU4HWFVdS6sZ/z13Dla+hAKn+4X2v2pL3ryrcjlY35yreB6NlCjbsRbEACZEvhaps/taLu4IkZ/CQ6msCz8XHkBOMlWDF36kIxS3BFRmu3mWjHCcQJBAMAfZfKZxWX6lJBWLSy3QhV8jIo9+e+kk4VQRZUXgLJf1IwkxcHMmp4OSgcJp5do1YcoBlPQNdaWta0bt7TQL0cCQQCq4X+jc8Ikn/fxeeIpE75CqveHiF86KU7HKVfpjqiZATIeIbBe8eeC1pXlgX6TmMTWFQSRHWVzmVSwRaRhuYIPAkBd5jquksdu60T3MpdLtpm+5KvP2TCyFq7fRndrwhvtknbQtBxPdw/O1k8KF4bosp1CPKazCh12LxzGabikz+d7AkA0iKbo5UmmYNelEUeKQVuYu17l9/LuuoxRhlBUqVsDzu5NfSXvyobWHopuyGTVk33QIx4ITvVFmLoEhySGNrXZAkBktQR+kMStI0SlcMKYFKmQXu78W97p8soVvhP1AndvPiI9keO3UxO7cUjcPRROmcGUU39yGHYlJvu1Krj6+GI1 +qyytz: + host: https://gyytz.market.alicloudapi.com + path: /sms/smsSend + appcode: daab49d0cf344614b174a9bf8303b4e2 + smsSignId: 2e65b1bb3d054466b82f0c9d125465e2 + templateId: 908e94ccf08b4476ba6c876d13f084ad +gps: + host: 120.26.44.207 +vedio: + host: 120.26.44.207 +send-urge-warn: + url: http://120.26.44.207:8092/warn/send_urge_warn +radar-data-task: + enable: false +# 黄山隧道 + hs-yw-radar-arm-ip: 192.168.6.42 + hs-yw-radar-arm-port: 13000 + hs-dy-radar-arm-ip: 192.168.6.49 + hs-dy-radar-arm-port: 13001 +# 何里隧道 + hl-radar-arm-ip: 192.168.10.62 + hl-radar-arm-port: 13002 diff --git a/ningda-yw-api/src/main/resources/application-prod.yml b/ningda-yw-api/src/main/resources/application-prod.yml new file mode 100644 index 0000000..ba4afe6 --- /dev/null +++ b/ningda-yw-api/src/main/resources/application-prod.yml @@ -0,0 +1,195 @@ +server: + port: 28088 + servlet: + context-path: /yw + session: + cookie: + http-only: true + tomcat: + connection-timeout: 600000 +logging: + config: classpath:logback-spring.xml + file: + path: logs +spring: + mvc: + pathmatch: + matching-strategy: ant_path_matcher + session: + store-type: redis + redis: + namespace: "spring:session" + redis: + timeout: 15000 + host: localhost + port: 6379 + database: 0 + password: Ndkj1234 + jedis: + pool: + max-active: 200 + max-idle: 500 + min-idle: 8 + max-wait: 10000 + application: + name: cm + jackson: + default-property-inclusion: non_null + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + datasource: + type: com.zaxxer.hikari.HikariDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/nd-yw-road?serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false + username: root + password: NingdaKeji123! + hikari: + minimum-idle: 5 + maximum-pool-size: 1000 + connection-timeout: 6000 + idle-timeout: 600000 + max-lifetime: 1800000 + aop: + proxy-target-class: true + auto: true + + mqtt: + url: tcp://202.107.206.254:1883 + username: artemis_22874416_1F3PANKD + password: GKIII7GJ + cleansession: false + clientid: 52dba0a1d3804a5e920afea8f8c06070 + timeout: 1000 + keepalive: 10 + completionTimeout: 3000 + default_topic: artemis/event_msa_alarm/5201154049/admin + servlet: + multipart: + max-file-size: 100MB + +jwt: + header: Authorization + # 令牌前缀 + token-start-with: sfm + # 必须使用最少88位的Base64对该令牌进行编码 + base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI= + # 令牌过期时间 此处单位/毫秒 ,默认4小时 + token-validity-in-seconds: 14400000 + # 在线用户key + online-key: sfm-online-token- + # token 续期检查时间范围(默认30分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期 + detect: 1800000 + # 续期时间范围,默认1小时,单位毫秒 + renew: 3600000 + +# 内存用户缓存配置 +user-cache: + # 最小回收数(当缓存数量达到此值时进行回收) + min-evictable-size: 512 + # 最小回收间隔 + min-evictable-interval: 1800000 + # 最小存活时间 (ms) + min-idle-time: 3600000 + +mybatis-plus: + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + +swagger: + enabled: true +# redis相关配置 +nd: + cache: + type: REDIS + serializerType: ProtoStuff + cacheNullVal: true + def: + keyPrefix: cm + timeToLive: PT5M + # 文件存储 + file: + storage-type: ALI_OSS + ali: + protocol: https:// + bucket: sanzhuangche2 + urlPrefix: oss-cn-hangzhou-zwynet-d01-a.internet.cloud-inner.zj.gov.cn + endpoint: oss-cn-hangzhou-zwynet-d01-a.internet.cloud-inner.zj.gov.cn + accessKeyId: oZFNfkh9YexqzTED + accessKeySecret: xewpDvACMzLQAGvY14fcXjkijBKSNH + log: + enabled: true + type: DB +task: + host: iZi5c01gdwbs8j8r0dzf8lZ + switch: + is-open: true #开关 + gps-data-pull: + domain: https://jtjdhcweb.z1l1.com:7443 + real-time-data-url: /talent/gps/datalist + key: Gps@!@163. + corn: + task-corn: 0/30 * * * * ? #每隔30秒统计一次车辆在线数 + driver-abnormal-behavior-task-corn: 0 0/1 * * * ? #每隔1分钟更新一次驾驶员异常行为数据 + vehicle-status-task-corn: 0 0/1 * * * ? +sms: + user: hzndkj + siid: HZNDKJYXGS + secretKey: hzndkj12!@ + url: http://115.239.134.217/smsservice/httpservices/capService + interfaceKey: szc2_sms + transmitUrl: http://shuiniche.ningdatech.com/sms/open/api/sms/send-sms-code +car: + interfaceKey: szc2_car_position +open-api: + app-key-secret: + test: test +error-warn: + url: https://oapi.dingtalk.com/robot/send?access_token=bc6b4c0deb3299a045bc511b61cfb0bd516af0c1d1ca221e3bcc97b9d69c2637 +# 日志文件配置 +log: + path: ./logs + info: + file-size: 50MB + max-size: 5 + total-size: 200MB + error: + file-size: 10MB + max-size: 5 + total-size: 50MB + backup: + url: https://claqgz.zcom.gov.cn/cm/open/api/log/backup/download +# url: http://shuiniche.ningdatech.com/cm/open/api/log/backup/download + +login: + sms-check: false + public-key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAPhUV8sdOC5MB0m6qHAIJfI0vhkO+wZpO8srcmiMjbzCoaCSznlxZKLVv8MXMB5fgEHqTlrXThZlmCXHJRdZvIpBLNCYu5dd8T0NlmxuioiOVH3dU7Cd1a78B901oZ0NJ5TdcmtQQQQNIq/eKdeOpb+x9NGCLBy7vaOJtYYPTKQIDAQAB + private-key: MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIA+FRXyx04LkwHSbqocAgl8jS+GQ77Bmk7yytyaIyNvMKhoJLOeXFkotW/wxcwHl+AQepOWtdOFmWYJcclF1m8ikEs0Ji7l13xPQ2WbG6KiI5Ufd1TsJ3VrvwH3TWhnQ0nlN1ya1BBBA0ir94p146lv7H00YIsHLu9o4m1hg9MpAgMBAAECgYBdgueFNZ62/iGX9oXTbNDfcf7RZKoJcsq+PrRF3+83a2CjrCz2/MaCDPkgQwU4HWFVdS6sZ/z13Dla+hAKn+4X2v2pL3ryrcjlY35yreB6NlCjbsRbEACZEvhaps/taLu4IkZ/CQ6msCz8XHkBOMlWDF36kIxS3BFRmu3mWjHCcQJBAMAfZfKZxWX6lJBWLSy3QhV8jIo9+e+kk4VQRZUXgLJf1IwkxcHMmp4OSgcJp5do1YcoBlPQNdaWta0bt7TQL0cCQQCq4X+jc8Ikn/fxeeIpE75CqveHiF86KU7HKVfpjqiZATIeIbBe8eeC1pXlgX6TmMTWFQSRHWVzmVSwRaRhuYIPAkBd5jquksdu60T3MpdLtpm+5KvP2TCyFq7fRndrwhvtknbQtBxPdw/O1k8KF4bosp1CPKazCh12LxzGabikz+d7AkA0iKbo5UmmYNelEUeKQVuYu17l9/LuuoxRhlBUqVsDzu5NfSXvyobWHopuyGTVk33QIx4ITvVFmLoEhySGNrXZAkBktQR+kMStI0SlcMKYFKmQXu78W97p8soVvhP1AndvPiI9keO3UxO7cUjcPRROmcGUU39yGHYlJvu1Krj6+GI1 +qyytz: + host: https://gyytz.market.alicloudapi.com + path: /sms/smsSend + appcode: daab49d0cf344614b174a9bf8303b4e2 + smsSignId: 2e65b1bb3d054466b82f0c9d125465e2 + templateId: 908e94ccf08b4476ba6c876d13f084ad +gps: + host: 10.145.213.161 +vedio: + host: 10.145.213.162 +# 督办调用接口 +send-urge-warn: + url: http://10.145.213.161:8092/warn/send_urge_warn +radar-data-task: + enable: false + # 黄山隧道 + hs-yw-come-radar-ip: 192.168.6.40 + hs-yw-come-radar-port: 10000 + hs-yw-go-radar-ip: 192.168.6.43 + hs-yw-go-radar-port: 20000 + hs-dy-come-radar-ip: 192.168.6.47 + hs-dy-come-radar-port: 30000 + hs-dy-go-radar-ip: 192.168.6.45 + hs-dy-go-radar-port: 40000 + # 何里隧道 + hl-yw-radar-ip: 192.168.10.60 + hl-yw-radar-port: 50000 + hl-lx-radar-ip: 192.168.10.63 + hl-lx-radar-port: 60000 \ No newline at end of file diff --git a/ningda-yw-api/src/main/resources/application.yml b/ningda-yw-api/src/main/resources/application.yml new file mode 100644 index 0000000..3d7808a --- /dev/null +++ b/ningda-yw-api/src/main/resources/application.yml @@ -0,0 +1,3 @@ +spring: + profiles: + active: dev diff --git a/ningda-yw-api/src/main/resources/db/migration/V1.sql b/ningda-yw-api/src/main/resources/db/migration/V1.sql new file mode 100644 index 0000000..a167490 --- /dev/null +++ b/ningda-yw-api/src/main/resources/db/migration/V1.sql @@ -0,0 +1,230 @@ +CREATE TABLE `nd_company_product_manage` +( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `company_id` bigint(20) NOT NULL COMMENT '企业id', + `company_name` varchar(500) DEFAULT NULL COMMENT '企业名称', + `region_id` bigint(20) DEFAULT NULL COMMENT '区域id', + `region_name` varchar(255) DEFAULT NULL COMMENT '区域名称', + `product_name` varchar(255) NOT NULL COMMENT '生产线名称', + `car_start_time` datetime DEFAULT NULL COMMENT '发车日期', + `equipment_status` varchar(255) NOT NULL COMMENT '设备状态', + `sum_product_count` int(12) DEFAULT NULL COMMENT '当天累计生产方量', + `real_product_count` int(12) DEFAULT NULL COMMENT '当天实际生产方量', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='公司生产管理'; + +CREATE TABLE `nd_company_quality_manage` +( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `region_id` bigint(20) DEFAULT NULL COMMENT '区域id', + `region_name` varchar(255) DEFAULT NULL COMMENT '区域名称', + `file_time` datetime DEFAULT NULL COMMENT '通报年月', + `file_path` varchar(255) NOT NULL COMMENT '文件地址', + `file_name` varchar(255) DEFAULT NULL COMMENT '文件名称', + `download_count` int(12) DEFAULT NULL COMMENT '下载次数', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='质量通报'; + +CREATE TABLE `nd_company_security_product_duty` +( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `region_id` bigint(20) DEFAULT NULL COMMENT '区域id', + `region_name` varchar(255) DEFAULT NULL COMMENT '区域名称', + `company_id` bigint(20) DEFAULT NULL COMMENT '企业id', + `company_name` varchar(255) DEFAULT NULL COMMENT '企业名称', + `file_path` varchar(255) DEFAULT NULL COMMENT '文件地址', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='安全生产责任体系'; + +CREATE TABLE `nd_company_security_product_regulations` +( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `region_id` bigint(20) DEFAULT NULL COMMENT '区域id', + `regulations_name` varchar(255) DEFAULT NULL COMMENT '制度名称', + `competent_department` varchar(255) DEFAULT NULL COMMENT '主管部门', + `file_path` varchar(255) DEFAULT NULL COMMENT '文件地址', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='安全生产制度体系'; + +CREATE TABLE `nd_company_security_product_execute` +( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `name` varchar(255) DEFAULT NULL COMMENT '通报名称', + `region_id` bigint(20) DEFAULT NULL COMMENT '区域id', + `file_path` varchar(255) DEFAULT NULL COMMENT '文件地址', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='安全生产制度执行'; + +CREATE TABLE `nd_company_credit_inside` +( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `company_id` bigint(20) DEFAULT NULL COMMENT '企业id', + `company_name` varchar(255) DEFAULT NULL COMMENT '企业名称', + `region_id` bigint(20) DEFAULT NULL COMMENT '区域id', + `region_name` varchar(255) DEFAULT NULL COMMENT '区域名称', + `driver_id` bigint(20) DEFAULT NULL COMMENT '驾驶员id', + `driver_name` varchar(255) DEFAULT NULL COMMENT '驾驶员名称', + `type` varchar(255) DEFAULT NULL COMMENT '行政监管类别', + `car_no` varchar(255) DEFAULT NULL COMMENT '车牌号', + `remark` varchar(255) DEFAULT NULL COMMENT '备注', + `check_time` datetime DEFAULT NULL COMMENT '检查日期', + `check_type` bit(1) NOT NULL COMMENT '检查类型(1-联合,0-内部)', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='内部/联合检查'; + +CREATE TABLE `nd_company_credit_deduct` +( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `company_id` bigint(20) NOT NULL COMMENT '企业id', + `company_name` varchar(255) DEFAULT NULL COMMENT '企业名称', + `region_id` bigint(20) DEFAULT NULL COMMENT '区域id', + `region_name` varchar(255) DEFAULT NULL COMMENT '区域名称', + `type` varchar(255) DEFAULT NULL COMMENT '检查指标类型', + `remark` varchar(255) DEFAULT NULL COMMENT '备注', + `check_time` datetime DEFAULT NULL COMMENT '检查日期', + `score` int(12) NOT NULL COMMENT '分值', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='平安办扣分'; + +CREATE TABLE `nd_company_credit_reward` +( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `company_id` bigint(20) NOT NULL COMMENT '企业id', + `company_name` varchar(255) DEFAULT NULL COMMENT '企业名称', + `region_id` bigint(20) DEFAULT NULL COMMENT '区域id', + `region_name` varchar(255) DEFAULT NULL COMMENT '区域名称', + `content` varchar(2000) DEFAULT NULL COMMENT '嘉奖内容', + `remark` varchar(255) DEFAULT NULL COMMENT '备注', + `reward_time` datetime DEFAULT NULL COMMENT '日期', + `reward_type` bit(1) NOT NULL COMMENT '嘉奖类型(1-行业标杆,0-政府)', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='政府/行业嘉奖'; + +CREATE TABLE `nd_company_credit_level` +( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `company_id` bigint(20) NOT NULL COMMENT '企业id', + `company_name` varchar(255) DEFAULT NULL COMMENT '企业名称', + `region_id` bigint(20) DEFAULT NULL COMMENT '区域id', + `region_name` varchar(255) DEFAULT NULL COMMENT '区域名称', + `year` varchar(12) DEFAULT NULL COMMENT '年度', + `level` varchar(12) DEFAULT NULL COMMENT '信用等级', + `score` int(12) NOT NULL COMMENT '综合得分', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='信用等级'; + +CREATE TABLE `nd_company_black_list` +( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `company_id` bigint(20) NOT NULL COMMENT '企业id', + `company_name` varchar(500) DEFAULT NULL COMMENT '企业名称', + `region_id` bigint(20) DEFAULT NULL COMMENT '区域id', + `region_name` varchar(255) DEFAULT NULL COMMENT '区域名称', + `type` varchar(12) DEFAULT NULL COMMENT '失信类型', + `black_time` datetime DEFAULT NULL COMMENT '失信日期', + `site` varchar(500) DEFAULT NULL COMMENT '地点', + `content` text DEFAULT NULL COMMENT '描述', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='企业失信名单'; + +CREATE TABLE `nd_company_certificate` +( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `company_id` bigint(20) NOT NULL COMMENT '企业id', + `certificate_name` varchar(255) NOT NULL COMMENT '证书名称', + `certificate_content` varchar(1000) NOT NULL COMMENT '证书内容', + `deadline_time` datetime NOT NULL COMMENT '有效日期', + `certificate_path` varchar(255) NOT NULL COMMENT '证书路径', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='企业证书'; + +CREATE TABLE `nd_company_basic_credit` +( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `company_id` bigint(20) NOT NULL COMMENT '企业id', + `registered_capital` varchar(255) DEFAULT NULL COMMENT '注册资金', + `business_term` varchar(255) DEFAULT NULL COMMENT '营业期限', + `create_time` datetime DEFAULT NULL COMMENT '成立日期', + `evaluation_organization` varchar(255) DEFAULT NULL COMMENT '评价机构', + `website` varchar(255) DEFAULT NULL COMMENT '企业网址', + `nature_business` text DEFAULT NULL COMMENT '经营范围', + `business_license_path` varchar(255) DEFAULT NULL COMMENT '营业执照地址', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='企业基础信用信息'; + +CREATE TABLE `nd_company_common_credit` +( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `company_id` bigint(20) NOT NULL COMMENT '企业id', + `project_name` varchar(255) DEFAULT NULL COMMENT '项目名称', + `black_list` varchar(255) DEFAULT NULL COMMENT '失信情况(0-失信,1-否)', + `black_list_content` text DEFAULT NULL COMMENT '失信内容', + `dispute_content` text DEFAULT NULL COMMENT '纠纷内容', + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', + `create_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', + `update_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='企业公共信用信息'; + + +CREATE TABLE `nd_training_bonus_record` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '继续教育培训奖励表', + `create_on` datetime NOT NULL, + `update_on` datetime DEFAULT NULL, + `driver_id` bigint(20) DEFAULT NULL COMMENT '驾驶员id', + `user_id` bigint(20) DEFAULT NULL COMMENT '用户id', + `material_type` varchar(64) DEFAULT NULL COMMENT '材料类型', + `training_material_id` bigint(20) DEFAULT NULL COMMENT '培训材料id', + `training_organization_id` bigint(20) DEFAULT NULL COMMENT '培训组织id', + `behavior_type` varchar(64) DEFAULT NULL COMMENT '行为类型', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file diff --git a/ningda-yw-api/src/main/resources/db/migration/meta_region.sql b/ningda-yw-api/src/main/resources/db/migration/meta_region.sql new file mode 100644 index 0000000..9118b48 --- /dev/null +++ b/ningda-yw-api/src/main/resources/db/migration/meta_region.sql @@ -0,0 +1,157 @@ +/* + Navicat Premium Data Transfer + + Source Server : 宁达科技测试数据库 + Source Server Type : MySQL + Source Server Version : 50736 + Source Host : 47.98.125.47:3306 + Source Schema : nd_cement_truck_dev + + Target Server Type : MySQL + Target Server Version : 50736 + File Encoding : 65001 + + Date: 08/10/2022 13:41:13 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for meta_region +-- ---------------------------- +DROP TABLE IF EXISTS `meta_region`; +CREATE TABLE `meta_region` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `create_on` datetime DEFAULT NULL, + `update_on` datetime DEFAULT NULL, + `region_code` varchar(64) DEFAULT NULL, + `name` varchar(64) DEFAULT NULL, + `level` int(8) DEFAULT NULL, + `parent_code` varchar(64) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=117 DEFAULT CHARSET=utf8mb4; + +-- ---------------------------- +-- Records of meta_region +-- ---------------------------- +BEGIN; +INSERT INTO `meta_region` VALUES (1, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330000', '省本级', 2, '330000'); +INSERT INTO `meta_region` VALUES (2, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330100', '杭州市', 2, '330000'); +INSERT INTO `meta_region` VALUES (3, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330100', '市本级', 3, '330100'); +INSERT INTO `meta_region` VALUES (4, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330102', '上城区', 3, '330100'); +INSERT INTO `meta_region` VALUES (5, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330103', '下城区', 3, '330100'); +INSERT INTO `meta_region` VALUES (6, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330104', '江干区', 3, '330100'); +INSERT INTO `meta_region` VALUES (7, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330105', '拱墅区', 3, '330100'); +INSERT INTO `meta_region` VALUES (8, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330106', '西湖区', 3, '330100'); +INSERT INTO `meta_region` VALUES (9, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330108', '滨江区', 3, '330100'); +INSERT INTO `meta_region` VALUES (10, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330109', '萧山区', 3, '330100'); +INSERT INTO `meta_region` VALUES (11, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330110', '余杭区', 3, '330100'); +INSERT INTO `meta_region` VALUES (12, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330111', '富阳区', 3, '330100'); +INSERT INTO `meta_region` VALUES (13, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330112', '临安区', 3, '330100'); +INSERT INTO `meta_region` VALUES (14, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330122', '桐庐县', 3, '330100'); +INSERT INTO `meta_region` VALUES (15, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330127', '淳安县', 3, '330100'); +INSERT INTO `meta_region` VALUES (16, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330182', '建德市', 3, '330100'); +INSERT INTO `meta_region` VALUES (17, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330113', '临平区', 3, '330100'); +INSERT INTO `meta_region` VALUES (18, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330114', '钱塘区', 3, '330100'); +INSERT INTO `meta_region` VALUES (19, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330200', '宁波市', 2, '330000'); +INSERT INTO `meta_region` VALUES (20, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330200', '市本级', 3, '330200'); +INSERT INTO `meta_region` VALUES (21, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330203', '海曙区', 3, '330200'); +INSERT INTO `meta_region` VALUES (22, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330205', '江北区', 3, '330200'); +INSERT INTO `meta_region` VALUES (23, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330206', '北仑区', 3, '330200'); +INSERT INTO `meta_region` VALUES (24, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330211', '镇海区', 3, '330200'); +INSERT INTO `meta_region` VALUES (25, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330212', '鄞州区', 3, '330200'); +INSERT INTO `meta_region` VALUES (26, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330213', '奉化区', 3, '330200'); +INSERT INTO `meta_region` VALUES (27, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330225', '象山县', 3, '330200'); +INSERT INTO `meta_region` VALUES (28, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330226', '宁海县', 3, '330200'); +INSERT INTO `meta_region` VALUES (29, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330281', '余姚市', 3, '330200'); +INSERT INTO `meta_region` VALUES (30, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330282', '慈溪市', 3, '330200'); +INSERT INTO `meta_region` VALUES (31, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330300', '温州市', 2, '330000'); +INSERT INTO `meta_region` VALUES (32, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330300', '市本级', 3, '330300'); +INSERT INTO `meta_region` VALUES (33, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330302', '鹿城区', 3, '330300'); +INSERT INTO `meta_region` VALUES (34, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330303', '龙湾区', 3, '330300'); +INSERT INTO `meta_region` VALUES (35, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330304', '瓯海区', 3, '330300'); +INSERT INTO `meta_region` VALUES (36, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330305', '洞头区', 3, '330300'); +INSERT INTO `meta_region` VALUES (37, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330324', '永嘉县', 3, '330300'); +INSERT INTO `meta_region` VALUES (38, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330326', '平阳县', 3, '330300'); +INSERT INTO `meta_region` VALUES (39, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330327', '苍南县', 3, '330300'); +INSERT INTO `meta_region` VALUES (40, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330328', '文成县', 3, '330300'); +INSERT INTO `meta_region` VALUES (41, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330329', '泰顺县', 3, '330300'); +INSERT INTO `meta_region` VALUES (42, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330381', '瑞安市', 3, '330300'); +INSERT INTO `meta_region` VALUES (43, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330382', '乐清市', 3, '330300'); +INSERT INTO `meta_region` VALUES (44, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330383', '龙港市', 3, '330300'); +INSERT INTO `meta_region` VALUES (45, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330400', '嘉兴市', 2, '330000'); +INSERT INTO `meta_region` VALUES (46, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330400', '市本级', 3, '330400'); +INSERT INTO `meta_region` VALUES (47, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330402', '南湖区', 3, '330400'); +INSERT INTO `meta_region` VALUES (48, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330411', '秀洲区', 3, '330400'); +INSERT INTO `meta_region` VALUES (49, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330421', '嘉善县', 3, '330400'); +INSERT INTO `meta_region` VALUES (50, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330424', '海盐县', 3, '330400'); +INSERT INTO `meta_region` VALUES (51, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330481', '海宁市', 3, '330400'); +INSERT INTO `meta_region` VALUES (52, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330482', '平湖市', 3, '330400'); +INSERT INTO `meta_region` VALUES (53, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330483', '桐乡市', 3, '330400'); +INSERT INTO `meta_region` VALUES (54, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330500', '湖州市', 2, '330000'); +INSERT INTO `meta_region` VALUES (55, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330500', '市本级', 3, '330500'); +INSERT INTO `meta_region` VALUES (56, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330502', '吴兴区', 3, '330500'); +INSERT INTO `meta_region` VALUES (57, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330503', '南浔区', 3, '330500'); +INSERT INTO `meta_region` VALUES (58, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330521', '德清县', 3, '330500'); +INSERT INTO `meta_region` VALUES (59, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330522', '长兴县', 3, '330500'); +INSERT INTO `meta_region` VALUES (60, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330523', '安吉县', 3, '330500'); +INSERT INTO `meta_region` VALUES (61, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330600', '绍兴市', 2, '330000'); +INSERT INTO `meta_region` VALUES (62, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330600', '市本级', 3, '330600'); +INSERT INTO `meta_region` VALUES (63, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330602', '越城区', 3, '330600'); +INSERT INTO `meta_region` VALUES (64, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330603', '柯桥区', 3, '330600'); +INSERT INTO `meta_region` VALUES (65, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330604', '上虞区', 3, '330600'); +INSERT INTO `meta_region` VALUES (66, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330624', '新昌县', 3, '330600'); +INSERT INTO `meta_region` VALUES (67, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330681', '诸暨市', 3, '330600'); +INSERT INTO `meta_region` VALUES (68, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330683', '嵊州市', 3, '330600'); +INSERT INTO `meta_region` VALUES (69, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330700', '金华市', 2, '330000'); +INSERT INTO `meta_region` VALUES (70, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330700', '市本级', 3, '330700'); +INSERT INTO `meta_region` VALUES (71, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330702', '婺城区', 3, '330700'); +INSERT INTO `meta_region` VALUES (72, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330703', '金东区', 3, '330700'); +INSERT INTO `meta_region` VALUES (73, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330723', '武义县', 3, '330700'); +INSERT INTO `meta_region` VALUES (74, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330726', '浦江县', 3, '330700'); +INSERT INTO `meta_region` VALUES (75, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330727', '磐安县', 3, '330700'); +INSERT INTO `meta_region` VALUES (76, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330781', '兰溪市', 3, '330700'); +INSERT INTO `meta_region` VALUES (77, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330782', '义乌市', 3, '330700'); +INSERT INTO `meta_region` VALUES (78, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330783', '东阳市', 3, '330700'); +INSERT INTO `meta_region` VALUES (79, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330784', '永康市', 3, '330700'); +INSERT INTO `meta_region` VALUES (80, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330800', '衢州市', 2, '330000'); +INSERT INTO `meta_region` VALUES (81, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330800', '市本级', 3, '330800'); +INSERT INTO `meta_region` VALUES (82, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330802', '柯城区', 3, '330800'); +INSERT INTO `meta_region` VALUES (83, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330803', '衢江区', 3, '330800'); +INSERT INTO `meta_region` VALUES (84, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330822', '常山县', 3, '330800'); +INSERT INTO `meta_region` VALUES (85, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330824', '开化县', 3, '330800'); +INSERT INTO `meta_region` VALUES (86, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330825', '龙游县', 3, '330800'); +INSERT INTO `meta_region` VALUES (87, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330881', '江山市', 3, '330800'); +INSERT INTO `meta_region` VALUES (88, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330900', '舟山市', 2, '330000'); +INSERT INTO `meta_region` VALUES (89, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330900', '市本级', 3, '330900'); +INSERT INTO `meta_region` VALUES (90, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330902', '定海区', 3, '330900'); +INSERT INTO `meta_region` VALUES (91, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330903', '普陀区', 3, '330900'); +INSERT INTO `meta_region` VALUES (92, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330921', '岱山县', 3, '330900'); +INSERT INTO `meta_region` VALUES (93, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330922', '嵊泗县', 3, '330900'); +INSERT INTO `meta_region` VALUES (94, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331000', '台州市', 2, '330000'); +INSERT INTO `meta_region` VALUES (95, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331000', '市本级', 3, '331000'); +INSERT INTO `meta_region` VALUES (96, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331002', '椒江区', 3, '331000'); +INSERT INTO `meta_region` VALUES (97, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331003', '黄岩区', 3, '331000'); +INSERT INTO `meta_region` VALUES (98, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331004', '路桥区', 3, '331000'); +INSERT INTO `meta_region` VALUES (99, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331022', '三门县', 3, '331000'); +INSERT INTO `meta_region` VALUES (100, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331023', '天台县', 3, '331000'); +INSERT INTO `meta_region` VALUES (101, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331024', '仙居县', 3, '331000'); +INSERT INTO `meta_region` VALUES (102, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331081', '温岭市', 3, '331000'); +INSERT INTO `meta_region` VALUES (103, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331082', '临海市', 3, '331000'); +INSERT INTO `meta_region` VALUES (104, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331083', '玉环市', 3, '331000'); +INSERT INTO `meta_region` VALUES (105, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331100', '丽水市', 2, '330000'); +INSERT INTO `meta_region` VALUES (106, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331100', '市本级', 3, '331100'); +INSERT INTO `meta_region` VALUES (107, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331102', '莲都区', 3, '331100'); +INSERT INTO `meta_region` VALUES (108, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331121', '青田县', 3, '331100'); +INSERT INTO `meta_region` VALUES (109, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331122', '缙云县', 3, '331100'); +INSERT INTO `meta_region` VALUES (110, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331123', '遂昌县', 3, '331100'); +INSERT INTO `meta_region` VALUES (111, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331124', '松阳县', 3, '331100'); +INSERT INTO `meta_region` VALUES (112, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331125', '云和县', 3, '331100'); +INSERT INTO `meta_region` VALUES (113, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331126', '庆元县', 3, '331100'); +INSERT INTO `meta_region` VALUES (114, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331127', '景宁畲族自治县', 3, '331100'); +INSERT INTO `meta_region` VALUES (115, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '331181', '龙泉市', 3, '331100'); +INSERT INTO `meta_region` VALUES (116, '2022-10-08 12:02:23', '2022-10-08 12:02:23', '330000', '浙江省', 1, '-1'); +COMMIT; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/ningda-yw-api/src/main/resources/integration/zwdd-dev.yml b/ningda-yw-api/src/main/resources/integration/zwdd-dev.yml new file mode 100644 index 0000000..775749e --- /dev/null +++ b/ningda-yw-api/src/main/resources/integration/zwdd-dev.yml @@ -0,0 +1,15 @@ +# 专有钉钉 +integration: + zwdd: + enabled: true + # 扫码 + app-auth-key: file-manage_dingoa-zte2LbiAfIj + app-auth-secret: H794aFZf271QbfUr50pbBpBTlXSrWIP71q9RTR34 + + #免登/获取信息 + app-key: file-manage-4Mjx9358wuxjyYFjY3 + app-secret: hE41938wqyQ5LOpc1QDRA9e7gb5YugoClWD3nY4O + + #专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729 + tenantId: 31141 + domain: openplatform.dg-work.cn \ No newline at end of file diff --git a/ningda-yw-api/src/main/resources/integration/zwdd-prod.yml b/ningda-yw-api/src/main/resources/integration/zwdd-prod.yml new file mode 100644 index 0000000..775749e --- /dev/null +++ b/ningda-yw-api/src/main/resources/integration/zwdd-prod.yml @@ -0,0 +1,15 @@ +# 专有钉钉 +integration: + zwdd: + enabled: true + # 扫码 + app-auth-key: file-manage_dingoa-zte2LbiAfIj + app-auth-secret: H794aFZf271QbfUr50pbBpBTlXSrWIP71q9RTR34 + + #免登/获取信息 + app-key: file-manage-4Mjx9358wuxjyYFjY3 + app-secret: hE41938wqyQ5LOpc1QDRA9e7gb5YugoClWD3nY4O + + #专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729 + tenantId: 31141 + domain: openplatform.dg-work.cn \ No newline at end of file diff --git a/ningda-yw-api/src/main/resources/irs/车牌号.xlsx b/ningda-yw-api/src/main/resources/irs/车牌号.xlsx new file mode 100644 index 0000000..1443da4 Binary files /dev/null and b/ningda-yw-api/src/main/resources/irs/车牌号.xlsx differ diff --git a/ningda-yw-api/src/main/resources/logback-spring.xml b/ningda-yw-api/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..75f5472 --- /dev/null +++ b/ningda-yw-api/src/main/resources/logback-spring.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + ${logPath}/info.log + + ${logPath}/info-%d{yyyyMMdd}-%i.log + + ${infoFileSize} + + ${infoMaxSize} + ${infoTotalSize} + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n + + + UTF-8 + + + + + + ERROR + + ${logPath}/error.log + + ${logPath}/error-%d{yyyyMMdd}-%i.log + + ${errorFileSize} + + ${errorMaxSize} + ${errorTotalSize} + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n + + + UTF-8 + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n + + UTF-8 + + + DEBUG + + + + + + + + + diff --git a/ningda-yw-api/src/main/resources/security/auth-dev.yml b/ningda-yw-api/src/main/resources/security/auth-dev.yml new file mode 100644 index 0000000..bf7b6f2 --- /dev/null +++ b/ningda-yw-api/src/main/resources/security/auth-dev.yml @@ -0,0 +1,50 @@ +security: + auth: + auth-require-url: /api/v1/user/auth/auth-require + invalid-session-url: /api/v1/user/auth/invalid-session + password-login-url: /api/v1/user/auth/login/password + password-verificationCode-login-url: /api/v1/user/auth/login/password/verificationCode + logout-url: /api/v1/user/auth/logout + ignore-auth-urls: + - /v2/api-docs + - /swagger-ui.html + - /webjars/** + - /swagger-resources/** + - /webjars/ + - /api/v1/user/auth/register + - /api/v1/user/auth/auth-require + - /api/v1/user/auth/invalid-session + - /api/v1/user/auth/login/password + - /api/v1/user/auth/forget-password + - /api/v1/user/auth/get-public-key + - /doc.html + - /ok.html + - /open/api/** + - /radar/** + - /gps/** + ignore-csrf-urls: + - /api/v1/user/auth/** + - /v2/api-docs + - /swagger-ui.html + - /webjars/** + - /swagger-resources/** + - /webjars/ + - /doc.html + - /ok.html + - /api/v1/** + - /optLog/** + - /file/** + - /api/user/** + - /api/role/** + - /api/menu/** + - /api/company/** + - /api/operator/** + - /api/archives/** + - /api/safe/** + - /api/qrcode/** + - /api/industry/** + - /api/car-rpt/** + - /open/api/** + - /radar/** + - /gps/** + - /road-monitor/** \ No newline at end of file diff --git a/ningda-yw-api/src/main/resources/security/auth-prod.yml b/ningda-yw-api/src/main/resources/security/auth-prod.yml new file mode 100644 index 0000000..b234df2 --- /dev/null +++ b/ningda-yw-api/src/main/resources/security/auth-prod.yml @@ -0,0 +1,48 @@ +security: + auth: + auth-require-url: /api/v1/user/auth/auth-require + invalid-session-url: /api/v1/user/auth/invalid-session + password-login-url: /api/v1/user/auth/login/password + logout-url: /api/v1/user/auth/logout + ignore-auth-urls: + - /v2/api-docs + - /swagger-ui.html + - /webjars/** + - /swagger-resources/** + - /webjars/ + - /api/v1/user/auth/register + - /api/v1/user/auth/auth-require + - /api/v1/user/auth/invalid-session + - /api/v1/user/auth/login/password + - /api/v1/user/auth/forget-password + - /api/v1/user/auth/get-public-key + - /doc.html + - /ok.html + - /open/api/** + - /radar/** + - /gps/** + ignore-csrf-urls: + - /api/v1/user/auth/** + - /v2/api-docs + - /swagger-ui.html + - /webjars/** + - /swagger-resources/** + - /webjars/ + - /doc.html + - /ok.html + - /api/v1/** + - /optLog/** + - /file/** + - /api/user/** + - /api/role/** + - /api/menu/** + - /api/company/** + - /api/operator/** + - /api/archives/** + - /api/safe/** + - /api/qrcode/** + - /api/industry/** + - /api/car-rpt/** + - /open/api/** + - /radar/** + - /gps/** \ No newline at end of file diff --git a/ningda-yw-api/src/main/resources/template/散装水泥、预拌混凝土、干混砂浆物流装备统计年报表(空).xls b/ningda-yw-api/src/main/resources/template/散装水泥、预拌混凝土、干混砂浆物流装备统计年报表(空).xls new file mode 100644 index 0000000..aa04800 Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/散装水泥、预拌混凝土、干混砂浆物流装备统计年报表(空).xls differ diff --git a/ningda-yw-api/src/main/resources/template/散装水泥、预拌混凝土、干混砂浆物流装备统计年报表.xls b/ningda-yw-api/src/main/resources/template/散装水泥、预拌混凝土、干混砂浆物流装备统计年报表.xls new file mode 100644 index 0000000..fe8de74 Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/散装水泥、预拌混凝土、干混砂浆物流装备统计年报表.xls differ diff --git a/ningda-yw-api/src/main/resources/template/散装水泥供应量统计月报表(空).xls b/ningda-yw-api/src/main/resources/template/散装水泥供应量统计月报表(空).xls new file mode 100644 index 0000000..66b4a8c Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/散装水泥供应量统计月报表(空).xls differ diff --git a/ningda-yw-api/src/main/resources/template/散装水泥供应量统计月报表.xls b/ningda-yw-api/src/main/resources/template/散装水泥供应量统计月报表.xls new file mode 100644 index 0000000..8b9aba8 Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/散装水泥供应量统计月报表.xls differ diff --git a/ningda-yw-api/src/main/resources/template/散装水泥物流设施统计年报表(空).xls b/ningda-yw-api/src/main/resources/template/散装水泥物流设施统计年报表(空).xls new file mode 100644 index 0000000..a1ab228 Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/散装水泥物流设施统计年报表(空).xls differ diff --git a/ningda-yw-api/src/main/resources/template/散装水泥物流设施统计年报表.xls b/ningda-yw-api/src/main/resources/template/散装水泥物流设施统计年报表.xls new file mode 100644 index 0000000..0dfeed3 Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/散装水泥物流设施统计年报表.xls differ diff --git a/ningda-yw-api/src/main/resources/template/浙江省散装水泥中转库进出量快报(空).xls b/ningda-yw-api/src/main/resources/template/浙江省散装水泥中转库进出量快报(空).xls new file mode 100644 index 0000000..18dfae6 Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/浙江省散装水泥中转库进出量快报(空).xls differ diff --git a/ningda-yw-api/src/main/resources/template/浙江省散装水泥中转库进出量快报.xls b/ningda-yw-api/src/main/resources/template/浙江省散装水泥中转库进出量快报.xls new file mode 100644 index 0000000..e38b167 Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/浙江省散装水泥中转库进出量快报.xls differ diff --git a/ningda-yw-api/src/main/resources/template/温州、台州、舟山市散装水泥使用量快报(空).xls b/ningda-yw-api/src/main/resources/template/温州、台州、舟山市散装水泥使用量快报(空).xls new file mode 100644 index 0000000..41c173d Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/温州、台州、舟山市散装水泥使用量快报(空).xls differ diff --git a/ningda-yw-api/src/main/resources/template/温州、台州、舟山市散装水泥使用量快报.xls b/ningda-yw-api/src/main/resources/template/温州、台州、舟山市散装水泥使用量快报.xls new file mode 100644 index 0000000..95a9714 Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/温州、台州、舟山市散装水泥使用量快报.xls differ diff --git a/ningda-yw-api/src/main/resources/template/车辆事故数据(空).xlsx b/ningda-yw-api/src/main/resources/template/车辆事故数据(空).xlsx new file mode 100644 index 0000000..f67a030 Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/车辆事故数据(空).xlsx differ diff --git a/ningda-yw-api/src/main/resources/template/车辆事故数据.xlsx b/ningda-yw-api/src/main/resources/template/车辆事故数据.xlsx new file mode 100644 index 0000000..5b38bca Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/车辆事故数据.xlsx differ diff --git a/ningda-yw-api/src/main/resources/template/运营商考核详情.docx b/ningda-yw-api/src/main/resources/template/运营商考核详情.docx new file mode 100644 index 0000000..824422d Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/运营商考核详情.docx differ diff --git a/ningda-yw-api/src/main/resources/template/非禁现区域散装水泥销售使用情况统计年报表(空).xls b/ningda-yw-api/src/main/resources/template/非禁现区域散装水泥销售使用情况统计年报表(空).xls new file mode 100644 index 0000000..d462edf Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/非禁现区域散装水泥销售使用情况统计年报表(空).xls differ diff --git a/ningda-yw-api/src/main/resources/template/非禁现区域散装水泥销售使用情况统计年报表.xls b/ningda-yw-api/src/main/resources/template/非禁现区域散装水泥销售使用情况统计年报表.xls new file mode 100644 index 0000000..8ba77cb Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/非禁现区域散装水泥销售使用情况统计年报表.xls differ diff --git a/ningda-yw-api/src/main/resources/template/预拌混凝土生产及废弃物综合利用情况统计月报表(空).xls b/ningda-yw-api/src/main/resources/template/预拌混凝土生产及废弃物综合利用情况统计月报表(空).xls new file mode 100644 index 0000000..95657a8 Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/预拌混凝土生产及废弃物综合利用情况统计月报表(空).xls differ diff --git a/ningda-yw-api/src/main/resources/template/预拌混凝土生产及废弃物综合利用情况统计月报表.xls b/ningda-yw-api/src/main/resources/template/预拌混凝土生产及废弃物综合利用情况统计月报表.xls new file mode 100644 index 0000000..9d4323c Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/预拌混凝土生产及废弃物综合利用情况统计月报表.xls differ diff --git a/ningda-yw-api/src/main/resources/template/预拌砂浆生产及废弃物综合利用情况统计月报表(空).xls b/ningda-yw-api/src/main/resources/template/预拌砂浆生产及废弃物综合利用情况统计月报表(空).xls new file mode 100644 index 0000000..fd7bc51 Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/预拌砂浆生产及废弃物综合利用情况统计月报表(空).xls differ diff --git a/ningda-yw-api/src/main/resources/template/预拌砂浆生产及废弃物综合利用情况统计月报表.xls b/ningda-yw-api/src/main/resources/template/预拌砂浆生产及废弃物综合利用情况统计月报表.xls new file mode 100644 index 0000000..bbb70be Binary files /dev/null and b/ningda-yw-api/src/main/resources/template/预拌砂浆生产及废弃物综合利用情况统计月报表.xls differ diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/AppTests.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/AppTests.java new file mode 100644 index 0000000..b98c838 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/AppTests.java @@ -0,0 +1,19 @@ +package com.ningdatech.carapi; + +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +/** + *

+ * AppRunTests + *

+ * + * @author WendyYang + * @since 19:27 2022/5/10 + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = App.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class AppTests { + +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/alarm/AlarmTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/alarm/AlarmTest.java new file mode 100644 index 0000000..af8665a --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/alarm/AlarmTest.java @@ -0,0 +1,164 @@ +package com.ningdatech.carapi.alarm; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +import javax.annotation.Resource; + +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.StringRedisTemplate; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.car.monitor.entity.DataAccessAlarmWarn; +import com.ningdatech.carapi.car.monitor.entity.DataAccessAlarmWarnFile; +import com.ningdatech.carapi.car.monitor.entity.VehicleSecurityMonitor; +import com.ningdatech.carapi.car.monitor.service.IDataAccessAlarmWarnFileService; +import com.ningdatech.carapi.car.monitor.service.IDataAccessAlarmWarnService; +import com.ningdatech.carapi.car.monitor.service.IVehicleSecurityMonitorService; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.common.constant.BgTypeEnum; +import com.ningdatech.carapi.common.constant.DeletedEnum; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.common.util.CodeUtil; +import com.ningdatech.carapi.driver.constant.DriverAbnormalBehaviorAppendixTypeEnum; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; +import com.ningdatech.carapi.sys.helper.VehiclesCacheHelper; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; +import lombok.extern.slf4j.Slf4j; + +/** + * @author PoffyZhang + * @Classname AlarmTest + * @Description + * @Date 2022/12/15 18:11 + */ +@Slf4j +public class AlarmTest extends AppTests { + + @Resource + private IDataAccessAlarmWarnService dataAccessAlarmWarnService; + + @Resource + private IDataAccessAlarmWarnFileService dataAccessAlarmWarnFileService; + + @Resource + private VehiclesCacheHelper vehiclesCacheHelper; + @Autowired + private RedisTemplate redisTemplate; + @Autowired + private StringRedisTemplate stringRedisTemplate; + @Resource + private IVehicleSecurityMonitorService vehicleSecurityMonitorService; + + @Test + public void test1(){ + Map online_index = stringRedisTemplate.opsForHash().entries("online_index"); + System.out.println(online_index); + } + + @Test + public void test(){ + log.info("========== 更新车辆安全监控数据 ==========任务开始"); + StopWatch stopWatch = StopWatch.create(StringUtils.EMPTY); + stopWatch.start(); + + List alarms = dataAccessAlarmWarnService.list(Wrappers.lambdaQuery(DataAccessAlarmWarn.class) + .eq(DataAccessAlarmWarn::getId,16078) + .isNotNull(DataAccessAlarmWarn::getBgType) + .orderBy(Boolean.TRUE,Boolean.TRUE,DataAccessAlarmWarn::getId)); + + if(CollUtil.isEmpty(alarms)){ + log.info("this time vehicle alarm size is empty"); + return; + } + + log.info("this time vehicle alarm size :{}",alarms.size()); + + //获取异常行为列表的所有报警唯一序号 + List alarmMsgSnList = alarms.stream().map(DataAccessAlarmWarn::getAlarmMsgSn).collect(Collectors.toList()); + List files = dataAccessAlarmWarnFileService.list(Wrappers.lambdaQuery(DataAccessAlarmWarnFile.class) + .in(DataAccessAlarmWarnFile::getAlarmMsgSn,alarmMsgSnList)); + for (DataAccessAlarmWarn alarm : alarms) { + NdVehicleBaseInfo car = vehiclesCacheHelper.getByCarPlate(alarm.getVehicleNo()); + if(Objects.isNull(car)){ + log.info("此条异常行为数据 系统里没有这辆车 {}", JSON.toJSONString(alarm)); + continue; + } + + VehicleSecurityMonitor monitor = new VehicleSecurityMonitor(); + List matchFiles = files.stream() + .filter(d -> Objects.nonNull(d.getAlarmMsgSn()) + && d.getAlarmMsgSn().equals(alarm.getAlarmMsgSn()) + && Objects.nonNull(d.getGnssCenterId()) + && d.getGnssCenterId().equals(alarm.getGnssCenterId())) + .collect(Collectors.toList()); + for (DataAccessAlarmWarnFile file : matchFiles) { + if (DriverAbnormalBehaviorAppendixTypeEnum.PICTURE.getCode().equals(file.getFileType())){ + monitor.setPictureUrl(StringUtils.isNotBlank(file.getFilePath()) ? file.getFilePath() : file.getSrcPath()); + } else if (DriverAbnormalBehaviorAppendixTypeEnum.VIDEO.getCode().equals(file.getFileType())){ + monitor.setVideoUrl(StringUtils.isNotBlank(file.getFilePath()) ? file.getFilePath() : file.getSrcPath()); + } + } + + String content = alarm.getContent(); + if(Objects.isNull(content) || !CodeUtil.getJSONType(content)){ + log.info("此条异常行为数据content内容有误 {}",JSON.toJSONString(alarm)); + continue; + } + + JSONObject jsonContent = JSON.parseObject(content); + JSONObject gpsJson = jsonContent.getJSONObject(TaskConstant.DataField.GPS); + + if(Objects.isNull(gpsJson)){ + log.info("此条异常行为数据 GPS 内容有误 {}",JSON.toJSONString(alarm)); + continue; + } + + monitor.setLongitude(Optional.of(gpsJson.getBigDecimal(TaskConstant.DataField.LONGITUDE)) + .map(c -> c.divide(TaskConstant.Math.LONGITUDE_UNITS, BigDecimal.ROUND_HALF_EVEN,BigDecimal.ROUND_HALF_UP)).get()); + monitor.setLatitude(Optional.of(gpsJson.getBigDecimal(TaskConstant.DataField.LATITUDE)) + .map(c -> c.divide(TaskConstant.Math.LONGITUDE_UNITS,BigDecimal.ROUND_HALF_EVEN,BigDecimal.ROUND_HALF_UP)).get()); + + // 装配告警信息 + monitor.setCompanyId(car.getCompanyId()); + monitor.setRegionId(car.getRegionId()); + CodeUtil.searchCompanyNameAndRegionName(monitor); + monitor.setAlarmAddress(alarm.getAddress()); + monitor.setAlarmId(alarm.getAlarmMsgSn()); + monitor.setAlarmType(alarm.getBgType()); + monitor.setAlarmTypeName(BgTypeEnum.getDescByCode(alarm.getBgType())); + monitor.setCarPlate(alarm.getVehicleNo()); + monitor.setVehicleType(car.getVehicleType()); + monitor.setVehicleTypeName(VehicleTypeEnum.getDescByCode(car.getVehicleType())); + monitor.setAlarmTime(alarm.getStartTime()); + monitor.setAlarmLevel(alarm.getGrade()); + monitor.setOperatorId(alarm.getGnssCenterId()); + + VehicleSecurityMonitor one = vehicleSecurityMonitorService.getOne(Wrappers.lambdaQuery(VehicleSecurityMonitor.class) + .eq(VehicleSecurityMonitor::getDeleted, DeletedEnum.NO_DELETED) + .eq(VehicleSecurityMonitor::getAlarmId, alarm.getAlarmMsgSn()) + .eq(VehicleSecurityMonitor::getOperatorId,alarm.getGnssCenterId())); + if(Objects.nonNull(one)){ + monitor.setId(one.getId()); + } + + vehicleSecurityMonitorService.saveOrUpdate(monitor); + } + stopWatch.stop(); + log.info(stopWatch.getTotalTimeSeconds() + ":::"); + } + + +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/car/HmacAuthUtil.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/car/HmacAuthUtil.java new file mode 100644 index 0000000..7d1a837 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/car/HmacAuthUtil.java @@ -0,0 +1,89 @@ +package com.ningdatech.carapi.car; + + +import org.apache.commons.lang3.tuple.Pair; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import javax.xml.bind.DatatypeConverter; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author CMM + * @since 2023/06/27 13:01 + */ + +public class HmacAuthUtil { + /** + * 构造http请求 header + * + * @param url 请求url,全路径格式,比如:https://bcdsg.zj.gov.cn/api/p/v1/user.get + * @param requestMethod 请求方法,大写格式,如:GET, POST + * @param accessKey 应用的 AK + * @param secretKey 应用的 SK + * @return + */ + public static Map generateHeader(String url, String requestMethod, String accessKey, String secretKey) { + Map header = new HashMap<>(); + try { + DateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); + dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); + String date = dateFormat.format(new Date()); + date = "Tue, 27 Jun 2023 05:02:23 GMT"; + URI uri = URI.create(url); + String canonicalQueryString = getCanonicalQueryString(uri.getQuery()); + String message = requestMethod.toUpperCase() + "\n" + uri.getPath() + "\n" + canonicalQueryString + "\n" + accessKey + "\n" + date + "\n"; + System.out.println(message); + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(new SecretKeySpec(secretKey.getBytes(), "HmacSHA256")); + byte[] hash = mac.doFinal(message.getBytes()); + // to lowercase hexits + String hex = DatatypeConverter.printHexBinary(hash); + // to base64 + String sign = DatatypeConverter.printBase64Binary(hex.getBytes()); + header.put("X-BG-HMAC-SIGNATURE", sign); + header.put("X-BG-HMAC-ALGORITHM", "hmac-sha256"); + header.put("X-BG-HMAC-ACCESS-KEY", accessKey); + header.put("X-BG-DATE-TIME", date); + } catch (Exception e) { + throw new RuntimeException("generate jc brain header error", e); + } + return header; + } + + private static String getCanonicalQueryString(String query) { + if (query == null || query.trim().length() == 0) { + return ""; + } + List> queryParamList = new ArrayList<>(); + String[] params = query.split("&"); + for (String param : params) { + String[] keyValue = param.split("="); + Pair pair = Pair.of(keyValue[0], keyValue.length > 1 ? keyValue[1] : ""); + queryParamList.add(pair); + } + List> sortedParamList = queryParamList.stream().sorted(Comparator.comparing(param -> param.getKey() + "=" + Optional.ofNullable(param.getValue()).orElse(""))).collect(Collectors.toList()); + List> encodeParamList = new ArrayList<>(); + sortedParamList.forEach(param -> { + try { + String key = URLEncoder.encode(param.getKey(), "utf-8"); + String value = URLEncoder.encode(Optional.ofNullable(param.getValue()).orElse(""), "utf-8"); + encodeParamList.add(Pair.of(key, value)); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException("encoding error"); + } + }); + StringBuilder queryParamString = new StringBuilder(64); + for (Pair encodeParam : encodeParamList) { + queryParamString.append(encodeParam.getKey()).append("=").append(Optional.ofNullable(encodeParam.getValue()).orElse("")); + queryParamString.append("&"); + } + return queryParamString.substring(0, queryParamString.length() - 1); + } +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/car/RptTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/car/RptTest.java new file mode 100644 index 0000000..5864863 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/car/RptTest.java @@ -0,0 +1,109 @@ +package com.ningdatech.carapi.car; + +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import com.alibaba.fastjson.JSON; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; + +import lombok.RequiredArgsConstructor; + +/** + * 车辆报表 + * + * @author CMM + * @since 2023/06/25 16:41 + */ +@RequiredArgsConstructor +public class RptTest extends AppTests { + + private final IVehicleBaseInfoService vehicleBaseInfoService; + @Test + public void test() { + + // 假设有以下车辆的上线时间和下线时间 + Map vehicles = new HashMap<>(); + vehicles.put("车辆1", new LocalDate[]{LocalDate.of(2021, 1, 1), LocalDate.of(2021, 1, 10)}); // 上线时间为1月1日,下线时间为1月10日 + vehicles.put("车辆2", new LocalDate[]{LocalDate.of(2021, 1, 5), LocalDate.of(2021, 1, 15)}); // 上线时间为1月5日,下线时间为1月15日 + vehicles.put("车辆3", new LocalDate[]{LocalDate.of(2021, 1, 10), LocalDate.of(2021, 1, 20)}); // 上线时间为1月10日,下线时间为1月20日 + + // 统计每辆车当月某个时间段不上线的天数 + LocalDate startDate = LocalDate.of(2021, 1, 1); // 统计开始日期 + LocalDate endDate = LocalDate.of(2021, 1, 31); // 统计结束日期 + Map offlineDays = new HashMap<>(); + for (Map.Entry entry : vehicles.entrySet()) { + LocalDate[] dates = entry.getValue(); + LocalDate onlineDate = dates[0]; + LocalDate offlineDate = dates[1]; + long days = ChronoUnit.DAYS.between(startDate, endDate) + 1; // 当月总天数 + if (onlineDate.isAfter(endDate) || offlineDate.isBefore(startDate)) { // 车辆在统计时间段外上下线 + offlineDays.put(entry.getKey(), days); + } else { + if (onlineDate.isBefore(startDate)) { + onlineDate = startDate; + } + if (offlineDate.isAfter(endDate)) { + offlineDate = endDate; + } + long offline = ChronoUnit.DAYS.between(onlineDate, offlineDate) + 1; // 不上线天数 + offlineDays.put(entry.getKey(), days - offline); + } + } + + // 按不上线天数进行排序 + List> list = new ArrayList<>(offlineDays.entrySet()); + list.sort(Map.Entry.comparingByValue()); + + // 输出结果 + for (Map.Entry entry : list) { + System.out.println(entry.getKey() + ": " + entry.getValue() + "天"); + } + + } + + @Test + public void test2() { + + //DateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); + //dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); + //String date = dateFormat.format(new Date()); + //System.out.println(date); + + + String method = "GET"; + String url = "https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl?appCode=A330000100000202105002530"; + String appScret = "BCDSGS_4ab4235d26a9a357170a39f3a13fd68c"; + String appKey = "BCDSGA_d874c8e46b541eb4e8aac6510fd3351b"; + + Map header = HmacAuthUtil.generateHeader(url, method, appKey, appScret); + //请求头 + HttpHeaders headers = new HttpHeaders(); + + for(Map.Entry entry : header.entrySet()){ + headers.add(entry.getKey(), entry.getValue()); + } + + System.out.println(headers); + //封装请求头 + HttpEntity> formEntity = new HttpEntity>(headers); + + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity forEntity = restTemplate.exchange(url, HttpMethod.GET,formEntity, String.class); + + System.out.println(JSON.toJSONString(forEntity)); + + } +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/car/VehicleBaseInfoTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/car/VehicleBaseInfoTest.java new file mode 100644 index 0000000..1ddb9fb --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/car/VehicleBaseInfoTest.java @@ -0,0 +1,744 @@ +package com.ningdatech.carapi.car; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.data.redis.core.StringRedisTemplate; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.archives.enums.AuditStateEnum; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentInfo; +import com.ningdatech.carapi.car.equipment.service.INdVehicleEquipmentInfoService; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.model.dto.VehicleArchivesPageQuery; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.constant.DeletedEnum; +import com.ningdatech.carapi.scheduler.service.IVehicleOnlineStatusDayService; +import com.ningdatech.carapi.scheduler.service.IVehicleOnlineStatusHourService; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.Operator; +import com.ningdatech.carapi.sys.entity.Region; +import com.ningdatech.carapi.sys.entity.dto.RegionDTO; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.sys.service.IRegionService; +import com.ningdatech.carapi.sys.service.OperatorService; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.io.FileUtil; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname InsureOutdangerTest + * @Description + * @Date 2022/12/22 10:47 + * @Created by PoffyZhang + */ +@Slf4j +public class VehicleBaseInfoTest extends AppTests { + + @Autowired + private CompanyService companyService; + @Autowired + private IVehicleBaseInfoService vehicleBaseInfoService; + @Autowired + private OperatorService operatorService; + @Autowired + private IRegionService regionService; + @Autowired + private RegionsCacheHelper regionCacheHelper; + @Autowired + private INdVehicleEquipmentInfoService vehicleEquipmentInfoService; + @Autowired + private IVehicleOnlineStatusHourService vehicleOnlineStatusHourService; + @Autowired + private IVehicleOnlineStatusDayService vehicleOnlineStatusDayService; + @Autowired + private ApplicationContext applicationContext; + @Autowired + private StringRedisTemplate stringRedisTemplate; + @Test + public void test() throws FileNotFoundException { + File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\车辆.xlsx"); + Workbook wb = readExcel(new FileInputStream(f), f.getName()); + Row row = null; + if (wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + HashSet carPlates = new HashSet<>(); + HashSet companySet = new HashSet<>(); + HashSet operatorSet = new HashSet<>(); + HashSet countySet = new HashSet<>(); + + // 根据企业名查询企业信息 + Map companyNameMap = companyService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + companySet.add(v.getName())) + .collect(Collectors.toMap(Company::getName, v -> v)); + + // 根据运营商名称查询运营商信息 + Map operatorMap = operatorService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + operatorSet.add(v.getName())) + .collect(Collectors.toMap(Operator::getName, v -> v)); + + // 根据区县名称获取区域ID + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + + //获取最大列数 + for (int i = 1; i < rownum; i++) { + + NdVehicleBaseInfo vehicleBaseInfo = new NdVehicleBaseInfo(); + + row = sheet.getRow(i); + + // 车牌号 + String carPlate = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 企业名称 + String companyName = Objects.nonNull(row.getCell(1)) ? row.getCell(1).toString() : StringUtils.EMPTY; + Company companyInfo = companyNameMap.get(companyName); + // 区县 + String countyName = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; + Region region = regionMap.get(countyName); + Long regionId = null; + if (Objects.nonNull(region)) { + regionId = region.getId(); + } + String displayName = regionCacheHelper.getDisplayName(regionId); + // 运营商 + String operatorName = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; + Operator operator = operatorMap.get(operatorName); + Long operatorId = null; + if (Objects.nonNull(operator)) { + operatorId = operator.getId(); + } + + Long companyId = companyInfo.getId(); + if (Objects.nonNull(companyInfo)) { + // 获取最新一个公司信息 + companyId = companyInfo.getId(); + } else if (!StrPool.EMPTY.equals(companyName)) { + // 没有该公司信息,新增企业信息 + Company company = new Company(); + company.setRegionId(regionId); + company.setRegionName(displayName); + company.setOperatorId(operatorId); + company.setCompanyType(1); + company.setName(companyName); + company.setSortName(companyName); + company.setCompanyStatus(0); + companyService.save(company); + companyId = company.getId(); + // 更新map + companyNameMap.put(companyName,company); + } + vehicleBaseInfo.setCarPlate(carPlate); + vehicleBaseInfo.setOperatorId(operatorId); + vehicleBaseInfo.setRegionId(regionId); + vehicleBaseInfo.setRegionName(displayName); + vehicleBaseInfo.setCompanyId(companyId); + vehicleBaseInfo.setAuditState(2); + vehicleBaseInfo.setUpdateOn(LocalDateTime.now()); + vehicleBaseInfo.setCreateOn(LocalDateTime.now()); + vehicleBaseInfoService.save(vehicleBaseInfo); + System.out.println("准备更新 " + i + "条:" + JSON.toJSONString(vehicleBaseInfo)); + } + } + } + + @Test + public void testRegion(){ + RegionDTO regionDTO = regionCacheHelper.getByRegionId(6L); + String regionName = regionDTO.getRegionName(); + System.out.println(regionName); + } + + //public fileout void main(String[] args) { + // Date date = new Date(); + // System.out.println(date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + //} + + //这个下面是单独函数 + public static Workbook readExcel(InputStream is, String extString) { + Workbook wb = null; + extString = extString.substring(extString.lastIndexOf(".")); + try { + if (".xls".equals(extString)) { + return wb = new HSSFWorkbook(is); + } else if (".xlsx".equals(extString)) { + return wb = new XSSFWorkbook(is); + } else { + return wb = null; + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wb; + } + + + @Test + public void test2() throws FileNotFoundException { + File f = new File("D:\\work\\file\\0510\\运营商车辆.xlsx"); + Workbook wb = readExcel(new FileInputStream(f), f.getName()); + Row row = null; + if (wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + HashSet carPlates = new HashSet<>(); + HashSet companySet = new HashSet<>(); + HashSet operatorSet = new HashSet<>(); + HashSet countySet = new HashSet<>(); + + int count = 0; + // 根据车牌号查询车辆信息 + Map vehicleBaseInfoMap = vehicleBaseInfoService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getCarPlate()) && + carPlates.add(v.getCarPlate())) + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + // 根据企业名查询企业信息 + Map companyNameMap = companyService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + companySet.add(v.getName())) + .collect(Collectors.toMap(Company::getName, v -> v)); + + //获取最大列数 + List list = new ArrayList<>(); + for (int i = 1; i < rownum; i++) { + + NdVehicleBaseInfo vehicleBaseInfo = new NdVehicleBaseInfo(); + + row = sheet.getRow(i); + + // 车牌号 + String carPlate = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 企业名称 + String companyName = Objects.nonNull(row.getCell(1)) ? row.getCell(1).toString() : StringUtils.EMPTY; + // 企业信息不存在 + if (!companyNameMap.containsKey(companyName)){ + log.info("该车牌号:" + carPlate + "没有公司信息"); + Company com = new Company(); + com.setName(companyName); + com.setSortName(companyName); + com.setCompanyStatus(0); + companyService.save(com); + // 更新map + companyNameMap.put(companyName,com); + } + if (!vehicleBaseInfoMap.containsKey(carPlate)) { + Company company = companyNameMap.get(companyName); + vehicleBaseInfo.setCarPlate(carPlate); + vehicleBaseInfo.setCompanyId(company.getId()); + vehicleBaseInfo.setOperatorId(company.getOperatorId()); + vehicleBaseInfo.setRegionId(company.getRegionId()); + vehicleBaseInfo.setRegionName(company.getRegionName()); + vehicleBaseInfo.setAuditState(2); + list.add(vehicleBaseInfo); + count++; + } + } + System.out.println("新增的车辆数为:" + count); + HashSet set = new HashSet<>(); + List infos = + list.stream().filter(c -> set.add(c.getCarPlate())).collect(Collectors.toList()); + System.out.println("去重后的总数为:" + infos.size()); + vehicleBaseInfoService.saveOrUpdateBatch(infos); + System.out.println("更新完成"); + + } + + } + + @Test + public void test3() throws FileNotFoundException { + File f = new File("D:\\work\\file\\0510\\运营商车辆.xlsx"); + Workbook wb = readExcel(new FileInputStream(f), f.getName()); + Row row = null; + if (wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + HashSet companySet = new HashSet<>(); + + // 根据企业名查询企业信息 + Map companyNameMap = companyService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + companySet.add(v.getName())) + .collect(Collectors.toMap(Company::getName, v -> v)); + + //获取最大列数 + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + + // 企业名称 + String companyName = Objects.nonNull(row.getCell(1)) ? row.getCell(1).toString() : StringUtils.EMPTY; + // 企业信息不存在 + if (!companyNameMap.containsKey(companyName)){ + Company com = new Company(); + com.setName(companyName); + com.setSortName(companyName); + com.setCompanyStatus(0); + companyService.save(com); + } + + } + System.out.println("更新完成"); + + } + + } + + + + @Test + public void test4() throws FileNotFoundException { + File f = new File("D:\\work\\file\\0510\\运营商车辆.xlsx"); + Workbook wb = readExcel(new FileInputStream(f), f.getName()); + Row row = null; + if (wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + HashSet carPlates = new HashSet<>(); + HashSet companySet = new HashSet<>(); + + int count = 0; + // 根据车牌号查询车辆信息 + Map vehicleBaseInfoMap = vehicleBaseInfoService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getCarPlate()) && + carPlates.add(v.getCarPlate())) + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + // 根据企业名查询企业信息 + Map companyNameMap = companyService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + companySet.add(v.getName())) + .collect(Collectors.toMap(Company::getName, v -> v)); + + //获取最大列数 + List list = new ArrayList<>(); + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + + // 车牌号 + String carPlate = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 企业名称 + String companyName = Objects.nonNull(row.getCell(1)) ? row.getCell(1).toString() : StringUtils.EMPTY; + if (vehicleBaseInfoMap.containsKey(carPlate)) { + NdVehicleBaseInfo vehicleBaseInfo = vehicleBaseInfoMap.get(carPlate); + Company company = companyNameMap.get(companyName); + vehicleBaseInfo.setCompanyId(company.getId()); + list.add(vehicleBaseInfo); + count++; + } + } + System.out.println("新增的车辆数为:" + count); + HashSet set = new HashSet<>(); + List infos = + list.stream().filter(c -> set.add(c.getCarPlate())).collect(Collectors.toList()); + System.out.println("去重后的总数为:" + infos.size()); + vehicleBaseInfoService.saveOrUpdateBatch(infos); + System.out.println("更新完成"); + + } + + } + + + @Test + public void test5() throws FileNotFoundException { + File f = new File("D:\\work\\file\\0510\\缺区域2.xlsx"); + Workbook wb = readExcel(new FileInputStream(f), f.getName()); + Row row = null; + if (wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + HashSet carPlates = new HashSet<>(); + HashSet countySet = new HashSet<>(); + + int count = 0; + // 根据车牌号查询车辆信息 + Map vehicleBaseInfoMap = vehicleBaseInfoService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getCarPlate()) && + carPlates.add(v.getCarPlate())) + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + // 根据区县名称获取区域ID + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + + //获取最大列数 + List list = new ArrayList<>(); + for (int i = 1; i < rownum; i++) { + + row = sheet.getRow(i); + + // 车牌号 + String carPlate = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 区县 + String countyName = Objects.nonNull(row.getCell(1)) ? row.getCell(1).toString() : StringUtils.EMPTY; + Region region = regionMap.get(countyName); + Long regionId = null; + if (Objects.nonNull(region)) { + regionId = region.getId(); + } + String displayName = regionCacheHelper.getDisplayName(regionId); + if (carPlates.contains(carPlate)) { + NdVehicleBaseInfo baseInfo = vehicleBaseInfoMap.get(carPlate); + baseInfo.setRegionId(regionId); + baseInfo.setRegionName(displayName); + count++; + list.add(baseInfo); + } + } + log.info("更新的车辆数量为:" + count); + vehicleBaseInfoService.saveOrUpdateBatch(list); + System.out.println("更新完成"); + } + } + + @Test + public void test6() throws FileNotFoundException { + File f = new File("D:\\work\\file\\0510\\车牌缺运营商.xlsx"); + Workbook wb = readExcel(new FileInputStream(f), f.getName()); + Row row = null; + if (wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + HashSet carPlates = new HashSet<>(); + HashSet companySet = new HashSet<>(); + HashSet operatorSet = new HashSet<>(); + HashSet countySet = new HashSet<>(); + + int count = 0; + // 根据车牌号查询车辆信息 + Map vehicleBaseInfoMap = vehicleBaseInfoService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getCarPlate()) && + carPlates.add(v.getCarPlate())) + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + // 根据运营商名称查询运营商信息 + Map operatorMap = operatorService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + operatorSet.add(v.getName())) + .collect(Collectors.toMap(Operator::getName, v -> v)); + + //获取最大列数 + List list = new ArrayList<>(); + for (int i = 1; i < rownum; i++) { + + row = sheet.getRow(i); + + // 车牌号 + String carPlate = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 运营商 + String operatorName = Objects.nonNull(row.getCell(1)) ? row.getCell(1).toString() : StringUtils.EMPTY; + Operator operator = operatorMap.get(operatorName); + Long operatorId = null; + if (Objects.nonNull(operator)) { + operatorId = operator.getId(); + } + + if (carPlates.contains(carPlate)) { + NdVehicleBaseInfo baseInfo = vehicleBaseInfoMap.get(carPlate); + baseInfo.setOperatorId(operatorId); + count++; + list.add(baseInfo); + } + } + log.info("更新的车辆数为:" + count); + vehicleBaseInfoService.saveOrUpdateBatch(list); + System.out.println("更新完成"); + } + } + + @Test + public void test7() throws FileNotFoundException { + File f = new File("D:\\work\\file\\0510\\缺企业.xlsx"); + Workbook wb = readExcel(new FileInputStream(f), f.getName()); + Row row = null; + if (wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + HashSet carPlates = new HashSet<>(); + HashSet companySet = new HashSet<>(); + + int count = 0; + // 根据车牌号查询车辆信息 + Map vehicleBaseInfoMap = vehicleBaseInfoService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getCarPlate()) && + carPlates.add(v.getCarPlate())) + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + // 根据企业名查询企业信息 + Map companyNameMap = companyService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + companySet.add(v.getName())) + .collect(Collectors.toMap(Company::getName, v -> v)); + + //获取最大列数 + List list = new ArrayList<>(); + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + + // 车牌号 + String carPlate = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 企业名称 + String companyName = Objects.nonNull(row.getCell(1)) ? row.getCell(1).toString() : StringUtils.EMPTY; + Company companyInfo = companyNameMap.get(companyName); + Long companyId = null; + if (Objects.nonNull(companyInfo)) { + // 获取最新一个公司信息 + companyId = companyInfo.getId(); + } + if (carPlates.contains(carPlate)) { + NdVehicleBaseInfo baseInfo = vehicleBaseInfoMap.get(carPlate); + baseInfo.setCompanyId(companyId); + count++; + list.add(baseInfo); + } + } + log.info("更新的车辆数为:" + count); + vehicleBaseInfoService.saveOrUpdateBatch(list); + System.out.println("更新完成"); + } + } + + // 更新车辆设备表中车辆ID + @Test + public void test8(){ + Map vehicleBaseInfoMap = vehicleBaseInfoService.list().stream() + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + List equipmentInfos = vehicleEquipmentInfoService.list(); + + for (NdVehicleEquipmentInfo equipmentInfo : equipmentInfos) { + String carPlate = equipmentInfo.getCarPlate(); + NdVehicleBaseInfo baseInfo = vehicleBaseInfoMap.get(carPlate); + if (Objects.nonNull(baseInfo)) { + equipmentInfo.setVehicleId(baseInfo.getId()); + if (Objects.nonNull(baseInfo.getVehicleType())){ + equipmentInfo.setVehicleType(Long.valueOf(baseInfo.getVehicleType())); + } + vehicleEquipmentInfoService.updateById(equipmentInfo); + } + } + } + + // 更新车辆区域信息 + @Test + public void test9(){ + List baseInfos = vehicleBaseInfoService.list().stream() + .filter(v -> Objects.isNull(v.getRegionId())) + .collect(Collectors.toList()); + Map companyMap = companyService.list().stream().collect(Collectors.toMap(Company::getId, c -> c)); + for (NdVehicleBaseInfo baseInfo : baseInfos) { + Long companyId = baseInfo.getCompanyId(); + Company company = companyMap.get(companyId); + Long regionId = company.getRegionId(); + String regionName = company.getRegionName(); + baseInfo.setRegionId(regionId); + baseInfo.setRegionName(regionName); + vehicleBaseInfoService.updateById(baseInfo); + } + } + + @Test + public void test10() throws FileNotFoundException { + File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\车辆类型数据.xlsx"); + Workbook wb = readExcel(new FileInputStream(f), f.getName()); + Row row = null; + if (wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + HashSet carPlates = new HashSet<>(); + // 根据车牌号查询车辆信息 + Map vehicleBaseInfoMap = vehicleBaseInfoService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getCarPlate()) && + carPlates.add(v.getCarPlate())) + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + //获取最大列数 + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + + // 车牌号 + String carPlate = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 车辆类型 + String vehicleType = Objects.nonNull(row.getCell(1)) ? row.getCell(1).toString() : StringUtils.EMPTY; + // 审核时间 + LocalDateTime dateTime = LocalDateTime.now(); + Cell cell = row.getCell(2); + if (cell.getCellType() == CellType.NUMERIC && DateUtil.isCellDateFormatted(cell)) { + Date dateValue = cell.getDateCellValue(); + // 处理日期值 + dateTime = NdDateUtils.date2LocalDateTime(dateValue); + if (vehicleBaseInfoMap.containsKey(carPlate)) { + NdVehicleBaseInfo baseInfo = vehicleBaseInfoMap.get(carPlate); + baseInfo.setAuditTime(dateTime); + vehicleBaseInfoService.updateById(baseInfo); + } + } + + } + } + } + + + private Long lastIndex = 626L; + private Integer lastCount = 626; + @Test + public void test11(){ + readLastIndex(); + System.out.println(lastIndex); + System.out.println(lastCount); + } + private void readLastIndex() { + File file = new File("C:\\Users\\CMM\\Desktop\\demo\\vehicleLicenseIndex.txt"); + try { + List dataList = FileUtil.readLines(file, StandardCharsets.UTF_8); + if (CollUtil.isNotEmpty(dataList) && dataList.size() == 2){ + lastIndex = Long.valueOf(dataList.get(0)); + lastCount = Integer.valueOf(dataList.get(1)); + } + } catch (Exception e) { + log.info("读取下标和车牌号失败!"); + } + } + + @Test + public void test12(){ + + LambdaQueryWrapper query = + Wrappers.lambdaQuery(NdVehicleBaseInfo.class).ge(NdVehicleBaseInfo::getId, 1000) + .lt(NdVehicleBaseInfo::getId, 1000 + 2900 - 1401 + 1) + .select(NdVehicleBaseInfo::getCarPlate,NdVehicleBaseInfo::getId).isNotNull(NdVehicleBaseInfo::getCarPlate); + List list = vehicleBaseInfoService.list(query); + if (CollUtil.isNotEmpty(list)) { + List carPlateSet = list.stream() + .sorted(Comparator.comparing(NdVehicleBaseInfo::getId)) + .map(NdVehicleBaseInfo::getCarPlate) + .collect(Collectors.toList()); + String[] carPlates = carPlateSet.stream().toArray(String[]::new); + System.out.println(carPlates[1499]); + System.out.println(carPlates[0]); + } + } + + + @Test + public void test13(){ + Map infoMap = + vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .select(NdVehicleBaseInfo::getId,NdVehicleBaseInfo::getCarPlate)) + .stream().collect(Collectors.toMap(NdVehicleBaseInfo::getId, NdVehicleBaseInfo::getCarPlate)); + OptionalLong maxKey = infoMap.keySet().stream().mapToLong(Long::longValue).max(); + Long maxIndex = null; + if (maxKey.isPresent()){ + maxIndex = maxKey.getAsLong(); + } + // 校验下标对应的车牌号是否一致 + String carNo; + carNo = infoMap.get(lastIndex); + while (Objects.isNull(carNo)) { + log.info("车辆id{}不存在,请检查该车辆信息是否已经被删除!", lastIndex); + // 查找下一个车辆信息,直到车辆信息存在 + lastIndex++; + if (Objects.nonNull(maxIndex) && lastIndex.compareTo(maxIndex) > 0){ + log.info("系统中没有待查询的车牌号"); + return; + } + carNo = infoMap.get(lastIndex); + } + + // 从车辆信息表中从上次执行中断的下标获取一定数量的车牌号 + int cnt = 2950 - lastCount; + LambdaQueryWrapper query = + Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .ge(NdVehicleBaseInfo::getId, lastIndex) + .last("limit " + cnt) + .select(NdVehicleBaseInfo::getCarPlate, NdVehicleBaseInfo::getId) + .isNotNull(NdVehicleBaseInfo::getCarPlate); + List list = vehicleBaseInfoService.list(query); + log.info("此次任务车辆数量为:" + list.size()); + + // 任务执行完毕后保存最终的数据下标 + TreeMap sortedMap = new TreeMap<>(infoMap); + Map.Entry higherEntry = sortedMap.higherEntry(lastIndex); + if (Objects.nonNull(higherEntry)){ + lastIndex = higherEntry.getKey(); + } + log.info("下个下标为:" + lastIndex); + } + + + @Test + public void test14(){ + VehicleArchivesPageQuery vehicleArchivesPageQuery = new VehicleArchivesPageQuery(); + LambdaQueryWrapper otherWrapper = Wrappers.lambdaQuery(NdVehicleBaseInfo.class); + otherWrapper.eq(NdVehicleBaseInfo::getDeleted, DeletedEnum.NO_DELETED.getCode()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getCompanyId()),NdVehicleBaseInfo::getCompanyId,vehicleArchivesPageQuery.getCompanyId()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getCarPlate()), NdVehicleBaseInfo::getCarPlate, vehicleArchivesPageQuery.getCarPlate()) + .like(StringUtils.isNotBlank(vehicleArchivesPageQuery.getUseCompanyName()),NdVehicleBaseInfo::getUseCompanyName,vehicleArchivesPageQuery.getUseCompanyName()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getVehicleType()), NdVehicleBaseInfo::getVehicleType, vehicleArchivesPageQuery.getVehicleType()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getVehicleStatus()),NdVehicleBaseInfo::getVehicleStatus,vehicleArchivesPageQuery.getVehicleStatus()) + .eq(Objects.nonNull(vehicleArchivesPageQuery.getRegionId()),NdVehicleBaseInfo::getRegionId,vehicleArchivesPageQuery.getRegionId()) + .eq(NdVehicleBaseInfo::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()) + .orderBy(Boolean.TRUE,Boolean.FALSE,NdVehicleBaseInfo::getUpdateOn); + List baseInfos = vehicleBaseInfoService.list(otherWrapper).stream().filter(v -> Objects.isNull(v.getCompanyId())).collect(Collectors.toList()); + log.info("数量为{}",baseInfos.size()); + } +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/ObjectData.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/ObjectData.java new file mode 100644 index 0000000..03de3c0 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/ObjectData.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.client; + +import lombok.Data; + +@Data +public class ObjectData { + private short targetId; + private byte laneNumber; + private byte targetType; + private float length; + private float width; + private float height; + private float yawAngle; + private float xCoordinate; + private float yCoordinate; + private float xVelocity; + private float yVelocity; + private float speed; + private float acceleration; + private float xAcceleration; + private float yAcceleration; + private double longitude; + private double latitude; + + // 构造函数、getter和setter方法 + // ... +} \ No newline at end of file diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/RadarClient.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/RadarClient.java new file mode 100644 index 0000000..d4a7196 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/RadarClient.java @@ -0,0 +1,32 @@ +package com.ningdatech.carapi.client; + +import java.io.*; +import java.net.*; + +public class RadarClient { + private Socket socket; + private DataInputStream input; + private DataOutputStream output; + + public RadarClient(String host, int port) throws IOException { + socket = new Socket(host, port); + input = new DataInputStream(new BufferedInputStream(socket.getInputStream())); + output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream())); + } + + public void sendData(byte[] data) throws IOException { + output.write(data); + output.flush(); + } + + public byte[] receiveData() throws IOException { + // 实现接收数据的逻辑 + return null; + } + + public void close() throws IOException { + input.close(); + output.close(); + socket.close(); + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/RadarDataProcessor.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/RadarDataProcessor.java new file mode 100644 index 0000000..989a8d1 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/RadarDataProcessor.java @@ -0,0 +1,46 @@ +package com.ningdatech.carapi.client; + +import java.io.IOException; + +public class RadarDataProcessor { + public static void main(String[] args) { + try { + RadarClient client = new RadarClient("localhost", 8080); + + while (true) { + byte[] receivedData = client.receiveData(); + RadarPacket packet = RadarPacket.fromByteArray(receivedData); + + if (packet.getDataType() == 0x01) { + ObjectData objectData = parseObjectData(packet.getData()); + processObjectData(objectData); + } else if (packet.getDataType() == 0x03) { + TrafficData trafficData = parseTrafficData(packet.getData()); + processTrafficData(trafficData); + } + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private static ObjectData parseObjectData(byte[] data) { + // 实现解析目标轨迹数据的逻辑 + return new ObjectData(); + } + + private static TrafficData parseTrafficData(byte[] data) { + // 实现解析交通流量统计数据的逻辑 + return new TrafficData(); + } + + private static void processObjectData(ObjectData data) { + // 处理目标轨迹数据 + return; + } + + private static void processTrafficData(TrafficData data) { + // 处理交通流量统计数据 + return; + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/RadarPacket.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/RadarPacket.java new file mode 100644 index 0000000..f4e583e --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/RadarPacket.java @@ -0,0 +1,29 @@ +package com.ningdatech.carapi.client; + +import lombok.Data; + +@Data +public class RadarPacket { + private static final byte[] HEADER = {0x55, (byte) 0xAA, 0x55, (byte) 0xBB}; + private static final byte[] FOOTER = {0x55, (byte) 0xCC, 0x55, (byte) 0xDD}; + + private short dataLength; + private byte dataType; + private byte checksum; + private String deviceId; + private long timestamp; + private byte[] data; + + // 构造函数、getter和setter方法 + // ... + + public byte[] toByteArray() { + // 实现将数据包转换为字节数组的逻辑 + return new byte[0]; + } + + public static RadarPacket fromByteArray(byte[] bytes) { + // 实现从字节数组解析数据包的逻辑 + return new RadarPacket(); + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/TrafficData.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/TrafficData.java new file mode 100644 index 0000000..eac5697 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/client/TrafficData.java @@ -0,0 +1,21 @@ +package com.ningdatech.carapi.client; + +import lombok.Data; + +@Data +public class TrafficData { + private short statisticalPeriod; + private short laneNumber; + private float monitoringPosition; + private short smallCarFlow; + private short largeCarFlow; + private short extraLargeCarFlow; + private short totalFlow; + private float averageSpeed; + private float headwayTime; + private float occupancyRate; + private float maxQueueLength; + + // 构造函数、getter和setter方法 + // ... +} \ No newline at end of file diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/company/CompanyInfoTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/company/CompanyInfoTest.java new file mode 100644 index 0000000..e52a41b --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/company/CompanyInfoTest.java @@ -0,0 +1,268 @@ +package com.ningdatech.carapi.company; + +import java.io.*; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import com.alibaba.fastjson.JSON; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.company.entity.NdCompanyCreditLevel; +import com.ningdatech.carapi.company.service.INdCompanyCreditLevelService; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.CompanyTypeRelated; +import com.ningdatech.carapi.sys.entity.Region; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.sys.service.CompanyTypeRelatedService; +import com.ningdatech.carapi.sys.service.IRegionService; + +/** + * @Classname InsureOutdangerTest + * @Description + * @Date 2022/12/22 10:47 + * @Created by PoffyZhang + */ +public class CompanyInfoTest extends AppTests { + + @Autowired + private CompanyService companyService; + @Autowired + private IRegionService regionService; + + @Autowired + private RegionsCacheHelper regionsCacheHelper; + + @Autowired + private CompanyTypeRelatedService companyTypeRelatedService; + @Autowired + private INdCompanyCreditLevelService companyCreditLevelService; + + @Test + public void test() throws FileNotFoundException { + File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\最新企业.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + + HashSet countySet = new HashSet<>(); + // 根据区县名称获取区域ID + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + + Map companyMap = companyService.list().stream() + .collect(Collectors.toMap(Company::getName, v -> v)); + + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i countySet = new HashSet<>(); + // 根据公司名称获取公司ID + Map companyMap = companyService.list().stream() + .collect(Collectors.toMap(Company::getName, c -> c)); + + + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i companyList = companyService.list().stream().filter(c -> c.getCompanyType() != 0).collect(Collectors.toList()); + // 初始化所有企业2023年的的企业信用等级 + for (Company company : companyList) { + NdCompanyCreditLevel creditLevel = new NdCompanyCreditLevel(); + creditLevel.setCompanyId(company.getId()); + creditLevel.setCompanyName(company.getName()); + creditLevel.setRegionId(company.getRegionId()); + String regionName = regionsCacheHelper.getDisplayName(company.getRegionId()); + creditLevel.setRegionName(regionName); + creditLevel.setYear("2023"); + creditLevel.setScore(1000); + creditLevel.setLevel("A"); + creditLevel.setBasicCreditScore(120); + creditLevel.setCommonCreditScore(300); + creditLevel.setSafeProductCreditScore(240); + creditLevel.setIndustryRegulateCreditScore(240); + creditLevel.setIndustryHonorBonus(100); + creditLevel.setGovernmentAwardScore(50); + creditLevel.setIndustryBenchMarkScore(50); + companyCreditLevelService.save(creditLevel); + } + + } + + @Test + public void test4() throws FileNotFoundException { + File f = new File("D:\\work\\水泥车车辆数据\\丽水莲都区物流企业.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i companyMap = companyService.list().stream().collect(Collectors.toMap(Company::getName, c -> c)); + List insureInfoList = insureInfoService.list(); + List warnAnalysisCompanyList = analysisCompanyService.list(); + for (WarnAnalysisCompany warnAnalysisCompany : warnAnalysisCompanyList) { + String companyName = warnAnalysisCompany.getCompanyName(); + if (companyMap.containsKey(companyName)){ + Company company = companyMap.get(companyName); + warnAnalysisCompany.setCompanyId(company.getId()); + warnAnalysisCompany.setRegionId(company.getRegionId()); + analysisCompanyService.updateById(warnAnalysisCompany); + } + } + } + + @Test + public void test3() { + // 更新预警评估-保险机构信息中的企业和区域信息 + Map vehicleBaseInfoMap = vehicleBaseInfoService.list().stream() + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + Map companyMap = companyService.list().stream().collect(Collectors.toMap(Company::getId, c -> c)); + List insureInfos = insureInfoService.list(); + for (NdInsureInfo insureInfo : insureInfos) { + String carPlate = insureInfo.getCarPlate(); + NdVehicleBaseInfo baseInfo = vehicleBaseInfoMap.get(carPlate); + Long companyId = baseInfo.getCompanyId(); + Long regionId = baseInfo.getRegionId(); + String regionName = baseInfo.getRegionName(); + Company company = companyMap.get(companyId); + insureInfo.setCompanyId(companyId); + insureInfo.setRegionId(regionId); + insureInfo.setRegionName(regionName); + insureInfo.setCompanyName(company.getName()); + insureInfoService.updateById(insureInfo); + } + } + + @Test + public void test4() { + // 创建各市、区县散装中心管理企业 + List cityList = regionService.list() + .stream().filter(c -> (2 == c.getLevel() || 3 == c.getLevel()) + && !"市本级".equals(c.getName())) + .collect(Collectors.toList()); + for (Region region : cityList) { + Company company = new Company(); + String regionName = region.getName(); + Long regionId = region.getId(); + String companyName = regionName + "散装中心"; + company.setName(companyName); + company.setRegionId(regionId); + String displayName = regionsCacheHelper.getDisplayName(regionId); + company.setRegionName(displayName); + company.setCompanyType(CompanyTypeEnum.MANAGE_BU.getCode()); + company.setCreateOn(LocalDateTime.now()); + company.setUpdateOn(LocalDateTime.now()); + companyService.save(company); + } + } + + @Test + public void test5() { + // 创建各企业企业信息员账号 + Map companyMap = companyService.list().stream().collect(Collectors.toMap(Company::getId, c -> c)); + List companyList = companyService.list().stream().filter(c -> c.getCompanyType().equals(CompanyTypeEnum.PRODUCT_BU.getCode()) + || c.getCompanyType().equals(CompanyTypeEnum.LOGISTICS_BU.getCode()) + || c.getCompanyType().equals(CompanyTypeEnum.OTHER.getCode())).collect(Collectors.toList()); + for (Company company : companyList) { + Long companyId = company.getId(); + Company companyInfo = companyMap.get(companyId); + NdUserInfo userInfo = new NdUserInfo(); + userInfo.setCanLogin(UserCanLoginEnum.CAN_LOGIN.getCode()); + userInfo.setUsername(companyInfo.getName()); + userInfo.setCompanyId(companyId); + userInfo.setCreateOn(LocalDateTime.now()); + userInfo.setUpdateOn(LocalDateTime.now()); + userInfoService.save(userInfo); + + Long userId = userInfo.getId(); + NdUserAuth userAuth = new NdUserAuth(); + userAuth.setUserId(userId); + userAuth.setIdentifier(companyInfo.getName()); + userAuth.setCredential(passwordEncoder.encode("123456Aa")); + userAuth.setAuthType(AuthTypeEnum.ACCOUNT_PASSWORD.getKey()); + userAuth.setIsAvailable(true); + ndUserAuthService.save(userAuth); + + UserRole userRole = new UserRole(); + userRole.setUserId(userId); + userRole.setRoleId(UserRoleTypeEnum.COMPANY_INFO_OFFICER_ROLE_ID.getId()); + userRoleService.save(userRole); + } + } + + @Test + public void test2() throws FileNotFoundException { + File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\水泥车企业类型细分.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + + HashSet countySet = new HashSet<>(); + // 根据公司名称获取公司ID + Map companyMap = companyService.list().stream() + .collect(Collectors.toMap(Company::getName, c -> c)); + + + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i driverInfos = driverInfoService.list(Wrappers.lambdaQuery(DriverInfo.class) + .eq(Objects.nonNull(companyId), DriverInfo::getCompanyId, companyId) + .eq(Objects.nonNull(regionId), DriverInfo::getRegionId, regionId) + .eq(Objects.nonNull(companyName), DriverInfo::getCompanyName, companyName)); + + Assert.assertNotNull(driverInfos); + + for (DriverInfo driverInfo : driverInfos) { + + //保存培训组织基础信息 考试试卷 + TrainingOrganization saveRecord = new TrainingOrganization(); + saveRecord.setUpdateOn(LocalDateTime.now()); + saveRecord.setTrainingTopic("取证培训"); + saveRecord.setTrainingStartTime(LocalDateTime.of(2022,12,1,9,30)); + saveRecord.setTrainingEndTime(LocalDateTime.of(2022,12,15,18,30)); + saveRecord.setAddress("杭州"); + saveRecord.setTrainingMode(TrainingModeEnum.online.name()); + + saveRecord.setTrainingType(TrainingTypeEnum.forensic_registration_training.name()); + saveRecord.setContacts("宁达"); + saveRecord.setContactNumber("18556996666"); + + saveRecord.setTrainingStatus(TrainingStatusEnum.enable.name()); + saveRecord.setRemark("备注"); + saveRecord.setExamPaperId(18L); + saveRecord.setExamPaperName("取证培训试卷"); + saveRecord.setCreateBy(2L); + saveRecord.setCreateOn(LocalDateTime.now()); + saveRecord.setRegionId(regionId); + iTrainingOrganizationService.save(saveRecord); + + //保存培训人员 + TrainingOrganizationTrainer trainingOrganizationTrainer = new TrainingOrganizationTrainer(); + trainingOrganizationTrainer.setDriverId(driverInfo.getId()); + trainingOrganizationTrainer.setDriverName(driverInfo.getDriverName()); + trainingOrganizationTrainer.setCompanyId(driverInfo.getCompanyId()); + trainingOrganizationTrainer.setDriverUserId(driverInfo.getUserId()); + trainingOrganizationTrainer.setCompanyName(driverInfo.getCompanyName()); + trainingOrganizationTrainer.setCreateOn(LocalDateTime.now()); + trainingOrganizationTrainer.setUpdateOn(LocalDateTime.now()); + trainingOrganizationTrainer.setExamPaperId(18L); + trainingOrganizationTrainer.setExaminationStatus(ExaminationStatusEnum.examined.name()); + trainingOrganizationTrainer.setExamPaperName("取证培训试卷"); + trainingOrganizationTrainer.setExamRegistrationNo("abcdefg"); + trainingOrganizationTrainer.setTrainingOrganizationId(saveRecord.getId()); + iTrainingOrganizationTrainerService.save(trainingOrganizationTrainer); + + //保存考试记录 + ExamRecord saveExamRecord = new ExamRecord(); + saveExamRecord.setCreateBy(2L); + saveExamRecord.setCreateOn(LocalDateTime.now()); + saveExamRecord.setUpdateOn(LocalDateTime.now()); + saveExamRecord.setExamPaperId(18L); + saveExamRecord.setTrainingOrganizationId(saveRecord.getId()); + saveExamRecord.setExamType(TrainingTypeEnum.forensic_registration_training.name()); + iExamRecordService.save(saveExamRecord); + + //保存考试分数 + ExamRecordDetail examRecordDetail = new ExamRecordDetail(); + examRecordDetail.setDriverId(driverInfo.getId()); + examRecordDetail.setDriverUserId(driverInfo.getUserId()); + examRecordDetail.setDriverName(driverInfo.getDriverName()); + examRecordDetail.setCompanyName(driverInfo.getCompanyName()); + examRecordDetail.setCompanyId(driverInfo.getCompanyId()); + examRecordDetail.setScore(100); + examRecordDetail.setExamResult(ExamQualifiedEnum.qualified.name()); + examRecordDetail.setExamTime(LocalDateTime.of(2022,12,7,9,30)); + examRecordDetail.setRegionId(driverInfo.getRegionId()); + examRecordDetail.setExamType(TrainingTypeEnum.forensic_registration_training.name()); + examRecordDetail.setExamRecordId(saveExamRecord.getId()); + examRecordDetail.setCreateBy(2L); + examRecordDetail.setCreateOn(LocalDateTime.now()); + examRecordDetail.setUpdateOn(LocalDateTime.now()); + //初始化驾驶员星级 + StarManage starManage = new StarManage(); + starManage.setCurrentStar(5.0); + starManage.setDriverId(driverInfo.getId()); + starManage.setDriverName(driverInfo.getDriverName()); + starManage.setRegionId(driverInfo.getRegionId()); + starManage.setCompanyName(driverInfo.getCompanyName()); + starManage.setCompanyId(driverInfo.getCompanyId()); + starManage.setCreateOn(LocalDateTime.now()); + starManage.setUpdateOn(LocalDateTime.now()); + iStarManageService.save(starManage); + + TrainingOrganizationTrainer trainer = iTrainingOrganizationTrainerService.getOne(Wrappers.lambdaQuery(TrainingOrganizationTrainer.class) + .eq(Objects.nonNull(driverInfo), TrainingOrganizationTrainer::getDriverId, driverInfo.getId())); + + // 保存培训资料 + TrainingMaterialOverviewInfo trainingMaterialOverviewInfo = new TrainingMaterialOverviewInfo(); + List ruleSystemMaterialList = new ArrayList<>(); + TrainingMaterialInfo trainingMaterialInfo1 = new TrainingMaterialInfo(); + trainingMaterialInfo1.setTrainingMaterialId(1L); + trainingMaterialInfo1.setMaterialType(MaterialTypeEnum.rule_system); + trainingMaterialInfo1.setContent("1"); + trainingMaterialInfo1.setTitle("杭州市水泥车培训资料"); + ruleSystemMaterialList.add(trainingMaterialInfo1); + trainingMaterialOverviewInfo.setRuleSystemMaterialList(ruleSystemMaterialList); + + List policyDocumentsMaterialInfoList = new ArrayList<>(); + TrainingMaterialInfo trainingMaterialInfo2 = new TrainingMaterialInfo(); + trainingMaterialInfo2.setTrainingMaterialId(4L); + trainingMaterialInfo2.setMaterialType(MaterialTypeEnum.policy_documents); + trainingMaterialInfo2.setContent("1"); + trainingMaterialInfo2.setTitle("散办水泥车政策文件"); + ruleSystemMaterialList.add(trainingMaterialInfo2); + trainingMaterialOverviewInfo.setPolicyDocumentsMaterialInfoList(policyDocumentsMaterialInfoList); + + List safetyKnowledgeMaterialInfoList = new ArrayList<>(); + TrainingMaterialInfo trainingMaterialInfo3 = new TrainingMaterialInfo(); + trainingMaterialInfo3.setTrainingMaterialId(3L); + trainingMaterialInfo3.setMaterialType(MaterialTypeEnum.safety_knowledge); + trainingMaterialInfo3.setContent("资料2内容"); + trainingMaterialInfo3.setTitle("散办水泥车规则"); + safetyKnowledgeMaterialInfoList.add(trainingMaterialInfo3); + trainingMaterialOverviewInfo.setSafetyKnowledgeMaterialInfoList(safetyKnowledgeMaterialInfoList); + + List accidentCaseMaterialInfoList = new ArrayList<>(); + TrainingMaterialInfo trainingMaterialInfo4 = new TrainingMaterialInfo(); + trainingMaterialInfo4.setTrainingMaterialId(8L); + trainingMaterialInfo4.setMaterialType(MaterialTypeEnum.accident_case); + trainingMaterialInfo4.setContent("122222222"); + trainingMaterialInfo4.setTitle("浙江省2022年事故案例"); + safetyKnowledgeMaterialInfoList.add(trainingMaterialInfo4); + trainingMaterialOverviewInfo.setAccidentCaseMaterialInfoList(accidentCaseMaterialInfoList); + + List trainingVideoMaterialInfoList = new ArrayList<>(); + TrainingMaterialInfo trainingMaterialInfo5 = new TrainingMaterialInfo(); + trainingMaterialInfo5.setTrainingMaterialId(9L); + trainingMaterialInfo5.setMaterialType(MaterialTypeEnum.training_video); + trainingMaterialInfo5.setContent("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"); + trainingMaterialInfo5.setTitle("省交通局培训视频"); + safetyKnowledgeMaterialInfoList.add(trainingMaterialInfo5); + trainingMaterialOverviewInfo.setTrainingVideoMaterialInfoList(trainingVideoMaterialInfoList); + + List otherMaterialInfoList = new ArrayList<>(); + TrainingMaterialInfo trainingMaterialInfo6 = new TrainingMaterialInfo(); + trainingMaterialInfo6.setTrainingMaterialId(10L); + trainingMaterialInfo6.setMaterialType(MaterialTypeEnum.other); + trainingMaterialInfo6.setContent("21"); + trainingMaterialInfo6.setTitle("交通厅其他资料"); + safetyKnowledgeMaterialInfoList.add(trainingMaterialInfo6); + trainingMaterialOverviewInfo.setOtherMaterialInfoList(otherMaterialInfoList); + + List allList = trainingMaterialOverviewInfo.getAllList(); + List materialSaveRecordList = new ArrayList<>(); + for (TrainingMaterialInfo trainingMaterialInfo : allList) { + TrainingOrganizationMaterial materialSaveRecord = new TrainingOrganizationMaterial(); + materialSaveRecord.setCreateBy(2L); + materialSaveRecord.setCreateOn(LocalDateTime.now()); + materialSaveRecord.setUpdateOn(LocalDateTime.now()); + materialSaveRecord.setMaterialType(trainingMaterialInfo.getMaterialType().name()); + materialSaveRecord.setTrainingMaterialId(trainingMaterialInfo.getTrainingMaterialId()); + materialSaveRecord.setTrainingOrganizationId(trainer.getTrainingOrganizationId()); + materialSaveRecordList.add(materialSaveRecord); + } + iTrainingOrganizationMaterialService.saveBatch(materialSaveRecordList); + } + } +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/driver/DriverDataImportTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/driver/DriverDataImportTest.java new file mode 100644 index 0000000..01926b7 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/driver/DriverDataImportTest.java @@ -0,0 +1,864 @@ +package com.ningdatech.carapi.driver; + + +import java.io.*; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.crypto.password.PasswordEncoder; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.archives.enums.AuditStateEnum; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.constant.*; +import com.ningdatech.carapi.driver.constant.DriverRegistrationStatusEnum; +import com.ningdatech.carapi.driver.constant.DriverStatusEnum; +import com.ningdatech.carapi.driver.constant.TrainingRegistrationFlagEnum; +import com.ningdatech.carapi.driver.constant.UserCanLoginEnum; +import com.ningdatech.carapi.driver.entity.Certificate; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.entity.DriverScoreInfo; +import com.ningdatech.carapi.driver.service.ICertificateService; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.driver.service.IDriverScoreInfoService; +import com.ningdatech.carapi.sys.contants.UserLoginConstant; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.Region; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.entity.dto.OperatorQueryDTO; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.sys.service.IRegionService; +import com.ningdatech.carapi.sys.service.UserRoleService; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.security.auth.constant.AuthTypeEnum; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.crypto.asymmetric.KeyType; +import cn.hutool.crypto.asymmetric.RSA; +import lombok.extern.slf4j.Slf4j; + +/** + * @author liuxinxin + * @date 2022/11/10 下午5:30 + */ +@Slf4j +public class DriverDataImportTest extends AppTests { + @Autowired + private IDriverInfoService iDriverInfoService; + @Autowired + private CompanyService companyService; + @Autowired + private IRegionService regionService; + @Autowired + private RegionsCacheHelper regionCacheHelper; + @Autowired + private INdUserInfoService iNdUserInfoService; + @Autowired + private INdUserAuthService iNdUserAuthService; + @Autowired + private UserRoleService userRoleService; + @Autowired + private PasswordEncoder passwordEncoder; + @Autowired + private ICertificateService certificateService; + @Autowired + private IDriverScoreInfoService iDriverScoreInfoService; + @Autowired + private IVehicleBaseInfoService vehicleBaseInfoService; + @Autowired + private OperatorsCacheHelper operatorsCacheHelper; + + @Value("${login.public-key}") + private String publicKey; + + @Value("${login.private-key}") + private String privateKey; + + @Test + public void importData() { + +// try { +// Workbook wb; +// File file = new File("/Users/liuxinxin/Desktop/driver_data_20221111.xls"); +// InputStream is = Files.newInputStream(file.toPath()); +// wb = Workbook.getWorkbook(is); +// +// Sheet sheet = wb.getSheet(0); +// int row_total = sheet.getRows(); +// +// List saveRecordList = new ArrayList<>(); +// List firmIdList = new ArrayList<>(); +// for (int j = 0; j < row_total; j++) { +// if (j >= 1) { +// Cell[] cells = sheet.getRow(j); +// String firmId = cells[53].getContents(); +// if (StringUtils.isNotBlank(firmId)) { +// firmIdList.add(Long.parseLong(firmId)); +// } +// } +// } +// Assert.assertNotNull(firmIdList); +// firmIdList = firmIdList.stream().distinct().collect(Collectors.toList()); +// List companyList = companyService.list(new QueryWrapper() +// .in("firm_id", firmIdList)); +// Map companyMap = companyList.stream().collect(Collectors.toMap(Company::getFirmId, Function.identity())); +// +// +// for (int j = 0; j < row_total; j++) { +// if (j >= 1) { +// Cell[] cells = sheet.getRow(j); +// DriverInfo saveRecord = new DriverInfo(); +// saveRecord.setDriverName(cells[1].getContents()); +//// saveRecord.setAvatarFile(cells[1].getContents()); +// saveRecord.setGender("男".equals(cells[3].getContents()) ? 1 : 0); +// saveRecord.setIdCard(cells[5].getContents()); +// +//// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); +//// LocalDateTime birth= LocalDateTime.parse(cells[2].getContents(), DateTimeFormatter.ofPattern("yyyy-MM-dd")); +//// saveRecord.setBirth(birth); +// +// saveRecord.setNativePlace(cells[21].getContents()); +// +//// saveRecord.setNativePlaceRegionCode(cells[1].getContents()); +// saveRecord.setPhoneNo(cells[4].getContents()); +// +// saveRecord.setHealth("良好"); +// saveRecord.setAddress(cells[13].getContents()); +// +// saveRecord.setDriverLicenseNo(cells[6].getContents()); +// +// String licenseClass = cells[7].getContents(); +// +// if (StringUtils.isNotBlank(licenseClass) && licenseClass.length() >= 2) { +// licenseClass = licenseClass.substring(0, 2); +// saveRecord.setDriverLicenseType(licenseClass); +// +// } +//// saveRecord.setCompanyId(cells[1].getContents()); +//// saveRecord.setCompanyName(cells[1].getContents()); +// saveRecord.setCreateOn(LocalDateTime.now()); +// saveRecord.setUpdateOn(LocalDateTime.now()); +// saveRecord.setDriverStatus(DriverStatusEnum.induction.name()); +//// saveRecord.setUserId(cells[1].getContents()); +//// saveRecord.setRegionId(cells[1].getContents()); +// +// saveRecord.setDriverRegistrationStatus(DriverRegistrationStatusEnum.available.name()); +//// saveRecord.setIllegalAndIllegalInfo(cells[1].getContents()); +//// saveRecord.setInitialLicenseTime(cells[1].getContents()); +//// saveRecord.setQuitTime(cells[1].getContents()); +//// saveRecord.setInductionTime(cells[1].getContents()); +// +//// saveRecord.setReplacementRegistrationStatus(cells[1].getContents()); +//// saveRecord.setContinuingEducationStatus(cells[1].getContents()); +// System.out.println(saveRecord); +// +//// iDriverInfoService.save(saveRecord); +// +// String firmId = cells[53].getContents(); +// if (StringUtils.isNotBlank(firmId)) { +// Company company = companyMap.get(Long.parseLong(firmId)); +// if (Objects.nonNull(company)) { +// saveRecord.setCompanyName(company.getName()); +// saveRecord.setCompanyId(company.getId()); +// saveRecord.setRegionId(company.getRegionId()); +// } +// } +// saveRecordList.add(saveRecord); +// } +// } +// +// List> split = SplitListUtils.split(saveRecordList, 500); +// for (List saveRecordList1 : split) { +// iDriverInfoService.saveBatch(saveRecordList1); +// } +// } catch (IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (BiffException e) { +// e.printStackTrace(); +// } + } + + + @Test + public void test() throws FileNotFoundException { + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\0729\\宁波驾驶员数据.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\0729\\宁波驾驶员数据-8-2.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\0729\\湖州安吉驾驶员.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\0729\\嘉兴驾驶员\\嘉兴驾驶员数据.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\0729\\丽水驾驶员\\丽水驾驶员数据.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\0729\\温州驾驶员\\温州驾驶员数据.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\驾驶员模板.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\金华市驾驶员.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\浙江丽水嘉城混凝土有限公司上岗证.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\台州市驾驶员.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\舟山市驾驶员数据-第一批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\绍兴市驾驶员数据-第一批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\温州平阳驾驶员数据-第二批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\湖州南浔区驾驶员数据-第二批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\丽水遂昌驾驶员数据-第二批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\杭州富阳驾驶员数据-第二批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\杭州淳安驾驶员数据-第三批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\丽水莲都驾驶员数据-第三批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\温州苍南驾驶员数据-第三批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\湖州南浔驾驶员数据-第四批.xlsx"); + //--------------------------------------------------------------------------- + //File f = new File("D:\\work\\水泥车驾驶员数据\\湖州吴兴驾驶员数据-第四批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\湖州长合驾驶员数据-第四批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\衢州常山驾驶员数据-第四批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\衢州江山驾驶员数据-第四批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\衢州开化驾驶员数据-第四批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\衢州龙游驾驶员数据-第四批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\衢州衢江驾驶员数据-第四批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\丽水莲都斯通驾驶员数据-第二批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\衢州衢江市本级驾驶员数据-第四批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\衢州柯城驾驶员数据-第四批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\湖州安吉驾驶员数据-第四批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\嘉兴平湖驾驶员数据-第四批.xlsx"); + //--------------------------------------------------------------------------- + //File f = new File("D:\\work\\水泥车驾驶员数据\\湖州德清驾驶员数据-第五批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\湖州德清驾驶员数据-第五批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\嘉兴经开区驾驶员数据-第六批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\嘉兴海盐县驾驶员数据-第六批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\嘉兴秀洲区驾驶员数据-第六批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\丽水市驾驶员数据-第六批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\台州市驾驶员数据-第六批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\温州龙港市驾驶员数据-第六批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\舟山定海区驾驶员数据-第六批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\舟山高新区驾驶员数据-第六批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\绍兴上虞驾驶员数据-第六批.xlsx"); + //--------------------------------------------------------------------------- + //File f = new File("D:\\work\\水泥车驾驶员数据\\台州市驾驶员数据-第一批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\舟山市驾驶员数据-第七批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\丽水松阳驾驶员数据-第七批.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\温州市驾驶员-第七批-2022-2023.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\温州市驾驶员-第七批-2020-2021.xlsx"); + //File f = new File("D:\\work\\水泥车驾驶员数据\\金华东阳驾驶员数据-第七批.xlsx"); + //--------------------------------------------------------------------------- + //File f = new File("D:\\work\\水泥车驾驶员数据\\杭州钱塘驾驶员数据-第八批.xlsx"); + File f = new File("D:\\work\\水泥车驾驶员数据\\丽水松阳驾驶员数据-第八批.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + List userList = Lists.newArrayList(); + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 根据区县名称获取区域ID + HashSet countySet = new HashSet<>(); + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + // 根据企业名查询企业信息 + HashSet companySet = new HashSet<>(); + Map companyNameMap = companyService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + companySet.add(v.getName())) + .collect(Collectors.toMap(Company::getName, v -> v)); + for (int i = 1; i arrayList = Lists.newArrayList(); + if (motorcycleTypeList.contains(StrPool.DASH)){ + String[] split = motorcycleTypeList.split(StrPool.DASH); + List strings = Arrays.asList(split); + String collect = strings.stream().map(s -> { + DriverVehicleTypeEnum vehicleTypeEnum = DriverVehicleTypeEnum.getEnum(s); + return vehicleTypeEnum.name(); + }).collect(Collectors.joining(StrPool.COMMA)); + arrayList.add(collect); + }else { + DriverVehicleTypeEnum vehicleTypeEnum = DriverVehicleTypeEnum.getEnum(motorcycleTypeList); + if (Objects.nonNull(vehicleTypeEnum)) { + arrayList.add(vehicleTypeEnum.name()); + } + } + driverInfo.setMotorcycleTypeList(JSONObject.toJSONString(arrayList)); + iDriverInfoService.saveOrUpdate(driverInfo); + System.out.println("准备插入 " + i + "条:" + JSON.toJSONString(driverInfo)); + + + //生成合格证信息 + Certificate certificate = new Certificate(); + + certificate.setDriverId(driverInfo.getId()); + certificate.setUserId(driverInfo.getUserId()); + certificate.setDriverName(driverInfo.getDriverName()); + certificate.setBirth(driverInfo.getBirth()); + certificate.setGender(driverInfo.getGender()); + certificate.setNativePlace(driverInfo.getNativePlace()); + certificate.setHealth(driverInfo.getHealth()); + certificate.setPhoneNo(driverInfo.getPhoneNo()); + certificate.setAddress(driverInfo.getAddress()); + certificate.setDriverLicenseType(driverInfo.getDriverLicenseType()); + certificate.setDriverLicenseNo(driverInfo.getDriverLicenseNo()); + // 合格证书编号 + certificate.setCertificateNo(certificateNo); + // 发证单位 + certificate.setIssuedBy(issuedBy); + if (Objects.nonNull(issueDate)) { + certificate.setIssueDate(issueDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + } + if (Objects.nonNull(expiryDate)) { + certificate.setExpiryDate(expiryDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + } + certificate.setRemark(null); + certificate.setRegionId(driverInfo.getRegionId()); + certificate.setRegionName(regionName); + certificate.setCompanyId(driverInfo.getCompanyId()); + certificate.setCompanyName(driverInfo.getCompanyName()); + certificate.setCreateOn(LocalDateTime.now()); + certificate.setUpdateOn(LocalDateTime.now()); + certificate.setCreateBy(2L); + certificateService.save(certificate); + //生成上车分数信息 + DriverScoreInfo driverScoreInfo = new DriverScoreInfo(); + driverScoreInfo.setCreateOn(LocalDateTime.now()); + driverScoreInfo.setCreateBy(2L); + driverScoreInfo.setUserId(driverInfo.getUserId()); + driverScoreInfo.setDriverId(driverInfo.getId()); + driverScoreInfo.setDriverScore(60); + iDriverScoreInfoService.save(driverScoreInfo); + System.out.println("准备插入 " + i + "条合格证信息:" + JSON.toJSONString(certificate)); + } + } + log.info("重复的手机号对应的用户ID为{}",userList.toString()); + System.out.println(userList); + } + + @Test + public void test2() throws FileNotFoundException { + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\0729\\宁波车辆数据.xlsx"); + File f = new File("D:\\work\\水泥车车辆数据\\丽水经济技术开发区车辆数据.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + HashSet useComSet = new HashSet<>(); + HashSet comSet = new HashSet<>(); + HashSet carSet = new HashSet<>(); + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 根据区县名称获取区域ID + HashSet countySet = new HashSet<>(); + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + // 根据企业名查询企业信息 + HashSet companySet = new HashSet<>(); + Map companyNameMap = companyService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + companySet.add(v.getName())) + .collect(Collectors.toMap(Company::getName, v -> v)); + + List baseInfos = vehicleBaseInfoService.list().stream() + .filter(v -> Objects.isNull(v.getCompanyId())).collect(Collectors.toList()); + + Map baseInfoMap = baseInfos.stream() + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + for (int i = 1; i < rownum; i++) { + + NdVehicleBaseInfo vehicleBaseInfo = new NdVehicleBaseInfo(); + + row = sheet.getRow(i); + // 车牌号 + String carPlate = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 车辆类型 + String carType = Objects.nonNull(row.getCell(1)) ? row.getCell(1).toString() : StringUtils.EMPTY; + // 运营商 + String operatorName = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; + // 使用企业 + String useCompanyName = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; + // 所属企业 + String companyName = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY; + NdVehicleBaseInfo baseInfo = baseInfoMap.get(carPlate); + // 车牌号在无所属企业中 + if (Objects.nonNull(baseInfo)){ + vehicleBaseInfo.setId(baseInfo.getId()); + vehicleBaseInfo.setVehicleType(baseInfo.getVehicleType()); + vehicleBaseInfo.setOperatorId(baseInfo.getOperatorId()); + } + vehicleBaseInfo.setCarPlate(carPlate); + if (StringUtils.isNotBlank(carType)) { + vehicleBaseInfo.setVehicleType(VehicleTypeEnum.getCodeByDesc(carType)); + } + if (StringUtils.isNotBlank(operatorName)) { + OperatorQueryDTO operatorDto = operatorsCacheHelper.getByName(operatorName); + vehicleBaseInfo.setOperatorId(operatorDto.getId()); + } + // 更新车辆数据 + Company company = companyNameMap.get(companyName); + vehicleBaseInfo.setRegionId(company.getRegionId()); + vehicleBaseInfo.setRegionName(regionCacheHelper.getDisplayName(company.getRegionId())); + vehicleBaseInfo.setCompanyId(company.getId()); + vehicleBaseInfo.setUseCompanyId(company.getId()); + vehicleBaseInfo.setUseCompanyName(company.getName()); + vehicleBaseInfo.setAuditState(AuditStateEnum.AUDIT_SUCCESS.getCode()); + vehicleBaseInfo.setVehicleStatus(CarStatusEnum.ENABLE.getCode()); + vehicleBaseInfoService.saveOrUpdate(vehicleBaseInfo); + System.out.println("准备插入 " + i + "条:" + JSON.toJSONString(vehicleBaseInfo)); + } + } + } + + @Test + public void test3() throws FileNotFoundException { + File f = new File("D:\\work\\水泥车车辆数据\\非所属企业车辆.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 根据企业名查询企业信息 + HashSet companySet = new HashSet<>(); + Map companyNameMap = companyService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + companySet.add(v.getName())) + .collect(Collectors.toMap(Company::getName, v -> v)); + + Map baseInfoMap = vehicleBaseInfoService.list().stream() + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + List comList = Lists.newArrayList(); + List carList = Lists.newArrayList(); + for (int i = 1; i < rownum; i++) { + + row = sheet.getRow(i); + // 所属企业 + String companyName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 车牌号 + String carPlate = Objects.nonNull(row.getCell(1)) ? row.getCell(1).toString() : StringUtils.EMPTY; + Company company = companyNameMap.get(companyName); + if (Objects.isNull(company)){ + log.info("企业:{} 不在系统中",companyName); + comList.add(companyName); + } + NdVehicleBaseInfo baseInfo = baseInfoMap.get(carPlate); + if (Objects.isNull(baseInfo)){ + log.info("车牌号:{} 不在系统中",carPlate); + carList.add(carPlate); + continue; + } + // 更新车辆信息 + // 如果车辆所在区域、所属企业和公司及所在区域相同,才更新 + Long regionId = baseInfo.getRegionId(); + Long companyId = baseInfo.getCompanyId(); + + Long companyRegionId = company.getRegionId(); + Long id = company.getId(); + + if (Objects.nonNull(regionId) && Objects.nonNull(companyId) + && regionId.equals(companyRegionId) && companyId.equals(id)) { + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(NdVehicleBaseInfo.class); + updateWrapper.set(NdVehicleBaseInfo::getCompanyId, null) + .set(NdVehicleBaseInfo::getUseCompanyId, null) + .set(NdVehicleBaseInfo::getUseCompanyName, null) + .set(NdVehicleBaseInfo::getRegionId, null) + .set(NdVehicleBaseInfo::getRegionName, null) + .eq(NdVehicleBaseInfo::getCarPlate, baseInfo.getCarPlate()); + vehicleBaseInfoService.update(updateWrapper); + System.out.println("准备更新 " + i + "条:" + JSON.toJSONString(baseInfo)); + } + } + } + } + + @Test + public void test4() throws FileNotFoundException { + //File f = new File("D:\\work\\水泥车车辆数据\\丽水中航混凝土有限公司车辆数据.xlsx"); + //File f = new File("D:\\work\\水泥车车辆数据\\丽水莲都区车辆数据-第二批.xlsx"); + //File f = new File("D:\\work\\水泥车车辆数据\\绍兴上虞区车辆数据-第四批.xlsx"); + //File f = new File("D:\\work\\水泥车车辆数据\\舟山定海车辆数据-第五批.xlsx"); + //File f = new File("D:\\work\\水泥车车辆数据\\绍兴柯桥车辆数据-第六批.xlsx"); + File f = new File("D:\\work\\水泥车车辆数据\\丽水松阳车辆数据-第六批.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + HashSet useComSet = new HashSet<>(); + HashSet comSet = new HashSet<>(); + HashSet carSet = new HashSet<>(); + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 根据区县名称获取区域ID + HashSet countySet = new HashSet<>(); + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + // 根据企业名查询企业信息 + HashSet companySet = new HashSet<>(); + Map companyNameMap = companyService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + companySet.add(v.getName())) + .collect(Collectors.toMap(Company::getName, v -> v)); + + // 系统中已经存在的车辆(包括无所属企业的车辆) + List baseInfos = vehicleBaseInfoService.list(); + + Map baseInfoMap = baseInfos.stream() + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + for (int i = 1; i < rownum; i++) { + + NdVehicleBaseInfo vehicleBaseInfo = new NdVehicleBaseInfo(); + + row = sheet.getRow(i); + // 车牌号 + String carPlate = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 车牌颜色 + String plateColor = Objects.nonNull(row.getCell(1)) ? row.getCell(1).toString() : StringUtils.EMPTY; + // 车辆类型 + String vehicleType = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; + // 总质量 + String standardTonnage = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; + // 发动机号 + String engineNo = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY; + // 底盘号 + String chassisNo = Objects.nonNull(row.getCell(5)) ? row.getCell(5).toString() : StringUtils.EMPTY; + // 运营商 + String operatorName = Objects.nonNull(row.getCell(6)) ? row.getCell(6).toString() : StringUtils.EMPTY; + // 责任驾驶员一 + String responsibleDriverFirst = Objects.nonNull(row.getCell(7)) ? row.getCell(7).toString() : StringUtils.EMPTY; + // 责任驾驶员一 电话 + String responsibleDriverFirstMobile = Objects.nonNull(row.getCell(8)) ? row.getCell(8).toString() : StringUtils.EMPTY; + // 排放标准 + String effluentDischargeStandard = Objects.nonNull(row.getCell(9)) ? row.getCell(9).toString() : StringUtils.EMPTY; + // 使用年限 + String usefulLife = Objects.nonNull(row.getCell(10)) ? row.getCell(10).toString() : StringUtils.EMPTY; + // 使用企业 + String useCompanyName = Objects.nonNull(row.getCell(11)) ? row.getCell(11).toString() : StringUtils.EMPTY; + // 所属企业 + String companyName = Objects.nonNull(row.getCell(12)) ? row.getCell(12).toString() : StringUtils.EMPTY; + // 自编号 + String selfNo = Objects.nonNull(row.getCell(13)) ? row.getCell(13).toString() : StringUtils.EMPTY; + // 整备质量 + String selfWeight = Objects.nonNull(row.getCell(14)) ? row.getCell(14).toString() : StringUtils.EMPTY; + NdVehicleBaseInfo baseInfo = baseInfoMap.get(carPlate); + // 车牌号在无所属企业中 + if (Objects.nonNull(baseInfo)){ + vehicleBaseInfo.setId(baseInfo.getId()); + } + vehicleBaseInfo.setCarPlate(carPlate); + vehicleBaseInfo.setPlateColor(plateColor); + if (StringUtils.isNotBlank(vehicleType)) { + vehicleBaseInfo.setVehicleType(VehicleTypeEnum.getCodeByDesc(vehicleType)); + } + vehicleBaseInfo.setStandardTonnage(Double.valueOf(standardTonnage)); + vehicleBaseInfo.setEngineNo(engineNo); + vehicleBaseInfo.setChassisNo(chassisNo); + OperatorQueryDTO operatorDto = operatorsCacheHelper.getByName(operatorName); + if (Objects.nonNull(operatorDto)) { + vehicleBaseInfo.setOperatorId(operatorDto.getId()); + } + vehicleBaseInfo.setResponsibleDriverFirst(responsibleDriverFirst); + vehicleBaseInfo.setResponsibleDriverFirstMobile(responsibleDriverFirstMobile); + vehicleBaseInfo.setEffluentDischargeStandard(effluentDischargeStandard); + if (StringUtils.isNotBlank(usefulLife)) { + Integer life = (int) Double.parseDouble(usefulLife); + vehicleBaseInfo.setUsefulLife(life); + } + if (StringUtils.isNotBlank(selfNo)) { + vehicleBaseInfo.setSelfNo(selfNo); + } + if (StringUtils.isNotBlank(selfWeight)) { + vehicleBaseInfo.setSelfWeight(Double.valueOf(selfWeight)); + } + // 更新车辆数据 + Company company = companyNameMap.get(companyName); + vehicleBaseInfo.setRegionId(company.getRegionId()); + vehicleBaseInfo.setRegionName(regionCacheHelper.getDisplayName(company.getRegionId())); + vehicleBaseInfo.setCompanyId(company.getId()); + vehicleBaseInfo.setUseCompanyId(company.getId()); + vehicleBaseInfo.setUseCompanyName(useCompanyName); + vehicleBaseInfo.setAuditState(AuditStateEnum.AUDIT_SUCCESS.getCode()); + vehicleBaseInfo.setVehicleStatus(CarStatusEnum.ENABLE.getCode()); + vehicleBaseInfoService.saveOrUpdate(vehicleBaseInfo); + System.out.println("准备插入 " + i + "条:" + JSON.toJSONString(vehicleBaseInfo)); + } + } + } + + @Test + public void test5(){ + //String username = "dImMTGYAPmUVoRZFly0RTadTvwASVSizaSuH9LFstFJb3t1Izz4HxlNUcE1x7VfwxJDHeWmQOL8Tl/KdWFZXC6lfyfoh1l4jEyInvgHIEBI9cHfxg14IcvCMZ/mEfdcn/BovjSc52vQuBy+EnD65zj6VUiCSJbssleqWjfSKWVc="; + String pwd = "ThcjwYO/IU1IKdQ5CivzyVreUBLXK79Qhe6DzEhjNWwOf3iGtz8yM0oUG8Ffhy2WqKEqXZ09vSBQm5uSY/U1Yyl2+j1NRIVAg3N5Q6n3nNV5lVFNSoCqhc8vGkRZArkOFJ1Pk5wDn45SHomB2LzKFiDUeckAkIR7RBKkVpfKFPQ="; + // 将获取到的经过RSA公钥加密后的用户名解密 + RSA rsa = new RSA(privateKey, publicKey); + + // 密码的密文先进行base64解码,之后再进行解密 + //String decryptStr = rsa.decryptStr(username, KeyType.PrivateKey); + String decryptStr = rsa.decryptStr(pwd, KeyType.PrivateKey); + //byte[] decrypt = rsa.decrypt(Base64.decode(username), KeyType.PrivateKey); + //String decryptStr = StrUtil.str(decrypt, CharsetUtil.CHARSET_UTF_8); + + System.out.println("解密后的用户名为:" + decryptStr); + } + + @Test + public void test6() throws FileNotFoundException { + File f = new File("D:\\work\\水泥车安全通报\\事故车牌号.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + List carPlates = Lists.newArrayList(); + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + // 车牌号 + String carPlate = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + StringBuilder sb = new StringBuilder(); + sb.append("\"" + carPlate + "\""); + String s = sb.toString(); + carPlates.add(s); + } + + String collect = carPlates.stream().collect(Collectors.joining(StrPool.COMMA)); + System.out.println(collect); + } + } + + @Test + public void test7(){ + // 获取系统车辆信息 + List baseInfos = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getAuditState, AuditStateEnum.AUDIT_SUCCESS.getCode()) + .select(NdVehicleBaseInfo::getCarPlate, NdVehicleBaseInfo::getVehicleType)); + if (CollUtil.isNotEmpty(baseInfos)) { + baseInfos.stream().filter(v -> StringUtils.isNotBlank(v.getCarPlate()) && Objects.nonNull(v.getVehicleType())) + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, NdVehicleBaseInfo::getVehicleType)); + } + } + + //这个下面是单独函数 + public static org.apache.poi.ss.usermodel.Workbook readExcel(InputStream is, String extString){ + Workbook wb = null; + extString = extString.substring(extString.lastIndexOf(".")); + try { + if(".xls".equals(extString)){ + return wb = new HSSFWorkbook(is); + }else if(".xlsx".equals(extString)){ + return wb = new XSSFWorkbook(is); + }else { + return wb = null; + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wb; + } + + //public fileout void main(String[] args) { + // String a = "2023-02-06"; + // LocalDateTime birthTime = LocalDateTime.parse(a, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)); + // System.out.println(birthTime); + //} + +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/driver/DriverStarDataImportTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/driver/DriverStarDataImportTest.java new file mode 100644 index 0000000..d233553 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/driver/DriverStarDataImportTest.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.driver; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.driver.entity.DriverInfo; +import com.ningdatech.carapi.driver.entity.StarManage; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.driver.service.IStarManageService; +import org.junit.Assert; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2022/11/16 下午2:56 + */ + +class DriverStarDataImportTest extends AppTests { + + @Autowired + private IDriverInfoService iDriverInfoService; + + @Autowired + private IStarManageService iStarManageService; + + + @Test + void importData() throws Exception { +// long count = iDriverInfoService.count(Wrappers.lambdaQuery(DriverInfo.class) +// .isNotNull(DriverInfo::getCompanyId)); + int pageNumber = 1; + int pageSize = 500; + + while (true) { + Page page = iDriverInfoService.page(new Page<>(pageNumber, pageSize), Wrappers.lambdaQuery(DriverInfo.class) + .isNotNull(DriverInfo::getCompanyId).orderByAsc(DriverInfo::getId)); + if (page.getTotal() == 0) { + return; + } + pageNumber++; + List records = page.getRecords(); + List collect = records.stream().map(r -> { + StarManage starManage = new StarManage(); + starManage.setCreateOn(LocalDateTime.now()); + starManage.setUpdateOn(LocalDateTime.now()); + starManage.setDriverId(r.getId()); + starManage.setDriverName(r.getDriverName()); + starManage.setCompanyId(r.getCompanyId()); + starManage.setCompanyName(r.getCompanyName()); + starManage.setRegionId(r.getRegionId()); + starManage.setAccidentsCnt(0); + starManage.setInjuredCnt(0); + starManage.setInsuranceCnt(0); + starManage.setInjuredCnt(0); + starManage.setCurrentStar(5D); + starManage.setDeductStar(0D); + starManage.setAccidentsCnt(0); + return starManage; + }).collect(Collectors.toList()); + Assert.assertTrue(iStarManageService.saveBatch(collect)); + } + } + + +} \ No newline at end of file diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/driver/SplitListUtils.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/driver/SplitListUtils.java new file mode 100644 index 0000000..81c5e1d --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/driver/SplitListUtils.java @@ -0,0 +1,27 @@ +package com.ningdatech.carapi.driver; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author liuxinxin + * @date 2022/8/23 下午4:31 + */ + +public class SplitListUtils { + + public static List> split(List list, int groupSize) { + int length = list.size(); + // 计算可以分成多少组 + int num = (length + groupSize - 1) / groupSize; + List> newList = new ArrayList<>(num); + for (int i = 0; i < num; i++) { + // 开始位置 + int fromIndex = i * groupSize; + // 结束位置 + int toIndex = (i + 1) * groupSize < length ? (i + 1) * groupSize : length; + newList.add(list.subList(fromIndex, toIndex)); + } + return newList; + } +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/loginbycode/AliSmsTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/loginbycode/AliSmsTest.java new file mode 100644 index 0000000..d5db6a0 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/loginbycode/AliSmsTest.java @@ -0,0 +1,39 @@ +package com.ningdatech.carapi.loginbycode; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; +import com.ningdatech.carapi.loginbycode.utils.AliSmsUtil; + +/** + * @author CMM + * @since 2022/12/28 14:44 + */ + +public class AliSmsTest { + public static void main(String[] args) { + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String sd = sdf.format(new Date()); + String phone = "********"; + String template = "********"; + String name = "********"; + Map map = new HashMap<>(4); + map.put("transportNo",name); + map.put("hour",sd); + // 对象转json + JSONObject jsonObject = (JSONObject) JSONObject.toJSON(map); + AliSmsUtil aliSmsUtil = new AliSmsUtil(); + // 发送短信 + SendSmsResponse sendSmsResponse = aliSmsUtil.sendSms(phone,jsonObject,template); + if("OK".equals(sendSmsResponse.getCode())){ + System.out.println("发送成功"); + }else { + System.out.println("发送失败"); + } + } +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/loginbycode/config/Config.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/loginbycode/config/Config.java new file mode 100644 index 0000000..bbda9ae --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/loginbycode/config/Config.java @@ -0,0 +1,35 @@ +package com.ningdatech.carapi.loginbycode.config; + +/** + * @author CMM + * @since 2022/12/28 14:00 + */ + +public class Config { + // 所有参数,可自定义根据需求,配置成application.properties 用@value()注入 + /** + * 产品名称: 云通信短信API产品,开发者无需替换 + */ + public static final String PRODUCT = "Dysmsapi"; + + /** + * 产品域名,开发者无需更换 + */ + public static final String DOMAIN = "dysmsapi.aliyuncs.com"; + + /** + * 开发者自己的AccessKeyID + */ + public static final String ACCESS_KEYID = "********"; + + /** + * 开发者自己的AccessKeySecret + */ + public static final String ACCESSKEY_SECRET = "********"; + + /** + * 短信签名--可在短信控制台中找到 + */ + public static final String SIGN = "****"; + +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/loginbycode/utils/AliSmsUtil.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/loginbycode/utils/AliSmsUtil.java new file mode 100644 index 0000000..b9b7836 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/loginbycode/utils/AliSmsUtil.java @@ -0,0 +1,106 @@ +package com.ningdatech.carapi.loginbycode.utils; + +import static com.ningdatech.carapi.loginbycode.config.Config.*; + +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest; +import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; +import com.aliyuncs.exceptions.ClientException; +import com.aliyuncs.http.FormatType; +import com.aliyuncs.http.MethodType; +import com.aliyuncs.profile.DefaultProfile; +import com.aliyuncs.profile.IClientProfile; + +/** + * @author ouj + * 版本: 阿里云云通信 + * jar包: aliyun-java-sdk-core and aliyun-java-sdk-dysmsapi + * 编码格式:UTF-8 + * 需要参数: 签名名称 / 模板code / RAM访问控制中的 AccessKeyID 和 AccessKeySecret + */ +public class AliSmsUtil { + + /** + * IAcsClient是aliyun-java-sdk-green的Java客户端。使用aliyun-java-sdk-green Java SDK发起请求前,您需要初始化一个IAcsClient实例,并根据需要修改IClientProfile的配置项。 + */ + public IAcsClient acsClient; + + /** + * 配置超时时间,初始化acsClient + * + * @return + * @throws + */ + public IAcsClient getInstant() throws ClientException { + if (acsClient == null) { + // 配置超时时间 + System.setProperty("sun.net.client.defaultConnectTimeout", "10000"); + System.setProperty("sun.net.client.defaultReadTimeout", "10000"); + //初始化acsClient,暂不支持region化 + IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", ACCESS_KEYID, ACCESSKEY_SECRET); + DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", PRODUCT, DOMAIN); + return acsClient = new DefaultAcsClient(profile); + } + return acsClient; + } + + /** + * 创建短信发送请求 + * @param mobile 手机号 + * @param jsonObject json数据 + * @param templateCode 短信模板 + * @return + * @throws ClientException + */ + public SendSmsResponse getSmsCodeClient(String mobile, JSONObject jsonObject, String templateCode) throws ClientException { + //组装请求对象-具体描述见控制台-文档部分内容 + SendSmsRequest request = new SendSmsRequest(); + //修改数据提交方式 + request.setMethod(MethodType.POST); + //修改数据交互格式 + request.setAcceptFormat(FormatType.JSON); + //必填:待发送手机号 + request.setPhoneNumbers(mobile); + //必填:短信签名-可在短信控制台中找到 + request.setSignName(SIGN); + //必填:短信模板-可在短信控制台中找到 + request.setTemplateCode(templateCode); + //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为 + request.setTemplateParam(jsonObject.toString()); + + return getInstant().getAcsResponse(request); + } + + /** + * 发送短信 + * + * @param mobile 手机号码 + * @param jsonObject json数据 + * @param templateCode 短信模板 + * @return + */ + public SendSmsResponse sendSms(String mobile, JSONObject jsonObject, String templateCode) { + SendSmsResponse smsResponse = null; + try{ + smsResponse = getSmsCodeClient(mobile,jsonObject,templateCode); + } catch (ClientException e) { + e.printStackTrace(); + } + // 发生业务错误 + if ("isv.BUSINESS_LIMIT_CONTROL".equals(smsResponse.getCode())) { + String message = smsResponse.getMessage(); + String limitNum = message.substring(message.length() - 1); + if ("5".equals(limitNum)) { + // 此处可自定义业务异常 + throw new RuntimeException("获取次数已达上线,请过一小时再试"); + } else if (limitNum.equals("0")) { + throw new RuntimeException("获取次数已达上线,请明日再试"); + } else if (limitNum.equals("1")) { + throw new RuntimeException("获取次数已达上线,请过一分钟再试"); + } + } + return smsResponse; + } +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/open/OpenApiTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/open/OpenApiTest.java new file mode 100644 index 0000000..ba49bf3 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/open/OpenApiTest.java @@ -0,0 +1,294 @@ +package com.ningdatech.carapi.open; + +import java.sql.Timestamp; +import java.time.Duration; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.stream.Collectors; + +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.cache.redis.RedisOps; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.homepage.entity.model.OnlineNumCnt; +import com.ningdatech.carapi.irs.model.entity.VehicleAccidentIrsData; +import com.ningdatech.carapi.irs.service.IVehicleAccidentIrsDataService; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.date.StopWatch; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; +import lombok.extern.slf4j.Slf4j; + +/** + * @Classname OpenApiTest + * @Description + * @Date 2022/11/3 10:47 + * @Created by PoffyZhang + */ +@Slf4j +public class OpenApiTest extends AppTests { + + @Autowired + private IVehicleBaseInfoService vehicleBaseInfoService; + @Autowired + private CachePlusOps cachePlusOps; + @Autowired + private IVehicleAccidentIrsDataService accidentIrsDataService; + + @Autowired + private RedisOps redisOps; + + + @Test + public void test(){ + + TreeMap fieldMap = new TreeMap<>(); + fieldMap.put("appKey","test"); + fieldMap.put("timestamps","1667444946960"); + fieldMap.put("originPicId","0000001"); + fieldMap.put("vehicleIndexCode","10000001"); + fieldMap.put("vehicleSelfNo","20000001"); + fieldMap.put("cameraIndexCode","sssss00001"); + fieldMap.put("cameraName","监控点1"); + fieldMap.put("uploadType","2"); + fieldMap.put("alarmId","300000001"); + fieldMap.put("alarmType","1001"); + fieldMap.put("alarmTypeName","开车接听电话"); + fieldMap.put("captureTime","2022-10-28"); + fieldMap.put("url","https://www.baidu.com"); + fieldMap.put("thumbUrl","1"); + fieldMap.put("parentPicId","1"); + fieldMap.put("faceRect","2"); + fieldMap.put("picType","3"); + fieldMap.put("plateNo","浙Axxxx"); + fieldMap.put("regionIndexCode","330107"); + fieldMap.put("regionName","滨江区"); + fieldMap.put("serialVersionUID","1"); + String appSecret = "test"; + String str = "{\"appKey\":\"test\",\"timestamps\":1667444946960,\"originPicId\":\"0000001\",\"vehicleIndexCode\":\"10000001\",\"vehicleSelfNo\":\"20000001\",\"cameraIndexCode\":\"sssss00001\",\"cameraName\":\"监控点1\",\"uploadType\":2,\n" + + " \"alarmId\":\"300000001\",\"alarmType\":\"1001\",\"alarmTypeName\":\"开车接听电话\",\"captureTime\":\"2022-10-28\",\"url\":\"https://www.baidu.com\",\"thumbUrl\":\"1\",\n" + + " \"parentPicId\":\"1\",\"faceRect\":\"2\",\"picType\":\"3\",\"plateNo\":\"浙Axxxx\",\"regionIndexCode\":\"330107\",\"regionName\":\"滨江区\"}"; +// TreeMap fieldMap = jsonStrToMap(str); + String paramStr = fieldMap.entrySet().stream() + .map(w -> w.getKey() + "=" + w.getValue()) + .collect(Collectors.joining("&")); + String hex = SecureUtil.hmacMd5(appSecret).digestHex(paramStr); + System.out.println(hex); + } + + @Test + public void sysout(){ + System.out.println(System.currentTimeMillis()); + } + + @Test + public void video(){ + TreeMap fieldMap = new TreeMap<>(); + fieldMap.put("appKey","test"); + fieldMap.put("timestamps","1667444946960"); + fieldMap.put("orginVideoId","0000001"); + fieldMap.put("serviceIndexCode","4000001"); + fieldMap.put("recordIndexCode","0001"); + fieldMap.put("vehicleIndexCode","10000001"); + fieldMap.put("vehicleSelfNo","20000001"); + fieldMap.put("cameraIndexCode","sssss00001"); + fieldMap.put("cameraName","监控点1"); + fieldMap.put("alarmId","300000001"); + fieldMap.put("alarmTime","2022-11-06 00:00:00"); + fieldMap.put("alarmType","1001"); + fieldMap.put("alarmTypeName","开车接听电话"); + fieldMap.put("url","https://www.baidu.com"); + fieldMap.put("coverUrl","1"); + fieldMap.put("beginTime","2022-11-02 00:00:00"); + fieldMap.put("endTime","2022-11-02 00:00:00"); + fieldMap.put("streamBeginTime","2022-11-02 00:00:00"); + fieldMap.put("streamEndTime","2022-11-02 00:00:00"); + fieldMap.put("regionIndexCode","330107"); + fieldMap.put("regionName","滨江区"); + fieldMap.put("videoLength","60"); + fieldMap.put("plateNo","浙Axxxx"); + fieldMap.put("serialVersionUID","1"); + String appSecret = "test"; + String str = "{\"appKey\":\"test\",\"timestamps\":1667444946960,\"originPicId\":\"0000001\",\"vehicleIndexCode\":\"10000001\",\"vehicleSelfNo\":\"20000001\",\"cameraIndexCode\":\"sssss00001\",\"cameraName\":\"监控点1\",\"uploadType\":2,\n" + + " \"alarmId\":\"300000001\",\"alarmType\":\"1001\",\"alarmTypeName\":\"开车接听电话\",\"captureTime\":\"2022-10-28\",\"url\":\"https://www.baidu.com\",\"thumbUrl\":\"1\",\n" + + " \"parentPicId\":\"1\",\"faceRect\":\"2\",\"picType\":\"3\",\"plateNo\":\"浙Axxxx\",\"regionIndexCode\":\"330107\",\"regionName\":\"滨江区\"}"; +// TreeMap fieldMap = jsonStrToMap(str); + String paramStr = fieldMap.entrySet().stream() + .map(w -> w.getKey() + "=" + w.getValue()) + .collect(Collectors.joining("&")); + String hex = SecureUtil.hmacMd5(appSecret).digestHex(paramStr); + System.out.println(hex); + } + + private final Integer cnt1 = 0; + @Test + public void onlineNum(){ + // 获取所有车辆信息 + List vehicleBaseInfos = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .select(NdVehicleBaseInfo::getCarPlate, NdVehicleBaseInfo::getOperatorId, + NdVehicleBaseInfo::getId)); + + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + Map onlineMap = redisOps.hGetAll("online_index"); + // 分批 + List> batchList = new ArrayList<>(ListUtil.partition(new ArrayList<>(vehicleBaseInfos), 5000)); + // 创建线程池 线程数是 分批的数 + ExecutorService executorService = Executors.newFixedThreadPool(batchList.size()); + //线程计数器,就是 分批的数 + CountDownLatch countDownLatch = new CountDownLatch(batchList.size()); + List cntList = Lists.newArrayList(); + batchList.forEach(e -> { + //每个分批用一个线程执行 + executorService.execute(()->{ + List result = e.stream().filter(v -> { + // 取到每个数据进行业务执行 + String carPlate = v.getCarPlate(); + LocalDateTime startTime = LocalDateTime.now(); + Integer timeStamp = onlineMap.get(carPlate); + if (Objects.nonNull(timeStamp)) { + // 将时间戳转换为Instant对象 + Instant instant = Instant.ofEpochSecond(timeStamp); + // 将Instant对象转换为LocalDateTime对象 + LocalDateTime endTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + Duration minuteDuration = Duration.between(startTime, endTime); + long minute = minuteDuration.toMinutes(); + // 判断最后一次上传时间距离当前时间是否大于5分钟 + if (minute <= 5) { + return true; + } + } + return false; + }).collect(Collectors.toList()); + OnlineNumCnt onlineNumCnt = new OnlineNumCnt(); + onlineNumCnt.setCnt(result.size()); + cntList.add(onlineNumCnt); + }); + countDownLatch.countDown(); + }); + + stopWatch.stop(); + log.info("共耗时 {}s", stopWatch.getTotalTimeSeconds()); + int cnt = 0; + for (OnlineNumCnt onlineNumCnt : cntList) { + Integer onlineNum = onlineNumCnt.getCnt(); + cnt = cnt + onlineNum; + } + log.info("缓存中车辆在线数为:" + cnt); + } + + @Test + public void jsonTest(){ + // 获取车牌号的所有事故信息 + //Map> accidentIrsDataMap = accidentIrsDataService.list().stream() + // .collect(Collectors.groupingBy(VehicleAccidentIrsData::getCarPlate)); + + // 获取车牌号的所有事故信息 + Map> accidentIrsDataMap = null; + //String dataJsonStr = "{\"code\":\"00\",\"msg\":\"成功\",\"data\":\"\",\"datas\":\"[[{\\\"TJSGBH\\\":null,\\\"LM\\\":\\\"海\n" + + // "宁市农丰路\\\",\\\"CLJSG\\\":\\\"6\\\",\\\"SSRS\\\":0,\\\"LWSGLX\\\":null,\\\"BADW\\\":\\\"海宁市公安局交通警察大队\\\",\\\"DCSG\\\":null,\\\"SCSJD\\\":0,\\\"RDYYFL\\\":null,\\\"GLS\\\":1003,\\\"SB\\\":null,\\\"GLBM\\\":\\\"330481006200\\\",\\\"SGFSSJ\\\":1678750636000\n" + + // ",\\\"CCLRSJ\\\":1678751217000,\\\"SGRDYY\\\":null,\\\"JBR\\\":\\\"朱洁林\\\",\\\"ZBLX\\\":null,\\\"JYAQ\\\":\\\"2023年03月14日07时37分许,朱晨霓 (驾驶证号:330481198408070022) 驾驶车辆号牌浙F9230F小型汽车,在浙江省嘉兴市海宁市硖石街道农丰\n" + + // "路南苑路口 与田夫勇 (驾驶证号:371322197609083813) 驾驶车辆号牌浙FM8761大型汽车发生交通事故。当事人朱晨霓转弯未让直行车辆先行负全责;当事人田夫勇负无责。\\\",\\\"DZZB\\\":\\\"120.700542,30.514331\\\",\\\"SWSG\\\":null,\\\"SJHM1\\\n" + + // "\":\\\"13656604531\\\",\\\"SJHM2\\\":null,\\\"MS\\\":0,\\\"GXSJ\\\":1678751230000,\\\"JYW\\\":\\\"59076598972026599116453825079992\\\",\\\"DAH\\\":null,\\\"XC\\\":null,\\\"DJBH\\\":\\\"33048120230011595\\\",\\\"JLLX\\\":null,\\\"SSZD\\\":\\\"330481006200\\\",\\\"GLX\n" + + // "ZDJ\\\":null,\\\"XZQH\\\":\\\"330481\\\",\\\"PZFS\\\":null,\\\"SGDD\\\":\\\"海宁市农丰路(南苑路口)\\\",\\\"TJR1\\\":null,\\\"LBQK\\\":null,\\\"DLLX\\\":\\\"22\\\",\\\"SFZMHM1\\\":\\\"330482198203205719\\\",\\\"SGXT\\\":\\\"11\\\",\\\"ZJCCSS\\\":1,\\\"SFZMHM2\\\":null,\\\"XQ\\\n" + + // "\":2,\\\"LH\\\":\\\"67014\\\",\\\"SGBH\\\":\\\"330481420230011578\\\",\\\"TQ\\\":\\\"1\\\",\\\"JDWZ\\\":550},{\\\"TJSGBH\\\":null,\\\"LM\\\":\\\"海宁市马桥街道经编四路\\\",\\\"CLJSG\\\":\\\"9\\\",\\\"SSRS\\\":0,\\\"LWSGLX\\\":null,\\\"BADW\\\":\\\"海宁市公安局交通警察大队\\\"\n" + + // ",\\\"DCSG\\\":null,\\\"SCSJD\\\":0,\\\"RDYYFL\\\":null,\\\"GLS\\\":1002,\\\"SB\\\":null,\\\"GLBM\\\":\\\"330481005200\\\",\\\"SGFSSJ\\\":1678848921000,\\\"CCLRSJ\\\":1678852288000,\\\"SGRDYY\\\":null,\\\"JBR\\\":\\\"刘晓林\\\",\\\"ZBLX\\\":null,\\\"JYAQ\\\":\\\"2023年0\n" + + // "3月15日10时55分许,史帅彪 (驾驶证号:412326199705092718) 驾驶车辆号牌浙F2BL86轻型货车,在浙江省嘉兴市海宁市马桥街道经编四路16号海宁市彩达包装材料有限公司厂内 因操作失误与田夫勇 (驾驶证号:371322197609083813) 驾驶\n" + + // "车辆号牌浙FM8761重型货车发生交通事故,造成财产损失,当事人史帅彪负全责,当事人田夫勇负无责;。\\\",\\\"DZZB\\\":\\\"120.678630,30.479932\\\",\\\"SWSG\\\":null,\\\"SJHM1\\\":\\\"15167388545\\\",\\\"SJHM2\\\":null,\\\"MS\\\":0,\\\"GXSJ\\\":1678852\n" + + // "301000,\\\"JYW\\\":\\\"99790670379267313188861065794064\\\",\\\"DAH\\\":null,\\\"XC\\\":null,\\\"DJBH\\\":\\\"33048120230011858\\\",\\\"JLLX\\\":null,\\\"SSZD\\\":\\\"330481005200\\\",\\\"GLXZDJ\\\":null,\\\"XZQH\\\":\\\"330481\\\",\\\"PZFS\\\":null,\\\"SGDD\\\":\\\"海\n" + + // "宁市马桥街道经编四路(经编三路至新民路)\\\",\\\"TJR1\\\":null,\\\"LBQK\\\":null,\\\"DLLX\\\":\\\"29\\\",\\\"SFZMHM1\\\":\\\"33048119881119501X\\\",\\\"SGXT\\\":\\\"12\\\",\\\"ZJCCSS\\\":1000,\\\"SFZMHM2\\\":null,\\\"XQ\\\":3,\\\"LH\\\":\\\"97010\\\",\\\"SGBH\\\":\\\"33048\n" + + // "1420230011840\\\",\\\"TQ\\\":\\\"1\\\",\\\"JDWZ\\\":200},{\\\"TJSGBH\\\":null,\\\"LM\\\":\\\"常海线(G524)\\\",\\\"CLJSG\\\":\\\"7\\\",\\\"SSRS\\\":1,\\\"LWSGLX\\\":null,\\\"BADW\\\":\\\"海宁市公安局交通警察大队\\\",\\\"DCSG\\\":null,\\\"SCSJD\\\":0,\\\"RDYYFL\\\":null,\\\"\n" + + // "GLS\\\":180,\\\"SB\\\":\\\"1\\\",\\\"GLBM\\\":\\\"330481000000\\\",\\\"SGFSSJ\\\":1679614140000,\\\"CCLRSJ\\\":1679630991000,\\\"SGRDYY\\\":null,\\\"JBR\\\":\\\"韩家振\\\",\\\"ZBLX\\\":\\\"2\\\",\\\"JYAQ\\\":\\\" 2023年03月24日07时29分,徐银甫(男,65岁)驾驶车\n" + + // "牌号为浙FCZ483的普通摩托车,沿常海线(G524)行驶至常海线(G524)185KM+382M海宁市汇浪桥路段时,与田夫勇(男,47岁)驾驶车牌号为浙FM8761的重型货车碰撞运动车辆,致受伤1人,直接财产损失1000元的交通事故。\\\\r\\\\n 当事\n" + + // "人徐银甫负全部责任;当事人田夫勇无责任。\\\",\\\"DZZB\\\":null,\\\"SWSG\\\":null,\\\"SJHM1\\\":\\\"13806703150\\\",\\\"SJHM2\\\":null,\\\"MS\\\":10,\\\"GXSJ\\\":1679631053000,\\\"JYW\\\":\\\"07721463458575243981940373724857\\\",\\\"DAH\\\":null,\\\"XC\\\":n\n" + + // "ull,\\\"DJBH\\\":\\\"33048120230013692\\\",\\\"JLLX\\\":\\\"1\\\",\\\"SSZD\\\":null,\\\"GLXZDJ\\\":\\\"1\\\",\\\"XZQH\\\":\\\"330481\\\",\\\"PZFS\\\":null,\\\"SGDD\\\":\\\"常海线(G524)185KM+382M海宁市汇浪桥路段\\\",\\\"TJR1\\\":\\\"韩家振\\\",\\\"LBQK\\\":null,\\\"DLLX\\\"\n" + + // ":\\\"11\\\",\\\"SFZMHM1\\\":\\\"330419197212202035\\\",\\\"SGXT\\\":\\\"11\\\",\\\"ZJCCSS\\\":1000,\\\"SFZMHM2\\\":null,\\\"XQ\\\":5,\\\"LH\\\":\\\"10524\\\",\\\"SGBH\\\":\\\"330481420230013673\\\",\\\"TQ\\\":\\\"2\\\",\\\"JDWZ\\\":180010},{\\\"TJSGBH\\\":null,\\\"LM\\\":\\\"常海\n" + + // "线(G524)\\\",\\\"CLJSG\\\":\\\"9\\\",\\\"SSRS\\\":0,\\\"LWSGLX\\\":null,\\\"BADW\\\":\\\"海宁市公安局交通警察大队\\\",\\\"DCSG\\\":null,\\\"SCSJD\\\":112,\\\"RDYYFL\\\":null,\\\"GLS\\\":200,\\\"SB\\\":\\\"1\\\",\\\"GLBM\\\":\\\"330481000300\\\",\\\"SGFSSJ\\\":16796141400\n" + + // "00,\\\"CCLRSJ\\\":1689321834000,\\\"SGRDYY\\\":null,\\\"JBR\\\":\\\"陆远\\\",\\\"ZBLX\\\":\\\"2\\\",\\\"JYAQ\\\":\\\" 2023年03月24日07时29分,徐银甫(男,65岁),骑其它,沿常海线(G524)行驶至常海线(G524)1公里111米时,与田夫勇(男,47岁)驾\n" + + // "驶车牌号为浙FM8761的重型货车碰撞运动车辆,致直接财产损失0元的交通事故。\\\\r\\\\n 当事人徐银甫负全部责任;当事人田夫勇无责任。\\\",\\\"DZZB\\\":null,\\\"SWSG\\\":null,\\\"SJHM1\\\":\\\"18457370603\\\",\\\"SJHM2\\\":\\\"13819319909\\\",\\\"M\n" + + // "S\\\":111,\\\"GXSJ\\\":1689321834000,\\\"JYW\\\":\\\"05491240436273013758918071494634\\\",\\\"DAH\\\":null,\\\"XC\\\":null,\\\"DJBH\\\":\\\"33048120230037409\\\",\\\"JLLX\\\":\\\"1\\\",\\\"SSZD\\\":\\\"330481005000\\\",\\\"GLXZDJ\\\":\\\"1\\\",\\\"XZQH\\\":\\\"330481\\\",\\\n" + + // "\"PZFS\\\":null,\\\"SGDD\\\":\\\"常海线(G524)1公里111米\\\",\\\"TJR1\\\":\\\"陆远\\\",\\\"LBQK\\\":null,\\\"DLLX\\\":\\\"11\\\",\\\"SFZMHM1\\\":\\\"330481199506031216\\\",\\\"SGXT\\\":\\\"11\\\",\\\"ZJCCSS\\\":0,\\\"SFZMHM2\\\":\\\"362426198008191311\\\",\\\"XQ\\\":5,\\\"LH\n" + + // "\\\":\\\"10524\\\",\\\"SGBH\\\":\\\"330481420230037382\\\",\\\"TQ\\\":\\\"1\\\",\\\"JDWZ\\\":200111}]]\",\"requestId\":\"60fb9ddf73b5ce135647e724e62428ae\",\"dataCount\":1,\"totalDataCount\":0,\"totalPage\":1}"; + + String dataJsonStr = "{\"code\":\"00\",\"msg\":\"成功\",\"data\":\"\",\"datas\":\"[[{\\\"TJSGBH\\\":null,\\\"LM\\\":\\\"海\n" + + "宁市俞家桥路\\\",\\\"CLJSG\\\":\\\"1\\\",\\\"SSRS\\\":0,\\\"LWSGLX\\\":null,\\\"BADW\\\":\\\"海宁市公安局交通警察大队\\\",\\\"DCSG\\\":null,\\\"SCSJD\\\":0,\\\"RDYYFL\\\":null,\\\"GLS\\\":1007,\\\"SB\\\":null,\\\"GLBM\\\":\\\"330481006200\\\",\\\"SGFSSJ\\\":16874026470\n" + + "00,\\\"CCLRSJ\\\":1687403022000,\\\"SGRDYY\\\":null,\\\"JBR\\\":\\\"朱洁林\\\",\\\"ZBLX\\\":null,\\\"JYAQ\\\":\\\"2023年06月22日10时57分许,刘刚 (驾驶证号:341223198107042130) 驾驶车辆号牌浙F3KH62小型汽车,在浙江省嘉兴市海宁市硖石街道俞家\n" + + "桥路东山公园 与代伟 (驾驶证号:510525199401023015) 驾驶车辆号牌浙FM9199小型汽车发生交通事故,造成两车损坏。当事人刘刚负无责;当事人代伟的行为违反在同车道行驶中,不按规定与前车保持必要的安全距离的 ,负全责。\\\",\\\"D\n" + + "ZZB\\\":\\\"120.699347,30.531393\\\",\\\"SWSG\\\":null,\\\"SJHM1\\\":\\\"13656604531\\\",\\\"SJHM2\\\":null,\\\"MS\\\":0,\\\"GXSJ\\\":1687403047000,\\\"JYW\\\":\\\"85919282240453431800722251912676\\\",\\\"DAH\\\":null,\\\"XC\\\":null,\\\"DJBH\\\":\\\"330481202300\n" + + "32093\\\",\\\"JLLX\\\":null,\\\"SSZD\\\":\\\"330481006200\\\",\\\"GLXZDJ\\\":null,\\\"XZQH\\\":\\\"330481\\\",\\\"PZFS\\\":null,\\\"SGDD\\\":\\\"海宁市俞家桥路(北关桥路口)\\\",\\\"TJR1\\\":null,\\\"LBQK\\\":null,\\\"DLLX\\\":\\\"22\\\",\\\"SFZMHM1\\\":\\\"330482198203205\n" + + "719\\\",\\\"SGXT\\\":\\\"11\\\",\\\"ZJCCSS\\\":1,\\\"SFZMHM2\\\":null,\\\"XQ\\\":4,\\\"LH\\\":\\\"67012\\\",\\\"SGBH\\\":\\\"330481420230032068\\\",\\\"TQ\\\":\\\"2\\\",\\\"JDWZ\\\":860}]]\",\"requestId\":\"4b54394e5e7ec319ee991add8f9f69b9\",\"dataCount\":1,\"totalData\n" + + "Count\":0,\"totalPage\":1}"; + + JSONObject object = JSON.parseObject(dataJsonStr, JSONObject.class); + String data = object.getString("datas"); + List array = JSON.parseArray(data, String.class); + if (CollUtil.isEmpty(array)) { + log.info("该车牌号没有事故信息!"); + return; + } + String carPlate = "浙FM8761"; + if (CollUtil.isEmpty(array)) { + log.info("该车牌号没有事故信息!"); + return; + } + for (String datas : array) { + if (StrUtil.isNotBlank(datas)) { + List accidentArray = JSON.parseArray(datas, JSONObject.class); + if (CollUtil.isEmpty(accidentArray)) { + log.info("该车牌号没有事故信息!"); + continue; + } + + for (JSONObject jsonObject : accidentArray) { + VehicleAccidentIrsData accidentIrsData = new VehicleAccidentIrsData(); + accidentIrsData.setCarPlate(carPlate); + String jsonString = jsonObject.toJSONString(); + accidentIrsData.setJsonStrData(jsonString); + // 获取事故日期 + Timestamp sgfssj = jsonObject.getTimestamp("SGFSSJ"); + LocalDateTime accidentTime = LocalDateTimeUtil.of(sgfssj); + if (accidentIrsDataMap.containsKey(carPlate)) { + List dataList = accidentIrsDataMap.get(carPlate); + Map dataMap = dataList.stream() + .collect(Collectors.toMap(VehicleAccidentIrsData::getAccidentTime, v -> v)); + if (dataMap.containsKey(accidentTime)) { + VehicleAccidentIrsData irsData = dataMap.get(accidentTime); + // 数据已经存在 + accidentIrsData.setId(irsData.getId()); + } + } + accidentIrsData.setAccidentTime(accidentTime); + accidentIrsData.setCreateOn(LocalDateTime.now()); + accidentIrsData.setUpdateOn(LocalDateTime.now()); + accidentIrsDataService.saveOrUpdate(accidentIrsData); + } + } + } + } + + public TreeMap jsonStrToMap(String jsonstr){ + TreeMap map = new TreeMap(); + String[] split = jsonstr.split("&"); + for (String s : split) { + String[] string = s.split("="); + map.put(string[0],string[1]); + } + return map; + } +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/oss/OSSTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/oss/OSSTest.java new file mode 100644 index 0000000..d7ae104 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/oss/OSSTest.java @@ -0,0 +1,115 @@ +package com.ningdatech.carapi.oss; + + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; + +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.crypto.password.PasswordEncoder; + +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClientBuilder; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.driver.service.ICertificateService; +import com.ningdatech.carapi.driver.service.IDriverInfoService; +import com.ningdatech.carapi.driver.service.IDriverScoreInfoService; +import com.ningdatech.carapi.sys.helper.OperatorsCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.sys.service.IRegionService; +import com.ningdatech.carapi.sys.service.UserRoleService; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; + +import lombok.extern.slf4j.Slf4j; + +/** + * @author liuxinxin + * @date 2022/11/10 下午5:30 + */ +@Slf4j +public class OSSTest extends AppTests { + @Autowired + private IDriverInfoService iDriverInfoService; + @Autowired + private CompanyService companyService; + @Autowired + private IRegionService regionService; + @Autowired + private RegionsCacheHelper regionCacheHelper; + @Autowired + private INdUserInfoService iNdUserInfoService; + @Autowired + private INdUserAuthService iNdUserAuthService; + @Autowired + private UserRoleService userRoleService; + @Autowired + private PasswordEncoder passwordEncoder; + @Autowired + private ICertificateService certificateService; + @Autowired + private IDriverScoreInfoService iDriverScoreInfoService; + @Autowired + private IVehicleBaseInfoService vehicleBaseInfoService; + @Autowired + private OperatorsCacheHelper operatorsCacheHelper; + + @Value("${login.public-key}") + private String publicKey; + + @Value("${login.private-key}") + private String privateKey; + + @Test + public void test() throws FileNotFoundException { + String endpoint = "oss-cn-hangzhou-zwynet-d01-a.internet.cloud-inner.zj.gov.cn"; + String accessKeyId = "oZFNfkh9YexqzTED"; + String accessKeySecret = "xewpDvACMzLQAGvY14fcXjkijBKSNH"; + String bucketName = "sanzhuangche2"; + String fileNamePrefix = "your_file_name_prefix"; + + OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); + + + //// 获取所有以指定前缀开头的文件名列表 + //List objectNames = ossClient.listObjects(bucketName, fileNamePrefix).getObjectSummaries().stream() + // .map(ObjectSummary::getKey).collect(Collectors.toList()); + // + //// 删除指定文件名的文件 + //DeleteObjectsRequest request = new DeleteObjectsRequest(bucketName); + //objectNames.forEach(request::addKey); + //DeleteObjectsResult result = ossClient.deleteObjects(request); + //System.out.println("删除成功"); + + // 关闭OSS客户端连接 + ossClient.shutdown(); + } + + + //这个下面是单独函数 + public static Workbook readExcel(InputStream is, String extString){ + Workbook wb = null; + extString = extString.substring(extString.lastIndexOf(".")); + try { + if(".xls".equals(extString)){ + return wb = new HSSFWorkbook(is); + }else if(".xlsx".equals(extString)){ + return wb = new XSSFWorkbook(is); + }else { + return wb = null; + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wb; + } +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/oss/util/OssUtils.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/oss/util/OssUtils.java new file mode 100644 index 0000000..47dce54 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/oss/util/OssUtils.java @@ -0,0 +1,126 @@ +package com.ningdatech.carapi.oss.util; + +import java.util.List; + +import org.apache.commons.lang3.StringUtils; + +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClient; +import com.aliyun.oss.model.ListObjectsRequest; +import com.aliyun.oss.model.OSSObjectSummary; +import com.aliyun.oss.model.ObjectListing; + +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/09/01 15:12 + */ +@Slf4j +public class OssUtils { + private static String ENDPOINT = "oss-cn-hangzhou-zwynet-d01-a.internet.cloud-inner.zj.gov.cn"; + //private fileout String ENDPOINT = "oss-cn-hangzhou.aliyuncs.com"; + private static String ACCESSKEYID = "oZFNfkh9YexqzTED"; + //private fileout String ACCESSKEYID = "LTAI4GL7uypycnBjiRn55rMG"; + private static String ACCESSKEYSECRET = "xewpDvACMzLQAGvY14fcXjkijBKSNH"; + //private fileout String ACCESSKEYSECRET = "qwYC7bW9bkStsko7qkLVnToAzj0Y98"; + private static String NEW_BUCKET = "sanzhuangche2"; + //private fileout String NEW_BUCKET = "devplat"; + + private static OSSClient client = null; + + + /** 创建OSSClient实例 + * + * @return + */ + private static OSSClient getOssClient(){ + client = new OSSClient(ENDPOINT, ACCESSKEYID, ACCESSKEYSECRET); + return client; + } + + /** 关闭OSSClient + * + */ + private static void close(){ + OssUtils.getOssClient().shutdown(); + } + + + /** + * 获取根目录下所有文件大小 + * @param bucketName + * @return + */ + public static Long getOss(String bucketName){ + try { + if (StringUtils.isBlank(bucketName)) { + bucketName = NEW_BUCKET; + } + long sizeTotal = 0L; + ObjectListing objectListing = null; + do { + // 列举bucket所有文件或目录,每次1000个 + ListObjectsRequest request = new ListObjectsRequest(bucketName).withDelimiter("/").withMaxKeys(1000); + // 列举bucket的指定目录(yourPrefix)下文件,每次1000个 + // ListObjectsRequest request = new ListObjectsRequest(bucketName).withMaxKeys(1000).withPrefix("yourPrefix"); + + if (objectListing != null) { + request.setMarker(objectListing.getNextMarker()); + } + objectListing = OssUtils.getOssClient().listObjects(request); + //获取当前文件夹下所有子目录大小 + List folders = objectListing.getCommonPrefixes(); + for (String folder : folders) { + sizeTotal = calculateFolderLength(OssUtils.getOssClient(), bucketName, folder)+sizeTotal; + } + + //获取当前文件夹下所有文件大小 + List sums = objectListing.getObjectSummaries(); + if (sums.size()==0){ + continue; + } + for (OSSObjectSummary s : sums) { + sizeTotal = sizeTotal+s.getSize(); + } + + } while (objectListing.isTruncated()); + //转换为TB + //sizeTotal = sizeTotal/1024/1024/1024/1024; + //转换为GB + sizeTotal = sizeTotal/1024/1024/1024; + //log.info(" 文件夹下所有子目录大小 : [{}] TB",sizeTotal); + log.info(" 文件夹下所有子目录大小 : [{}] GB",sizeTotal); + return sizeTotal; + }catch (Exception e){ + e.printStackTrace(); + return 0L; + }finally { + OssUtils.close(); + } + + } + + public static void main(String[] args) { + Long oss = getOss(NEW_BUCKET); + System.out.println(oss); + } + + private static long calculateFolderLength(OSS ossClient, String bucketName, String folder) { + long size = 0L; + ObjectListing objectListing = null; + do { + // MaxKey默认值为100,最大值为1000。 + ListObjectsRequest request = new ListObjectsRequest(bucketName).withPrefix(folder).withMaxKeys(1000); + if (objectListing != null) { + request.setMarker(objectListing.getNextMarker()); + } + objectListing = ossClient.listObjects(request); + List sums = objectListing.getObjectSummaries(); + for (OSSObjectSummary s : sums) { + size += s.getSize(); + } + } while (objectListing.isTruncated()); + return size; + } +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/radar/RadarTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/radar/RadarTest.java new file mode 100644 index 0000000..fc92761 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/radar/RadarTest.java @@ -0,0 +1,437 @@ +package com.ningdatech.carapi.radar; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; + +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import com.google.common.collect.Lists; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.radar.helper.RadarDataHelper; + +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @author CMM + * @date 2024/11/8 10:28 + * / + * /** + * @since 2024/11/08 10:28 + */ +@Slf4j +public class RadarTest extends AppTests { + + @Autowired + private RadarDataHelper radarDataHelper; + + @Test + public void test(){ + // 目标轨迹数据 + String data = "55aa55bb01d001763231363236303932000000000000000000000000180b0d0f2d0c00530b7e210232140fffffff0e0cfe5c1aa4000a07761adc0000ff4c000047868a4c11e1baee0b4b210232140fffffff0e0cfe167d4600f0097e22560000fe8e000047868a0311e213880b63220232140fffffff003801183f0cffce06c21856000000b4000047868d2211e1dba20b4e210232140fffffff0e0cfe2069aa019007f81d3bffecffa6fef247868a0e11e201eb0b7fff0232140fffffff0debfbaa14faff2407801b2dfff6fe8eff4c4786878011e1b5d70b57210232140fffffff0e0efe3e53e8fff607d01c200000fdda000047868a2d11e1ee5f0b661f0232140fffffff0e0efb32442afff6091a20c40000ffa6ffa64786870411e1e03b0b5d2003961925ffffff0e0cfc9a4a60ffa606cc18800000000000004786887911e1e5cf0b71200232140fffffff0e0ffccc29ae0000073a1a04000000000000478688ad11e1c8710b67200232140fffffff0e0ffcf43c14000007bc1bd7000000000000478688d611e1d8f80b7b200232140fffffff0e0efcb81f900000078a1b230000000000004786889811e1bf5a0b3e210232140fffffff0e0cfdda6cf2007805be14bd0000ff4c0000478689c511e204de55cc55dd"; + // 交通流量数据 + //String data = "55aa55bb007803703231363236303932000000000000000000000000180b0d102914000f0000001f0064000600000000000602f9001e00660000000000200064000400000000000402e5003200350000000000210064000300000000000302eb004600350000000000220064000200000000000202520064002b000055cc55dd"; + String head = "55aa55bb"; + String tail = "55cc55dd"; + + // 解析上面的数据帧data 包头是head 包尾是tail 从包头到包尾分段取出数据 放入一个字符串列表中 等待解析 + List segments = Lists.newArrayList(); + int headIndex = data.indexOf(head); + while (headIndex != -1) { + int tailIndex = data.indexOf(tail, headIndex + head.length()); + if (tailIndex != -1) { + // 提取从包头到包尾的数据段 + String segment = data.substring(headIndex + head.length(), tailIndex); + segments.add(segment); + // 移动到下一个包头的位置 + headIndex = data.indexOf(head, tailIndex + tail.length()); + } else { + // 没有找到包尾,结束循环 + break; + } + } + + // 遍历这些数据帧 解析其中携带的数据 + for (String segment : segments) { + System.out.println(segment); + + //// 获取数据长度 2字节 4字符 判断数据包长度 + byte[] dataLengthData = radarDataHelper.extractHexData(segment, 0, 2); + String dataLengthHexString = radarDataHelper.byteArrayToHexStringAll(dataLengthData); + // 将16进制字符串转换为字节数组 + byte[] lengthBytes = new byte[2]; + // 高8位 + lengthBytes[0] = (byte) Integer.parseInt(dataLengthHexString.substring(0, 2), 16); + // 低8位 + lengthBytes[1] = (byte) Integer.parseInt(dataLengthHexString.substring(2, 4), 16); + + // 将字节数组转换为16位整数,注意网络字节序是大端序 + int byteLength = ((lengthBytes[0] & 0xFF) << 8) | (lengthBytes[1] & 0xFF); + // 打印结果 + System.out.println("数据长度: " + byteLength); + + // 获取数据帧类型 1字节 2字符 判断是目标轨迹数据还是交通流量数据 + byte[] objectTypeData = radarDataHelper.extractHexData(segment, 2, 1); + String objectTypeHexString = radarDataHelper.byteArrayToHexString(objectTypeData); + System.out.println("数据帧类型:" + objectTypeHexString); + + // 获取设备编号 20字节 40字符 判断是哪个雷达的发送的数据 + byte[] deviceIdData = radarDataHelper.extractHexData(segment, 4, 16); + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < deviceIdData.length; i++) { + byte b = deviceIdData[i]; + // 16进制数 "32" + String hexString = String.format("%02X", b); + // 将16进制字符串转换为十进制整数 + int decimalValue = Integer.parseInt(hexString, 16); + // 将十进制整数转换为对应的ASCII字符 + char asciiChar = (char) decimalValue; + // 如果不为0则添加到字符串中 + if (decimalValue != 0) { + builder.append(asciiChar); + } + } + System.out.println("设备编号:" + builder); + + //String deviceIdHexString = radarDataHelper.byteArrayToHexString(deviceIdData); + //System.out.println("设备编号:" + deviceIdHexString); + + byte[] timestampData = radarDataHelper.extractHexData(segment, 24, 8); + String timestampHexString = radarDataHelper.byteArrayToHexString(timestampData); + System.out.println("时间戳:" + timestampHexString); + String localDateTime = getLocalDateTime(segment, timestampData); + System.out.println("时间戳:" + localDateTime); + // 获取数据 + // 用获取到的数据长度 减去数据长度(2字节)、数据帧类型(1字节)、校验和(1字节)、数据编号)、时间戳(8字节)、包头包尾(8字节) + int dataLength = byteLength - 2 - 1 - 1 - 20 - 8; + segment = segment.substring(64); + System.out.println("总数据:" + segment); + + // 如果是目标轨迹数据 + if (objectTypeHexString.equals("01")) { + if (dataLength >= 36) { + byte[] dataBytes = radarDataHelper.hexStringToByteArray(segment); + // 36个字节为一组数据 进行分组解析 + for (int i = 0; i < dataBytes.length; i += 36) { + byte[] dataSegment = Arrays.copyOfRange(dataBytes, i, i + 36); + String dataSegmentHexString = radarDataHelper.byteArrayToHexStringAll(dataSegment); + System.out.println("数据:" + dataSegmentHexString); + // 获取目标所属车道 + byte[] targetLaneData = radarDataHelper.extractHexData(dataSegmentHexString, 2, 1); + String targetLaneHexString = radarDataHelper.byteArrayToHexStringAll(targetLaneData); + // 将16进制数转换为10进制数 + int targetLane = Integer.parseInt(targetLaneHexString, 16); + System.out.println("目标所属车道:" + targetLane); + // 获取目标类型 + byte[] carTypeData = radarDataHelper.extractHexData(dataSegmentHexString, 3, 1); + String carTypeHexString = radarDataHelper.byteArrayToHexStringAll(carTypeData); + System.out.println("目标类型:" + carTypeHexString); + // 获取目标速度 + byte[] targetSpeedData = radarDataHelper.extractHexData(dataSegmentHexString, 20, 2); + String targetSpeedHexString = radarDataHelper.byteArrayToHexStringAll(targetSpeedData); + double targetSpeed = Integer.parseInt(targetSpeedHexString, 16) * 0.01; + System.out.println("目标速度:" + targetSpeed); + // 获取目标经度 + byte[] targetLongitudeData = radarDataHelper.extractHexData(dataSegmentHexString, 28, 4); + String targetLongitudeHexString = radarDataHelper.byteArrayToHexStringAll(targetLongitudeData); + // 将十六进制字符串转换为long类型的数字 + long targetLongitudeLongValue = Long.parseLong(targetLongitudeHexString, 16); + // 将long类型的数字转换为double类型的数字 + double targetLongitude = (double) targetLongitudeLongValue / 10000000; + System.out.println("目标经度:" + targetLongitude); + // 获取目标纬度 + byte[] targetLatitudeData = radarDataHelper.extractHexData(dataSegmentHexString, 32, 4); + String targetLatitudeHexString = radarDataHelper.byteArrayToHexStringAll(targetLatitudeData); + + // 将十六进制字符串转换为long类型的数字 + long targetLatitudeLongValue = Long.parseLong(targetLatitudeHexString, 16); + // 将long类型的数字转换为double类型的数字 + double targetLatitude = (double) targetLatitudeLongValue / 10000000; + System.out.println("目标纬度:" + targetLatitude); + } + } + } + // 如果是交通流量数据 + else if (objectTypeHexString.equals("03")) { + if (dataLength >= 22) { + byte[] dataBytes = radarDataHelper.hexStringToByteArray(segment); + // 22个字节为一组数据 进行分组解析 + for (int i = 0; i < dataBytes.length; i += 22) { + byte[] dataSegment = Arrays.copyOfRange(dataBytes, i, i + 22); + String dataSegmentHexString = radarDataHelper.byteArrayToHexStringAll(dataSegment); + System.out.println("数据:" + dataSegmentHexString); + // 获取统计周期 + byte[] statisticsCycleData = radarDataHelper.extractHexData(dataSegmentHexString, 0, 2); + String statisticsCycleHexString = radarDataHelper.byteArrayToHexStringAll(statisticsCycleData); + // 将16进制数转换为10进制数 + int statisticsCycle = Integer.parseInt(statisticsCycleHexString, 16); + System.out.println("统计周期:" + statisticsCycle); + // 获取实时车流量 + byte[] realTimeTrafficFlowData = radarDataHelper.extractHexData(dataSegmentHexString, 12, 2); + String realTimeTrafficFlowHexString = radarDataHelper.byteArrayToHexStringAll(realTimeTrafficFlowData); + // 将16进制数转换为10进制数 + int realTimeTrafficFlow = Integer.parseInt(realTimeTrafficFlowHexString, 16); + System.out.println("总流量:" + realTimeTrafficFlow); + // 获取平均车速 + byte[] averageSpeedData = radarDataHelper.extractHexData(dataSegmentHexString, 14, 2); + String averageSpeedHexString = radarDataHelper.byteArrayToHexStringAll(averageSpeedData); + double averageSpeed = Integer.parseInt(averageSpeedHexString, 16) * 0.1; + System.out.println("平均速度:" + averageSpeed); + // 获取最大排队长度 + byte[] maxQueueLengthData = radarDataHelper.extractHexData(dataSegmentHexString, 20, 2); + String maxQueueLengthHexString = radarDataHelper.byteArrayToHexStringAll(maxQueueLengthData); + // 将16进制数转换为10进制数 + int maxQueueLength = Integer.parseInt(maxQueueLengthHexString, 16); + System.out.println("最大排队长度:" + maxQueueLength); + } + } + } + } + } + + @Test + public void test2(){ + String data = "\\x55\\xaa\\x55\\xbb\\x01\\x88\\x01\\x0121626098\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x18\\x0b\\x08\\x122\\x1e\\x02W\\x0fF\\x0b\\x022\\x14\\x0f\\xff\\xff\\xff\\x07\\x07\\x04~\\x15r\\x00Z\\xf9\\xde\\x16\\x1d\\x00\\n\\x00\\xb4\\xff\\xa6G\\x86\\x90\\xa8\\x11\\xe1\\xb6C\\x0f^\\r\\x022\\x14\\x0f\\xff\\xff\\xff\\x07\\x08\\x01\\xd66\\xe2\\x00\\x00\\xf8\\xd0\\x19\\xdf\\x06\\xa4\\x00\\x00\\x00\\x00G\\x86\\x8d\\xe7\\x11\\xe1\\xd4M\\x0fG\\x0c\\x022\\x14\\x0f\\xff\\xff\\xff\\x07\\x07\\x02N.\\xf4\\x00\\x00\\xf9>\\x18S\\x00\\x00\\xfe\\xf2\\x00\\x00G\\x86\\x8ec\\x11\\xe1\\xcd-\\x0fH\\x0c\\x022\\x14\\x0f\\xff\\xff\\xff\\x07\\x07\\x02\\xa8\\x18V\\x00\\x1e\\xf9 \\x18\\xc0\\x00\\x00\\x00\\x00\\x00\\x00G\\x86\\x8e\\xc1\\x11\\xe1\\xb8\\xdc\\x0f]\\r\\x022\\x14\\x0f\\xff\\xff\\xff\\x07\\x08\\x01\\xa4c\\xe2\\x00\\x00\\xf7\\xea\\x1d\\x1c\\x00\\x00\\x00\\x00\\x00\\x00G\\x86\\x8d\\xb3\\x11\\xe1\\xfc\\xb9\\x0fA\\x0c\\x022\\x14\\x0f\\xff\\xff\\xff\\x07\\x07\\x03H\\x11D\\x00F\\xf9\\x84\\x17]\\xff\\xec\\x00\\x00\\x01\\x0eG\\x86\\x8fg\\x11\\xe1\\xb2\\x82\\x0f@\\x0b\\x022\\x14\\x0f\\xff\\xff\\xff\\x07\\x07\\x04V\\x1e2\\x00x\\xfaL\\x14\\x99\\x00\\x00\\x04\\xb0\\x00\\x00G\\x86\\x90\\x7f\\x11\\xe1\\xbe\\x1f\\x0fP\\x0b\\x022\\x14\\x0f\\xff\\xff\\xff\\x07\\x07\\x04`\\\\\\xbc\\x00F\\xf9\\xa2\\x16\\xf1\\x00\\x00\\x00\\x00\\x00\\x00G\\x86\\x90\\x89\\x11\\xe1\\xf6N\\x0f\\x1d\\x0b\\x022\\x14\\x0f\\xff\\xff\\xff\\x07\\x07\\x03\\xca\\'\\x1a\\xff\\xe2\\xfa8\\x14\\xd1\\x00\\x00\\x01r\\x00\\x00G\\x86\\x8f\\xee\\x11\\xe1\\xc6 \\x0f\\\\\\x0c\\x022\\x14\\x0f\\xff\\xff\\xff\\x07\\x08\\x03>j\"\\x00\\x00\\xf9z\\x17|\\x00\\x00\\x00\\x00\\x00\\x00G\\x86\\x8f\\\\\\x11\\xe2\\x02W\\x55\\xcc\\x55\\xdd'"; + // 替换 \n、\r、\t + String dataString = data.replaceAll("\\\\n", "").replaceAll("\\\\r", "").replaceAll("\\\\t", "").replaceAll(" ", ""); + System.out.println(dataString); + // 以\x为分割符将数据分组 + String[] segments = dataString.split("\\\\x"); + // 对每个字符串做分析 前两个字符作为为一个16进制字节 添加到字节数组中 如果还有剩余的字符 每个字符作为一个字节添加到字节数组中 + LinkedList byteArrayList = new LinkedList<>(); + for (int i = 0; i < segments.length; i++) { + String segment = segments[i]; + if (segment.length() >= 2) { + // 截取前两个字符 + String hexString = segment.substring(0, 2); + // 将两位的字符转换为十六进制的字节 + byte b = hexStringToByte(hexString); + byte[] bytes1 = {b}; + byteArrayList.add(bytes1); + + // 截取剩余的字符串 + String remainingString = segment.substring(2); + // 如果是设备编号 + if (remainingString.equals("21626098") || remainingString.equals("21626092") || + remainingString.equals("21626163") || remainingString.equals("21626114") || + remainingString.equals("21626107") || remainingString.equals("21626197")) { + // 每个字符转换为ASIC码 + for (int j = 0; j < remainingString.length(); j++) { + byte asic = charToAsciiByte(remainingString.substring(j, j + 1)); + byte[] bytes2 = new byte[]{asic}; + byteArrayList.add(bytes2); + } + }else { + // 每个字符作为一个字节添加到字节数组列表中 + for (int j = 0; j < remainingString.length(); j++) { + byte asic = charToAsciiByte(remainingString.substring(j, j + 1)); + byte[] bytes2 = new byte[]{asic}; + byteArrayList.add(bytes2); + } + } + }else if (segment.length() == 1){ + byte asic = charToAsciiByte(segment); + byte[] bytes2 = new byte[]{asic}; + byteArrayList.add(bytes2); + }else { + System.out.println("无效的字符串:" + segment); + } + } + // 将字节数组列表转换为字节数组 + byte[] mergedData; + try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { + for (byte[] bytes : byteArrayList) { + outputStream.write(bytes); + } + mergedData = outputStream.toByteArray(); + } catch (IOException e) { + throw new RuntimeException("Failed to merge byte arrays", e); + } + + StringBuilder hexString = new StringBuilder(); + for (byte b : mergedData) { + String hex = Integer.toHexString(0xFF & b); + if (hex.length() == 1) { + hexString.append('0'); + } + hexString.append(hex); + } + + System.out.println(hexString); + + } + + public static byte charToAsciiByte(String charStr) { + if (charStr == null || charStr.length() != 1) { + throw new IllegalArgumentException("Input string must be one character long."); + } + // 获取字符的ASCII码值 + int asciiValue = charStr.charAt(0); + // 将ASCII码值转换为字节 + return (byte) asciiValue; + } + + public static byte hexStringToByte(String hexString) { + if (hexString == null || hexString.length() != 2) { + throw new IllegalArgumentException("Input string must be two characters long."); + } + // 将字符串转换为整数,并指定基数为16 + int intValue = Integer.parseInt(hexString, 16); + // 将整数转换为字节 + return (byte) intValue; + } + + @Test + public void test3(){ + // 给定的转义过后的字节数据 + byte[] data = new byte[] { + (byte) 0x55, (byte) 0xaa, (byte) 0x55, (byte) 0xbb, + 0x01, (byte) 0x88, 0x01, 0x01, + '2', '1', '6', '2', '6', '0', '9', '8', + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, (byte) 0x18, 0x0b, 0x08, (byte) 0x12, + '2', (byte) 0x1e, 0x02, 'W', (byte) 0x0f, 'F', (byte) 0x0b, 0x02, + '2', (byte) 0x14, (byte) 0x0f, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x07, 0x07, + 0x04, '~', (byte) 0x15, 'r', 0x00, 'Z', (byte) 0xf9, (byte) 0xde, + 0x16, (byte) 0x1d, 0x00, 0x0a, 0x00, (byte) 0xb4, (byte) 0xff, (byte) 0xa6, + 'G', (byte) 0x86, (byte) 0x90, (byte) 0xa8, (byte) 0x11, (byte) 0xe1, (byte) 0xb6, 'C', + 0x0f, '^', 0x0d, 0x02, '2', (byte) 0x14, (byte) 0x0f, (byte) 0xff, + (byte) 0xff, (byte) 0xff, 0x07, 0x08, 0x01, (byte) 0xd6, '6', (byte) 0xe2, + 0x00, 0x00, (byte) 0xf8, (byte) 0xd0, (byte) 0x19, (byte) 0xdf, 0x06, (byte) 0xa4, + 0x00, 0x00, 0x00, 0x00, 'G', (byte) 0x86, (byte) 0x8d, (byte) 0xe7, + (byte) 0x11, (byte) 0xe1, (byte) 0xd4, 'M', 0x0f, 'G', 0x0c, 0x02, + '2', (byte) 0x14, (byte) 0x0f, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x07, 0x07, + 0x02, 'N', '.', (byte) 0xf4, 0x00, 0x00, (byte) 0xf9, '>', + (byte) 0x18, 'S', 0x00, 0x00, (byte) 0xfe, (byte) 0xf2, 0x00, 0x00, + 'G', (byte) 0x86, (byte) 0x8e, 'c', (byte) 0x11, (byte) 0xe1, (byte) 0xcd, '-', + 0x0f, 'H', 0x0c, 0x02, '2', (byte) 0x14, (byte) 0x0f, (byte) 0xff, + (byte) 0xff, (byte) 0xff, 0x07, 0x07, 0x02, (byte) 0xa8, 0x18, 'V', + 0x00, (byte) 0x1e, (byte) 0xf9, ' ', (byte) 0x18, (byte) 0xc0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 'G', (byte) 0x86, (byte) 0x8e, (byte) 0xc1, + (byte) 0x11, (byte) 0xe1, (byte) 0xb8, (byte) 0xdc, 0x0f, ']', + 0x0d, 0x02, '2', (byte) 0x14, (byte) 0x0f, (byte) 0xff, (byte) 0xff, + (byte) 0xff, 0x07, 0x08, 0x01, (byte) 0xa4, 'c', (byte) 0xe2, 0x00, + 0x00, (byte) 0xf7, (byte) 0xea, (byte) 0x1d, (byte) 0x1c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 'G', (byte) 0x86, (byte) 0x8d, (byte) 0xb3, + (byte) 0x11, (byte) 0xe1, (byte) 0xfc, (byte) 0xb9, 0x0f, 'A', + 0x0c, 0x02, '2', (byte) 0x14, (byte) 0x0f, (byte) 0xff, (byte) 0xff, + (byte) 0xff, 0x07, 0x07, 0x03, 'H', 0x11, 'D', 0x00, + 'F', (byte) 0xf9, (byte) 0x84, 0x17, ']', (byte) 0xff, (byte) 0xec, 0x00, + 0x00, 0x01, 0x0e, 'G', (byte) 0x86, (byte) 0x8f, 'g', (byte) 0x11, + (byte) 0xe1, (byte) 0xb2, (byte) 0x82, 0x0f, '@', 0x0b, 0x02, '2', + (byte) 0x14, (byte) 0x0f, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x07, 0x07, 0x04, + 'V', 0x1e, '2', 0x00, 'x', (byte) 0xfa, 'L', 0x14, + (byte) 0x99, 0x00, 0x00, 0x04, (byte) 0xb0, 0x00, 0x00, 'G', + (byte) 0x86, (byte) 0x90, (byte) 0x7f, (byte) 0x11, (byte) 0xe1, (byte) 0xbe, 0x1f, 0x0f, + 'P', 0x0b, 0x02, '2', (byte) 0x14, (byte) 0x0f, (byte) 0xff, (byte) 0xff, + (byte) 0xff, 0x07, 0x07, 0x04, '`', '\\', (byte) 0xbc, 0x00, + 'F', (byte) 0xf9, (byte) 0xa2, 0x16, (byte) 0xf1, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 'G', (byte) 0x86, (byte) 0x90, (byte) 0x89, (byte) 0x11, + (byte) 0xe1, (byte) 0xf6, 'N', 0x0f, 0x1d, 0x0b, 0x02, '2', + (byte) 0x14, (byte) 0x0f, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x07, 0x07, 0x03, + (byte) 0xca, 0x27, 0x1a, (byte) 0xff, (byte) 0xe2, (byte) 0xfa, '8', 0x14, + (byte) 0xd1, 0x00, 0x00, 0x01, 'r', 0x00, 0x00, 'G', + (byte) 0x86, (byte) 0x8f, (byte) 0xee, (byte) 0x11, (byte) 0xe2, 0x02, 'W', 'U', + (byte) 0xcc, 'U', (byte) 0xdd + }; + + StringBuilder hexString = new StringBuilder(); + for (byte b : data) { + String hex = Integer.toHexString(0xFF & b); + if (hex.length() == 1) { + hexString.append('0'); + } + hexString.append(hex); + } + + System.out.println(hexString.toString()); + } + + private String getLocalDateTime(String segment, byte[] timestampData) { + // 第一个字节 -> year + byte year = timestampData[0]; + // 将16进制字节转换为整数 + int yearInt = Integer.parseInt(String.format("%02X", year), 16); + // 创建位掩码来提取第0到7位 + int yearMask = 0xFF; + // 使用位掩码提取第0到第7位 + int extractedYearBits = yearInt & yearMask; + // 数据 0~255 对应 2000~2255 year 获取实际的年份 + int yearValue = extractedYearBits + 2000; + System.out.println("年份:" + yearValue); + + // 第二个字节 -> month + byte month = timestampData[1]; + // 将16进制字节转换为整数 + int monthInt = Integer.parseInt(String.format("%02X", month), 16); + // 创建位掩码来提取第0到3位 + // 1~12 对应 1~12 month + int monthMask = 0x0F; + // 使用位掩码提取第0到第3位 + int monthValue = monthInt & monthMask; + System.out.println("月份:" + monthValue); + + // 第三个字节 -> day + byte day = timestampData[2]; + // 将16进制字节转换为整数 + int dayInt = Integer.parseInt(String.format("%02X", day), 16); + // 创建位掩码来提取第0到4位 + // 数据 1~31 对应 1~31 day + int dayMask = 0x1F; + // 使用位掩码提取第0到第4位 + // 数据 1~31 对应 1~31 day + int dayValue = dayInt & dayMask; + System.out.println("天:" + dayValue); + + // 第四个字节 -> hour + byte hour = timestampData[3]; + // 将16进制字节转换为整数 + int hourInt = Integer.parseInt(String.format("%02X", hour), 16); + // 创建位掩码来提取第0到4位 + int hourMask = 0x1F; + // 使用位掩码提取第0到第4位 + // 数据 0~31 对应 0~23 hour + int hourValue = hourInt & hourMask; + System.out.println("小时:" + hourValue); + + // 第五个字节 -> minute + byte minute = timestampData[4]; + // 将16进制字节转换为整数 + int minuteInt = Integer.parseInt(String.format("%02X", minute), 16); + // 创建位掩码来提取第0到5位 + int minuteMask = 0x3F; + // 使用位掩码提取第0到第5位 + // 数据 0~63 对应 0~59 minute + int minuteValue = minuteInt & minuteMask; + System.out.println("分钟:" + minuteValue); + + // 第六个字节 -> second + byte second = timestampData[5]; + // 将16进制字节转换为整数 + int secondInt = Integer.parseInt(String.format("%02X", second), 16); + // 创建位掩码来提取第0到5位 + int secondMask = 0x3F; + // 使用位掩码提取第0到第5位 + // 数据 0~63 对应 0~59 second + int secondValue = secondInt & secondMask; + System.out.println("秒:" + secondValue); + // 第7、8个字节-> millisecond + // 把第7和第8个字节拼接成16进制字符串 再转换为整数 + byte[] millisecondData = radarDataHelper.extractHexData(segment, 30, 2); + String millisecondHexString = radarDataHelper.byteArrayToHexString(millisecondData); + int millisecondValue = Integer.parseInt(millisecondHexString, 16); + // 创建位掩码来提取第0到9位 + int millisecondMask = 0x3FF; + // 使用位掩码提取第0到第9位 + millisecondValue = millisecondValue & millisecondMask; + // 数据 0~999 对应 0~999 毫秒 + System.out.println("毫秒:" + millisecondValue); + // 拼接成LocalDateTime 类型的数据 + String localDateTime = yearValue + "-" + monthValue + "-" + dayValue + " " + hourValue + ":" + minuteValue + ":" + secondValue; + return localDateTime; + } +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/redis/RedisTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/redis/RedisTest.java new file mode 100644 index 0000000..ba584e3 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/redis/RedisTest.java @@ -0,0 +1,70 @@ +package com.ningdatech.carapi.redis; + +import java.time.Duration; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Set; + +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.scheduler.contants.TaskConstant; + +/** + * @Classname RedisTest + * @Description + * @Date 2023/3/1 16:33 + * @Author PoffyZhang + */ +public class RedisTest extends AppTests { + + @Autowired + private CachePlusOps cachePlusOps; + + @Test + public void remove (){ + // 模糊匹配所有以keyword:开头的所有key值 + + Set keys = cachePlusOps.keys("cm:"+"*"); + + System.out.println(keys.size()); + } + + @Test + public void get (){ + CacheKey key = new CacheKey(TaskConstant.RedisKey.IRS_ACCIDENT_QUERY_REQUEST_SECRET); + String requestSecret = cachePlusOps.get(key); + System.out.println(requestSecret); + requestSecret = "abcdefg123456"; + cachePlusOps.set(key,requestSecret,Boolean.TRUE); + String requestSecret2 = cachePlusOps.get(key); + System.out.println(requestSecret2); + } + + @Test + public void getValue (){ + String timeStamp = "1689081083"; + // 将时间戳转换为Instant对象 + Instant instant = Instant.ofEpochSecond(Long.parseLong(timeStamp)); + // 将Instant对象转换为LocalDateTime对象 + LocalDateTime startTime = LocalDateTime.now(); + LocalDateTime endTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + Duration minuteDuration = Duration.between(endTime,startTime); + long minute = minuteDuration.toMinutes(); + System.out.println( minute); + } + + @Test + public void removeBatch (){ + // 模糊匹配所有以keyword:开头的所有key值 + Set keys = cachePlusOps.keys("*_online_index"); + for (String key : keys) { + cachePlusOps.del(key); + } + System.out.println(keys.size()); + } +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/report/ReportTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/report/ReportTest.java new file mode 100644 index 0000000..ef49ddb --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/report/ReportTest.java @@ -0,0 +1,2977 @@ +package com.ningdatech.carapi.report; + +import java.io.*; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.car.vehicle.contants.VehicleContant; +import com.ningdatech.carapi.common.contants.DefValConstants; +import com.ningdatech.carapi.report.constant.DataUploadAuditStatusEnum; +import com.ningdatech.carapi.report.constant.DataUploadAuditTypeEnum; +import com.ningdatech.carapi.report.constant.UploadDataTypeEnum; +import com.ningdatech.carapi.report.model.dto.ReqBulkCementLogFacStaDataUploadDTO; +import com.ningdatech.carapi.report.model.dto.ReqMaterialLogEquipStaDataUploadDTO; +import com.ningdatech.carapi.report.model.entity.*; +import com.ningdatech.carapi.report.service.*; +import com.ningdatech.carapi.sys.entity.Region; +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.IRegionService; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import lombok.extern.slf4j.Slf4j; + +/** + * @author CMM + * @since 2023/10/10 10:08 + */ + +@Slf4j +public class ReportTest extends AppTests { + + @Autowired + private IRegionService regionService; + @Autowired + private IBulkCementDirectReportSystemAuditInfoService auditInfoService; + @Autowired + private CompaniesCacheHelper companiesCacheHelper; + @Autowired + private IBulkCementSupplyBulletinService bulkCementSupplyBulletinService; + @Autowired + private IBulkCementThreeCityUsageBulletinService bulkCementThreeCityUsageBulletinService; + @Autowired + private IBulkCementDirectReportSystemAuditRecordService auditRecordService; + @Autowired + private RegionsCacheHelper regionsCacheHelper; + @Autowired + private IBulkCementDirectReportSystemDataRelevanceService dataRelevanceService; + @Autowired + private IConcreteSupplyBulletinService concreteSupplyBulletinService; + @Autowired + private IMortarSupplyBulletinService mortarSupplyBulletinService; + @Autowired + private IBulkCementLogisticFacilityStatisticAnnualReportService bulkCementLogFacStaService; + @Autowired + private IMaterialLogisticEquipmentStatisticAnnualReportService materialLogEquipStaAnnualReportService; + @Autowired + private IBulkCementTransferBulletinService bulkCementTransferBulletinService; + @Autowired + private INonProhibitedAreasBulkCementSalesUseService nonProhibitedAreasBulkCementSalesUseService; + + @Test + public void bulkCementSupplyTest() throws FileNotFoundException { + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2022-01.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2022-02.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2022-03.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2022-04.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2022-05.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2022-06.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2022-07.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2022-08.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2022-09.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2022-10.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2022-11.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2022-12.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2023-01.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2023-02.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2023-03.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2023-04.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2023-05.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2023-06.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2023-07.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2023-08.xlsx"); + File f = new File("D:\\work\\水泥车直报系统\\data\\散装水泥供应量快报\\散装水泥供应量-2023-09.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + List userList = Lists.newArrayList(); + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 根据区县名称获取区域ID + HashSet countySet = new HashSet<>(); + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + + // 区域名称 + String regionName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 上报月份 + Date reportMonth = Objects.nonNull(row.getCell(1)) ? row.getCell(1).getDateCellValue() : null; + LocalDateTime month = reportMonth.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + // 本月实际散装水泥总量 + String bulkCementAmount = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; + // 本月实际水泥产量 + String cementOutput = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; + // 年初至本月累计完成量 + String completedTotalAmount = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY; + // 年初至本月累计散装率 + String bulkRate = Objects.nonNull(row.getCell(5)) ? row.getCell(5).toString() : StringUtils.EMPTY; + // 年初至本月累计 比去年同期增加量 + String increment = Objects.nonNull(row.getCell(6)) ? row.getCell(6).toString() : StringUtils.EMPTY; + // 年初至本月累计比去年同期 增长率 + String increaseRate = Objects.nonNull(row.getCell(7)) ? row.getCell(7).toString() : StringUtils.EMPTY; + // 年初至本月累计水泥产量 + String cumulativeCementProduction = Objects.nonNull(row.getCell(8)) ? row.getCell(8).toString() : StringUtils.EMPTY; + + // 区县名称 获取区域ID、上级区域ID + Long regionId = null; + Long cityRegionId = null; + String cityRegionName = null; + for (Map.Entry regionEntry : regionMap.entrySet()) { + String regionNameStr = regionEntry.getKey(); + if (regionNameStr.contains(regionName) && regionNameStr.length() < 4){ + regionName = regionNameStr; + Region region = regionMap.get(regionNameStr); + if (Objects.nonNull(region)) { + regionId = region.getId(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + cityRegionId = regionDto.getParentId(); + cityRegionName = regionDto.getRegionName(); + } + } + } + if (Objects.isNull(regionId)){ + throw new BizException("区域不存在!"); + } + + // 根据地区名称获取对应散装中心的企业信息 + Long companyId; + Long cityCompanyId; + CompanyDTO companyDto = companiesCacheHelper.getByName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + CompanyDTO cityCompanyDto = companiesCacheHelper.getByName(cityRegionName + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.isNull(companyDto) || Objects.isNull(cityCompanyDto)){ + throw new BizException("管理企业不存在!"); + }else { + companyId = companyDto.getId(); + cityCompanyId = cityCompanyDto.getId(); + } + + // 创建市级审核通过申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + cityAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityAuditInfo.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode()); + cityAuditInfo.setCreateOn(month); + cityAuditInfo.setCreateBy(null); + cityAuditInfo.setUpdateOn(month); + cityAuditInfo.setUpdateBy(null); + cityAuditInfo.setAuditTime(month); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 保存上报数据信息 + // 创建上报记录 + BulkCementSupplyBulletin concreteSupplyBulletin = new BulkCementSupplyBulletin(); + concreteSupplyBulletin.setUnitName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + concreteSupplyBulletin.setBulkCementAmount(BigDecimal.valueOf(Double.parseDouble(bulkCementAmount))); + concreteSupplyBulletin.setCementOutput(BigDecimal.valueOf(Double.parseDouble(cementOutput))); + concreteSupplyBulletin.setCompletedTotalAmount(BigDecimal.valueOf(Double.parseDouble(completedTotalAmount))); + concreteSupplyBulletin.setBulkRate(BigDecimal.valueOf(Double.parseDouble(bulkRate))); + concreteSupplyBulletin.setIncrement(BigDecimal.valueOf(Double.parseDouble(increment))); + concreteSupplyBulletin.setIncreaseRate(BigDecimal.valueOf(Double.parseDouble(increaseRate))); + concreteSupplyBulletin.setCumulativeCementProduction(BigDecimal.valueOf(Double.parseDouble(cumulativeCementProduction))); + concreteSupplyBulletin.setReportMonth(month); + concreteSupplyBulletin.setCompanyId(companyId); + concreteSupplyBulletin.setUnitResponsiblePerson(null); + concreteSupplyBulletin.setPreparer(null); + concreteSupplyBulletin.setReviewer(null); + concreteSupplyBulletin.setSubmissionDate(null); + concreteSupplyBulletin.setRegionId(regionId); + concreteSupplyBulletin.setCreateOn(month); + concreteSupplyBulletin.setCreateBy(null); + concreteSupplyBulletin.setUpdateOn(month); + concreteSupplyBulletin.setUpdateBy(null); + concreteSupplyBulletin.setAuditInfoId(cityAuditInfo.getId()); + concreteSupplyBulletin.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + bulkCementSupplyBulletinService.saveOrUpdate(concreteSupplyBulletin); + + // 补充市级数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + auditRecord.setAuditDataId(concreteSupplyBulletin.getId()); + auditRecord.setAuditInfoId(cityAuditInfo.getId()); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode()); + auditRecord.setCompanyId(companyId); + auditRecord.setRegionId(regionId); + auditRecord.setCreateOn(month.plusDays(20)); + auditRecord.setCreateBy(null); + auditRecord.setUpdateOn(month.plusDays(20)); + auditRecord.setUpdateBy(null); + auditRecord.setReportMonth(month); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + Long relevanceDataId; + // 判断上报月份所在市的关联数据不存在 + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, cityRegionId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, month) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode())); + // 已经存在,更新上报数据ID列表 + if (Objects.nonNull(cityData)){ + String auditDataIdListStr = cityData.getAuditDataIdList(); + List auditDataIdList; + if (StringUtils.isNotBlank(auditDataIdListStr)){ + auditDataIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditDataIdList.contains(concreteSupplyBulletin.getId())){ + auditDataIdList.add(concreteSupplyBulletin.getId()); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityData.setAuditDataIdList(idListStr); + } + // 更新最后一次更新时间 + cityData.setLastUpdateTime(LocalDateTime.now()); + cityData.setUpdateOn(LocalDateTime.now()); + cityData.setUpdateBy(null); + // 有新上报的数据,就更新关联数据状态为未上报 + cityData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(cityData); + } + relevanceDataId = cityData.getId(); + }else { + // 补充所在市的关联数据信息 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + cityRelevanceData.setReportMonth(month); + List auditDataIdList = Lists.newArrayList(); + auditDataIdList.add(concreteSupplyBulletin.getId()); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityRelevanceData.setAuditDataIdList(idListStr); + cityRelevanceData.setUnitResponsiblePerson(null); + cityRelevanceData.setPreparer(null); + cityRelevanceData.setReviewer(null); + cityRelevanceData.setSubmissionDate(null); + cityRelevanceData.setCreateOn(LocalDateTime.now()); + cityRelevanceData.setCreateBy(null); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setLastUpdateTime(LocalDateTime.now()); + cityRelevanceData.setRegionId(cityRegionId); + // 获取所在市散装中心所属的管理企业ID + cityRelevanceData.setCompanyId(cityCompanyId); + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode()); + // 有新上报的数据,就更新关联数据 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + relevanceDataId = cityRelevanceData.getId(); + } + + // 补充省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + provinceAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditInfo.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode()); + provinceAuditInfo.setCreateOn(month); + provinceAuditInfo.setCreateBy(null); + provinceAuditInfo.setUpdateOn(month); + provinceAuditInfo.setUpdateBy(null); + provinceAuditInfo.setAuditTime(month); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + // 更新市级关联数据 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(relevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityRelevanceData.setUpdateOn(month.plusDays(20L)); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setUnitResponsiblePerson(null); + cityRelevanceData.setPreparer(null); + cityRelevanceData.setReviewer(null); + cityRelevanceData.setSubmissionDate(null); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, month) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode())); + // 存在,更新市关联数据ID列表 + if (Objects.nonNull(provinceData)){ + String auditDataIdListStr = provinceData.getAuditDataIdList(); + List auditDataIdList; + if (StringUtils.isNotBlank(auditDataIdListStr)){ + auditDataIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditDataIdList.contains(relevanceDataId)){ + auditDataIdList.add(relevanceDataId); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceData.setAuditDataIdList(idListStr); + } + // 更新最后一次更新时间 + provinceData.setLastUpdateTime(month); + provinceData.setUpdateOn(month); + provinceData.setUpdateBy(null); + // 有新上报的数据,就更新关联数据状态为审核中 + provinceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(provinceData); + } + }else { + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + provinceRelevanceData.setReportMonth(month); + List auditDataIdList = Lists.newArrayList(); + auditDataIdList.add(relevanceDataId); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceRelevanceData.setAuditDataIdList(idListStr); + + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setCreateOn(month); + provinceRelevanceData.setCreateBy(null); + provinceRelevanceData.setUpdateOn(month); + provinceRelevanceData.setUpdateBy(null); + provinceRelevanceData.setLastUpdateTime(month); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO provinceCompanyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(provinceCompanyDto)) { + provinceRelevanceData.setCompanyId(provinceCompanyDto.getId()); + } + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + provinceAuditRecord.setAuditDataId(cityRelevanceData.getId()); + provinceAuditRecord.setAuditInfoId(provinceAuditInfo.getId()); + provinceAuditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditRecord.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_SUPPLY_BULLETIN.getCode()); + provinceAuditRecord.setCompanyId(cityRelevanceData.getCompanyId()); + provinceAuditRecord.setRegionId(cityRelevanceData.getRegionId()); + provinceAuditRecord.setCreateOn(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setCreateBy(null); + provinceAuditRecord.setUpdateOn(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setUpdateBy(null); + provinceAuditRecord.setReportMonth(month); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + + System.out.println("已成功插入第" + i + "条数据!"); + } + } + } + + @Test + public void bulkCementTransferTest() throws FileNotFoundException { + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2022-01-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2022-02-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2022-03-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2022-04-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2022-05-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2022-06-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2022-07-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2022-08-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2022-09-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2022-10-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2022-11-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2022-12-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2023-01-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2023-02-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2023-03-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2023-04-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2023-05-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2023-06-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2023-07-中转库进出量.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2023-08-中转库进出量.xlsx"); + File f = new File("D:\\work\\水泥车直报系统\\data\\中转库进出量\\2023-09-中转库进出量.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + List userList = Lists.newArrayList(); + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 根据区县名称获取区域ID + HashSet countySet = new HashSet<>(); + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + + // 区域名称 + String regionName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 上报月份 + Date reportMonth = Objects.nonNull(row.getCell(1)) ? row.getCell(1).getDateCellValue() : null; + LocalDateTime month = reportMonth.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + // 上月末库存 + String lastMonthEndInventory = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; + // 本月进库量 + String thisMonthIncomingStorage = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; + // 累计进库量 + String cumulativeIncomingStorage = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY; + // 本月出库量 + String thisMonthOutgoingStorage = Objects.nonNull(row.getCell(5)) ? row.getCell(5).toString() : StringUtils.EMPTY; + // 累计出库量 + String cumulativeOutgoingStorage = Objects.nonNull(row.getCell(6)) ? row.getCell(6).toString() : StringUtils.EMPTY; + // 月末库存量 + String monthEndInventory = Objects.nonNull(row.getCell(7)) ? row.getCell(7).toString() : StringUtils.EMPTY; + // 月末库存同比增长率 + String monthEndInventoryGrowthRate = Objects.nonNull(row.getCell(8)) ? row.getCell(8).toString() : StringUtils.EMPTY; + + // 区县名称 获取区域ID、上级区域ID + Long regionId = null; + Long cityRegionId = null; + String cityRegionName = null; + for (Map.Entry regionEntry : regionMap.entrySet()) { + String regionNameStr = regionEntry.getKey(); + if (regionNameStr.contains(regionName) && regionNameStr.length() < 4){ + regionName = regionNameStr; + Region region = regionMap.get(regionNameStr); + if (Objects.nonNull(region)) { + regionId = region.getId(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + cityRegionId = regionDto.getParentId(); + cityRegionName = regionDto.getRegionName(); + } + } + } + if (Objects.isNull(regionId)){ + throw new BizException("区域不存在!"); + } + + // 根据地区名称获取对应散装中心的企业信息 + Long companyId; + Long cityCompanyId; + CompanyDTO companyDto = companiesCacheHelper.getByName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + CompanyDTO cityCompanyDto = companiesCacheHelper.getByName(cityRegionName + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.isNull(companyDto) || Objects.isNull(cityCompanyDto)){ + throw new BizException("管理企业不存在!"); + }else { + companyId = companyDto.getId(); + cityCompanyId = cityCompanyDto.getId(); + } + + // 创建市级审核通过申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + cityAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityAuditInfo.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode()); + cityAuditInfo.setCreateOn(month); + cityAuditInfo.setCreateBy(null); + cityAuditInfo.setUpdateOn(month); + cityAuditInfo.setUpdateBy(null); + cityAuditInfo.setAuditTime(month); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 保存上报数据信息 + // 创建上报记录 + BulkCementTransferBulletin bulkCementTransferBulletin = new BulkCementTransferBulletin(); + bulkCementTransferBulletin.setUnitName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + bulkCementTransferBulletin.setLastMonthEndInventory(BigDecimal.valueOf(Double.parseDouble(lastMonthEndInventory))); + bulkCementTransferBulletin.setThisMonthIncomingStorage(BigDecimal.valueOf(Double.parseDouble(thisMonthIncomingStorage))); + bulkCementTransferBulletin.setCumulativeIncomingStorage(BigDecimal.valueOf(Double.parseDouble(cumulativeIncomingStorage))); + bulkCementTransferBulletin.setThisMonthIncomingStorage(BigDecimal.valueOf(Double.parseDouble(thisMonthIncomingStorage))); + bulkCementTransferBulletin.setThisMonthOutgoingStorage(BigDecimal.valueOf(Double.parseDouble(thisMonthOutgoingStorage))); + bulkCementTransferBulletin.setCumulativeOutgoingStorage(BigDecimal.valueOf(Double.parseDouble(cumulativeOutgoingStorage))); + bulkCementTransferBulletin.setMonthEndInventory(BigDecimal.valueOf(Double.parseDouble(monthEndInventory))); + bulkCementTransferBulletin.setMonthEndInventoryGrowthRate(BigDecimal.valueOf(Double.parseDouble(monthEndInventoryGrowthRate))); + bulkCementTransferBulletin.setReportMonth(month); + bulkCementTransferBulletin.setCompanyId(companyId); + bulkCementTransferBulletin.setUnitResponsiblePerson(null); + bulkCementTransferBulletin.setPreparer(null); + bulkCementTransferBulletin.setReviewer(null); + bulkCementTransferBulletin.setSubmissionDate(null); + bulkCementTransferBulletin.setRegionId(regionId); + bulkCementTransferBulletin.setCreateOn(month); + bulkCementTransferBulletin.setCreateBy(null); + bulkCementTransferBulletin.setUpdateOn(month); + bulkCementTransferBulletin.setUpdateBy(null); + bulkCementTransferBulletin.setAuditInfoId(cityAuditInfo.getId()); + bulkCementTransferBulletin.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + bulkCementTransferBulletinService.saveOrUpdate(bulkCementTransferBulletin); + + // 补充市级数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + auditRecord.setAuditDataId(bulkCementTransferBulletin.getId()); + auditRecord.setAuditInfoId(cityAuditInfo.getId()); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode()); + auditRecord.setCompanyId(companyId); + auditRecord.setRegionId(regionId); + auditRecord.setCreateOn(month.plusDays(20)); + auditRecord.setCreateBy(null); + auditRecord.setUpdateOn(month.plusDays(20)); + auditRecord.setUpdateBy(null); + auditRecord.setReportMonth(month); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + Long relevanceDataId; + // 判断上报月份所在市的关联数据不存在 + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, cityRegionId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, month) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode())); + // 已经存在,更新上报数据ID列表 + if (Objects.nonNull(cityData)){ + String auditDataIdListStr = cityData.getAuditDataIdList(); + List auditDataIdList; + if (StringUtils.isNotBlank(auditDataIdListStr)){ + auditDataIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditDataIdList.contains(bulkCementTransferBulletin.getId())){ + auditDataIdList.add(bulkCementTransferBulletin.getId()); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityData.setAuditDataIdList(idListStr); + } + // 更新最后一次更新时间 + cityData.setLastUpdateTime(LocalDateTime.now()); + cityData.setUpdateOn(LocalDateTime.now()); + cityData.setUpdateBy(null); + // 有新上报的数据 + cityData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(cityData); + } + relevanceDataId = cityData.getId(); + }else { + // 补充所在市的关联数据信息 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + cityRelevanceData.setReportMonth(month); + List auditDataIdList = Lists.newArrayList(); + auditDataIdList.add(bulkCementTransferBulletin.getId()); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityRelevanceData.setAuditDataIdList(idListStr); + cityRelevanceData.setUnitResponsiblePerson(null); + cityRelevanceData.setPreparer(null); + cityRelevanceData.setReviewer(null); + cityRelevanceData.setSubmissionDate(null); + cityRelevanceData.setCreateOn(LocalDateTime.now()); + cityRelevanceData.setCreateBy(null); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setLastUpdateTime(LocalDateTime.now()); + cityRelevanceData.setRegionId(cityRegionId); + // 获取所在市散装中心所属的管理企业ID + cityRelevanceData.setCompanyId(cityCompanyId); + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode()); + // 有新上报的数据,就更新关联数据 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + relevanceDataId = cityRelevanceData.getId(); + } + + // 补充省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + provinceAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditInfo.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode()); + provinceAuditInfo.setCreateOn(month); + provinceAuditInfo.setCreateBy(null); + provinceAuditInfo.setUpdateOn(month); + provinceAuditInfo.setUpdateBy(null); + provinceAuditInfo.setAuditTime(month); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + // 更新市级关联数据 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(relevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityRelevanceData.setUpdateOn(month.plusDays(20L)); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setUnitResponsiblePerson(null); + cityRelevanceData.setPreparer(null); + cityRelevanceData.setReviewer(null); + cityRelevanceData.setSubmissionDate(null); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, month) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode())); + // 存在,更新市关联数据ID列表 + if (Objects.nonNull(provinceData)){ + String auditDataIdListStr = provinceData.getAuditDataIdList(); + List auditDataIdList; + if (StringUtils.isNotBlank(auditDataIdListStr)){ + auditDataIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditDataIdList.contains(relevanceDataId)){ + auditDataIdList.add(relevanceDataId); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceData.setAuditDataIdList(idListStr); + } + // 更新最后一次更新时间 + provinceData.setLastUpdateTime(month); + provinceData.setUpdateOn(month); + provinceData.setUpdateBy(null); + // 有新上报的数据,就更新关联数据状态为审核中 + provinceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(provinceData); + } + }else { + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + provinceRelevanceData.setReportMonth(month); + List auditDataIdList = Lists.newArrayList(); + auditDataIdList.add(relevanceDataId); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceRelevanceData.setAuditDataIdList(idListStr); + + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setCreateOn(month); + provinceRelevanceData.setCreateBy(null); + provinceRelevanceData.setUpdateOn(month); + provinceRelevanceData.setUpdateBy(null); + provinceRelevanceData.setLastUpdateTime(month); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO provinceCompanyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(provinceCompanyDto)) { + provinceRelevanceData.setCompanyId(provinceCompanyDto.getId()); + } + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + provinceAuditRecord.setAuditDataId(cityRelevanceData.getId()); + provinceAuditRecord.setAuditInfoId(provinceAuditInfo.getId()); + provinceAuditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditRecord.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_TRANSFER_BULLETIN.getCode()); + provinceAuditRecord.setCompanyId(cityRelevanceData.getCompanyId()); + provinceAuditRecord.setRegionId(cityRelevanceData.getRegionId()); + provinceAuditRecord.setCreateOn(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setCreateBy(null); + provinceAuditRecord.setUpdateOn(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setUpdateBy(null); + provinceAuditRecord.setReportMonth(month); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + + System.out.println("已成功插入第" + i + "条数据!"); + } + } + } + + @Test + public void bulkCementThreeCityUsageTest() throws FileNotFoundException { + + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2022-01.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2022-02.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2022-03.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2022-04.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2022-05.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2022-06.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2022-07.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2022-08.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2022-09.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2022-10.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2022-11.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2022-12.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2023-01.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2023-02.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2023-03.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2023-04.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2023-05.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2023-06.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2023-07.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2023-08.xlsx"); + File f = new File("D:\\work\\水泥车直报系统\\data\\温台舟使用量快报\\温台舟使用量快报-2023-09.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + List userList = Lists.newArrayList(); + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 根据区县名称获取区域ID + HashSet countySet = new HashSet<>(); + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + + // 单位名称 + String regionName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 上报月份 + Date reportMonth = Objects.nonNull(row.getCell(1)) ? row.getCell(1).getDateCellValue() : null; + LocalDateTime month = reportMonth.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + // 年目标 + String yearTarget = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; + // 占全年目标 + String percentageOfAnnualTarget = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; + // 本月合计 + String thisMonthUsage = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY; + // 累计合计 + String accumulativeUsage = Objects.nonNull(row.getCell(5)) ? row.getCell(5).toString() : StringUtils.EMPTY; + // 本省本月 + String thisProvinceThisMonthUsage = Objects.nonNull(row.getCell(6)) ? row.getCell(6).toString() : StringUtils.EMPTY; + // 本省累计 + String thisProvinceAccumulativeUsage = Objects.nonNull(row.getCell(7)) ? row.getCell(7).toString() : StringUtils.EMPTY; + // 外省本月 + String otherProvinceThisMonthUsage = Objects.nonNull(row.getCell(8)) ? row.getCell(8).toString() : StringUtils.EMPTY; + // 外省累计 + String otherProvinceAccumulativeUsage = Objects.nonNull(row.getCell(9)) ? row.getCell(9).toString() : StringUtils.EMPTY; + + // 区县名称 获取区域ID、上级区域ID + Long regionId = null; + Long cityRegionId = null; + String cityRegionName = null; + for (Map.Entry regionEntry : regionMap.entrySet()) { + String regionNameStr = regionEntry.getKey(); + if (regionNameStr.contains(regionName) && regionNameStr.length() < 4){ + regionName = regionNameStr; + Region region = regionMap.get(regionNameStr); + if (Objects.nonNull(region)) { + regionId = region.getId(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + cityRegionId = regionDto.getParentId(); + cityRegionName = regionDto.getRegionName(); + } + } + } + if (Objects.isNull(regionId)){ + throw new BizException("区域不存在!"); + } + + // 根据地区名称获取对应散装中心的企业信息 + Long companyId; + Long cityCompanyId; + CompanyDTO companyDto = companiesCacheHelper.getByName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + CompanyDTO cityCompanyDto = companiesCacheHelper.getByName(cityRegionName + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.isNull(companyDto) || Objects.isNull(cityCompanyDto)){ + throw new BizException("管理企业不存在!"); + }else { + companyId = companyDto.getId(); + cityCompanyId = cityCompanyDto.getId(); + } + + // 创建市级审核通过申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + cityAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityAuditInfo.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode()); + cityAuditInfo.setCreateOn(month); + cityAuditInfo.setCreateBy(null); + cityAuditInfo.setUpdateOn(month); + cityAuditInfo.setUpdateBy(null); + cityAuditInfo.setAuditTime(month); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 保存上报数据信息 + // 创建上报记录 + BulkCementThreeCityUsageBulletin bulkCementThreeCityUsageBulletIn = new BulkCementThreeCityUsageBulletin(); + bulkCementThreeCityUsageBulletIn.setUnitName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + bulkCementThreeCityUsageBulletIn.setYearTarget(BigDecimal.valueOf(Double.parseDouble(yearTarget))); + bulkCementThreeCityUsageBulletIn.setPercentageOfAnnualTarget(BigDecimal.valueOf(Double.parseDouble(percentageOfAnnualTarget))); + bulkCementThreeCityUsageBulletIn.setThisMonthUsage(BigDecimal.valueOf(Double.parseDouble(thisMonthUsage))); + bulkCementThreeCityUsageBulletIn.setAccumulativeUsage(BigDecimal.valueOf(Double.parseDouble(accumulativeUsage))); + bulkCementThreeCityUsageBulletIn.setThisProvinceThisMonthUsage(BigDecimal.valueOf(Double.parseDouble(thisProvinceThisMonthUsage))); + bulkCementThreeCityUsageBulletIn.setThisProvinceAccumulativeUsage(BigDecimal.valueOf(Double.parseDouble(thisProvinceAccumulativeUsage))); + bulkCementThreeCityUsageBulletIn.setOtherProvinceThisMonthUsage(BigDecimal.valueOf(Double.parseDouble(otherProvinceThisMonthUsage))); + bulkCementThreeCityUsageBulletIn.setOtherProvinceAccumulativeUsage(BigDecimal.valueOf(Double.parseDouble(otherProvinceAccumulativeUsage))); + bulkCementThreeCityUsageBulletIn.setReportMonth(month); + bulkCementThreeCityUsageBulletIn.setCompanyId(companyId); + bulkCementThreeCityUsageBulletIn.setUnitResponsiblePerson(null); + bulkCementThreeCityUsageBulletIn.setPreparer(null); + bulkCementThreeCityUsageBulletIn.setReviewer(null); + bulkCementThreeCityUsageBulletIn.setSubmissionDate(null); + bulkCementThreeCityUsageBulletIn.setRegionId(regionId); + bulkCementThreeCityUsageBulletIn.setCreateOn(month); + bulkCementThreeCityUsageBulletIn.setCreateBy(null); + bulkCementThreeCityUsageBulletIn.setUpdateOn(month); + bulkCementThreeCityUsageBulletIn.setUpdateBy(null); + bulkCementThreeCityUsageBulletIn.setAuditInfoId(cityAuditInfo.getId()); + bulkCementThreeCityUsageBulletIn.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + bulkCementThreeCityUsageBulletinService.saveOrUpdate(bulkCementThreeCityUsageBulletIn); + + // 补充市级数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + auditRecord.setAuditDataId(bulkCementThreeCityUsageBulletIn.getId()); + auditRecord.setAuditInfoId(cityAuditInfo.getId()); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode()); + auditRecord.setCompanyId(companyId); + auditRecord.setRegionId(regionId); + auditRecord.setCreateOn(month.plusDays(20)); + auditRecord.setCreateBy(null); + auditRecord.setUpdateOn(month.plusDays(20)); + auditRecord.setUpdateBy(null); + auditRecord.setReportMonth(month); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + Long relevanceDataId; + // 判断上报月份所在市的关联数据不存在 + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, cityRegionId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, month) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode())); + // 已经存在,更新上报数据ID列表 + if (Objects.nonNull(cityData)){ + String auditDataIdListStr = cityData.getAuditDataIdList(); + List auditDataIdList; + if (StringUtils.isNotBlank(auditDataIdListStr)){ + auditDataIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditDataIdList.contains(bulkCementThreeCityUsageBulletIn.getId())){ + auditDataIdList.add(bulkCementThreeCityUsageBulletIn.getId()); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityData.setAuditDataIdList(idListStr); + } + // 更新最后一次更新时间 + cityData.setLastUpdateTime(LocalDateTime.now()); + cityData.setUpdateOn(LocalDateTime.now()); + cityData.setUpdateBy(null); + // 有新上报的数据,就更新关联数据状态为未上报 + cityData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(cityData); + } + relevanceDataId = cityData.getId(); + }else { + // 补充所在市的关联数据信息 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + cityRelevanceData.setReportMonth(month); + List auditDataIdList = Lists.newArrayList(); + auditDataIdList.add(bulkCementThreeCityUsageBulletIn.getId()); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityRelevanceData.setAuditDataIdList(idListStr); + cityRelevanceData.setUnitResponsiblePerson(null); + cityRelevanceData.setPreparer(null); + cityRelevanceData.setReviewer(null); + cityRelevanceData.setSubmissionDate(null); + cityRelevanceData.setCreateOn(LocalDateTime.now()); + cityRelevanceData.setCreateBy(null); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setLastUpdateTime(LocalDateTime.now()); + cityRelevanceData.setRegionId(cityRegionId); + // 获取所在市散装中心所属的管理企业ID + cityRelevanceData.setCompanyId(cityCompanyId); + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode()); + // 有新上报的数据,就更新关联数据 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + relevanceDataId = cityRelevanceData.getId(); + } + + // 补充省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + provinceAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditInfo.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode()); + provinceAuditInfo.setCreateOn(month); + provinceAuditInfo.setCreateBy(null); + provinceAuditInfo.setUpdateOn(month); + provinceAuditInfo.setUpdateBy(null); + provinceAuditInfo.setAuditTime(month); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + // 更新市级关联数据 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(relevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityRelevanceData.setUpdateOn(month.plusDays(20L)); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setUnitResponsiblePerson(null); + cityRelevanceData.setPreparer(null); + cityRelevanceData.setReviewer(null); + cityRelevanceData.setSubmissionDate(null); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, month) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode())); + // 存在,更新市关联数据ID列表 + if (Objects.nonNull(provinceData)){ + String auditDataIdListStr = provinceData.getAuditDataIdList(); + List auditDataIdList; + if (StringUtils.isNotBlank(auditDataIdListStr)){ + auditDataIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditDataIdList.contains(relevanceDataId)){ + auditDataIdList.add(relevanceDataId); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceData.setAuditDataIdList(idListStr); + } + // 更新最后一次更新时间 + provinceData.setLastUpdateTime(month); + provinceData.setUpdateOn(month); + provinceData.setUpdateBy(null); + // 有新上报的数据,就更新关联数据状态为审核中 + provinceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(provinceData); + } + }else { + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + provinceRelevanceData.setReportMonth(month); + List auditDataIdList = Lists.newArrayList(); + auditDataIdList.add(relevanceDataId); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceRelevanceData.setAuditDataIdList(idListStr); + + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setCreateOn(month); + provinceRelevanceData.setCreateBy(null); + provinceRelevanceData.setUpdateOn(month); + provinceRelevanceData.setUpdateBy(null); + provinceRelevanceData.setLastUpdateTime(month); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO provinceCompanyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(provinceCompanyDto)) { + provinceRelevanceData.setCompanyId(provinceCompanyDto.getId()); + } + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + provinceAuditRecord.setAuditDataId(cityRelevanceData.getId()); + provinceAuditRecord.setAuditInfoId(provinceAuditInfo.getId()); + provinceAuditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditRecord.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_THREE_CITY_USAGE_BULLETIN.getCode()); + provinceAuditRecord.setCompanyId(cityRelevanceData.getCompanyId()); + provinceAuditRecord.setRegionId(cityRelevanceData.getRegionId()); + provinceAuditRecord.setCreateOn(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setCreateBy(null); + provinceAuditRecord.setUpdateOn(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setUpdateBy(null); + provinceAuditRecord.setReportMonth(month); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + + System.out.println("已成功插入第" + i + "条数据!"); + } + } + } + + + /** + * 计算温台舟使用量数据同比增长率 + */ + @Test + public void calculateBulkCementThreeCityUsageGrowthRateTest() { + + List dataList = bulkCementThreeCityUsageBulletinService.list(); + for (BulkCementThreeCityUsageBulletin data : dataList) { + LocalDateTime reportMonth = data.getReportMonth(); + Long regionId = data.getRegionId(); + LocalDateTime preReportMonth = reportMonth.minusMonths(1L); + // 获取去年当前上报月份该地区的散装水泥使用量数据 + LocalDateTime preYearReportMonth = preReportMonth.minusYears(1L); + BulkCementThreeCityUsageBulletin preYearBulkCementThreeCityUsageBulletin = bulkCementThreeCityUsageBulletinService.getOne(Wrappers.lambdaQuery(BulkCementThreeCityUsageBulletin.class) + .eq(BulkCementThreeCityUsageBulletin::getRegionId, regionId) + .eq(BulkCementThreeCityUsageBulletin::getReportMonth, preYearReportMonth)); + if (Objects.isNull(preYearBulkCementThreeCityUsageBulletin)) { + // 如果去年没有数据,那么今年的数据就不用计算了 + continue; + } + BigDecimal accumulativeUsage = data.getAccumulativeUsage(); + // 同比增长率: (今年这个月的累计使用量 - 去年这个月的累计使用量) / 去年这个月的累计使用量 * 100 + BigDecimal preYearAccumulativeUsage = preYearBulkCementThreeCityUsageBulletin.getAccumulativeUsage(); + BigDecimal preYearAccUsage = Objects.isNull(preYearAccumulativeUsage) ? BigDecimal.ZERO : preYearAccumulativeUsage; + BigDecimal growthRate = accumulativeUsage.subtract(preYearAccUsage).divide(preYearAccUsage, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100L)); + data.setGrowthRate(growthRate); + bulkCementThreeCityUsageBulletinService.updateById(data); + } + } + + @Test + public void concreteSupplyTest() throws FileNotFoundException { + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2022-01.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2022-02.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2022-03.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2022-04.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2022-05.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2022-06.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2022-07.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2022-08.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2022-09.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2022-10.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2022-11.xlsx"); + File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2022-12.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2023-01.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2023-02.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2023-03.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2023-04.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2023-05.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2023-06.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2023-07.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2023-08.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\混凝土供应量快报\\混凝土供应量快报-2023-09.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + List userList = Lists.newArrayList(); + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 根据区县名称获取区域ID + HashSet countySet = new HashSet<>(); + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + // 单位 + String regionName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 上报月份 + Date reportMonth = Objects.nonNull(row.getCell(1)) ? row.getCell(1).getDateCellValue() : null; + LocalDateTime month = reportMonth.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + // 三类指导目标 + String threeCategoryGuidGoal = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; + // 生产企业数量 + String productionCompanyNums = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; + // 年设计生产能力 + String annualDesignProductionCapacity = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY; + // 本月实际产量 + String thisMonthOutput = Objects.nonNull(row.getCell(5)) ? row.getCell(5).toString() : StringUtils.EMPTY; + // 累计实际产量 + String accumulativeOutput = Objects.nonNull(row.getCell(6)) ? row.getCell(6).toString() : StringUtils.EMPTY; + // 本月使用散装水泥量 + String thisMonthCementUsage = Objects.nonNull(row.getCell(7)) ? row.getCell(7).toString() : StringUtils.EMPTY; + // 累计使用散装水泥量 + String cementAccumulativeUsage = Objects.nonNull(row.getCell(8)) ? row.getCell(8).toString() : StringUtils.EMPTY; + // 本月废弃物综合利用量 + String thisMonthWasteUtilization = Objects.nonNull(row.getCell(9)) ? row.getCell(9).toString() : StringUtils.EMPTY; + // 累计废弃物综合利用量 + String accumulativeWasteUtilization = Objects.nonNull(row.getCell(10)) ? row.getCell(10).toString() : StringUtils.EMPTY; + + + // 区县名称 获取区域ID、上级区域ID + Long regionId = null; + Long cityRegionId = null; + String cityRegionName = null; + for (Map.Entry regionEntry : regionMap.entrySet()) { + String regionNameStr = regionEntry.getKey(); + if (regionNameStr.contains(regionName) && regionNameStr.length() < 4){ + regionName = regionNameStr; + Region region = regionMap.get(regionNameStr); + if (Objects.nonNull(region)) { + regionId = region.getId(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + cityRegionId = regionDto.getParentId(); + cityRegionName = regionDto.getRegionName(); + } + } else if ((regionNameStr.contains(regionName) && regionNameStr.equals("丽水经济技术开发区")) || + (regionNameStr.contains(regionName) && regionNameStr.equals("景宁畲族自治县"))) { + regionName = regionNameStr; + Region region = regionMap.get(regionNameStr); + if (Objects.nonNull(region)) { + regionId = region.getId(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + cityRegionId = regionDto.getParentId(); + cityRegionName = regionDto.getRegionName(); + } + } + } + if (Objects.isNull(regionId)){ + throw new BizException("区域不存在!"); + } + + // 根据地区名称获取对应散装中心的企业信息 + Long companyId; + Long cityCompanyId; + CompanyDTO companyDto = companiesCacheHelper.getByName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + CompanyDTO cityCompanyDto = companiesCacheHelper.getByName(cityRegionName + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.isNull(companyDto) || Objects.isNull(cityCompanyDto)){ + throw new BizException("管理企业不存在!"); + }else { + companyId = companyDto.getId(); + cityCompanyId = cityCompanyDto.getId(); + } + + // 创建市级审核通过申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + cityAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityAuditInfo.setAuditDataType(UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode()); + cityAuditInfo.setCreateOn(month); + cityAuditInfo.setCreateBy(null); + cityAuditInfo.setUpdateOn(month); + cityAuditInfo.setUpdateBy(null); + cityAuditInfo.setAuditTime(month); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 保存上报数据信息 + // 创建上报记录 + ConcreteSupplyBulletin concreteSupplyBulletin = new ConcreteSupplyBulletin(); + concreteSupplyBulletin.setUnitName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + concreteSupplyBulletin.setThreeCategoryGuidGoal(BigDecimal.valueOf(Double.parseDouble(threeCategoryGuidGoal))); + Double d = Double.parseDouble(productionCompanyNums); + int proNum = d.intValue(); + concreteSupplyBulletin.setProductionCompanyNums(proNum); + concreteSupplyBulletin.setAnnualDesignProductionCapacity(BigDecimal.valueOf(Double.parseDouble(annualDesignProductionCapacity))); + concreteSupplyBulletin.setThisMonthOutput(BigDecimal.valueOf(Double.parseDouble(thisMonthOutput))); + concreteSupplyBulletin.setAccumulativeOutput(BigDecimal.valueOf(Double.parseDouble(accumulativeOutput))); + concreteSupplyBulletin.setThisMonthCementUsage(BigDecimal.valueOf(Double.parseDouble(thisMonthCementUsage))); + concreteSupplyBulletin.setCementAccumulativeUsage(BigDecimal.valueOf(Double.parseDouble(cementAccumulativeUsage))); + concreteSupplyBulletin.setThisMonthWasteUtilization(BigDecimal.valueOf(Double.parseDouble(thisMonthWasteUtilization))); + concreteSupplyBulletin.setAccumulativeWasteUtilization(BigDecimal.valueOf(Double.parseDouble(accumulativeWasteUtilization))); + concreteSupplyBulletin.setReportMonth(month); + concreteSupplyBulletin.setCompanyId(companyId); + concreteSupplyBulletin.setUnitResponsiblePerson(null); + concreteSupplyBulletin.setPreparer(null); + concreteSupplyBulletin.setReviewer(null); + concreteSupplyBulletin.setSubmissionDate(null); + concreteSupplyBulletin.setRegionId(regionId); + concreteSupplyBulletin.setCreateOn(month); + concreteSupplyBulletin.setCreateBy(null); + concreteSupplyBulletin.setUpdateOn(month); + concreteSupplyBulletin.setUpdateBy(null); + concreteSupplyBulletin.setAuditInfoId(cityAuditInfo.getId()); + concreteSupplyBulletin.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + concreteSupplyBulletinService.saveOrUpdate(concreteSupplyBulletin); + + // 补充市级数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + auditRecord.setAuditDataId(concreteSupplyBulletin.getId()); + auditRecord.setAuditInfoId(cityAuditInfo.getId()); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode()); + auditRecord.setCompanyId(companyId); + auditRecord.setRegionId(regionId); + auditRecord.setCreateOn(month.plusDays(20)); + auditRecord.setCreateBy(null); + auditRecord.setUpdateOn(month.plusDays(20)); + auditRecord.setUpdateBy(null); + auditRecord.setReportMonth(month); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + Long relevanceDataId; + // 判断上报月份所在市的关联数据不存在 + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, cityRegionId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, month) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode())); + // 已经存在,更新上报数据ID列表 + if (Objects.nonNull(cityData)){ + String auditDataIdListStr = cityData.getAuditDataIdList(); + List auditDataIdList; + if (StringUtils.isNotBlank(auditDataIdListStr)){ + auditDataIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditDataIdList.contains(concreteSupplyBulletin.getId())){ + auditDataIdList.add(concreteSupplyBulletin.getId()); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityData.setAuditDataIdList(idListStr); + } + // 更新最后一次更新时间 + cityData.setLastUpdateTime(LocalDateTime.now()); + cityData.setUpdateOn(LocalDateTime.now()); + cityData.setUpdateBy(null); + // 有新上报的数据,就更新关联数据状态为未上报 + cityData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(cityData); + } + relevanceDataId = cityData.getId(); + }else { + // 补充所在市的关联数据信息 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + cityRelevanceData.setReportMonth(month); + List auditDataIdList = Lists.newArrayList(); + auditDataIdList.add(concreteSupplyBulletin.getId()); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityRelevanceData.setAuditDataIdList(idListStr); + cityRelevanceData.setUnitResponsiblePerson(null); + cityRelevanceData.setPreparer(null); + cityRelevanceData.setReviewer(null); + cityRelevanceData.setSubmissionDate(null); + cityRelevanceData.setCreateOn(LocalDateTime.now()); + cityRelevanceData.setCreateBy(null); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setLastUpdateTime(LocalDateTime.now()); + cityRelevanceData.setRegionId(cityRegionId); + // 获取所在市散装中心所属的管理企业ID + cityRelevanceData.setCompanyId(cityCompanyId); + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode()); + // 有新上报的数据,就更新关联数据 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + relevanceDataId = cityRelevanceData.getId(); + } + + // 补充省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + provinceAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditInfo.setAuditDataType(UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode()); + provinceAuditInfo.setCreateOn(month); + provinceAuditInfo.setCreateBy(null); + provinceAuditInfo.setUpdateOn(month); + provinceAuditInfo.setUpdateBy(null); + provinceAuditInfo.setAuditTime(month); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + // 更新市级关联数据 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(relevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityRelevanceData.setUpdateOn(month.plusDays(20L)); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setUnitResponsiblePerson(null); + cityRelevanceData.setPreparer(null); + cityRelevanceData.setReviewer(null); + cityRelevanceData.setSubmissionDate(null); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, month) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode())); + // 存在,更新市关联数据ID列表 + if (Objects.nonNull(provinceData)){ + String auditDataIdListStr = provinceData.getAuditDataIdList(); + List auditDataIdList; + if (StringUtils.isNotBlank(auditDataIdListStr)){ + auditDataIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditDataIdList.contains(relevanceDataId)){ + auditDataIdList.add(relevanceDataId); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceData.setAuditDataIdList(idListStr); + } + // 更新最后一次更新时间 + provinceData.setLastUpdateTime(month); + provinceData.setUpdateOn(month); + provinceData.setUpdateBy(null); + // 有新上报的数据,就更新关联数据状态为审核中 + provinceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(provinceData); + } + }else { + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + provinceRelevanceData.setReportMonth(month); + List auditDataIdList = Lists.newArrayList(); + auditDataIdList.add(relevanceDataId); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceRelevanceData.setAuditDataIdList(idListStr); + + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setCreateOn(month); + provinceRelevanceData.setCreateBy(null); + provinceRelevanceData.setUpdateOn(month); + provinceRelevanceData.setUpdateBy(null); + provinceRelevanceData.setLastUpdateTime(month); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO provinceCompanyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(provinceCompanyDto)) { + provinceRelevanceData.setCompanyId(provinceCompanyDto.getId()); + } + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + provinceAuditRecord.setAuditDataId(cityRelevanceData.getId()); + provinceAuditRecord.setAuditInfoId(provinceAuditInfo.getId()); + provinceAuditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditRecord.setAuditDataType(UploadDataTypeEnum.CONCRETE_SUPPLY_BULLETIN.getCode()); + provinceAuditRecord.setCompanyId(cityRelevanceData.getCompanyId()); + provinceAuditRecord.setRegionId(cityRelevanceData.getRegionId()); + provinceAuditRecord.setCreateOn(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setCreateBy(null); + provinceAuditRecord.setUpdateOn(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setUpdateBy(null); + provinceAuditRecord.setReportMonth(month); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + + System.out.println("已成功插入第" + i + "条数据!"); + } + } + } + + @Test + public void mortarSupplyTest() throws FileNotFoundException { + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2022-01.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2022-02.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2022-03.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2022-04.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2022-05.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2022-06.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2022-07.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2022-08.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2022-09.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2022-10.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2022-11.xlsx"); + File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2022-12.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2023-01.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2023-02.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2023-03.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2023-04.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2023-05.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2023-06.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2023-07.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2023-08.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\砂浆供应量快报\\砂浆供应量快报-2023-09.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + List userList = Lists.newArrayList(); + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 根据区县名称获取区域ID + HashSet countySet = new HashSet<>(); + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + // 地区 + String regionName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 上报月份 + Date reportMonth = Objects.nonNull(row.getCell(1)) ? row.getCell(1).getDateCellValue() : null; + LocalDateTime month = reportMonth.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + // 二类指导目标 + String twoCategoryGuidGoal = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; + // 普通干混砂浆生产企业数量 + String dryMixedMortarProductionCompanyNum = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; + // 普通干混砂浆生产总能力 + String dryMixedMortarProductiveCapacity = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY; + // 普通干混砂浆散装能力 + String dryMixedMortarBulkCapacity = Objects.nonNull(row.getCell(5)) ? row.getCell(5).toString() : StringUtils.EMPTY; + // 本月总产量 + String thisMonthTotalOutput = Objects.nonNull(row.getCell(6)) ? row.getCell(6).toString() : StringUtils.EMPTY; + // 本月累计产量 + String thisMonthAccumulativeOutput = Objects.nonNull(row.getCell(7)) ? row.getCell(7).toString() : StringUtils.EMPTY; + // 普通干混砂浆本月产量 + String dryMixedMortarThisMonthOutput = Objects.nonNull(row.getCell(8)) ? row.getCell(8).toString() : StringUtils.EMPTY; + // 普通干混砂浆累计产量 + String dryMixedMortarThisMonthAccumulativeOutput = Objects.nonNull(row.getCell(9)) ? row.getCell(9).toString() : StringUtils.EMPTY; + // 普通干混砂浆同比增长量 + String dryMixedMortarIncrement = Objects.nonNull(row.getCell(10)) ? row.getCell(10).toString() : StringUtils.EMPTY; + // 普通干混砂浆增长率 + String dryMixedMortarGrowthRate = Objects.nonNull(row.getCell(11)) ? row.getCell(11).toString() : StringUtils.EMPTY; + // 普通干混砂浆本月散装量 + String dryMixedMortarThisMonthBulkQuantity = Objects.nonNull(row.getCell(12)) ? row.getCell(12).toString() : StringUtils.EMPTY; + // 普通干混砂浆累计散装量 + String dryMixedMortarAccumulativeBulkQuantity = Objects.nonNull(row.getCell(13)) ? row.getCell(13).toString() : StringUtils.EMPTY; + // 湿拌砂浆本月产量 + String wetMortarThisMonthOutput = Objects.nonNull(row.getCell(14)) ? row.getCell(14).toString() : StringUtils.EMPTY; + // 湿拌砂浆累计产量 + String wetMortarAccumulativeOutput = Objects.nonNull(row.getCell(15)) ? row.getCell(15).toString() : StringUtils.EMPTY; + // 散装水泥本月使用量 + String bulkCementThisMonthUsage = Objects.nonNull(row.getCell(16)) ? row.getCell(16).toString() : StringUtils.EMPTY; + // 散装水泥累计使用量 + String bulkCementAccumulativeUsage = Objects.nonNull(row.getCell(17)) ? row.getCell(17).toString() : StringUtils.EMPTY; + // 废弃物本月综合利用量 + String wasteThisMonthComprehensiveUtilization = Objects.nonNull(row.getCell(18)) ? row.getCell(18).toString() : StringUtils.EMPTY; + // 废弃物累计综合利用量 + String wasteAccumulativeComprehensiveUtilization = Objects.nonNull(row.getCell(19)) ? row.getCell(19).toString() : StringUtils.EMPTY; + + + // 区县名称 获取区域ID、上级区域ID + Long regionId = null; + Long cityRegionId = null; + String cityRegionName = null; + for (Map.Entry regionEntry : regionMap.entrySet()) { + String regionNameStr = regionEntry.getKey(); + if (regionNameStr.contains(regionName) && regionNameStr.length() < 4){ + regionName = regionNameStr; + Region region = regionMap.get(regionNameStr); + if (Objects.nonNull(region)) { + regionId = region.getId(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + cityRegionId = regionDto.getParentId(); + cityRegionName = regionDto.getRegionName(); + } + } else if ((regionNameStr.contains(regionName) && regionNameStr.equals("丽水经济技术开发区")) || + (regionNameStr.contains(regionName) && regionNameStr.equals("景宁畲族自治县"))) { + regionName = regionNameStr; + Region region = regionMap.get(regionNameStr); + if (Objects.nonNull(region)) { + regionId = region.getId(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + cityRegionId = regionDto.getParentId(); + cityRegionName = regionDto.getRegionName(); + } + } + } + if (Objects.isNull(regionId)){ + throw new BizException("区域不存在!"); + } + + // 根据地区名称获取对应散装中心的企业信息 + Long companyId; + Long cityCompanyId; + CompanyDTO companyDto = companiesCacheHelper.getByName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + CompanyDTO cityCompanyDto = companiesCacheHelper.getByName(cityRegionName + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.isNull(companyDto) || Objects.isNull(cityCompanyDto)){ + throw new BizException("管理企业不存在!"); + }else { + companyId = companyDto.getId(); + cityCompanyId = cityCompanyDto.getId(); + } + + // 创建市级审核通过申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + cityAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityAuditInfo.setAuditDataType(UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode()); + cityAuditInfo.setCreateOn(month); + cityAuditInfo.setCreateBy(null); + cityAuditInfo.setUpdateOn(month); + cityAuditInfo.setUpdateBy(null); + cityAuditInfo.setAuditTime(month); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 保存上报数据信息 + // 创建上报记录 + MortarSupplyBulletin mortarSupplyBulletin = new MortarSupplyBulletin(); + mortarSupplyBulletin.setRegionName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + mortarSupplyBulletin.setTwoCategoryGuidGoal(BigDecimal.valueOf(Double.parseDouble(twoCategoryGuidGoal))); + Double d = Double.parseDouble(dryMixedMortarProductionCompanyNum); + int proNum = d.intValue(); + mortarSupplyBulletin.setDryMixedMortarProductionCompanyNum(proNum); + mortarSupplyBulletin.setDryMixedMortarProductiveCapacity(BigDecimal.valueOf(Double.parseDouble(dryMixedMortarProductiveCapacity))); + mortarSupplyBulletin.setDryMixedMortarBulkCapacity(BigDecimal.valueOf(Double.parseDouble(dryMixedMortarBulkCapacity))); + mortarSupplyBulletin.setThisMonthTotalOutput(BigDecimal.valueOf(Double.parseDouble(thisMonthTotalOutput))); + mortarSupplyBulletin.setThisMonthAccumulativeOutput(BigDecimal.valueOf(Double.parseDouble(thisMonthAccumulativeOutput))); + mortarSupplyBulletin.setDryMixedMortarThisMonthOutput(BigDecimal.valueOf(Double.parseDouble(dryMixedMortarThisMonthOutput))); + mortarSupplyBulletin.setDryMixedMortarThisMonthAccumulativeOutput(BigDecimal.valueOf(Double.parseDouble(dryMixedMortarThisMonthAccumulativeOutput))); + mortarSupplyBulletin.setDryMixedMortarIncrement(BigDecimal.valueOf(Double.parseDouble(dryMixedMortarIncrement))); + mortarSupplyBulletin.setDryMixedMortarGrowthRate(BigDecimal.valueOf(Double.parseDouble(dryMixedMortarGrowthRate))); + mortarSupplyBulletin.setDryMixedMortarThisMonthBulkQuantity(BigDecimal.valueOf(Double.parseDouble(dryMixedMortarThisMonthBulkQuantity))); + mortarSupplyBulletin.setDryMixedMortarAccumulativeBulkQuantity(BigDecimal.valueOf(Double.parseDouble(dryMixedMortarAccumulativeBulkQuantity))); + mortarSupplyBulletin.setWetMortarThisMonthOutput(BigDecimal.valueOf(Double.parseDouble(wetMortarThisMonthOutput))); + mortarSupplyBulletin.setWetMortarAccumulativeOutput(BigDecimal.valueOf(Double.parseDouble(wetMortarAccumulativeOutput))); + mortarSupplyBulletin.setBulkCementThisMonthUsage(BigDecimal.valueOf(Double.parseDouble(bulkCementThisMonthUsage))); + mortarSupplyBulletin.setBulkCementAccumulativeUsage(BigDecimal.valueOf(Double.parseDouble(bulkCementAccumulativeUsage))); + mortarSupplyBulletin.setWasteThisMonthComprehensiveUtilization(BigDecimal.valueOf(Double.parseDouble(wasteThisMonthComprehensiveUtilization))); + mortarSupplyBulletin.setWasteAccumulativeComprehensiveUtilization(BigDecimal.valueOf(Double.parseDouble(wasteAccumulativeComprehensiveUtilization))); + mortarSupplyBulletin.setReportMonth(month); + mortarSupplyBulletin.setCompanyId(companyId); + mortarSupplyBulletin.setUnitResponsiblePerson(null); + mortarSupplyBulletin.setPreparer(null); + mortarSupplyBulletin.setReviewer(null); + mortarSupplyBulletin.setSubmissionDate(null); + mortarSupplyBulletin.setRegionId(regionId); + mortarSupplyBulletin.setCreateOn(month); + mortarSupplyBulletin.setCreateBy(null); + mortarSupplyBulletin.setUpdateOn(month); + mortarSupplyBulletin.setUpdateBy(null); + mortarSupplyBulletin.setAuditInfoId(cityAuditInfo.getId()); + mortarSupplyBulletin.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + mortarSupplyBulletinService.saveOrUpdate(mortarSupplyBulletin); + + // 补充市级数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + auditRecord.setAuditDataId(mortarSupplyBulletin.getId()); + auditRecord.setAuditInfoId(cityAuditInfo.getId()); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode()); + auditRecord.setCompanyId(companyId); + auditRecord.setRegionId(regionId); + auditRecord.setCreateOn(month.plusDays(20)); + auditRecord.setCreateBy(null); + auditRecord.setUpdateOn(month.plusDays(20)); + auditRecord.setUpdateBy(null); + auditRecord.setReportMonth(month); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + Long relevanceDataId; + // 判断上报月份所在市的关联数据不存在 + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, cityRegionId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, month) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode())); + // 已经存在,更新上报数据ID列表 + if (Objects.nonNull(cityData)){ + String auditDataIdListStr = cityData.getAuditDataIdList(); + List auditDataIdList; + if (StringUtils.isNotBlank(auditDataIdListStr)){ + auditDataIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditDataIdList.contains(mortarSupplyBulletin.getId())){ + auditDataIdList.add(mortarSupplyBulletin.getId()); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityData.setAuditDataIdList(idListStr); + } + // 更新最后一次更新时间 + cityData.setLastUpdateTime(LocalDateTime.now()); + cityData.setUpdateOn(LocalDateTime.now()); + cityData.setUpdateBy(null); + // 有新上报的数据,就更新关联数据状态为未上报 + cityData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(cityData); + } + relevanceDataId = cityData.getId(); + }else { + // 补充所在市的关联数据信息 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + cityRelevanceData.setReportMonth(month); + List auditDataIdList = Lists.newArrayList(); + auditDataIdList.add(mortarSupplyBulletin.getId()); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityRelevanceData.setAuditDataIdList(idListStr); + cityRelevanceData.setUnitResponsiblePerson(null); + cityRelevanceData.setPreparer(null); + cityRelevanceData.setReviewer(null); + cityRelevanceData.setSubmissionDate(null); + cityRelevanceData.setCreateOn(LocalDateTime.now()); + cityRelevanceData.setCreateBy(null); + cityRelevanceData.setUpdateOn(LocalDateTime.now()); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setLastUpdateTime(LocalDateTime.now()); + cityRelevanceData.setRegionId(cityRegionId); + // 获取所在市散装中心所属的管理企业ID + cityRelevanceData.setCompanyId(cityCompanyId); + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode()); + // 有新上报的数据,就更新关联数据 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + relevanceDataId = cityRelevanceData.getId(); + } + + // 补充省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + provinceAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditInfo.setAuditDataType(UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode()); + provinceAuditInfo.setCreateOn(month); + provinceAuditInfo.setCreateBy(null); + provinceAuditInfo.setUpdateOn(month); + provinceAuditInfo.setUpdateBy(null); + provinceAuditInfo.setAuditTime(month); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + // 更新市级关联数据 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(relevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityRelevanceData.setUpdateOn(month.plusDays(20L)); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setUnitResponsiblePerson(null); + cityRelevanceData.setPreparer(null); + cityRelevanceData.setReviewer(null); + cityRelevanceData.setSubmissionDate(null); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportMonth, month) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode())); + // 存在,更新市关联数据ID列表 + if (Objects.nonNull(provinceData)){ + String auditDataIdListStr = provinceData.getAuditDataIdList(); + List auditDataIdList; + if (StringUtils.isNotBlank(auditDataIdListStr)){ + auditDataIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditDataIdList.contains(relevanceDataId)){ + auditDataIdList.add(relevanceDataId); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceData.setAuditDataIdList(idListStr); + } + // 更新最后一次更新时间 + provinceData.setLastUpdateTime(month); + provinceData.setUpdateOn(month); + provinceData.setUpdateBy(null); + // 有新上报的数据,就更新关联数据状态为审核中 + provinceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(provinceData); + } + }else { + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + provinceRelevanceData.setReportMonth(month); + List auditDataIdList = Lists.newArrayList(); + auditDataIdList.add(relevanceDataId); + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceRelevanceData.setAuditDataIdList(idListStr); + + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setCreateOn(month); + provinceRelevanceData.setCreateBy(null); + provinceRelevanceData.setUpdateOn(month); + provinceRelevanceData.setUpdateBy(null); + provinceRelevanceData.setLastUpdateTime(month); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO provinceCompanyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(provinceCompanyDto)) { + provinceRelevanceData.setCompanyId(provinceCompanyDto.getId()); + } + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + provinceAuditRecord.setAuditDataId(cityRelevanceData.getId()); + provinceAuditRecord.setAuditInfoId(provinceAuditInfo.getId()); + provinceAuditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditRecord.setAuditDataType(UploadDataTypeEnum.MORTAR_SUPPLY_BULLETIN.getCode()); + provinceAuditRecord.setCompanyId(cityRelevanceData.getCompanyId()); + provinceAuditRecord.setRegionId(cityRelevanceData.getRegionId()); + provinceAuditRecord.setCreateOn(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setCreateBy(null); + provinceAuditRecord.setUpdateOn(cityRelevanceData.getReportMonth()); + provinceAuditRecord.setUpdateBy(null); + provinceAuditRecord.setReportMonth(month); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + + System.out.println("已成功插入第" + i + "条数据!"); + } + } + } + + @Test + public void bulkCementLogFacStaTest() throws FileNotFoundException { + // ------------------------------------------杭州市------------------------------------- + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\杭州市\\萧山.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\杭州市\\余杭.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\杭州市\\富阳.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\杭州市\\桐庐.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\杭州市\\建德.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\杭州市\\临安.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\杭州市\\淳安.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\杭州市\\钱塘.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\杭州市\\临平.xlsx"); + // ------------------------------------------宁波市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\宁波市\\余姚.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\宁波市\\慈溪.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\宁波市\\象山.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\宁波市\\宁海.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\宁波市\\鄞州.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\宁波市\\北仑.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\宁波市\\镇海.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\宁波市\\奉化.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\宁波市\\江北.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\宁波市\\海曙.xlsx"); + // ------------------------------------------温州市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\温州市\\鹿城.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\温州市\\瓯海.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\温州市\\龙湾.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\温州市\\瑞安.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\温州市\\乐清.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\温州市\\永嘉.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\温州市\\平阳.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\温州市\\苍南.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\温州市\\文成.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\温州市\\洞头.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\温州市\\泰顺.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\温州市\\龙港.xlsx"); + // ------------------------------------------嘉兴市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\嘉兴市\\南湖.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\嘉兴市\\秀洲.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\嘉兴市\\嘉善.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\嘉兴市\\平湖.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\嘉兴市\\海盐.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\嘉兴市\\海宁.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\嘉兴市\\桐乡.xlsx"); + // ------------------------------------------湖州市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\湖州市\\德清.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\湖州市\\长兴.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\湖州市\\安吉.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\湖州市\\吴兴.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\湖州市\\吴兴.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\湖州市\\南浔.xlsx"); + // ------------------------------------------绍兴市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\绍兴市\\越城.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\绍兴市\\柯桥.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\绍兴市\\诸暨.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\绍兴市\\上虞.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\绍兴市\\嵊州.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\绍兴市\\新昌.xlsx"); + // ------------------------------------------金华市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\金华市\\金东.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\金华市\\婺城.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\金华市\\兰溪.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\金华市\\浦江.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\金华市\\东阳.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\金华市\\义乌.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\金华市\\永康.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\金华市\\武义.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\金华市\\磐安.xlsx"); + // ------------------------------------------衢州市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\衢州市\\衢江.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\衢州市\\江山.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\衢州市\\常山.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\衢州市\\开化.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\衢州市\\龙游.xlsx"); + // ------------------------------------------舟山市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\舟山市\\定海.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\舟山市\\普陀.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\舟山市\\岱山.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\舟山市\\嵊泗.xlsx"); + // ------------------------------------------台州市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\台州市\\椒江.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\台州市\\路桥.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\台州市\\黄岩.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\台州市\\临海.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\台州市\\温岭.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\台州市\\仙居.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\台州市\\天台.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\台州市\\三门.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\台州市\\玉环.xlsx"); + // ------------------------------------------丽水市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\丽水市\\莲都.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\丽水市\\青田.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\丽水市\\缙云.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\丽水市\\松阳.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\丽水市\\遂昌.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\丽水市\\龙泉.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\丽水市\\云和.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\丽水市\\景宁畲族自治县.xlsx"); + File f = new File("D:\\work\\水泥车直报系统\\data\\物流设施统计年报\\丽水市\\丽水经济技术开发区.xlsx"); + + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + List userList = Lists.newArrayList(); + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 根据区县名称获取区域ID + HashSet countySet = new HashSet<>(); + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + + List dataList = Lists.newArrayList(); + + Long regionId = null; + Long cityRegionId = null; + String cityRegionName = null; + + Long companyId = null; + Long cityCompanyId = null; + + String unitResponsiblePerson = null; + String preparer = null; + String reviewer = null; + LocalDateTime subDate = null; + + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + // 地区 + String regionName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 上报年份 + String reportYear = Objects.nonNull(row.getCell(1)) ? row.getCell(1).toString() : null; + Double parseDouble = Double.parseDouble(reportYear); + int year = parseDouble.intValue(); + // 设备名称 + String facilityName = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; + // 年初数量 + String yearBeginNum = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; + // 年初容量 + String yearBeginCapacity = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY; + // 本年新增数量 + String thisYearNewAddNum = Objects.nonNull(row.getCell(5)) ? row.getCell(5).toString() : StringUtils.EMPTY; + // 本年新增容量 + String thisYearNewAddCapacity = Objects.nonNull(row.getCell(6)) ? row.getCell(6).toString() : StringUtils.EMPTY; + // 本年报废数量 + String thisYearScrapNum = Objects.nonNull(row.getCell(7)) ? row.getCell(7).toString() : StringUtils.EMPTY; + // 本年报废容量 + String thisYearScrapCapacity = Objects.nonNull(row.getCell(8)) ? row.getCell(8).toString() : StringUtils.EMPTY; + // 年末数量 + String yearEndNum = Objects.nonNull(row.getCell(9)) ? row.getCell(9).toString() : StringUtils.EMPTY; + // 年末容量 + String yearEndCapacity = Objects.nonNull(row.getCell(10)) ? row.getCell(10).toString() : StringUtils.EMPTY; + // 本年实际作业量 + String thisYearWorkAmount = Objects.nonNull(row.getCell(11)) ? row.getCell(11).toString() : StringUtils.EMPTY; + // 单位负责人 + unitResponsiblePerson = Objects.nonNull(row.getCell(12)) ? row.getCell(12).toString() : StringUtils.EMPTY; + // 填表人 + preparer = Objects.nonNull(row.getCell(13)) ? row.getCell(13).toString() : StringUtils.EMPTY; + // 复核人 + reviewer = Objects.nonNull(row.getCell(14)) ? row.getCell(14).toString() : StringUtils.EMPTY; + // 报出日期 + Date submissionDate = Objects.nonNull(row.getCell(15)) ? row.getCell(15).getDateCellValue() : null; + if (Objects.nonNull(submissionDate)) { + subDate = submissionDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + }else { + subDate = LocalDateTime.now().minusMonths(9).minusDays(15L); + } + + // 区县名称 获取区域ID、上级区域ID + for (Map.Entry regionEntry : regionMap.entrySet()) { + String regionNameStr = regionEntry.getKey(); + if (regionNameStr.contains(regionName) && regionNameStr.length() < 4){ + regionName = regionNameStr; + Region region = regionMap.get(regionNameStr); + if (Objects.nonNull(region)) { + regionId = region.getId(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + cityRegionId = regionDto.getParentId(); + cityRegionName = regionDto.getRegionName(); + } + } else if ((regionNameStr.contains(regionName) && regionNameStr.equals("丽水经济技术开发区")) || + (regionNameStr.contains(regionName) && regionNameStr.equals("景宁畲族自治县"))) { + regionName = regionNameStr; + Region region = regionMap.get(regionNameStr); + if (Objects.nonNull(region)) { + regionId = region.getId(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + cityRegionId = regionDto.getParentId(); + cityRegionName = regionDto.getRegionName(); + } + } + } + if (Objects.isNull(regionId)){ + throw new BizException("区域不存在!"); + } + + // 根据地区名称获取对应散装中心的企业信息 + CompanyDTO companyDto = companiesCacheHelper.getByName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + CompanyDTO cityCompanyDto = companiesCacheHelper.getByName(cityRegionName + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.isNull(companyDto) || Objects.isNull(cityCompanyDto)){ + throw new BizException("管理企业不存在!"); + }else { + companyId = companyDto.getId(); + cityCompanyId = cityCompanyDto.getId(); + } + + ReqBulkCementLogFacStaDataUploadDTO uploadDto = new ReqBulkCementLogFacStaDataUploadDTO(); + uploadDto.setRegionName(regionName); + uploadDto.setCompanyId(companyId); + uploadDto.setRegionId(regionId); + uploadDto.setFacilityName(facilityName); + Double d = Double.parseDouble(yearBeginNum); + int beginNum = d.intValue(); + uploadDto.setYearBeginNum(beginNum); + uploadDto.setYearBeginCapacity(BigDecimal.valueOf(Double.parseDouble(yearBeginCapacity))); + Double d2 = Double.parseDouble(thisYearNewAddNum); + int newAddNum = d2.intValue(); + uploadDto.setThisYearNewAddNum(newAddNum); + uploadDto.setThisYearNewAddCapacity(BigDecimal.valueOf(Double.parseDouble(thisYearNewAddCapacity))); + Double d3 = Double.parseDouble(thisYearScrapNum); + int scrapNum = d3.intValue(); + uploadDto.setThisYearScrapNum(scrapNum); + uploadDto.setThisYearScrapCapacity(BigDecimal.valueOf(Double.parseDouble(thisYearScrapCapacity))); + Double d4 = Double.parseDouble(yearEndNum); + int endNum = d4.intValue(); + uploadDto.setYearEndNum(endNum); + uploadDto.setYearEndCapacity(BigDecimal.valueOf(Double.parseDouble(yearEndCapacity))); + uploadDto.setThisYearWorkAmount(BigDecimal.valueOf(Double.parseDouble(thisYearWorkAmount))); + uploadDto.setReportYear(year); + uploadDto.setUnitResponsiblePerson(unitResponsiblePerson); + uploadDto.setPreparer(preparer); + uploadDto.setReviewer(reviewer); + uploadDto.setSubmissionDate(subDate); + dataList.add(uploadDto); + } + + // 先提交市级审核申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + cityAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityAuditInfo.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()); + cityAuditInfo.setCreateOn(subDate); + cityAuditInfo.setCreateBy(null); + cityAuditInfo.setUpdateOn(subDate); + cityAuditInfo.setUpdateBy(null); + cityAuditInfo.setAuditTime(subDate); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 创建区县关联数据信息(对应每个设备名称的数据关系为一对多) + BulkCementDirectReportSystemDataRelevance countryData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, 2022) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode())); + BulkCementDirectReportSystemDataRelevance countryRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + // 说明为重新提交 + if (Objects.nonNull(countryData)){ + // 先删除关联的已经保存的各设备名称的数据 + String auditDataIdList = countryData.getAuditDataIdList(); + if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(idList)){ + bulkCementLogFacStaService.remove(Wrappers.lambdaQuery(BulkCementLogisticFacilityStatisticAnnualReport.class) + .in(BulkCementLogisticFacilityStatisticAnnualReport::getId,idList)); + } + } + countryRelevanceData.setId(countryData.getId()); + } + countryRelevanceData.setReportYear(2022); + countryRelevanceData.setUnitResponsiblePerson(unitResponsiblePerson); + countryRelevanceData.setPreparer(preparer); + countryRelevanceData.setReviewer(reviewer); + countryRelevanceData.setSubmissionDate(subDate); + countryRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()); + countryRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + countryRelevanceData.setCreateOn(LocalDateTime.now()); + countryRelevanceData.setCreateBy(null); + countryRelevanceData.setUpdateOn(subDate); + countryRelevanceData.setUpdateBy(null); + countryRelevanceData.setLastUpdateTime(subDate); + countryRelevanceData.setRegionId(regionId); + countryRelevanceData.setCompanyId(companyId); + List auditDataIdList = Lists.newArrayList(); + + // 保存本次上报数据信息 + for (ReqBulkCementLogFacStaDataUploadDTO uploadDto : dataList) { + BulkCementLogisticFacilityStatisticAnnualReport bulkCementLogFacStaAnnualReport = + new BulkCementLogisticFacilityStatisticAnnualReport(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + String regionName = regionDto.getRegionName(); + bulkCementLogFacStaAnnualReport.setRegionName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + bulkCementLogFacStaAnnualReport.setFacilityName(uploadDto.getFacilityName()); + bulkCementLogFacStaAnnualReport.setYearBeginNum(uploadDto.getYearBeginNum()); + bulkCementLogFacStaAnnualReport.setYearBeginCapacity(uploadDto.getYearBeginCapacity()); + bulkCementLogFacStaAnnualReport.setThisYearNewAddNum(uploadDto.getThisYearNewAddNum()); + bulkCementLogFacStaAnnualReport.setThisYearNewAddCapacity(uploadDto.getThisYearNewAddCapacity()); + bulkCementLogFacStaAnnualReport.setThisYearScrapNum(uploadDto.getThisYearScrapNum()); + bulkCementLogFacStaAnnualReport.setThisYearScrapCapacity(uploadDto.getThisYearScrapCapacity()); + bulkCementLogFacStaAnnualReport.setYearEndNum(uploadDto.getYearEndNum()); + bulkCementLogFacStaAnnualReport.setYearEndCapacity(uploadDto.getYearEndCapacity()); + bulkCementLogFacStaAnnualReport.setThisYearWorkAmount(uploadDto.getThisYearWorkAmount()); + bulkCementLogFacStaAnnualReport.setReportYear(uploadDto.getReportYear()); + bulkCementLogFacStaAnnualReport.setRemark(uploadDto.getRemark()); + bulkCementLogFacStaAnnualReport.setCompanyId(companyId); + bulkCementLogFacStaAnnualReport.setUnitResponsiblePerson(uploadDto.getUnitResponsiblePerson()); + bulkCementLogFacStaAnnualReport.setPreparer(uploadDto.getPreparer()); + bulkCementLogFacStaAnnualReport.setReviewer(uploadDto.getReviewer()); + bulkCementLogFacStaAnnualReport.setSubmissionDate(uploadDto.getSubmissionDate()); + bulkCementLogFacStaAnnualReport.setRegionId(regionId); + bulkCementLogFacStaAnnualReport.setCreateOn(subDate); + bulkCementLogFacStaAnnualReport.setCreateBy(null); + bulkCementLogFacStaAnnualReport.setUpdateOn(subDate); + bulkCementLogFacStaAnnualReport.setUpdateBy(null); + bulkCementLogFacStaAnnualReport.setAuditInfoId(cityAuditInfo.getId()); + bulkCementLogFacStaAnnualReport.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + bulkCementLogFacStaService.save(bulkCementLogFacStaAnnualReport); + auditDataIdList.add(bulkCementLogFacStaAnnualReport.getId()); + } + // 保存关联数据ID集合(一条关联数据对应多条不同设备名称的数据) + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + countryRelevanceData.setAuditDataIdList(idListStr); + dataRelevanceService.saveOrUpdate(countryRelevanceData); + + // 补充数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + auditRecord.setAuditDataId(countryRelevanceData.getId()); + auditRecord.setAuditInfoId(cityAuditInfo.getId()); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()); + auditRecord.setCompanyId(companyId); + auditRecord.setRegionId(regionId); + auditRecord.setCreateOn(subDate); + auditRecord.setCreateBy(null); + auditRecord.setUpdateOn(subDate); + auditRecord.setUpdateBy(null); + auditRecord.setReportYear(2022); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + // 杭州市 + //String cityUnitResponsiblePerson = "赵斌"; + //String cityPreparer = "蔡义超"; + //String cityReviewer = "王瑞理"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-15 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + // 宁波市 + //String cityUnitResponsiblePerson = "卢汉"; + //String cityPreparer = "杨浩杰"; + //String cityReviewer = "徐立国"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-09 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + // 温州市 + //String cityUnitResponsiblePerson = null; + //String cityPreparer = null; + //String cityReviewer = null; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-01-01 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + // 嘉兴市 + //String cityUnitResponsiblePerson = "潘卫国"; + //String cityPreparer = "倪竹红"; + //String cityReviewer = "倪竹红"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-15 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + // 湖州市 + //String cityUnitResponsiblePerson = "傅饶"; + //String cityPreparer = "付平安"; + //String cityReviewer = "沈宁儿"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-06 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + // 绍兴市 + //String cityUnitResponsiblePerson = "丁正龙"; + //String cityPreparer = "寿晨杰"; + //String cityReviewer = "寿晨杰"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-13 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + //// 金华市 + //String cityUnitResponsiblePerson = "汪欣"; + //String cityPreparer = "吴昌蒲"; + //String cityReviewer = "杨裕发"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-10 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + //// 衢州市 + //String cityUnitResponsiblePerson = "徐欣"; + //String cityPreparer = "徐欣"; + //String cityReviewer = "徐欣"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-10 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + //// 舟山市 + //String cityUnitResponsiblePerson = "刘海港"; + //String cityPreparer = "吴煜之"; + //String cityReviewer = "檀坤"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-01-10 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + //// 台州市 + //String cityUnitResponsiblePerson = "陈虹"; + //String cityPreparer = "林"; + //String cityReviewer = "林"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-15 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + // 丽水市 + String cityUnitResponsiblePerson = null; + String cityPreparer = null; + String cityReviewer = null; + LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-01-01 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + Long relevanceDataId; + // 判断上报年份所在市的市级关联数据不存在 + // 区县的区域ID + // 获取所在市的区域ID + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + Long parentId = regionDto.getParentId(); + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, parentId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, 2022) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode())); + // 已经存在,更新上报数据ID列表 + if (Objects.nonNull(cityData)){ + String auditDataIdListStr = cityData.getAuditDataIdList(); + List auditIdList; + if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(auditDataIdListStr)){ + auditIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditIdList.contains(countryRelevanceData.getId())){ + auditIdList.add(countryRelevanceData.getId()); + String dataIdListStr = auditIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityData.setAuditDataIdList(dataIdListStr); + } + // 更新最后一次更新时间 + cityData.setLastUpdateTime(subDate); + cityData.setUpdateOn(subDate); + cityData.setUpdateBy(null); + // 有新上报的数据 + cityData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(cityData); + } + relevanceDataId = cityData.getId(); + }else { + // 补充所在市的关联数据信息 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + cityRelevanceData.setReportYear(2022); + List auditIdList = Lists.newArrayList(); + if (Objects.nonNull(countryRelevanceData.getId())) { + auditIdList.add(countryRelevanceData.getId()); + String idListString = auditIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityRelevanceData.setAuditDataIdList(idListString); + } + cityRelevanceData.setUnitResponsiblePerson(cityUnitResponsiblePerson); + cityRelevanceData.setPreparer(cityPreparer); + cityRelevanceData.setReviewer(cityReviewer); + cityRelevanceData.setSubmissionDate(citySubDate); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityRelevanceData.setCreateOn(citySubDate); + cityRelevanceData.setCreateBy(null); + cityRelevanceData.setUpdateOn(citySubDate); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setLastUpdateTime(citySubDate); + cityRelevanceData.setRegionId(parentId); + // 获取所在市散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(regionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + cityRelevanceData.setCompanyId(companyDto.getId()); + } + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()); + // 有新上报的数据,就更新关联数据状态为未上报 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + relevanceDataId = cityRelevanceData.getId(); + } + + + // 补充省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + provinceAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditInfo.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()); + provinceAuditInfo.setCreateOn(citySubDate); + provinceAuditInfo.setCreateBy(null); + provinceAuditInfo.setUpdateOn(citySubDate); + provinceAuditInfo.setUpdateBy(null); + provinceAuditInfo.setAuditTime(citySubDate); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + // 更新市级关联数据 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(relevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityRelevanceData.setUpdateOn(citySubDate); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setUnitResponsiblePerson(null); + cityRelevanceData.setPreparer(null); + cityRelevanceData.setReviewer(null); + cityRelevanceData.setSubmissionDate(citySubDate); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, 2022) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode())); + // 存在,更新市关联数据ID列表 + if (Objects.nonNull(provinceData)){ + String auditDataIdListStr = provinceData.getAuditDataIdList(); + List auditIdList; + if (StringUtils.isNotBlank(auditDataIdListStr)){ + auditIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditIdList.contains(relevanceDataId)){ + auditIdList.add(relevanceDataId); + String idListString = auditIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceData.setAuditDataIdList(idListString); + } + // 更新最后一次更新时间 + provinceData.setLastUpdateTime(citySubDate); + provinceData.setUpdateOn(citySubDate); + provinceData.setUpdateBy(null); + // 有新上报的数据,就更新关联数据状态为审核中 + provinceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(provinceData); + } + }else { + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + provinceRelevanceData.setReportYear(2022); + List auditIdList = Lists.newArrayList(); + auditIdList.add(relevanceDataId); + String idListString = auditIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceRelevanceData.setAuditDataIdList(idListString); + + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setCreateOn(citySubDate); + provinceRelevanceData.setCreateBy(null); + provinceRelevanceData.setUpdateOn(citySubDate); + provinceRelevanceData.setUpdateBy(null); + provinceRelevanceData.setLastUpdateTime(citySubDate); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO provinceCompanyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(provinceCompanyDto)) { + provinceRelevanceData.setCompanyId(provinceCompanyDto.getId()); + } + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + provinceAuditRecord.setAuditDataId(cityRelevanceData.getId()); + provinceAuditRecord.setAuditInfoId(provinceAuditInfo.getId()); + provinceAuditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditRecord.setAuditDataType(UploadDataTypeEnum.BULK_CEMENT_LOGISTIC_FACILITY_STATISTIC_ANNUAL_REPORT.getCode()); + provinceAuditRecord.setCompanyId(cityRelevanceData.getCompanyId()); + provinceAuditRecord.setRegionId(cityRelevanceData.getRegionId()); + provinceAuditRecord.setCreateOn(cityRelevanceData.getSubmissionDate()); + provinceAuditRecord.setCreateBy(null); + provinceAuditRecord.setUpdateOn(cityRelevanceData.getSubmissionDate()); + provinceAuditRecord.setUpdateBy(null); + provinceAuditRecord.setReportYear(2022); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + } + } + + @Test + public void materialLogEquipStaTest() throws FileNotFoundException { + // ------------------------------------------杭州市------------------------------------- + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\杭州市\\萧山.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\杭州市\\余杭.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\杭州市\\富阳.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\杭州市\\桐庐.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\杭州市\\建德.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\杭州市\\临安.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\杭州市\\淳安.xlsx"); + // File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\杭州市\\钱塘.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\杭州市\\临平.xlsx"); + // ------------------------------------------宁波市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\宁波市\\余姚.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\宁波市\\慈溪.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\宁波市\\象山.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\宁波市\\宁海.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\宁波市\\鄞州.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\宁波市\\北仑.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\宁波市\\镇海.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\宁波市\\奉化.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\宁波市\\江北.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\宁波市\\海曙.xlsx"); + // ------------------------------------------温州市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\温州市\\鹿城.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\温州市\\瓯海.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\温州市\\龙湾.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\温州市\\瑞安.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\温州市\\乐清.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\温州市\\永嘉.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\温州市\\平阳.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\温州市\\苍南.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\温州市\\文成.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\温州市\\洞头.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\温州市\\泰顺.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\温州市\\龙港.xlsx"); + // ------------------------------------------嘉兴市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\嘉兴市\\南湖.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\嘉兴市\\秀洲.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\嘉兴市\\嘉善.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\嘉兴市\\平湖.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\嘉兴市\\海盐.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\嘉兴市\\海宁.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\嘉兴市\\桐乡.xlsx"); + // ------------------------------------------湖州市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\湖州市\\德清.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\湖州市\\长兴.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\湖州市\\安吉.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\湖州市\\吴兴.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\湖州市\\南浔.xlsx"); + // ------------------------------------------绍兴市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\绍兴市\\越城.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\绍兴市\\柯桥.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\绍兴市\\诸暨.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\绍兴市\\上虞.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\绍兴市\\嵊州.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\绍兴市\\新昌.xlsx"); + // ------------------------------------------金华市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\金华市\\金东.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\金华市\\婺城.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\金华市\\兰溪.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\金华市\\浦江.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\金华市\\东阳.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\金华市\\义乌.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\金华市\\永康.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\金华市\\武义.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\金华市\\磐安.xlsx"); + // ------------------------------------------衢州市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\衢州市\\衢江.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\衢州市\\江山.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\衢州市\\常山.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\衢州市\\开化.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\衢州市\\龙游.xlsx"); + // ------------------------------------------舟山市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\舟山市\\定海.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\舟山市\\普陀.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\舟山市\\岱山.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\舟山市\\嵊泗.xlsx"); + // ------------------------------------------台州市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\台州市\\椒江.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\台州市\\路桥.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\台州市\\黄岩.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\台州市\\临海.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\台州市\\温岭.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\台州市\\仙居.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\台州市\\天台.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\台州市\\三门.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\台州市\\玉环.xlsx"); + // ------------------------------------------丽水市------------------------------------- + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\丽水市\\莲都.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\丽水市\\青田.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\丽水市\\缙云.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\丽水市\\松阳.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\丽水市\\遂昌.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\丽水市\\龙泉.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\丽水市\\云和.xlsx"); + //File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\丽水市\\景宁畲族自治县.xlsx"); + File f = new File("D:\\work\\水泥车直报系统\\data\\物流装备统计年报\\丽水市\\丽水经济技术开发区.xlsx"); + + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + List userList = Lists.newArrayList(); + if(wb != null) { + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 根据区县名称获取区域ID + HashSet countySet = new HashSet<>(); + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + + List dataList = Lists.newArrayList(); + + Long regionId = null; + Long cityRegionId = null; + String cityRegionName = null; + + Long companyId = null; + Long cityCompanyId = null; + + String unitResponsiblePerson = null; + String preparer = null; + String reviewer = null; + LocalDateTime subDate = null; + + for (int i = 1; i < rownum; i++) { + row = sheet.getRow(i); + // 地区 + String regionName = Objects.nonNull(row.getCell(0)) ? row.getCell(0).toString() : StringUtils.EMPTY; + // 上报年份 + String reportYear = Objects.nonNull(row.getCell(1)) ? row.getCell(1).toString() : null; + Double parseDouble = Double.parseDouble(reportYear); + int year = parseDouble.intValue(); + // 装备名称 + String equipmentName = Objects.nonNull(row.getCell(2)) ? row.getCell(2).toString() : StringUtils.EMPTY; + // 年初数量 + String yearBeginNum = Objects.nonNull(row.getCell(3)) ? row.getCell(3).toString() : StringUtils.EMPTY; + // 年初额定量 + String yearBeginNominalRate = Objects.nonNull(row.getCell(4)) ? row.getCell(4).toString() : StringUtils.EMPTY; + // 本年新增数量 + String thisYearNewAddNum = Objects.nonNull(row.getCell(5)) ? row.getCell(5).toString() : StringUtils.EMPTY; + // 本年新增额定量 + String thisYearNewAddNominalRate = Objects.nonNull(row.getCell(6)) ? row.getCell(6).toString() : StringUtils.EMPTY; + // 本年减少数量 + String thisYearDecreaseNum = Objects.nonNull(row.getCell(7)) ? row.getCell(7).toString() : StringUtils.EMPTY; + // 本年减少额定量 + String thisYearDecreaseNominalRate = Objects.nonNull(row.getCell(8)) ? row.getCell(8).toString() : StringUtils.EMPTY; + // 年末数量 + String yearEndNum = Objects.nonNull(row.getCell(9)) ? row.getCell(9).toString() : StringUtils.EMPTY; + // 年末额定量 + String yearEndNominal = Objects.nonNull(row.getCell(10)) ? row.getCell(10).toString() : StringUtils.EMPTY; + // 单位负责人 + unitResponsiblePerson = Objects.nonNull(row.getCell(11)) ? row.getCell(11).toString() : StringUtils.EMPTY; + // 填表人 + preparer = Objects.nonNull(row.getCell(12)) ? row.getCell(12).toString() : StringUtils.EMPTY; + // 复核人 + reviewer = Objects.nonNull(row.getCell(13)) ? row.getCell(13).toString() : StringUtils.EMPTY; + // 报出日期 + Date submissionDate = Objects.nonNull(row.getCell(14)) ? row.getCell(14).getDateCellValue() : null; + if (Objects.nonNull(submissionDate)) { + subDate = submissionDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + }else { + subDate = LocalDateTime.now().minusMonths(9).minusDays(15L); + } + + // 区县名称 获取区域ID、上级区域ID + for (Map.Entry regionEntry : regionMap.entrySet()) { + String regionNameStr = regionEntry.getKey(); + if (regionNameStr.contains(regionName) && regionNameStr.length() < 4){ + regionName = regionNameStr; + Region region = regionMap.get(regionNameStr); + if (Objects.nonNull(region)) { + regionId = region.getId(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + cityRegionId = regionDto.getParentId(); + cityRegionName = regionDto.getRegionName(); + } + } else if ((regionNameStr.contains(regionName) && regionNameStr.equals("丽水经济技术开发区")) || + (regionNameStr.contains(regionName) && regionNameStr.equals("景宁畲族自治县"))) { + regionName = regionNameStr; + Region region = regionMap.get(regionNameStr); + if (Objects.nonNull(region)) { + regionId = region.getId(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + cityRegionId = regionDto.getParentId(); + cityRegionName = regionDto.getRegionName(); + } + } + } + if (Objects.isNull(regionId)){ + throw new BizException("区域不存在!"); + } + + // 根据地区名称获取对应散装中心的企业信息 + CompanyDTO companyDto = companiesCacheHelper.getByName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + CompanyDTO cityCompanyDto = companiesCacheHelper.getByName(cityRegionName + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.isNull(companyDto) || Objects.isNull(cityCompanyDto)){ + throw new BizException("管理企业不存在!"); + }else { + companyId = companyDto.getId(); + cityCompanyId = cityCompanyDto.getId(); + } + + ReqMaterialLogEquipStaDataUploadDTO uploadDto = new ReqMaterialLogEquipStaDataUploadDTO(); + uploadDto.setRegionName(regionName); + uploadDto.setCompanyId(companyId); + uploadDto.setRegionId(regionId); + uploadDto.setEquipmentName(equipmentName); + Double d = Double.parseDouble(yearBeginNum); + int beginNum = d.intValue(); + uploadDto.setYearBeginNum(beginNum); + uploadDto.setYearBeginNominalRate(BigDecimal.valueOf(Double.parseDouble(yearBeginNominalRate))); + Double d2 = Double.parseDouble(thisYearNewAddNum); + int newAddNum = d2.intValue(); + uploadDto.setThisYearNewAddNum(newAddNum); + uploadDto.setThisYearNewAddNominalRate(BigDecimal.valueOf(Double.parseDouble(thisYearNewAddNominalRate))); + Double d3 = Double.parseDouble(thisYearDecreaseNum); + int decreaseNum = d3.intValue(); + uploadDto.setThisYearDecreaseNum(decreaseNum); + uploadDto.setThisYearDecreaseNominalRate(BigDecimal.valueOf(Double.parseDouble(thisYearDecreaseNominalRate))); + Double d4 = Double.parseDouble(yearEndNum); + int endNum = d4.intValue(); + uploadDto.setYearEndNum(endNum); + uploadDto.setYearEndNominal(BigDecimal.valueOf(Double.parseDouble(yearEndNominal))); + + uploadDto.setReportYear(year); + uploadDto.setUnitResponsiblePerson(unitResponsiblePerson); + uploadDto.setPreparer(preparer); + uploadDto.setReviewer(reviewer); + uploadDto.setSubmissionDate(subDate); + dataList.add(uploadDto); + } + + // 先提交市级审核申请 + BulkCementDirectReportSystemAuditInfo cityAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + cityAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityAuditInfo.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + cityAuditInfo.setCreateOn(subDate); + cityAuditInfo.setCreateBy(null); + cityAuditInfo.setUpdateOn(subDate); + cityAuditInfo.setUpdateBy(null); + cityAuditInfo.setAuditTime(subDate); + cityAuditInfo.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditInfoService.save(cityAuditInfo); + + // 创建区县关联数据信息(对应每个设备名称的数据关系为一对多) + BulkCementDirectReportSystemDataRelevance countryData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, regionId) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, 2022) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode())); + BulkCementDirectReportSystemDataRelevance countryRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + // 说明为重新提交 + if (Objects.nonNull(countryData)){ + // 先删除关联的已经保存的各设备名称的数据 + String auditDataIdList = countryData.getAuditDataIdList(); + if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(auditDataIdList)){ + List idList = Arrays.stream(auditDataIdList.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(idList)){ + bulkCementLogFacStaService.remove(Wrappers.lambdaQuery(BulkCementLogisticFacilityStatisticAnnualReport.class) + .in(BulkCementLogisticFacilityStatisticAnnualReport::getId,idList)); + } + } + countryRelevanceData.setId(countryData.getId()); + } + countryRelevanceData.setReportYear(2022); + countryRelevanceData.setUnitResponsiblePerson(unitResponsiblePerson); + countryRelevanceData.setPreparer(preparer); + countryRelevanceData.setReviewer(reviewer); + countryRelevanceData.setSubmissionDate(subDate); + countryRelevanceData.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + countryRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + countryRelevanceData.setCreateOn(LocalDateTime.now()); + countryRelevanceData.setCreateBy(null); + countryRelevanceData.setUpdateOn(subDate); + countryRelevanceData.setUpdateBy(null); + countryRelevanceData.setLastUpdateTime(subDate); + countryRelevanceData.setRegionId(regionId); + countryRelevanceData.setCompanyId(companyId); + List auditDataIdList = Lists.newArrayList(); + + // 保存本次上报数据信息 + for (ReqMaterialLogEquipStaDataUploadDTO uploadDto : dataList) { + MaterialLogisticEquipmentStatisticAnnualReport materialLogEquipStaAnnualReport = + new MaterialLogisticEquipmentStatisticAnnualReport(); + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + String regionName = regionDto.getRegionName(); + materialLogEquipStaAnnualReport.setRegionName(regionName + VehicleContant.ADMIN_COMPANY_NAME); + materialLogEquipStaAnnualReport.setEquipmentName(uploadDto.getEquipmentName()); + materialLogEquipStaAnnualReport.setYearBeginNum(uploadDto.getYearBeginNum()); + materialLogEquipStaAnnualReport.setYearBeginNominalRate(uploadDto.getYearBeginNominalRate()); + materialLogEquipStaAnnualReport.setThisYearNewAddNum(uploadDto.getThisYearNewAddNum()); + materialLogEquipStaAnnualReport.setThisYearNewAddNominalRate(uploadDto.getThisYearNewAddNominalRate()); + materialLogEquipStaAnnualReport.setThisYearDecreaseNum(uploadDto.getThisYearDecreaseNum()); + materialLogEquipStaAnnualReport.setThisYearDecreaseNominalRate(uploadDto.getThisYearDecreaseNominalRate()); + materialLogEquipStaAnnualReport.setYearEndNum(uploadDto.getYearEndNum()); + materialLogEquipStaAnnualReport.setYearEndNominal(uploadDto.getYearEndNominal()); + materialLogEquipStaAnnualReport.setReportYear(uploadDto.getReportYear()); + materialLogEquipStaAnnualReport.setRemark(uploadDto.getRemark()); + materialLogEquipStaAnnualReport.setCompanyId(companyId); + materialLogEquipStaAnnualReport.setUnitResponsiblePerson(uploadDto.getUnitResponsiblePerson()); + materialLogEquipStaAnnualReport.setPreparer(uploadDto.getPreparer()); + materialLogEquipStaAnnualReport.setReviewer(uploadDto.getReviewer()); + materialLogEquipStaAnnualReport.setSubmissionDate(uploadDto.getSubmissionDate()); + materialLogEquipStaAnnualReport.setRegionId(regionId); + materialLogEquipStaAnnualReport.setCreateOn(subDate); + materialLogEquipStaAnnualReport.setCreateBy(null); + materialLogEquipStaAnnualReport.setUpdateOn(subDate); + materialLogEquipStaAnnualReport.setUpdateBy(null); + materialLogEquipStaAnnualReport.setAuditInfoId(cityAuditInfo.getId()); + materialLogEquipStaAnnualReport.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + materialLogEquipStaAnnualReportService.save(materialLogEquipStaAnnualReport); + auditDataIdList.add(materialLogEquipStaAnnualReport.getId()); + } + // 保存关联数据ID集合(一条关联数据对应多条不同设备名称的数据) + String idListStr = auditDataIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + countryRelevanceData.setAuditDataIdList(idListStr); + dataRelevanceService.saveOrUpdate(countryRelevanceData); + + // 补充数据审核表信息 + BulkCementDirectReportSystemAuditRecord auditRecord = new BulkCementDirectReportSystemAuditRecord(); + auditRecord.setAuditDataId(countryRelevanceData.getId()); + auditRecord.setAuditInfoId(cityAuditInfo.getId()); + auditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + auditRecord.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + auditRecord.setCompanyId(companyId); + auditRecord.setRegionId(regionId); + auditRecord.setCreateOn(subDate); + auditRecord.setCreateBy(null); + auditRecord.setUpdateOn(subDate); + auditRecord.setUpdateBy(null); + auditRecord.setReportYear(2022); + auditRecord.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + auditRecordService.save(auditRecord); + + //// 杭州市 + //String cityUnitResponsiblePerson = "赵斌"; + //String cityPreparer = "蔡义超"; + //String cityReviewer = "王瑞理"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-16 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + //// 宁波市 + //String cityUnitResponsiblePerson = "卢汉"; + //String cityPreparer = "杨浩杰"; + //String cityReviewer = "徐立国"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-09 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + //// 温州市 + //String cityUnitResponsiblePerson = null; + //String cityPreparer = null; + //String cityReviewer = null; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-01-01 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + //// 嘉兴市 + //String cityUnitResponsiblePerson = "潘卫国"; + //String cityPreparer = "倪竹红"; + //String cityReviewer = "倪竹红"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-15 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + //// 湖州市 + //String cityUnitResponsiblePerson = "傅饶"; + //String cityPreparer = "付平安"; + //String cityReviewer = "沈宁儿"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-06 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + //// 绍兴市 + //String cityUnitResponsiblePerson = "丁正龙"; + //String cityPreparer = "寿晨杰"; + //String cityReviewer = "寿晨杰"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-13 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + //// 金华市 + //String cityUnitResponsiblePerson = "汪欣"; + //String cityPreparer = "吴昌蒲"; + //String cityReviewer = "杨裕发"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-10 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + //// 衢州市 + //String cityUnitResponsiblePerson = "徐欣"; + //String cityPreparer = "徐欣"; + //String cityReviewer = "徐欣"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-10 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + //// 舟山市 + //String cityUnitResponsiblePerson = "刘海港"; + //String cityPreparer = "吴煜之"; + //String cityReviewer = "檀坤"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-01-10 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + //// 台州市 + //String cityUnitResponsiblePerson = "陈虹"; + //String cityPreparer = "林"; + //String cityReviewer = "林"; + //LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-02-16 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + // 丽水市 + String cityUnitResponsiblePerson = null; + String cityPreparer = null; + String cityReviewer = null; + LocalDateTime citySubDate = LocalDateTimeUtil.parse("2023-01-01 00:00:00", NdDateUtils.DEFAULT_DATE_TIME_FORMAT); + Long relevanceDataId; + // 判断上报年份所在市的市级关联数据不存在 + // 区县的区域ID + // 获取所在市的区域ID + RegionDTO regionDto = regionsCacheHelper.getByRegionId(regionId); + Long parentId = regionDto.getParentId(); + BulkCementDirectReportSystemDataRelevance cityData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, parentId) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.CITY_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, 2022) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode())); + // 已经存在,更新上报数据ID列表 + if (Objects.nonNull(cityData)){ + String auditDataIdListStr = cityData.getAuditDataIdList(); + List auditIdList; + if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(auditDataIdListStr)){ + auditIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditIdList.contains(countryRelevanceData.getId())){ + auditIdList.add(countryRelevanceData.getId()); + String dataIdListStr = auditIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityData.setAuditDataIdList(dataIdListStr); + } + // 更新最后一次更新时间 + cityData.setLastUpdateTime(subDate); + cityData.setUpdateOn(subDate); + cityData.setUpdateBy(null); + // 有新上报的数据 + cityData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(cityData); + } + relevanceDataId = cityData.getId(); + }else { + // 补充所在市的关联数据信息 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + cityRelevanceData.setReportYear(2022); + List auditIdList = Lists.newArrayList(); + if (Objects.nonNull(countryRelevanceData.getId())) { + auditIdList.add(countryRelevanceData.getId()); + String idListString = auditIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + cityRelevanceData.setAuditDataIdList(idListString); + } + cityRelevanceData.setUnitResponsiblePerson(cityUnitResponsiblePerson); + cityRelevanceData.setPreparer(cityPreparer); + cityRelevanceData.setReviewer(cityReviewer); + cityRelevanceData.setSubmissionDate(citySubDate); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityRelevanceData.setCreateOn(citySubDate); + cityRelevanceData.setCreateBy(null); + cityRelevanceData.setUpdateOn(citySubDate); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setLastUpdateTime(citySubDate); + cityRelevanceData.setRegionId(parentId); + // 获取所在市散装中心所属的管理企业ID + CompanyDTO companyDto = companiesCacheHelper.getByName(regionDto.getRegionName() + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(companyDto)) { + cityRelevanceData.setCompanyId(companyDto.getId()); + } + cityRelevanceData.setAuditType(DataUploadAuditTypeEnum.CITY_AUDIT.getCode()); + cityRelevanceData.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + // 有新上报的数据,就更新关联数据状态为未上报 + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.saveOrUpdate(cityRelevanceData); + relevanceDataId = cityRelevanceData.getId(); + } + + + // 补充省级审核申请 + BulkCementDirectReportSystemAuditInfo provinceAuditInfo = new BulkCementDirectReportSystemAuditInfo(); + provinceAuditInfo.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditInfo.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + provinceAuditInfo.setCreateOn(citySubDate); + provinceAuditInfo.setCreateBy(null); + provinceAuditInfo.setUpdateOn(citySubDate); + provinceAuditInfo.setUpdateBy(null); + provinceAuditInfo.setAuditTime(citySubDate); + provinceAuditInfo.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditInfoService.save(provinceAuditInfo); + // 更新市级关联数据 + BulkCementDirectReportSystemDataRelevance cityRelevanceData = dataRelevanceService.getById(relevanceDataId); + VUtils.isTrue(Objects.isNull(cityRelevanceData)).throwMessage("数据不存在!"); + // 关联审核信息ID + cityRelevanceData.setAuditInfoId(provinceAuditInfo.getId()); + cityRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + cityRelevanceData.setUpdateOn(citySubDate); + cityRelevanceData.setUpdateBy(null); + cityRelevanceData.setUnitResponsiblePerson(null); + cityRelevanceData.setPreparer(null); + cityRelevanceData.setReviewer(null); + cityRelevanceData.setSubmissionDate(citySubDate); + dataRelevanceService.updateById(cityRelevanceData); + + // 判断上报月份省关联数据是否存在 + BulkCementDirectReportSystemDataRelevance provinceData = dataRelevanceService.getOne(Wrappers.lambdaQuery(BulkCementDirectReportSystemDataRelevance.class) + .eq(BulkCementDirectReportSystemDataRelevance::getRegionId, DefValConstants.ZJREGION_ID) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditType,DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()) + .eq(BulkCementDirectReportSystemDataRelevance::getReportYear, 2022) + .eq(BulkCementDirectReportSystemDataRelevance::getAuditDataType, UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode())); + // 存在,更新市关联数据ID列表 + if (Objects.nonNull(provinceData)){ + String auditDataIdListStr = provinceData.getAuditDataIdList(); + List auditIdList; + if (StringUtils.isNotBlank(auditDataIdListStr)){ + auditIdList = Arrays.stream(auditDataIdListStr.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + if (!auditIdList.contains(relevanceDataId)){ + auditIdList.add(relevanceDataId); + String idListString = auditIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceData.setAuditDataIdList(idListString); + } + // 更新最后一次更新时间 + provinceData.setLastUpdateTime(citySubDate); + provinceData.setUpdateOn(citySubDate); + provinceData.setUpdateBy(null); + // 有新上报的数据,就更新关联数据状态为审核中 + provinceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.updateById(provinceData); + } + }else { + // 如果上报月份省级关联数据不存在 + // 补充省散办关联数据信息 + BulkCementDirectReportSystemDataRelevance provinceRelevanceData = new BulkCementDirectReportSystemDataRelevance(); + provinceRelevanceData.setReportYear(2022); + List auditIdList = Lists.newArrayList(); + auditIdList.add(relevanceDataId); + String idListString = auditIdList.stream().map(String::valueOf).collect(Collectors.joining(StrPool.COMMA)); + provinceRelevanceData.setAuditDataIdList(idListString); + + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setCreateOn(citySubDate); + provinceRelevanceData.setCreateBy(null); + provinceRelevanceData.setUpdateOn(citySubDate); + provinceRelevanceData.setUpdateBy(null); + provinceRelevanceData.setLastUpdateTime(citySubDate); + provinceRelevanceData.setRegionId(DefValConstants.ZJREGION_ID); + provinceRelevanceData.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + // 获取省散装中心所属的管理企业ID + CompanyDTO provinceCompanyDto = companiesCacheHelper.getByName(DefValConstants.PROVINCE + VehicleContant.ADMIN_COMPANY_NAME); + if (Objects.nonNull(provinceCompanyDto)) { + provinceRelevanceData.setCompanyId(provinceCompanyDto.getId()); + } + provinceRelevanceData.setUnitResponsiblePerson(null); + provinceRelevanceData.setPreparer(null); + provinceRelevanceData.setReviewer(null); + provinceRelevanceData.setSubmissionDate(null); + provinceRelevanceData.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + provinceRelevanceData.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + dataRelevanceService.save(provinceRelevanceData); + } + + // 创建省级审核记录 + BulkCementDirectReportSystemAuditRecord provinceAuditRecord = new BulkCementDirectReportSystemAuditRecord(); + provinceAuditRecord.setAuditDataId(cityRelevanceData.getId()); + provinceAuditRecord.setAuditInfoId(provinceAuditInfo.getId()); + provinceAuditRecord.setAuditStatus(DataUploadAuditStatusEnum.AUDIT_PASS.getCode()); + provinceAuditRecord.setAuditDataType(UploadDataTypeEnum.MATERIAL_LOGISTIC_EQUIPMENT_STATISTIC_ANNUAL_REPORT.getCode()); + provinceAuditRecord.setCompanyId(cityRelevanceData.getCompanyId()); + provinceAuditRecord.setRegionId(cityRelevanceData.getRegionId()); + provinceAuditRecord.setCreateOn(cityRelevanceData.getSubmissionDate()); + provinceAuditRecord.setCreateBy(null); + provinceAuditRecord.setUpdateOn(cityRelevanceData.getSubmissionDate()); + provinceAuditRecord.setUpdateBy(null); + provinceAuditRecord.setReportYear(2022); + provinceAuditRecord.setAuditType(DataUploadAuditTypeEnum.PROVINCE_AUDIT.getCode()); + auditRecordService.save(provinceAuditRecord); + } + } + + @Test + public void updateTest() { + // 散装水泥供应量数据 + List bulkCementSupplyBulletinList = bulkCementSupplyBulletinService.list(); + for (BulkCementSupplyBulletin bulkCementSupplyBulletin : bulkCementSupplyBulletinList) { + Long regionId = bulkCementSupplyBulletin.getRegionId(); + RegionDTO regionDTO = regionsCacheHelper.getByRegionId(regionId); + bulkCementSupplyBulletin.setUnitName(regionDTO.getRegionName()); + bulkCementSupplyBulletinService.updateById(bulkCementSupplyBulletin); + } + + // 中转库进出量数据 + List bulkCementTransferBulletins = bulkCementTransferBulletinService.list(); + for (BulkCementTransferBulletin bulkCementTransferBulletin : bulkCementTransferBulletins) { + Long regionId = bulkCementTransferBulletin.getRegionId(); + RegionDTO regionDTO = regionsCacheHelper.getByRegionId(regionId); + bulkCementTransferBulletin.setUnitName(regionDTO.getRegionName()); + bulkCementTransferBulletinService.updateById(bulkCementTransferBulletin); + } + + + // 温台州使用量数据 + List bulkCementThreeCityUsageBulletins = bulkCementThreeCityUsageBulletinService.list(); + for (BulkCementThreeCityUsageBulletin bulkCementThreeCityUsageBulletin : bulkCementThreeCityUsageBulletins) { + Long regionId = bulkCementThreeCityUsageBulletin.getRegionId(); + RegionDTO regionDTO = regionsCacheHelper.getByRegionId(regionId); + bulkCementThreeCityUsageBulletin.setUnitName(regionDTO.getRegionName()); + bulkCementThreeCityUsageBulletinService.updateById(bulkCementThreeCityUsageBulletin); + } + + // 混凝土供应量数据 + List concreteSupplyBulletins = concreteSupplyBulletinService.list(); + for (ConcreteSupplyBulletin concreteSupplyBulletin : concreteSupplyBulletins) { + Long regionId = concreteSupplyBulletin.getRegionId(); + RegionDTO regionDTO = regionsCacheHelper.getByRegionId(regionId); + concreteSupplyBulletin.setUnitName(regionDTO.getRegionName()); + concreteSupplyBulletinService.updateById(concreteSupplyBulletin); + } + + // 砂浆供应量数据 + List mortarSupplyBulletins = mortarSupplyBulletinService.list(); + for (MortarSupplyBulletin mortarSupplyBulletin : mortarSupplyBulletins) { + Long regionId = mortarSupplyBulletin.getRegionId(); + RegionDTO regionDTO = regionsCacheHelper.getByRegionId(regionId); + mortarSupplyBulletin.setRegionName(regionDTO.getRegionName()); + mortarSupplyBulletinService.updateById(mortarSupplyBulletin); + } + + // 非禁现区数据 + List nonProhibitedAreasBulkCementSalesUses = nonProhibitedAreasBulkCementSalesUseService.list(); + for (NonProhibitedAreasBulkCementSalesUse nonProhibitedAreasBulkCementSalesUse : nonProhibitedAreasBulkCementSalesUses) { + Long regionId = nonProhibitedAreasBulkCementSalesUse.getRegionId(); + RegionDTO regionDTO = regionsCacheHelper.getByRegionId(regionId); + nonProhibitedAreasBulkCementSalesUse.setRegionName(regionDTO.getRegionName()); + nonProhibitedAreasBulkCementSalesUseService.updateById(nonProhibitedAreasBulkCementSalesUse); + } + + // 物流设施数据 + List bulkCementLogisticFacilityStatisticAnnualReports = bulkCementLogFacStaService.list(); + for (BulkCementLogisticFacilityStatisticAnnualReport bulkCementLogisticFacilityStatisticAnnualReport : bulkCementLogisticFacilityStatisticAnnualReports) { + Long regionId = bulkCementLogisticFacilityStatisticAnnualReport.getRegionId(); + RegionDTO regionDTO = regionsCacheHelper.getByRegionId(regionId); + bulkCementLogisticFacilityStatisticAnnualReport.setRegionName(regionDTO.getRegionName()); + bulkCementLogFacStaService.updateById(bulkCementLogisticFacilityStatisticAnnualReport); + } + + // 物流装备数据 + List materialLogisticEquipmentStatisticAnnualReports = materialLogEquipStaAnnualReportService.list(); + for (MaterialLogisticEquipmentStatisticAnnualReport materialLogisticEquipmentStatisticAnnualReport : materialLogisticEquipmentStatisticAnnualReports) { + Long regionId = materialLogisticEquipmentStatisticAnnualReport.getRegionId(); + RegionDTO regionDTO = regionsCacheHelper.getByRegionId(regionId); + materialLogisticEquipmentStatisticAnnualReport.setRegionName(regionDTO.getRegionName()); + materialLogEquipStaAnnualReportService.updateById(materialLogisticEquipmentStatisticAnnualReport); + } + } + + + + //这个下面是单独函数 + public static org.apache.poi.ss.usermodel.Workbook readExcel(InputStream is, String extString){ + Workbook wb = null; + extString = extString.substring(extString.lastIndexOf(".")); + try { + if(".xls".equals(extString)){ + return wb = new HSSFWorkbook(is); + }else if(".xlsx".equals(extString)){ + return wb = new XSSFWorkbook(is); + }else { + return wb = null; + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wb; + } +} + diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/safe/InsureOutdangerTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/safe/InsureOutdangerTest.java new file mode 100644 index 0000000..a6da96e --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/safe/InsureOutdangerTest.java @@ -0,0 +1,442 @@ +package com.ningdatech.carapi.safe; + +import java.io.*; +import java.math.BigDecimal; +import java.time.ZoneId; +import java.util.Date; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import com.alibaba.fastjson.JSON; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +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.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.Region; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; +import com.ningdatech.carapi.sys.helper.RegionsCacheHelper; +import com.ningdatech.carapi.sys.helper.VehiclesCacheHelper; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.sys.service.IRegionService; + +/** + * @Classname InsureOutdangerTest + * @Description + * @Date 2022/12/22 10:47 + * @Created by PoffyZhang + */ +public class InsureOutdangerTest extends AppTests { + + @Autowired + private CompaniesCacheHelper companiesCacheHelper; + + @Autowired + private VehiclesCacheHelper vehiclesCacheHelper; + + @Autowired + private INdInsureOutDangerService outDangerService; + + @Autowired + private IVehicleBaseInfoService vehicleBaseInfoService; + + @Autowired + private INdInsureInfoService insureInfoService; + + @Autowired + private IRegionService regionService; + @Autowired + private RegionsCacheHelper regionCacheHelper; + @Autowired + private CompanyService companyService; + + @Test + public void test() throws FileNotFoundException { + File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\出险信息导入\\出险详情\\出险详情\\2023年1-5月出险数据.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + Map vehicleBaseInfoMap = vehicleBaseInfoService.list() + .stream().collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + //Map outDangerMap = outDangerService.list(Wrappers.lambdaQuery(NdInsureOutDanger.class) + // .select(NdInsureOutDanger::getCarPlate,NdInsureOutDanger::getAccidentTime, + // NdInsureOutDanger::getAccidentAddress,NdInsureOutDanger::getId) + // .gt(NdInsureOutDanger::getAccidentTime,"2023-01-01") + // .lt(NdInsureOutDanger::getAccidentTime,"2023-12-31")) + // .stream() + // .collect(Collectors.toMap(v -> v.getCarPlate() + StrPool.DASH + v.getAccidentAddress() + StrPool.DASH + v.getAccidentTime(), NdInsureOutDanger::getId)); + + //获取最大列数 + for (int i = 1; i vehicleBaseInfoMap = vehicleBaseInfoService.list() + .stream().collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + HashSet countySet = new HashSet<>(); + // 根据区县名称获取区域ID + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + + //获取最大列数 + for (int i = 1; i countySet = new HashSet<>(); + Map regionMap = regionService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + !"市本级".equals(v.getName()) && + countySet.add(v.getName())) + .collect(Collectors.toMap(Region::getName, v -> v)); + + // 根据企业名查询企业信息 + HashSet companySet = new HashSet<>(); + Map companyNameMap = companyService.list().stream() + .filter(v -> !StrPool.EMPTY.equals(v.getName()) && + companySet.add(v.getName())) + .collect(Collectors.toMap(Company::getName, v -> v)); + + for (int i = 1; i vehicleStatusInGps = vehicleStatusService.getVehicleStatusInGps(); + System.out.println(JSON.toJSONString(vehicleStatusInGps)); + } +} diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/sms/SendSms.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/sms/SendSms.java new file mode 100644 index 0000000..3274f38 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/sms/SendSms.java @@ -0,0 +1,42 @@ +package com.ningdatech.carapi.sms; + +import com.ningdatech.carapi.sys.utils.HttpUtils; +import org.apache.http.HttpResponse; +import java.util.*; + +public class SendSms { + public static void main(String[] args) { + String host = "https://gyytz.market.alicloudapi.com"; + String path = "/sms/smsSend"; + String method = "POST"; + String appcode = "daab49d0cf344614b174a9bf8303b4e2"; + Map headers = new HashMap(); + //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105 + headers.put("Authorization", "APPCODE " + appcode); + Map querys = new HashMap(); + querys.put("mobile", "15058187290"); + querys.put("param", "**code**:1234,**minute**:5"); + querys.put("smsSignId", "2e65b1bb3d054466b82f0c9d125465e2"); + querys.put("templateId", "908e94ccf08b4476ba6c876d13f084ad"); + Map bodys = new HashMap(); + + try { + /** + * 重要提示如下: + * HttpUtils请从 + * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java + * 下载 + * + * 相应的依赖请参照 + * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml + */ + HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys); + System.out.println("短信验证码返回:" + response.toString()); + //获取response的body + //System.out.println(EntityUtils.toString(response.getEntity())); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} \ No newline at end of file diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/sys/helper/RegionsCacheHelperTempTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/sys/helper/RegionsCacheHelperTempTest.java new file mode 100644 index 0000000..da657e8 --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/sys/helper/RegionsCacheHelperTempTest.java @@ -0,0 +1,44 @@ +package com.ningdatech.carapi.sys.helper; + +import com.ningdatech.carapi.AppTests; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +/** + *

+ * RegionsCacheHelperTempTest + *

+ * + * @author WendyYang + * @since 22:24 2022/10/24 + */ +class RegionsCacheHelperTempTest extends AppTests { + + @Autowired + private RegionsCacheHelper regionsCacheHelper; + + @Test + void refresh() { + regionsCacheHelper.refresh(7L); + } + + @Test + void getAll() { + regionsCacheHelper.getAll().forEach(System.out::println); + } + + @Test + void listChildRegionId() { + regionsCacheHelper.listChildRegionId(2L).forEach(System.out::println); + } + + @Test + void listParents() { + regionsCacheHelper.listParents(128L).forEach(System.out::println); + } + + @Test + void getDisplayName() { + System.out.println(regionsCacheHelper.getDisplayName(128L)); + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/sys/helper/RegionsCacheHelperTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/sys/helper/RegionsCacheHelperTest.java new file mode 100644 index 0000000..1121bac --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/sys/helper/RegionsCacheHelperTest.java @@ -0,0 +1,68 @@ +package com.ningdatech.carapi.sys.helper; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.io.IoUtil; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.industry.model.dto.UseCertPageParamDTO; +import org.apache.commons.io.FileUtils; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * RegionsCacheHelperTest + *

+ * + * @author WendyYang + * @since 17:50 2022/10/22 + */ +class RegionsCacheHelperTest extends AppTests { + + @Autowired + private RegionsCacheHelper regionsCacheHelper; + + @Test + public void listChildren() { + System.out.println("regionsCacheHelper.listParents(1L) = " + regionsCacheHelper.listChildRegionId(2L)); + } + + @Test + public void listParents() { + System.out.println("regionsCacheHelper.listParents(1L) = " + regionsCacheHelper.listParents(2L)); + } + + @Test + public void getByRegionId() { + System.out.println("regionsCacheHelper.getByRegionId(7) = " + regionsCacheHelper.getByRegionId(7L)); + } + + @Test + public void downRegionJsonFile() { + List longs = regionsCacheHelper.listChildRegionId(116L); + List regionCodes = longs.stream() + .map(w -> regionsCacheHelper.getByRegionId(w).getRegionCode()) + .distinct() + .collect(Collectors.toList()); + regionCodes.forEach(w -> { + String name = w + (!w.substring(4).equals("00") ? ".json" : "_full.json"); + String url = String.format("https://geo.datav.aliyun.com/areas_v3/bound/%s", name); + try { + URL url1 = new URL(url); + InputStream stream = url1.openConnection().getInputStream(); + FileUtils.copyInputStreamToFile(stream, new File("/Users/wendy/desktop/" + w + ".json")); + } catch (Exception ignore) { + System.out.println(w); + } + }); + } + +} \ No newline at end of file diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/user/UserInfoTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/user/UserInfoTest.java new file mode 100644 index 0000000..257a37b --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/user/UserInfoTest.java @@ -0,0 +1,129 @@ +package com.ningdatech.carapi.user; + +import java.io.*; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Date; +import java.util.Objects; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.crypto.password.PasswordEncoder; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.common.constant.UserRoleTypeEnum; +import com.ningdatech.carapi.sys.entity.Company; +import com.ningdatech.carapi.sys.entity.UserRole; +import com.ningdatech.carapi.sys.service.CompanyService; +import com.ningdatech.carapi.sys.service.UserRoleService; +import com.ningdatech.carapi.user.entity.NdUserAuth; +import com.ningdatech.carapi.user.entity.NdUserInfo; +import com.ningdatech.carapi.user.security.auth.constant.AuthTypeEnum; +import com.ningdatech.carapi.user.service.INdUserAuthService; +import com.ningdatech.carapi.user.service.INdUserInfoService; + +/** + * @Classname InsureOutdangerTest + * @Description + * @Date 2022/12/22 10:47 + * @Created by PoffyZhang + */ +public class UserInfoTest extends AppTests { + + @Autowired + private CompanyService companyService; + @Autowired + private INdUserInfoService userInfoService; + @Autowired + private INdUserAuthService userAuthService; + @Autowired + private PasswordEncoder passwordEncoder; + @Autowired + private UserRoleService userRoleService; + + @Test + public void test() throws FileNotFoundException { + File f = new File("C:\\Users\\CMM\\Desktop\\年全省预拌混凝土、砂浆企业基本情况调查表2\\账号.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Row row = null; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpGet request = new HttpGet(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + /** + * post form + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param bodys + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + Map bodys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (bodys != null) { + List nameValuePairList = new ArrayList(); + + for (String key : bodys.keySet()) { + nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key))); + } + UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8"); + formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8"); + request.setEntity(formEntity); + } + + return httpClient.execute(request); + } + + /** + * Post String + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Post stream + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Put String + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Put stream + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Delete + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @return + * @throws Exception + */ + public static HttpResponse doDelete(String host, String path, String method, + Map headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpDelete request = new HttpDelete(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + private static String buildUrl(String host, String path, Map querys) throws UnsupportedEncodingException { + StringBuilder sbUrl = new StringBuilder(); + sbUrl.append(host); + if (!StringUtils.isBlank(path)) { + sbUrl.append(path); + } + if (null != querys) { + StringBuilder sbQuery = new StringBuilder(); + for (Map.Entry query : querys.entrySet()) { + if (0 < sbQuery.length()) { + sbQuery.append("&"); + } + if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) { + sbQuery.append(query.getValue()); + } + if (!StringUtils.isBlank(query.getKey())) { + sbQuery.append(query.getKey()); + if (!StringUtils.isBlank(query.getValue())) { + sbQuery.append("="); + sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8")); + } + } + } + if (0 < sbQuery.length()) { + sbUrl.append("?").append(sbQuery); + } + } + + return sbUrl.toString(); + } + + private static HttpClient wrapClient(String host) { + HttpClient httpClient = new DefaultHttpClient(); + if (host.startsWith("https://")) { + sslClient(httpClient); + } + + return httpClient; + } + + private static void sslClient(HttpClient httpClient) { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); + X509TrustManager tm = new X509TrustManager() { + public X509Certificate[] getAcceptedIssuers() { + return null; + } + public void checkClientTrusted(X509Certificate[] xcs, String str) { + + } + public void checkServerTrusted(X509Certificate[] xcs, String str) { + + } + }; + ctx.init(null, new TrustManager[] { tm }, null); + SSLSocketFactory ssf = new SSLSocketFactory(ctx); + ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); + ClientConnectionManager ccm = httpClient.getConnectionManager(); + SchemeRegistry registry = ccm.getSchemeRegistry(); + registry.register(new Scheme("https", 443, ssf)); + } catch (KeyManagementException ex) { + throw new RuntimeException(ex); + } catch (NoSuchAlgorithmException ex) { + throw new RuntimeException(ex); + } + } +} \ No newline at end of file diff --git a/ningda-yw-api/src/test/java/com/ningdatech/carapi/vehicle/CompanyVehicleTest.java b/ningda-yw-api/src/test/java/com/ningdatech/carapi/vehicle/CompanyVehicleTest.java new file mode 100644 index 0000000..691e9bf --- /dev/null +++ b/ningda-yw-api/src/test/java/com/ningdatech/carapi/vehicle/CompanyVehicleTest.java @@ -0,0 +1,800 @@ +package com.ningdatech.carapi.vehicle; + +import java.io.*; +import java.nio.file.Files; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.junit.Assert; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.ningdatech.carapi.AppTests; +import com.ningdatech.carapi.archives.enums.AuditStateEnum; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentChannels; +import com.ningdatech.carapi.car.equipment.model.NdVehicleEquipmentInfo; +import com.ningdatech.carapi.car.equipment.service.INdVehicleEquipmentChannelsService; +import com.ningdatech.carapi.car.equipment.service.INdVehicleEquipmentInfoService; +import com.ningdatech.carapi.car.vehicle.manage.VehicleManage; +import com.ningdatech.carapi.car.vehicle.model.NdVehicleBaseInfo; +import com.ningdatech.carapi.car.vehicle.service.IVehicleBaseInfoService; +import com.ningdatech.carapi.common.constant.VehicleTypeEnum; +import com.ningdatech.carapi.sys.entity.dto.CompanyDTO; +import com.ningdatech.carapi.sys.helper.CompaniesCacheHelper; + +import cn.hutool.core.collection.CollUtil; + +/** + * @Classname OpenApiTest + * @Description + * @Date 2022/11/3 10:47 + * @Created by PoffyZhang + */ +public class CompanyVehicleTest extends AppTests { + + @Autowired + private CompaniesCacheHelper companiesCacheHelper; + + @Autowired + private VehicleManage vehicleManage; + + @Autowired + private INdVehicleEquipmentInfoService equipmentInfoService; + @Autowired + private INdVehicleEquipmentChannelsService equipmentChannelsService; + + @Autowired + private IVehicleBaseInfoService vehicleBaseInfoService; + + @Test + public void test() throws FileNotFoundException { + File f = new File("C:\\Users\\PoffyZhang\\Desktop\\海盐秦山混凝土有限公司.xls"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Assert.assertNotNull(wb); + Row row; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i equipmentNos = Lists.newArrayList(); + equipmentNos.add(row.getCell(2)); + equipmentNos.add(row.getCell(3)); + equipmentNos.add(row.getCell(4)); + equipmentNos.add(row.getCell(5)); + equipmentNos.add(row.getCell(6)); + equipmentNos.add(row.getCell(7)); + equipmentNos.add(row.getCell(8)); + equipmentNos.add(row.getCell(9)); + + List vehicles = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getCarPlate,carPlate) + .eq(NdVehicleBaseInfo::getAuditState,AuditStateEnum.AUDIT_SUCCESS.getCode())); + + if(CollUtil.isEmpty(vehicles)){ + NdVehicleBaseInfo vehicle = new NdVehicleBaseInfo(); + CompanyDTO company = companiesCacheHelper.getByName(companyName); + if(Objects.isNull(company)){ + System.out.println("没有这个公司 " + companyName); + continue; + } + vehicle.setCompanyId(company.getId()); + vehicle.setAuditState(AuditStateEnum.AUDIT_SUCCESS.getCode()); + vehicle.setRegionId(company.getRegionId()); + vehicle.setRegionName(company.getRegionName()); + vehicle.setCarPlate(carPlate); + vehicle.setAuditMind("审核通过"); + vehicle.setAuditBy(1L); + vehicle.setAuditTime(LocalDateTime.now()); + vehicle.setStatus(1); + if(vehicleBaseInfoService.save(vehicle)){ + vehicles.add(vehicle); + } + } + //1.先删除该车辆下的设备 + equipmentInfoService.remove(Wrappers.lambdaQuery(NdVehicleEquipmentInfo.class) + .eq(NdVehicleEquipmentInfo::getVehicleId,vehicles.get(0).getId())); + + int j = 1; + for(Cell equipmentNoCell : equipmentNos){ + if(Objects.isNull(equipmentNoCell)){ + System.out.println("空行跳过"); + continue; + } + String equipmentNo = equipmentNoCell.toString(); + System.out.println(carPlate + "," + companyName + "," + equipmentNo); + + try{ + NdVehicleBaseInfo vehicle = vehicles.get(0); + + CompanyDTO company = companiesCacheHelper.getById(vehicle.getCompanyId()); + if(Objects.isNull(company)){ + System.out.println("没有此公司 !" + vehicle.getCompanyId()); + continue; + } + + //2.添加车辆设备 + NdVehicleEquipmentInfo saveEntity = new NdVehicleEquipmentInfo(); + saveEntity.setCarPlate(carPlate); + saveEntity.setRegionId(company.getRegionId()); + saveEntity.setEquipmentNo(equipmentNo); + saveEntity.setName("摄像头" + j); + saveEntity.setVehicleId(vehicle.getId()); + if(equipmentInfoService.save(saveEntity)){ + System.out.println("设备添加成功 :" + JSON.toJSONString(saveEntity)); + } + j++; + }catch (Exception e){ + e.printStackTrace(); + } + } + } + } + } + + @Test + public void importLvDao() throws FileNotFoundException { + File f = new File("C:\\Users\\PoffyZhang\\Desktop\\绿岛上报的设备通道.xlsx"); + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + Assert.assertNotNull(wb); + List hasNoCarPlate = Lists.newArrayList(); + Map equipmentCountMap = Maps.newConcurrentMap(); + + Row row; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i vehicles = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getCarPlate,carPlate) + .eq(NdVehicleBaseInfo::getAuditState,AuditStateEnum.AUDIT_SUCCESS.getCode())); + + if(CollUtil.isEmpty(vehicles)){ + hasNoCarPlate.add(carPlate); + continue; +// NdVehicleBaseInfo vehicle = new NdVehicleBaseInfo(); +// CompanyDTO company = companiesCacheHelper.getByName(companyName); +// if(Objects.isNull(company)){ +// System.out.println("没有这个公司 " + companyName); +// continue; +// } +// vehicle.setCompanyId(company.getId()); +// vehicle.setAuditState(AuditStateEnum.AUDIT_SUCESS.getCode()); +// vehicle.setRegionId(company.getRegionId()); +// vehicle.setRegionName(company.getRegionName()); +// vehicle.setCarPlate(carPlate); +// vehicle.setAudiMind("审核通过"); +// vehicle.setAuditBy(1L); +// vehicle.setAuditTime(LocalDateTime.now()); +// vehicle.setStatus(1); +// if(vehicleBaseInfoService.save(vehicle)){ +// vehicles.add(vehicle); +// } + } +// //1.先删除该车辆下的设备 +// equipmentInfoService.remove(Wrappers.lambdaQuery(NdVehicleEquipmentInfo.class) +// .eq(NdVehicleEquipmentInfo::getVehicleId,vehicles.get(0).getId())); + + if(Objects.isNull(equipmentNo)){ + System.out.println("空行跳过"); + continue; + } + System.out.println(carPlate + "," + companyName + "," + equipmentNo); + + try{ + NdVehicleBaseInfo vehicle = vehicles.get(0); + + CompanyDTO company = companiesCacheHelper.getById(vehicle.getCompanyId()); + if(Objects.isNull(company)){ + System.out.println("没有此公司 !" + vehicle.getCompanyId()); + continue; + } + + if(equipmentCountMap.containsKey(carPlate)){ + equipmentCountMap.put(carPlate,equipmentCountMap.get(carPlate) + 1); + }else{ + equipmentCountMap.put(carPlate,1); + } + + //2.添加车辆设备 + NdVehicleEquipmentInfo old = equipmentInfoService.getOne(Wrappers.lambdaQuery(NdVehicleEquipmentInfo.class) + .eq(NdVehicleEquipmentInfo::getEquipmentNo,equipmentNo).last("limit 1")); + NdVehicleEquipmentInfo saveEntity = new NdVehicleEquipmentInfo(); + if(Objects.nonNull(old)){ + saveEntity = old; + } + saveEntity.setCarPlate(carPlate); + saveEntity.setRegionId(company.getRegionId()); + saveEntity.setEquipmentNo(equipmentNo); + saveEntity.setName("摄像头" + equipmentCountMap.get(carPlate)); + saveEntity.setVehicleId(vehicle.getId()); + if(equipmentInfoService.saveOrUpdate(saveEntity)){ + System.out.println("设备添加成功 :" + JSON.toJSONString(saveEntity)); + } + }catch (Exception e){ + e.printStackTrace(); + } + + } + + + if(!hasNoCarPlate.isEmpty()){ + System.out.println("系统不存在的车辆号 " + hasNoCarPlate.size() + "个"); + for(String carPlate : hasNoCarPlate){ + System.out.print(carPlate + ","); + } + } + } + } + + @Test + public void test4() throws IOException { + File file = new File("C:\\Users\\PoffyZhang\\Desktop\\宁达文档\\联调车辆信息新(网泽)(1)(1).xlsx"); + InputStream is = Files.newInputStream(file.toPath()); + Workbook wb = readExcel(is,file.getName()); + + Assert.assertNotNull(wb); + + Row row; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i hasNoCarPlate = Sets.newHashSet(); + + Assert.assertNotNull(wb); + + Row row; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + for (int i = 1; i vehicles = vehicleBaseInfoService.list(Wrappers.lambdaQuery(NdVehicleBaseInfo.class) + .eq(NdVehicleBaseInfo::getCarPlate,carPlate) + .eq(NdVehicleBaseInfo::getAuditState,AuditStateEnum.AUDIT_SUCCESS.getCode())); + + if(CollUtil.isEmpty(vehicles)){ + hasNoCarPlate.add(carPlate); + continue; + } + } + + + if(!hasNoCarPlate.isEmpty()){ + System.out.println("系统不存在的车辆号 " + hasNoCarPlate.size() + "个"); + for(String carPlate : hasNoCarPlate){ + System.out.print(carPlate + ","); + } + } + } + } + + //这个下面是单独函数 + public static Workbook readExcel(InputStream is, String extString){ + Workbook wb = null; + + extString = extString.substring(extString.lastIndexOf(".")); + try { + if(".xls".equals(extString)){ + return wb = new HSSFWorkbook(is); + }else if(".xlsx".equals(extString)){ + return wb = new XSSFWorkbook(is); + }else { + return wb = null; + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wb; + } + + @Test + public void testTTTT(){ + List carsOnline = Arrays.asList("1","2"); + Boolean update = vehicleBaseInfoService.update(Wrappers.lambdaUpdate(NdVehicleBaseInfo.class) + .set(NdVehicleBaseInfo::getStatus, 0) + .notIn(NdVehicleBaseInfo::getCarPlate, carsOnline)); + System.out.println(update); + } + + + // 导入设备编号 + @Test + public void importEquipmentNo() throws FileNotFoundException { + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\中导设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\吴霞设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\绿岛设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\马良设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\星软设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\中交设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\网泽设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\道为尔设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\金华丽驰设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\嘉兴信达设备信息.xlsx"); + //File f = new File("D:\\work\\水泥车视频设备数据\\视频设备添加-星软-11.29.xlsx"); + File f = new File("D:\\work\\水泥车视频设备数据\\视频设备添加-星软-12.12.xlsx"); + + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + + Set hasNoCarPlate = Sets.newHashSet(); + + Row row; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 获取车辆基本信息 + Map baseInfoMap = vehicleBaseInfoService.list().stream() + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + // 获取车辆设备信息 + Map> equipmentMap = equipmentInfoService.list().stream() + .collect(Collectors.groupingBy(NdVehicleEquipmentInfo::getCarPlate)); + + // 获取车辆通道信息 + Map channelsMap = equipmentChannelsService.list().stream() + .collect(Collectors.toMap(NdVehicleEquipmentChannels::getEquipmentId, v -> v)); + + + //获取最大列数 + for (int i = 1; i equipmentInfos = equipmentMap.get(carPlate); + if (CollUtil.isNotEmpty(equipmentInfos)) { + // 当前车牌号已存在设备信息 + Map equipmentInfoMap = equipmentInfos.stream() + .collect(Collectors.toMap(NdVehicleEquipmentInfo::getEquipmentNo, v -> v)); + if (equipmentInfoMap.containsKey(equipmentNo)) { + // 已导入该设备信息 + NdVehicleEquipmentInfo vehicleEquipmentInfo = equipmentInfoMap.get(equipmentNo); + equipmentInfo.setId(vehicleEquipmentInfo.getId()); + } + } + + // 保存设备信息 + //equipmentInfo.setSimCardNo(simCardNo); + //equipmentInfo.setEndPoint(endPoint); + equipmentInfo.setEquipmentNo(equipmentNo); + equipmentInfo.setEquipmentFunction(equipmentFunction); + equipmentInfo.setVehicleId(baseInfo.getId()); + equipmentInfo.setCarPlate(carPlate); + equipmentInfo.setName(name); + equipmentInfo.setPlatformId(platformId); + equipmentInfo.setUpdateOn(LocalDateTime.now()); + equipmentInfoService.saveOrUpdate(equipmentInfo); + + // 保存通道名称 + NdVehicleEquipmentChannels equipmentChannel = new NdVehicleEquipmentChannels(); + Long equipmentId = equipmentInfo.getId(); + // 通道信息存在 + if (channelsMap.containsKey(equipmentId)){ + NdVehicleEquipmentChannels channels = channelsMap.get(equipmentId); + equipmentChannel.setId(channels.getId()); + } + equipmentChannel.setEquipmentId(equipmentId); + equipmentChannel.setName(channelName); + equipmentChannel.setUpdateOn(LocalDateTime.now()); + equipmentChannelsService.saveOrUpdate(equipmentChannel); + } + + if(!hasNoCarPlate.isEmpty()){ + System.out.println("系统不存在的车辆号 " + hasNoCarPlate.size() + "个"); + for(String carPlate : hasNoCarPlate){ + System.out.print(carPlate + ","); + } + } + } + } + + // 更新车辆类型 + @Test + public void importEquipmentNo2() throws FileNotFoundException { + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\中导设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\吴霞设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\绿岛设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\马良设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\星软设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\中交设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\网泽设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\道为尔设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\金华丽驰设备信息.xlsx"); + File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\嘉兴信达设备信息.xlsx"); + + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + + Set hasNoCarPlate = Sets.newHashSet(); + + Row row; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 获取车辆基本信息 + Map baseInfoMap = vehicleBaseInfoService.list().stream() + .collect(Collectors.toMap(NdVehicleBaseInfo::getCarPlate, v -> v)); + + // 获取车辆设备信息 + Map> equipmentMap = equipmentInfoService.list().stream() + .collect(Collectors.groupingBy(NdVehicleEquipmentInfo::getCarPlate)); + + //获取最大列数 + for (int i = 1; i equipmentInfos = equipmentMap.get(carPlate); + if (CollUtil.isNotEmpty(equipmentInfos)) { + // 当前车牌号已存在设备信息 + Map equipmentInfoMap = equipmentInfos.stream() + .collect(Collectors.toMap(NdVehicleEquipmentInfo::getEquipmentNo, v -> v)); + if (equipmentInfoMap.containsKey(equipmentNo)) { + // 已导入该设备信息 + NdVehicleEquipmentInfo vehicleEquipmentInfo = equipmentInfoMap.get(equipmentNo); + equipmentInfo.setId(vehicleEquipmentInfo.getId()); + } + } + + // 保存设备信息 + equipmentInfo.setSimCardNo(simCardNo); + equipmentInfo.setEndPoint(endPoint); + equipmentInfo.setEquipmentNo(equipmentNo); + equipmentInfo.setEquipmentFunction(equipmentFunction); + equipmentInfo.setVehicleId(baseInfo.getId()); + equipmentInfo.setCarPlate(carPlate); + equipmentInfo.setName(name); + equipmentInfo.setPlatformId(platformId); + equipmentInfo.setUpdateOn(LocalDateTime.now()); + equipmentInfoService.saveOrUpdate(equipmentInfo); + } + + if(!hasNoCarPlate.isEmpty()){ + System.out.println("系统不存在的车辆号 " + hasNoCarPlate.size() + "个"); + for(String carPlate : hasNoCarPlate){ + System.out.print(carPlate + ","); + } + } + } + } + + + // 导入平台ID + @Test + public void importPlatId() throws FileNotFoundException { + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\中导设备信息.xlsx"); + File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\吴霞设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\绿岛设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\马良设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\星软设备信息.xlsx"); + //File f = new File("C:\\Users\\CMM\\Desktop\\水泥车数据初始化\\设备信息\\中交设备信息.xlsx"); + + Workbook wb = readExcel(new FileInputStream(f),f.getName()); + + Set hasNoCarPlate = Sets.newHashSet(); + + Row row; + if(wb != null){ + //获取第一个sheet + Sheet sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + + // 获取车辆设备信息 + Map equipmentMap = equipmentInfoService.list().stream() + .filter(e -> "video".equals(e.getEquipmentFunction())) + .collect(Collectors.toMap(e -> e.getCarPlate() + e.getEquipmentNo(), e -> e)); + + //获取最大列数 + for (int i = 1; i + + 4.0.0 + + com.ningdatech + ningda-yw-road + pom + 1.0.0 + ningda-yw-road + + + UTF-8 + 2.6.15 + 1.8 + 1.8 + 3.5.4.1 + 3.0.0 + 3.0.3 + 1.2.9 + 31.1-jre + 2.11.1 + + + + + + cn.hutool + hutool-all + 5.8.18 + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis.plus.version} + + + com.baomidou + mybatis-plus-extension + ${mybatis.plus.version} + + + com.alibaba + fastjson + ${fast.json.version} + + + + com.google.guava + guava + ${guava.version} + + + + com.ningdatech + nd-swagger2-starter + 1.0.0 + + + com.ningdatech + nd-openapi-signature-starter + 1.0.0 + + + + com.aliyun.oss + aliyun-sdk-oss + 3.15.0 + + + + com.alibaba + easyexcel + 3.1.2 + + + com.ningdatech + nd-sms-send-starter + 1.0.0 + + + + cn.afterturn + easypoi-base + 4.2.0 + + + + + + + + spring-plugin + spring-plugin + https://maven.aliyun.com/repository/spring-plugin + + true + + + false + + + + + + ningda-yw-api + + diff --git a/开发指南.md b/开发指南.md new file mode 100644 index 0000000..725b646 --- /dev/null +++ b/开发指南.md @@ -0,0 +1,18 @@ +# yw-car-manage + +义乌公路 + +## 常用字段命名 + +命名原则:尽可能简短且能见名知意 + +- 备注:remark +- 修改时间:update_on +- 修改人:update_by +- 创建人:create_by +- 创建时间:create_on +- 表主键:id +- 身份证号:idcard +- 电话:mobile +- 车牌号:car_no +- 驾驶证编号:driver_license_no \ No newline at end of file