| @ -0,0 +1,33 @@ | |||||
| HELP.md | |||||
| target/ | |||||
| !.mvn/wrapper/maven-wrapper.jar | |||||
| !**/src/main/**/target/ | |||||
| !**/src/test/**/target/ | |||||
| ### STS ### | |||||
| .apt_generated | |||||
| .classpath | |||||
| .factorypath | |||||
| .project | |||||
| .settings | |||||
| .springBeans | |||||
| .sts4-cache | |||||
| ### IntelliJ IDEA ### | |||||
| .idea | |||||
| *.iws | |||||
| *.iml | |||||
| *.ipr | |||||
| ### NetBeans ### | |||||
| /nbproject/private/ | |||||
| /nbbuild/ | |||||
| /dist/ | |||||
| /nbdist/ | |||||
| /.nb-gradle/ | |||||
| build/ | |||||
| !**/src/main/**/build/ | |||||
| !**/src/test/**/build/ | |||||
| ### VS Code ### | |||||
| .vscode/ | |||||
| @ -0,0 +1,145 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||||
| <modelVersion>4.0.0</modelVersion> | |||||
| <groupId>com.inspect</groupId> | |||||
| <artifactId>inspect-simulator-senior</artifactId> | |||||
| <version>v-1.0</version> | |||||
| <name>inspect-simulator-senior</name> | |||||
| <description>inspect-simulator-senior</description> | |||||
| <properties> | |||||
| <java.version>1.8</java.version> | |||||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||||
| <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |||||
| <spring-boot.version>2.6.13</spring-boot.version> | |||||
| <start-class>com.inspect.simulator.InspectSimulatorApplication</start-class> | |||||
| </properties> | |||||
| <dependencies> | |||||
| <dependency> | |||||
| <groupId>org.springframework.boot</groupId> | |||||
| <artifactId>spring-boot-starter</artifactId> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>org.springframework.boot</groupId> | |||||
| <artifactId>spring-boot-starter-web</artifactId> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>org.springframework.boot</groupId> | |||||
| <artifactId>spring-boot-starter-test</artifactId> | |||||
| <scope>test</scope> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>org.projectlombok</groupId> | |||||
| <artifactId>lombok</artifactId> | |||||
| <version>1.18.24</version> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>org.apache.commons</groupId> | |||||
| <artifactId>commons-lang3</artifactId> | |||||
| <version>3.12.0</version> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>com.squareup.retrofit2</groupId> | |||||
| <artifactId>retrofit</artifactId> | |||||
| <version>2.9.0</version> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>com.squareup.retrofit2</groupId> | |||||
| <artifactId>converter-jackson</artifactId> | |||||
| <version>2.9.0</version> | |||||
| </dependency> | |||||
| <!-- https://mvnrepository.com/artifact/com.squareup.retrofit2/converter-gson --> | |||||
| <dependency> | |||||
| <groupId>com.squareup.retrofit2</groupId> | |||||
| <artifactId>converter-gson</artifactId> | |||||
| <version>2.9.0</version> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>com.squareup.retrofit2</groupId> | |||||
| <artifactId>converter-scalars</artifactId> | |||||
| <version>2.9.0</version> | |||||
| </dependency> | |||||
| <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> | |||||
| <dependency> | |||||
| <groupId>com.google.code.gson</groupId> | |||||
| <artifactId>gson</artifactId> | |||||
| <version>2.10.1</version> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>com.alibaba</groupId> | |||||
| <artifactId>fastjson</artifactId> | |||||
| <version>1.2.83</version> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>mysql</groupId> | |||||
| <artifactId>mysql-connector-java</artifactId> | |||||
| <version>8.0.28</version> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>com.alibaba</groupId> | |||||
| <artifactId>druid-spring-boot-starter</artifactId> | |||||
| <version>1.2.8</version> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>com.baomidou</groupId> | |||||
| <artifactId>dynamic-datasource-spring-boot-starter</artifactId> | |||||
| <version>3.5.0</version> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>org.mybatis.spring.boot</groupId> | |||||
| <artifactId>mybatis-spring-boot-starter</artifactId> | |||||
| <version>2.2.2</version> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>com.baomidou</groupId> | |||||
| <artifactId>mybatis-plus-boot-starter</artifactId> | |||||
| <version>3.4.3</version> | |||||
| </dependency> | |||||
| </dependencies> | |||||
| <dependencyManagement> | |||||
| <dependencies> | |||||
| <dependency> | |||||
| <groupId>org.springframework.boot</groupId> | |||||
| <artifactId>spring-boot-dependencies</artifactId> | |||||
| <version>${spring-boot.version}</version> | |||||
| <type>pom</type> | |||||
| <scope>import</scope> | |||||
| </dependency> | |||||
| </dependencies> | |||||
| </dependencyManagement> | |||||
| <build> | |||||
| <plugins> | |||||
| <plugin> | |||||
| <groupId>org.apache.maven.plugins</groupId> | |||||
| <artifactId>maven-compiler-plugin</artifactId> | |||||
| <version>3.8.1</version> | |||||
| <configuration> | |||||
| <source>1.8</source> | |||||
| <target>1.8</target> | |||||
| <encoding>UTF-8</encoding> | |||||
| </configuration> | |||||
| </plugin> | |||||
| <plugin> | |||||
| <groupId>org.springframework.boot</groupId> | |||||
| <artifactId>spring-boot-maven-plugin</artifactId> | |||||
| <version>${spring-boot.version}</version> | |||||
| <configuration> | |||||
| <mainClass>com.inspect.simulator.InspectSimulatorApplication</mainClass> | |||||
| <!-- <skip>true</skip>--> | |||||
| </configuration> | |||||
| <executions> | |||||
| <execution> | |||||
| <id>repackage</id> | |||||
| <goals> | |||||
| <goal>repackage</goal> | |||||
| </goals> | |||||
| </execution> | |||||
| </executions> | |||||
| </plugin> | |||||
| </plugins> | |||||
| </build> | |||||
| </project> | |||||
| @ -0,0 +1,77 @@ | |||||
| package com.inspect.simulator; | |||||
| import okhttp3.Interceptor; | |||||
| import okhttp3.OkHttpClient; | |||||
| import okhttp3.Request; | |||||
| import org.springframework.beans.factory.annotation.Value; | |||||
| import org.springframework.boot.SpringApplication; | |||||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |||||
| import org.springframework.context.annotation.Bean; | |||||
| import org.springframework.scheduling.annotation.EnableScheduling; | |||||
| import retrofit2.Retrofit; | |||||
| import retrofit2.converter.jackson.JacksonConverterFactory; | |||||
| import retrofit2.converter.scalars.ScalarsConverterFactory; | |||||
| @SpringBootApplication | |||||
| @EnableScheduling | |||||
| public class InspectSimulatorApplication { | |||||
| @Value("${analysis.api.url}") | |||||
| private String apiUrlOfAnalysis; | |||||
| @Value("${analysis.api.token}") | |||||
| private String apiTokenOfAnalysis; | |||||
| @Value("${upper.api.url}") | |||||
| private String apiUrlOfUpper; | |||||
| // @Value("${upper.api.token}") | |||||
| // private String apiTokenOfUpper; | |||||
| OkHttpClient.Builder clientBuilderOfAnalysis = new OkHttpClient.Builder(); | |||||
| Interceptor interceptorOfAnalysis = chain -> { | |||||
| Request request = chain.request() | |||||
| .newBuilder() | |||||
| // .addHeader("Authorization", "token " + token) | |||||
| // .addHeader("content-type", "application/json") | |||||
| .build(); | |||||
| return chain.proceed(request); | |||||
| }; | |||||
| @Bean(name = "RetrofitOfAnalysis") | |||||
| public Retrofit retrofitOfAnalysis() { | |||||
| clientBuilderOfAnalysis.interceptors().add(interceptorOfAnalysis); | |||||
| return new Retrofit.Builder() | |||||
| .baseUrl(apiUrlOfAnalysis) | |||||
| .client(clientBuilderOfAnalysis.build()) | |||||
| .addConverterFactory(ScalarsConverterFactory.create()) | |||||
| // //.addConverterFactory(GsonConverterFactory.create()) | |||||
| .addConverterFactory(JacksonConverterFactory.create()) | |||||
| .build(); | |||||
| } | |||||
| OkHttpClient.Builder clientBuilderOfUpper = new OkHttpClient.Builder(); | |||||
| Interceptor interceptorOfUpper = chain -> { | |||||
| Request request = chain.request() | |||||
| .newBuilder() | |||||
| // .addHeader("Authorization", "token " + token) | |||||
| // .addHeader("content-type", "application/json") | |||||
| .build(); | |||||
| return chain.proceed(request); | |||||
| }; | |||||
| @Bean(name = "RetrofitOfUpper") | |||||
| public Retrofit retrofitOfUpper() { | |||||
| clientBuilderOfUpper.interceptors().add(interceptorOfUpper); | |||||
| return new Retrofit.Builder() | |||||
| .baseUrl(apiUrlOfUpper) | |||||
| .client(clientBuilderOfAnalysis.build()) | |||||
| .addConverterFactory(ScalarsConverterFactory.create()) | |||||
| // //.addConverterFactory(GsonConverterFactory.create()) | |||||
| .addConverterFactory(JacksonConverterFactory.create()) | |||||
| .build(); | |||||
| } | |||||
| public static void main(String[] args) { | |||||
| SpringApplication.run(InspectSimulatorApplication.class, args); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,102 @@ | |||||
| package com.inspect.simulator.controller; | |||||
| import com.google.gson.Gson; | |||||
| import com.inspect.simulator.domain.algorithm.in.AnalyseRequest; | |||||
| import com.inspect.simulator.domain.algorithm.out.AnalyseResItem; | |||||
| import com.inspect.simulator.domain.algorithm.out.AnalyseResPoint; | |||||
| import com.inspect.simulator.domain.algorithm.out.AnalyseResult; | |||||
| import com.inspect.simulator.service.remote.AnalysisRemoteService; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.http.ResponseEntity; | |||||
| import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestBody; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import retrofit2.Call; | |||||
| import retrofit2.Response; | |||||
| import javax.annotation.Resource; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| @RestController | |||||
| public class AlgorithmController { | |||||
| private final Logger log = LoggerFactory.getLogger(this.getClass()); | |||||
| @Resource | |||||
| private AnalysisRemoteService analysisRemoteService; | |||||
| @PostMapping("/simu/filter/picAnalyse") | |||||
| public ResponseEntity<String> filterPicAnalyse(@RequestBody final String analyseRequestStr) { | |||||
| log.info("[FILTER] filterPicAnalyse: analyseRequestStr={}", analyseRequestStr); | |||||
| AnalyseRequest analyseRequest = new Gson().fromJson(analyseRequestStr, AnalyseRequest.class); | |||||
| log.info("[FILTER] filterPicAnalyse: analyseRequest={}", new Gson().toJson(analyseRequest)); | |||||
| AnalyseResult analyseResult = new AnalyseResult(); | |||||
| analyseResult.setRequestId(analyseRequest.getRequestId()); | |||||
| AnalyseResPoint analyseResPoint = new AnalyseResPoint(); | |||||
| analyseResPoint.setValue("0"); | |||||
| analyseResPoint.setConf("0.85"); | |||||
| analyseResPoint.setCode("2000"); | |||||
| analyseResPoint.setResImageUrl(analyseRequest.getObjectList().get(0).getImageUrlList()[0]); | |||||
| List<AnalyseResPoint> analyseResPoints = new ArrayList<>(); | |||||
| analyseResPoints.add(analyseResPoint); | |||||
| AnalyseResItem analyseResItem = new AnalyseResItem(); | |||||
| analyseResItem.setObjectId(analyseRequest.getObjectList().get(0).getObjectId()); | |||||
| analyseResItem.setAlgFactory("yd"); | |||||
| analyseResItem.setResults(analyseResPoints); | |||||
| List<AnalyseResItem> analyseResItems = new ArrayList<>(); | |||||
| analyseResItems.add(analyseResItem); | |||||
| analyseResult.setResultList(analyseResItems); | |||||
| log.info("[FILTER] filterPicAnalyse: analyseResult={}", new Gson().toJson(analyseResult)); | |||||
| try { | |||||
| Call<Object> call = analysisRemoteService.picAnalyseRetNotify(analyseResult); | |||||
| Response<Object> response = call.execute(); | |||||
| Object result = response.body(); | |||||
| System.out.println("result: " + result); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return ResponseEntity.ok().body("{\"code\":\"200\"}"); | |||||
| } | |||||
| @PostMapping("/simu/bigModel/picAnalyse") | |||||
| public ResponseEntity<String> bigModelPicAnalyse(@RequestBody final String analyseRequestStr) { | |||||
| log.info("[FILTER] bigModelPicAnalyse: analyseRequestStr={}", analyseRequestStr); | |||||
| AnalyseRequest analyseRequest = new Gson().fromJson(analyseRequestStr, AnalyseRequest.class); | |||||
| log.info("[FILTER] bigModelPicAnalyse: analyseRequest={}", new Gson().toJson(analyseRequest)); | |||||
| AnalyseResult analyseResult = new AnalyseResult(); | |||||
| analyseResult.setRequestId(analyseRequest.getRequestId()); | |||||
| AnalyseResPoint analyseResPoint = new AnalyseResPoint(); | |||||
| analyseResPoint.setValue("1"); | |||||
| analyseResPoint.setConf("0.95"); | |||||
| analyseResPoint.setCode("2000"); | |||||
| analyseResPoint.setResImageUrl(analyseRequest.getObjectList().get(0).getImageUrlList()[0]); | |||||
| List<AnalyseResPoint> analyseResPoints = new ArrayList<>(); | |||||
| analyseResPoints.add(analyseResPoint); | |||||
| AnalyseResItem analyseResItem = new AnalyseResItem(); | |||||
| analyseResItem.setObjectId(analyseRequest.getObjectList().get(0).getObjectId()); | |||||
| analyseResItem.setAlgFactory("yd"); | |||||
| analyseResItem.setResults(analyseResPoints); | |||||
| List<AnalyseResItem> analyseResItems = new ArrayList<>(); | |||||
| analyseResItems.add(analyseResItem); | |||||
| analyseResult.setResultList(analyseResItems); | |||||
| log.info("[FILTER] bigModelPicAnalyse: analyseResult={}", new Gson().toJson(analyseResult)); | |||||
| try { | |||||
| Call<Object> call = analysisRemoteService.picAnalyseRetNotify(analyseResult); | |||||
| Response<Object> response = call.execute(); | |||||
| Object result = response.body(); | |||||
| System.out.println("result: " + result); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return ResponseEntity | |||||
| .ok() | |||||
| .body("{\"code\":\"200\"}"); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,24 @@ | |||||
| package com.inspect.simulator.controller; | |||||
| import com.inspect.simulator.domain.file.FileReturn; | |||||
| import com.inspect.simulator.service.FileService; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RequestParam; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import org.springframework.web.multipart.MultipartFile; | |||||
| @RestController | |||||
| @RequestMapping(value = "/file") | |||||
| public class FileController { | |||||
| private final FileService fileService; | |||||
| public FileController(FileService fileService) { | |||||
| this.fileService = fileService; | |||||
| } | |||||
| @RequestMapping("/upload") | |||||
| public FileReturn uploadFile(@RequestParam("filename") String filename, @RequestParam("uploadFile") MultipartFile multipartFile) { | |||||
| return fileService.uploadFile(filename, multipartFile); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,335 @@ | |||||
| package com.inspect.simulator.controller; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.google.gson.Gson; | |||||
| import com.inspect.simulator.domain.analysis.vi.AnalysisRequest; | |||||
| import com.inspect.simulator.domain.analysis.vo.AnalysisResult; | |||||
| import com.inspect.simulator.domain.analysis.vo.AnalysisResultEntity; | |||||
| import com.inspect.simulator.domain.analysis.vo.AnalysisResultList; | |||||
| import com.inspect.simulator.domain.ivs.*; | |||||
| import com.inspect.simulator.service.remote.AnalysisRemoteService; | |||||
| import com.inspect.simulator.view.IvsPlatformSnapshotView; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Value; | |||||
| import org.springframework.boot.system.ApplicationHome; | |||||
| import org.springframework.core.io.InputStreamResource; | |||||
| import org.springframework.http.HttpHeaders; | |||||
| import org.springframework.http.MediaType; | |||||
| import org.springframework.http.ResponseEntity; | |||||
| import org.springframework.util.ClassUtils; | |||||
| import org.springframework.util.ResourceUtils; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import retrofit2.Call; | |||||
| import retrofit2.Response; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.io.*; | |||||
| import java.net.URLDecoder; | |||||
| import java.nio.file.Files; | |||||
| import java.util.*; | |||||
| @RestController | |||||
| public class IvsServerController { | |||||
| private final Logger log = LoggerFactory.getLogger(this.getClass()); | |||||
| private final String TASK_CODE = "1234567890"; | |||||
| private final String PIC_URL = "https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=d&word=songbird&step_word=&hs=0&pn=15&spn=0&di=7360350738658099201&pi=0&rn=1&tn=baiduimagedetail&is=0%2C0&istype=2&ie=utf-8&oe=utf-8&in=&cl=2&lm=&st=-1&cs=1060316073%2C1951231255&os=2156611125%2C946097664&simid=60689125%2C716595069&adpicid=0&lpn=0&ln=1080&fr=&fmq=1718353459191_R&fm=result&ic=0&s=undefined&hd=&latest=©right=&se=&sme=&tab=0&width=&height=&face=undefined&ist=&jit=&cg=&bdtype=0&oriquery=&objurl=https%3A%2F%2Fup.sc.enterdesk.com%2Fedpic%2Ff4%2F4a%2Fee%2Ff44aeeb12debd4e56faf34d72890d76d.jpg&fromurl=ippr_z2C%24qAzdH3FAzdH3F4_z%26e3Bfv_z%26e3Bjgpj61jfh_z%26e3Bv54AzdH3F_jgAzdH3Ff7vwtAzdH3Fnbn8lb_z%26e3Bip4s&gsm=1e&rpstart=0&rpnum=0&islist=&querylist=&nojc=undefined&lid=6977254189663851692"; | |||||
| private final AnalysisRemoteService analysisRemoteService; | |||||
| @Value("${platform.url}") | |||||
| private String platFormUrl; | |||||
| public IvsServerController(AnalysisRemoteService analysisRemoteService) { | |||||
| this.analysisRemoteService = analysisRemoteService; | |||||
| } | |||||
| @GetMapping("/common/keepAlive") | |||||
| public ResponseEntity<IvsResult> keepAlive() { | |||||
| log.info("[GAB] keep alive"); | |||||
| return ResponseEntity | |||||
| .ok() | |||||
| .body(IvsResult.builder().resultCode("0").build()); | |||||
| } | |||||
| @PostMapping({"/loginInfo/login/v1.0"}) | |||||
| public ResponseEntity<IvsResult> login(@RequestBody Login login) { | |||||
| log.info("[GAB] login : {}", login.toString()); | |||||
| HttpHeaders responseHeaders = new HttpHeaders(); | |||||
| responseHeaders.set("Set-Cookie", "token=1234567890"); | |||||
| return ResponseEntity | |||||
| .ok() | |||||
| .headers(responseHeaders) | |||||
| .body(IvsResult.builder().resultCode("0").build()); | |||||
| } | |||||
| @GetMapping("/device/ptzpresetlist/{cameraCode}/{domainCode}") | |||||
| public ResponseEntity<IvsPresetListView> ptzPresetList( | |||||
| @PathVariable("cameraCode") String cameraCode, | |||||
| @PathVariable("domainCode") String domainCode | |||||
| ) { | |||||
| log.info("[GAB] cameraCode : {}, domainCode: {}", cameraCode, domainCode); | |||||
| List<IvsPresetListView.PtzPresetInfo> list = new ArrayList<>(); | |||||
| list.add(IvsPresetListView.PtzPresetInfo | |||||
| .builder().presetName("preset").presetIndex(0).focusSwitch(1).reserve("reserve") | |||||
| .build()); | |||||
| return ResponseEntity | |||||
| .ok() | |||||
| .body(IvsPresetListView | |||||
| .builder() | |||||
| .resultCode(0) | |||||
| .ptzPresetNum(1) | |||||
| .ptzPresetInfoList(IvsPresetListView.PtzPresetInfoList.builder().ptzPresetInfo(list).build()) | |||||
| .build()); | |||||
| } | |||||
| @PostMapping({"/video/rtspurl/v1.0"}) | |||||
| public ResponseEntity<IvsVideoRtspView> videoRtspUrl(@RequestBody IvsVideoRtspVo rtspVo) { | |||||
| log.info("[GAB] videoRtspUrl : {}", rtspVo.toString()); | |||||
| return ResponseEntity | |||||
| .ok() | |||||
| .body( | |||||
| IvsVideoRtspView | |||||
| .builder() | |||||
| .resultCode("0") | |||||
| .rtspURL("rtsp://admin:wd19216811@192.168.1.249:554/h264/ch39/main/av_stream") | |||||
| .build() | |||||
| ); | |||||
| } | |||||
| @PostMapping({"/device/ptzcontrol"}) | |||||
| public ResponseEntity<ResultEntity> devicePtzControl(@RequestBody SipbPtzVo ptzVo) { | |||||
| log.info("[GAB] devicePtzControl : {}", ptzVo.toString()); | |||||
| return ResponseEntity | |||||
| .ok() | |||||
| .body(ResultEntity.builder().resultCode("0").build()); | |||||
| } | |||||
| @GetMapping("/device/deviceList/v1.0") | |||||
| public ResponseEntity<ResultEntity> getDeviceList(IvsDevChanListVo chanListVo) { | |||||
| log.info("[GAB] chanListVo : {}", chanListVo.toString()); | |||||
| return ResponseEntity | |||||
| .ok() | |||||
| .body(ResultEntity.builder().resultCode("0").build()); | |||||
| } | |||||
| private static int mCount = 0; | |||||
| @GetMapping("/platform/platformSnapshot/{cameraCode}/{domainCode}") | |||||
| public ResponseEntity<ResultEntity> getPlatformSnapshot( | |||||
| @PathVariable("cameraCode") String cameraCode, | |||||
| @PathVariable("domainCode") String domainCode, | |||||
| IvsDevChanSnapVo chanSnapVo | |||||
| ) { | |||||
| log.info("[GAB] cameraCode: {}, domainCode: {}, platformSnapshot: {}", cameraCode, domainCode, chanSnapVo.toString()); | |||||
| mCount++; | |||||
| // if(mCount % 2 == 0) | |||||
| { | |||||
| return ResponseEntity | |||||
| .ok() | |||||
| .body(ResultEntity | |||||
| .builder() | |||||
| .resultCode("0") | |||||
| .resultBody(IvsSnapshotView | |||||
| .builder() | |||||
| .taskID(TASK_CODE) | |||||
| .build() | |||||
| ).build() | |||||
| ); | |||||
| } | |||||
| // else { | |||||
| // return ResponseEntity | |||||
| // .ok().body(null); | |||||
| // } | |||||
| // return ResponseEntity | |||||
| // .ok() | |||||
| // .body(ResultEntity | |||||
| // .builder() | |||||
| // .resultCode("0") | |||||
| // .resultBody(IvsSnapshotView | |||||
| // .builder() | |||||
| // .taskID(TASK_CODE) | |||||
| // .build() | |||||
| // ).build() | |||||
| // ); | |||||
| } | |||||
| private static int mCount2 = 0; | |||||
| @PostMapping("/platform/snapshotList") | |||||
| public ResponseEntity<IvsPlatformSnapshotView> getPlatformSnapshotList(@RequestBody IvsChanSnapVo chanSnapVo) { | |||||
| log.info("[GAB] chanSnapVo: {}", chanSnapVo.toString()); | |||||
| mCount2++; | |||||
| // if(mCount2 % 4 == 0) | |||||
| { | |||||
| List<IvsPlatformSnapshotView.SnapshotInfo> snapshotInfos = new ArrayList<>(); | |||||
| final String urlRes = platFormUrl + "/platform/snapshot/" + chanSnapVo.getCameraCode(); | |||||
| //final String urlRes = "http://192.168.110.184:18530/platform/snapshot/" + chanSnapVo.getCameraCode(); | |||||
| snapshotInfos.add( | |||||
| IvsPlatformSnapshotView.SnapshotInfo | |||||
| .builder() | |||||
| .cameraCode(chanSnapVo.getCameraCode()) | |||||
| .pictureName("test.png") | |||||
| .previewUrl(urlRes) | |||||
| .pictureUrl(urlRes) | |||||
| .build() | |||||
| ); | |||||
| IvsPlatformSnapshotView.SnapshotInfoList snapshotInfoList = | |||||
| IvsPlatformSnapshotView.SnapshotInfoList | |||||
| .builder() | |||||
| .total(1) | |||||
| .indexRange(IndexRange.builder().fromIndex(0).toIndex(0).build()) | |||||
| .snapshotInfos(snapshotInfos) | |||||
| .build(); | |||||
| IvsPlatformSnapshotView snapshotView | |||||
| = IvsPlatformSnapshotView | |||||
| .builder() | |||||
| .resultCode("0") | |||||
| .snapshotInfoList(snapshotInfoList) | |||||
| .build(); | |||||
| return ResponseEntity | |||||
| .ok() | |||||
| .body(snapshotView); | |||||
| } | |||||
| // else { | |||||
| // return ResponseEntity | |||||
| // .ok() | |||||
| // .body(null); | |||||
| // } | |||||
| } | |||||
| @GetMapping("/platform/snapshot/{cameraCode}") | |||||
| public ResponseEntity<InputStreamResource> getPlatformSnapshotByCameraCode(@PathVariable("cameraCode") String cameraCode, HttpServletResponse response) { | |||||
| log.info("[GAB] get stream, cameraCode: {}", cameraCode); | |||||
| try { | |||||
| final String resourcePath = String.format("images/%s.jpg", cameraCode); | |||||
| // InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcePath); | |||||
| final String userDir = System.getProperty("user.dir"); | |||||
| final String absolutePath = userDir.endsWith("/") ? | |||||
| userDir + resourcePath : | |||||
| userDir + File.separator + resourcePath; | |||||
| log.info("absolutePath: {}", absolutePath); | |||||
| InputStream inputStream = Files.newInputStream(new File(absolutePath).toPath()); | |||||
| int length = inputStream.available(); | |||||
| log.info("[snapshot] inputStream length: {}", length); | |||||
| //byte bytes[] = new byte[length]; | |||||
| //response.setContentLength(length); | |||||
| InputStreamResource resource = new InputStreamResource(inputStream); | |||||
| return ResponseEntity.ok() | |||||
| .contentType(MediaType.IMAGE_JPEG) | |||||
| .body(resource) | |||||
| ; | |||||
| } catch (Exception e) { | |||||
| //e.printStackTrace(); | |||||
| log.info("[GAB] get stream cameraCode: {}, exception: {}", cameraCode, e.getMessage()); | |||||
| return ResponseEntity.ok().body(null); | |||||
| } | |||||
| } | |||||
| @GetMapping("/platform/snapshot2/{cameraCode}") | |||||
| public ResponseEntity<InputStreamResource> getPlatformSnapshotByCameraCode2(@PathVariable("cameraCode") String cameraCode, HttpServletResponse response) { | |||||
| log.info("[GAB] get stream2, cameraCode: {}", cameraCode); | |||||
| try { | |||||
| File path = new File(ResourceUtils.getURL("classpath:").getPath()); | |||||
| if (!path.exists()) path = new File(""); | |||||
| log.info("path1: {}", path.getAbsolutePath()); | |||||
| log.info("path2: {}", System.getProperty("user.dir")); | |||||
| String path1 = ClassUtils.getDefaultClassLoader().getResource("").getPath(); | |||||
| log.info("path3: {}", URLDecoder.decode(path1, "utf-8")); | |||||
| String path2 = ResourceUtils.getURL("classpath:").getPath(); | |||||
| log.info("path4: {}", path2); | |||||
| ApplicationHome h = new ApplicationHome(getClass()); | |||||
| File jarF = h.getSource(); | |||||
| log.info("path5: {}", jarF.getParentFile().toString()); | |||||
| final String resourcePath = String.format("images/%s.jpg", cameraCode); | |||||
| final String userDir = System.getProperty("user.dir"); | |||||
| final String absolutePath = userDir.endsWith("/") ? | |||||
| userDir + resourcePath : | |||||
| userDir + "\\" + resourcePath; | |||||
| log.info("absolutePath2: {}", absolutePath); | |||||
| InputStream inputStream = Files.newInputStream(new File(absolutePath).toPath()); | |||||
| int length = inputStream.available(); | |||||
| log.info("[snapshot] inputStream2 length: {}", length); | |||||
| InputStreamResource resource = new InputStreamResource(inputStream); | |||||
| return ResponseEntity.ok() | |||||
| .contentType(MediaType.IMAGE_JPEG) | |||||
| .body(resource) | |||||
| ; | |||||
| } catch (Exception e) { | |||||
| //e.printStackTrace(); | |||||
| log.info("[GAB] get stream cameraCode: {}, exception2: {}", cameraCode, e.getMessage()); | |||||
| return ResponseEntity.ok().body(null); | |||||
| } | |||||
| } | |||||
| @PostMapping({"/picAnalyse"}) | |||||
| public ResponseEntity<String> picAnalyse(@RequestBody AnalysisRequest analysisRequest) { | |||||
| log.info("[GAB] analysisRequest!!!!!!: {}", analysisRequest.toString()); | |||||
| // OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder(); | |||||
| // Interceptor interceptor = chain -> { | |||||
| // Request request = chain.request().newBuilder().addHeader("Authorization", "token 012345678").build(); | |||||
| // return chain.proceed(request); | |||||
| // }; | |||||
| // | |||||
| // clientBuilder.interceptors().add(interceptor); | |||||
| // Retrofit retrofit = new Retrofit.Builder() | |||||
| // .baseUrl(analysisRequest.getRequestHostIp() + ":" + analysisRequest.getRequestHostPort()) | |||||
| // .client(clientBuilder.build()) | |||||
| // .addConverterFactory(JacksonConverterFactory.create()) | |||||
| // .build(); | |||||
| AnalysisResult analysisResult = AnalysisResult.builder() | |||||
| .code("2000") | |||||
| .resImageUrl(analysisRequest.getObjectList().get(0).getImageUrlList().get(0)) | |||||
| .pos(Arrays.asList("")) | |||||
| .conf(0.99) | |||||
| .value("30") | |||||
| .type("meter") | |||||
| .desc("blablabla") | |||||
| .build(); | |||||
| List<AnalysisResult> results = new ArrayList<>(); | |||||
| results.add(analysisResult); | |||||
| AnalysisResultList analysisResultList = AnalysisResultList.builder() | |||||
| .algFactory("yd") | |||||
| .objectId(analysisRequest.getObjectList().get(0).getObjectId()) | |||||
| .results(results) | |||||
| .build(); | |||||
| List<AnalysisResultList> resultList = new ArrayList<>(); | |||||
| resultList.add(analysisResultList); | |||||
| AnalysisResultEntity analysisResultEntity = AnalysisResultEntity.builder() | |||||
| .requestId(analysisRequest.getRequestId()) | |||||
| .resultList(resultList) | |||||
| .build(); | |||||
| final String analysisResultJson = new Gson().toJson(analysisResultEntity); | |||||
| System.out.println("res entity: \n" + analysisResultJson); | |||||
| try { | |||||
| JSONObject parseObject = JSONObject.parseObject(analysisResultJson); | |||||
| System.out.println("parseObject: \n" + parseObject); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| try { | |||||
| Call<Object> call = analysisRemoteService.analysisResultNotify(analysisResultEntity); | |||||
| Response<Object> response = call.execute(); | |||||
| Object result = response.body(); | |||||
| System.out.println("result: " + result); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return ResponseEntity.ok().body("This is the test result!"); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,69 @@ | |||||
| package com.inspect.simulator.controller; | |||||
| import com.inspect.simulator.domain.result.upper.MessageBody; | |||||
| import com.inspect.simulator.domain.result.upper.MessageResult; | |||||
| import com.inspect.simulator.domain.result.upper.TokenParam; | |||||
| import com.inspect.simulator.domain.result.upper.TokenResult; | |||||
| import com.inspect.simulator.service.PatrolResultService; | |||||
| import com.inspect.simulator.utils.DateUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.http.ResponseEntity; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.Date; | |||||
| @RestController | |||||
| public class PatrolResultController { | |||||
| private final Logger log = LoggerFactory.getLogger(this.getClass()); | |||||
| private final PatrolResultService patrolResultService; | |||||
| public PatrolResultController(PatrolResultService patrolResultService) { | |||||
| this.patrolResultService = patrolResultService; | |||||
| } | |||||
| @GetMapping("/patrol/result/upper/getToken") | |||||
| public ResponseEntity<TokenResult> getUpperToken(TokenParam tokenParam) { | |||||
| TokenResult tokenResult = patrolResultService.getUpperToken(tokenParam); | |||||
| return ResponseEntity | |||||
| .ok() | |||||
| .body(tokenResult); | |||||
| } | |||||
| @PostMapping("/patrol/result/upper/messageNotify") | |||||
| public ResponseEntity<MessageResult> messageNotify( | |||||
| @RequestHeader(value = "token") String token, | |||||
| @RequestBody MessageBody messageBody) { | |||||
| log.info("messageNotify: token={}, messageBody={}", token, messageBody); | |||||
| MessageResult messageResult = patrolResultService.messageNotify(token, messageBody); | |||||
| return ResponseEntity | |||||
| .ok() | |||||
| .body(messageResult); | |||||
| } | |||||
| @PostMapping("/patrol/result/upper/send") | |||||
| public void sendPatrolResultToUpperSystem() { | |||||
| patrolResultService.sendPatrolResultToUpperSystem(); | |||||
| } | |||||
| //@Scheduled(cron = "*/6 * * * * ?") | |||||
| public void sayHello() { | |||||
| final long threadId = Thread.currentThread().getId(); | |||||
| final String execTime = DateUtils.format(DateUtils.yyyyMMddHHmmss2, new Date()); | |||||
| log.info("[{}] {} --------------hello------------------", threadId, execTime); | |||||
| int i = 0; | |||||
| while (i < 10000) { | |||||
| i++; | |||||
| try { | |||||
| Thread.sleep(1); | |||||
| } catch (InterruptedException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| log.info("[{}] {} --------------hello------------------ i: {}", threadId, execTime, i); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,60 @@ | |||||
| package com.inspect.simulator.domain; | |||||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||||
| import lombok.Setter; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| import java.util.HashMap; | |||||
| import java.util.Map; | |||||
| @Setter | |||||
| public class BaseEntity implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private String searchValue; | |||||
| private String createBy; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd HH:mm:ss" | |||||
| ) | |||||
| private Date createTime; | |||||
| private String updateBy; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd HH:mm:ss" | |||||
| ) | |||||
| private Date updateTime; | |||||
| private String remark; | |||||
| private Map<String, Object> params; | |||||
| public String getSearchValue() { | |||||
| return this.searchValue; | |||||
| } | |||||
| public String getCreateBy() { | |||||
| return this.createBy; | |||||
| } | |||||
| public Date getCreateTime() { | |||||
| return this.createTime; | |||||
| } | |||||
| public String getUpdateBy() { | |||||
| return this.updateBy; | |||||
| } | |||||
| public Date getUpdateTime() { | |||||
| return this.updateTime; | |||||
| } | |||||
| public String getRemark() { | |||||
| return this.remark; | |||||
| } | |||||
| public Map<String, Object> getParams() { | |||||
| if (this.params == null) { | |||||
| this.params = new HashMap(); | |||||
| } | |||||
| return this.params; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,35 @@ | |||||
| package com.inspect.simulator.domain.algorithm.in; | |||||
| public class AnalyseConstants { | |||||
| public static final String ANALYSE_FILTER_REQUEST = "ANALYSE_FILTER_REQUEST:"; | |||||
| public static final String ANALYSE_REQUEST_ALG = "ANALYSE_REQUEST_ALG:"; | |||||
| public static final String ANALYSE_TASK_REQUEST = "ANALYSE_TASK_REQUEST:"; | |||||
| public static final String ANALYSE_REQUEST_ID = "ANALYSE_REQUEST_ID:"; | |||||
| public static final String ANALYSE_OK = "2000"; | |||||
| public static final String ANALYSE_FAIL_NO_FILE = "2001"; | |||||
| public static final String ANALYSE_FAIL_ALG_EXCEPT = "2002"; | |||||
| public static final String ANALYSE_FAIL_FILE_EXCEPT = "2003"; | |||||
| public static final String ANALYSE_FAIL_FILE_INCOMPATIBLE = "2004"; | |||||
| public static final String ANALYSE_CODE = "code"; | |||||
| public static final String ANALYSE_UPPER_VALUE = "upperValue"; | |||||
| public static final String ANALYSE_LOWER_VALUE = "lowerValue"; | |||||
| public static final String ANALYSE_ALARM_THRESHOLD = "alarm_threshold"; | |||||
| public static final String ANALYSE_VALUE_ERROR = "1"; | |||||
| public static final String ANALYSE_SPLIT = "$analyse$"; | |||||
| public static final String POINT_STATUS_FAIL = "0"; | |||||
| public static final String POINT_STATUS_OK = "1"; | |||||
| public static final String POINT_STATUS_PERSON = "2"; | |||||
| public static final String RES_STATUS_UN = "0"; | |||||
| public static final String RES_STATUS_ED = "1"; | |||||
| public static final String RES_STATUS_NO = "2"; | |||||
| public static final String RESULT_TYPE_ALARM = "0"; | |||||
| public static final String RESULT_TYPE_RESULT = "1"; | |||||
| public static final String RESULT_TYPE_ERROR = "2"; | |||||
| public static final String TASK_PROGRESS_WAITING = "99.99"; | |||||
| public static final String TASK_PROGRESS_OK = "100"; | |||||
| public static final String ANALYSE_IS_FILTER = "ANALYSE_IS_FILTER"; | |||||
| public static final String ANALYSE_IS_METER_FILTER = "ANALYSE_IS_METER_FILTER"; | |||||
| public static final String ANALYSE_FILTER_URL = "ANALYSE_FILTER_URL"; | |||||
| public static final String ANALYSIS_BIG_URL = "ANALYSIS_BIG_URL"; | |||||
| public static final String MAX_NUM = "MAX_NUM"; | |||||
| } | |||||
| @ -0,0 +1,50 @@ | |||||
| package com.inspect.simulator.domain.algorithm.in; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import java.io.Serializable; | |||||
| import java.util.Arrays; | |||||
| import java.util.Objects; | |||||
| @Setter | |||||
| @Getter | |||||
| public class AnalyseReqItem implements Serializable { | |||||
| private String objectId; | |||||
| private String imageNormalUrlPath; | |||||
| private String[] typeList; | |||||
| private String[] imageUrlList; | |||||
| public AnalyseReqItem clone() { | |||||
| return JSONObject.parseObject(JSONObject.toJSONString(this), AnalyseReqItem.class); | |||||
| } | |||||
| public String toResultValue(String type) { | |||||
| return this.objectId + AnalyseConstants.ANALYSE_SPLIT + type; | |||||
| } | |||||
| @Override | |||||
| public boolean equals(Object object) { | |||||
| if (this == object) return true; | |||||
| if (object == null || getClass() != object.getClass()) return false; | |||||
| AnalyseReqItem that = (AnalyseReqItem) object; | |||||
| return Objects.equals(objectId, that.objectId) && Objects.equals(imageNormalUrlPath, that.imageNormalUrlPath) && Objects.deepEquals(typeList, that.typeList) && Objects.deepEquals(imageUrlList, that.imageUrlList); | |||||
| } | |||||
| @Override | |||||
| public int hashCode() { | |||||
| return Objects.hash(objectId, imageNormalUrlPath, Arrays.hashCode(typeList), Arrays.hashCode(imageUrlList)); | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return "AnalyseReqItem{" + | |||||
| "objectId='" + objectId + '\'' + | |||||
| ", imageNormalUrlPath='" + imageNormalUrlPath + '\'' + | |||||
| ", typeList=" + Arrays.toString(typeList) + | |||||
| ", imageUrlList=" + Arrays.toString(imageUrlList) + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,72 @@ | |||||
| package com.inspect.simulator.domain.algorithm.in; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.inspect.simulator.domain.algorithm.out.AnalyseResItem; | |||||
| import com.inspect.simulator.domain.algorithm.out.AnalyseResPoint; | |||||
| import com.inspect.simulator.domain.algorithm.out.AnalyseResult; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import java.io.Serializable; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| import java.util.Objects; | |||||
| @Setter | |||||
| @Getter | |||||
| public class AnalyseRequest implements Serializable { | |||||
| private List<AnalyseReqItem> objectList; | |||||
| private String requestHostIp; | |||||
| private String requestHostPort; | |||||
| private String requestId; | |||||
| private String algorithmPath; | |||||
| private String taskPatrolId; | |||||
| public AnalyseRequest clone() { | |||||
| return JSONObject.parseObject(JSONObject.toJSONString(this), AnalyseRequest.class); | |||||
| } | |||||
| public String toErrorResultStr() { | |||||
| AnalyseResult analyseResult = new AnalyseResult(); | |||||
| analyseResult.setRequestId(this.requestId); | |||||
| List<AnalyseResItem> list = new ArrayList<>(); | |||||
| analyseResult.setResultsList(list); | |||||
| for (AnalyseReqItem analyseReqItem : this.objectList) { | |||||
| AnalyseResItem analyseResItem = new AnalyseResItem(); | |||||
| list.add(analyseResItem); | |||||
| analyseResItem.setObjectId(analyseReqItem.getObjectId()); | |||||
| List<AnalyseResPoint> results = new ArrayList<>(); | |||||
| analyseResItem.setResults(results); | |||||
| for (String type : analyseReqItem.getTypeList()) { | |||||
| AnalyseResPoint analyseResPoint = new AnalyseResPoint(); | |||||
| analyseResPoint.setCode("2002"); | |||||
| analyseResPoint.setType(type); | |||||
| analyseResPoint.setDesc("调用分析失败"); | |||||
| analyseResPoint.setResImageUrl(analyseReqItem.getImageUrlList()[0]); | |||||
| analyseResPoint.setValue("-1"); | |||||
| results.add(analyseResPoint); | |||||
| } | |||||
| } | |||||
| return JSONObject.toJSONString(analyseResult); | |||||
| } | |||||
| public String toString() { | |||||
| return JSONObject.toJSONString(this); | |||||
| } | |||||
| @Override | |||||
| public boolean equals(Object object) { | |||||
| if (this == object) return true; | |||||
| if (object == null || getClass() != object.getClass()) return false; | |||||
| AnalyseRequest that = (AnalyseRequest) object; | |||||
| return Objects.equals(objectList, that.objectList) && Objects.equals(requestHostIp, that.requestHostIp) && Objects.equals(requestHostPort, that.requestHostPort) && Objects.equals(requestId, that.requestId) && Objects.equals(algorithmPath, that.algorithmPath) && Objects.equals(taskPatrolId, that.taskPatrolId); | |||||
| } | |||||
| @Override | |||||
| public int hashCode() { | |||||
| return Objects.hash(objectList, requestHostIp, requestHostPort, requestId, algorithmPath, taskPatrolId); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,42 @@ | |||||
| package com.inspect.simulator.domain.algorithm.out; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import java.io.Serializable; | |||||
| import java.util.List; | |||||
| import java.util.Objects; | |||||
| @Setter | |||||
| @Getter | |||||
| public class AnalyseResItem implements Serializable { | |||||
| private String objectId; | |||||
| private String algFactory; | |||||
| private List<AnalyseResPoint> results; | |||||
| public AnalyseResItem clone() { | |||||
| return JSONObject.parseObject(JSONObject.toJSONString(this), AnalyseResItem.class); | |||||
| } | |||||
| @Override | |||||
| public boolean equals(Object object) { | |||||
| if (this == object) return true; | |||||
| if (object == null || getClass() != object.getClass()) return false; | |||||
| AnalyseResItem that = (AnalyseResItem) object; | |||||
| return Objects.equals(objectId, that.objectId) && Objects.equals(results, that.results); | |||||
| } | |||||
| @Override | |||||
| public int hashCode() { | |||||
| return Objects.hash(objectId, results); | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return "AnalyseResItem{" + | |||||
| "objectId='" + objectId + '\'' + | |||||
| ", results=" + results + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,119 @@ | |||||
| package com.inspect.simulator.domain.algorithm.out; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.inspect.simulator.domain.algorithm.in.AnalyseConstants; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import java.io.Serializable; | |||||
| import java.util.List; | |||||
| import java.util.Objects; | |||||
| public class AnalyseResPoint implements Serializable { | |||||
| private String type; | |||||
| private String Value; | |||||
| private String value; | |||||
| private String code; | |||||
| private String resImageUrl; | |||||
| private String imageNormalUrlPath; | |||||
| private String conf; | |||||
| private String desc; | |||||
| private List<Pos> pos; | |||||
| public boolean checkSuccess() { | |||||
| return "2000".equals(this.code) && "1".equals(this.value); | |||||
| } | |||||
| public String toString() { | |||||
| return JSONObject.toJSONString(this); | |||||
| } | |||||
| public void setValue(String value) { | |||||
| this.value = value; | |||||
| if (!StringUtils.isEmpty(value)) { | |||||
| this.Value = value; | |||||
| } | |||||
| } | |||||
| public String toResultValue(String objectId) { | |||||
| return objectId + AnalyseConstants.ANALYSE_SPLIT + this.type; | |||||
| } | |||||
| public AnalyseResPoint clone() { | |||||
| return JSONObject.parseObject(JSONObject.toJSONString(this), AnalyseResPoint.class); | |||||
| } | |||||
| public String getType() { | |||||
| return this.type; | |||||
| } | |||||
| public String getValue() { | |||||
| return this.Value; | |||||
| } | |||||
| public String getCode() { | |||||
| return this.code; | |||||
| } | |||||
| public String getResImageUrl() { | |||||
| return this.resImageUrl; | |||||
| } | |||||
| public String getImageNormalUrlPath() { | |||||
| return this.imageNormalUrlPath; | |||||
| } | |||||
| public String getConf() { | |||||
| return this.conf; | |||||
| } | |||||
| public String getDesc() { | |||||
| return this.desc; | |||||
| } | |||||
| public List<Pos> getPos() { | |||||
| return this.pos; | |||||
| } | |||||
| public void setType(String type) { | |||||
| this.type = type; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| public void setResImageUrl(String resImageUrl) { | |||||
| this.resImageUrl = resImageUrl; | |||||
| } | |||||
| public void setImageNormalUrlPath(String imageNormalUrlPath) { | |||||
| this.imageNormalUrlPath = imageNormalUrlPath; | |||||
| } | |||||
| public void setConf(String conf) { | |||||
| this.conf = conf; | |||||
| } | |||||
| public void setDesc(String desc) { | |||||
| this.desc = desc; | |||||
| } | |||||
| public void setPos(List<Pos> pos) { | |||||
| this.pos = pos; | |||||
| } | |||||
| @Override | |||||
| public boolean equals(Object object) { | |||||
| if (this == object) return true; | |||||
| if (object == null || getClass() != object.getClass()) return false; | |||||
| AnalyseResPoint that = (AnalyseResPoint) object; | |||||
| return Objects.equals(type, that.type) && Objects.equals(Value, that.Value) && Objects.equals(value, that.value) && Objects.equals(code, that.code) && Objects.equals(resImageUrl, that.resImageUrl) && Objects.equals(imageNormalUrlPath, that.imageNormalUrlPath) && Objects.equals(conf, that.conf) && Objects.equals(desc, that.desc) && Objects.equals(pos, that.pos); | |||||
| } | |||||
| @Override | |||||
| public int hashCode() { | |||||
| return Objects.hash(type, Value, value, code, resImageUrl, imageNormalUrlPath, conf, desc, pos); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,95 @@ | |||||
| package com.inspect.simulator.domain.algorithm.out; | |||||
| import com.inspect.simulator.domain.algorithm.in.AnalyseReqItem; | |||||
| import com.inspect.simulator.domain.algorithm.in.AnalyseRequest; | |||||
| import lombok.Getter; | |||||
| import java.io.Serializable; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| import java.util.Objects; | |||||
| @Getter | |||||
| public class AnalyseResult implements Serializable { | |||||
| private String requestId; | |||||
| private List<AnalyseResItem> resultList; | |||||
| private List<AnalyseResItem> resultsList; | |||||
| private String taskPatrolId; | |||||
| private String filter = "0"; | |||||
| private String result = "1"; | |||||
| public void setResultsList(List<AnalyseResItem> resultsList) { | |||||
| this.resultsList = resultsList; | |||||
| if (resultsList != null) { | |||||
| this.resultList = resultsList; | |||||
| } | |||||
| } | |||||
| public void reloadReq(AnalyseRequest analyseRequest) { | |||||
| AnalyseResItem analyseResItem = this.resultList.get(0); | |||||
| List<AnalyseResItem> resultList = new ArrayList<>(); | |||||
| this.setResultsList(resultList); | |||||
| for (int i = 0; i < analyseRequest.getObjectList().size(); ++i) { | |||||
| AnalyseResItem resItem = analyseResItem.clone(); | |||||
| resultList.add(resItem); | |||||
| AnalyseReqItem analyseReqItem = analyseRequest.getObjectList().get(i); | |||||
| AnalyseResPoint resPoint = analyseResItem.getResults().get(0); | |||||
| List<AnalyseResPoint> results = new ArrayList<>(); | |||||
| resItem.setResults(results); | |||||
| for (String type : analyseReqItem.getTypeList()) { | |||||
| AnalyseResPoint clone = resPoint.clone(); | |||||
| clone.setType(type); | |||||
| results.add(clone); | |||||
| } | |||||
| } | |||||
| } | |||||
| public void setRequestId(String requestId) { | |||||
| this.requestId = requestId; | |||||
| } | |||||
| public void setResultList(List<AnalyseResItem> resultList) { | |||||
| this.resultList = resultList; | |||||
| } | |||||
| public void setTaskPatrolId(String taskPatrolId) { | |||||
| this.taskPatrolId = taskPatrolId; | |||||
| } | |||||
| public void setFilter(String filter) { | |||||
| this.filter = filter; | |||||
| } | |||||
| public void setResult(String result) { | |||||
| this.result = result; | |||||
| } | |||||
| @Override | |||||
| public boolean equals(Object object) { | |||||
| if (this == object) return true; | |||||
| if (object == null || getClass() != object.getClass()) return false; | |||||
| AnalyseResult that = (AnalyseResult) object; | |||||
| return Objects.equals(requestId, that.requestId) && Objects.equals(resultList, that.resultList) && Objects.equals(resultsList, that.resultsList) && Objects.equals(taskPatrolId, that.taskPatrolId) && Objects.equals(filter, that.filter) && Objects.equals(result, that.result); | |||||
| } | |||||
| @Override | |||||
| public int hashCode() { | |||||
| return Objects.hash(requestId, resultList, resultsList, taskPatrolId, filter, result); | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return "AnalyseResult{" + | |||||
| "requestId='" + requestId + '\'' + | |||||
| ", resultList=" + resultList + | |||||
| ", resultsList=" + resultsList + | |||||
| ", taskPatrolId='" + taskPatrolId + '\'' + | |||||
| ", filter='" + filter + '\'' + | |||||
| ", result='" + result + '\'' + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,11 @@ | |||||
| package com.inspect.simulator.domain.algorithm.out; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| @Setter | |||||
| @Getter | |||||
| public class Pos { | |||||
| private String[] areas; | |||||
| } | |||||
| @ -0,0 +1,19 @@ | |||||
| package com.inspect.simulator.domain.analysis.vi; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import lombok.experimental.SuperBuilder; | |||||
| import java.util.List; | |||||
| @Data | |||||
| @SuperBuilder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class AnalysisObject { | |||||
| private String objectId; | |||||
| private String imageNormalUrlPath; | |||||
| private List<String> typeList; | |||||
| private List<String> imageUrlList; | |||||
| } | |||||
| @ -0,0 +1,20 @@ | |||||
| package com.inspect.simulator.domain.analysis.vi; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import lombok.experimental.SuperBuilder; | |||||
| import java.util.List; | |||||
| @Data | |||||
| @SuperBuilder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class AnalysisRequest { | |||||
| private String requestId; | |||||
| private String taskPatrolId; | |||||
| private String requestHostIp; | |||||
| private String requestHostPort; | |||||
| private List<AnalysisObject> objectList; | |||||
| } | |||||
| @ -0,0 +1,23 @@ | |||||
| package com.inspect.simulator.domain.analysis.vo; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import lombok.experimental.SuperBuilder; | |||||
| import java.io.Serializable; | |||||
| import java.util.List; | |||||
| @Data | |||||
| @SuperBuilder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class AnalysisResult implements Serializable { | |||||
| private String code; | |||||
| private List<String> pos; | |||||
| private String resImageUrl; | |||||
| private Double conf; | |||||
| private String type; | |||||
| private String value; | |||||
| private String desc; | |||||
| } | |||||
| @ -0,0 +1,18 @@ | |||||
| package com.inspect.simulator.domain.analysis.vo; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import lombok.experimental.SuperBuilder; | |||||
| import java.io.Serializable; | |||||
| import java.util.List; | |||||
| @Data | |||||
| @SuperBuilder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class AnalysisResultEntity implements Serializable { | |||||
| private String requestId; | |||||
| private List<AnalysisResultList> resultList; | |||||
| } | |||||
| @ -0,0 +1,19 @@ | |||||
| package com.inspect.simulator.domain.analysis.vo; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import lombok.experimental.SuperBuilder; | |||||
| import java.io.Serializable; | |||||
| import java.util.List; | |||||
| @Data | |||||
| @SuperBuilder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class AnalysisResultList implements Serializable { | |||||
| private String algFactory; | |||||
| private String objectId; | |||||
| private List<AnalysisResult> results; | |||||
| } | |||||
| @ -0,0 +1,54 @@ | |||||
| package com.inspect.simulator.domain.file; | |||||
| import java.io.Serializable; | |||||
| public class FileReturn<T> implements Serializable { | |||||
| private static final long serialVersionUID = -1959544190118740608L; | |||||
| private int resultCode; | |||||
| private String msg; | |||||
| private T data; | |||||
| public FileReturn() { | |||||
| } | |||||
| public FileReturn(int resultCode, String msg, T data) { | |||||
| this.resultCode = resultCode; | |||||
| this.msg = msg; | |||||
| this.data = data; | |||||
| } | |||||
| public int getResultCode() { | |||||
| return resultCode; | |||||
| } | |||||
| public void setResultCode(int resultCode) { | |||||
| this.resultCode = resultCode; | |||||
| } | |||||
| public String getMsg() { | |||||
| return msg; | |||||
| } | |||||
| public void setMsg(String msg) { | |||||
| this.msg = msg; | |||||
| } | |||||
| public T getData() { | |||||
| return data; | |||||
| } | |||||
| public void setData(T data) { | |||||
| this.data = data; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return "FileReturn{" + | |||||
| "resultCode=" + resultCode + | |||||
| ", msg='" + msg + '\'' + | |||||
| ", data=" + data + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,16 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class IndexRange { | |||||
| private int fromIndex; | |||||
| private int toIndex; | |||||
| } | |||||
| @ -0,0 +1,18 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import java.io.Serializable; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class IvsChanSnapVo implements Serializable { | |||||
| private String taskID; | |||||
| private String cameraCode; | |||||
| private String domainCode; | |||||
| } | |||||
| @ -0,0 +1,28 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import java.io.Serializable; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class IvsDevChanListVo implements Serializable { | |||||
| private String serial; | |||||
| private String code; | |||||
| private String civilcode; | |||||
| private String block; | |||||
| private String channel_type; | |||||
| private String dir_serial; | |||||
| private String start; | |||||
| private String limit; | |||||
| private String q; | |||||
| private String online; | |||||
| private int deviceType = 35; | |||||
| private int fromIndex = 1; | |||||
| private int toIndex = 10000; | |||||
| } | |||||
| @ -0,0 +1,20 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import lombok.ToString; | |||||
| import lombok.experimental.SuperBuilder; | |||||
| @Data | |||||
| @SuperBuilder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| @ToString(callSuper = true) | |||||
| public class IvsDevChanSnapVo extends IvsVo { | |||||
| private String serial; | |||||
| private String channel; | |||||
| private boolean realtime; | |||||
| private boolean check_outputs; | |||||
| private boolean timeout; | |||||
| } | |||||
| @ -0,0 +1,38 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import java.io.Serializable; | |||||
| import java.util.List; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class IvsPresetListView implements Serializable { | |||||
| private int resultCode; | |||||
| private int ptzPresetNum; | |||||
| private PtzPresetInfoList ptzPresetInfoList; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public static class PtzPresetInfo implements Serializable { | |||||
| private int presetIndex; | |||||
| private String presetName; | |||||
| private String reserve; | |||||
| private int focusSwitch; | |||||
| } | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public static class PtzPresetInfoList implements Serializable { | |||||
| private List<PtzPresetInfo> ptzPresetInfo; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,30 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import java.io.Serializable; | |||||
| import java.util.Objects; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class IvsResult implements Serializable { | |||||
| private String resultCode; | |||||
| @Override | |||||
| public boolean equals(Object o) { | |||||
| if (this == o) return true; | |||||
| if (o == null || getClass() != o.getClass()) return false; | |||||
| IvsResult ivsResult = (IvsResult) o; | |||||
| return Objects.equals(resultCode, ivsResult.resultCode); | |||||
| } | |||||
| @Override | |||||
| public int hashCode() { | |||||
| return Objects.hashCode(resultCode); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,16 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import lombok.experimental.SuperBuilder; | |||||
| import java.io.Serializable; | |||||
| @Data | |||||
| @SuperBuilder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class IvsSnapshotView implements Serializable { | |||||
| private String taskID; | |||||
| } | |||||
| @ -0,0 +1,23 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import java.io.Serializable; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class IvsVideoRtspView implements Serializable { | |||||
| private String resultCode; | |||||
| private String url; | |||||
| private String rtspURL; | |||||
| private String flvURL; | |||||
| private String webrtcURL; | |||||
| private String downloadURL; | |||||
| private String hlsURL; | |||||
| private String mp4URL; | |||||
| } | |||||
| @ -0,0 +1,46 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import com.inspect.simulator.view.IvsRecordListView; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import java.io.Serializable; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class IvsVideoRtspVo implements Serializable { | |||||
| private String cameraCode; | |||||
| private RealMediaURLParam mediaURLParam; | |||||
| public static IvsVideoRtspVo realStream(String cameraCode) { | |||||
| IvsVideoRtspVo ivsVideoRtspVo = new IvsVideoRtspVo(); | |||||
| ivsVideoRtspVo.mediaURLParam = new RealMediaURLParam(); | |||||
| ivsVideoRtspVo.cameraCode = cameraCode; | |||||
| return ivsVideoRtspVo; | |||||
| } | |||||
| public static IvsVideoRtspVo playbackStream(SipbStartRecordVo sipbStartRecordVo) { | |||||
| IvsVideoRtspVo ivsVideoRtspVo = new IvsVideoRtspVo(); | |||||
| ivsVideoRtspVo.mediaURLParam = new RealMediaURLParam(); | |||||
| ivsVideoRtspVo.mediaURLParam.setServiceType(8); | |||||
| ivsVideoRtspVo.cameraCode = sipbStartRecordVo.getCameraCode(); | |||||
| ivsVideoRtspVo.mediaURLParam.setTimeSpan(new TimeSpan(sipbStartRecordVo.getBeginTime(), sipbStartRecordVo.getEndTime())); | |||||
| ivsVideoRtspVo.mediaURLParam.setFileName(sipbStartRecordVo.getRecordFileName()); | |||||
| return ivsVideoRtspVo; | |||||
| } | |||||
| public static IvsVideoRtspVo download(String cameraCode, IvsRecordListView.RecordInfo recordInfo) { | |||||
| IvsVideoRtspVo ivsVideoRtspVo = new IvsVideoRtspVo(); | |||||
| ivsVideoRtspVo.cameraCode = cameraCode; | |||||
| RecordMediaURLParam recordMediaURLParam = new RecordMediaURLParam(); | |||||
| ivsVideoRtspVo.mediaURLParam = recordMediaURLParam; | |||||
| recordMediaURLParam.setNvrCode(recordInfo.getNvrCode()); | |||||
| recordMediaURLParam.setTimeSpan(recordInfo.getRecordTime()); | |||||
| recordMediaURLParam.setServiceType(3); | |||||
| return ivsVideoRtspVo; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,20 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import lombok.experimental.SuperBuilder; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import java.io.Serializable; | |||||
| @Data | |||||
| @SuperBuilder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class IvsVo implements Serializable { | |||||
| private static final long serialVersionUID = -6922254609485688648L; | |||||
| private String code; | |||||
| private String cameraCode; | |||||
| private String domainCode; | |||||
| } | |||||
| @ -0,0 +1,18 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import com.fasterxml.jackson.annotation.JsonProperty; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class Login { | |||||
| @JsonProperty("userName") | |||||
| private String username; | |||||
| private String password; | |||||
| } | |||||
| @ -0,0 +1,97 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import java.io.Serializable; | |||||
| //@Data | |||||
| //@Builder | |||||
| //@NoArgsConstructor | |||||
| //@AllArgsConstructor | |||||
| public class RealMediaURLParam implements Serializable { | |||||
| private int serviceType = 1; | |||||
| private int packProtocolType = 1; | |||||
| private int streamType = 1; | |||||
| private int protocolType = 2; | |||||
| private int transMode = 1; | |||||
| private int broadCastType = 0; | |||||
| private int clientType = 1; | |||||
| private TimeSpan timeSpan; | |||||
| private String fileName; | |||||
| public int getServiceType() { | |||||
| return serviceType; | |||||
| } | |||||
| public void setServiceType(int serviceType) { | |||||
| this.serviceType = serviceType; | |||||
| } | |||||
| public int getPackProtocolType() { | |||||
| return packProtocolType; | |||||
| } | |||||
| public void setPackProtocolType(int packProtocolType) { | |||||
| this.packProtocolType = packProtocolType; | |||||
| } | |||||
| public int getStreamType() { | |||||
| return streamType; | |||||
| } | |||||
| public void setStreamType(int streamType) { | |||||
| this.streamType = streamType; | |||||
| } | |||||
| public int getProtocolType() { | |||||
| return protocolType; | |||||
| } | |||||
| public void setProtocolType(int protocolType) { | |||||
| this.protocolType = protocolType; | |||||
| } | |||||
| public int getTransMode() { | |||||
| return transMode; | |||||
| } | |||||
| public void setTransMode(int transMode) { | |||||
| this.transMode = transMode; | |||||
| } | |||||
| public int getBroadCastType() { | |||||
| return broadCastType; | |||||
| } | |||||
| public void setBroadCastType(int broadCastType) { | |||||
| this.broadCastType = broadCastType; | |||||
| } | |||||
| public int getClientType() { | |||||
| return clientType; | |||||
| } | |||||
| public void setClientType(int clientType) { | |||||
| this.clientType = clientType; | |||||
| } | |||||
| public TimeSpan getTimeSpan() { | |||||
| return timeSpan; | |||||
| } | |||||
| public void setTimeSpan(TimeSpan timeSpan) { | |||||
| this.timeSpan = timeSpan; | |||||
| } | |||||
| public String getFileName() { | |||||
| return fileName; | |||||
| } | |||||
| public void setFileName(String fileName) { | |||||
| this.fileName = fileName; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,17 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class RecordMediaURLParam extends RealMediaURLParam { | |||||
| private TimeSpan timeSpan = new TimeSpan(); | |||||
| private String dstIP; | |||||
| private String nvrCode; | |||||
| private String fileName; | |||||
| } | |||||
| @ -0,0 +1,15 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class ResultEntity<T> { | |||||
| private String resultCode; | |||||
| private T resultBody; | |||||
| } | |||||
| @ -0,0 +1,25 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import java.io.Serializable; | |||||
| import java.util.HashMap; | |||||
| import java.util.Map; | |||||
| public class SipbAndIvsConvert implements Serializable { | |||||
| public static final String SPEED_DEFAULT = "1"; | |||||
| public static final String CONTINUITY_DEFAULT = "1"; | |||||
| public static final String CONTINUITY_CONTINUE = "2"; | |||||
| private static final String[] ptz = new String[]{"stop,PTZ_STOP,1", "upstop,PTZ_STOP,1", "downstop,PTZ_STOP,1", "rightstop,PTZ_STOP,1", "leftstop,PTZ_STOP,1", "upleftstop,PTZ_STOP,1", "downleftstop,PTZ_STOP,1", "uprightstop,PTZ_STOP,1", "downrightstop,PTZ_STOP,1", "up,PTZ_UP,2", "down,PTZ_DOWN,3", "left,PTZ_LEFT,4", "upleft,PTZ_UP_LEFT,5", "downleft,PTZ_DOWN_LEFT,6", "right,PTZ_RIGHT,7", "upright,PTZ_UP_RIGHT,8", "downright,PTZ_DOWN_RIGHT,9", "auto,PTZ_AUTO,10", "setpreset,PTZ_PREFAB_BIT_RUN,11", "x,PTZ_CRUISE_RUN,12", "x,PTZ_CRUISE_STOP,13", "x,PTZ_MODE_CRUISE_RUN,14", "x,PTZ_MODE_CRUISE_STOP,15", "x,PTZ_MENU_OPEN,16", "x,PTZ_MENU_EXIT,17", "x,PTZ_MENU_ENTER,18", "x,PTZ_FLIP,19", "x,PTZ_START,20", "apertureonstop,PTZ_STOP,1", "apertureon,PTZ_LENS_APERTURE_OPEN,21", "apertureoffstop,PTZ_STOP,1", "apertureoff,PTZ_LENS_APERTURE_CLOSE,22", "zoominstop,PTZ_STOP,1", "zoomin,PTZ_LENS_ZOOM_IN,23", "zoomoutstop,PTZ_STOP,1", "zoomout,PTZ_LENS_ZOOM_OUT,24", "nearfocusstop,PTZ_STOP,1", "nearfocus,PTZ_LENS_FOCAL_NEAR,25", "farfocusstop,PTZ_STOP,1", "farfocus,PTZ_LENS_FOCAL_FAR,26", "x,PTZ_AUX_OPEN,27", "x,PTZ_AUX_STOP,28", "x,MODE_SET_START,29", "x,MODE_SET_STOP,30", "x,PTZ_FAST_LOCATE,31", "x,PTZ_HORIZONTAL_SCAN,32", "x,PTZ_VERTICAL_SCAN,33", "x,PTZ_LOCK,34", "x,PTZ_UNLOCK,35", "x,PTZ_ABSOLUTE_MOVE,36", "x,PTZ_DIRECTION_MOVE,37"}; | |||||
| public static final Map<String, String> map = new HashMap(); | |||||
| static { | |||||
| String[] var0 = ptz; | |||||
| int var1 = var0.length; | |||||
| for(int var2 = 0; var2 < var1; ++var2) { | |||||
| String str = var0[var2]; | |||||
| String[] split = str.split(","); | |||||
| map.put(split[0], split[2]); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,25 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import java.io.Serializable; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class SipbPtzVo implements Serializable { | |||||
| private String serial; | |||||
| private String channel; | |||||
| private String code; | |||||
| private String command; | |||||
| private String speed; | |||||
| private String portraitspeed; | |||||
| private String cameraCode; | |||||
| private String controlCode; | |||||
| private String controlPara1 = "1"; | |||||
| private String controlPara2 = "1"; | |||||
| } | |||||
| @ -0,0 +1,150 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import com.inspect.simulator.utils.TimeUtils; | |||||
| import java.io.Serializable; | |||||
| public class SipbStartRecordVo implements Serializable { | |||||
| private String serial; | |||||
| private String filepath; | |||||
| private String starttime; | |||||
| private String code; | |||||
| private String fileName; | |||||
| private String cameraCode; | |||||
| private String cameraId; | |||||
| private String recordFileName; | |||||
| private String beginTime; | |||||
| private String endTime; | |||||
| private String streamType = "1"; | |||||
| private String urlType = "4"; | |||||
| private String recordMethod = "1"; | |||||
| private String agentType = "1"; | |||||
| private String templetId = "100001"; | |||||
| public void setFilepath(String filepath) { | |||||
| this.filepath = filepath; | |||||
| String[] split = filepath.split("@"); | |||||
| this.cameraId = split[0]; | |||||
| this.recordFileName = split[1]; | |||||
| this.cameraCode = this.cameraId; | |||||
| } | |||||
| public void setStarttime(String starttime) { | |||||
| this.starttime = starttime; | |||||
| this.beginTime = TimeUtils.toIvs(starttime); | |||||
| } | |||||
| public void setEndTime(String endTime) { | |||||
| this.endTime = TimeUtils.toIvs(endTime); | |||||
| } | |||||
| public String getSerial() { | |||||
| return this.serial; | |||||
| } | |||||
| public String getFilepath() { | |||||
| return this.filepath; | |||||
| } | |||||
| public String getStarttime() { | |||||
| return this.starttime; | |||||
| } | |||||
| public String getCode() { | |||||
| return this.code; | |||||
| } | |||||
| public String getFileName() { | |||||
| return this.fileName; | |||||
| } | |||||
| public String getCameraCode() { | |||||
| return this.cameraCode; | |||||
| } | |||||
| public String getCameraId() { | |||||
| return this.cameraId; | |||||
| } | |||||
| public String getRecordFileName() { | |||||
| return this.recordFileName; | |||||
| } | |||||
| public String getBeginTime() { | |||||
| return this.beginTime; | |||||
| } | |||||
| public String getEndTime() { | |||||
| return this.endTime; | |||||
| } | |||||
| public String getStreamType() { | |||||
| return this.streamType; | |||||
| } | |||||
| public String getUrlType() { | |||||
| return this.urlType; | |||||
| } | |||||
| public String getRecordMethod() { | |||||
| return this.recordMethod; | |||||
| } | |||||
| public String getAgentType() { | |||||
| return this.agentType; | |||||
| } | |||||
| public String getTempletId() { | |||||
| return this.templetId; | |||||
| } | |||||
| public void setSerial(String serial) { | |||||
| this.serial = serial; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| public void setFileName(String fileName) { | |||||
| this.fileName = fileName; | |||||
| } | |||||
| public void setCameraCode(String cameraCode) { | |||||
| this.cameraCode = cameraCode; | |||||
| } | |||||
| public void setCameraId(String cameraId) { | |||||
| this.cameraId = cameraId; | |||||
| } | |||||
| public void setRecordFileName(String recordFileName) { | |||||
| this.recordFileName = recordFileName; | |||||
| } | |||||
| public void setBeginTime(String beginTime) { | |||||
| this.beginTime = beginTime; | |||||
| } | |||||
| public void setStreamType(String streamType) { | |||||
| this.streamType = streamType; | |||||
| } | |||||
| public void setUrlType(String urlType) { | |||||
| this.urlType = urlType; | |||||
| } | |||||
| public void setRecordMethod(String recordMethod) { | |||||
| this.recordMethod = recordMethod; | |||||
| } | |||||
| public void setAgentType(String agentType) { | |||||
| this.agentType = agentType; | |||||
| } | |||||
| public void setTempletId(String templetId) { | |||||
| this.templetId = templetId; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,18 @@ | |||||
| package com.inspect.simulator.domain.ivs; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import java.io.Serializable; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class TimeSpan implements Serializable { | |||||
| private String startTime; | |||||
| private String endTime; | |||||
| } | |||||
| @ -0,0 +1,13 @@ | |||||
| package com.inspect.simulator.domain.result; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| @Setter | |||||
| @Getter | |||||
| public class AlgInfo { | |||||
| private String algSubtypeName; | |||||
| private String algSubtypeCode; | |||||
| private String algName; | |||||
| } | |||||
| @ -0,0 +1,42 @@ | |||||
| package com.inspect.simulator.domain.result; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import java.util.Objects; | |||||
| @Setter | |||||
| @Getter | |||||
| public class BasePointAreaInfo { | |||||
| private String patrolPointId; | |||||
| private String patrolPointName; | |||||
| private String deviceName; | |||||
| private String mainName; | |||||
| private String jgName; | |||||
| private String areaName; | |||||
| @Override | |||||
| public boolean equals(Object object) { | |||||
| if (this == object) return true; | |||||
| if (object == null || getClass() != object.getClass()) return false; | |||||
| BasePointAreaInfo that = (BasePointAreaInfo) object; | |||||
| return Objects.equals(patrolPointId, that.patrolPointId) && Objects.equals(patrolPointName, that.patrolPointName) && Objects.equals(deviceName, that.deviceName) && Objects.equals(mainName, that.mainName) && Objects.equals(jgName, that.jgName) && Objects.equals(areaName, that.areaName); | |||||
| } | |||||
| @Override | |||||
| public int hashCode() { | |||||
| return Objects.hash(patrolPointId, patrolPointName, deviceName, mainName, jgName, areaName); | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return "BasePointAreaInfo{" + | |||||
| "patrolPointId='" + patrolPointId + '\'' + | |||||
| ", patrolPointName='" + patrolPointName + '\'' + | |||||
| ", deviceName='" + deviceName + '\'' + | |||||
| ", mainName='" + mainName + '\'' + | |||||
| ", jgName='" + jgName + '\'' + | |||||
| ", areaName='" + areaName + '\'' + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,72 @@ | |||||
| package com.inspect.simulator.domain.result; | |||||
| import com.inspect.simulator.domain.BaseEntity; | |||||
| import lombok.*; | |||||
| import java.util.List; | |||||
| @Getter | |||||
| @Setter | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class BasedataEqpBookMoMain extends BaseEntity { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long eqpBookId; | |||||
| private String stationName; | |||||
| private String stationCode; | |||||
| private Long areaId; | |||||
| private String areaName; | |||||
| private String patrolDeviceName; | |||||
| private String patrolDeviceCode; | |||||
| private String deviceModel; | |||||
| private String manufacturer; | |||||
| private String useUnit; | |||||
| private String deviceSource; | |||||
| private String productionDate; | |||||
| private String productionCode; | |||||
| private String isTransport; | |||||
| private String useMode; | |||||
| private String videoMode; | |||||
| private String place; | |||||
| private String positionX; | |||||
| private String positionY; | |||||
| private String positionZ; | |||||
| private String type; | |||||
| private String patrolDeviceInfo; | |||||
| private String robotsCode; | |||||
| private String ipAddr; | |||||
| private String port; | |||||
| private String user; | |||||
| private String password; | |||||
| private String mainSystemCode; | |||||
| private String delFlag; | |||||
| private List<String> algId; | |||||
| private List<PatrolTaskDomain> patrolTaskList; | |||||
| } | |||||
| @ -0,0 +1,20 @@ | |||||
| package com.inspect.simulator.domain.result; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| @Setter | |||||
| @Getter | |||||
| public class PatrolData { | |||||
| private String lineId; | |||||
| private String pointName; | |||||
| private String patrolTime; | |||||
| private String pointStatus; | |||||
| private String warnStatus; | |||||
| private String desc; | |||||
| private String img; | |||||
| private String imgType; | |||||
| private String imgAnalyse; | |||||
| private String dataType; | |||||
| } | |||||
| @ -0,0 +1,65 @@ | |||||
| package com.inspect.simulator.domain.result; | |||||
| import com.inspect.simulator.domain.BaseEntity; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import org.apache.commons.lang3.builder.ToStringBuilder; | |||||
| import org.apache.commons.lang3.builder.ToStringStyle; | |||||
| @Setter | |||||
| @Getter | |||||
| public class PatrolPresetPosModule extends BaseEntity { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long presetPosId; | |||||
| private String presetPosCode; | |||||
| private String presetPosName; | |||||
| private Long eqpBookId; | |||||
| private String patrolDeviceCode; | |||||
| private Long patrolPointId; | |||||
| private Long channelId; | |||||
| private String channelCode; | |||||
| private String channelType; | |||||
| private String coordinateType; | |||||
| private Long stopTime; | |||||
| private String channelImg; | |||||
| private String description; | |||||
| private String algSubtypeCode; | |||||
| private String isEnable; | |||||
| private String algName; | |||||
| @Override | |||||
| public String toString() { | |||||
| return "PatrolPresetPosModule{" + | |||||
| "presetPosId=" + presetPosId + | |||||
| ", presetPosCode='" + presetPosCode + '\'' + | |||||
| ", presetPosName='" + presetPosName + '\'' + | |||||
| ", eqpBookId=" + eqpBookId + | |||||
| ", patrolDeviceCode='" + patrolDeviceCode + '\'' + | |||||
| ", patrolPointId=" + patrolPointId + | |||||
| ", channelId=" + channelId + | |||||
| ", channelCode='" + channelCode + '\'' + | |||||
| ", channelType='" + channelType + '\'' + | |||||
| ", coordinateType='" + coordinateType + '\'' + | |||||
| ", stopTime=" + stopTime + | |||||
| ", channelImg='" + channelImg + '\'' + | |||||
| ", description='" + description + '\'' + | |||||
| ", algSubtypeCode='" + algSubtypeCode + '\'' + | |||||
| ", isEnable='" + isEnable + '\'' + | |||||
| ", algName='" + algName + '\'' + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,223 @@ | |||||
| package com.inspect.simulator.domain.result; | |||||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||||
| import com.fasterxml.jackson.annotation.JsonProperty; | |||||
| import com.inspect.simulator.domain.BaseEntity; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Setter | |||||
| @Getter | |||||
| public class PatrolResult extends BaseEntity { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long lineId; | |||||
| @JsonProperty("patroldeviceName") | |||||
| private String patrolDeviceName; | |||||
| @JsonProperty("patroldeviceCode") | |||||
| private String patrolDeviceCode; | |||||
| private String taskName; | |||||
| private String taskCode; | |||||
| private String deviceName; | |||||
| private String deviceId; | |||||
| private String valueType; | |||||
| private String value; | |||||
| private String valueUnit; | |||||
| private String unit; | |||||
| private String time; | |||||
| private String recognitionType; | |||||
| private String fileType; | |||||
| private String filePath; | |||||
| private String rectangle; | |||||
| private String taskPatrolledId; | |||||
| private String valid; | |||||
| private String patrolStatus; | |||||
| private String checkPerson; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd HH:mm:ss" | |||||
| ) | |||||
| private String checkTime; | |||||
| private String checkResult; | |||||
| private String materialId; | |||||
| private String dataType; | |||||
| private String threshold; | |||||
| private String taskId; | |||||
| private String presetPosCode; | |||||
| private String description; | |||||
| private List<String> infraRed; | |||||
| private List<String> visible; | |||||
| private List<String> audio; | |||||
| private List<String> video; | |||||
| private List<String> photo; | |||||
| private String areaName; | |||||
| private String areaType; | |||||
| private String deviceNam; | |||||
| @JsonProperty("devicetypName") | |||||
| private String deviceTypeName; | |||||
| private String mainId; | |||||
| private String defectType; | |||||
| private String beginTime; | |||||
| private String endTime; | |||||
| private String alarmType; | |||||
| private String resultContent; | |||||
| private String devNo; | |||||
| private String componentName; | |||||
| private String componentId; | |||||
| private String bayName; | |||||
| private String areaId; | |||||
| private String mainDevId; | |||||
| @JsonProperty("warnlevel") | |||||
| private String warnLevel; | |||||
| private String photoUrl; | |||||
| private String videoUrl; | |||||
| private String desc; | |||||
| private String deviceCode; | |||||
| private String devType; | |||||
| private String phase; | |||||
| private String status; | |||||
| private String pointStatus; | |||||
| private String suggestion; | |||||
| private String resStatus; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd HH:mm:ss" | |||||
| ) | |||||
| private Date createTime; | |||||
| private String content; | |||||
| private List<String> algId; | |||||
| @JsonProperty("patrolpointName") | |||||
| private String patrolPointName; | |||||
| private String channelCode; | |||||
| private String pointName; | |||||
| private String algorithmsType; | |||||
| private String algorithmsName; | |||||
| private String sampleRaw; | |||||
| private String fitlerDefect; | |||||
| private String mllmDefect; | |||||
| private String fitlerDiffBase; | |||||
| private String fitlerResultCode; | |||||
| private String mllmResultCode; | |||||
| private String filter; | |||||
| private String resImgUrl; | |||||
| private String imageNormalUrlPath; | |||||
| private String resultType; | |||||
| public PatrolResult(String mainId) { | |||||
| this.mainId = mainId; | |||||
| } | |||||
| public PatrolResult() { | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return "PatrolResult{" + | |||||
| "lineId=" + lineId + | |||||
| ", patrolDeviceName='" + patrolDeviceName + '\'' + | |||||
| ", patrolDeviceCode='" + patrolDeviceCode + '\'' + | |||||
| ", taskName='" + taskName + '\'' + | |||||
| ", taskCode='" + taskCode + '\'' + | |||||
| ", deviceName='" + deviceName + '\'' + | |||||
| ", deviceId='" + deviceId + '\'' + | |||||
| ", valueType='" + valueType + '\'' + | |||||
| ", value='" + value + '\'' + | |||||
| ", valueUnit='" + valueUnit + '\'' + | |||||
| ", unit='" + unit + '\'' + | |||||
| ", time='" + time + '\'' + | |||||
| ", recognitionType='" + recognitionType + '\'' + | |||||
| ", fileType='" + fileType + '\'' + | |||||
| ", filePath='" + filePath + '\'' + | |||||
| ", rectangle='" + rectangle + '\'' + | |||||
| ", taskPatrolledId='" + taskPatrolledId + '\'' + | |||||
| ", valid='" + valid + '\'' + | |||||
| ", patrolStatus='" + patrolStatus + '\'' + | |||||
| ", checkPerson='" + checkPerson + '\'' + | |||||
| ", checkTime='" + checkTime + '\'' + | |||||
| ", checkResult='" + checkResult + '\'' + | |||||
| ", materialId='" + materialId + '\'' + | |||||
| ", dataType='" + dataType + '\'' + | |||||
| ", threshold='" + threshold + '\'' + | |||||
| ", taskId='" + taskId + '\'' + | |||||
| ", presetPosCode='" + presetPosCode + '\'' + | |||||
| ", description='" + description + '\'' + | |||||
| ", infraRed=" + infraRed + | |||||
| ", visible=" + visible + | |||||
| ", audio=" + audio + | |||||
| ", video=" + video + | |||||
| ", photo=" + photo + | |||||
| ", areaName='" + areaName + '\'' + | |||||
| ", areaType='" + areaType + '\'' + | |||||
| ", deviceNam='" + deviceNam + '\'' + | |||||
| ", deviceTypeName='" + deviceTypeName + '\'' + | |||||
| ", mainId='" + mainId + '\'' + | |||||
| ", defectType='" + defectType + '\'' + | |||||
| ", beginTime='" + beginTime + '\'' + | |||||
| ", endTime='" + endTime + '\'' + | |||||
| ", alarmType='" + alarmType + '\'' + | |||||
| ", resultContent='" + resultContent + '\'' + | |||||
| ", devNo='" + devNo + '\'' + | |||||
| ", componentName='" + componentName + '\'' + | |||||
| ", componentId='" + componentId + '\'' + | |||||
| ", bayName='" + bayName + '\'' + | |||||
| ", areaId='" + areaId + '\'' + | |||||
| ", mainDevId='" + mainDevId + '\'' + | |||||
| ", warnLevel='" + warnLevel + '\'' + | |||||
| ", photoUrl='" + photoUrl + '\'' + | |||||
| ", videoUrl='" + videoUrl + '\'' + | |||||
| ", desc='" + desc + '\'' + | |||||
| ", deviceCode='" + deviceCode + '\'' + | |||||
| ", devType='" + devType + '\'' + | |||||
| ", phase='" + phase + '\'' + | |||||
| ", status='" + status + '\'' + | |||||
| ", pointStatus='" + pointStatus + '\'' + | |||||
| ", suggestion='" + suggestion + '\'' + | |||||
| ", resStatus='" + resStatus + '\'' + | |||||
| ", createTime=" + createTime + | |||||
| ", content='" + content + '\'' + | |||||
| ", algId=" + algId + | |||||
| ", patrolPointName='" + patrolPointName + '\'' + | |||||
| ", channelCode='" + channelCode + '\'' + | |||||
| ", pointName='" + pointName + '\'' + | |||||
| ", algorithmsType='" + algorithmsType + '\'' + | |||||
| ", algorithmsName='" + algorithmsName + '\'' + | |||||
| ", sampleRaw='" + sampleRaw + '\'' + | |||||
| ", fitlerDefect='" + fitlerDefect + '\'' + | |||||
| ", mllmDefect='" + mllmDefect + '\'' + | |||||
| ", fitlerDiffBase='" + fitlerDiffBase + '\'' + | |||||
| ", fitlerResultCode='" + fitlerResultCode + '\'' + | |||||
| ", mllmResultCode='" + mllmResultCode + '\'' + | |||||
| ", filter='" + filter + '\'' + | |||||
| ", resImgUrl='" + resImgUrl + '\'' + | |||||
| ", imageNormalUrlPath='" + imageNormalUrlPath + '\'' + | |||||
| ", resultType='" + resultType + '\'' + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,52 @@ | |||||
| package com.inspect.simulator.domain.result; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import java.util.Objects; | |||||
| @Setter | |||||
| @Getter | |||||
| public class PatrolResultRef { | |||||
| private String lineId; | |||||
| private String deviceId; | |||||
| private String devType; | |||||
| private String time; | |||||
| private String value; | |||||
| private String threshold; | |||||
| private String filePath; | |||||
| private String description; | |||||
| private String pointStatus; | |||||
| private String valueUnit; | |||||
| private String resultContent; | |||||
| @Override | |||||
| public boolean equals(Object object) { | |||||
| if (this == object) return true; | |||||
| if (object == null || getClass() != object.getClass()) return false; | |||||
| PatrolResultRef that = (PatrolResultRef) object; | |||||
| return Objects.equals(lineId, that.lineId) && Objects.equals(deviceId, that.deviceId) && Objects.equals(devType, that.devType) && Objects.equals(time, that.time) && Objects.equals(value, that.value) && Objects.equals(threshold, that.threshold) && Objects.equals(filePath, that.filePath) && Objects.equals(description, that.description) && Objects.equals(pointStatus, that.pointStatus) && Objects.equals(valueUnit, that.valueUnit) && Objects.equals(resultContent, that.resultContent); | |||||
| } | |||||
| @Override | |||||
| public int hashCode() { | |||||
| return Objects.hash(lineId, deviceId, devType, time, value, threshold, filePath, description, pointStatus, valueUnit, resultContent); | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return "PatrolResultRef{" + | |||||
| "lineId='" + lineId + '\'' + | |||||
| ", deviceId='" + deviceId + '\'' + | |||||
| ", devType='" + devType + '\'' + | |||||
| ", time='" + time + '\'' + | |||||
| ", value='" + value + '\'' + | |||||
| ", threshold='" + threshold + '\'' + | |||||
| ", filePath='" + filePath + '\'' + | |||||
| ", description='" + description + '\'' + | |||||
| ", pointStatus='" + pointStatus + '\'' + | |||||
| ", valueUnit='" + valueUnit + '\'' + | |||||
| ", resultContent='" + resultContent + '\'' + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,94 @@ | |||||
| package com.inspect.simulator.domain.result; | |||||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||||
| import com.inspect.simulator.domain.BaseEntity; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Setter | |||||
| @Getter | |||||
| public class PatrolTaskDomain extends BaseEntity { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long taskId; | |||||
| private String stationName; | |||||
| private String stationCode; | |||||
| private String type; | |||||
| private String taskCode; | |||||
| private String taskName; | |||||
| private String priority; | |||||
| private String deviceLevel; | |||||
| private String deviceList; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd" | |||||
| ) | |||||
| private Date fixedStartTime; | |||||
| private String cycleMonth; | |||||
| private String cycleWeek; | |||||
| private String cycleExecuteTime; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd" | |||||
| ) | |||||
| private Date cycleStartTime; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd" | |||||
| ) | |||||
| private Date cycleEndTime; | |||||
| private String intervalNumber; | |||||
| private String intervalType; | |||||
| private Date intervalExecuteTime; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd" | |||||
| ) | |||||
| private Date intervalStartTime; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd" | |||||
| ) | |||||
| private Date intervalEndTime; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd" | |||||
| ) | |||||
| private Date invalidStartTime; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd" | |||||
| ) | |||||
| private Date invalidEndTime; | |||||
| private String isEnable; | |||||
| private String creator; | |||||
| private String executionStatus; | |||||
| private String fileStatus; | |||||
| private String taskCycle; | |||||
| private String prevPoints; | |||||
| private String devNo; | |||||
| private List<PatrolTaskStatusDomain> patrolTaskStatusList; | |||||
| private List<BasedataEqpBookMoMain> basedataEqpbookList; | |||||
| } | |||||
| @ -0,0 +1,100 @@ | |||||
| package com.inspect.simulator.domain.result; | |||||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||||
| import com.inspect.simulator.domain.BaseEntity; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import java.util.Date; | |||||
| @Setter | |||||
| @Getter | |||||
| @Builder | |||||
| @AllArgsConstructor | |||||
| public class PatrolTaskStatus extends BaseEntity { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long lineId; | |||||
| private String taskPatrolledId; | |||||
| private String taskName; | |||||
| private String taskCode; | |||||
| private String taskState; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM- HH:mm:ss" | |||||
| ) | |||||
| private Date planStartTime; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd HH:mm:ss" | |||||
| ) | |||||
| private Date startTime; | |||||
| private String taskProgress; | |||||
| private String taskEstimatedTime; | |||||
| private String description; | |||||
| private String posType; | |||||
| private String code; | |||||
| private String pos; | |||||
| private String patrolType; | |||||
| private String timeType; | |||||
| private String timeConditions; | |||||
| private String beginTime; | |||||
| private String endTime; | |||||
| private Date createTime; | |||||
| private String patrolStatus; | |||||
| private int year; | |||||
| private String devNo; | |||||
| private String command; | |||||
| private String pointCount; | |||||
| private String execType; | |||||
| public PatrolTaskStatus(String taskPatrolledId) { | |||||
| this.taskPatrolledId = taskPatrolledId; | |||||
| } | |||||
| public PatrolTaskStatus() { | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return "PatrolTaskStatus{" + | |||||
| "lineId=" + lineId + | |||||
| ", taskPatrolledId='" + taskPatrolledId + '\'' + | |||||
| ", taskName='" + taskName + '\'' + | |||||
| ", taskCode='" + taskCode + '\'' + | |||||
| ", taskState='" + taskState + '\'' + | |||||
| ", planStartTime=" + planStartTime + | |||||
| ", startTime=" + startTime + | |||||
| ", taskProgress='" + taskProgress + '\'' + | |||||
| ", taskEstimatedTime='" + taskEstimatedTime + '\'' + | |||||
| ", description='" + description + '\'' + | |||||
| ", posType='" + posType + '\'' + | |||||
| ", code='" + code + '\'' + | |||||
| ", pos='" + pos + '\'' + | |||||
| ", patrolType='" + patrolType + '\'' + | |||||
| ", timeType='" + timeType + '\'' + | |||||
| ", timeConditions='" + timeConditions + '\'' + | |||||
| ", beginTime='" + beginTime + '\'' + | |||||
| ", endTime='" + endTime + '\'' + | |||||
| ", createTime=" + createTime + | |||||
| ", patrolStatus='" + patrolStatus + '\'' + | |||||
| ", year=" + year + | |||||
| ", devNo='" + devNo + '\'' + | |||||
| ", command='" + command + '\'' + | |||||
| ", pointCount='" + pointCount + '\'' + | |||||
| ", execType='" + execType + '\'' + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,74 @@ | |||||
| package com.inspect.simulator.domain.result; | |||||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||||
| import com.inspect.simulator.domain.BaseEntity; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import java.util.Date; | |||||
| @Setter | |||||
| @Getter | |||||
| public class PatrolTaskStatusDomain extends BaseEntity { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long lineId; | |||||
| private String taskPatrolledId; | |||||
| private String taskName; | |||||
| private String taskCode; | |||||
| private String taskState; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd" | |||||
| ) | |||||
| private Date planStartTime; | |||||
| @JsonFormat( | |||||
| pattern = "yyyy-MM-dd" | |||||
| ) | |||||
| private Date startTime; | |||||
| private String taskProgress; | |||||
| private String taskEstimatedTime; | |||||
| private String description; | |||||
| private String posType; | |||||
| private String code; | |||||
| private String pos; | |||||
| private String patrolType; | |||||
| private String timeType; | |||||
| private String timeConditions; | |||||
| private String beginTime; | |||||
| private String endTime; | |||||
| @Override | |||||
| public String toString() { | |||||
| return "PatrolTaskStatusDomain{" + | |||||
| "lineId=" + lineId + | |||||
| ", taskPatrolledId='" + taskPatrolledId + '\'' + | |||||
| ", taskName='" + taskName + '\'' + | |||||
| ", taskCode='" + taskCode + '\'' + | |||||
| ", taskState='" + taskState + '\'' + | |||||
| ", planStartTime=" + planStartTime + | |||||
| ", startTime=" + startTime + | |||||
| ", taskProgress='" + taskProgress + '\'' + | |||||
| ", taskEstimatedTime='" + taskEstimatedTime + '\'' + | |||||
| ", description='" + description + '\'' + | |||||
| ", posType='" + posType + '\'' + | |||||
| ", code='" + code + '\'' + | |||||
| ", pos='" + pos + '\'' + | |||||
| ", patrolType='" + patrolType + '\'' + | |||||
| ", timeType='" + timeType + '\'' + | |||||
| ", timeConditions='" + timeConditions + '\'' + | |||||
| ", beginTime='" + beginTime + '\'' + | |||||
| ", endTime='" + endTime + '\'' + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,32 @@ | |||||
| package com.inspect.simulator.domain.result; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import java.io.Serializable; | |||||
| @Setter | |||||
| @Getter | |||||
| public class ResultValue implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long lineId; | |||||
| private String areaName; | |||||
| private String deviceName; | |||||
| private String patrolDeviceName; | |||||
| private String patrolPointName; | |||||
| private String value; | |||||
| private String createTime; | |||||
| @Override | |||||
| public String toString() { | |||||
| return "ResultValue{" + | |||||
| "lineId=" + lineId + | |||||
| ", areaName='" + areaName + '\'' + | |||||
| ", deviceName='" + deviceName + '\'' + | |||||
| ", patrolDeviceName='" + patrolDeviceName + '\'' + | |||||
| ", patrolPointName='" + patrolPointName + '\'' + | |||||
| ", value='" + value + '\'' + | |||||
| ", createTime='" + createTime + '\'' + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,32 @@ | |||||
| package com.inspect.simulator.domain.result; | |||||
| import com.inspect.simulator.domain.BaseEntity; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| @Setter | |||||
| @Getter | |||||
| public class TaskStatisticsConfig extends BaseEntity { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long id; | |||||
| private String type; | |||||
| private String taskCode; | |||||
| private String threshold; | |||||
| private String msg; | |||||
| @Override | |||||
| public String toString() { | |||||
| return "TaskStatisticsConfig{" + | |||||
| "id=" + id + | |||||
| ", type='" + type + '\'' + | |||||
| ", taskCode='" + taskCode + '\'' + | |||||
| ", threshold='" + threshold + '\'' + | |||||
| ", msg='" + msg + '\'' + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,28 @@ | |||||
| package com.inspect.simulator.domain.result.upper; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import java.util.List; | |||||
| @Getter | |||||
| @Setter | |||||
| public class MessageBody { | |||||
| private String provinceCode; | |||||
| private String stationCode; | |||||
| private String voltLevel; | |||||
| private List<MessageData> samples; | |||||
| @Override | |||||
| public String toString() { | |||||
| return "MessageBody{" + | |||||
| "provinceCode='" + provinceCode + '\'' + | |||||
| ", stationCode='" + stationCode + '\'' + | |||||
| ", voltLevel=" + voltLevel + | |||||
| ", samples=" + samples + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,50 @@ | |||||
| package com.inspect.simulator.domain.result.upper; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| @Getter | |||||
| @Setter | |||||
| public class MessageData { | |||||
| private String areaName; | |||||
| private String deviceName; | |||||
| private String pointName; | |||||
| private String time; | |||||
| private String algorithmsName; | |||||
| private String algorithmsType; | |||||
| private String sampleRaw; | |||||
| private String fitlerDefect; | |||||
| private String mllmDefect; | |||||
| private String fitlerDiffBase; | |||||
| private String fitlerResultCode; | |||||
| private String mllmResultCode; | |||||
| @Override | |||||
| public String toString() { | |||||
| return "MessageData{" + | |||||
| "areaName='" + areaName + '\'' + | |||||
| ", deviceName='" + deviceName + '\'' + | |||||
| ", pointName='" + pointName + '\'' + | |||||
| ", time='" + time + '\'' + | |||||
| ", algorithmsName='" + algorithmsName + '\'' + | |||||
| ", algorithmsType='" + algorithmsType + '\'' + | |||||
| ", sampleRaw='" + sampleRaw + '\'' + | |||||
| ", fitlerDefect='" + fitlerDefect + '\'' + | |||||
| ", mllmDefect='" + mllmDefect + '\'' + | |||||
| ", fitlerDiffBase='" + fitlerDiffBase + '\'' + | |||||
| ", fitlerResultCode='" + fitlerResultCode + '\'' + | |||||
| ", mllmResultCode='" + mllmResultCode + '\'' + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,46 @@ | |||||
| package com.inspect.simulator.domain.result.upper; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| @Getter | |||||
| @Setter | |||||
| public class MessageResult { | |||||
| private Integer code; | |||||
| private String msg; | |||||
| private String resultCode; | |||||
| private Boolean success; | |||||
| private Data data; | |||||
| @Override | |||||
| public String toString() { | |||||
| return "MessageResult{" + | |||||
| "code=" + code + | |||||
| ", msg='" + msg + '\'' + | |||||
| ", resultCode='" + resultCode + '\'' + | |||||
| ", success=" + success + | |||||
| ", data=" + data + | |||||
| '}'; | |||||
| } | |||||
| @Getter | |||||
| @Setter | |||||
| public static class Data { | |||||
| private Integer code; | |||||
| private String msg; | |||||
| private Integer data; | |||||
| private String resultCode; | |||||
| private Boolean success; | |||||
| @Override | |||||
| public String toString() { | |||||
| return "Data{" + | |||||
| "code=" + code + | |||||
| ", msg='" + msg + '\'' + | |||||
| ", data=" + data + | |||||
| ", resultCode='" + resultCode + '\'' + | |||||
| ", success=" + success + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,41 @@ | |||||
| package com.inspect.simulator.domain.result.upper; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import java.util.Objects; | |||||
| @Getter | |||||
| @Setter | |||||
| public class TokenData { | |||||
| private Integer expiresIn; | |||||
| private String refreshToken; | |||||
| private String token; | |||||
| private String tokenHead; | |||||
| @Override | |||||
| public boolean equals(Object object) { | |||||
| if (this == object) return true; | |||||
| if (object == null || getClass() != object.getClass()) return false; | |||||
| TokenData tokenData = (TokenData) object; | |||||
| return Objects.equals(expiresIn, tokenData.expiresIn) && Objects.equals(refreshToken, tokenData.refreshToken) && Objects.equals(token, tokenData.token) && Objects.equals(tokenHead, tokenData.tokenHead); | |||||
| } | |||||
| @Override | |||||
| public int hashCode() { | |||||
| return Objects.hash(expiresIn, refreshToken, token, tokenHead); | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return "TokenData{" + | |||||
| "expiresIn=" + expiresIn + | |||||
| ", refreshToken='" + refreshToken + '\'' + | |||||
| ", token='" + token + '\'' + | |||||
| ", tokenHead='" + tokenHead + '\'' + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,36 @@ | |||||
| package com.inspect.simulator.domain.result.upper; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| import java.util.Objects; | |||||
| @Getter | |||||
| @Setter | |||||
| public class TokenParam { | |||||
| private String grantType; | |||||
| private String clientId; | |||||
| private String clientSecret; | |||||
| @Override | |||||
| public boolean equals(Object object) { | |||||
| if (this == object) return true; | |||||
| if (object == null || getClass() != object.getClass()) return false; | |||||
| TokenParam that = (TokenParam) object; | |||||
| return Objects.equals(grantType, that.grantType) && Objects.equals(clientId, that.clientId) && Objects.equals(clientSecret, that.clientSecret); | |||||
| } | |||||
| @Override | |||||
| public int hashCode() { | |||||
| return Objects.hash(grantType, clientId, clientSecret); | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return "TokenParam{" + | |||||
| "grantType='" + grantType + '\'' + | |||||
| ", clientId='" + clientId + '\'' + | |||||
| ", clientSecret='" + clientSecret + '\'' + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,29 @@ | |||||
| package com.inspect.simulator.domain.result.upper; | |||||
| import lombok.Getter; | |||||
| import lombok.Setter; | |||||
| @Getter | |||||
| @Setter | |||||
| public class TokenResult { | |||||
| private Integer code; | |||||
| private String msg; | |||||
| private String resultCode; | |||||
| private TokenData data; | |||||
| private Boolean success; | |||||
| @Override | |||||
| public String toString() { | |||||
| return "TokenResult{" + | |||||
| "code=" + code + | |||||
| ", msg='" + msg + '\'' + | |||||
| ", resultCode='" + resultCode + '\'' + | |||||
| ", data=" + data + | |||||
| ", success=" + success + | |||||
| '}'; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,97 @@ | |||||
| package com.inspect.simulator.mapper; | |||||
| import com.inspect.simulator.domain.result.*; | |||||
| import org.apache.ibatis.annotations.Mapper; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| import java.util.Set; | |||||
| @Mapper | |||||
| public interface PatrolResultMapper { | |||||
| PatrolResult selectPatrolResultByLineId(Long lineId); | |||||
| Map<String, Object> selectBaseInfoByPointId(String pointId); | |||||
| List<Map<String, String>> selectAlgTypeByAlaName(String key); | |||||
| Map<String, Object> selectBaseByPointId(String pointId); | |||||
| List<PatrolResult> selectPatrolResultList(PatrolResult patrolResult); | |||||
| List<PatrolResult> selectPatrolResultListOrderBy(PatrolResult patrolResult); | |||||
| List<PatrolData> selectPatrolDataResultByTaskCode(PatrolResult patrolResult); | |||||
| List<PatrolData> selectPatrolDataResultByTaskCodeList(PatrolTaskStatus patrolTaskStatus); | |||||
| List<BasedataEqpBookMoMain> selectBasedataEqpBookList(BasedataEqpBookMoMain basedataEqpBookMoMain); | |||||
| List<PatrolResult> selectPatroByAllDev(PatrolResult patrolResult); | |||||
| List<AlgInfo> selectAlgInfo(PatrolResult patrolResult); | |||||
| List<PatrolResult> queryPatrolResultByPointID(String key, Date date, Date date2); | |||||
| Map<String, String> selectAlgorithmType(String key); | |||||
| Map<String, String> selectAlgorithmInfo(String key); | |||||
| List<PatrolPresetPosModule> selectAlgorithmTypeList(String key); | |||||
| Map<String, String> selectThresholdByPointId(String pointId); | |||||
| Map<String, String> selectAlgTypeDataType(String key); | |||||
| Map<String, String> selectAlgTypeByCode(String code); | |||||
| Map<String, String> selectBasedataStation(); | |||||
| List<Map<String, String>> selectEvnData(String key); | |||||
| Map<String, Object> selectDevInfoById(String id); | |||||
| Map<String, String> selectAreByAudit(String key); | |||||
| Map<String, Object> selectAreInfo(String key); | |||||
| List<Map<String, Object>> selectAreInfoByParentId(String parentId); | |||||
| int insertPatrolResult(PatrolResult patrolResult); | |||||
| int updatePatrolResult(PatrolResult patrolResult); | |||||
| int updatePatrolResultByMainId(String mainId); | |||||
| int deletePatrolResultByLineId(Long lineId); | |||||
| int deletePatrolResultByLineIds(Long[] lineIds); | |||||
| int updatePatrolResultValue(PatrolResult patrolResult); | |||||
| List<ResultValue> selectOilResultValue(PatrolResult patrolResult); | |||||
| List<ResultValue> select6FsResultValue(PatrolResult patrolResult); | |||||
| List<PatrolResult> queryOneTaskResult(PatrolResult patrolResult); | |||||
| Integer queryTaskDeviceNum(String key); | |||||
| TaskStatisticsConfig selectStatisticsTaskConfigList(String key); | |||||
| List<PatrolResult> queryDiffTimeResult(@Param("taskCode") String taskCode, @Param("time") Long time); | |||||
| List<PatrolResult> queryNumTypeResult(@Param("num") Integer num, @Param("deviceId") String deviceId, @Param("patrolDeviceCode") String patrolDeviceCode); | |||||
| List<PatrolResultRef> selectResultRefByLineId(String lineId); | |||||
| List<BasePointAreaInfo> selectBaseInfoByMainId(String mainId); | |||||
| int updatePatrolResultUpStatus(@Param("lineIds") Set<Long> lineIds); | |||||
| List<PatrolResult> selectCurrentPatrolResultList(String createTimeStr); | |||||
| } | |||||
| @ -0,0 +1,8 @@ | |||||
| package com.inspect.simulator.service; | |||||
| import com.inspect.simulator.domain.file.FileReturn; | |||||
| import org.springframework.web.multipart.MultipartFile; | |||||
| public interface FileService { | |||||
| public FileReturn uploadFile(String filename, MultipartFile multipartFile); | |||||
| } | |||||
| @ -0,0 +1,15 @@ | |||||
| package com.inspect.simulator.service; | |||||
| import com.inspect.simulator.domain.result.upper.MessageBody; | |||||
| import com.inspect.simulator.domain.result.upper.MessageResult; | |||||
| import com.inspect.simulator.domain.result.upper.TokenParam; | |||||
| import com.inspect.simulator.domain.result.upper.TokenResult; | |||||
| public interface PatrolResultService { | |||||
| TokenResult getUpperToken(TokenParam tokenParam); | |||||
| MessageResult messageNotify(String token, MessageBody messageBody); | |||||
| void sendPatrolResultToUpperSystem(); | |||||
| } | |||||
| @ -0,0 +1,48 @@ | |||||
| package com.inspect.simulator.service.impl; | |||||
| import com.inspect.simulator.domain.file.FileReturn; | |||||
| import com.inspect.simulator.service.FileService; | |||||
| import org.apache.tomcat.util.http.fileupload.IOUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.stereotype.Service; | |||||
| import org.springframework.web.multipart.MultipartFile; | |||||
| import java.io.File; | |||||
| import java.io.FileNotFoundException; | |||||
| import java.io.FileOutputStream; | |||||
| import java.io.IOException; | |||||
| @Service | |||||
| public class FileServiceImpl implements FileService { | |||||
| private final Logger log = LoggerFactory.getLogger(this.getClass()); | |||||
| @Override | |||||
| public FileReturn uploadFile(String filename, MultipartFile multipartFile) { | |||||
| File file = null; | |||||
| FileOutputStream fileOutputStream = null; | |||||
| try { | |||||
| //String filePath = ResourceUtils.getURL("classpath:").getPath() + File.separator + "images"; | |||||
| String filePath = "images/"; | |||||
| file = new File(filePath + filename); | |||||
| fileOutputStream = new FileOutputStream(file); | |||||
| IOUtils.copy(multipartFile.getInputStream(), fileOutputStream); | |||||
| log.info("===========file upload success======="); | |||||
| } catch (FileNotFoundException e) { | |||||
| e.printStackTrace(); | |||||
| } catch (IOException e) { | |||||
| e.printStackTrace(); | |||||
| } finally { | |||||
| if (fileOutputStream != null) { | |||||
| try { | |||||
| fileOutputStream.close(); | |||||
| } catch (IOException e) { | |||||
| log.error("文件关闭错误", e); | |||||
| } | |||||
| } | |||||
| } | |||||
| return new FileReturn<>(1, "文件上传成功", file); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,170 @@ | |||||
| package com.inspect.simulator.service.impl; | |||||
| import com.google.gson.Gson; | |||||
| import com.inspect.simulator.domain.result.PatrolResult; | |||||
| import com.inspect.simulator.domain.result.upper.*; | |||||
| import com.inspect.simulator.mapper.PatrolResultMapper; | |||||
| import com.inspect.simulator.service.PatrolResultService; | |||||
| import com.inspect.simulator.service.remote.UpperRemoteService; | |||||
| import com.inspect.simulator.utils.DateUtils; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.scheduling.annotation.Scheduled; | |||||
| import org.springframework.stereotype.Service; | |||||
| import retrofit2.Call; | |||||
| import retrofit2.Response; | |||||
| import java.util.*; | |||||
| import java.util.stream.Collectors; | |||||
| @Service | |||||
| public class PatrolResultServiceImpl implements PatrolResultService { | |||||
| private static String token; | |||||
| private static final String MLLM_FILTER = "0"; | |||||
| private static final String FITLER_FILTER = "1"; | |||||
| private final Logger log = LoggerFactory.getLogger(this.getClass()); | |||||
| private final UpperRemoteService upperRemoteService; | |||||
| private final PatrolResultMapper patrolResultMapper; | |||||
| public PatrolResultServiceImpl(PatrolResultMapper patrolResultMapper, UpperRemoteService upperRemoteService) { | |||||
| this.patrolResultMapper = patrolResultMapper; | |||||
| this.upperRemoteService = upperRemoteService; | |||||
| } | |||||
| @Override | |||||
| public TokenResult getUpperToken(TokenParam tokenParam) { | |||||
| log.info("tokenParam: {}", tokenParam); | |||||
| TokenResult tokenResult = new TokenResult(); | |||||
| tokenResult.setCode(401); | |||||
| tokenResult.setMsg("认证异常"); | |||||
| tokenResult.setResultCode("OAUTH_012"); | |||||
| try { | |||||
| Call<Object> call = upperRemoteService.getOathToken(tokenParam.getGrantType(), tokenParam.getClientId(), tokenParam.getClientSecret()); | |||||
| Response<Object> response = call.execute(); | |||||
| Object result = response.body(); | |||||
| tokenResult = new Gson().fromJson(new Gson().toJson(result), TokenResult.class); | |||||
| log.info("Upper token: {}", tokenResult); | |||||
| } catch (Exception e) { | |||||
| log.error("getUpperToken Exception: {}", e.getMessage()); | |||||
| } | |||||
| return tokenResult; | |||||
| } | |||||
| @Override | |||||
| public MessageResult messageNotify(String token, MessageBody messageBody) { | |||||
| MessageResult messageResult = new MessageResult(); | |||||
| messageResult.setSuccess(false); | |||||
| messageResult.setResultCode("201"); | |||||
| try { | |||||
| final String bearerToken = "Bearer " + token; | |||||
| log.info("bearerToken: {}", bearerToken); | |||||
| Call<Object> call = upperRemoteService.messageNotify(bearerToken, messageBody); | |||||
| Response<Object> response = call.execute(); | |||||
| Object result = response.body(); | |||||
| log.info("messageNotify res: {}", new Gson().toJson(result)); | |||||
| messageResult = new Gson().fromJson(new Gson().toJson(result), MessageResult.class); | |||||
| } catch (Exception e) { | |||||
| log.error("messageNotify Exception: {}", e.getMessage()); | |||||
| } | |||||
| return messageResult; | |||||
| } | |||||
| @Scheduled(cron = "59 59 0/1 * * ?") | |||||
| public void sendPatrolResultToUpperSystem() { | |||||
| final long threadId = Thread.currentThread().getId(); | |||||
| Date date = new Date(); | |||||
| final String execTime = DateUtils.format(DateUtils.yyyyMMddHHmmss2, date); | |||||
| log.info("[{}] [{}] sendPatrolResultToUpperSystem", threadId, execTime); | |||||
| // 查询当天的巡检结果 | |||||
| String createTimeStr = DateUtils.parseDateToStr("yyyy-MM-dd", date); | |||||
| // createTimeStr = "2024-06-19"; | |||||
| List<PatrolResult> patrolResults = patrolResultMapper.selectCurrentPatrolResultList(createTimeStr); | |||||
| if (patrolResults == null || patrolResults.size() <= 0) { | |||||
| log.info("[{}] [{}] sendPatrolResultToUpperSystem no data", threadId, execTime); | |||||
| return; | |||||
| } | |||||
| try { | |||||
| String token = getOrRefreshToken(false); | |||||
| MessageBody messageBody = prepareMessageBody(patrolResults); | |||||
| MessageResult messageResult = messageNotify(token, messageBody); | |||||
| if (messageResult == null || !messageResult.getSuccess()) { | |||||
| log.warn("[{}] [{}] First attempt to send message failed. Retrying with a new token.", threadId, execTime); | |||||
| token = getOrRefreshToken(true); | |||||
| messageResult = messageNotify(token, messageBody); | |||||
| } | |||||
| log.info("sendPatrolResultToUpperSystem messageResult: {}", messageResult); | |||||
| if (messageResult != null && messageResult.getSuccess()) { | |||||
| // 成功则更新数据库中上送状态 | |||||
| Set<Long> lineIds = patrolResults.stream().map(PatrolResult::getLineId).collect(Collectors.toSet()); | |||||
| int row = patrolResultMapper.updatePatrolResultUpStatus(lineIds); | |||||
| log.info("[{}] [{}] sendPatrolResultToUpperSystem updatePatrolResultUpStatus row:{}", threadId, execTime, row); | |||||
| } else { | |||||
| log.error("[{}] [{}] sendPatrolResultToUpperSystem failed", threadId, execTime); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| log.error("sendPatrolResultToUpperSystem Exception", e); | |||||
| } | |||||
| } | |||||
| private String getOrRefreshToken(Boolean isTokenExpired) { | |||||
| if (token == null || isTokenExpired) { | |||||
| TokenParam tokenParam = new TokenParam(); | |||||
| tokenParam.setGrantType("client_credentials"); | |||||
| tokenParam.setClientId("patrol"); | |||||
| tokenParam.setClientSecret("8dc6595707a1d457cdef07f46c034a1c"); | |||||
| TokenResult tokenResult = getUpperToken(tokenParam); | |||||
| // TokenResult tokenResult = new TokenResult(); | |||||
| // TokenData tokenData1 = new TokenData(); | |||||
| // tokenData1.setExpiresIn(10000); | |||||
| // tokenData1.setRefreshToken("123456"); | |||||
| // String s = UUID.randomUUID().toString(); | |||||
| // tokenData1.setToken(s); | |||||
| // log.info("tokenData1: {}", s); | |||||
| // tokenResult.setData(tokenData1); | |||||
| TokenData tokenData = tokenResult.getData(); | |||||
| if (tokenData != null) { | |||||
| token = tokenData.getToken(); | |||||
| } else { | |||||
| throw new RuntimeException("sendPatrolResultToUpperSystem failed to obtain token"); | |||||
| } | |||||
| } | |||||
| return token; | |||||
| } | |||||
| private MessageBody prepareMessageBody(List<PatrolResult> patrolResults) { | |||||
| MessageBody messageBody = new MessageBody(); | |||||
| messageBody.setProvinceCode("330000"); | |||||
| messageBody.setStationCode("30000001-112967078"); | |||||
| messageBody.setVoltLevel("800"); | |||||
| List<MessageData> samples = new ArrayList<>(); | |||||
| for (PatrolResult patrolResult : patrolResults) { | |||||
| MessageData sample = new MessageData(); | |||||
| sample.setAreaName(patrolResult.getAreaName()); | |||||
| sample.setDeviceName(patrolResult.getDeviceName()); | |||||
| sample.setPointName(patrolResult.getDeviceName()); | |||||
| sample.setTime(DateUtils.format(DateUtils.yyyyMMddHHmmss2, patrolResult.getCreateTime())); | |||||
| sample.setAlgorithmsName(patrolResult.getAlgorithmsName()); | |||||
| sample.setAlgorithmsType(patrolResult.getAlgorithmsType()); | |||||
| sample.setSampleRaw(patrolResult.getFilePath()); | |||||
| sample.setFitlerDefect(FITLER_FILTER.equals(patrolResult.getFilter()) ? patrolResult.getResImgUrl() : ""); | |||||
| sample.setMllmDefect(MLLM_FILTER.equals(patrolResult.getFilter()) ? patrolResult.getResImgUrl() : ""); | |||||
| sample.setFitlerDiffBase(FITLER_FILTER.equals(patrolResult.getFilter()) ? patrolResult.getImageNormalUrlPath() : ""); | |||||
| String resultType = StringUtils.isEmpty(patrolResult.getResultType()) ? patrolResult.getResultType() : ("1".equals(patrolResult.getResultType()) ? "0" : "1"); | |||||
| sample.setFitlerResultCode(FITLER_FILTER.equals(patrolResult.getFilter()) ? resultType : ""); | |||||
| sample.setMllmResultCode(MLLM_FILTER.equals(patrolResult.getFilter()) ? resultType : ""); | |||||
| samples.add(sample); | |||||
| } | |||||
| messageBody.setSamples(samples); | |||||
| log.info("samples size: {},messageBody: {}", samples.size(), messageBody); | |||||
| return messageBody; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,15 @@ | |||||
| package com.inspect.simulator.service.remote; | |||||
| import com.inspect.simulator.domain.algorithm.out.AnalyseResult; | |||||
| import com.inspect.simulator.domain.analysis.vo.AnalysisResultEntity; | |||||
| import retrofit2.Call; | |||||
| import retrofit2.http.Body; | |||||
| import retrofit2.http.POST; | |||||
| public interface AnalysisRemoteService { | |||||
| @POST("picAnalyseRetNotify") | |||||
| Call<Object> analysisResultNotify(@Body AnalysisResultEntity analysisResultEntity); | |||||
| @POST("picAnalyseRetNotify") | |||||
| Call<Object> picAnalyseRetNotify(@Body AnalyseResult analyseResult); | |||||
| } | |||||
| @ -0,0 +1,23 @@ | |||||
| package com.inspect.simulator.service.remote; | |||||
| import com.inspect.simulator.domain.result.upper.MessageBody; | |||||
| import retrofit2.Call; | |||||
| import retrofit2.http.Body; | |||||
| import retrofit2.http.Header; | |||||
| import retrofit2.http.POST; | |||||
| import retrofit2.http.Query; | |||||
| public interface UpperRemoteService { | |||||
| @POST("/ylkj-oauth2/oauth/token") | |||||
| Call<Object> getOathToken( | |||||
| @Query("grant_type") String grantType, | |||||
| @Query("client_id") String clientId, | |||||
| @Query("client_secret") String clientSecret | |||||
| ); | |||||
| @POST("/ylkj-oauth2/api/v1/inner/002") | |||||
| Call<Object> messageNotify( | |||||
| @Header("Authorization") String bearerToken, | |||||
| @Body MessageBody messageBody | |||||
| ); | |||||
| } | |||||
| @ -0,0 +1,40 @@ | |||||
| package com.inspect.simulator.service.remote.impl; | |||||
| import com.inspect.simulator.domain.algorithm.out.AnalyseResult; | |||||
| import com.inspect.simulator.domain.analysis.vo.AnalysisResultEntity; | |||||
| import com.inspect.simulator.service.remote.AnalysisRemoteService; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import org.springframework.beans.factory.annotation.Qualifier; | |||||
| import org.springframework.stereotype.Service; | |||||
| import retrofit2.Call; | |||||
| import retrofit2.Retrofit; | |||||
| import javax.annotation.PostConstruct; | |||||
| @EqualsAndHashCode | |||||
| @Service | |||||
| public class AnalysisRemoteServiceImpl implements AnalysisRemoteService { | |||||
| private final Retrofit retrofit; | |||||
| private AnalysisRemoteService analysisRemoteService; | |||||
| public AnalysisRemoteServiceImpl(@Qualifier("RetrofitOfAnalysis") Retrofit retrofit) { | |||||
| this.retrofit = retrofit; | |||||
| } | |||||
| @PostConstruct | |||||
| public void setup() { | |||||
| analysisRemoteService = retrofit.create(AnalysisRemoteService.class); | |||||
| } | |||||
| @Override | |||||
| public Call<Object> analysisResultNotify(AnalysisResultEntity analysisResultEntity) { | |||||
| return analysisRemoteService.analysisResultNotify(analysisResultEntity); | |||||
| } | |||||
| @Override | |||||
| public Call<Object> picAnalyseRetNotify(AnalyseResult analyseResult) { | |||||
| return analysisRemoteService.picAnalyseRetNotify(analyseResult); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,38 @@ | |||||
| package com.inspect.simulator.service.remote.impl; | |||||
| import com.inspect.simulator.domain.result.upper.MessageBody; | |||||
| import com.inspect.simulator.service.remote.AnalysisRemoteService; | |||||
| import com.inspect.simulator.service.remote.UpperRemoteService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.beans.factory.annotation.Qualifier; | |||||
| import org.springframework.stereotype.Service; | |||||
| import retrofit2.Call; | |||||
| import retrofit2.Retrofit; | |||||
| import javax.annotation.PostConstruct; | |||||
| @Service | |||||
| public class UpperRemoteServiceImpl implements UpperRemoteService { | |||||
| private final Retrofit retrofit; | |||||
| private UpperRemoteService upperRemoteService; | |||||
| public UpperRemoteServiceImpl(@Qualifier("RetrofitOfUpper") Retrofit retrofit) { | |||||
| this.retrofit = retrofit; | |||||
| } | |||||
| @PostConstruct | |||||
| public void setup() { | |||||
| upperRemoteService = retrofit.create(UpperRemoteService.class); | |||||
| } | |||||
| @Override | |||||
| public Call<Object> getOathToken(String grantType, String clientId, String clientSecret) { | |||||
| return upperRemoteService.getOathToken(grantType, clientId, clientSecret); | |||||
| } | |||||
| @Override | |||||
| public Call<Object> messageNotify(String token, MessageBody messageBody) { | |||||
| return upperRemoteService.messageNotify(token, messageBody); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,230 @@ | |||||
| package com.inspect.simulator.utils; | |||||
| import org.apache.commons.lang3.time.DateFormatUtils; | |||||
| import java.lang.management.ManagementFactory; | |||||
| import java.text.ParseException; | |||||
| import java.text.SimpleDateFormat; | |||||
| import java.time.*; | |||||
| import java.util.Calendar; | |||||
| import java.util.Date; | |||||
| public class DateUtils extends org.apache.commons.lang3.time.DateUtils { | |||||
| public static String YYYY = "yyyy"; | |||||
| public static String YYYY_MM = "yyyy-MM"; | |||||
| public static String YYYY_MM_DD = "yyyy-MM-dd"; | |||||
| public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; | |||||
| public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; | |||||
| public static final String yyyyMMdd = "yyyyMMdd"; | |||||
| public static final String yyyyMMdd2 = "yyyy-MM-dd"; | |||||
| public static final String yyyyMMddHHmmss = "yyyyMMddHHmmss"; | |||||
| public static final String yyyyMMddHHmmss2 = "yyyy-MM-dd HH:mm:ss"; | |||||
| private static String[] parsePatterns = new String[]{"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; | |||||
| public static Date getNowDate() { | |||||
| return new Date(); | |||||
| } | |||||
| public static String getDate() { | |||||
| return dateTimeNow(YYYY_MM_DD); | |||||
| } | |||||
| public static final String getTime() { | |||||
| return dateTimeNow(YYYY_MM_DD_HH_MM_SS); | |||||
| } | |||||
| public static final String dateTimeNow() { | |||||
| return dateTimeNow(YYYYMMDDHHMMSS); | |||||
| } | |||||
| public static final String dateTimeNow(String format) { | |||||
| return parseDateToStr(format, new Date()); | |||||
| } | |||||
| public static final String dateTime(Date date) { | |||||
| return parseDateToStr(YYYY_MM_DD, date); | |||||
| } | |||||
| public static final String parseDateToStr(String format, Date date) { | |||||
| return (new SimpleDateFormat(format)).format(date); | |||||
| } | |||||
| public static final Date dateTime(String format, String ts) { | |||||
| try { | |||||
| return (new SimpleDateFormat(format)).parse(ts); | |||||
| } catch (ParseException var3) { | |||||
| throw new RuntimeException(var3); | |||||
| } | |||||
| } | |||||
| public static final String datePath() { | |||||
| Date now = new Date(); | |||||
| return DateFormatUtils.format(now, "yyyy/MM/dd"); | |||||
| } | |||||
| public static final String dateTime() { | |||||
| Date now = new Date(); | |||||
| return DateFormatUtils.format(now, "yyyyMMdd"); | |||||
| } | |||||
| public static Date parseDate(Object str) { | |||||
| if(str == null) { | |||||
| return null; | |||||
| } else { | |||||
| try { | |||||
| return parseDate(str.toString(), parsePatterns); | |||||
| } catch (ParseException var2) { | |||||
| return null; | |||||
| } | |||||
| } | |||||
| } | |||||
| public static Date getServerStartDate() { | |||||
| long time = ManagementFactory.getRuntimeMXBean().getStartTime(); | |||||
| return new Date(time); | |||||
| } | |||||
| public static String getDatePoor(Date endDate, Date nowDate) { | |||||
| long nd = 86400000L; | |||||
| long nh = 3600000L; | |||||
| long nm = 60000L; | |||||
| long diff = endDate.getTime() - nowDate.getTime(); | |||||
| long day = diff / nd; | |||||
| long hour = diff % nd / nh; | |||||
| long min = diff % nd % nh / nm; | |||||
| return day + "天" + hour + "小时" + min + "分钟"; | |||||
| } | |||||
| public static Date toDate(LocalDateTime temporalAccessor) { | |||||
| ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault()); | |||||
| return Date.from(zdt.toInstant()); | |||||
| } | |||||
| public static Date toDate(LocalDate temporalAccessor) { | |||||
| LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0)); | |||||
| ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); | |||||
| return Date.from(zdt.toInstant()); | |||||
| } | |||||
| public static Date theDayStartTime(Date date) { | |||||
| Calendar calendar = Calendar.getInstance(); | |||||
| calendar.setTime(date); | |||||
| calendar.set(11, 0); | |||||
| calendar.set(12, 0); | |||||
| calendar.set(13, 0); | |||||
| calendar.set(14, 0); | |||||
| Date date_start = calendar.getTime(); | |||||
| return date_start; | |||||
| } | |||||
| public static Date theDayBeforeStartTime(Date date) { | |||||
| Calendar calendar = Calendar.getInstance(); | |||||
| calendar.setTime(date); | |||||
| calendar.set(11, 0); | |||||
| calendar.set(12, 0); | |||||
| calendar.set(13, 0); | |||||
| calendar.set(14, 0); | |||||
| calendar.add(5, -1); | |||||
| Date date_start = calendar.getTime(); | |||||
| return date_start; | |||||
| } | |||||
| public static Date theDayBeforeEndTime(Date date) { | |||||
| Calendar calendar_end = Calendar.getInstance(); | |||||
| calendar_end.setTime(date); | |||||
| calendar_end.set(11, 23); | |||||
| calendar_end.set(12, 59); | |||||
| calendar_end.set(13, 59); | |||||
| calendar_end.set(14, 999); | |||||
| calendar_end.add(5, -1); | |||||
| Date date_end = calendar_end.getTime(); | |||||
| return date_end; | |||||
| } | |||||
| public static Date theDayTimeByAddHour(Date date, int hour) { | |||||
| Calendar calendar = Calendar.getInstance(); | |||||
| calendar.setTime(date); | |||||
| calendar.set(11, hour); | |||||
| calendar.set(12, 0); | |||||
| calendar.set(13, 0); | |||||
| calendar.set(14, 0); | |||||
| calendar.add(5, 0); | |||||
| Date date_time = calendar.getTime(); | |||||
| return date_time; | |||||
| } | |||||
| public static String format(final String pattern, final Date date) { | |||||
| try { | |||||
| return new SimpleDateFormat(pattern).format(date); | |||||
| } catch (Exception e) { | |||||
| return ""; | |||||
| } | |||||
| } | |||||
| public static int toInt(final String pattern, final Date date) { | |||||
| try { | |||||
| return Integer.parseInt(format(pattern, date)); | |||||
| } catch (Exception e) { | |||||
| return 0; | |||||
| } | |||||
| } | |||||
| public static Date parse(final String pattern, final String time) { | |||||
| try { | |||||
| return new SimpleDateFormat(pattern).parse(time); | |||||
| } catch (Exception e) { | |||||
| return new Date(0); | |||||
| } | |||||
| } | |||||
| public static int getDayInt() { | |||||
| return Calendar.getInstance().get(5); | |||||
| } | |||||
| public static int getHourInt() { | |||||
| return Calendar.getInstance().get(11); | |||||
| } | |||||
| public static int getMinuteInt() { | |||||
| return Calendar.getInstance().get(12); | |||||
| } | |||||
| public static String getDayOfWeek(Date date) { | |||||
| String[] weekDays = new String[]{"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; | |||||
| Calendar cal = Calendar.getInstance(); | |||||
| cal.setTime(date); | |||||
| int w = cal.get(7) - 1; | |||||
| if(w < 0) { | |||||
| w = 0; | |||||
| } | |||||
| return weekDays[w]; | |||||
| } | |||||
| public static void main(String[] args) { | |||||
| theDayBeforeStartTime(new Date()); | |||||
| theDayBeforeEndTime(new Date()); | |||||
| theDayStartTime(new Date()); | |||||
| Date now = new Date(); | |||||
| System.out.println(now); | |||||
| theDayTimeByAddHour(getNowDate(), 24); | |||||
| int interval = 24; | |||||
| Date dayBeforeStartTime = theDayBeforeStartTime(new Date()); | |||||
| int hour; | |||||
| for(int i = 0; i < interval; ++i) { | |||||
| hour = i * 1 + 1; | |||||
| Date startTime = theDayTimeByAddHour(dayBeforeStartTime, i * 1); | |||||
| System.out.println("startTime::" + startTime); | |||||
| Date endTime = theDayTimeByAddHour(dayBeforeStartTime, hour); | |||||
| System.out.println(" endTime::" + endTime); | |||||
| } | |||||
| Calendar now1 = Calendar.getInstance(); | |||||
| hour = now1.get(11); | |||||
| Double a = Double.valueOf((double)(hour / 1)); | |||||
| int b = a.intValue(); | |||||
| System.out.println("时: " + now1.get(11)); | |||||
| System.out.println("时: " + b); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,19 @@ | |||||
| package com.inspect.simulator.utils; | |||||
| public class TimeUtils { | |||||
| private static final String SIPB_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; | |||||
| private static final String IVS_TIME_FORMAT; | |||||
| public static String toSipb(String ivsTime) { | |||||
| return DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", DateUtils.dateTime(IVS_TIME_FORMAT, ivsTime)).replace(" ", "T") + "Z"; | |||||
| } | |||||
| public static String toIvs(String sipTime) { | |||||
| String replace = sipTime.replace("-", "").replace("T", "").replace("Z", "").replace(":", ""); | |||||
| return replace; | |||||
| } | |||||
| static { | |||||
| IVS_TIME_FORMAT = DateUtils.YYYYMMDDHHMMSS; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,44 @@ | |||||
| package com.inspect.simulator.view; | |||||
| import com.inspect.simulator.domain.ivs.IndexRange; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import lombok.experimental.SuperBuilder; | |||||
| import java.io.Serializable; | |||||
| import java.util.List; | |||||
| @Data | |||||
| @SuperBuilder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class IvsPlatformSnapshotView implements Serializable { | |||||
| private String resultCode; | |||||
| private SnapshotInfoList snapshotInfoList; | |||||
| @Data | |||||
| @SuperBuilder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public static class SnapshotInfoList { | |||||
| private int total; | |||||
| private IndexRange indexRange; | |||||
| private List<SnapshotInfo> snapshotInfos; | |||||
| } | |||||
| @Data | |||||
| @SuperBuilder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public static class SnapshotInfo { | |||||
| private String cameraCode; | |||||
| private String snapTime; | |||||
| private String snapType; | |||||
| private String pictureName; | |||||
| private String pictureSize; | |||||
| private String previewUrl; | |||||
| private String pictureUrl; | |||||
| private String reserve; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,100 @@ | |||||
| package com.inspect.simulator.view; | |||||
| import com.inspect.simulator.domain.ivs.IndexRange; | |||||
| import com.inspect.simulator.domain.ivs.TimeSpan; | |||||
| import lombok.AllArgsConstructor; | |||||
| import lombok.Builder; | |||||
| import lombok.Data; | |||||
| import lombok.NoArgsConstructor; | |||||
| import java.io.Serializable; | |||||
| import java.util.List; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public class IvsRecordListView implements Serializable { | |||||
| private IvsRecordListView.RecordInfos recordInfos; | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public static class PtzPresetInfo implements Serializable { | |||||
| private int presetIndex; | |||||
| private String presetName; | |||||
| private String reserve; | |||||
| private int focusSwitch; | |||||
| } | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public static class LockInfo implements Serializable { | |||||
| private int lockId; | |||||
| private String lockTime; | |||||
| private TimeSpan lockTimeSpan; | |||||
| private String lockDesc; | |||||
| private int operatorId; | |||||
| private String operatorName; | |||||
| private String reserve; | |||||
| } | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public static class BookmarkInfo implements Serializable { | |||||
| private int bookmarkId; | |||||
| private String bookmarkName; | |||||
| private String bookmarkTime; | |||||
| private String cameraCode; | |||||
| private String cameraName; | |||||
| private String userDomain; | |||||
| private int bookmarkCreatorId; | |||||
| private int bookmarkCreatorName; | |||||
| private String nvrCode; | |||||
| private String mbuDomain; | |||||
| private String reserve; | |||||
| } | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public static class RecordInfo implements Serializable { | |||||
| private String recordFileName; | |||||
| private int recordMethod; | |||||
| private String nvrCode; | |||||
| private String mbuDomain; | |||||
| private String recordType; | |||||
| private String alarmType; | |||||
| private TimeSpan recordTime; | |||||
| private int frameExtractionTimes; | |||||
| private IvsRecordListView.BookmarkInfo bookmarkInfo; | |||||
| private IvsRecordListView.LockInfo lockInfo; | |||||
| private IvsRecordListView.PtzPresetInfo ptzPresetInfo; | |||||
| private String reserve; | |||||
| } | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public static class RecordInfoList implements Serializable { | |||||
| private List<RecordInfo> recordInfo; | |||||
| } | |||||
| @Data | |||||
| @Builder | |||||
| @NoArgsConstructor | |||||
| @AllArgsConstructor | |||||
| public static class RecordInfos implements Serializable { | |||||
| private int total; | |||||
| private IndexRange indexRange; | |||||
| private String reserve; | |||||
| private IvsRecordListView.RecordInfoList recordInfoList; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,50 @@ | |||||
| server: | |||||
| port: 18530 | |||||
| spring: | |||||
| application: | |||||
| name: inspect-simulator-senior | |||||
| servlet: | |||||
| multipart: | |||||
| max-file-size: 20MB | |||||
| max-request-size: 60MB | |||||
| datasource: | |||||
| druid: | |||||
| stat-view-servlet: | |||||
| enabled: true | |||||
| loginUsername: admin | |||||
| loginPassword: 123456 | |||||
| dynamic: | |||||
| druid: | |||||
| initial-size: 5 | |||||
| min-idle: 5 | |||||
| maxActive: 20 | |||||
| maxWait: 60000 | |||||
| timeBetweenEvictionRunsMillis: 60000 | |||||
| minEvictableIdleTimeMillis: 300000 | |||||
| validationQuery: SELECT 1 FROM DUAL | |||||
| testWhileIdle: true | |||||
| testOnBorrow: false | |||||
| testOnReturn: false | |||||
| poolPreparedStatements: true | |||||
| maxPoolPreparedStatementPerConnectionSize: 20 | |||||
| filters: stat,slf4j | |||||
| connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 | |||||
| datasource: | |||||
| master: | |||||
| driver-class-name: com.mysql.cj.jdbc.Driver | |||||
| url: jdbc:mysql://localhost:3306/dliip?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 | |||||
| username: root | |||||
| password: atia2018 | |||||
| analysis: | |||||
| api: | |||||
| url: http://192.168.1.116:9911 | |||||
| token: 01234567890 | |||||
| upper: | |||||
| api: | |||||
| url: http://20.148.0.4:40029 | |||||
| platform: | |||||
| url: http://192.168.1.116:18530 | |||||
| @ -0,0 +1,51 @@ | |||||
| server: | |||||
| port: 18530 | |||||
| spring: | |||||
| application: | |||||
| name: inspect-simulator-senior | |||||
| servlet: | |||||
| multipart: | |||||
| max-file-size: 20MB | |||||
| max-request-size: 60MB | |||||
| datasource: | |||||
| druid: | |||||
| stat-view-servlet: | |||||
| enabled: true | |||||
| loginUsername: admin | |||||
| loginPassword: 123456 | |||||
| dynamic: | |||||
| druid: | |||||
| initial-size: 5 | |||||
| min-idle: 5 | |||||
| maxActive: 20 | |||||
| maxWait: 60000 | |||||
| timeBetweenEvictionRunsMillis: 60000 | |||||
| minEvictableIdleTimeMillis: 300000 | |||||
| validationQuery: SELECT 1 FROM DUAL | |||||
| testWhileIdle: true | |||||
| testOnBorrow: false | |||||
| testOnReturn: false | |||||
| poolPreparedStatements: true | |||||
| maxPoolPreparedStatementPerConnectionSize: 20 | |||||
| filters: stat,slf4j | |||||
| connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 | |||||
| datasource: | |||||
| master: | |||||
| driver-class-name: com.mysql.cj.jdbc.Driver | |||||
| url: jdbc:mysql://172.21.101.112:4406/dliip?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 | |||||
| username: root | |||||
| password: 123456 | |||||
| analysis: | |||||
| api: | |||||
| url: http://192.168.1.116:9911 | |||||
| token: 01234567890 | |||||
| upper: | |||||
| api: | |||||
| url: http://20.148.0.4:40029 | |||||
| platform: | |||||
| url: http://192.168.1.116:18530 | |||||
| @ -0,0 +1,51 @@ | |||||
| server: | |||||
| port: 18530 | |||||
| spring: | |||||
| application: | |||||
| name: inspect-simulator-senior | |||||
| servlet: | |||||
| multipart: | |||||
| max-file-size: 20MB | |||||
| max-request-size: 60MB | |||||
| datasource: | |||||
| druid: | |||||
| stat-view-servlet: | |||||
| enabled: true | |||||
| loginUsername: admin | |||||
| loginPassword: 123456 | |||||
| dynamic: | |||||
| druid: | |||||
| initial-size: 5 | |||||
| min-idle: 5 | |||||
| maxActive: 20 | |||||
| maxWait: 60000 | |||||
| timeBetweenEvictionRunsMillis: 60000 | |||||
| minEvictableIdleTimeMillis: 300000 | |||||
| validationQuery: SELECT 1 FROM DUAL | |||||
| testWhileIdle: true | |||||
| testOnBorrow: false | |||||
| testOnReturn: false | |||||
| poolPreparedStatements: true | |||||
| maxPoolPreparedStatementPerConnectionSize: 20 | |||||
| filters: stat,slf4j | |||||
| connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 | |||||
| datasource: | |||||
| master: | |||||
| driver-class-name: com.mysql.cj.jdbc.Driver | |||||
| url: jdbc:mysql://192.168.1.116:4406/inspect-milestone?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 | |||||
| username: root | |||||
| password: atia2018 | |||||
| analysis: | |||||
| api: | |||||
| url: http://192.168.1.116:9911 | |||||
| token: 01234567890 | |||||
| upper: | |||||
| api: | |||||
| url: http://20.148.0.4:40029 | |||||
| platform: | |||||
| url: http://192.168.1.116:18530 | |||||
| @ -0,0 +1,4 @@ | |||||
| spring: | |||||
| profiles: | |||||
| active: dev | |||||