commit
bfc9c0df6f
249 changed files with 26270 additions and 0 deletions
@ -0,0 +1,37 @@ |
|||||
|
target/ |
||||
|
!.mvn/wrapper/maven-wrapper.jar |
||||
|
!**/src/main/**/target/ |
||||
|
!**/src/test/**/target/ |
||||
|
|
||||
|
### IntelliJ IDEA ### |
||||
|
.idea/ |
||||
|
.jpb/ |
||||
|
*.iws |
||||
|
*.iml |
||||
|
*.ipr |
||||
|
logs/ |
||||
|
|
||||
|
### Eclipse ### |
||||
|
.apt_generated |
||||
|
.classpath |
||||
|
.factorypath |
||||
|
.project |
||||
|
.settings |
||||
|
.springBeans |
||||
|
.sts4-cache |
||||
|
|
||||
|
### NetBeans ### |
||||
|
/nbproject/private/ |
||||
|
/nbbuild/ |
||||
|
/dist/ |
||||
|
/nbdist/ |
||||
|
/.nb-gradle/ |
||||
|
build/ |
||||
|
!**/src/main/**/build/ |
||||
|
!**/src/test/**/build/ |
||||
|
|
||||
|
### VS Code ### |
||||
|
.vscode/ |
||||
|
|
||||
|
### Mac OS ### |
||||
|
.DS_Store!/ |
||||
Binary file not shown.
@ -0,0 +1,18 @@ |
|||||
|
# Licensed to the Apache Software Foundation (ASF) under one |
||||
|
# or more contributor license agreements. See the NOTICE file |
||||
|
# distributed with this work for additional information |
||||
|
# regarding copyright ownership. The ASF licenses this file |
||||
|
# to you under the Apache License, Version 2.0 (the |
||||
|
# "License"); you may not use this file except in compliance |
||||
|
# with the License. You may obtain a copy of the License at |
||||
|
# |
||||
|
# https://www.apache.org/licenses/LICENSE-2.0 |
||||
|
# |
||||
|
# Unless required by applicable law or agreed to in writing, |
||||
|
# software distributed under the License is distributed on an |
||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||||
|
# KIND, either express or implied. See the License for the |
||||
|
# specific language governing permissions and limitations |
||||
|
# under the License. |
||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip |
||||
|
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar |
||||
@ -0,0 +1,10 @@ |
|||||
|
# Getting Started |
||||
|
|
||||
|
### Reference Documentation |
||||
|
|
||||
|
For further reference, please consider the following sections: |
||||
|
|
||||
|
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) |
||||
|
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.7.11/maven-plugin/reference/html/) |
||||
|
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.7.11/maven-plugin/reference/html/#build-image) |
||||
|
|
||||
@ -0,0 +1,31 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<parent> |
||||
|
<artifactId>bolt-server</artifactId> |
||||
|
<groupId>com.jiluo.bolt</groupId> |
||||
|
<version>0.0.1-SNAPSHOT</version> |
||||
|
</parent> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<artifactId>bolt-api</artifactId> |
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework</groupId> |
||||
|
<artifactId>spring-context</artifactId> |
||||
|
<version>5.3.27</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>javax.validation</groupId> |
||||
|
<artifactId>validation-api</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.hibernate.validator</groupId> |
||||
|
<artifactId>hibernate-validator</artifactId> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
|
||||
|
</project> |
||||
File diff suppressed because it is too large
@ -0,0 +1,94 @@ |
|||||
|
package com.jiluo.bolt.Aladdin; |
||||
|
import java.io.UnsupportedEncodingException; |
||||
|
import com.jiluo.bolt.Aladdin.HaspStatus; |
||||
|
|
||||
|
public class HaspApiVersion |
||||
|
{ |
||||
|
private int major_version[] = { 0 }; |
||||
|
private int minor_version[] = { 0 }; |
||||
|
private int build_server[] = { 0 }; |
||||
|
private int build_number[] = { 0 }; |
||||
|
private int status; |
||||
|
|
||||
|
/** |
||||
|
* private native functions |
||||
|
* |
||||
|
*/ |
||||
|
private static native int GetVersion(int major_version[], |
||||
|
int minor_version[], |
||||
|
int build_server[], |
||||
|
int build_number[], |
||||
|
byte vendor_code[]); |
||||
|
|
||||
|
/** |
||||
|
* IA 64 not considered yet |
||||
|
*/ |
||||
|
static |
||||
|
{ |
||||
|
HaspStatus.Init(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* HaspApiVersion constructor |
||||
|
* |
||||
|
* @param vendor_code The Vendor Code. |
||||
|
* |
||||
|
*/ |
||||
|
public HaspApiVersion(String vendor_code) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
// Following code is added to ensure that byte array passed to JNI interface
|
||||
|
// is NULL terminated. Ideally the JNI GetVersion interface should be accepting
|
||||
|
// vendor_code as String like other JNI interface hasp_login, hasp_login_scope etc.
|
||||
|
// But changing JNI interface will result in incompatible function signature
|
||||
|
// Another solution will be to add new JNI interface
|
||||
|
int vc_bytes_count = vendor_code.length(); |
||||
|
byte tmp_vendor_code[] = new byte[vc_bytes_count + 1]; |
||||
|
|
||||
|
System.arraycopy(vendor_code.getBytes("UTF-8"), 0, tmp_vendor_code, 0, vc_bytes_count); |
||||
|
tmp_vendor_code[vc_bytes_count] = 0; // NULL termination
|
||||
|
|
||||
|
status = GetVersion(major_version, minor_version, build_server, build_number, tmp_vendor_code); |
||||
|
} |
||||
|
catch (UnsupportedEncodingException ex) |
||||
|
{ |
||||
|
// cannot happen, so ignore
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the error that occurred in the last function call. |
||||
|
*/ |
||||
|
public int getLastError() |
||||
|
{ |
||||
|
return status; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the HASP API major version. |
||||
|
*/ |
||||
|
public int majorVersion() |
||||
|
{ |
||||
|
return major_version[0]; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the HASP API minor version. |
||||
|
* |
||||
|
*/ |
||||
|
public int minorVersion() |
||||
|
{ |
||||
|
return minor_version[0]; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the HASP API build number. |
||||
|
* |
||||
|
*/ |
||||
|
public int buildNumber() |
||||
|
{ |
||||
|
return build_number[0]; |
||||
|
} |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,727 @@ |
|||||
|
package com.jiluo.bolt.Aladdin; |
||||
|
|
||||
|
public class HaspStatus |
||||
|
{ |
||||
|
/** |
||||
|
* return codes |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
* Request successfully completed |
||||
|
*/ |
||||
|
public static final int HASP_STATUS_OK = 0; |
||||
|
|
||||
|
/** |
||||
|
* Request exceeds memory range of a Sentinel file |
||||
|
*/ |
||||
|
public static final int HASP_MEM_RANGE = 1; |
||||
|
|
||||
|
/** |
||||
|
* Legacy HASP HL Run-time API: Unknown/Invalid Feature ID option |
||||
|
*/ |
||||
|
public static final int HASP_INV_PROGNUM_OPT = 2; |
||||
|
|
||||
|
/** |
||||
|
* System is out of memory |
||||
|
*/ |
||||
|
public static final int HASP_INSUF_MEM = 3; |
||||
|
|
||||
|
/** |
||||
|
* Too many open Features/login sessions |
||||
|
*/ |
||||
|
public static final int HASP_TMOF = 4; |
||||
|
|
||||
|
/** |
||||
|
* Access to Feature, Sentinel protection key or functionality denied |
||||
|
*/ |
||||
|
public static final int HASP_ACCESS_DENIED = 5; |
||||
|
|
||||
|
/** |
||||
|
* Legacy decryption function cannot work on Feature |
||||
|
*/ |
||||
|
public static final int HASP_INCOMPAT_FEATURE = 6; |
||||
|
|
||||
|
/** |
||||
|
* Sentinel protection key not available |
||||
|
*/ |
||||
|
public static final int HASP_HASP_NOT_FOUND = 7; |
||||
|
|
||||
|
/** |
||||
|
* Deprecated - use HASP_HASP_NOT_FOUND |
||||
|
*/ |
||||
|
public static final int HASP_CONTAINER_NOT_FOUND = 7; |
||||
|
|
||||
|
/** |
||||
|
* Encrypted/decrypted data length too short to execute function call |
||||
|
*/ |
||||
|
public static final int HASP_TOO_SHORT = 8; |
||||
|
|
||||
|
/** |
||||
|
* Invalid login handle passed to function |
||||
|
*/ |
||||
|
public static final int HASP_INV_HND = 9; |
||||
|
|
||||
|
/** |
||||
|
* Specified File ID not recognized by API |
||||
|
*/ |
||||
|
public static final int HASP_INV_FILEID = 10; |
||||
|
|
||||
|
/** |
||||
|
* Installed driver or daemon too old to execute function |
||||
|
*/ |
||||
|
public static final int HASP_OLD_DRIVER = 11; |
||||
|
|
||||
|
/** |
||||
|
* Real-time clock (rtc) not available |
||||
|
*/ |
||||
|
public static final int HASP_NO_TIME = 12; |
||||
|
|
||||
|
/** |
||||
|
* Generic error from host system call |
||||
|
*/ |
||||
|
public static final int HASP_SYS_ERR = 13; |
||||
|
|
||||
|
/** |
||||
|
* Required driver not installed |
||||
|
*/ |
||||
|
public static final int HASP_NO_DRIVER = 14; |
||||
|
|
||||
|
/** |
||||
|
* Invalid XML format |
||||
|
*/ |
||||
|
public static final int HASP_INV_FORMAT = 15; |
||||
|
|
||||
|
/** |
||||
|
* Unable to execute function in this context; the requested |
||||
|
* functionality is not implemented |
||||
|
*/ |
||||
|
public static final int HASP_REQ_NOT_SUPP = 16; |
||||
|
|
||||
|
/** |
||||
|
* Binary data passed to function does not contain valid update |
||||
|
*/ |
||||
|
public static final int HASP_INV_UPDATE_OBJ = 17; |
||||
|
|
||||
|
/** |
||||
|
* Sentinel protection key not found |
||||
|
*/ |
||||
|
public static final int HASP_KEYID_NOT_FOUND = 18; |
||||
|
|
||||
|
/** |
||||
|
* Required XML tags not found; Contents in binary data are missing |
||||
|
* or invalid |
||||
|
*/ |
||||
|
public static final int HASP_INV_UPDATE_DATA = 19; |
||||
|
|
||||
|
/** |
||||
|
* Update request not supported by Sentinel protection key |
||||
|
*/ |
||||
|
public static final int HASP_INV_UPDATE_NOTSUPP = 20; |
||||
|
|
||||
|
/** |
||||
|
* Update counter set incorrectly |
||||
|
*/ |
||||
|
public static final int HASP_INV_UPDATE_CNTR = 21; |
||||
|
|
||||
|
/** |
||||
|
* Invalid Vendor Code passed |
||||
|
*/ |
||||
|
public static final int HASP_INV_VCODE = 22; |
||||
|
|
||||
|
/** |
||||
|
* Sentinel protection key does not support encryption type |
||||
|
*/ |
||||
|
public static final int HASP_ENC_NOT_SUPP = 23; |
||||
|
|
||||
|
/** |
||||
|
* Passed time value outside supported value range |
||||
|
*/ |
||||
|
public static final int HASP_INV_TIME = 24; |
||||
|
|
||||
|
/** |
||||
|
* Real-time clock battery out of power |
||||
|
*/ |
||||
|
public static final int HASP_NO_BATTERY_POWER = 25; |
||||
|
|
||||
|
/** |
||||
|
* Acknowledge data requested by update, but ack_data parameter |
||||
|
* is NULL |
||||
|
*/ |
||||
|
public static final int HASP_NO_ACK_SPACE = 26; |
||||
|
|
||||
|
/** |
||||
|
* Program running on a terminal server |
||||
|
*/ |
||||
|
public static final int HASP_TS_DETECTED = 27; |
||||
|
|
||||
|
/** |
||||
|
* Requested Feature type not implemented |
||||
|
*/ |
||||
|
public static final int HASP_FEATURE_TYPE_NOT_IMPL = 28; |
||||
|
|
||||
|
/** |
||||
|
* Unknown algorithm used in H2R/V2C file |
||||
|
*/ |
||||
|
public static final int HASP_UNKNOWN_ALG = 29; |
||||
|
|
||||
|
/** |
||||
|
* Signature verification operation failed |
||||
|
*/ |
||||
|
public static final int HASP_INV_SIG = 30; |
||||
|
|
||||
|
/** |
||||
|
* Requested Feature not available |
||||
|
*/ |
||||
|
public static final int HASP_FEATURE_NOT_FOUND = 31; |
||||
|
|
||||
|
/** |
||||
|
* Access log not enabled |
||||
|
*/ |
||||
|
public static final int HASP_NO_LOG = 32; |
||||
|
|
||||
|
/** |
||||
|
* Communication error between API and local Sentinel License Manager |
||||
|
*/ |
||||
|
public static final int HASP_LOCAL_COMM_ERR = 33; |
||||
|
|
||||
|
/** |
||||
|
* Vendor Code not recognized by API |
||||
|
*/ |
||||
|
public static final int HASP_UNKNOWN_VCODE = 34; |
||||
|
|
||||
|
/** |
||||
|
* Invalid XML specification |
||||
|
*/ |
||||
|
public static final int HASP_INV_SPEC = 35; |
||||
|
|
||||
|
/** |
||||
|
* Invalid XML scope |
||||
|
*/ |
||||
|
public static final int HASP_INV_SCOPE = 36; |
||||
|
|
||||
|
/** |
||||
|
* Too many Sentinel HASP protection keys currently connected |
||||
|
*/ |
||||
|
public static final int HASP_TOO_MANY_KEYS = 37; |
||||
|
|
||||
|
/** |
||||
|
* Too many concurrent user sessions currently connected |
||||
|
*/ |
||||
|
public static final int HASP_TOO_MANY_USERS = 38; |
||||
|
|
||||
|
/** |
||||
|
* Session has been interrupted |
||||
|
*/ |
||||
|
public static final int HASP_BROKEN_SESSION = 39; |
||||
|
|
||||
|
/** |
||||
|
* Communication error between local and remote HASP License Manager |
||||
|
*/ |
||||
|
public static final int HASP_REMOTE_COMM_ERR = 40; |
||||
|
|
||||
|
/** |
||||
|
* Feature expired |
||||
|
*/ |
||||
|
public static final int HASP_FEATURE_EXPIRED = 41; |
||||
|
|
||||
|
/** |
||||
|
* HASP License Manager version too old |
||||
|
*/ |
||||
|
public static final int HASP_OLD_LM = 42; |
||||
|
|
||||
|
/** |
||||
|
* Input/Output error occurred in secure storage area of HASP SL key OR |
||||
|
* a USB error occurred when communicating with a HASP HL key |
||||
|
*/ |
||||
|
public static final int HASP_DEVICE_ERR = 43; |
||||
|
|
||||
|
/** |
||||
|
* Update installation not permitted; This update was already applied |
||||
|
*/ |
||||
|
public static final int HASP_UPDATE_BLOCKED = 44; |
||||
|
|
||||
|
/** |
||||
|
* System time has been tampered with |
||||
|
*/ |
||||
|
public static final int HASP_TIME_ERR = 45; |
||||
|
|
||||
|
/** |
||||
|
* Communication error occurred in secure channel |
||||
|
*/ |
||||
|
public static final int HASP_SCHAN_ERR = 46; |
||||
|
|
||||
|
/** |
||||
|
* Corrupt data exists in secure storage area of HASP SL protection key |
||||
|
*/ |
||||
|
public static final int HASP_STORAGE_CORRUPT = 47; |
||||
|
|
||||
|
/** |
||||
|
* Unable to find Vendor library |
||||
|
*/ |
||||
|
public static final int HASP_NO_VLIB = 48; |
||||
|
|
||||
|
/** |
||||
|
* Unable to load Vendor library |
||||
|
*/ |
||||
|
public static final int HASP_INV_VLIB = 49; |
||||
|
|
||||
|
/** |
||||
|
* Unable to locate any Features matching scope |
||||
|
*/ |
||||
|
public static final int HASP_SCOPE_RESULTS_EMPTY = 50; |
||||
|
|
||||
|
/** |
||||
|
* Program running on a virtual machine |
||||
|
*/ |
||||
|
public static final int HASP_VM_DETECTED = 51; |
||||
|
|
||||
|
/** |
||||
|
* HASP SL key incompatible with machine hardware; HASP SL key is locked |
||||
|
* to different hardware. OR: |
||||
|
* In the case of a V2C file, conflict between HASP SL key data and machine |
||||
|
* hardware data; HASP SL key locked to different hardware |
||||
|
*/ |
||||
|
public static final int HASP_HARDWARE_MODIFIED = 52; |
||||
|
|
||||
|
/** |
||||
|
* Login denied because of user restrictions |
||||
|
*/ |
||||
|
public static final int HASP_USER_DENIED = 53; |
||||
|
|
||||
|
/** |
||||
|
* Trying to install a V2C file with an update counter that is out of |
||||
|
* sequence with the update counter on Sentinel HASP protection key. The |
||||
|
* update counter value in the V2C file is lower than the value in Sentinel |
||||
|
* HASP protection key. |
||||
|
*/ |
||||
|
public static final int HASP_UPDATE_TOO_OLD = 54; |
||||
|
|
||||
|
/** |
||||
|
* Trying to install a V2C file with an update counter that is out of |
||||
|
* sequence with update counter in Sentinel HASP protection key. The first |
||||
|
* value in the V2C file is greater than the value in Sentinel HASP |
||||
|
* protection key. |
||||
|
*/ |
||||
|
public static final int HASP_UPDATE_TOO_NEW = 55; |
||||
|
|
||||
|
/** |
||||
|
* Vendor library version too old |
||||
|
*/ |
||||
|
public static final int HASP_OLD_VLIB = 56; |
||||
|
|
||||
|
/** |
||||
|
* Upload via ACC failed, e.g. because of illegal format |
||||
|
*/ |
||||
|
public static final int HASP_UPLOAD_ERROR = 57; |
||||
|
|
||||
|
/** |
||||
|
* Invalid XML "recipient" parameter |
||||
|
*/ |
||||
|
public static final int HASP_INV_RECIPIENT = 58; |
||||
|
|
||||
|
/** |
||||
|
* Invalid XML "action" parameter |
||||
|
*/ |
||||
|
public static final int HASP_INV_DETACH_ACTION = 59; |
||||
|
|
||||
|
/** |
||||
|
* Scope does not specify a unique Product |
||||
|
*/ |
||||
|
public static final int HASP_TOO_MANY_PRODUCTS = 60; |
||||
|
|
||||
|
/** |
||||
|
* Invalid Product information |
||||
|
*/ |
||||
|
public static final int HASP_INV_PRODUCT = 61; |
||||
|
|
||||
|
/** |
||||
|
* Unknown Recipient; update can only be applied to the |
||||
|
* Recipient specified in detach(), and not to this computer |
||||
|
*/ |
||||
|
public static final int HASP_UNKNOWN_RECIPIENT = 62; |
||||
|
|
||||
|
/** |
||||
|
* Invalid duration |
||||
|
*/ |
||||
|
public static final int HASP_INV_DURATION = 63; |
||||
|
|
||||
|
/** |
||||
|
* Cloned secure storage area detected |
||||
|
*/ |
||||
|
public static final int HASP_CLONE_DETECTED = 64; |
||||
|
|
||||
|
/** |
||||
|
* Specified V2C update already installed in the LLM |
||||
|
*/ |
||||
|
public static final int HASP_UPDATE_ALREADY_ADDED = 65; |
||||
|
|
||||
|
/** |
||||
|
* Specified Hasp Id is in Inactive state |
||||
|
*/ |
||||
|
public static final int HASP_HASP_INACTIVE = 66; |
||||
|
|
||||
|
/** |
||||
|
* No detachable feature exists |
||||
|
*/ |
||||
|
public static final int HASP_NO_DETACHABLE_FEATURE = 67; |
||||
|
|
||||
|
/** |
||||
|
* No detachable feature exists (typo; kept for compatibility) |
||||
|
*/ |
||||
|
public static final int HASP_NO_DEATCHABLE_FEATURE = 67; |
||||
|
|
||||
|
/** |
||||
|
* scope does not specify a unique Host |
||||
|
*/ |
||||
|
public static final int HASP_TOO_MANY_HOSTS = 68; |
||||
|
|
||||
|
/** |
||||
|
* Rehost is not allowed for any license |
||||
|
*/ |
||||
|
public static final int HASP_REHOST_NOT_ALLOWED = 69; |
||||
|
|
||||
|
/** |
||||
|
* License is rehosted to other machine |
||||
|
*/ |
||||
|
public static final int HASP_LICENSE_REHOSTED = 70; |
||||
|
|
||||
|
/** |
||||
|
* Old rehost license try to apply |
||||
|
*/ |
||||
|
public static final int HASP_REHOST_ALREADY_APPLIED = 71; |
||||
|
|
||||
|
/** |
||||
|
* File not found or access denied |
||||
|
*/ |
||||
|
public static final int HASP_CANNOT_READ_FILE = 72; |
||||
|
|
||||
|
/** |
||||
|
* Extension of license not allowed as number of detached |
||||
|
* licenses is greater than current concurrency count |
||||
|
*/ |
||||
|
public static final int HASP_EXTENSION_NOT_ALLOWED = 73; |
||||
|
|
||||
|
/** |
||||
|
* Detach of license not allowed as product |
||||
|
* contains VM disabled feature and host machine is a virtual machine |
||||
|
*/ |
||||
|
public static final int HASP_DETACH_DISABLED = 74; |
||||
|
|
||||
|
/** |
||||
|
* Rehost of license not allowed as container |
||||
|
* contains VM disabled feature and host machine is a virtual machine |
||||
|
*/ |
||||
|
public static final int HASP_REHOST_DISABLED = 75; |
||||
|
|
||||
|
/** |
||||
|
* Format SL-AdminMode or migrate SL-Legacy to SL-AdminMode not allowed |
||||
|
* as container has detached license |
||||
|
*/ |
||||
|
public static final int HASP_DETACHED_LICENSE_FOUND = 76; |
||||
|
|
||||
|
/** |
||||
|
* Recipient of the requested operation is older than expected |
||||
|
*/ |
||||
|
public static final int HASP_RECIPIENT_OLD_LM = 77; |
||||
|
|
||||
|
/** |
||||
|
* Secure storage ID mismatch |
||||
|
*/ |
||||
|
public static final int HASP_SECURE_STORE_ID_MISMATCH = 78; |
||||
|
|
||||
|
/** |
||||
|
* Duplicate Hostname found while key contains Hostname Fingerprinting |
||||
|
*/ |
||||
|
public static final int HASP_DUPLICATE_HOSTNAME = 79; |
||||
|
|
||||
|
/** |
||||
|
* The Sentinel License Manager is required for this operation |
||||
|
*/ |
||||
|
public static final int HASP_MISSING_LM = 80; |
||||
|
|
||||
|
/** |
||||
|
* Attempting to consume multiple executions during log in to a Feature. |
||||
|
* However, the license for the Feature does not contain enough remaining executions |
||||
|
*/ |
||||
|
public static final int HASP_FEATURE_INSUFFICIENT_EXECUTION_COUNT = 81; |
||||
|
|
||||
|
/** |
||||
|
* Attempting to perform an operation not compatible with target platform |
||||
|
*/ |
||||
|
public static final int HASP_INCOMPATIBLE_PLATFORM = 82; |
||||
|
|
||||
|
/** |
||||
|
* The key is disabled due to suspected tampering |
||||
|
*/ |
||||
|
public static final int HASP_HASP_DISABLED = 83; |
||||
|
|
||||
|
/** |
||||
|
* The key is inaccessible due to sharing |
||||
|
*/ |
||||
|
public static final int HASP_SHARING_VIOLATION = 84; |
||||
|
|
||||
|
/** |
||||
|
* The session was killed due a network malfunction or manually from ACC |
||||
|
*/ |
||||
|
public static final int HASP_KILLED_SESSION = 85; |
||||
|
|
||||
|
/** |
||||
|
* Program running on a virtual storage |
||||
|
*/ |
||||
|
public static final int HASP_VS_DETECTED = 86; |
||||
|
|
||||
|
/** |
||||
|
* An identity is required |
||||
|
*/ |
||||
|
public static final int HASP_IDENTITY_REQUIRED = 87; |
||||
|
|
||||
|
/** |
||||
|
* The identity is not authenticated |
||||
|
*/ |
||||
|
public static final int HASP_IDENTITY_UNAUTHENTICATED = 88; |
||||
|
|
||||
|
/** |
||||
|
* The identity is disabled |
||||
|
*/ |
||||
|
public static final int HASP_IDENTITY_DISABLED = 89; |
||||
|
|
||||
|
/** |
||||
|
* The identity doesn't have enough permission for the operation |
||||
|
*/ |
||||
|
public static final int HASP_IDENTITY_DENIED = 90; |
||||
|
|
||||
|
/** |
||||
|
* A session for this identity from a different machine already exists |
||||
|
*/ |
||||
|
public static final int HASP_IDENTITY_SHARING_VIOLATION = 91; |
||||
|
|
||||
|
/** |
||||
|
* The maximum number of machines usable by the identity was reached |
||||
|
*/ |
||||
|
public static final int HASP_IDENTITY_TOO_MANY_MACHINES = 92; |
||||
|
|
||||
|
/** |
||||
|
* The server is not ready to authenticate |
||||
|
*/ |
||||
|
public static final int HASP_IDENTITY_SERVER_NOT_READY = 93; |
||||
|
|
||||
|
/** |
||||
|
* Trying to install a V2C file with an update counter that is out of |
||||
|
* sync with update counter in the Sentinel protection key |
||||
|
*/ |
||||
|
public static final int HASP_UPDATE_OUT_OF_SYNC = 94; |
||||
|
|
||||
|
/** |
||||
|
* Multiple attemps to access the key from remote with a proxy |
||||
|
*/ |
||||
|
public static final int HASP_REMOTE_SHARING_VIOLATION = 95; |
||||
|
|
||||
|
/** |
||||
|
* The session was released because the seat was requested from a different location |
||||
|
*/ |
||||
|
public static final int HASP_CLOUD_SESSION_OCCUPIED_REMOTELY = 96; |
||||
|
|
||||
|
/** |
||||
|
* Cloud licensing authorization is required to use this license |
||||
|
*/ |
||||
|
public static final int HASP_CLOUD_MISSING_AUTHORIZATION = 97; |
||||
|
|
||||
|
/** |
||||
|
* Invalid seat value in network detach. Seat count cannot be decreased when modifying a detach |
||||
|
*/ |
||||
|
public static final int HASP_INV_NETWORK_SEATS = 98; |
||||
|
|
||||
|
/** |
||||
|
* Network detach is disabled on products with only unlimited concurrency features |
||||
|
*/ |
||||
|
public static final int HASP_NETWORK_DETACH_DISABLED = 99; |
||||
|
|
||||
|
/** |
||||
|
* The requested cloud functionality is not supported |
||||
|
*/ |
||||
|
public static final int HASP_CLOUD_NOT_SUPP = 100; |
||||
|
|
||||
|
/** |
||||
|
* Only trusted licenses can be installed in the trusted license storage |
||||
|
*/ |
||||
|
public static final int HASP_CLOUD_NOT_TRUSTED = 101; |
||||
|
|
||||
|
/** |
||||
|
* Communication error with the license storage |
||||
|
*/ |
||||
|
public static final int HASP_CLOUD_STORAGE_COMM_ERR = 102; |
||||
|
|
||||
|
/** |
||||
|
* The identity is expired |
||||
|
*/ |
||||
|
public static final int HASP_IDENTITY_EXPIRED = 103; |
||||
|
|
||||
|
/** |
||||
|
* Invalid option value |
||||
|
*/ |
||||
|
public static final int HASP_INV_OPTION = 104; |
||||
|
|
||||
|
/** |
||||
|
* Busy error with the license storage |
||||
|
*/ |
||||
|
public static final int HASP_CLOUD_STORAGE_BUSY = 105; |
||||
|
|
||||
|
/** |
||||
|
* This machine cannot be used |
||||
|
*/ |
||||
|
public static final int HASP_MACHINE_DENIED = 106; |
||||
|
|
||||
|
/** |
||||
|
* This machine is disabled |
||||
|
*/ |
||||
|
public static final int HASP_MACHINE_DISABLED = 107; |
||||
|
|
||||
|
/** |
||||
|
* The rate at which identity requests are received exceeds the contracted limit |
||||
|
*/ |
||||
|
public static final int HASP_IDENTITY_RATE_LIMIT_EXCEEDED = 108; |
||||
|
|
||||
|
/** |
||||
|
* Feature start date not yet reached |
||||
|
*/ |
||||
|
public static final int HASP_FEATURE_START_DATE_NOT_REACHED = 109; |
||||
|
|
||||
|
/** |
||||
|
* API dispatcher: API for this Vendor Code was not found |
||||
|
*/ |
||||
|
public static final int HASP_NO_API_DYLIB = 400; |
||||
|
|
||||
|
/** |
||||
|
* API dispatcher: Unable to load API; DLL possibly corrupt? |
||||
|
*/ |
||||
|
public static final int HASP_INV_API_DYLIB = 401; |
||||
|
|
||||
|
/** |
||||
|
* API dispatcher: Unable to find API function; DLL possibly old? |
||||
|
*/ |
||||
|
public static final int HASP_INCOMPLETE_API_DYLIB = 402; |
||||
|
|
||||
|
/** |
||||
|
* C++ API: Object incorrectly initialized |
||||
|
*/ |
||||
|
public static final int HASP_INVALID_OBJECT = 500; |
||||
|
|
||||
|
/** |
||||
|
* Invalid function parameter |
||||
|
*/ |
||||
|
public static final int HASP_INV_PARAM = 501; |
||||
|
|
||||
|
/** |
||||
|
* C++ API: Logging in twice to the same object |
||||
|
*/ |
||||
|
public static final int HASP_ALREADY_LOGGED_IN = 502; |
||||
|
|
||||
|
/** |
||||
|
* C++ API: Logging out twice of the same object |
||||
|
*/ |
||||
|
public static final int HASP_ALREADY_LOGGED_OUT = 503; |
||||
|
|
||||
|
/** |
||||
|
* .NET API: Incorrect use of system or platform |
||||
|
*/ |
||||
|
public static final int HASP_OPERATION_FAILED = 525; |
||||
|
|
||||
|
/* |
||||
|
* Internal use: no classic memory extension block available |
||||
|
*/ |
||||
|
public static final int HASP_NO_EXTBLOCK = 600; |
||||
|
|
||||
|
/* |
||||
|
* Internal use: invalid port type |
||||
|
*/ |
||||
|
public static final int HASP_INV_PORT_TYPE = 650; |
||||
|
|
||||
|
/* |
||||
|
* Internal use: invalid port value |
||||
|
*/ |
||||
|
public static final int HASP_INV_PORT = 651; |
||||
|
|
||||
|
/* |
||||
|
* Dot-Net DLL found broken |
||||
|
*/ |
||||
|
public static final int HASP_NET_DLL_BROKEN = 652; |
||||
|
|
||||
|
/** |
||||
|
* Requested function not implemented |
||||
|
*/ |
||||
|
public static final int HASP_NOT_IMPL = 698; |
||||
|
|
||||
|
/** |
||||
|
* Internal error occurred in API |
||||
|
*/ |
||||
|
public static final int HASP_INT_ERR = 699; |
||||
|
|
||||
|
/* |
||||
|
* Reserved for Sentinel helper libraries |
||||
|
*/ |
||||
|
public static final int HASP_FIRST_HELPER = 2001; |
||||
|
|
||||
|
/* |
||||
|
* Reserved for Sentinel Activation API |
||||
|
*/ |
||||
|
public static final int HASP_FIRST_HASP_ACT = 3001; |
||||
|
|
||||
|
public static final int HASP_NEXT_FREE_VALUES = 7001; |
||||
|
|
||||
|
public static String runtime_library_default = "HASPJava"; |
||||
|
public static String runtime_library_x64_windows = "HASPJava_x64"; |
||||
|
public static String runtime_library_x64_linux = "HASPJava_x86_64"; |
||||
|
public static String runtime_library_armhf_linux = "HASPJava_armhf"; |
||||
|
public static String runtime_library_arm64_linux = "HASPJava_arm64"; |
||||
|
|
||||
|
public static void Init() |
||||
|
{ |
||||
|
String operatingSystem = System.getProperty("os.name"); |
||||
|
String architecture = System.getProperty("os.arch"); |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
if (operatingSystem.indexOf("Windows") != -1) |
||||
|
{ |
||||
|
if (architecture.equals("x86_64") || architecture.equals("amd64")) |
||||
|
{ |
||||
|
System.loadLibrary(runtime_library_x64_windows); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
System.loadLibrary(runtime_library_default); |
||||
|
} |
||||
|
} |
||||
|
else if (operatingSystem.indexOf("Linux") != -1) |
||||
|
{ |
||||
|
if (architecture.equals("x86_64") || architecture.equals("amd64")) |
||||
|
{ |
||||
|
System.loadLibrary(runtime_library_x64_linux); |
||||
|
} |
||||
|
else if (architecture.equals("arm")) |
||||
|
{ |
||||
|
System.loadLibrary(runtime_library_armhf_linux); |
||||
|
} |
||||
|
else if (architecture.equals("aarch64")) |
||||
|
{ |
||||
|
System.loadLibrary(runtime_library_arm64_linux); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
System.loadLibrary(runtime_library_default); |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
System.loadLibrary(runtime_library_default); |
||||
|
} |
||||
|
} |
||||
|
catch (UnsatisfiedLinkError e) |
||||
|
{ |
||||
|
if (e.getMessage().indexOf("already loaded in another classloader") == -1) |
||||
|
{ |
||||
|
throw e; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,118 @@ |
|||||
|
package com.jiluo.bolt.Aladdin; |
||||
|
|
||||
|
import com.jiluo.bolt.Aladdin.HaspStatus; |
||||
|
|
||||
|
public class HaspTime |
||||
|
{ |
||||
|
private long time[] = {0}; |
||||
|
private int day[] = {0}; |
||||
|
private int month[] = {0}; |
||||
|
private int year[] = {0}; |
||||
|
private int hour[] = {0}; |
||||
|
private int minute[] = {0}; |
||||
|
private int second[] = {0}; |
||||
|
private int status; |
||||
|
|
||||
|
/* |
||||
|
* private native functions |
||||
|
* |
||||
|
*/ |
||||
|
private static native int DatetimeToHasptime(int day, int month, int year, int hour, int minute, int second, long time[]); |
||||
|
private static native int HasptimeToDatetime(long time, int day[], int month[], int year[],int hour[], int minute[], int second[]); |
||||
|
|
||||
|
/** |
||||
|
* IA 64 not considered yet |
||||
|
*/ |
||||
|
static |
||||
|
{ |
||||
|
HaspStatus.Init(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* HaspTime constructor. |
||||
|
* |
||||
|
* @param year input year |
||||
|
* @param month input month |
||||
|
* @param day input day |
||||
|
* @param hour input hour |
||||
|
* @param minute input minute |
||||
|
* @param second input second |
||||
|
* |
||||
|
*/ |
||||
|
public HaspTime(int year, int month, int day, int hour, |
||||
|
int minute, int second) |
||||
|
{ |
||||
|
status = DatetimeToHasptime(day, month, year, hour, minute, second, time); |
||||
|
} |
||||
|
|
||||
|
public HaspTime(long hasptime) |
||||
|
{ |
||||
|
time[0] = hasptime; |
||||
|
status = HasptimeToDatetime(hasptime,day,month,year,hour,minute,second); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the error that occurred in the last function call. |
||||
|
*/ |
||||
|
public int getLastError() |
||||
|
{ |
||||
|
return status; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the HASP Time value in UTC format. |
||||
|
*/ |
||||
|
public long getHaspTime() |
||||
|
{ |
||||
|
return time[0]; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the month value of the time. |
||||
|
*/ |
||||
|
public int getMonth() |
||||
|
{ |
||||
|
return month[0]; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the year value of the time. |
||||
|
*/ |
||||
|
public int getYear() |
||||
|
{ |
||||
|
return year[0]; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the day value of the time. |
||||
|
*/ |
||||
|
public int getDay() |
||||
|
{ |
||||
|
return day[0]; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the hour value of the time. |
||||
|
*/ |
||||
|
public int getHour() |
||||
|
{ |
||||
|
return hour[0]; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the minute value of the time. |
||||
|
*/ |
||||
|
public int getMinute() |
||||
|
{ |
||||
|
return minute[0]; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Returns the second value of the time. |
||||
|
*/ |
||||
|
public int getSecond() |
||||
|
{ |
||||
|
return second[0]; |
||||
|
} |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.jiluo.bolt.common; |
||||
|
|
||||
|
import com.alibaba.fastjson.serializer.ValueFilter; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/04/28/9:40 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
public class BigDecimalValueFilter implements ValueFilter { |
||||
|
@Override |
||||
|
public Object process(Object object, String name, Object value) { |
||||
|
if (value instanceof BigDecimal) { |
||||
|
value = ((BigDecimal) value).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
||||
|
return String.format("%.2f", value); |
||||
|
} |
||||
|
return value; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
package com.jiluo.bolt.common; |
||||
|
|
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/10/17/10:33 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Getter |
||||
|
public enum CameraDriverEnum { |
||||
|
LucidCamera("lucid_camera","Lucid"), |
||||
|
BaslerCamera("basler_camera","Basler"), |
||||
|
BaumerCamera("baumer_camera","Baumer"); |
||||
|
|
||||
|
String vender; |
||||
|
|
||||
|
String driverName; |
||||
|
|
||||
|
CameraDriverEnum(String vender, String driverName){ |
||||
|
this.vender = vender; |
||||
|
this.driverName = driverName; |
||||
|
} |
||||
|
|
||||
|
public static String getDriverName(String vender){ |
||||
|
for (CameraDriverEnum driver: CameraDriverEnum.values()) { |
||||
|
if (driver.getVender().equals(vender)){ |
||||
|
return driver.getDriverName(); |
||||
|
} |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,50 @@ |
|||||
|
package com.jiluo.bolt.common; |
||||
|
|
||||
|
import lombok.Getter; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.RoundingMode; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/04/27/14:12 |
||||
|
* @Description:检测结果缺陷类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
public enum DefectType { |
||||
|
bolt("螺栓松动", DetectType.BOLT_AND_LINE, 0), |
||||
|
|
||||
|
line("引出线变形", DetectType.BOLT_AND_LINE, 0), |
||||
|
|
||||
|
pole("磁极开闸", DetectType.BOLT_AND_LINE, 0), |
||||
|
|
||||
|
temperature("无线测温", DetectType.TEMPERATURE, 0); |
||||
|
|
||||
|
@Getter |
||||
|
String desc; |
||||
|
|
||||
|
@Getter |
||||
|
DetectType detectType; |
||||
|
|
||||
|
@Getter |
||||
|
BigDecimal defaultValue; |
||||
|
|
||||
|
DefectType(String desc, DetectType detectType, int defaultValue) { |
||||
|
this.desc = desc; |
||||
|
this.detectType = detectType; |
||||
|
this.defaultValue = new BigDecimal(defaultValue).setScale(2, RoundingMode.HALF_UP); |
||||
|
} |
||||
|
|
||||
|
public static DefectType toDefectType(String type) { |
||||
|
return Arrays.stream(DefectType.values()).filter(_t -> _t.getDesc().equalsIgnoreCase(type) || _t.name().equalsIgnoreCase(type)).findFirst().orElse(null); |
||||
|
} |
||||
|
|
||||
|
public static List<DefectType> defectTypes(String product) { |
||||
|
return Arrays.stream(DefectType.values()).filter(_t -> _t.getDetectType().getProduct().equalsIgnoreCase(product)).collect(Collectors.toList()); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
package com.jiluo.bolt.common; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/05/11/16:12 |
||||
|
* @Description:检测结果描述 |
||||
|
*/ |
||||
|
@Data |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
@Builder |
||||
|
public class DetectAttribute { |
||||
|
private String productId; |
||||
|
|
||||
|
private String productName; |
||||
|
|
||||
|
private Integer detectZone; |
||||
|
|
||||
|
private Integer detectTotal; |
||||
|
|
||||
|
private Integer detectDuration; |
||||
|
|
||||
|
private Integer defectTotal; |
||||
|
|
||||
|
private Map<String, List<Integer>> defectZone; |
||||
|
|
||||
|
private String detectTrack; |
||||
|
} |
||||
@ -0,0 +1,68 @@ |
|||||
|
package com.jiluo.bolt.common; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/05/11/14:19 |
||||
|
* @Description:检测参数配置 |
||||
|
*/ |
||||
|
@Data |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
@Builder |
||||
|
public class DetectConfig { |
||||
|
|
||||
|
private Boolean bolt; |
||||
|
|
||||
|
private Boolean line; |
||||
|
|
||||
|
private Boolean pole; |
||||
|
|
||||
|
private Boolean temp; |
||||
|
|
||||
|
private Double detect_threshold_bolt; |
||||
|
|
||||
|
private Double detect_threshold_line; |
||||
|
|
||||
|
private Double detect_threshold_pole; |
||||
|
|
||||
|
private Double detect_threshold_temperature; |
||||
|
|
||||
|
private Integer detect_duration; |
||||
|
|
||||
|
private Integer detect_work_zone; |
||||
|
|
||||
|
private String defect_work_dir; |
||||
|
|
||||
|
private Integer delayDetect; |
||||
|
|
||||
|
private String plc_ip; |
||||
|
|
||||
|
private Integer plc_delay; |
||||
|
|
||||
|
private String serial_number; |
||||
|
|
||||
|
private Integer width; |
||||
|
|
||||
|
private Integer height; |
||||
|
|
||||
|
private Double fps; |
||||
|
|
||||
|
private Double exposureTime; |
||||
|
|
||||
|
private String jobId; |
||||
|
|
||||
|
private String algorithm_id; |
||||
|
|
||||
|
private String algorithm_type; |
||||
|
|
||||
|
private String algorithm_name; |
||||
|
|
||||
|
private String algorithm_model; |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
package com.jiluo.bolt.common; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/03/19:56 |
||||
|
* @Description:检测任务 |
||||
|
*/ |
||||
|
|
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class DetectJob { |
||||
|
private String jobId; |
||||
|
private String powerStation; |
||||
|
private String motorGroup; |
||||
|
private String point; |
||||
|
private String deviceId; |
||||
|
private JSONObject attribute; |
||||
|
private JSONObject config; |
||||
|
|
||||
|
/** |
||||
|
* 当前的检测状态 0-检测结束,结果正常,1-检测结束,结果异常,2-检测过程中程序错误,3-检测中 |
||||
|
*/ |
||||
|
private Integer status; |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
package com.jiluo.bolt.common; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/09/18/16:24 |
||||
|
* @Description:检测结果Websocket消息队列 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class DetectMessage { |
||||
|
|
||||
|
private String pointId; |
||||
|
|
||||
|
private JSONObject jsonObject; |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.jiluo.bolt.common; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/10/11:08 |
||||
|
* @Description:统一检测结果 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class DetectResult { |
||||
|
private int zone; // 区域, 如: 1号扇区
|
||||
|
private int position; // 位置, 如: 3号螺栓,5号引出线
|
||||
|
private String type; // 类型, 如:螺栓,引出线
|
||||
|
private Float value; // 检测值
|
||||
|
private String img; |
||||
|
private int alarm; |
||||
|
} |
||||
@ -0,0 +1,50 @@ |
|||||
|
package com.jiluo.bolt.common; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/26/14:07 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
public class DetectResultKey { |
||||
|
private int zone; |
||||
|
private int position; |
||||
|
private String type; |
||||
|
|
||||
|
public DetectResultKey(DetectResult detect) { |
||||
|
this.zone = detect.getZone(); |
||||
|
this.position = detect.getPosition(); |
||||
|
this.type = detect.getType(); |
||||
|
} |
||||
|
|
||||
|
// 实现hashCode()和equals()方法以便正确操作HashMap
|
||||
|
@Override |
||||
|
public int hashCode() { |
||||
|
final int prime = 31; |
||||
|
int result = 1; |
||||
|
result = prime * result + zone; |
||||
|
result = prime * result + position; |
||||
|
result = prime * result + ((type == null) ? 0 : type.hashCode()); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public boolean equals(Object obj) { |
||||
|
if (this == obj) |
||||
|
return true; |
||||
|
if (obj == null || getClass() != obj.getClass()) |
||||
|
return false; |
||||
|
DetectResultKey other = (DetectResultKey) obj; |
||||
|
if (zone != other.zone) |
||||
|
return false; |
||||
|
if (position != other.position) |
||||
|
return false; |
||||
|
if (type == null) { |
||||
|
if (other.type != null) |
||||
|
return false; |
||||
|
} else if (!type.equals(other.type)) |
||||
|
return false; |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
package com.jiluo.bolt.common; |
||||
|
|
||||
|
import lombok.Getter; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/04/27/14:14 |
||||
|
* @Description:检测类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
public enum DetectType { |
||||
|
BOLT_AND_LINE("BOLT_AND_LINE", "螺栓引出线磁极开闸检测"), |
||||
|
|
||||
|
TEMPERATURE("TEMPERATURE", "无线测温"); |
||||
|
|
||||
|
@Getter |
||||
|
String desc; |
||||
|
|
||||
|
@Getter |
||||
|
String product; |
||||
|
|
||||
|
DetectType(String product, String desc) { |
||||
|
this.desc = desc; |
||||
|
this.product = product; |
||||
|
} |
||||
|
|
||||
|
public static DetectType toDetectType(String type) { |
||||
|
return Arrays.stream(DetectType.values()).filter(_t -> _t.getProduct().equalsIgnoreCase(type) || _t.name().equalsIgnoreCase(type)).findFirst().orElse(null); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
package com.jiluo.bolt.common; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/19/10:06 |
||||
|
* @Description:设备状态-内存存储 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class LocalStatus { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private Integer cameraStatus; //相机设备状态:0-停用,1-正常,2-离线
|
||||
|
|
||||
|
private Integer pointStatus; //检测点状态:0-检测正常,1-检测异常,2-设备掉线
|
||||
|
|
||||
|
private Integer tempSensorStatus; //温度传感器状态:0-停用,1-正常,2-离线
|
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
package com.jiluo.bolt.common; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/06/11:12 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class PermissionValue implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String permissionId; |
||||
|
|
||||
|
private Boolean value; |
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import lombok.*; |
||||
|
import lombok.experimental.Accessors; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* (AlgorithmConfig)表实体类 |
||||
|
* |
||||
|
* @author Fangy |
||||
|
* @since 2023-05-08 17:46:48 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@Accessors(chain = true) |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class AlgorithmConfigDto implements Serializable { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String algorithmConfigId; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
private Double boltThreshold; |
||||
|
|
||||
|
private Double lineThreshold; |
||||
|
|
||||
|
@DateTimeFormat(pattern = "HH:mm") |
||||
|
private List<String> dailyAutoDetectionTime; |
||||
|
|
||||
|
private Integer delayDetect; |
||||
|
|
||||
|
private List<String> pointIdList; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/03/15:43 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class AlgorithmDto implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String algorithmId; |
||||
|
|
||||
|
private String source; |
||||
|
|
||||
|
private String algorithmName; |
||||
|
|
||||
|
private String algorithmFileName; |
||||
|
|
||||
|
private String powerStationId; |
||||
|
|
||||
|
private String motorGroupId; |
||||
|
|
||||
|
private String pointId; |
||||
|
|
||||
|
List<PointDto> points; |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import lombok.experimental.Accessors; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/05/15/16:59 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@Accessors(chain = true) |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
public class AlgorithmModelDto { |
||||
|
|
||||
|
private String detect_threshold_model; |
||||
|
|
||||
|
private String detect_threshold_bk; |
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
/** |
||||
|
* 检测过程表(Detect)实体类 |
||||
|
* |
||||
|
* @author Fangy |
||||
|
* @since 2023-05-05 09:57:05 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class DetectDto implements Serializable { |
||||
|
private static final long serialVersionUID = -11167425972916095L; |
||||
|
|
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private String startTime; |
||||
|
|
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private String endTime; |
||||
|
|
||||
|
Integer current; |
||||
|
|
||||
|
Integer size; |
||||
|
|
||||
|
private Integer id; |
||||
|
|
||||
|
private String powerStationId; |
||||
|
|
||||
|
private String motorGroupId; |
||||
|
|
||||
|
private String pointId; |
||||
|
|
||||
|
private String jobId; |
||||
|
|
||||
|
private Integer zone; |
||||
|
|
||||
|
private Integer status; |
||||
|
|
||||
|
private List<String> features; |
||||
|
|
||||
|
private List<String> jobs; |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,30 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import com.jiluo.bolt.common.DetectResult; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/14/16:56 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class DetectResultDto implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String jobId; |
||||
|
|
||||
|
private List<DetectResult> detectList; |
||||
|
} |
||||
@ -0,0 +1,92 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
|
/** |
||||
|
* 设备信息表(Device)实体类 |
||||
|
* |
||||
|
* @author Fangy |
||||
|
* @since 2023-05-05 09:57:05 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
public class DeviceDto implements Serializable { |
||||
|
private static final long serialVersionUID = -34441038340206111L; |
||||
|
|
||||
|
private Date gmtCreate; |
||||
|
|
||||
|
private Date gmtModify; |
||||
|
|
||||
|
private Integer id; |
||||
|
/** |
||||
|
* 设备编号 |
||||
|
*/ |
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String deviceId; |
||||
|
/** |
||||
|
* 设备类别 |
||||
|
*/ |
||||
|
private String type; |
||||
|
/** |
||||
|
* 设备名称 |
||||
|
*/ |
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String name; |
||||
|
/** |
||||
|
* 关联电站 |
||||
|
*/ |
||||
|
private String powerStationId; |
||||
|
/** |
||||
|
* 关联检测类型 |
||||
|
*/ |
||||
|
private String product; |
||||
|
/** |
||||
|
* 关联机组 |
||||
|
*/ |
||||
|
private String motorGroupId; |
||||
|
/** |
||||
|
* 关联检测点位 |
||||
|
*/ |
||||
|
private String pointId; |
||||
|
/** |
||||
|
* 设备状态:0-停用,1-正常,2-离线 |
||||
|
*/ |
||||
|
private Integer status; |
||||
|
/** |
||||
|
* 工作保护温度 |
||||
|
*/ |
||||
|
private BigDecimal tempThreshold; |
||||
|
/** |
||||
|
* 设备配置属性 |
||||
|
*/ |
||||
|
private String config; |
||||
|
/** |
||||
|
* 标识厂商 |
||||
|
*/ |
||||
|
private String nameOrSN; |
||||
|
|
||||
|
private String sn; |
||||
|
|
||||
|
private String vender; |
||||
|
|
||||
|
private Double fps; |
||||
|
|
||||
|
private Double exposureTime; |
||||
|
|
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String plcIp; |
||||
|
|
||||
|
private Integer plcDelay; |
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/06/15/14:59 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
public class IdToNameDto { |
||||
|
private static final long serialVersionUID = -18677499673088561L; |
||||
|
|
||||
|
private String id; |
||||
|
|
||||
|
private String name; |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/06/06/15:27 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
public class ImgDto { |
||||
|
private static final long serialVersionUID = -18677499673088561L; |
||||
|
|
||||
|
private String jobId; |
||||
|
|
||||
|
private String img; |
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/06/26/15:08 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
public class MotorGroupDto implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String powerStationId; |
||||
|
|
||||
|
private String motorGroupId; |
||||
|
|
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String number; |
||||
|
|
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String contact; |
||||
|
|
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String phone; |
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import com.jiluo.bolt.common.PermissionValue; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/06/11:06 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class PermissionDto implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String roleId; |
||||
|
|
||||
|
private List<PermissionValue> permissionList; |
||||
|
} |
||||
@ -0,0 +1,56 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
|
import javax.validation.constraints.*; |
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/06/27/10:18 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
public class PointDto implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String powerStationId; |
||||
|
|
||||
|
private String motorGroupId; |
||||
|
|
||||
|
private String pointId; |
||||
|
|
||||
|
@Length(max=10,message = "输入长度应小于{max}字") |
||||
|
private String name; |
||||
|
|
||||
|
@Min(value = 1, message = "磁极数量应大于1个") |
||||
|
@Max(value = 999, message = "磁极数量应小于999个") |
||||
|
private Integer poleNum; |
||||
|
|
||||
|
@DecimalMin(value = "0.0", inclusive = false, message = "检测时长应大于0s") |
||||
|
@DecimalMax(value = "600.0", inclusive = false, message = "检测时长应小于600s") |
||||
|
private BigDecimal manualTime; |
||||
|
|
||||
|
@DecimalMin(value = "0.0", inclusive = false, message = "检测时长应大于0s") |
||||
|
@DecimalMax(value = "600.0", inclusive = false, message = "检测时长应小于600s") |
||||
|
private BigDecimal automaticTime; |
||||
|
|
||||
|
private Boolean boltDetect; |
||||
|
|
||||
|
private Boolean lineDetect; |
||||
|
|
||||
|
private Boolean poleOpenDetect; |
||||
|
|
||||
|
private Boolean pointTempDetect; |
||||
|
} |
||||
@ -0,0 +1,45 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/06/26/10:10 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class PowerStationDto implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String powerStationId; |
||||
|
|
||||
|
@NotBlank(message = "名称不能为空") |
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String name; |
||||
|
|
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String address; |
||||
|
|
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String contact; |
||||
|
|
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String phone; |
||||
|
|
||||
|
@Length(max=200,message = "输入长度应小于{max}字") |
||||
|
private String introduction; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/06/9:59 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class RoleDto implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String roleId; |
||||
|
|
||||
|
private String roleName; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/05/13:08 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class SystemInfoConfigDto implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String systemInfoId; |
||||
|
|
||||
|
private String systemInfoName; |
||||
|
|
||||
|
private String logoFileName; |
||||
|
|
||||
|
@Length(max=10,message = "输入长度应小于{max}字") |
||||
|
private String systemName; |
||||
|
|
||||
|
List<String> powerStations; |
||||
|
|
||||
|
private String reservedField; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,60 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/11/16:41 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
public class TempSenserDto implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String deviceId; |
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String name; |
||||
|
|
||||
|
private String serialPort; |
||||
|
|
||||
|
private String nameOrSerialPort; |
||||
|
|
||||
|
private String type; |
||||
|
|
||||
|
private String powerStationId; |
||||
|
|
||||
|
private String motorGroupId; |
||||
|
|
||||
|
private String pointId; |
||||
|
|
||||
|
private String powerStation; |
||||
|
|
||||
|
private String Group_Point; |
||||
|
|
||||
|
private String relatedDeviceId; |
||||
|
|
||||
|
private String relatedDevice; |
||||
|
|
||||
|
private Integer status; |
||||
|
|
||||
|
private String typeId; |
||||
|
|
||||
|
private String jobId; |
||||
|
|
||||
|
private Double value; |
||||
|
|
||||
|
private JSONObject config; |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import lombok.experimental.Accessors; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/05/10/15:33 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@Accessors(chain = true) |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
public class TempThresholdDto { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String tempThresholdId; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
private BigDecimal tempThreshold; |
||||
|
|
||||
|
private List<IdToNameDto> deviceIdList; |
||||
|
} |
||||
@ -0,0 +1,46 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/05/15:58 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
public class ThemeConfigDto implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private String themeId; |
||||
|
|
||||
|
private String themeName; |
||||
|
|
||||
|
private String primary; |
||||
|
private String primary_btn_color; |
||||
|
private String bg_color; |
||||
|
private String border_color; |
||||
|
private String nav_bg; |
||||
|
private String text_color; |
||||
|
private String desc_color; |
||||
|
private String thead_bg; |
||||
|
private String tag_bg; |
||||
|
private String tag_color; |
||||
|
private String card_text_color; |
||||
|
private String card_hd_bg_color; |
||||
|
private String corner_color; |
||||
|
private String title_color; |
||||
|
|
||||
|
List<String> powerStationList; |
||||
|
} |
||||
@ -0,0 +1,54 @@ |
|||||
|
package com.jiluo.bolt.entity.dto; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.io.Serializable; |
||||
|
import lombok.Data; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
|
/** |
||||
|
* 用户信息表(User)实体类 |
||||
|
* |
||||
|
* @author Fangy |
||||
|
* @since 2023-05-05 09:57:05 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
public class UserDto implements Serializable { |
||||
|
private static final long serialVersionUID = -18677499673088561L; |
||||
|
|
||||
|
private Date gmtCreate; |
||||
|
|
||||
|
private Date gmtModify; |
||||
|
|
||||
|
private Integer id; |
||||
|
/** |
||||
|
* 用户编号 |
||||
|
*/ |
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String uid; |
||||
|
/** |
||||
|
* 用户姓名 |
||||
|
*/ |
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String userName; |
||||
|
/** |
||||
|
* 用户密码 |
||||
|
*/ |
||||
|
@Length(max=50,message = "输入长度应小于{max}字") |
||||
|
private String password; |
||||
|
/** |
||||
|
* 用户类型 |
||||
|
*/ |
||||
|
private String role; |
||||
|
|
||||
|
private String clientVersion; |
||||
|
|
||||
|
private String clientType; |
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,35 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/03/15:37 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class AlgorithmVo { |
||||
|
|
||||
|
private String AlgorithmId; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
private String source; |
||||
|
|
||||
|
private Integer group_point_num; |
||||
|
|
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date gmtCreate; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
|
import com.jiluo.bolt.common.DefectType; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/04/21/18:35 |
||||
|
* @Description:检测结果 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) |
||||
|
public class DefectVo { |
||||
|
|
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date time; |
||||
|
|
||||
|
private DefectType type; |
||||
|
|
||||
|
private Integer zone; |
||||
|
|
||||
|
private Integer position; |
||||
|
|
||||
|
private String img; |
||||
|
|
||||
|
private BigDecimal value; |
||||
|
|
||||
|
private Boolean alarm; |
||||
|
} |
||||
@ -0,0 +1,56 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/06/28/15:22 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class DeviceVo { |
||||
|
|
||||
|
private String deviceId; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
private String sn; |
||||
|
|
||||
|
private String plcIp; |
||||
|
|
||||
|
private String powerStationId; |
||||
|
|
||||
|
private String motorGroupId; |
||||
|
|
||||
|
private String pointId; |
||||
|
|
||||
|
private String powerStation; |
||||
|
|
||||
|
private String Group_Point; |
||||
|
|
||||
|
private Double fps; |
||||
|
|
||||
|
private Double exposureTime; |
||||
|
|
||||
|
private Integer status; |
||||
|
|
||||
|
private String venderId; |
||||
|
|
||||
|
private String vender; |
||||
|
|
||||
|
private Integer plcDelay; |
||||
|
|
||||
|
@JsonFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date gmtCreate; |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/03/11:51 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class DropDownVo { |
||||
|
|
||||
|
private String powerStationId; |
||||
|
|
||||
|
private String motorGroupId; |
||||
|
|
||||
|
private String pointId; |
||||
|
|
||||
|
private String name; |
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/04/21/17:01 |
||||
|
* @Description:历史数据 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class HistoricalDataVo { |
||||
|
|
||||
|
private String jobId; |
||||
|
|
||||
|
private String motorGroup; |
||||
|
|
||||
|
private String point; |
||||
|
|
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date gmtCreate; |
||||
|
|
||||
|
private String type; |
||||
|
|
||||
|
private Integer status; |
||||
|
|
||||
|
private String info; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/06/26/15:16 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class MotorGroupVo { |
||||
|
private String motorGroupId; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
private String powerStationId; |
||||
|
|
||||
|
private String powerStation; |
||||
|
|
||||
|
private Integer pointNum; |
||||
|
|
||||
|
private String contact; |
||||
|
|
||||
|
private String phone; |
||||
|
|
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date gmtCreate; |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/06/10:55 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class PermissionVo { |
||||
|
|
||||
|
private String permissionId; |
||||
|
|
||||
|
private String permissionName; |
||||
|
|
||||
|
private boolean value; |
||||
|
|
||||
|
//应用范围 0-前端检测系统权限;1-后台管理系统权限
|
||||
|
private Integer scope; |
||||
|
} |
||||
@ -0,0 +1,52 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/06/27/10:38 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class PointVo { |
||||
|
|
||||
|
private String pointId; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
private String motorGroupId; |
||||
|
|
||||
|
private String motorGroup; |
||||
|
|
||||
|
private String powerStationId; |
||||
|
|
||||
|
private String powerStation; |
||||
|
|
||||
|
private Integer poleNum; |
||||
|
|
||||
|
private Boolean boltDetect; |
||||
|
|
||||
|
private Boolean lineDetect; |
||||
|
|
||||
|
private Boolean poleOpenDetect; |
||||
|
|
||||
|
private Boolean pointTempDetect; |
||||
|
|
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date gmtCreate; |
||||
|
|
||||
|
private Integer manualTime; |
||||
|
|
||||
|
private Integer automaticTime; |
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/06/26/10:06 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class PowerStationVo { |
||||
|
private String powerStationId; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
private String address; |
||||
|
|
||||
|
private Integer groupNum; |
||||
|
|
||||
|
private String contact; |
||||
|
|
||||
|
private String phone; |
||||
|
|
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date gmtCreate; |
||||
|
|
||||
|
private String introduction; |
||||
|
} |
||||
@ -0,0 +1,46 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import lombok.Data; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
|
||||
|
/** |
||||
|
* 角色信息表(Role)实体类 |
||||
|
* |
||||
|
* @author Fangy |
||||
|
* @since 2023-05-05 09:57:05 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@AllArgsConstructor |
||||
|
@NoArgsConstructor |
||||
|
public class RoleVo implements Serializable { |
||||
|
private static final long serialVersionUID = -63387953100329487L; |
||||
|
|
||||
|
/** |
||||
|
* 权限编号 |
||||
|
*/ |
||||
|
private String roleId; |
||||
|
|
||||
|
/** |
||||
|
* 权限名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 权限值 |
||||
|
*/ |
||||
|
private Object value; |
||||
|
|
||||
|
|
||||
|
private Integer scope; |
||||
|
|
||||
|
/** |
||||
|
* 0-菜单权限,1-检测功能权限,2-机组权限 |
||||
|
*/ |
||||
|
private Integer type; |
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,38 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/05/14:41 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class SystemInfoConfigVo { |
||||
|
|
||||
|
private String systemInfoId; |
||||
|
|
||||
|
private String systemInfoName; |
||||
|
|
||||
|
private String logoImg; |
||||
|
|
||||
|
private String logoFileName; |
||||
|
|
||||
|
private String systemName; |
||||
|
|
||||
|
private List<JSONObject> powerStations; |
||||
|
|
||||
|
private String reservedField; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,52 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/11/16:38 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class TempSenserVo { |
||||
|
|
||||
|
private String deviceId; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
private String serialPort; |
||||
|
|
||||
|
private String typeId; |
||||
|
|
||||
|
private String type; |
||||
|
|
||||
|
private String powerStationId; |
||||
|
|
||||
|
private String motorGroupId; |
||||
|
|
||||
|
private String pointId; |
||||
|
|
||||
|
private String powerStation; |
||||
|
|
||||
|
private String Group_Point; |
||||
|
|
||||
|
private String relatedDeviceId; |
||||
|
|
||||
|
private String relatedDevice; |
||||
|
|
||||
|
private Integer status; |
||||
|
|
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date gmtCreate; |
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/05/15:48 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class ThemeConfigVo { |
||||
|
|
||||
|
private String themeId; |
||||
|
|
||||
|
private String themeName; |
||||
|
|
||||
|
private String themeColor; |
||||
|
|
||||
|
private String textColor; |
||||
|
|
||||
|
private String topMenuSelectColor; |
||||
|
|
||||
|
private String secondMenuSelectColor; |
||||
|
|
||||
|
private String guideColor; |
||||
|
|
||||
|
List<JSONObject> powerStations; |
||||
|
} |
||||
@ -0,0 +1,49 @@ |
|||||
|
package com.jiluo.bolt.entity.vo; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.fasterxml.jackson.annotation.JsonInclude; |
||||
|
import lombok.Data; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
|
||||
|
/** |
||||
|
* 用户信息表(User)实体类 |
||||
|
* |
||||
|
* @author Fangy |
||||
|
* @since 2023-05-05 09:57:05 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class UserVo { |
||||
|
|
||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) |
||||
|
private Integer id; |
||||
|
/** |
||||
|
* 用户编号 |
||||
|
*/ |
||||
|
private String uid; |
||||
|
/** |
||||
|
* 用户姓名 |
||||
|
*/ |
||||
|
private String userName; |
||||
|
/** |
||||
|
* 用户类型 |
||||
|
*/ |
||||
|
private String role; |
||||
|
|
||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) |
||||
|
private List<RoleVo> permissionList; |
||||
|
|
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date gmtCreate; |
||||
|
|
||||
|
private String password; |
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,76 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<parent> |
||||
|
<artifactId>bolt-server</artifactId> |
||||
|
<groupId>com.jiluo.bolt</groupId> |
||||
|
<version>0.0.1-SNAPSHOT</version> |
||||
|
</parent> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<artifactId>bolt-core</artifactId> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.jiluo.bolt</groupId> |
||||
|
<artifactId>bolt-dao</artifactId> |
||||
|
<version>0.0.1-SNAPSHOT</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>com.jiluo.bolt</groupId> |
||||
|
<artifactId>bolt-api</artifactId> |
||||
|
<version>0.0.1-SNAPSHOT</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- jwt生成token的库 --> |
||||
|
<dependency> |
||||
|
<groupId>com.auth0</groupId> |
||||
|
<artifactId>java-jwt</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- hutool工具类--> |
||||
|
<dependency> |
||||
|
<groupId>cn.hutool</groupId> |
||||
|
<artifactId>hutool-all</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>com.opencsv</groupId> |
||||
|
<artifactId>opencsv</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>com.google.guava</groupId> |
||||
|
<artifactId>guava</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>com.deepoove</groupId> |
||||
|
<artifactId>poi-tl</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- easyExcel --> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba</groupId> |
||||
|
<artifactId>easyexcel</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>io.minio</groupId> |
||||
|
<artifactId>minio</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework</groupId> |
||||
|
<artifactId>spring-test</artifactId> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
</project> |
||||
@ -0,0 +1,44 @@ |
|||||
|
package com.jiluo.bolt.config; |
||||
|
|
||||
|
import io.minio.MinioClient; |
||||
|
import io.minio.errors.InvalidEndpointException; |
||||
|
import io.minio.errors.InvalidPortException; |
||||
|
import lombok.Data; |
||||
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/10/13/14:35 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Data |
||||
|
@Component |
||||
|
@ConfigurationProperties(prefix = "minio") |
||||
|
public class MinioConfig { |
||||
|
|
||||
|
// endPoint是一个URL,域名,IPv4或者IPv6地址
|
||||
|
private String endpoint; |
||||
|
|
||||
|
// TCP/IP端口号
|
||||
|
private int port; |
||||
|
|
||||
|
private String accessKey; |
||||
|
|
||||
|
private String secretKey; |
||||
|
|
||||
|
// 如果是true,则用的是https而不是http,默认值是true
|
||||
|
private Boolean secure; |
||||
|
|
||||
|
// 默认存储桶
|
||||
|
private String bucketName; |
||||
|
|
||||
|
@Bean |
||||
|
public MinioClient getMinioClient() throws InvalidEndpointException, InvalidPortException { |
||||
|
MinioClient minioClient = new MinioClient(endpoint, port, accessKey, secretKey, secure); |
||||
|
return minioClient; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,110 @@ |
|||||
|
package com.jiluo.bolt.config; |
||||
|
|
||||
|
import cn.hutool.core.io.file.FileNameUtil; |
||||
|
import com.jiluo.bolt.service.MinioService; |
||||
|
import lombok.SneakyThrows; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import java.io.InputStream; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/10/13/14:55 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Component |
||||
|
public class UploadFile { |
||||
|
|
||||
|
@Autowired |
||||
|
private MinioService minioService; |
||||
|
|
||||
|
@Autowired |
||||
|
private MinioConfig minioConfig; |
||||
|
|
||||
|
@SneakyThrows |
||||
|
public void uploadFile(MultipartFile file, String bucketName) { |
||||
|
|
||||
|
// 获取存储桶名称
|
||||
|
bucketName = StringUtils.isNotBlank(bucketName) ? bucketName : minioConfig.getBucketName(); |
||||
|
|
||||
|
// 判断是否存在该存储桶
|
||||
|
if (!minioService.bucketExists(bucketName)) { |
||||
|
// 不存在则创建
|
||||
|
minioService.makeBucket(bucketName); |
||||
|
// 设置存储桶读写策略
|
||||
|
|
||||
|
String bucketPolicy = "{\"Version\":\"2023-10-10\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]}," + |
||||
|
"\"Action\":[\"s3:GetBucketLocation\",\"s3:ListBucket\",\"s3:ListBucketMultipartUploads\"],\"Resource\":[\"arn:aws:s3:::" + |
||||
|
bucketName + "\"]}," + |
||||
|
"{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:DeleteObject\",\"s3:GetObject\",\"s3:ListMultipartUploadParts\",\"s3:PutObject\",\"s3:AbortMultipartUpload\"],\"Resource\":[\"arn:aws:s3:::" |
||||
|
+ bucketName + "/*\"]}]}"; |
||||
|
|
||||
|
// 设置存储桶策略
|
||||
|
minioService.setBucketPolicy(bucketName, bucketPolicy); |
||||
|
} |
||||
|
// 原始文件名
|
||||
|
String fileName = file.getOriginalFilename(); |
||||
|
// 获取文件后缀名
|
||||
|
String extName = FileNameUtil.extName(fileName); |
||||
|
// 定义文件路径
|
||||
|
String format = new SimpleDateFormat("yyyy/MM/dd/").format(new Date()); |
||||
|
// 定义文件修改之后的名字,去除uuid中的' - '
|
||||
|
String fileuuid = UUID.randomUUID().toString().replaceAll("-", ""); |
||||
|
// 定义新的文件名
|
||||
|
//String objectName = format + fileuuid + "." + extName;
|
||||
|
String objectName = format + fileName; |
||||
|
//上传文件
|
||||
|
minioService.putObject(bucketName, file, objectName); |
||||
|
} |
||||
|
|
||||
|
@SneakyThrows |
||||
|
public void uploadFiles(List<MultipartFile> files) { |
||||
|
|
||||
|
// 获取存储桶名称
|
||||
|
String bucketName = minioConfig.getBucketName(); |
||||
|
|
||||
|
// 判断是否存在该存储桶
|
||||
|
if (!minioService.bucketExists(bucketName)) { |
||||
|
// 不存在则创建
|
||||
|
minioService.makeBucket(bucketName); |
||||
|
|
||||
|
// 设置存储桶读写策略
|
||||
|
String bucketPolicy = "{\"Version\":\"2023-10-10\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]}," + |
||||
|
"\"Action\":[\"s3:GetBucketLocation\",\"s3:ListBucket\",\"s3:ListBucketMultipartUploads\"],\"Resource\":[\"arn:aws:s3:::" + |
||||
|
bucketName + "\"]}," + |
||||
|
"{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:DeleteObject\",\"s3:GetObject\",\"s3:ListMultipartUploadParts\",\"s3:PutObject\",\"s3:AbortMultipartUpload\"],\"Resource\":[\"arn:aws:s3:::" |
||||
|
+ bucketName + "/*\"]}]}"; |
||||
|
|
||||
|
// 设置存储桶策略
|
||||
|
minioService.setBucketPolicy(bucketName, bucketPolicy); |
||||
|
} |
||||
|
for (MultipartFile file : files) { |
||||
|
//上传文件
|
||||
|
minioService.putObject(bucketName, file, file.getOriginalFilename()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@SneakyThrows |
||||
|
public void uploadFile(String objectName, InputStream stream, String contentType) { |
||||
|
String bucketName = minioConfig.getBucketName(); |
||||
|
if (!minioService.bucketExists(bucketName)) { |
||||
|
minioService.makeBucket(bucketName); |
||||
|
String bucketPolicy = "{\"Version\":\"2023-10-10\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]}," + |
||||
|
"\"Action\":[\"s3:GetBucketLocation\",\"s3:ListBucket\",\"s3:ListBucketMultipartUploads\"],\"Resource\":[\"arn:aws:s3:::" + |
||||
|
bucketName + "\"]}," + |
||||
|
"{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:DeleteObject\",\"s3:GetObject\",\"s3:ListMultipartUploadParts\",\"s3:PutObject\",\"s3:AbortMultipartUpload\"],\"Resource\":[\"arn:aws:s3:::" |
||||
|
+ bucketName + "/*\"]}]}"; |
||||
|
minioService.setBucketPolicy(bucketName, bucketPolicy); |
||||
|
} |
||||
|
minioService.putObject(bucketName, objectName, stream, contentType); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
package com.jiluo.bolt.domain; |
||||
|
|
||||
|
import com.alibaba.fastjson.annotation.JSONField; |
||||
|
import com.jiluo.bolt.common.DefectType; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/28/13:39 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
|
||||
|
@Data |
||||
|
@Builder |
||||
|
@EqualsAndHashCode(of = {"type", "zone", "position", "time"}) |
||||
|
public class DefectInfo { |
||||
|
private DefectType type; |
||||
|
private Integer zone; |
||||
|
private Integer position; |
||||
|
private BigDecimal value; |
||||
|
private Boolean alarm; |
||||
|
private Date time; |
||||
|
|
||||
|
@JSONField(serialize = false) |
||||
|
private String file; |
||||
|
|
||||
|
public void setValue(BigDecimal value) { |
||||
|
this.value = value; |
||||
|
} |
||||
|
|
||||
|
public BigDecimal getValue() { |
||||
|
return this.value; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,127 @@ |
|||||
|
package com.jiluo.bolt.export; |
||||
|
|
||||
|
import com.jiluo.bolt.common.DefectType; |
||||
|
import com.jiluo.bolt.common.DetectType; |
||||
|
import com.jiluo.bolt.domain.DefectInfo; |
||||
|
import com.jiluo.bolt.entity.po.*; |
||||
|
import com.jiluo.bolt.service.*; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.collections4.CollectionUtils; |
||||
|
import org.apache.commons.lang3.BooleanUtils; |
||||
|
import org.apache.commons.lang3.Range; |
||||
|
import org.apache.commons.lang3.tuple.Pair; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.RoundingMode; |
||||
|
import java.util.*; |
||||
|
import java.util.stream.Collectors; |
||||
|
import java.util.stream.IntStream; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/28/15:04 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
public class Analysis { |
||||
|
|
||||
|
@Resource |
||||
|
PointService pointService; |
||||
|
|
||||
|
@Resource |
||||
|
MotorGroupService motorGroupService; |
||||
|
|
||||
|
@Resource |
||||
|
PowerStationService powerStationService; |
||||
|
|
||||
|
@Resource |
||||
|
JobService jobService; |
||||
|
|
||||
|
@Resource |
||||
|
DefectService defectService; |
||||
|
|
||||
|
@Value("${defect_work_dir}") |
||||
|
private String defect_work_dir; |
||||
|
|
||||
|
public Report report(String pointId, List<String> jobs) { |
||||
|
Pair<List<Date>, List<DefectInfo>> data = load(pointId, jobs, null,null); |
||||
|
if (data.getKey().isEmpty()) { |
||||
|
data.getKey().add(new Date()); |
||||
|
} |
||||
|
return analysis(pointId, data.getKey(), data.getValue()); |
||||
|
} |
||||
|
|
||||
|
public Report report(String pointId, Range<Date> dateRange, Integer status) { |
||||
|
Pair<List<Date>, List<DefectInfo>> data = load(pointId, null, dateRange, status); |
||||
|
if (data.getKey().isEmpty()) { |
||||
|
data.getKey().add(dateRange.getMinimum()); |
||||
|
data.getKey().add(dateRange.getMaximum()); |
||||
|
} |
||||
|
return analysis(pointId, data.getKey(), data.getValue()); |
||||
|
} |
||||
|
|
||||
|
private Report analysis(String pointId, List<Date> timeDim, List<DefectInfo> defects) { |
||||
|
Point _point = pointService.getByBizId(pointId); |
||||
|
MotorGroup _motorGroup = motorGroupService.getByBizId(_point.getMotorGroup()); |
||||
|
PowerStation _powerStation = powerStationService.getByBizId(_point.getPowerStation()); |
||||
|
|
||||
|
return Report.builder().powerStationName(_powerStation.getName()).groupName(_motorGroup.getName()) |
||||
|
.pointName(_point.getName()) |
||||
|
.timeDimensions(timeDim).zoneDimensions(zoneDim(_point.getPoleNum())).typeDimensions(typeDim()) |
||||
|
.allDefectData(defects.parallelStream().collect(Collectors.groupingBy(DefectInfo::getType))) |
||||
|
.build() |
||||
|
.generate(); |
||||
|
} |
||||
|
|
||||
|
private List<DefectType> typeDim() { |
||||
|
return DefectType.defectTypes(DetectType.BOLT_AND_LINE.getProduct()); |
||||
|
} |
||||
|
|
||||
|
private List<Integer> zoneDim(Integer zone) { |
||||
|
return IntStream.rangeClosed(1, zone).boxed().collect(Collectors.toList()); |
||||
|
} |
||||
|
|
||||
|
private Pair<List<Date>, List<DefectInfo>> load(String pointId, List<String> jobs, Range<Date> dateRange, Integer status) { |
||||
|
List<Job> jobList = new ArrayList<>(); |
||||
|
List<Defect> defectList = new ArrayList<>(); |
||||
|
if (!CollectionUtils.isEmpty(jobs)) { |
||||
|
jobList = jobService.getByBizId(jobs); |
||||
|
defectList = defectService.getByJob(jobs); |
||||
|
} |
||||
|
if (dateRange != null) { |
||||
|
jobList = jobService.exportData(dateRange.getMinimum(), dateRange.getMaximum()); |
||||
|
defectList = defectService.exportData(pointId,dateRange.getMinimum(), dateRange.getMaximum(),status); |
||||
|
} |
||||
|
return apply(jobList, defectList); |
||||
|
} |
||||
|
|
||||
|
private Pair<List<Date>, List<DefectInfo>> apply(List<Job> jobs, List<Defect> defects) { |
||||
|
Map<String, Date> _job = jobs.stream().collect(Collectors.toMap(Job::getJobId, Job::getGmtCreate)); |
||||
|
|
||||
|
List<DefectInfo> _defects = defects.stream().map(defect -> { |
||||
|
DefectType type = DefectType.toDefectType(defect.getType()); |
||||
|
BigDecimal value = (type == DefectType.bolt || type == DefectType.temperature) ? BigDecimal.valueOf(defect.getValue() / 100.0).setScale(2, RoundingMode.HALF_UP) : (type == DefectType.line ? BigDecimal.valueOf(defect.getValue() / 1000.0).setScale(3, RoundingMode.HALF_UP) : BigDecimal.valueOf(defect.getValue())); |
||||
|
|
||||
|
return DefectInfo.builder() |
||||
|
.time(_job.get(defect.getJob())) |
||||
|
.type(type) |
||||
|
.alarm(BooleanUtils.toBoolean(defect.getAlarm())) |
||||
|
.zone(defect.getZone()) |
||||
|
.position(defect.getPosition()) |
||||
|
.value(value) |
||||
|
.file(DetectType.BOLT_AND_LINE == type.getDetectType() ? String.format("ipc:%s/%s/%s/%s", defect_work_dir, defect.getJob(), "/detect/", defect.getData()) : null) |
||||
|
.build(); |
||||
|
}) |
||||
|
.filter(x -> x.getZone() != null && x.getType() != null && x.getPosition() != null && x.getValue() != null && x.getTime() != null) |
||||
|
.sorted(Comparator.comparing(DefectInfo::getTime).thenComparing(DefectInfo::getZone).thenComparing(DefectInfo::getType).thenComparing(DefectInfo::getPosition)).collect(Collectors.toList()); |
||||
|
|
||||
|
List<Date> timeDim = jobs.parallelStream().map(Job::getGmtCreate).distinct().sorted(Date::compareTo).collect(Collectors.toList()); |
||||
|
return Pair.of(timeDim, _defects); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,136 @@ |
|||||
|
package com.jiluo.bolt.export; |
||||
|
|
||||
|
import com.jiluo.bolt.entity.po.*; |
||||
|
import com.jiluo.bolt.service.*; |
||||
|
import com.jiluo.bolt.util.ExcelUtils; |
||||
|
import lombok.SneakyThrows; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.lang3.Range; |
||||
|
import org.apache.commons.lang3.math.NumberUtils; |
||||
|
import org.apache.commons.lang3.time.DateUtils; |
||||
|
import org.springframework.scheduling.annotation.Scheduled; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import javax.annotation.PostConstruct; |
||||
|
import javax.annotation.Resource; |
||||
|
import java.io.ByteArrayOutputStream; |
||||
|
import java.io.File; |
||||
|
import java.time.*; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/07/28/14:38 |
||||
|
* @Description:报告导出 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Component |
||||
|
public class Export { |
||||
|
private static String AUTO_EXPORT_PATH = "/data/work/report"; |
||||
|
private static Integer AUTO_EXPORT_PERIOD = 30; |
||||
|
|
||||
|
@Resource |
||||
|
Analysis analysis; |
||||
|
|
||||
|
@Resource |
||||
|
PointService pointService; |
||||
|
|
||||
|
@Resource |
||||
|
ConfigService configService; |
||||
|
|
||||
|
@PostConstruct |
||||
|
private void init() { |
||||
|
Config report_auto_export_dir = configService.selectByBizId("report_auto_export_dir"); |
||||
|
Config report_auto_export_time = configService.selectByBizId("report_auto_export_time"); |
||||
|
if (report_auto_export_time != null) { |
||||
|
AUTO_EXPORT_PERIOD = NumberUtils.toInt(report_auto_export_time.getValue()); |
||||
|
} |
||||
|
if (report_auto_export_dir != null) { |
||||
|
AUTO_EXPORT_PATH = report_auto_export_dir.getValue().endsWith(File.pathSeparator) ? report_auto_export_dir.getValue() : report_auto_export_dir.getValue() + File.separator; |
||||
|
} |
||||
|
log.info(String.format("[Export] init AUTO_EXPORT_PATH=%s; AUTO_EXPORT_PERIOD=%s", AUTO_EXPORT_PATH, AUTO_EXPORT_PERIOD)); |
||||
|
} |
||||
|
|
||||
|
@Scheduled(cron = "0 0 1 * * ?") |
||||
|
private void autoExport() { |
||||
|
// Date now = new Date();
|
||||
|
// Date start = getStartOfDay(now, -AUTO_EXPORT_PERIOD);
|
||||
|
// Date end = getEndOfDay(now, -1);
|
||||
|
// Range<Date> dateRange = Range.between(start, end);
|
||||
|
LocalDate now = LocalDate.now(); |
||||
|
LocalDateTime start = now.minusDays(1).atStartOfDay(); |
||||
|
LocalDateTime end = now.minusDays(1).atTime(LocalTime.MAX); |
||||
|
if (AUTO_EXPORT_PERIOD == 1) { |
||||
|
// 每天导出一次报告
|
||||
|
LocalDate startDaily = now.minusDays(1); |
||||
|
LocalDate endDaily = now.minusDays(1); |
||||
|
start = startDaily.atStartOfDay(); |
||||
|
end = endDaily.atTime(LocalTime.MAX); |
||||
|
} else if (AUTO_EXPORT_PERIOD == 7) { |
||||
|
// 每周导出一次报告(周一开始,周日结束)
|
||||
|
LocalDate startWeekly = now.minusWeeks(1).with(java.time.DayOfWeek.MONDAY); |
||||
|
LocalDate endWeekly = now.minusWeeks(1).with(java.time.DayOfWeek.SUNDAY); |
||||
|
start = startWeekly.atStartOfDay(); |
||||
|
end = endWeekly.atTime(LocalTime.MAX); |
||||
|
} else if (AUTO_EXPORT_PERIOD == 30) { |
||||
|
// 每月导出一次报告(上个月的起始和结束日期)
|
||||
|
LocalDate startMonthly = now.minusMonths(1).withDayOfMonth(1); |
||||
|
LocalDate endMonthly = now.minusMonths(1).withDayOfMonth(now.minusMonths(1).lengthOfMonth()); |
||||
|
start = startMonthly.atStartOfDay(); |
||||
|
end = endMonthly.atTime(LocalTime.MAX); |
||||
|
} |
||||
|
|
||||
|
Range<Date> dateRange = Range.between(Date.from(start.toInstant(ZoneOffset.UTC)), Date.from(end.toInstant(ZoneOffset.UTC))); |
||||
|
|
||||
|
List<Point> points = pointService.getAll(); |
||||
|
for (Point point : points) { |
||||
|
try { |
||||
|
String filePath = analysis.report(point.getPointId(), dateRange, null).export(AUTO_EXPORT_PATH).getExportFileName(); |
||||
|
log.info(String.format("[Export] autoExport point=%s; dateRange=%s~%s; filePath=%s", point.getName(), start, end, filePath)); |
||||
|
} catch (Exception e) { |
||||
|
log.error(String.format("[Export] autoExport point=%s; dateRange=%s~%s", point.getName(), start, end), e); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@SneakyThrows |
||||
|
public String export(String pointId, List<String> jobs, ByteArrayOutputStream target) { |
||||
|
return analysis.report(pointId, jobs).export(target).getExportFileName(); |
||||
|
} |
||||
|
|
||||
|
@SneakyThrows |
||||
|
public String export(String pointId, Range<Date> dateRange, Integer status, ByteArrayOutputStream target) { |
||||
|
return analysis.report(pointId, dateRange, status).export(target).getExportFileName(); |
||||
|
} |
||||
|
|
||||
|
@SneakyThrows |
||||
|
public String export(String pointId, List<String> jobs, String path) { |
||||
|
return analysis.report(pointId, jobs).export(path).getExportFileName(); |
||||
|
} |
||||
|
|
||||
|
@SneakyThrows |
||||
|
public String export(String pointId, Range<Date> dateRange, Integer status, String path) { |
||||
|
return analysis.report(pointId, dateRange, status).export(path).getExportFileName(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static Date getEndOfDay(Date date, int offset) { |
||||
|
Date _date = DateUtils.addDays(date, offset); |
||||
|
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(_date.getTime()), ZoneId.systemDefault()); |
||||
|
LocalDateTime endOfDay = localDateTime.with(LocalTime.MAX); |
||||
|
return Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant()); |
||||
|
} |
||||
|
|
||||
|
public static Date getStartOfDay(Date date, int offset) { |
||||
|
Date _date = DateUtils.addDays(date, offset); |
||||
|
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(_date.getTime()), ZoneId.systemDefault()); |
||||
|
LocalDateTime startOfDay = localDateTime.with(LocalTime.MIN); |
||||
|
return Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,278 @@ |
|||||
|
package com.jiluo.bolt.export; |
||||
|
|
||||
|
import com.deepoove.poi.XWPFTemplate; |
||||
|
import com.deepoove.poi.config.Configure; |
||||
|
import com.deepoove.poi.data.*; |
||||
|
import com.deepoove.poi.data.style.TableStyle; |
||||
|
import com.google.common.collect.Lists; |
||||
|
import com.google.common.collect.Maps; |
||||
|
import com.jiluo.bolt.common.DefectType; |
||||
|
import com.jiluo.bolt.domain.DefectInfo; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.io.FileUtils; |
||||
|
import org.apache.commons.io.IOUtils; |
||||
|
import org.apache.commons.lang3.Range; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.apache.commons.lang3.time.DateFormatUtils; |
||||
|
import org.springframework.core.io.ClassPathResource; |
||||
|
import org.springframework.util.ResourceUtils; |
||||
|
|
||||
|
import java.io.ByteArrayOutputStream; |
||||
|
import java.io.File; |
||||
|
import java.io.FileInputStream; |
||||
|
import java.io.IOException; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.RoundingMode; |
||||
|
import java.util.*; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
@Data |
||||
|
@Slf4j |
||||
|
@Builder |
||||
|
public class Report { |
||||
|
private static final String AUTO_EXPORT_FILE_NAME = "转子视觉检测报告_%s.docx"; |
||||
|
private static final String AUTO_EXPORT_TEMPLATE = "report.docx"; |
||||
|
|
||||
|
private String exportFileName; |
||||
|
private String powerStationName; |
||||
|
private String groupName; |
||||
|
private String pointName; |
||||
|
private Range<Date> reportTime; |
||||
|
|
||||
|
private List<Date> timeDimensions; |
||||
|
private List<DefectType> typeDimensions; |
||||
|
private List<Integer> zoneDimensions; |
||||
|
|
||||
|
private Map<DefectType, List<DefectInfo>> allDefectData; |
||||
|
|
||||
|
private Map<DefectType, AnalysisResult> analysisResult; |
||||
|
|
||||
|
private AnalysisResult analysis(DefectType type, List<DefectInfo> defects) { |
||||
|
defects.removeAll(defects.parallelStream().filter(x -> !timeDimensions.contains(x.getTime()) || !zoneDimensions.contains(x.getZone())).collect(Collectors.toList())); |
||||
|
Map<Integer, List<DefectInfo>> _defects = defects.parallelStream().collect(Collectors.groupingBy(DefectInfo::getZone)); |
||||
|
|
||||
|
AnalysisResult result = new AnalysisResult(type, !defects.isEmpty()); |
||||
|
zoneDimensions.forEach(z -> { |
||||
|
if (!_defects.containsKey(z)) { |
||||
|
result.getCensus().add(new DetectReport(type, z)); |
||||
|
} else { |
||||
|
DetectReport detectReport = new DetectReport(type, z); |
||||
|
Map<Integer, DefectReport> defectReports = Maps.newConcurrentMap(); |
||||
|
_defects.get(z).forEach(d -> { |
||||
|
detectReport.addValue(d.getAlarm(), d.getValue()); |
||||
|
defectReports.putIfAbsent(d.getPosition(), new DefectReport(type, z, d.getPosition())); |
||||
|
defectReports.get(d.getPosition()).addValue(d.getAlarm(), d.getTime(), d.getValue(), d.getFile()); |
||||
|
}); |
||||
|
timeDimensions.forEach(d -> defectReports.values().stream().filter(r -> !r.getValues().containsKey(d)).forEach(r -> r.addValue(d))); |
||||
|
defectReports.keySet().stream().filter(k -> !defectReports.get(k).isAlarm()).forEach(defectReports::remove); |
||||
|
|
||||
|
result.getCensus().add(detectReport); |
||||
|
result.getDetail().addAll(defectReports.values()); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
result.getCensus().sort(Comparator.comparing(DetectReport::getZone)); |
||||
|
result.getDetail().sort(Comparator.comparing(DefectReport::getZone).thenComparing(DefectReport::getPosition)); |
||||
|
result.fill(); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
public Report generate() { |
||||
|
if (timeDimensions.isEmpty()) { |
||||
|
timeDimensions.add(new Date()); |
||||
|
} |
||||
|
reportTime = Range.between(timeDimensions.get(0), timeDimensions.get(timeDimensions.size() -1)); |
||||
|
analysisResult = typeDimensions.parallelStream().map(t -> analysis(t, allDefectData.getOrDefault(t, new ArrayList<>()))).collect(Collectors.toMap(AnalysisResult::getType, x -> x)); |
||||
|
exportFileName = String.format(AUTO_EXPORT_FILE_NAME, String.format("%s_%s", DateFormatUtils.format(getReportTime().getMinimum(), "yyyy年MM月dd日"), DateFormatUtils.format(getReportTime().getMaximum(), "yyyy年MM月dd日"))); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
private Map<String, Object> convert() { |
||||
|
Map<String, Object> data = new HashMap<>(); |
||||
|
data.put("productLine", getPowerStationName()); |
||||
|
data.put("groupName", getGroupName()); |
||||
|
data.put("pointName", getPointName()); |
||||
|
data.put("reportTime", String.format("%s-%s", DateFormatUtils.format(getReportTime().getMinimum(), "yyyy年MM月dd日"), DateFormatUtils.format(getReportTime().getMaximum(), "yyyy年MM月dd日"))); |
||||
|
data.put("boltDetail", getAnalysisResult().get(DefectType.bolt).getDetail()); |
||||
|
data.put("lineDetail", getAnalysisResult().get(DefectType.line).getDetail()); |
||||
|
data.put("poleDetail", getAnalysisResult().get(DefectType.pole).getDetail()); |
||||
|
data.put("boltTable", getAnalysisResult().get(DefectType.bolt).getTable()); |
||||
|
data.put("lineTable", getAnalysisResult().get(DefectType.line).getTable()); |
||||
|
data.put("poleTable", getAnalysisResult().get(DefectType.pole).getTable()); |
||||
|
return data; |
||||
|
} |
||||
|
|
||||
|
public Report export(String path) throws IOException { |
||||
|
File dir = FileUtils.getFile(path, powerStationName, groupName, pointName); |
||||
|
FileUtils.forceMkdir(dir); |
||||
|
this.exportFileName = FileUtils.getFile(dir, exportFileName).getAbsolutePath(); |
||||
|
XWPFTemplate.compile(new ClassPathResource(AUTO_EXPORT_TEMPLATE).getInputStream(), Configure.builder().useSpringEL().build()).render(convert()).writeToFile(exportFileName); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public Report export(ByteArrayOutputStream target) throws IOException { |
||||
|
XWPFTemplate.compile(new ClassPathResource(AUTO_EXPORT_TEMPLATE).getInputStream(), Configure.builder().useSpringEL().build()).render(convert()).writeAndClose(target); |
||||
|
return this; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
class AnalysisResult { |
||||
|
private DefectType type; |
||||
|
private boolean hasDefect; |
||||
|
|
||||
|
private List<DetectReport> census; |
||||
|
private List<DefectReport> detail; |
||||
|
|
||||
|
private TableRenderData table; |
||||
|
|
||||
|
public AnalysisResult(DefectType type, boolean hasDefect) { |
||||
|
this.type = type; |
||||
|
this.hasDefect = hasDefect; |
||||
|
census = new ArrayList<>(); |
||||
|
detail = new ArrayList<>(); |
||||
|
} |
||||
|
|
||||
|
public void fill() { |
||||
|
List<RowRenderData> rows = new ArrayList<>(); |
||||
|
Lists.partition(census, 10).forEach(_values -> { |
||||
|
Rows.RowBuilder rowA = Rows.of("编号"); |
||||
|
Rows.RowBuilder rowB = Rows.of("范围"); |
||||
|
_values.forEach(x -> { |
||||
|
rowA.addCell(Cells.of(String.valueOf(x.getZone())).create()); |
||||
|
StringBuilder _v = new StringBuilder(); |
||||
|
_v.append(x.getMin().setScale(2, RoundingMode.HALF_UP)).append('~').append(x.getMax().setScale(2, RoundingMode.HALF_UP)); |
||||
|
|
||||
|
if (x.isAlarm()) { |
||||
|
rowB.addCell(Cells.of(Texts.of(_v.toString()).bold().create()).create()); |
||||
|
} else { |
||||
|
rowB.addCell(Cells.of(_v.toString()).create()); |
||||
|
} |
||||
|
}); |
||||
|
if (_values.size() < 10) { |
||||
|
int _lack = 10 - _values.size(); |
||||
|
while(_lack-- > 0) { |
||||
|
rowA.addCell(new CellRenderData()); |
||||
|
rowB.addCell(new CellRenderData()); |
||||
|
} |
||||
|
} |
||||
|
rows.add(rowA.textFontSize(10).center().create()); |
||||
|
rows.add(rowB.textFontSize(10).center().create()); |
||||
|
}); |
||||
|
table = Tables.of(rows.toArray(new RowRenderData[]{})).width(16, null).center().border(TableStyle.BorderStyle.DEFAULT).create(); |
||||
|
detail.forEach(DefectReport::fill); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
class DetectReport { |
||||
|
private DefectType type; |
||||
|
private int zone; |
||||
|
private BigDecimal max = BigDecimal.ZERO; |
||||
|
private BigDecimal min = BigDecimal.ZERO; |
||||
|
private boolean alarm = false; |
||||
|
|
||||
|
public DetectReport(DefectType type, int zone) { |
||||
|
this.type = type; |
||||
|
this.zone = zone; |
||||
|
} |
||||
|
|
||||
|
public synchronized void addValue(boolean alarm, BigDecimal v) { |
||||
|
this.alarm = this.alarm || alarm; |
||||
|
if (v.compareTo(max) > 0) { |
||||
|
this.max = v; |
||||
|
} |
||||
|
if (this.min.equals(BigDecimal.ZERO)) { |
||||
|
this.min = v; |
||||
|
} else { |
||||
|
if (min.compareTo(v) > 0) { |
||||
|
this.min = v; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@Slf4j |
||||
|
class DefectReport { |
||||
|
private DefectType type; |
||||
|
private int zone; |
||||
|
private int position; |
||||
|
private BigDecimal value; |
||||
|
private String url; |
||||
|
private boolean alarm; |
||||
|
private TreeMap<Date, BigDecimal> values; |
||||
|
|
||||
|
private PictureRenderData file; |
||||
|
private ChartMultiSeriesRenderData chart; |
||||
|
|
||||
|
public DefectReport(DefectType type, int zone, int position) { |
||||
|
this.type = type; |
||||
|
this.zone = zone; |
||||
|
this.position = position; |
||||
|
this.value = type.getDefaultValue(); |
||||
|
this.values = new TreeMap<>(); |
||||
|
} |
||||
|
|
||||
|
public synchronized void addValue(Date t) { |
||||
|
this.values.put(t, type.getDefaultValue()); |
||||
|
this.value = this.values.lastEntry().getValue(); |
||||
|
if (this.value.equals(type.getDefaultValue())) { |
||||
|
this.alarm = false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public synchronized void addValue(boolean alarm, Date t, BigDecimal v, String url) { |
||||
|
this.values.put(t, v); |
||||
|
this.value = this.values.lastEntry().getValue(); |
||||
|
if (this.value.equals(v)) { |
||||
|
this.alarm = alarm; |
||||
|
} |
||||
|
if (this.alarm) { |
||||
|
this.url = url; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void fill() { |
||||
|
fillChart(); |
||||
|
fillFile(); |
||||
|
} |
||||
|
|
||||
|
private void fillFile() { |
||||
|
try { |
||||
|
if (StringUtils.isBlank(url)) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (url.startsWith("ipc")) { |
||||
|
String path = url.split(":")[1]; |
||||
|
File img = ResourceUtils.getFile(path); |
||||
|
FileInputStream fileInputStream = new FileInputStream(img); |
||||
|
byte[] bytes = IOUtils.toByteArray(fileInputStream); |
||||
|
fileInputStream.close(); |
||||
|
// 读取图像文件的字节数组
|
||||
|
file = Pictures.ofBytes(bytes, PictureType.JPEG).altMeta("图片丢失!").size(577, 397).create(); |
||||
|
} else { |
||||
|
file = Pictures.ofStream(new ClassPathResource(url.split(":")[1]).getInputStream(), PictureType.JPEG).altMeta("图片丢失!").size(577, 397).create(); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
log.error("[DefectReport] fillFile exception!", e); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void fillChart() { |
||||
|
String series = String.format("%s#磁极", zone); |
||||
|
if (type == DefectType.bolt) { |
||||
|
series = series + String.format("%s号螺栓", position); |
||||
|
} |
||||
|
if (type == DefectType.line) { |
||||
|
series = series + String.format("%s号引出线", position); |
||||
|
} |
||||
|
chart = Charts.ofLine( |
||||
|
this.type.getDesc(), this.getValues().keySet().stream().map(integer -> DateFormatUtils.format(integer, "yyyy-MM-dd HH:mm:ss")).toArray(String[]::new)) |
||||
|
.addSeries(series, this.getValues().values().toArray(new Number[]{})) |
||||
|
.create(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.po.Alarm; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.concurrent.ConcurrentHashMap; |
||||
|
|
||||
|
/** |
||||
|
* 告警信息表(Alarm)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:06 |
||||
|
*/ |
||||
|
|
||||
|
public interface AlarmService extends IService<Alarm> { |
||||
|
|
||||
|
public static Map<String, Alarm> ALARM_MAP = new ConcurrentHashMap<>(); |
||||
|
|
||||
|
public List<Alarm> getAll(); |
||||
|
|
||||
|
public void add(Alarm alarm); |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.dto.AlgorithmDto; |
||||
|
import com.jiluo.bolt.entity.po.Algorithm; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 算法信息表(Algorithm)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:08 |
||||
|
*/ |
||||
|
|
||||
|
public interface AlgorithmService extends IService<Algorithm> { |
||||
|
|
||||
|
public Algorithm getByPoint(String pointId); |
||||
|
|
||||
|
public Integer getPointCount(String algorithmId); |
||||
|
|
||||
|
public List<Algorithm> select(AlgorithmDto algorithmDto); |
||||
|
|
||||
|
public void add(AlgorithmDto algorithmDto); |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.dto.AlgorithmDto; |
||||
|
import com.jiluo.bolt.entity.po.AlgorithmTemplete; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* (AlgorithmTemplete)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:09 |
||||
|
*/ |
||||
|
|
||||
|
public interface AlgorithmTempleteService extends IService<AlgorithmTemplete> { |
||||
|
|
||||
|
|
||||
|
public List<AlgorithmTemplete> select(AlgorithmDto algorithmDto); |
||||
|
|
||||
|
public Integer selectTotal(AlgorithmDto algorithmDto); |
||||
|
|
||||
|
public String add(AlgorithmDto algorithmDto); |
||||
|
|
||||
|
public Boolean updateByBizId(AlgorithmDto algorithmDto); |
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.po.Config; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 系统配置表(Config)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:11 |
||||
|
*/ |
||||
|
|
||||
|
public interface ConfigService extends IService<Config> { |
||||
|
|
||||
|
public boolean updateByBizId(String bizId,String value); |
||||
|
|
||||
|
public Config selectByBizId(String bizId); |
||||
|
|
||||
|
public List<Config> selectByCategory(String category); |
||||
|
|
||||
|
public Config selectByDescription(String description); |
||||
|
|
||||
|
public List<Config> select(Config configDto); |
||||
|
|
||||
|
public Boolean add(Config configDto,String type); |
||||
|
|
||||
|
public Boolean updateByBizId(Config configDto); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.po.Defect; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.concurrent.ConcurrentHashMap; |
||||
|
|
||||
|
/** |
||||
|
* 检测结果表(Defect)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:11 |
||||
|
*/ |
||||
|
|
||||
|
public interface DefectService extends IService<Defect> { |
||||
|
|
||||
|
public static Map<String, Float> TEMPERATUREMAP = new ConcurrentHashMap<>(); |
||||
|
|
||||
|
public List<Defect> getRealTimeData(String jobId); |
||||
|
|
||||
|
public List<Defect> getByJob(String jobId); |
||||
|
|
||||
|
public List<Defect> getByJob(List<String> jobIds); |
||||
|
|
||||
|
public List<Defect> chartData(String pointId,String product,Integer zone,String startTime,String endTime); |
||||
|
|
||||
|
public List<Defect> exportData(String pointId, Date startTime, Date endTime, Integer status); |
||||
|
|
||||
|
public Defect selectToCompare(String jobId,String type,Integer zone,Integer position); |
||||
|
|
||||
|
public void add(Defect defect); |
||||
|
|
||||
|
public void update(Defect defect); |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.po.Detect; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 检测过程表(Detect)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:11 |
||||
|
*/ |
||||
|
|
||||
|
public interface DetectService extends IService<Detect> { |
||||
|
|
||||
|
public Map<Integer, List<String>> getImg(String jobId); |
||||
|
|
||||
|
public void add(Detect detect); |
||||
|
|
||||
|
public Integer selectByJob(String jobId); |
||||
|
|
||||
|
public List<Detect> getByJob(String jobId); |
||||
|
} |
||||
@ -0,0 +1,50 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.common.LocalStatus; |
||||
|
import com.jiluo.bolt.entity.dto.DeviceDto; |
||||
|
import com.jiluo.bolt.entity.dto.TempSenserDto; |
||||
|
import com.jiluo.bolt.entity.po.Device; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.concurrent.ConcurrentHashMap; |
||||
|
|
||||
|
/** |
||||
|
* 设备信息表(Device)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:11 |
||||
|
*/ |
||||
|
|
||||
|
public interface DeviceService extends IService<Device> { |
||||
|
|
||||
|
Map<String, LocalStatus> DeviceLocalStatus = new ConcurrentHashMap<>(); |
||||
|
|
||||
|
public Device selectByBizId(String deviceId); |
||||
|
|
||||
|
public List<Device> selectByPoint(String pointId); |
||||
|
|
||||
|
public List<Device> selectAll(); |
||||
|
|
||||
|
public void updateTemp(String deviceId,String tempThreshold); |
||||
|
|
||||
|
public void updateStatus(String deviceId,Integer status); |
||||
|
|
||||
|
public List<Device> select(DeviceDto deviceDto); |
||||
|
|
||||
|
public Integer selectTotal(DeviceDto deviceDto); |
||||
|
|
||||
|
public Boolean add(DeviceDto deviceDto,String type); |
||||
|
|
||||
|
public Boolean updateByBizId(DeviceDto deviceDto); |
||||
|
|
||||
|
public Boolean deactivate(DeviceDto deviceDto); |
||||
|
|
||||
|
public List<Device> select(TempSenserDto tempSenserDto); |
||||
|
|
||||
|
public Integer selectTotal(TempSenserDto tempSenserDto); |
||||
|
|
||||
|
public Boolean add(TempSenserDto tempSenserDto,String type); |
||||
|
|
||||
|
public Boolean updateByBizId(TempSenserDto tempSenserDto); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.po.DeviceTemplete; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* (DeviceTemplete)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:11 |
||||
|
*/ |
||||
|
|
||||
|
public interface DeviceTempleteService extends IService<DeviceTemplete> { |
||||
|
|
||||
|
public DeviceTemplete getByBizId(String venderId); |
||||
|
|
||||
|
public List<DeviceTemplete> getByBizId(List<String> venderIds); |
||||
|
|
||||
|
List<DeviceTemplete> getAll(); |
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.common.DetectJob; |
||||
|
import com.jiluo.bolt.entity.po.Job; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.concurrent.ConcurrentHashMap; |
||||
|
|
||||
|
/** |
||||
|
* 检测任务表(Job)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
|
||||
|
public interface JobService extends IService<Job> { |
||||
|
|
||||
|
public static Map<String, DetectJob> JOB_MAP = new ConcurrentHashMap<>(); |
||||
|
|
||||
|
public Job getByBizId(String jobId); |
||||
|
|
||||
|
public List<Job> getByBizId(List<String> jobIds); |
||||
|
|
||||
|
public Job getRealtimeJob(String pointId,String product); |
||||
|
|
||||
|
public List<Job> getHistoryJob(String pointId,Integer status, String product, Integer current, Integer size, |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") String startTime, |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") String endTime); |
||||
|
|
||||
|
public Integer getHistoryJobTotal(String pointId,Integer status, String product, |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") String startTime, |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") String endTime); |
||||
|
public List<Job> exportData(Date startTime,Date endTime); |
||||
|
|
||||
|
public void addJob(Job job); |
||||
|
|
||||
|
public void updateAttribute(String jobId, String attribute, Integer status); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,148 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
|
||||
|
import io.minio.ObjectStat; |
||||
|
import io.minio.Result; |
||||
|
import io.minio.errors.*; |
||||
|
import io.minio.messages.Item; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.io.IOException; |
||||
|
import java.io.InputStream; |
||||
|
import java.security.InvalidKeyException; |
||||
|
import java.security.NoSuchAlgorithmException; |
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/10/13/14:56 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
public interface MinioService { |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 判断 bucket是否存在 |
||||
|
* |
||||
|
* @param bucketName |
||||
|
* @return |
||||
|
*/ |
||||
|
boolean bucketExists(String bucketName); |
||||
|
|
||||
|
/** |
||||
|
* 创建 bucket |
||||
|
* |
||||
|
* @param bucketName |
||||
|
*/ |
||||
|
void makeBucket(String bucketName); |
||||
|
|
||||
|
/** |
||||
|
* 文件上传 |
||||
|
* |
||||
|
* @param bucketName |
||||
|
* @param objectName |
||||
|
* @param filename |
||||
|
*/ |
||||
|
void putObject(String bucketName, String objectName, String filename); |
||||
|
|
||||
|
/** |
||||
|
* 文件上传 |
||||
|
* |
||||
|
* @param bucketName |
||||
|
* @param objectName |
||||
|
* @param stream |
||||
|
*/ |
||||
|
void putObject(String bucketName, String objectName, InputStream stream, String contentType); |
||||
|
|
||||
|
/** |
||||
|
* 文件上传 |
||||
|
* |
||||
|
* @param bucketName |
||||
|
* @param multipartFile |
||||
|
*/ |
||||
|
void putObject(String bucketName, MultipartFile multipartFile, String filename); |
||||
|
|
||||
|
/** |
||||
|
* 删除文件 |
||||
|
* |
||||
|
* @param bucketName |
||||
|
* @param objectName |
||||
|
*/ |
||||
|
boolean removeObject(String bucketName, String objectName); |
||||
|
|
||||
|
/** |
||||
|
* 下载文件 |
||||
|
* |
||||
|
* @param fileName |
||||
|
* @param originalName |
||||
|
* @param response |
||||
|
*/ |
||||
|
void downloadFile(String bucketName, String fileName, String originalName, HttpServletResponse response); |
||||
|
|
||||
|
/** |
||||
|
* 获取文件路径 |
||||
|
* |
||||
|
* @param bucketName |
||||
|
* @param objectName |
||||
|
* @return |
||||
|
*/ |
||||
|
String getObjectUrl(String bucketName, String objectName); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @description: 文件下载 |
||||
|
* @param: bucketName |
||||
|
* objectName |
||||
|
* @return: io.minio.ObjectStat |
||||
|
* @author yangc |
||||
|
* @date: 2020-10-20 20:24 |
||||
|
*/ |
||||
|
ObjectStat statObject(String bucketName, String objectName); |
||||
|
|
||||
|
/** |
||||
|
* 以流的形式获取一个文件对象 |
||||
|
* |
||||
|
* @param bucketName 存储桶名称 |
||||
|
* @param objectName 存储桶里的对象名称 |
||||
|
* @return |
||||
|
*/ |
||||
|
InputStream getObject(String bucketName, String objectName); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 列出存储桶中所有对象 |
||||
|
* |
||||
|
* @param bucketName 存储桶名称 |
||||
|
* @return |
||||
|
*/ |
||||
|
Iterable<Result<Item>> listObjects(String bucketName); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 生成一个给HTTP GET请求用的presigned URL |
||||
|
* |
||||
|
* @param bucketName 存储桶名称 |
||||
|
* @param objectName 存储桶里的对象名称 |
||||
|
* @param expires 失效时间(以秒为单位),默认是7天,不得大于七天 |
||||
|
* @return |
||||
|
*/ |
||||
|
String presignedGetObject(String bucketName, String objectName, Integer expires); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 设置存储桶策略 |
||||
|
* |
||||
|
* @param bucketName 存储桶名称 |
||||
|
* @return |
||||
|
*/ |
||||
|
void setBucketPolicy(String bucketName, String policy) throws IOException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, ErrorResponseException, XmlParserException, InvalidBucketNameException, InsufficientDataException, InternalException; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 获取存储桶策略 |
||||
|
* |
||||
|
* @param bucketName 存储桶名称 |
||||
|
* @return |
||||
|
*/ |
||||
|
String getBucketPolicy(String bucketName) throws IOException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, BucketPolicyTooLargeException, ErrorResponseException, XmlParserException, InvalidBucketNameException, InsufficientDataException, InternalException; |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.dto.MotorGroupDto; |
||||
|
import com.jiluo.bolt.entity.po.MotorGroup; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 机组信息表(MotorGroup)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
|
||||
|
public interface MotorGroupService extends IService<MotorGroup> { |
||||
|
|
||||
|
public List<MotorGroup> getAll(); |
||||
|
|
||||
|
public MotorGroup getByBizId(String bizId); |
||||
|
|
||||
|
public Integer getTotalByPowerStation(String powerStationId); |
||||
|
|
||||
|
public List<MotorGroup> select(MotorGroupDto motorGroupDto); |
||||
|
|
||||
|
public Integer selectTotal(MotorGroupDto motorGroupDto); |
||||
|
|
||||
|
public Boolean add(MotorGroupDto motorGroupDto); |
||||
|
|
||||
|
public Boolean updateByBizId(MotorGroupDto motorGroupDto); |
||||
|
} |
||||
@ -0,0 +1,42 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.dto.PointDto; |
||||
|
import com.jiluo.bolt.entity.po.Point; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 检测点表(Point)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
|
||||
|
public interface PointService extends IService<Point> { |
||||
|
|
||||
|
public List<Point> getAll(); |
||||
|
|
||||
|
public List<Point> getByRole(String groupPermission); |
||||
|
|
||||
|
public void updateEnableDetect(String pointId,Integer enableDetect); |
||||
|
|
||||
|
public void updateResetTime(String pointId, Date date); |
||||
|
|
||||
|
public void updateConfig(String pointId, String config); |
||||
|
|
||||
|
public Point getByBizId(String bizId); |
||||
|
|
||||
|
public Integer getTotalByMotorGroup(String motorGroupId); |
||||
|
|
||||
|
public List<Point> select(PointDto pointDto); |
||||
|
|
||||
|
public Integer selectTotal(PointDto pointDto); |
||||
|
|
||||
|
public Boolean add(PointDto pointDto); |
||||
|
|
||||
|
public Boolean updateByBizId(PointDto pointDto); |
||||
|
|
||||
|
public Boolean updateDetect(PointDto pointDto); |
||||
|
|
||||
|
public List<Point> getByPowerStation(String powerStationId); |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.dto.PowerStationDto; |
||||
|
import com.jiluo.bolt.entity.po.PowerStation; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 电站表(PowerStation)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
|
||||
|
public interface PowerStationService extends IService<PowerStation> { |
||||
|
public List<PowerStation> getAll(); |
||||
|
|
||||
|
public PowerStation getByBizId(String bizId); |
||||
|
|
||||
|
public List<PowerStation> select(PowerStationDto powerStationDto); |
||||
|
|
||||
|
public Integer selectTotal(PowerStationDto powerStationDto); |
||||
|
|
||||
|
public Boolean add(PowerStationDto powerStationDto); |
||||
|
|
||||
|
public Boolean updateByBizId(PowerStationDto powerStationDto); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.po.Product; |
||||
|
|
||||
|
/** |
||||
|
* 检测类型表(Product)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
|
||||
|
public interface ProductService extends IService<Product> { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.po.RoleItem; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 权限信息表(RoleItem)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
|
||||
|
public interface RoleItemService extends IService<RoleItem> { |
||||
|
|
||||
|
public RoleItem getByBizId(String bizId); |
||||
|
|
||||
|
public List<RoleItem> getByBizId(List<String> itemIds); |
||||
|
|
||||
|
public List<RoleItem> getAll(); |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.dto.RoleDto; |
||||
|
import com.jiluo.bolt.entity.po.Role; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 角色信息表(Role)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 18:59:16 |
||||
|
*/ |
||||
|
|
||||
|
public interface RoleService extends IService<Role> { |
||||
|
|
||||
|
public Role getByRoleId(String roleId); |
||||
|
|
||||
|
public List<Role> select(RoleDto roleDto); |
||||
|
|
||||
|
public String add(RoleDto roleDto); |
||||
|
|
||||
|
public Boolean updateByBizId(RoleDto roleDto); |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.dto.PermissionDto; |
||||
|
import com.jiluo.bolt.entity.po.RoleValue; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 角色信息表(Role)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
|
||||
|
public interface RoleValueService extends IService<RoleValue> { |
||||
|
|
||||
|
public List<RoleValue> getByRoleId(String roleId); |
||||
|
|
||||
|
public RoleValue getProduct(String roleId); |
||||
|
|
||||
|
public List<RoleValue> select(PermissionDto permissionDto); |
||||
|
|
||||
|
public Boolean add(RoleValue roleValue); |
||||
|
|
||||
|
public Boolean updateByItemId(RoleValue roleValue); |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.dto.UserDto; |
||||
|
import com.jiluo.bolt.entity.po.User; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 用户信息表(User)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
|
||||
|
public interface UserService extends IService<User> { |
||||
|
|
||||
|
public User getByUid(String uid); |
||||
|
|
||||
|
public List<User> select(UserDto userDto); |
||||
|
|
||||
|
public Boolean add(UserDto userDto); |
||||
|
|
||||
|
public Boolean updateByBizId(UserDto userDto); |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
package com.jiluo.bolt.service; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.jiluo.bolt.entity.po.Version; |
||||
|
|
||||
|
/** |
||||
|
* 版本信息表(Version)表服务接口 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
|
||||
|
public interface VersionService extends IService<Version> { |
||||
|
|
||||
|
public Version select(); |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.mapper.AlarmMapper; |
||||
|
import com.jiluo.bolt.entity.po.Alarm; |
||||
|
import com.jiluo.bolt.service.AlarmService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 告警信息表(Alarm)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:07 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements AlarmService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(AlarmServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
AlarmMapper alarmMapper; |
||||
|
|
||||
|
public List<Alarm> getAll(){ |
||||
|
return new ArrayList<>(ALARM_MAP.values()); |
||||
|
} |
||||
|
|
||||
|
public void add(Alarm alarm){ |
||||
|
alarmMapper.insert(alarm); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,86 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.entity.dto.AlgorithmDto; |
||||
|
import com.jiluo.bolt.entity.po.AlgorithmTemplete; |
||||
|
import com.jiluo.bolt.entity.po.Config; |
||||
|
import com.jiluo.bolt.mapper.AlgorithmMapper; |
||||
|
import com.jiluo.bolt.entity.po.Algorithm; |
||||
|
import com.jiluo.bolt.mapper.AlgorithmTempleteMapper; |
||||
|
import com.jiluo.bolt.mapper.ConfigMapper; |
||||
|
import com.jiluo.bolt.service.AlgorithmService; |
||||
|
import com.jiluo.bolt.util.SnowFlakeUtil; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 算法信息表(Algorithm)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:09 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class AlgorithmServiceImpl extends ServiceImpl<AlgorithmMapper, Algorithm> implements AlgorithmService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(AlgorithmServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
AlgorithmMapper algorithmMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
AlgorithmTempleteMapper algorithmTempleteMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
ConfigMapper configMapper; |
||||
|
|
||||
|
public Algorithm getByPoint(String pointId){ |
||||
|
QueryWrapper<Algorithm> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("point",pointId); |
||||
|
return algorithmMapper.selectOne(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer getPointCount(String algorithmId) { |
||||
|
QueryWrapper<Algorithm> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("algorithm",algorithmId); |
||||
|
return algorithmMapper.selectCount(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Algorithm> select(AlgorithmDto algorithmDto) { |
||||
|
QueryWrapper<Algorithm> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq(StringUtils.isNotBlank(algorithmDto.getAlgorithmId()),"algorithm",algorithmDto.getAlgorithmId()); |
||||
|
return algorithmMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void add(AlgorithmDto algorithmDto) { |
||||
|
algorithmDto.getPoints().forEach(item ->{ |
||||
|
Algorithm algorithm = new Algorithm(); |
||||
|
JSONObject config = new JSONObject(); |
||||
|
JSONObject attribute = new JSONObject(); |
||||
|
Config algorithm_model_config = configMapper.selectOne(new QueryWrapper<Config>().eq("biz_id","algorithm_model_dir")); |
||||
|
if (algorithm_model_config!=null){ |
||||
|
String algorithm_model_dir = algorithm_model_config.getValue()+algorithmDto.getAlgorithmFileName(); |
||||
|
config.put("algorithm_name",algorithmDto.getAlgorithmName()); |
||||
|
config.put("algorithm_model",algorithm_model_dir); |
||||
|
attribute.put("detect_threshold_model",algorithmDto.getAlgorithmFileName()); |
||||
|
algorithm.setBizId("algorithm_"+ SnowFlakeUtil.getDefaultSnowFlakeId()) |
||||
|
.setAlgorithm(algorithmDto.getAlgorithmId()) |
||||
|
.setPowerStation(item.getPowerStationId()) |
||||
|
.setMotorGroup(item.getMotorGroupId()) |
||||
|
.setPoint(item.getPointId()) |
||||
|
.setConfig(config.toJSONString()) |
||||
|
.setAttribute(attribute.toJSONString()) |
||||
|
.setVersion("1.0.0"); |
||||
|
algorithmMapper.insert(algorithm); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,79 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.entity.dto.AlgorithmDto; |
||||
|
import com.jiluo.bolt.mapper.AlgorithmTempleteMapper; |
||||
|
import com.jiluo.bolt.entity.po.AlgorithmTemplete; |
||||
|
import com.jiluo.bolt.service.AlgorithmTempleteService; |
||||
|
import com.jiluo.bolt.util.SnowFlakeUtil; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* (AlgorithmTemplete)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:10 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class AlgorithmTempleteServiceImpl extends ServiceImpl<AlgorithmTempleteMapper, AlgorithmTemplete> implements AlgorithmTempleteService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(AlgorithmTempleteServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
AlgorithmTempleteMapper algorithmTempleteMapper; |
||||
|
|
||||
|
@Override |
||||
|
public List<AlgorithmTemplete> select(AlgorithmDto algorithmDto) { |
||||
|
QueryWrapper<AlgorithmTemplete> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.like(StringUtils.isNotBlank(algorithmDto.getAlgorithmName()),"name",algorithmDto.getAlgorithmName()) |
||||
|
.eq(StringUtils.isNotBlank(algorithmDto.getSource()),"source",algorithmDto.getSource()) |
||||
|
.eq(StringUtils.isNotBlank(algorithmDto.getAlgorithmId()),"biz_id",algorithmDto.getAlgorithmId());; |
||||
|
return algorithmTempleteMapper.selectList(queryWrapper); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer selectTotal(AlgorithmDto algorithmDto) { |
||||
|
QueryWrapper<AlgorithmTemplete> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.like(StringUtils.isNotBlank(algorithmDto.getAlgorithmName()),"name",algorithmDto.getAlgorithmName()) |
||||
|
.eq(StringUtils.isNotBlank(algorithmDto.getSource()),"source",algorithmDto.getSource()); |
||||
|
return algorithmTempleteMapper.selectCount(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String add(AlgorithmDto algorithmDto) { |
||||
|
AlgorithmTemplete algorithmTemplete = new AlgorithmTemplete(); |
||||
|
JSONObject config = new JSONObject(); |
||||
|
config.put("detect_threshold_model",algorithmDto.getAlgorithmFileName()); |
||||
|
algorithmTemplete.setBizId(algorithmDto.getSource()+ SnowFlakeUtil.getDefaultSnowFlakeId()) |
||||
|
.setSource(algorithmDto.getSource()) |
||||
|
.setName(algorithmDto.getAlgorithmName()) |
||||
|
.setDrive(algorithmDto.getAlgorithmFileName()) |
||||
|
.setVersion("1.0.0") |
||||
|
.setConfig(config.toJSONString()); |
||||
|
algorithmTempleteMapper.insert(algorithmTemplete); |
||||
|
return algorithmTemplete.getBizId(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean updateByBizId(AlgorithmDto algorithmDto) { |
||||
|
UpdateWrapper<AlgorithmTemplete> updateWrapper = new UpdateWrapper<>(); |
||||
|
JSONObject config = new JSONObject(); |
||||
|
config.put("detect_threshold_model",algorithmDto.getAlgorithmFileName()); |
||||
|
|
||||
|
updateWrapper.eq("biz_id",algorithmDto.getAlgorithmId()) |
||||
|
.set("source",algorithmDto.getSource()) |
||||
|
.set("name",algorithmDto.getAlgorithmName()) |
||||
|
.set("drive",algorithmDto.getAlgorithmFileName()) |
||||
|
.set("config",config.toJSONString()); |
||||
|
return algorithmTempleteMapper.update(null,updateWrapper)>0?true:false; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,85 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.mapper.ConfigMapper; |
||||
|
import com.jiluo.bolt.entity.po.Config; |
||||
|
import com.jiluo.bolt.service.ConfigService; |
||||
|
import com.jiluo.bolt.util.SnowFlakeUtil; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 系统配置表(Config)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:11 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ConfigServiceImpl extends ServiceImpl<ConfigMapper, Config> implements ConfigService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(ConfigServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
ConfigMapper configMapper; |
||||
|
|
||||
|
public boolean updateByBizId(String bizId,String value){ |
||||
|
UpdateWrapper<Config> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",bizId).set("value",value); |
||||
|
configMapper.update(null,updateWrapper); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
public Config selectByBizId(String bizId){ |
||||
|
QueryWrapper<Config> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("biz_id",bizId); |
||||
|
return configMapper.selectOne(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Config> selectByCategory(String category) { |
||||
|
QueryWrapper<Config> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("category",category); |
||||
|
return configMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Config selectByDescription(String description) { |
||||
|
QueryWrapper<Config> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("description",description); |
||||
|
return configMapper.selectOne(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Config> select(Config configDto) { |
||||
|
QueryWrapper<Config> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq(StringUtils.isNotBlank(configDto.getConfigId()),"biz_id",configDto.getConfigId()) |
||||
|
.eq(StringUtils.isNotBlank(configDto.getDescription()),"description",configDto.getDescription()) |
||||
|
.eq(StringUtils.isNotBlank(configDto.getCategory()),"category",configDto.getCategory()); |
||||
|
|
||||
|
return configMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean add(Config configDto,String type) { |
||||
|
configDto.setConfigId(type+ SnowFlakeUtil.getDefaultSnowFlakeId()); |
||||
|
return configMapper.insert(configDto)>0?true:false; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean updateByBizId(Config configDto) { |
||||
|
UpdateWrapper<Config> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",configDto.getConfigId()) |
||||
|
.set(StringUtils.isNotBlank(configDto.getValue()),"value",configDto.getValue()) |
||||
|
.set(StringUtils.isNotBlank(configDto.getDescription()),"description",configDto.getDescription()) |
||||
|
.set(StringUtils.isNotBlank(configDto.getCategory()),"category",configDto.getCategory()) |
||||
|
.set(StringUtils.isNotBlank(configDto.getType()),"type",configDto.getType()); |
||||
|
|
||||
|
return configMapper.update(null,updateWrapper)>0?true:false; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,106 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.common.DefectType; |
||||
|
import com.jiluo.bolt.common.DetectType; |
||||
|
import com.jiluo.bolt.common.LocalStatus; |
||||
|
import com.jiluo.bolt.entity.po.Job; |
||||
|
import com.jiluo.bolt.mapper.DefectMapper; |
||||
|
import com.jiluo.bolt.entity.po.Defect; |
||||
|
import com.jiluo.bolt.mapper.JobMapper; |
||||
|
import com.jiluo.bolt.service.DefectService; |
||||
|
import com.jiluo.bolt.util.BigDecimalUtils; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.scheduling.annotation.Scheduled; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import javax.annotation.PostConstruct; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.RoundingMode; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 检测结果表(Defect)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:11 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class DefectServiceImpl extends ServiceImpl<DefectMapper, Defect> implements DefectService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(DefectServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
DefectMapper defectMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
JobMapper jobMapper; |
||||
|
|
||||
|
@PostConstruct |
||||
|
public void init() { |
||||
|
defectMapper.selectTemperature().forEach(defect -> { |
||||
|
DefectService.TEMPERATUREMAP.put(defect.getPoint(), BigDecimalUtils.DBToFront(DefectType.temperature,defect.getValue()).floatValue()); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
@Scheduled(cron = "0 0 * * * *") |
||||
|
public void updateLocal() { |
||||
|
defectMapper.selectTemperature().forEach(defect -> { |
||||
|
DefectService.TEMPERATUREMAP.put(defect.getPoint(), BigDecimalUtils.DBToFront(DefectType.temperature,defect.getValue()).floatValue()); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public List<Defect> getRealTimeData(String jobId){ |
||||
|
QueryWrapper<Defect> wrapper = new QueryWrapper<Defect>(); |
||||
|
wrapper.eq("job",jobId).eq("status",0); |
||||
|
return defectMapper.selectList(wrapper); |
||||
|
} |
||||
|
|
||||
|
public List<Defect> getByJob(String jobId){ |
||||
|
QueryWrapper<Defect> wrapper = new QueryWrapper<Defect>(); |
||||
|
wrapper.eq("job",jobId).eq("status",0); |
||||
|
return defectMapper.selectList(wrapper); |
||||
|
} |
||||
|
|
||||
|
public List<Defect> getByJob(List<String> jobIds){ |
||||
|
QueryWrapper<Defect> wrapper = new QueryWrapper<Defect>(); |
||||
|
wrapper.in("job",jobIds); |
||||
|
return defectMapper.selectList(wrapper); |
||||
|
} |
||||
|
|
||||
|
public List<Defect> chartData(String pointId,String product,Integer zone,String startTime,String endTime){ |
||||
|
QueryWrapper<Defect> wrapper = new QueryWrapper<Defect>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(pointId),"point",pointId) |
||||
|
.eq(StringUtils.isNotBlank(product),"type",product) |
||||
|
.eq("zone",zone) |
||||
|
.between(StringUtils.isNotBlank(startTime)&&StringUtils.isNotBlank(endTime),"gmt_create",startTime,endTime); |
||||
|
return defectMapper.selectList(wrapper); |
||||
|
} |
||||
|
public List<Defect> exportData(String pointId, Date startTime, Date endTime, Integer status){ |
||||
|
QueryWrapper<Defect> wrapper = new QueryWrapper<Defect>(); |
||||
|
wrapper.eq(pointId!=null&&StringUtils.isNotBlank(pointId),"point",pointId).between("gmt_create",startTime,endTime).eq(status!=null,"status",status); |
||||
|
return defectMapper.selectList(wrapper); |
||||
|
} |
||||
|
|
||||
|
public Defect selectToCompare(String jobId,String type,Integer zone,Integer position){ |
||||
|
QueryWrapper<Defect> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq("job",jobId) |
||||
|
.eq("type",type) |
||||
|
.eq("zone",zone) |
||||
|
.eq("position",position); |
||||
|
return defectMapper.selectOne(wrapper); |
||||
|
} |
||||
|
|
||||
|
public void add(Defect defect){ |
||||
|
defectMapper.insert(defect); |
||||
|
} |
||||
|
|
||||
|
public void update(Defect defect){ |
||||
|
defectMapper.updateById(defect); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,63 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.mapper.DetectMapper; |
||||
|
import com.jiluo.bolt.entity.po.Detect; |
||||
|
import com.jiluo.bolt.service.DetectService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* 检测过程表(Detect)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:11 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class DetectServiceImpl extends ServiceImpl<DetectMapper, Detect> implements DetectService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(DetectServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
DetectMapper detectMapper; |
||||
|
|
||||
|
public Map<Integer, List<String>> getImg(String jobId){ |
||||
|
QueryWrapper<Detect> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("job",jobId); |
||||
|
Map<Integer,List<String>> result = new HashMap<>(); |
||||
|
detectMapper.selectList(queryWrapper).stream().collect(Collectors.groupingBy(Detect::getZone)) |
||||
|
.forEach((k,v)->{ |
||||
|
List<String> imgs = new ArrayList<>(); |
||||
|
v.stream().forEach(defect->imgs.add(defect.getData())); |
||||
|
result.put(k,imgs); |
||||
|
}); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
public void add(Detect detect){ |
||||
|
detectMapper.insert(detect); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer selectByJob(String jobId) { |
||||
|
QueryWrapper<Detect> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("job",jobId); |
||||
|
return detectMapper.selectCount(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Detect> getByJob(String jobId) { |
||||
|
QueryWrapper<Detect> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("job",jobId); |
||||
|
return detectMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,202 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.common.LocalStatus; |
||||
|
import com.jiluo.bolt.entity.dto.DeviceDto; |
||||
|
import com.jiluo.bolt.entity.dto.TempSenserDto; |
||||
|
import com.jiluo.bolt.mapper.DeviceMapper; |
||||
|
import com.jiluo.bolt.entity.po.Device; |
||||
|
import com.jiluo.bolt.service.DeviceService; |
||||
|
import com.jiluo.bolt.util.SnowFlakeUtil; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import javax.annotation.PostConstruct; |
||||
|
import java.util.*; |
||||
|
|
||||
|
/** |
||||
|
* 设备信息表(Device)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:11 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements DeviceService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(DeviceServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
DeviceMapper deviceMapper; |
||||
|
|
||||
|
@PostConstruct |
||||
|
public void init() { |
||||
|
deviceMapper.selectList(new QueryWrapper<>()).forEach(device -> DeviceLocalStatus.putIfAbsent(device.getPointId(), LocalStatus.builder().pointStatus(2).cameraStatus(2).tempSensorStatus(2).build())); |
||||
|
} |
||||
|
|
||||
|
public Device selectByBizId(String deviceId){ |
||||
|
QueryWrapper<Device> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("biz_id",deviceId); |
||||
|
Device device = deviceMapper.selectOne(queryWrapper); |
||||
|
if (DeviceLocalStatus.get(device.getPointId()).getCameraStatus()==2){ |
||||
|
device.setStatus(2); |
||||
|
} |
||||
|
return device; |
||||
|
} |
||||
|
|
||||
|
public List<Device> selectByPoint(String pointId){ |
||||
|
QueryWrapper<Device> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("point",pointId); |
||||
|
List<Device> deviceList = deviceMapper.selectList(queryWrapper); |
||||
|
deviceList.stream().filter(device -> DeviceLocalStatus.get(device.getPointId()).getCameraStatus()==2).forEach(device -> device.setStatus(2)); |
||||
|
return deviceList; |
||||
|
} |
||||
|
|
||||
|
public List<Device> selectAll(){ |
||||
|
List<Device> deviceList = deviceMapper.selectList(new QueryWrapper<>()); |
||||
|
deviceList.stream().filter(device -> DeviceLocalStatus.get(device.getPointId()).getCameraStatus()==2).forEach(device -> device.setStatus(2)); |
||||
|
return deviceList; |
||||
|
} |
||||
|
|
||||
|
public void updateTemp(String deviceId,String tempThreshold){ |
||||
|
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",deviceId).set("temp_threshold",tempThreshold); |
||||
|
deviceMapper.update(null,updateWrapper); |
||||
|
} |
||||
|
|
||||
|
public void updateStatus(String deviceId,Integer status){ |
||||
|
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",deviceId).set("status",status); |
||||
|
deviceMapper.update(null,updateWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Device> select(DeviceDto deviceDto) { |
||||
|
QueryWrapper<Device> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("type","camera") |
||||
|
.eq(StringUtils.isNotBlank(deviceDto.getPowerStationId()),"power_station",deviceDto.getPowerStationId()) |
||||
|
.eq(StringUtils.isNotBlank(deviceDto.getPointId()),"point",deviceDto.getPointId()) |
||||
|
.eq(deviceDto.getStatus()!=null,"status",deviceDto.getStatus()); |
||||
|
List<Device> deviceList = deviceMapper.selectList(queryWrapper); |
||||
|
deviceList.stream().filter(device -> DeviceLocalStatus.get(device.getPointId()).getCameraStatus()==2).forEach(device -> device.setStatus(2)); |
||||
|
return deviceList; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer selectTotal(DeviceDto deviceDto) { |
||||
|
QueryWrapper<Device> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("type","camera") |
||||
|
.eq(StringUtils.isNotBlank(deviceDto.getPowerStationId()),"power_station",deviceDto.getPowerStationId()) |
||||
|
.eq(StringUtils.isNotBlank(deviceDto.getPointId()),"point",deviceDto.getPointId()) |
||||
|
.eq(deviceDto.getStatus()!=null,"status",deviceDto.getStatus()); |
||||
|
return deviceMapper.selectCount(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean add(DeviceDto deviceDto,String type) { |
||||
|
Device device = new Device(); |
||||
|
String deviceId = "camera_"+SnowFlakeUtil.getDefaultSnowFlakeId(); |
||||
|
device.setDeviceId(deviceId) |
||||
|
.setType(type) |
||||
|
.setName(deviceDto.getName()) |
||||
|
.setPowerStationId(deviceDto.getPowerStationId()) |
||||
|
.setProduct("BOLT_AND_LINE") |
||||
|
.setMotorGroupId(deviceDto.getMotorGroupId()) |
||||
|
.setPointId(deviceDto.getPointId()) |
||||
|
.setStatus(1) |
||||
|
.setTempThreshold("") |
||||
|
.setConfig(deviceDto.getConfig()) |
||||
|
.setVender(deviceDto.getVender()); |
||||
|
boolean result = deviceMapper.insert(device)>0?true:false; |
||||
|
if(result){ |
||||
|
DeviceLocalStatus.putIfAbsent(device.getPointId(), LocalStatus.builder().pointStatus(2).cameraStatus(2).tempSensorStatus(2).build()); |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean updateByBizId(DeviceDto deviceDto) { |
||||
|
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",deviceDto.getDeviceId()) |
||||
|
.set("power_station",deviceDto.getPowerStationId()) |
||||
|
.set("motor_group",deviceDto.getMotorGroupId()) |
||||
|
.set("point",deviceDto.getPointId()) |
||||
|
.set("name",deviceDto.getName()) |
||||
|
.set("vender",deviceDto.getVender()) |
||||
|
.set("config",deviceDto.getConfig()); |
||||
|
return deviceMapper.update(null,updateWrapper)>0?true:false; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean deactivate(DeviceDto deviceDto) { |
||||
|
if (!DeviceLocalStatus.containsKey(deviceDto.getPointId())){ |
||||
|
return false; |
||||
|
} |
||||
|
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",deviceDto.getDeviceId()).set("status",deviceDto.getStatus()); |
||||
|
deviceMapper.update(null,updateWrapper); |
||||
|
return true; |
||||
|
} |
||||
|
@Override |
||||
|
public List<Device> select(TempSenserDto tempSenserDto) { |
||||
|
QueryWrapper<Device> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("type","temperature_sensor") |
||||
|
.eq(StringUtils.isNotBlank(tempSenserDto.getPowerStationId()),"power_station",tempSenserDto.getPowerStationId()) |
||||
|
.eq(StringUtils.isNotBlank(tempSenserDto.getPointId()),"point",tempSenserDto.getPointId()) |
||||
|
.eq(tempSenserDto.getStatus()!=null,"status",tempSenserDto.getStatus()); |
||||
|
List<Device> deviceList = deviceMapper.selectList(queryWrapper); |
||||
|
deviceList.stream().filter(device -> DeviceLocalStatus.get(device.getPointId()).getCameraStatus()==2).forEach(device -> device.setStatus(2)); |
||||
|
return deviceList; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer selectTotal(TempSenserDto tempSenserDto) { |
||||
|
QueryWrapper<Device> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("type","temperature_sensor") |
||||
|
.eq(StringUtils.isNotBlank(tempSenserDto.getPowerStationId()),"power_station",tempSenserDto.getPowerStationId()) |
||||
|
.eq(StringUtils.isNotBlank(tempSenserDto.getPointId()),"point",tempSenserDto.getPointId()) |
||||
|
.eq(tempSenserDto.getStatus()!=null,"status",tempSenserDto.getStatus()); |
||||
|
return deviceMapper.selectCount(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean add(TempSenserDto tempSenserDto,String type) { |
||||
|
Device device = new Device(); |
||||
|
String deviceId = "temperature_sensor_"+SnowFlakeUtil.getDefaultSnowFlakeId(); |
||||
|
device.setDeviceId(deviceId) |
||||
|
.setType(type) |
||||
|
.setName(tempSenserDto.getName()) |
||||
|
.setPowerStationId(tempSenserDto.getPowerStationId()) |
||||
|
.setProduct("TEMPERATURE") |
||||
|
.setMotorGroupId(tempSenserDto.getMotorGroupId()) |
||||
|
.setPointId(tempSenserDto.getPointId()) |
||||
|
.setStatus(1) |
||||
|
.setTempThreshold("") |
||||
|
.setConfig(tempSenserDto.getConfig().toJSONString()) |
||||
|
.setVender(tempSenserDto.getTypeId()); |
||||
|
boolean result = deviceMapper.insert(device)>0?true:false; |
||||
|
if(result){ |
||||
|
DeviceLocalStatus.putIfAbsent(device.getPointId(), LocalStatus.builder().pointStatus(2).cameraStatus(2).tempSensorStatus(2).build()); |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean updateByBizId(TempSenserDto tempSenserDto) { |
||||
|
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",tempSenserDto.getDeviceId()) |
||||
|
.set("power_station",tempSenserDto.getPowerStationId()) |
||||
|
.set("motor_group",tempSenserDto.getMotorGroupId()) |
||||
|
.set("point",tempSenserDto.getPointId()) |
||||
|
.set("name",tempSenserDto.getName()) |
||||
|
.set("vender",tempSenserDto.getTypeId()) |
||||
|
.set("config",tempSenserDto.getConfig().toJSONString()); |
||||
|
return deviceMapper.update(null,updateWrapper)>0?true:false; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,54 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.mapper.DeviceTempleteMapper; |
||||
|
import com.jiluo.bolt.entity.po.DeviceTemplete; |
||||
|
import com.jiluo.bolt.service.DeviceTempleteService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import javax.annotation.PostConstruct; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* (DeviceTemplete)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:11 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class DeviceTempleteServiceImpl extends ServiceImpl<DeviceTempleteMapper, DeviceTemplete> implements DeviceTempleteService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(DeviceTempleteServiceImpl.class); |
||||
|
|
||||
|
List<DeviceTemplete> deviceTempleteList = new ArrayList<>(); |
||||
|
|
||||
|
@Autowired |
||||
|
DeviceTempleteMapper deviceTempleteMapper; |
||||
|
|
||||
|
@PostConstruct |
||||
|
private void init(){ |
||||
|
QueryWrapper<DeviceTemplete> queryWrapper = new QueryWrapper<>(); |
||||
|
deviceTempleteList = deviceTempleteMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DeviceTemplete getByBizId(String venderId) { |
||||
|
return deviceTempleteList.stream().filter(x-> StringUtils.equalsIgnoreCase(x.getBizId(),venderId)).findFirst().orElse(null); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<DeviceTemplete> getByBizId(List<String> venderIds) { |
||||
|
return deviceTempleteList.stream().filter(x->venderIds.stream().anyMatch(_venderId -> StringUtils.equalsIgnoreCase(x.getBizId(),_venderId))).collect(Collectors.toList()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<DeviceTemplete> getAll() { |
||||
|
return deviceTempleteList; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,99 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.mapper.JobMapper; |
||||
|
import com.jiluo.bolt.entity.po.Job; |
||||
|
import com.jiluo.bolt.service.JobService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 检测任务表(Job)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class JobServiceImpl extends ServiceImpl<JobMapper, Job> implements JobService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(JobServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
JobMapper jobMapper; |
||||
|
|
||||
|
@Override |
||||
|
public Job getByBizId(String jobId) { |
||||
|
QueryWrapper<Job> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("biz_id",jobId); |
||||
|
return jobMapper.selectOne(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
public List<Job> getByBizId(List<String> jobIds) { |
||||
|
QueryWrapper<Job> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.in("biz_id", jobIds); |
||||
|
return jobMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
public Job getRealtimeJob(String pointId, String product){ |
||||
|
QueryWrapper<Job> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("point",pointId) |
||||
|
.eq("product",product) |
||||
|
.orderByDesc("gmt_create") |
||||
|
.last("limit 1"); |
||||
|
return jobMapper.selectOne(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
public List<Job> getHistoryJob(String pointId, Integer status, String product, Integer current, Integer size, |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") String startTime, |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") String endTime){ |
||||
|
StringBuilder lastSql = new StringBuilder(); |
||||
|
lastSql.append("limit ").append(current-1).append(",").append(size); |
||||
|
QueryWrapper<Job> wrapper = new QueryWrapper<Job>(); |
||||
|
//组装模糊查询条件
|
||||
|
wrapper.eq(StringUtils.isNotBlank(pointId),"point",pointId) |
||||
|
.eq(status!=null,"status",status) |
||||
|
.eq(StringUtils.isNotBlank(product),"product",product) |
||||
|
.between(StringUtils.isNotBlank(startTime)&&StringUtils.isNotBlank(endTime),"gmt_create",startTime,endTime) |
||||
|
.ne("attribute","{}") |
||||
|
.orderByDesc("gmt_create"); |
||||
|
wrapper.last(lastSql.toString()); |
||||
|
return jobMapper.selectList(wrapper); |
||||
|
} |
||||
|
|
||||
|
public Integer getHistoryJobTotal(String pointId,Integer status, String product, |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") String startTime, |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") String endTime){ |
||||
|
QueryWrapper<Job> wrapper = new QueryWrapper<Job>(); |
||||
|
//组装模糊查询条件
|
||||
|
wrapper.eq(StringUtils.isNotBlank(pointId),"point",pointId) |
||||
|
.eq(status!=null,"status",status) |
||||
|
.eq(StringUtils.isNotBlank(product),"product",product) |
||||
|
.between(StringUtils.isNotBlank(startTime)&&StringUtils.isNotBlank(endTime),"gmt_create",startTime,endTime); |
||||
|
return jobMapper.selectCount(wrapper); |
||||
|
} |
||||
|
|
||||
|
public List<Job> exportData(Date startTime, Date endTime){ |
||||
|
QueryWrapper<Job> wrapper = new QueryWrapper<Job>(); |
||||
|
//组装模糊查询条件
|
||||
|
wrapper.between("gmt_create",startTime,endTime); |
||||
|
return jobMapper.selectList(wrapper); |
||||
|
} |
||||
|
|
||||
|
public void addJob(Job job){ |
||||
|
jobMapper.insert(job); |
||||
|
} |
||||
|
|
||||
|
public void updateAttribute(String jobId, String attribute, Integer status){ |
||||
|
UpdateWrapper<Job> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",jobId).set("attribute",attribute).set("status",status); |
||||
|
jobMapper.update(null,updateWrapper); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,191 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.jiluo.bolt.service.MinioService; |
||||
|
import com.jiluo.bolt.util.MinioUtil; |
||||
|
import io.minio.ObjectStat; |
||||
|
import io.minio.Result; |
||||
|
import io.minio.errors.*; |
||||
|
import io.minio.messages.Item; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.io.IOException; |
||||
|
import java.io.InputStream; |
||||
|
import java.security.InvalidKeyException; |
||||
|
import java.security.NoSuchAlgorithmException; |
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/10/13/14:58 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
@Service |
||||
|
public class MinioServiceImpl implements MinioService { |
||||
|
|
||||
|
@Autowired |
||||
|
private MinioUtil minioUtil; |
||||
|
|
||||
|
/** |
||||
|
* 判断 bucket是否存在 |
||||
|
* |
||||
|
* @param bucketName |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public boolean bucketExists(String bucketName) { |
||||
|
return minioUtil.bucketExists(bucketName); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 创建 bucket |
||||
|
* |
||||
|
* @param bucketName |
||||
|
*/ |
||||
|
@Override |
||||
|
public void makeBucket(String bucketName) { |
||||
|
minioUtil.makeBucket(bucketName); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 文件上传 |
||||
|
* |
||||
|
* @param bucketName |
||||
|
* @param objectName |
||||
|
* @param filename |
||||
|
*/ |
||||
|
@Override |
||||
|
public void putObject(String bucketName, String objectName, String filename) { |
||||
|
minioUtil.putObject(bucketName, objectName, filename); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public void putObject(String bucketName, String objectName, InputStream stream, String contentType) { |
||||
|
minioUtil.putObject(bucketName, objectName, stream, contentType); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 文件上传 |
||||
|
* |
||||
|
* @param bucketName |
||||
|
* @param multipartFile |
||||
|
*/ |
||||
|
@Override |
||||
|
public void putObject(String bucketName, MultipartFile multipartFile, String filename) { |
||||
|
minioUtil.putObject(bucketName, multipartFile, filename); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除文件 |
||||
|
* |
||||
|
* @param bucketName |
||||
|
* @param objectName |
||||
|
*/ |
||||
|
@Override |
||||
|
public boolean removeObject(String bucketName, String objectName) { |
||||
|
return minioUtil.removeObject(bucketName, objectName); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 下载文件 |
||||
|
* |
||||
|
* @param fileName |
||||
|
* @param originalName |
||||
|
* @param response |
||||
|
*/ |
||||
|
@Override |
||||
|
public void downloadFile(String bucketName, String fileName, String originalName, HttpServletResponse response) { |
||||
|
minioUtil.downloadFile(bucketName, fileName, originalName, response); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取文件路径 |
||||
|
* |
||||
|
* @param bucketName |
||||
|
* @param objectName |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public String getObjectUrl(String bucketName, String objectName) { |
||||
|
return minioUtil.getObjectUrl(bucketName, objectName); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param bucketName |
||||
|
* @param objectName |
||||
|
* @description: 文件下载 |
||||
|
* @param: bucketName |
||||
|
* objectName |
||||
|
* @return: io.minio.ObjectStat |
||||
|
* @author yangc |
||||
|
* @date: 2020-10-20 20:24 |
||||
|
*/ |
||||
|
@Override |
||||
|
public ObjectStat statObject(String bucketName, String objectName) { |
||||
|
return minioUtil.statObject(bucketName, objectName); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 以流的形式获取一个文件对象 |
||||
|
* |
||||
|
* @param bucketName 存储桶名称 |
||||
|
* @param objectName 存储桶里的对象名称 |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public InputStream getObject(String bucketName, String objectName) { |
||||
|
return minioUtil.getObject(bucketName, objectName); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 列出存储桶中所有对象 |
||||
|
* |
||||
|
* @param bucketName 存储桶名称 |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public Iterable<Result<Item>> listObjects(String bucketName) { |
||||
|
return minioUtil.listObjects(bucketName); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 生成一个给HTTP GET请求用的presigned URL |
||||
|
* |
||||
|
* @param bucketName 存储桶名称 |
||||
|
* @param objectName 存储桶里的对象名称 |
||||
|
* @param expires 失效时间(以秒为单位),默认是7天,不得大于七天 |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public String presignedGetObject(String bucketName, String objectName, Integer expires) { |
||||
|
return minioUtil.presignedGetObject(bucketName, objectName, expires); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 设置存储桶策略 |
||||
|
* |
||||
|
* @param bucketName 存储桶名称 |
||||
|
* @param policy |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public void setBucketPolicy(String bucketName, String policy) throws IOException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, ErrorResponseException, XmlParserException, InvalidBucketNameException, InsufficientDataException, InternalException { |
||||
|
minioUtil.setBucketPolicy(bucketName, policy); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取存储桶策略 |
||||
|
* |
||||
|
* @param bucketName 存储桶名称 |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public String getBucketPolicy(String bucketName) throws IOException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, BucketPolicyTooLargeException, ErrorResponseException, XmlParserException, InvalidBucketNameException, InsufficientDataException, InternalException { |
||||
|
return minioUtil.getBucketPolicy(bucketName); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,89 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.entity.dto.MotorGroupDto; |
||||
|
import com.jiluo.bolt.mapper.MotorGroupMapper; |
||||
|
import com.jiluo.bolt.entity.po.MotorGroup; |
||||
|
import com.jiluo.bolt.service.MotorGroupService; |
||||
|
import com.jiluo.bolt.util.SnowFlakeUtil; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 机组信息表(MotorGroup)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class MotorGroupServiceImpl extends ServiceImpl<MotorGroupMapper, MotorGroup> implements MotorGroupService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(MotorGroupServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
MotorGroupMapper motorGroupMapper; |
||||
|
|
||||
|
public List<MotorGroup> getAll(){ |
||||
|
QueryWrapper<MotorGroup> queryWrapper = new QueryWrapper<>(); |
||||
|
return motorGroupMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public MotorGroup getByBizId(String bizId){ |
||||
|
QueryWrapper<MotorGroup> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("biz_id",bizId); |
||||
|
return motorGroupMapper.selectOne(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
public Integer getTotalByPowerStation(String powerStationId){ |
||||
|
QueryWrapper<MotorGroup> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("power_station",powerStationId); |
||||
|
return motorGroupMapper.selectCount(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<MotorGroup> select(MotorGroupDto motorGroupDto) { |
||||
|
QueryWrapper<MotorGroup> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.like(StringUtils.isNotBlank(motorGroupDto.getNumber()),"name",motorGroupDto.getNumber()) |
||||
|
.eq(StringUtils.isNotBlank(motorGroupDto.getPowerStationId()),"power_station",motorGroupDto.getPowerStationId()); |
||||
|
return motorGroupMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer selectTotal(MotorGroupDto motorGroupDto) { |
||||
|
QueryWrapper<MotorGroup> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.like(StringUtils.isNotBlank(motorGroupDto.getNumber()),"name",motorGroupDto.getNumber()) |
||||
|
.eq(StringUtils.isNotBlank(motorGroupDto.getPowerStationId()),"power_station",motorGroupDto.getPowerStationId()); |
||||
|
return motorGroupMapper.selectCount(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean add(MotorGroupDto motorGroupDto) { |
||||
|
MotorGroup motorGroup = new MotorGroup(); |
||||
|
motorGroup.setMotorGroupId("GROUP_"+ SnowFlakeUtil.getDefaultSnowFlakeId()) |
||||
|
.setName(motorGroupDto.getNumber()+"#机组") |
||||
|
.setContact(motorGroupDto.getContact()) |
||||
|
.setPhone(motorGroupDto.getPhone()) |
||||
|
.setPowerStation(motorGroupDto.getPowerStationId()); |
||||
|
return motorGroupMapper.insert(motorGroup)>0?true:false; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean updateByBizId(MotorGroupDto motorGroupDto) { |
||||
|
UpdateWrapper<MotorGroup> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",motorGroupDto.getMotorGroupId()) |
||||
|
.set("name",motorGroupDto.getNumber()+"#机组") |
||||
|
.set("contact",motorGroupDto.getContact()) |
||||
|
.set("phone",motorGroupDto.getPhone()) |
||||
|
.set("power_station",motorGroupDto.getPowerStationId()); |
||||
|
return motorGroupMapper.update(null,updateWrapper)>0?true:false; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,152 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.entity.dto.PointDto; |
||||
|
import com.jiluo.bolt.mapper.PointMapper; |
||||
|
import com.jiluo.bolt.entity.po.Point; |
||||
|
import com.jiluo.bolt.service.DeviceService; |
||||
|
import com.jiluo.bolt.service.PointService; |
||||
|
import com.jiluo.bolt.util.SnowFlakeUtil; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import java.util.*; |
||||
|
|
||||
|
/** |
||||
|
* 检测点表(Point)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class PointServiceImpl extends ServiceImpl<PointMapper, Point> implements PointService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(PointServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
PointMapper pointMapper; |
||||
|
|
||||
|
|
||||
|
public List<Point> getAll(){ |
||||
|
QueryWrapper<Point> queryWrapper = new QueryWrapper<>(); |
||||
|
List<Point> points = pointMapper.selectList(queryWrapper); |
||||
|
points.stream().forEach(point -> { |
||||
|
if (DeviceService.DeviceLocalStatus.containsKey(point.getPointId())){ |
||||
|
point.setStatus(DeviceService.DeviceLocalStatus.get(point.getPointId()).getPointStatus()); |
||||
|
} |
||||
|
}); |
||||
|
return points; |
||||
|
} |
||||
|
|
||||
|
public List<Point> getByRole(String motorGroup){ |
||||
|
QueryWrapper<Point> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("motor_group",motorGroup); |
||||
|
return pointMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
public void updateEnableDetect(String pointId,Integer enableDetect){ |
||||
|
UpdateWrapper<Point> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",pointId).set("enable_detect",enableDetect); |
||||
|
pointMapper.update(null,updateWrapper); |
||||
|
} |
||||
|
|
||||
|
public void updateResetTime(String pointId,Date date){ |
||||
|
UpdateWrapper<Point> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",pointId).set("gmt_reset",date); |
||||
|
pointMapper.update(null,updateWrapper); |
||||
|
} |
||||
|
|
||||
|
public void updateConfig(String pointId, String config){ |
||||
|
UpdateWrapper<Point> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",pointId).set("config",config); |
||||
|
pointMapper.update(null,updateWrapper); |
||||
|
} |
||||
|
|
||||
|
public Point getByBizId(String bizId){ |
||||
|
QueryWrapper<Point> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("biz_id",bizId); |
||||
|
return pointMapper.selectOne(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer getTotalByMotorGroup(String motorGroupId) { |
||||
|
QueryWrapper<Point> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("motor_group",motorGroupId); |
||||
|
|
||||
|
return pointMapper.selectCount(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Point> select(PointDto pointDto) { |
||||
|
QueryWrapper<Point> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.like(StringUtils.isNotBlank(pointDto.getName()),"name",pointDto.getName()) |
||||
|
.eq(StringUtils.isNotBlank(pointDto.getPowerStationId()),"power_station",pointDto.getPowerStationId()) |
||||
|
.eq(StringUtils.isNotBlank(pointDto.getMotorGroupId()),"motor_group",pointDto.getMotorGroupId()); |
||||
|
return pointMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer selectTotal(PointDto pointDto) { |
||||
|
QueryWrapper<Point> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.like(StringUtils.isNotBlank(pointDto.getName()),"name",pointDto.getName()) |
||||
|
.eq(StringUtils.isNotBlank(pointDto.getPowerStationId()),"power_station",pointDto.getPowerStationId()) |
||||
|
.eq(StringUtils.isNotBlank(pointDto.getMotorGroupId()),"motor_group",pointDto.getMotorGroupId()); |
||||
|
return pointMapper.selectCount(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean add(PointDto pointDto) { |
||||
|
Point point = new Point(); |
||||
|
point.setPointId("POINT_"+ SnowFlakeUtil.getDefaultSnowFlakeId()) |
||||
|
.setPowerStation(pointDto.getPowerStationId()) |
||||
|
.setMotorGroup(pointDto.getMotorGroupId()) |
||||
|
.setName(pointDto.getName()) |
||||
|
.setPoleNum(pointDto.getPoleNum()) |
||||
|
.setManualTime(pointDto.getManualTime().intValue()) |
||||
|
.setAutomaticTime(pointDto.getAutomaticTime().intValue()) |
||||
|
.setStatus(0) |
||||
|
.setEnableDetect(0) |
||||
|
.setBoltDetect(0) |
||||
|
.setLineDetect(0) |
||||
|
.setPoleOpenDetect(0) |
||||
|
.setPointTempDetect(0) |
||||
|
.setConfig(" "); |
||||
|
return pointMapper.insert(point)>0?true:false; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean updateByBizId(PointDto pointDto) { |
||||
|
UpdateWrapper<Point> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",pointDto.getPointId()) |
||||
|
.set("power_station",pointDto.getPowerStationId()) |
||||
|
.set("motor_group",pointDto.getMotorGroupId()) |
||||
|
.set("name",pointDto.getName()) |
||||
|
.set("pole_num",pointDto.getPoleNum()) |
||||
|
.set("manual_time",pointDto.getManualTime()) |
||||
|
.set("automatic_time",pointDto.getAutomaticTime()); |
||||
|
return pointMapper.update(null,updateWrapper)>0?true:false; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean updateDetect(PointDto pointDto) { |
||||
|
UpdateWrapper<Point> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",pointDto.getPointId()) |
||||
|
.set("bolt_detect",pointDto.getBoltDetect().equals(true)?0:1) |
||||
|
.set("line_detect",pointDto.getLineDetect().equals(true)?0:1) |
||||
|
.set("pole_open_detect",pointDto.getPoleOpenDetect().equals(true)?0:1) |
||||
|
.set("point_temp_detect",pointDto.getPointTempDetect().equals(true)?0:1); |
||||
|
return pointMapper.update(null,updateWrapper)>0?true:false; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Point> getByPowerStation(String powerStationId) { |
||||
|
QueryWrapper<Point> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("power_station",powerStationId); |
||||
|
return pointMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,77 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.entity.dto.PowerStationDto; |
||||
|
import com.jiluo.bolt.mapper.PowerStationMapper; |
||||
|
import com.jiluo.bolt.entity.po.PowerStation; |
||||
|
import com.jiluo.bolt.service.PowerStationService; |
||||
|
import com.jiluo.bolt.util.SnowFlakeUtil; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 电站表(PowerStation)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class PowerStationServiceImpl extends ServiceImpl<PowerStationMapper, PowerStation> implements PowerStationService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(PowerStationServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
PowerStationMapper powerStationMapper; |
||||
|
|
||||
|
public List<PowerStation> getAll(){ |
||||
|
QueryWrapper<PowerStation> queryWrapper = new QueryWrapper<>(); |
||||
|
return powerStationMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
public PowerStation getByBizId(String bizId){ |
||||
|
QueryWrapper<PowerStation> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("biz_id",bizId); |
||||
|
return powerStationMapper.selectOne(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
public List<PowerStation> select(PowerStationDto powerStationDto){ |
||||
|
QueryWrapper<PowerStation> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.like(StringUtils.isNotBlank(powerStationDto.getName()),"name",powerStationDto.getName()); |
||||
|
return powerStationMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
public Integer selectTotal(PowerStationDto powerStationDto){ |
||||
|
QueryWrapper<PowerStation> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.like(StringUtils.isNotBlank(powerStationDto.getName()),"name",powerStationDto.getName()); |
||||
|
return powerStationMapper.selectCount(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
public Boolean add(PowerStationDto powerStationDto){ |
||||
|
PowerStation powerStation = new PowerStation(); |
||||
|
powerStation.setPowerStationId("STATION_"+SnowFlakeUtil.getDefaultSnowFlakeId()) |
||||
|
.setName(powerStationDto.getName()) |
||||
|
.setAddress(powerStationDto.getAddress()) |
||||
|
.setContact(powerStationDto.getContact()) |
||||
|
.setPhone(powerStationDto.getPhone()) |
||||
|
.setIntroduction(powerStationDto.getIntroduction()); |
||||
|
return powerStationMapper.insert(powerStation)>0?true:false; |
||||
|
} |
||||
|
|
||||
|
public Boolean updateByBizId(PowerStationDto powerStationDto){ |
||||
|
UpdateWrapper<PowerStation> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("biz_id",powerStationDto.getPowerStationId()) |
||||
|
.set(StringUtils.isNotBlank(powerStationDto.getName()),"name",powerStationDto.getName()) |
||||
|
.set("address",powerStationDto.getAddress()) |
||||
|
.set("contact",powerStationDto.getContact()) |
||||
|
.set("phone",powerStationDto.getPhone()) |
||||
|
.set("introduction",powerStationDto.getIntroduction()); |
||||
|
return powerStationMapper.update(null,updateWrapper)>0?true:false; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.mapper.ProductMapper; |
||||
|
import com.jiluo.bolt.entity.po.Product; |
||||
|
import com.jiluo.bolt.service.ProductService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
/** |
||||
|
* 检测类型表(Product)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(ProductServiceImpl.class); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.entity.po.RoleItem; |
||||
|
import com.jiluo.bolt.mapper.RoleItemMapper; |
||||
|
import com.jiluo.bolt.service.RoleItemService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import javax.annotation.PostConstruct; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* 权限信息表(RoleItem)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class RoleItemServiceImpl extends ServiceImpl<RoleItemMapper, RoleItem> implements RoleItemService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(RoleItemServiceImpl.class); |
||||
|
|
||||
|
private List<RoleItem> roleItemList = new ArrayList<>(); |
||||
|
|
||||
|
@Autowired |
||||
|
RoleItemMapper roleItemMapper; |
||||
|
|
||||
|
|
||||
|
@PostConstruct |
||||
|
private void init(){ |
||||
|
QueryWrapper<RoleItem> queryWrapper = new QueryWrapper<>(); |
||||
|
roleItemList = roleItemMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public RoleItem getByBizId(String itemId){ |
||||
|
return roleItemList.stream().filter(x -> StringUtils.equalsIgnoreCase(x.getBizId(), itemId)).findFirst().orElse(null); |
||||
|
} |
||||
|
|
||||
|
public List<RoleItem> getByBizId(List<String> itemIds){ |
||||
|
return roleItemList.stream().filter(x -> itemIds.stream().anyMatch(_itemId -> StringUtils.equalsIgnoreCase(x.getBizId(), _itemId))).collect(Collectors.toList()); |
||||
|
} |
||||
|
|
||||
|
public List<RoleItem> getAll(){ |
||||
|
return roleItemList; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,62 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.entity.dto.RoleDto; |
||||
|
import com.jiluo.bolt.mapper.RoleMapper; |
||||
|
import com.jiluo.bolt.entity.po.Role; |
||||
|
import com.jiluo.bolt.service.RoleService; |
||||
|
import com.jiluo.bolt.util.SnowFlakeUtil; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 角色信息表(Role)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 18:59:16 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(RoleServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
RoleMapper roleMapper; |
||||
|
|
||||
|
public Role getByRoleId(String roleId){ |
||||
|
QueryWrapper<Role> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("role_id",roleId); |
||||
|
return roleMapper.selectOne(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Role> select(RoleDto roleDto) { |
||||
|
QueryWrapper<Role> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq(StringUtils.isNotBlank(roleDto.getRoleId()),"role_id",roleDto.getRoleId()) |
||||
|
.like(StringUtils.isNotBlank(roleDto.getRoleName()),"role_name",roleDto.getRoleName()); |
||||
|
return roleMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String add(RoleDto roleDto) { |
||||
|
Role role = new Role(); |
||||
|
role.setRoleId("role_"+ SnowFlakeUtil.getDefaultSnowFlakeId()) |
||||
|
.setRoleName(roleDto.getRoleName()); |
||||
|
roleMapper.insert(role); |
||||
|
return role.getRoleId(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean updateByBizId(RoleDto roleDto) { |
||||
|
UpdateWrapper<Role> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("role_id",roleDto.getRoleId()) |
||||
|
.set("role_name",roleDto.getRoleName()); |
||||
|
return roleMapper.update(null,updateWrapper)>0?true:false; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,64 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.api.R; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.entity.dto.PermissionDto; |
||||
|
import com.jiluo.bolt.entity.po.RoleValue; |
||||
|
import com.jiluo.bolt.mapper.RoleValueMapper; |
||||
|
import com.jiluo.bolt.service.RoleValueService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 角色信息表(Role)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class RoleValueServiceImpl extends ServiceImpl<RoleValueMapper, RoleValue> implements RoleValueService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(RoleValueServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
RoleValueMapper roleValueMapper; |
||||
|
|
||||
|
public List<RoleValue> getByRoleId(String roleId){ |
||||
|
QueryWrapper<RoleValue> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("role_id",roleId); |
||||
|
return roleValueMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
public RoleValue getProduct(String roleId){ |
||||
|
QueryWrapper<RoleValue> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("role_id",roleId) |
||||
|
.eq("item_id","detect_pole"); |
||||
|
return roleValueMapper.selectOne(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<RoleValue> select(PermissionDto permissionDto) { |
||||
|
QueryWrapper<RoleValue> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("role_id",permissionDto.getRoleId()); |
||||
|
return roleValueMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean add(RoleValue roleValue) { |
||||
|
return roleValueMapper.insert(roleValue)>0?true:false; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean updateByItemId(RoleValue roleValue) { |
||||
|
UpdateWrapper<RoleValue> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("role_id",roleValue.getRoleId()) |
||||
|
.eq("item_id",roleValue.getItemId()) |
||||
|
.set("item_value",roleValue.getItemValue()); |
||||
|
return roleValueMapper.update(null,updateWrapper)>0?true:false; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,65 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.entity.dto.UserDto; |
||||
|
import com.jiluo.bolt.mapper.UserMapper; |
||||
|
import com.jiluo.bolt.entity.po.User; |
||||
|
import com.jiluo.bolt.service.UserService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 用户信息表(User)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(UserServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
private UserMapper userMapper; |
||||
|
|
||||
|
public User getByUid(String uid){ |
||||
|
QueryWrapper<User> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("biz_id",uid); |
||||
|
User user = userMapper.selectOne(queryWrapper); |
||||
|
return user; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<User> select(UserDto userDto) { |
||||
|
QueryWrapper<User> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq(StringUtils.isNotBlank(userDto.getRole()),"role",userDto.getRole()) |
||||
|
.like(StringUtils.isNotBlank(userDto.getUserName()),"user_name",userDto.getUserName()); |
||||
|
return userMapper.selectList(queryWrapper); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean add(UserDto userDto) { |
||||
|
User user = new User(); |
||||
|
user.setBizId(userDto.getUid()) |
||||
|
.setUserName(userDto.getUserName()) |
||||
|
.setPassword(userDto.getPassword()) |
||||
|
.setRole(userDto.getRole()); |
||||
|
return userMapper.insert(user)>0?true:false; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Boolean updateByBizId(UserDto userDto) { |
||||
|
UpdateWrapper<User> updateWrapper = new UpdateWrapper<>(); |
||||
|
updateWrapper.eq("id",userDto.getId()) |
||||
|
.set("biz_id",userDto.getUid()) |
||||
|
.set("user_name",userDto.getUserName()) |
||||
|
.set("password",userDto.getPassword()); |
||||
|
return userMapper.update(null,updateWrapper)>0?true:false; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package com.jiluo.bolt.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.jiluo.bolt.mapper.VersionMapper; |
||||
|
import com.jiluo.bolt.entity.po.Version; |
||||
|
import com.jiluo.bolt.service.VersionService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
/** |
||||
|
* 版本信息表(Version)表服务实现类 |
||||
|
* @author Fangy |
||||
|
* @date 2023-05-05 10:10:12 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class VersionServiceImpl extends ServiceImpl<VersionMapper, Version> implements VersionService { |
||||
|
/** logger:日志文件 */ |
||||
|
private static final Logger logger = LoggerFactory.getLogger(VersionServiceImpl.class); |
||||
|
|
||||
|
@Autowired |
||||
|
VersionMapper versionMapper; |
||||
|
|
||||
|
public Version select(){ |
||||
|
QueryWrapper<Version> queryWrapper = new QueryWrapper<>(); |
||||
|
queryWrapper.eq("available",1); |
||||
|
return versionMapper.selectOne(queryWrapper); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,259 @@ |
|||||
|
package com.jiluo.bolt.util; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/08/03/10:05 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
|
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.codec.binary.Base64; |
||||
|
import org.apache.commons.codec.binary.Hex; |
||||
|
|
||||
|
import javax.crypto.Cipher; |
||||
|
import javax.crypto.KeyGenerator; |
||||
|
import javax.crypto.SecretKey; |
||||
|
import javax.crypto.spec.SecretKeySpec; |
||||
|
import java.nio.charset.StandardCharsets; |
||||
|
import java.security.Key; |
||||
|
import java.security.NoSuchAlgorithmException; |
||||
|
|
||||
|
/** |
||||
|
* AES 加/解密工具类 |
||||
|
* 使用密钥时请使用 initKey() 方法来生成随机密钥 |
||||
|
* initKey 方法内部使用 java.crypto.KeyGenerator 密钥生成器来生成特定于 AES 算法参数集的随机密钥 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
public class AesEncryptUtil { |
||||
|
|
||||
|
private AesEncryptUtil() { |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 密钥算法类型 |
||||
|
*/ |
||||
|
public static final String KEY_ALGORITHM = "AES"; |
||||
|
|
||||
|
/** |
||||
|
* 密钥的默认位长度 |
||||
|
*/ |
||||
|
public static final int DEFAULT_KEY_SIZE = 128; |
||||
|
|
||||
|
/** |
||||
|
* 加解密算法/工作模式/填充方式 |
||||
|
*/ |
||||
|
private static final String ECB_PKCS_5_PADDING = "AES/ECB/PKCS5Padding"; |
||||
|
public static final String ECB_NO_PADDING = "AES/ECB/NoPadding"; |
||||
|
|
||||
|
public static String base64Encode(byte[] bytes) { |
||||
|
return Base64.encodeBase64String(bytes); |
||||
|
} |
||||
|
|
||||
|
public static byte[] base64Decode(String base64Code) { |
||||
|
return Base64.decodeBase64(base64Code); |
||||
|
} |
||||
|
|
||||
|
public static byte[] aesEncryptToBytes(String content, String hexAesKey) throws Exception { |
||||
|
return encrypt(content.getBytes(StandardCharsets.UTF_8), Hex.decodeHex(hexAesKey.toCharArray())); |
||||
|
} |
||||
|
|
||||
|
public static String aesEncrypt(String content, String hexAesKey) throws Exception { |
||||
|
return base64Encode(aesEncryptToBytes(content, hexAesKey)); |
||||
|
} |
||||
|
|
||||
|
public static String aesDecryptByBytes(byte[] encryptBytes, String hexAesKey) throws Exception { |
||||
|
byte[] decrypt = decrypt(encryptBytes, Hex.decodeHex(hexAesKey.toCharArray())); |
||||
|
return new String(decrypt, StandardCharsets.UTF_8); |
||||
|
} |
||||
|
|
||||
|
public static String aesDecrypt(String encryptStr, String hexAesKey) throws Exception { |
||||
|
return aesDecryptByBytes(base64Decode(encryptStr), hexAesKey); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 生成 Hex 格式默认长度的随机密钥 |
||||
|
* 字符串长度为 32,解二进制后为 16 个字节 |
||||
|
* |
||||
|
* @return String Hex 格式的随机密钥 |
||||
|
*/ |
||||
|
public static String initHexKey() { |
||||
|
return Hex.encodeHexString(initKey()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 生成默认长度的随机密钥 |
||||
|
* 默认长度为 128 |
||||
|
* |
||||
|
* @return byte[] 二进制密钥 |
||||
|
*/ |
||||
|
public static byte[] initKey() { |
||||
|
return initKey(DEFAULT_KEY_SIZE); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 生成密钥 |
||||
|
* 128、192、256 可选 |
||||
|
* |
||||
|
* @param keySize 密钥长度 |
||||
|
* @return byte[] 二进制密钥 |
||||
|
*/ |
||||
|
public static byte[] initKey(int keySize) { |
||||
|
// AES 要求密钥长度为 128 位、192 位或 256 位
|
||||
|
if (keySize != 128 && keySize != 192 && keySize != 256) { |
||||
|
throw new RuntimeException("error keySize: " + keySize); |
||||
|
} |
||||
|
// 实例化
|
||||
|
KeyGenerator keyGenerator; |
||||
|
try { |
||||
|
keyGenerator = KeyGenerator.getInstance(KEY_ALGORITHM); |
||||
|
} catch (NoSuchAlgorithmException e) { |
||||
|
throw new RuntimeException("no such algorithm exception: " + KEY_ALGORITHM, e); |
||||
|
} |
||||
|
keyGenerator.init(keySize); |
||||
|
// 生成秘密密钥
|
||||
|
SecretKey secretKey = keyGenerator.generateKey(); |
||||
|
// 获得密钥的二进制编码形式
|
||||
|
return secretKey.getEncoded(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 转换密钥 |
||||
|
* |
||||
|
* @param key 二进制密钥 |
||||
|
* @return Key 密钥 |
||||
|
*/ |
||||
|
private static Key toKey(byte[] key) { |
||||
|
// 实例化 DES 密钥材料
|
||||
|
return new SecretKeySpec(key, KEY_ALGORITHM); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 加密 |
||||
|
* |
||||
|
* @param data 待加密数据 |
||||
|
* @param key 密钥 |
||||
|
* @return byte[] 加密的数据 |
||||
|
*/ |
||||
|
public static byte[] encrypt(byte[] data, byte[] key) { |
||||
|
return encrypt(data, key, ECB_PKCS_5_PADDING); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 加密 |
||||
|
* |
||||
|
* @param data 待加密数据 |
||||
|
* @param key 密钥 |
||||
|
* @param cipherAlgorithm 算法/工作模式/填充模式 |
||||
|
* @return byte[] 加密的数据 |
||||
|
*/ |
||||
|
public static byte[] encrypt(byte[] data, byte[] key, final String cipherAlgorithm) { |
||||
|
// 还原密钥
|
||||
|
Key k = toKey(key); |
||||
|
try { |
||||
|
Cipher cipher = Cipher.getInstance(cipherAlgorithm); |
||||
|
// 初始化,设置为加密模式
|
||||
|
cipher.init(Cipher.ENCRYPT_MODE, k); |
||||
|
|
||||
|
// 发现使用 NoPadding 时,使用 ZeroPadding 填充
|
||||
|
if (ECB_NO_PADDING.equals(cipherAlgorithm)) { |
||||
|
return cipher.doFinal(formatWithZeroPadding(data, cipher.getBlockSize())); |
||||
|
} |
||||
|
|
||||
|
// 执行操作
|
||||
|
return cipher.doFinal(data); |
||||
|
} catch (Exception e) { |
||||
|
throw new RuntimeException("AES encrypt error", e); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 解密 |
||||
|
* |
||||
|
* @param data 待解密数据 |
||||
|
* @param key 密钥 |
||||
|
* @return byte[] 解密的数据 |
||||
|
*/ |
||||
|
public static byte[] decrypt(byte[] data, byte[] key) { |
||||
|
return decrypt(data, key, ECB_PKCS_5_PADDING); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 解密 |
||||
|
* |
||||
|
* @param data 待解密数据 |
||||
|
* @param key 密钥 |
||||
|
* @param cipherAlgorithm 算法/工作模式/填充模式 |
||||
|
* @return byte[] 解密的数据 |
||||
|
*/ |
||||
|
public static byte[] decrypt(byte[] data, byte[] key, final String cipherAlgorithm) { |
||||
|
// 还原密钥
|
||||
|
Key k = toKey(key); |
||||
|
try { |
||||
|
Cipher cipher = Cipher.getInstance(cipherAlgorithm); |
||||
|
// 初始化,设置为解密模式
|
||||
|
cipher.init(Cipher.DECRYPT_MODE, k); |
||||
|
|
||||
|
// 发现使用 NoPadding 时,使用 ZeroPadding 填充
|
||||
|
if (ECB_NO_PADDING.equals(cipherAlgorithm)) { |
||||
|
return removeZeroPadding(cipher.doFinal(data), cipher.getBlockSize()); |
||||
|
} |
||||
|
|
||||
|
// 执行操作
|
||||
|
return cipher.doFinal(data); |
||||
|
} catch (Exception e) { |
||||
|
throw new RuntimeException("AES decrypt error", e); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private static byte[] formatWithZeroPadding(byte[] data, final int blockSize) { |
||||
|
final int length = data.length; |
||||
|
final int remainLength = length % blockSize; |
||||
|
|
||||
|
if (remainLength > 0) { |
||||
|
byte[] inputData = new byte[length + blockSize - remainLength]; |
||||
|
System.arraycopy(data, 0, inputData, 0, length); |
||||
|
return inputData; |
||||
|
} |
||||
|
return data; |
||||
|
} |
||||
|
|
||||
|
private static byte[] removeZeroPadding(byte[] data, final int blockSize) { |
||||
|
final int length = data.length; |
||||
|
final int remainLength = length % blockSize; |
||||
|
if (remainLength == 0) { |
||||
|
// 解码后的数据正好是块大小的整数倍,说明可能存在补 0 的情况,去掉末尾所有的 0
|
||||
|
int i = length - 1; |
||||
|
while (i >= 0 && 0 == data[i]) { |
||||
|
i--; |
||||
|
} |
||||
|
byte[] outputData = new byte[i + 1]; |
||||
|
System.arraycopy(data, 0, outputData, 0, outputData.length); |
||||
|
return outputData; |
||||
|
} |
||||
|
return data; |
||||
|
} |
||||
|
|
||||
|
// public static void main(String[] args) throws Exception {
|
||||
|
//
|
||||
|
// byte[] bytes = AesEncryptUtil.initKey();
|
||||
|
//
|
||||
|
// // 使用密钥生成器 KeyGenerator 生成的 16 字节随机密钥的 hex 字符串,使用时解 hex 得到二进制密钥
|
||||
|
// String aesKey = Hex.encodeHexString(bytes);
|
||||
|
// System.out.println(aesKey);
|
||||
|
//
|
||||
|
//// String aesKey = "dbf13279f5bc85b038cbc9ee21dfbc03";
|
||||
|
//
|
||||
|
// String content = "123456";
|
||||
|
// System.out.println("加密前:" + content);
|
||||
|
//
|
||||
|
// String encrypt = aesEncrypt(content, aesKey);
|
||||
|
// System.out.println(encrypt.length() + ":加密后:" + encrypt);
|
||||
|
//
|
||||
|
// String decrypt = aesDecrypt(encrypt, aesKey);
|
||||
|
// System.out.println("解密后:" + decrypt);
|
||||
|
// }
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.jiluo.bolt.util; |
||||
|
|
||||
|
import com.jiluo.bolt.common.DefectType; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.RoundingMode; |
||||
|
|
||||
|
/** |
||||
|
* Created with IntelliJ IDEA. |
||||
|
* |
||||
|
* @Author: fy |
||||
|
* @Date: 2023/10/25/13:58 |
||||
|
* @Description: |
||||
|
*/ |
||||
|
public class BigDecimalUtils { |
||||
|
public static BigDecimal DBToFront(DefectType _type, Integer value){ |
||||
|
return (_type == DefectType.bolt || _type == DefectType.temperature) ? BigDecimal.valueOf(value / 100.0).setScale(2, RoundingMode.HALF_UP) : (_type == DefectType.line ? BigDecimal.valueOf(value / 1000.0).setScale(3, RoundingMode.HALF_UP) : BigDecimal.valueOf(value)); |
||||
|
} |
||||
|
|
||||
|
public static BigDecimal FrontToDB(DefectType _type, Float value){ |
||||
|
return (_type == DefectType.bolt || _type == DefectType.temperature) ? BigDecimal.valueOf(value * 100).setScale(0, RoundingMode.HALF_UP) : |
||||
|
(_type == DefectType.line) ? BigDecimal.valueOf(value * 1000).setScale(0, RoundingMode.HALF_UP) : BigDecimal.valueOf(value); |
||||
|
} |
||||
|
} |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue