");
+
+ /**
+ * format to retrieve recipient parameter for hasp_detach
+ */
+ public static final String HASP_RECIPIENT = new String(""+
+ " " +
+ " " +
+ " " +
+ " " +
+ " " +
+ " " +
+ " " +
+ " \n");
+
+ /**
+ * AND-mask used to identify the Feature type.
+ */
+ public static final long HASP_FEATURETYPE_MASK = 0xffff0000;
+
+ /**
+ * After AND-ing with HASP_FEATURETYPE_MASK, the Feature type contains
+ * this value.
+ */
+ public static final long HASP_PROGNUM_FEATURETYPE = 0xffff0000;
+
+ /**
+ * AND-mask used to extract program number from Feature ID
+ * if program number Feature.
+ */
+ public static final long HASP_PROGNUM_MASK = 0x000000ff;
+
+ /**
+ * AND-mask used to identify "prognum" options.
+ *
+ * The following "prognum" options can be identified:
+ *
+ *
+ * - HASP_PROGNUM_OPT_NO_LOCAL
+ *
- HASP_PROGNUM_OPT_NO_REMOTE
+ *
- HASP_PROGNUM_OPT_PROCESS
+ *
- HASP_PROGNUM_OPT_CLASSIC
+ *
- HASP_PROGNUM_OPT_TS
+ *
+ *
+ * 3 bits of the mask are reserved for future extensions and currently
+ * unused. Initialize them to zero.
+ */
+ public static final long HASP_PROGNUM_OPT_MASK = 0x0000ff00;
+
+ /**
+ * "Prognum" option: disables local license search.
+ */
+ public static final long HASP_PROGNUM_OPT_NO_LOCAL = 0x00008000;
+
+ /**
+ * "Prognum" option: disables network license search.
+ */
+ public static final long HASP_PROGNUM_OPT_NO_REMOTE = 0x00004000;
+
+ /**
+ * "Prognum" option: sets session count of network licenses
+ * to "per process".
+ */
+ public static final long HASP_PROGNUM_OPT_PROCESS = 0x00002000;
+
+ /**
+ * "Prognum" option: enables the API to access "classic"
+ * (HASP4 or earlier) keys.
+ */
+ public static final long HASP_PROGNUM_OPT_CLASSIC = 0x00001000;
+
+ /**
+ * "Prognum" option: ignores Terminal Services.
+ */
+ public static final long HASP_PROGNUM_OPT_TS = 0x00000800;
+
+ /**
+ * HASP default Feature ID.
+ * Present in every hardware key.
+ */
+ public static final long HASP_DEFAULT_FID = 0;
+
+ /**
+ * "Prognum" default Feature ID.
+ * Present in every HASP key.
+ */
+ public static final long HASP_PROGNUM_DEFAULT_FID = (HASP_DEFAULT_FID | HASP_PROGNUM_FEATURETYPE);
+
+ /**
+ * Minimal block size for hasp_encrypt() and hasp_decrypt() functions.
+ */
+ public static final int HASP_MIN_BLOCK_SIZE = 16;
+
+ /**
+ * Minimal block size for legacy functions hasp_legacy_encrypt()
+ * and hasp_legacy_decrypt().
+ */
+ public static final long HASP_MIN_BLOCK_SIZE_LEGACY = 8;
+
+ /**
+ * HASP4 memory file:
+ * File ID for HASP4-compatible memory contents without FAS.
+ */
+ public static final int HASP_FILEID_MAIN = 0xfff0;
+
+ /**
+ * HASP4 FAS memory file:
+ * (Dummy) File ID for license data segment of memory contents.
+ */
+ public static final long HASP_FILEID_LICENSE = 0xfff2;
+
+ /**
+ * File ID for HASP secure writable memory.
+ */
+ public static final long HASP_FILEID_RW = 0xfff4;
+
+ /**
+ * File ID for HASP secure read only memory.
+ */
+ public static final long HASP_FILEID_RO = 0xfff5;
+
+ /**
+ * Returns the error that occurred in the last function call.
+ */
+ public int getLastError()
+ {
+ return status;
+ }
+
+ static
+ {
+ HaspStatus.Init();
+ }
+
+ /*
+ * private native methods
+ */
+ private static native int Login(long feature_id,String vendor_code,int handle[]);
+ private static native int LoginScope(long feature_id,String scope,String vendor_code,int handle[]);
+ private static native int Logout(int handle);
+ private static native int Encrypt(int handle, byte buffer[], int length);
+ private static native int Decrypt(int handle, byte buffer[], int length);
+ private static native int GetRtc(int handle, long time[]);
+ private static native int LegacyEncrypt(int handle, byte buffer[], int length);
+ private static native int LegacyDecrypt(int handle, byte buffer[], int length);
+ private static native int LegacySetRtc(int handle, long time);
+ private static native int LegacySetIdletime(int handle, short time);
+ private static native byte[] GetSessioninfo(int handle,String format,int status[]);
+ private static native byte[] GetInfo(String scope,String format,String vendor_code,int status[]);
+ private static native void Free(long info);
+ private static native String Update(String update_data,int status[]);
+ private static native byte[] Detach(String action,String scope,String vendor_code,String destination,int status[]);
+ private static native byte[] Transfer(String action,String scope,String vendor_code,String destination,int status[]);
+ private static native int UpdateSession(int handle,String option);
+
+ /*
+ * functions to access the memory
+ */
+ private static native int Read(int handle, long fileid, int offset, int length, byte buffer[]);
+ private static native int Write(int handle, long fileid, int offset, int length, byte buffer[]);
+ private static native int GetSize(int handle, long fileid, int size[]);
+
+ /**
+ * Hasp constructor.
+ *
+ * For local "prognum" Features, concurrency is not handled and each
+ * login performs a decrement if it is a counting license.
+ *
+ * Network "prognum" Features only use the old HASP LM login logic,
+ * with all its limitations.
+ *
+ * Only concurrent usage of one server is supported (global server address).
+ *
+ * @param feature_id Unique identifier of the Feature.
+ *
+ * With "prognum" Features (see HASP_FEATURETYPE_MASK),
+ * 8 bits are reserved for legacy options (see
+ * HASP_PROGNUM_OPT_MASK, currently 5 bits are used):
+ *
+ * - only local
+ *
- only remote
+ *
- login is counted per process ID
+ *
- disable terminal server check
+ *
- enable access to old (HASP3/HASP4) keys
+ *
+ */
+ public Hasp(long feature_id)
+ {
+ status = HaspStatus.HASP_STATUS_OK;
+ featureid = feature_id;
+ handle[0] = 0;
+ }
+
+ /**
+ * Logs in to a Feature.
+ *
+ * Establishes a session context.
+ *
+ * If a previously established session context exists, the session
+ * will be logged out.
+ *
+ * @param vendor_code The Vendor Code.
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #loginScope
+ * @see #logout
+ * @see #getLastError
+ */
+ public boolean login(String vendor_code)
+ {
+ synchronized(this)
+ {
+ synchronized(this)
+ {
+ logout();
+ status = Hasp.Login(featureid, vendor_code, handle);
+ }
+ }
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Logs in to a Feature according to customizable search parameters.
+ *
+ * This function is an extended login function, where the search for the
+ * Feature can be restricted.
+ *
+ * If a previously established session context exists, the session
+ * will be logged out.
+ *
+ * @param scope The hasp_scope of the Feature search.
+ * @param vendor_code The Vendor Code.
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #login
+ * @see #logout
+ * @see #getLastError
+ */
+ public boolean loginScope(String scope, String vendor_code)
+ {
+ if (vendor_code == null)
+ status = HaspStatus.HASP_INV_VCODE;
+ else if (scope == null)
+ status = HaspStatus.HASP_INV_SCOPE;
+ else
+ {
+ synchronized(this)
+ {
+ logout();
+ status = Hasp.LoginScope(featureid, scope, vendor_code,handle);
+ }
+ }
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Logs out from a session and frees all allocated resources for the session.
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #login
+ * @see #getLastError
+ */
+ public boolean logout()
+ {
+ if (handle[0] == 0)
+ {
+ status = HaspStatus.HASP_INV_HND;
+ return true;
+ }
+ synchronized(this)
+ {
+ status = Hasp.Logout(handle[0]);
+ if (status == HaspStatus.HASP_STATUS_OK)
+ handle[0] = 0;
+ }
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Encrypts a buffer.
+ *
+ * This is the reverse operation of the decrypt() function.
+ *
+ * If the encryption fails (e.g. key removed during the process) the
+ * data buffer is unmodified.
+ *
+ * This function is deprecated.
+ *
+ * @param buffer The buffer to be encrypted.
+ * @param length Size in bytes of the buffer to be encrypted
+ * (16 bytes minimum).
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #decrypt
+ * @see #getLastError
+ */
+ @Deprecated
+ public boolean encrypt(byte[] buffer, int length)
+ {
+ if (buffer == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else if (length > buffer.length)
+ status = HaspStatus.HASP_INV_PARAM;
+ else
+ status = Hasp.Encrypt(handle[0], buffer, length);
+
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Encrypts a buffer.
+ *
+ * This is the reverse operation of the decrypt() function.
+ *
+ * If the encryption fails (e.g. key removed during the process) the
+ * data buffer is unmodified.
+ *
+ * @param buffer The buffer to be encrypted.
+ * (16 bytes minimum).
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #decrypt
+ * @see #getLastError
+ */
+ public boolean encrypt(byte[] buffer)
+ {
+ if (buffer == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else
+ status = Hasp.Encrypt(handle[0], buffer, buffer.length);
+
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Decrypts a buffer.
+ *
+ * This is the reverse operation of the encrypt() function.
+ *
+ * If the decryption fails (e.g. key removed during the process) the
+ * data buffer is unmodified.
+ *
+ * This function is deprecated.
+ *
+ * @param buffer The buffer to be decrypted.
+ * @param length Size in bytes of the buffer to be decrypted
+ * (16 bytes minimum).
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #encrypt
+ * @see #getLastError
+ */
+ @Deprecated
+ public boolean decrypt(byte[] buffer, int length)
+ {
+ if (buffer == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else if (length > buffer.length)
+ status = HaspStatus.HASP_INV_PARAM;
+ else
+ status = Hasp.Decrypt(handle[0], buffer, length);
+
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Decrypts a buffer.
+ *
+ * This is the reverse operation of the encrypt() function.
+ *
+ * If the decryption fails (e.g. key removed during the process) the
+ * data buffer is unmodified.
+ *
+ * @param buffer The buffer to be decrypted.
+ * (16 bytes minimum).
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #encrypt
+ * @see #getLastError
+ */
+ public boolean decrypt(byte[] buffer)
+ {
+ if (buffer == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else
+ status = Hasp.Decrypt(handle[0], buffer, buffer.length);
+
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Retrieves information about all system components.
+ *
+ * Acquires information about all system components.
+ * The programmer can choose the scope and output structure of the data.
+ * The function has a "scope" parameter that defines the scope using
+ * XML syntax.
+ *
+ * This function is not used in a login context, so it can be used
+ * in a generic "Monitor" application.
+ *
+ * @param scope XML definition of the information scope.
+ * @param format XML definition of the output data structure.
+ * @param vendor_code The Vendor Code.
+ * @return info The returned information (XML list).
+ *
+ * @see #getSessionInfo
+ * @see #getLastError
+ */
+ public String getInfo(String scope, String format, String vendor_code)
+ {
+ byte[] info = { 0 };
+ int[] status1 = { 0 };
+ String s = null;
+
+ status = HaspStatus.HASP_STATUS_OK;
+ if (vendor_code == null)
+ status = HaspStatus.HASP_INV_VCODE;
+ else if (scope == null)
+ status = HaspStatus.HASP_INV_SCOPE;
+ else if (format == null)
+ status = HaspStatus.HASP_INV_FORMAT;
+ if (status != HaspStatus.HASP_STATUS_OK)
+ return null;
+
+ info = Hasp.GetInfo(scope, format, vendor_code, status1);
+
+ status = status1[0];
+ if( status == HaspStatus.HASP_STATUS_OK)
+ s = new String(info);
+
+ return s;
+ }
+
+ /**
+ * Retrieves information regarding a session context.
+ *
+ * @param format XML definition of the output data structure.
+ * @return info The returned information (XML list).
+ *
+ * @see #getLastError
+ */
+ public String getSessionInfo(String format)
+ {
+ byte[] info = { 0 };
+ int[] status1 = { 0 };
+ String s = null;
+
+ if (format == null)
+ {
+ status = HaspStatus.HASP_INV_FORMAT;
+ return null;
+ }
+
+ info = Hasp.GetSessioninfo(handle[0], format, status1);
+
+ status = status1[0];
+ if( status == HaspStatus.HASP_STATUS_OK)
+ s = new String(info);
+
+ return s;
+ }
+
+ /**
+ * Reads from the HASP key memory.
+ *
+ * This function is deprecated.
+ *
+ * @param fileid ID of the file to read (memory descriptor).
+ * @param offset Position in the file.
+ * @param length Number of bytes to be read from the file.
+ * @param buffer The retrieved data.
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #getLastError
+ * @see #write
+ * @see #getSize
+ */
+ @Deprecated
+ public boolean read(long fileid, int offset, int length, byte[] buffer)
+ {
+ if (buffer == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else if (offset < 0)
+ status = HaspStatus.HASP_INV_PARAM;
+ else if (length > buffer.length)
+ status = HaspStatus.HASP_INV_PARAM;
+ else
+ status = Hasp.Read(handle[0], fileid, offset, length, buffer);
+
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Reads from the HASP key memory.
+ *
+ * @param fileid ID of the file to read (memory descriptor).
+ * @param offset Position in the file.
+ * @param buffer Buffer for the retrieved data.
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #getLastError
+ * @see #write
+ * @see #getSize
+ */
+ public boolean read(long fileid, int offset, byte[] buffer)
+ {
+ if (buffer == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else if (offset < 0)
+ status = HaspStatus.HASP_INV_PARAM;
+ else
+ status = Hasp.Read(handle[0], fileid, offset, buffer.length, buffer);
+
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Writes to the HASP key memory.
+ *
+ * Depending on the provided session handle (either logged into the
+ * default Feature or any other Feature), write access to the FAS
+ * memory (HASP_FILEID_LICENSE) is not permitted.
+ *
+ * This function is deprecated.
+ *
+ * @param fileid ID of the file to write (memory descriptor).
+ * @param offset Position in the file.
+ * @param length Number of bytes to write to the file.
+ * @param buffer The data to write.
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #getLastError
+ * @see #read
+ * @see #getSize
+ */
+ @Deprecated
+ public boolean write(long fileid, int offset, int length, byte[] buffer)
+ {
+ if (buffer == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else if (offset < 0)
+ status = HaspStatus.HASP_INV_PARAM;
+ else if (length > buffer.length)
+ status = HaspStatus.HASP_INV_PARAM;
+ else
+ status = Hasp.Write(handle[0], fileid, offset, length, buffer);
+
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Writes to the HASP key memory.
+ *
+ * Depending on the provided session handle (either logged into the
+ * default Feature or any other Feature), write access to the FAS
+ * memory (HASP_FILEID_LICENSE) is not permitted.
+ *
+ * @param fileid ID of the file to write (memory descriptor).
+ * @param offset Position in the file.
+ * @param buffer The data to write.
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #getLastError
+ * @see #read
+ * @see #getSize
+ */
+ public boolean write(long fileid, int offset, byte[] buffer)
+ {
+ if (buffer == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else if (offset < 0)
+ status = HaspStatus.HASP_INV_PARAM;
+ else
+ status = Hasp.Write(handle[0], fileid, offset, buffer.length, buffer);
+
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Retrieves the byte size of a memory file from a HASP key.
+ *
+ * @param fileid ID of the file to be queried.
+ *
+ * @return Size of the file.
+ *
+ * @see #getLastError
+ * @see #read
+ * @see #write
+ */
+ public int getSize(long fileid)
+ {
+ int[] size = { 0 };
+ status = Hasp.GetSize(handle[0], fileid, size);
+ return size[0];
+ }
+
+ /**
+ * Writes update information to a HASP key.
+ *
+ * The update BLOB contains all necessary data to perform the update:
+ * Where to write (to which HASP key), the necessary
+ * access data (Vendor Code) and the update itself.
+ *
+ * If requested by the update BLOB, the function returns an Acknowledge BLOB,
+ * which is signed/encrypted by the updated instance and contains
+ * proof that this update was successfully installed.
+ *
+ * @param update_data The complete update data.
+ *
+ * @return ack_data The acknowledged data (if requested).
+ *
+ * @see #getLastError
+ */
+ public String update(String update_data)
+ {
+ int[] dll_status = {0};
+ String s = null;
+
+ if (update_data == null) {
+ status = HaspStatus.HASP_INV_PARAM;
+ return null;
+ }
+
+ s = Hasp.Update(update_data, dll_status);
+ status = dll_status[0];
+
+ return s;
+ }
+
+ /**
+ * Reads the current time from a HASP Time key.
+ *
+ * Time values are returned as the number of seconds that have elapsed
+ * since Jan-01-1970 0:00:00 UTC.
+ *
+ * The general purpose of this function is to
+ * obtain reliable timestamps that are independent from the system clock.
+ *
+ * @return A HaspTime object.
+ */
+ public HaspTime getRealTimeClock()
+ {
+ long[] time = { 0 };
+ HaspTime rtcTime;
+ status = Hasp.GetRtc(handle[0], time);
+ rtcTime = new HaspTime(time[0]);
+
+ if (status == HaspStatus.HASP_STATUS_OK)
+ status = rtcTime.getLastError();
+
+ return rtcTime;
+ }
+
+ /**
+ * Sets the HASP License Manager idle time.
+ *
+ * @param idle_time Idle time in minutes. Set to 0 for default value.
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #getLastError
+ */
+ /*
+ public boolean setIdletime(short idle_time)
+ {
+ status = Hasp.SetIdletime(handle[0], idle_time);
+ if (status == HaspStatus.HASP_STATUS_OK)
+ return true;
+
+ return false;
+ }
+ */
+
+ /**
+ * Reads the HASP API Version.
+ *
+ * @param vendor_code The Vendor Code.
+ *
+ * @return A HaspApiVersion object.
+ *
+ * @see #getLastError
+ */
+ public HaspApiVersion getVersion(String vendor_code)
+ {
+ HaspApiVersion version;
+ version = new HaspApiVersion(vendor_code);
+ status = version.getLastError();
+
+ return version;
+ }
+
+ /**
+ * Encrypts a buffer.
+ *
+ * This is the reverse operation of the legacydecrypt() function.
+ *
+ * If the encryption fails (e.g. key removed during the process) the
+ * data buffer is unmodified.
+ *
+ * This function is deprecated.
+ *
+ * @param buffer The buffer to be encrypted.
+ * @param length Size in bytes of the buffer to be encrypted
+ * (16 bytes minimum).
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #decrypt
+ * @see #getLastError
+ */
+ @Deprecated
+ public boolean legacyencrypt(byte[] buffer, int length)
+ {
+ if (buffer == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else if (length > buffer.length)
+ status = HaspStatus.HASP_INV_PARAM;
+ else
+ status = Hasp.LegacyEncrypt(handle[0], buffer, length);
+
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Encrypts a buffer.
+ *
+ * This is the reverse operation of the legacydecrypt() function.
+ *
+ * If the encryption fails (e.g. key removed during the process) the
+ * data buffer is unmodified.
+ *
+ * @param buffer The buffer to be encrypted. Minimum size: 16 bytes
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #decrypt
+ * @see #getLastError
+ */
+ public boolean legacyencrypt(byte[] buffer)
+ {
+ if (buffer == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else
+ status = Hasp.LegacyEncrypt(handle[0], buffer, buffer.length);
+
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Decrypts a buffer.
+ *
+ * This is the reverse operation of the legacyencrypt() function.
+ *
+ * If the decryption fails (e.g. key removed during the process) the
+ * data buffer is unmodified.
+ *
+ * This function is deprecated.
+ *
+ * @param buffer The buffer to be decrypted.
+ * @param length Size in bytes of the buffer to be decrypted
+ * (16 bytes minimum).
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #encrypt
+ * @see #getLastError
+ */
+ @Deprecated
+ public boolean legacydecrypt(byte[] buffer, int length)
+ {
+ if (buffer == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else if (length > buffer.length)
+ status = HaspStatus.HASP_INV_PARAM;
+ else
+ status = Hasp.LegacyDecrypt(handle[0], buffer, length);
+
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Decrypts a buffer.
+ *
+ * This is the reverse operation of the legacyencrypt() function.
+ *
+ * If the decryption fails (e.g. key removed during the process) the
+ * data buffer is unmodified.
+ *
+ * @param buffer The buffer to be decrypted. Minimum size: 16 bytes
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #encrypt
+ * @see #getLastError
+ */
+ public boolean legacydecrypt(byte[] buffer)
+ {
+ if (buffer == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else
+ status = Hasp.LegacyDecrypt(handle[0], buffer, buffer.length);
+
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+ /**
+ * Sets the HASP License Manager Rtc.
+ *
+ * This function is deprecated.
+ *
+ * @param idle_time Idle time in minutes. Set to 0 for default value.
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #getLastError
+ */
+ @Deprecated
+ public boolean legacysetRtc(short idle_time) {
+ status = Hasp.LegacySetRtc(handle[0], (short)idle_time);
+ if (status == HaspStatus.HASP_STATUS_OK)
+ return true;
+ return false;
+ }
+
+ /**
+ * Sets the HASP License Manager Rtc.
+ *
+ * @param idle_time Idle time in minutes. Set to 0 for default value.
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #getLastError
+ */
+ public boolean legacysetRtc(long idle_time)
+ {
+ status = Hasp.LegacySetRtc(handle[0], idle_time);
+ if (status == HaspStatus.HASP_STATUS_OK)
+ return true;
+
+ return false;
+ }
+
+ /**
+ * Sets the HASP License Manager idle time.
+ *
+ * @param idle_time Idle time in minutes. Set to 0 for default value.
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #getLastError
+ */
+ public boolean legacysetIdletime(short idle_time) {
+ status = Hasp.LegacySetIdletime(handle[0], idle_time);
+ if (status == HaspStatus.HASP_STATUS_OK)
+ return true;
+ return false;
+ }
+
+ /**
+ * Detach a commuter license.
+ *
+ * @deprecated This function is deprecated use transfer API instead
+ * @param action XML definition of the action.
+ * @param scope XML definition of the information scope.
+ * @param vendor_code The Vendor Code.
+ * @param destination XML definition of the output destination.
+ * @return info The returned information (XML list).
+ *
+ * @see #getLastError
+ */
+ @Deprecated
+ public String detach(String action, String scope, String vendor_code, String destination)
+ {
+ byte[] info = { 0 };
+ int[] status1 = { 0 };
+ String s = null;
+
+ if (action == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else if (scope == null)
+ status = HaspStatus.HASP_INV_SCOPE;
+ else if (vendor_code == null)
+ status = HaspStatus.HASP_INV_VCODE;
+ else if (destination == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ if (status != HaspStatus.HASP_STATUS_OK)
+ return null;
+
+ info = Hasp.Detach(action, scope, vendor_code, destination, status1);
+ status = status1[0];
+
+ if (status == HaspStatus.HASP_STATUS_OK)
+ s = new String(info);
+
+ return s;
+ }
+
+ /**
+ * Transfer a license (detach or rehost).
+ *
+ * @param action XML definition of the action.
+ * @param scope XML definition of the information scope.
+ * @param vendor_code The Vendor Code.
+ * @param destination XML definition of the output destination.
+ * @return info The returned information (XML list).
+ *
+ * @see #getLastError
+ */
+ public String transfer(String action, String scope, String vendor_code, String destination)
+ {
+ byte[] info= { 0 };
+ int[] status1 = { 0 };
+ String s = null;
+
+ if (action == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else if (scope == null)
+ status = HaspStatus.HASP_INV_SCOPE;
+ else if (vendor_code == null)
+ status = HaspStatus.HASP_INV_VCODE;
+ else if (destination == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ if (status != HaspStatus.HASP_STATUS_OK)
+ return null;
+
+ info = Hasp.Transfer(action, scope, vendor_code, destination, status1);
+
+ status = status1[0];
+
+ if (status == HaspStatus.HASP_STATUS_OK)
+ s = new String(info);
+
+ return s;
+ }
+
+ /**
+ * Update information regarding a login session
+ * for a Sentinel protection key.
+ *
+ * @param option Definition of the data to be updated by the function.
+ *
+ * @return true/false - indicates success or failure.
+ *
+ * @see #getLastError
+ */
+ public boolean updateSession(String option)
+ {
+ if (option == null)
+ status = HaspStatus.HASP_INV_PARAM;
+ else
+ status = Hasp.UpdateSession(handle[0], option);
+
+ return (status == HaspStatus.HASP_STATUS_OK);
+ }
+
+}
+
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/Aladdin/HaspApiVersion.java b/bolt-api/src/main/java/com/jiluo/bolt/Aladdin/HaspApiVersion.java
new file mode 100644
index 0000000..bd60b70
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/Aladdin/HaspApiVersion.java
@@ -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];
+ }
+}
+
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/Aladdin/HaspStatus.java b/bolt-api/src/main/java/com/jiluo/bolt/Aladdin/HaspStatus.java
new file mode 100644
index 0000000..2dfbe3c
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/Aladdin/HaspStatus.java
@@ -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;
+ }
+ }
+ }
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/Aladdin/HaspTime.java b/bolt-api/src/main/java/com/jiluo/bolt/Aladdin/HaspTime.java
new file mode 100644
index 0000000..7125825
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/Aladdin/HaspTime.java
@@ -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];
+ }
+}
+
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/common/BigDecimalValueFilter.java b/bolt-api/src/main/java/com/jiluo/bolt/common/BigDecimalValueFilter.java
new file mode 100644
index 0000000..fd4e0b1
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/common/BigDecimalValueFilter.java
@@ -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;
+ }
+}
\ No newline at end of file
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/common/CameraDriverEnum.java b/bolt-api/src/main/java/com/jiluo/bolt/common/CameraDriverEnum.java
new file mode 100644
index 0000000..a2c8aaa
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/common/CameraDriverEnum.java
@@ -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;
+ }
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/common/DefectType.java b/bolt-api/src/main/java/com/jiluo/bolt/common/DefectType.java
new file mode 100644
index 0000000..3ef7977
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/common/DefectType.java
@@ -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 defectTypes(String product) {
+ return Arrays.stream(DefectType.values()).filter(_t -> _t.getDetectType().getProduct().equalsIgnoreCase(product)).collect(Collectors.toList());
+ }
+}
\ No newline at end of file
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/common/DetectAttribute.java b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectAttribute.java
new file mode 100644
index 0000000..b0ae369
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectAttribute.java
@@ -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> defectZone;
+
+ private String detectTrack;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/common/DetectConfig.java b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectConfig.java
new file mode 100644
index 0000000..5ad51e0
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectConfig.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/common/DetectJob.java b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectJob.java
new file mode 100644
index 0000000..76a8f42
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectJob.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/common/DetectMessage.java b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectMessage.java
new file mode 100644
index 0000000..3e1a88c
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectMessage.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/common/DetectResult.java b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectResult.java
new file mode 100644
index 0000000..60fbf85
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectResult.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/common/DetectResultKey.java b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectResultKey.java
new file mode 100644
index 0000000..fdb0659
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectResultKey.java
@@ -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;
+ }
+}
\ No newline at end of file
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/common/DetectType.java b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectType.java
new file mode 100644
index 0000000..39eda68
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/common/DetectType.java
@@ -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);
+ }
+}
\ No newline at end of file
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/common/LocalStatus.java b/bolt-api/src/main/java/com/jiluo/bolt/common/LocalStatus.java
new file mode 100644
index 0000000..610b475
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/common/LocalStatus.java
@@ -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-离线
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/common/PermissionValue.java b/bolt-api/src/main/java/com/jiluo/bolt/common/PermissionValue.java
new file mode 100644
index 0000000..1a3aedf
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/common/PermissionValue.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/AlgorithmConfigDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/AlgorithmConfigDto.java
new file mode 100644
index 0000000..8e0cdef
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/AlgorithmConfigDto.java
@@ -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 dailyAutoDetectionTime;
+
+ private Integer delayDetect;
+
+ private List pointIdList;
+
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/AlgorithmDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/AlgorithmDto.java
new file mode 100644
index 0000000..641e2fd
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/AlgorithmDto.java
@@ -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 points;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/AlgorithmModelDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/AlgorithmModelDto.java
new file mode 100644
index 0000000..8578a3b
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/AlgorithmModelDto.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/DetectDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/DetectDto.java
new file mode 100644
index 0000000..3484c51
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/DetectDto.java
@@ -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 features;
+
+ private List jobs;
+}
+
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/DetectResultDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/DetectResultDto.java
new file mode 100644
index 0000000..6ba73bf
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/DetectResultDto.java
@@ -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 detectList;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/DeviceDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/DeviceDto.java
new file mode 100644
index 0000000..514cbb1
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/DeviceDto.java
@@ -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;
+
+}
+
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/IdToNameDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/IdToNameDto.java
new file mode 100644
index 0000000..7b684ca
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/IdToNameDto.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/ImgDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/ImgDto.java
new file mode 100644
index 0000000..2461bf0
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/ImgDto.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/MotorGroupDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/MotorGroupDto.java
new file mode 100644
index 0000000..6924f1b
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/MotorGroupDto.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/PermissionDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/PermissionDto.java
new file mode 100644
index 0000000..df8c192
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/PermissionDto.java
@@ -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 permissionList;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/PointDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/PointDto.java
new file mode 100644
index 0000000..845dc99
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/PointDto.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/PowerStationDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/PowerStationDto.java
new file mode 100644
index 0000000..f09a216
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/PowerStationDto.java
@@ -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;
+
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/RoleDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/RoleDto.java
new file mode 100644
index 0000000..522bfee
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/RoleDto.java
@@ -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;
+
+
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/SystemInfoConfigDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/SystemInfoConfigDto.java
new file mode 100644
index 0000000..752f21a
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/SystemInfoConfigDto.java
@@ -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 powerStations;
+
+ private String reservedField;
+
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/TempSenserDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/TempSenserDto.java
new file mode 100644
index 0000000..cfd9710
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/TempSenserDto.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/TempThresholdDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/TempThresholdDto.java
new file mode 100644
index 0000000..0609a63
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/TempThresholdDto.java
@@ -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 deviceIdList;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/ThemeConfigDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/ThemeConfigDto.java
new file mode 100644
index 0000000..4fc55b7
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/ThemeConfigDto.java
@@ -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 powerStationList;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/UserDto.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/UserDto.java
new file mode 100644
index 0000000..9adc2cb
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/dto/UserDto.java
@@ -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;
+
+}
+
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/AlgorithmVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/AlgorithmVo.java
new file mode 100644
index 0000000..9ce2853
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/AlgorithmVo.java
@@ -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;
+
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/DefectVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/DefectVo.java
new file mode 100644
index 0000000..766d4c3
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/DefectVo.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/DeviceVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/DeviceVo.java
new file mode 100644
index 0000000..c6735eb
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/DeviceVo.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/DropDownVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/DropDownVo.java
new file mode 100644
index 0000000..fb31766
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/DropDownVo.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/HistoricalDataVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/HistoricalDataVo.java
new file mode 100644
index 0000000..6f80810
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/HistoricalDataVo.java
@@ -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;
+
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/MotorGroupVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/MotorGroupVo.java
new file mode 100644
index 0000000..dc7390d
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/MotorGroupVo.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/PermissionVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/PermissionVo.java
new file mode 100644
index 0000000..689a62c
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/PermissionVo.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/PointVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/PointVo.java
new file mode 100644
index 0000000..b9e00a9
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/PointVo.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/PowerStationVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/PowerStationVo.java
new file mode 100644
index 0000000..4280c5a
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/PowerStationVo.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/RoleVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/RoleVo.java
new file mode 100644
index 0000000..d89ba04
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/RoleVo.java
@@ -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;
+
+}
+
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/SystemInfoConfigVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/SystemInfoConfigVo.java
new file mode 100644
index 0000000..c183567
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/SystemInfoConfigVo.java
@@ -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 powerStations;
+
+ private String reservedField;
+
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/TempSenserVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/TempSenserVo.java
new file mode 100644
index 0000000..7466c76
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/TempSenserVo.java
@@ -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;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/ThemeConfigVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/ThemeConfigVo.java
new file mode 100644
index 0000000..63fddcc
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/ThemeConfigVo.java
@@ -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 powerStations;
+}
diff --git a/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/UserVo.java b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/UserVo.java
new file mode 100644
index 0000000..6ab169f
--- /dev/null
+++ b/bolt-api/src/main/java/com/jiluo/bolt/entity/vo/UserVo.java
@@ -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 permissionList;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date gmtCreate;
+
+ private String password;
+
+}
+
diff --git a/bolt-core/pom.xml b/bolt-core/pom.xml
new file mode 100644
index 0000000..fbdf4e4
--- /dev/null
+++ b/bolt-core/pom.xml
@@ -0,0 +1,76 @@
+
+
+
+ bolt-server
+ com.jiluo.bolt
+ 0.0.1-SNAPSHOT
+
+ 4.0.0
+
+ bolt-core
+
+
+
+ com.jiluo.bolt
+ bolt-dao
+ 0.0.1-SNAPSHOT
+
+
+
+ com.jiluo.bolt
+ bolt-api
+ 0.0.1-SNAPSHOT
+
+
+
+
+ com.auth0
+ java-jwt
+
+
+
+
+ cn.hutool
+ hutool-all
+
+
+
+ com.opencsv
+ opencsv
+
+
+
+ com.google.guava
+ guava
+
+
+
+ com.deepoove
+ poi-tl
+
+
+
+
+ com.alibaba
+ easyexcel
+
+
+
+ io.minio
+ minio
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework
+ spring-test
+
+
+
+
\ No newline at end of file
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/config/MinioConfig.java b/bolt-core/src/main/java/com/jiluo/bolt/config/MinioConfig.java
new file mode 100644
index 0000000..da5d7a4
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/config/MinioConfig.java
@@ -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;
+ }
+}
\ No newline at end of file
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/config/UploadFile.java b/bolt-core/src/main/java/com/jiluo/bolt/config/UploadFile.java
new file mode 100644
index 0000000..b559dc9
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/config/UploadFile.java
@@ -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 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);
+ }
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/domain/DefectInfo.java b/bolt-core/src/main/java/com/jiluo/bolt/domain/DefectInfo.java
new file mode 100644
index 0000000..478cdb4
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/domain/DefectInfo.java
@@ -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;
+ }
+}
\ No newline at end of file
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/export/Analysis.java b/bolt-core/src/main/java/com/jiluo/bolt/export/Analysis.java
new file mode 100644
index 0000000..58887e4
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/export/Analysis.java
@@ -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 jobs) {
+ Pair, List> 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 dateRange, Integer status) {
+ Pair, List> 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 timeDim, List 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 typeDim() {
+ return DefectType.defectTypes(DetectType.BOLT_AND_LINE.getProduct());
+ }
+
+ private List zoneDim(Integer zone) {
+ return IntStream.rangeClosed(1, zone).boxed().collect(Collectors.toList());
+ }
+
+ private Pair, List> load(String pointId, List jobs, Range dateRange, Integer status) {
+ List jobList = new ArrayList<>();
+ List 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> apply(List jobs, List defects) {
+ Map _job = jobs.stream().collect(Collectors.toMap(Job::getJobId, Job::getGmtCreate));
+
+ List _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 timeDim = jobs.parallelStream().map(Job::getGmtCreate).distinct().sorted(Date::compareTo).collect(Collectors.toList());
+ return Pair.of(timeDim, _defects);
+ }
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/export/Export.java b/bolt-core/src/main/java/com/jiluo/bolt/export/Export.java
new file mode 100644
index 0000000..f31ce81
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/export/Export.java
@@ -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 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 dateRange = Range.between(Date.from(start.toInstant(ZoneOffset.UTC)), Date.from(end.toInstant(ZoneOffset.UTC)));
+
+ List 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 jobs, ByteArrayOutputStream target) {
+ return analysis.report(pointId, jobs).export(target).getExportFileName();
+ }
+
+ @SneakyThrows
+ public String export(String pointId, Range dateRange, Integer status, ByteArrayOutputStream target) {
+ return analysis.report(pointId, dateRange, status).export(target).getExportFileName();
+ }
+
+ @SneakyThrows
+ public String export(String pointId, List jobs, String path) {
+ return analysis.report(pointId, jobs).export(path).getExportFileName();
+ }
+
+ @SneakyThrows
+ public String export(String pointId, Range 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());
+ }
+
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/export/Report.java b/bolt-core/src/main/java/com/jiluo/bolt/export/Report.java
new file mode 100644
index 0000000..b0face3
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/export/Report.java
@@ -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 reportTime;
+
+ private List timeDimensions;
+ private List typeDimensions;
+ private List zoneDimensions;
+
+ private Map> allDefectData;
+
+ private Map analysisResult;
+
+ private AnalysisResult analysis(DefectType type, List defects) {
+ defects.removeAll(defects.parallelStream().filter(x -> !timeDimensions.contains(x.getTime()) || !zoneDimensions.contains(x.getZone())).collect(Collectors.toList()));
+ Map> _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 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 convert() {
+ Map 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 census;
+ private List 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 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 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();
+ }
+}
\ No newline at end of file
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/AlarmService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/AlarmService.java
new file mode 100644
index 0000000..3914c01
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/AlarmService.java
@@ -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 {
+
+ public static Map ALARM_MAP = new ConcurrentHashMap<>();
+
+ public List getAll();
+
+ public void add(Alarm alarm);
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/AlgorithmService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/AlgorithmService.java
new file mode 100644
index 0000000..0142108
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/AlgorithmService.java
@@ -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 {
+
+ public Algorithm getByPoint(String pointId);
+
+ public Integer getPointCount(String algorithmId);
+
+ public List select(AlgorithmDto algorithmDto);
+
+ public void add(AlgorithmDto algorithmDto);
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/AlgorithmTempleteService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/AlgorithmTempleteService.java
new file mode 100644
index 0000000..6aff0b6
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/AlgorithmTempleteService.java
@@ -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 {
+
+
+ public List select(AlgorithmDto algorithmDto);
+
+ public Integer selectTotal(AlgorithmDto algorithmDto);
+
+ public String add(AlgorithmDto algorithmDto);
+
+ public Boolean updateByBizId(AlgorithmDto algorithmDto);
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/ConfigService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/ConfigService.java
new file mode 100644
index 0000000..b1e9471
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/ConfigService.java
@@ -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 {
+
+ public boolean updateByBizId(String bizId,String value);
+
+ public Config selectByBizId(String bizId);
+
+ public List selectByCategory(String category);
+
+ public Config selectByDescription(String description);
+
+ public List select(Config configDto);
+
+ public Boolean add(Config configDto,String type);
+
+ public Boolean updateByBizId(Config configDto);
+
+
+
+
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/DefectService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/DefectService.java
new file mode 100644
index 0000000..e24d909
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/DefectService.java
@@ -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 {
+
+ public static Map TEMPERATUREMAP = new ConcurrentHashMap<>();
+
+ public List getRealTimeData(String jobId);
+
+ public List getByJob(String jobId);
+
+ public List getByJob(List jobIds);
+
+ public List chartData(String pointId,String product,Integer zone,String startTime,String endTime);
+
+ public List 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);
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/DetectService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/DetectService.java
new file mode 100644
index 0000000..50bc365
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/DetectService.java
@@ -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 {
+
+ public Map> getImg(String jobId);
+
+ public void add(Detect detect);
+
+ public Integer selectByJob(String jobId);
+
+ public List getByJob(String jobId);
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/DeviceService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/DeviceService.java
new file mode 100644
index 0000000..0825c8e
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/DeviceService.java
@@ -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 {
+
+ Map DeviceLocalStatus = new ConcurrentHashMap<>();
+
+ public Device selectByBizId(String deviceId);
+
+ public List selectByPoint(String pointId);
+
+ public List selectAll();
+
+ public void updateTemp(String deviceId,String tempThreshold);
+
+ public void updateStatus(String deviceId,Integer status);
+
+ public List 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 select(TempSenserDto tempSenserDto);
+
+ public Integer selectTotal(TempSenserDto tempSenserDto);
+
+ public Boolean add(TempSenserDto tempSenserDto,String type);
+
+ public Boolean updateByBizId(TempSenserDto tempSenserDto);
+
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/DeviceTempleteService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/DeviceTempleteService.java
new file mode 100644
index 0000000..37315c8
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/DeviceTempleteService.java
@@ -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 {
+
+ public DeviceTemplete getByBizId(String venderId);
+
+ public List getByBizId(List venderIds);
+
+ List getAll();
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/JobService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/JobService.java
new file mode 100644
index 0000000..afa679f
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/JobService.java
@@ -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 {
+
+ public static Map JOB_MAP = new ConcurrentHashMap<>();
+
+ public Job getByBizId(String jobId);
+
+ public List getByBizId(List jobIds);
+
+ public Job getRealtimeJob(String pointId,String product);
+
+ public List 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 exportData(Date startTime,Date endTime);
+
+ public void addJob(Job job);
+
+ public void updateAttribute(String jobId, String attribute, Integer status);
+
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/MinioService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/MinioService.java
new file mode 100644
index 0000000..ca4b60b
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/MinioService.java
@@ -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> 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;
+}
\ No newline at end of file
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/MotorGroupService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/MotorGroupService.java
new file mode 100644
index 0000000..7d2546d
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/MotorGroupService.java
@@ -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 {
+
+ public List getAll();
+
+ public MotorGroup getByBizId(String bizId);
+
+ public Integer getTotalByPowerStation(String powerStationId);
+
+ public List select(MotorGroupDto motorGroupDto);
+
+ public Integer selectTotal(MotorGroupDto motorGroupDto);
+
+ public Boolean add(MotorGroupDto motorGroupDto);
+
+ public Boolean updateByBizId(MotorGroupDto motorGroupDto);
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/PointService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/PointService.java
new file mode 100644
index 0000000..e88324c
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/PointService.java
@@ -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 {
+
+ public List getAll();
+
+ public List 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 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 getByPowerStation(String powerStationId);
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/PowerStationService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/PowerStationService.java
new file mode 100644
index 0000000..cff0c5a
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/PowerStationService.java
@@ -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 {
+ public List getAll();
+
+ public PowerStation getByBizId(String bizId);
+
+ public List select(PowerStationDto powerStationDto);
+
+ public Integer selectTotal(PowerStationDto powerStationDto);
+
+ public Boolean add(PowerStationDto powerStationDto);
+
+ public Boolean updateByBizId(PowerStationDto powerStationDto);
+
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/ProductService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/ProductService.java
new file mode 100644
index 0000000..5b4af64
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/ProductService.java
@@ -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 {
+
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/RoleItemService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/RoleItemService.java
new file mode 100644
index 0000000..752e04d
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/RoleItemService.java
@@ -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 {
+
+ public RoleItem getByBizId(String bizId);
+
+ public List getByBizId(List itemIds);
+
+ public List getAll();
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/RoleService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/RoleService.java
new file mode 100644
index 0000000..377136f
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/RoleService.java
@@ -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 {
+
+ public Role getByRoleId(String roleId);
+
+ public List select(RoleDto roleDto);
+
+ public String add(RoleDto roleDto);
+
+ public Boolean updateByBizId(RoleDto roleDto);
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/RoleValueService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/RoleValueService.java
new file mode 100644
index 0000000..81fb210
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/RoleValueService.java
@@ -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 {
+
+ public List getByRoleId(String roleId);
+
+ public RoleValue getProduct(String roleId);
+
+ public List select(PermissionDto permissionDto);
+
+ public Boolean add(RoleValue roleValue);
+
+ public Boolean updateByItemId(RoleValue roleValue);
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/UserService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/UserService.java
new file mode 100644
index 0000000..0c6fad8
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/UserService.java
@@ -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 {
+
+ public User getByUid(String uid);
+
+ public List select(UserDto userDto);
+
+ public Boolean add(UserDto userDto);
+
+ public Boolean updateByBizId(UserDto userDto);
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/VersionService.java b/bolt-core/src/main/java/com/jiluo/bolt/service/VersionService.java
new file mode 100644
index 0000000..0e9f7d1
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/VersionService.java
@@ -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 {
+
+ public Version select();
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/AlarmServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/AlarmServiceImpl.java
new file mode 100644
index 0000000..e4f1b2e
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/AlarmServiceImpl.java
@@ -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 implements AlarmService {
+ /** logger:日志文件 */
+ private static final Logger logger = LoggerFactory.getLogger(AlarmServiceImpl.class);
+
+ @Autowired
+ AlarmMapper alarmMapper;
+
+ public List getAll(){
+ return new ArrayList<>(ALARM_MAP.values());
+ }
+
+ public void add(Alarm alarm){
+ alarmMapper.insert(alarm);
+ }
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/AlgorithmServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/AlgorithmServiceImpl.java
new file mode 100644
index 0000000..1cfe893
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/AlgorithmServiceImpl.java
@@ -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 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 queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("point",pointId);
+ return algorithmMapper.selectOne(queryWrapper);
+ }
+
+ @Override
+ public Integer getPointCount(String algorithmId) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("algorithm",algorithmId);
+ return algorithmMapper.selectCount(queryWrapper);
+ }
+
+ @Override
+ public List select(AlgorithmDto algorithmDto) {
+ QueryWrapper 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().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);
+ }
+ });
+ }
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/AlgorithmTempleteServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/AlgorithmTempleteServiceImpl.java
new file mode 100644
index 0000000..dbdead9
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/AlgorithmTempleteServiceImpl.java
@@ -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 implements AlgorithmTempleteService {
+ /** logger:日志文件 */
+ private static final Logger logger = LoggerFactory.getLogger(AlgorithmTempleteServiceImpl.class);
+
+ @Autowired
+ AlgorithmTempleteMapper algorithmTempleteMapper;
+
+ @Override
+ public List select(AlgorithmDto algorithmDto) {
+ QueryWrapper 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 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 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;
+ }
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/ConfigServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/ConfigServiceImpl.java
new file mode 100644
index 0000000..f815632
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/ConfigServiceImpl.java
@@ -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 implements ConfigService {
+ /** logger:日志文件 */
+ private static final Logger logger = LoggerFactory.getLogger(ConfigServiceImpl.class);
+
+ @Autowired
+ ConfigMapper configMapper;
+
+ public boolean updateByBizId(String bizId,String value){
+ UpdateWrapper updateWrapper = new UpdateWrapper<>();
+ updateWrapper.eq("biz_id",bizId).set("value",value);
+ configMapper.update(null,updateWrapper);
+ return true;
+ }
+
+ public Config selectByBizId(String bizId){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("biz_id",bizId);
+ return configMapper.selectOne(queryWrapper);
+ }
+
+ @Override
+ public List selectByCategory(String category) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("category",category);
+ return configMapper.selectList(queryWrapper);
+ }
+
+ @Override
+ public Config selectByDescription(String description) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("description",description);
+ return configMapper.selectOne(queryWrapper);
+ }
+
+ @Override
+ public List select(Config configDto) {
+ QueryWrapper 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 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;
+ }
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/DefectServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/DefectServiceImpl.java
new file mode 100644
index 0000000..0dbf323
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/DefectServiceImpl.java
@@ -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 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 getRealTimeData(String jobId){
+ QueryWrapper wrapper = new QueryWrapper();
+ wrapper.eq("job",jobId).eq("status",0);
+ return defectMapper.selectList(wrapper);
+ }
+
+ public List getByJob(String jobId){
+ QueryWrapper wrapper = new QueryWrapper();
+ wrapper.eq("job",jobId).eq("status",0);
+ return defectMapper.selectList(wrapper);
+ }
+
+ public List getByJob(List jobIds){
+ QueryWrapper wrapper = new QueryWrapper();
+ wrapper.in("job",jobIds);
+ return defectMapper.selectList(wrapper);
+ }
+
+ public List chartData(String pointId,String product,Integer zone,String startTime,String endTime){
+ QueryWrapper wrapper = new QueryWrapper();
+ 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 exportData(String pointId, Date startTime, Date endTime, Integer status){
+ QueryWrapper wrapper = new QueryWrapper();
+ 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 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);
+ }
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/DetectServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/DetectServiceImpl.java
new file mode 100644
index 0000000..2a6a503
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/DetectServiceImpl.java
@@ -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 implements DetectService {
+ /** logger:日志文件 */
+ private static final Logger logger = LoggerFactory.getLogger(DetectServiceImpl.class);
+
+ @Autowired
+ DetectMapper detectMapper;
+
+ public Map> getImg(String jobId){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("job",jobId);
+ Map> result = new HashMap<>();
+ detectMapper.selectList(queryWrapper).stream().collect(Collectors.groupingBy(Detect::getZone))
+ .forEach((k,v)->{
+ List 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 queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("job",jobId);
+ return detectMapper.selectCount(queryWrapper);
+ }
+
+ @Override
+ public List getByJob(String jobId) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("job",jobId);
+ return detectMapper.selectList(queryWrapper);
+ }
+
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/DeviceServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/DeviceServiceImpl.java
new file mode 100644
index 0000000..8fe0aff
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/DeviceServiceImpl.java
@@ -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 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 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 selectByPoint(String pointId){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("point",pointId);
+ List deviceList = deviceMapper.selectList(queryWrapper);
+ deviceList.stream().filter(device -> DeviceLocalStatus.get(device.getPointId()).getCameraStatus()==2).forEach(device -> device.setStatus(2));
+ return deviceList;
+ }
+
+ public List selectAll(){
+ List 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 updateWrapper = new UpdateWrapper<>();
+ updateWrapper.eq("biz_id",deviceId).set("temp_threshold",tempThreshold);
+ deviceMapper.update(null,updateWrapper);
+ }
+
+ public void updateStatus(String deviceId,Integer status){
+ UpdateWrapper updateWrapper = new UpdateWrapper<>();
+ updateWrapper.eq("biz_id",deviceId).set("status",status);
+ deviceMapper.update(null,updateWrapper);
+ }
+
+ @Override
+ public List select(DeviceDto deviceDto) {
+ QueryWrapper 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 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 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 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 updateWrapper = new UpdateWrapper<>();
+ updateWrapper.eq("biz_id",deviceDto.getDeviceId()).set("status",deviceDto.getStatus());
+ deviceMapper.update(null,updateWrapper);
+ return true;
+ }
+ @Override
+ public List select(TempSenserDto tempSenserDto) {
+ QueryWrapper 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 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 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 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;
+ }
+
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/DeviceTempleteServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/DeviceTempleteServiceImpl.java
new file mode 100644
index 0000000..6f32a84
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/DeviceTempleteServiceImpl.java
@@ -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 implements DeviceTempleteService {
+ /** logger:日志文件 */
+ private static final Logger logger = LoggerFactory.getLogger(DeviceTempleteServiceImpl.class);
+
+ List deviceTempleteList = new ArrayList<>();
+
+ @Autowired
+ DeviceTempleteMapper deviceTempleteMapper;
+
+ @PostConstruct
+ private void init(){
+ QueryWrapper 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 getByBizId(List venderIds) {
+ return deviceTempleteList.stream().filter(x->venderIds.stream().anyMatch(_venderId -> StringUtils.equalsIgnoreCase(x.getBizId(),_venderId))).collect(Collectors.toList());
+ }
+
+ @Override
+ public List getAll() {
+ return deviceTempleteList;
+ }
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/JobServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/JobServiceImpl.java
new file mode 100644
index 0000000..a854c1c
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/JobServiceImpl.java
@@ -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 implements JobService {
+ /** logger:日志文件 */
+ private static final Logger logger = LoggerFactory.getLogger(JobServiceImpl.class);
+
+ @Autowired
+ JobMapper jobMapper;
+
+ @Override
+ public Job getByBizId(String jobId) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("biz_id",jobId);
+ return jobMapper.selectOne(queryWrapper);
+ }
+
+ public List getByBizId(List jobIds) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.in("biz_id", jobIds);
+ return jobMapper.selectList(queryWrapper);
+ }
+
+ public Job getRealtimeJob(String pointId, String product){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("point",pointId)
+ .eq("product",product)
+ .orderByDesc("gmt_create")
+ .last("limit 1");
+ return jobMapper.selectOne(queryWrapper);
+ }
+
+ public List 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 wrapper = new QueryWrapper();
+ //组装模糊查询条件
+ 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 wrapper = new QueryWrapper();
+ //组装模糊查询条件
+ 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 exportData(Date startTime, Date endTime){
+ QueryWrapper wrapper = new QueryWrapper();
+ //组装模糊查询条件
+ 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 updateWrapper = new UpdateWrapper<>();
+ updateWrapper.eq("biz_id",jobId).set("attribute",attribute).set("status",status);
+ jobMapper.update(null,updateWrapper);
+ }
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/MinioServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/MinioServiceImpl.java
new file mode 100644
index 0000000..a981624
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/MinioServiceImpl.java
@@ -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> 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);
+ }
+
+
+}
\ No newline at end of file
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/MotorGroupServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/MotorGroupServiceImpl.java
new file mode 100644
index 0000000..a5b0c5b
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/MotorGroupServiceImpl.java
@@ -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 implements MotorGroupService {
+ /** logger:日志文件 */
+ private static final Logger logger = LoggerFactory.getLogger(MotorGroupServiceImpl.class);
+
+ @Autowired
+ MotorGroupMapper motorGroupMapper;
+
+ public List getAll(){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ return motorGroupMapper.selectList(queryWrapper);
+ }
+
+
+ public MotorGroup getByBizId(String bizId){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("biz_id",bizId);
+ return motorGroupMapper.selectOne(queryWrapper);
+ }
+
+ public Integer getTotalByPowerStation(String powerStationId){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("power_station",powerStationId);
+ return motorGroupMapper.selectCount(queryWrapper);
+ }
+
+ @Override
+ public List select(MotorGroupDto motorGroupDto) {
+ QueryWrapper 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 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 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;
+ }
+
+
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/PointServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/PointServiceImpl.java
new file mode 100644
index 0000000..ebb230c
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/PointServiceImpl.java
@@ -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 implements PointService {
+ /** logger:日志文件 */
+ private static final Logger logger = LoggerFactory.getLogger(PointServiceImpl.class);
+
+ @Autowired
+ PointMapper pointMapper;
+
+
+ public List getAll(){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ List 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 getByRole(String motorGroup){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("motor_group",motorGroup);
+ return pointMapper.selectList(queryWrapper);
+ }
+
+ public void updateEnableDetect(String pointId,Integer enableDetect){
+ UpdateWrapper updateWrapper = new UpdateWrapper<>();
+ updateWrapper.eq("biz_id",pointId).set("enable_detect",enableDetect);
+ pointMapper.update(null,updateWrapper);
+ }
+
+ public void updateResetTime(String pointId,Date date){
+ UpdateWrapper updateWrapper = new UpdateWrapper<>();
+ updateWrapper.eq("biz_id",pointId).set("gmt_reset",date);
+ pointMapper.update(null,updateWrapper);
+ }
+
+ public void updateConfig(String pointId, String config){
+ UpdateWrapper updateWrapper = new UpdateWrapper<>();
+ updateWrapper.eq("biz_id",pointId).set("config",config);
+ pointMapper.update(null,updateWrapper);
+ }
+
+ public Point getByBizId(String bizId){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("biz_id",bizId);
+ return pointMapper.selectOne(queryWrapper);
+ }
+
+ @Override
+ public Integer getTotalByMotorGroup(String motorGroupId) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("motor_group",motorGroupId);
+
+ return pointMapper.selectCount(queryWrapper);
+ }
+
+ @Override
+ public List select(PointDto pointDto) {
+ QueryWrapper 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 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 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 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 getByPowerStation(String powerStationId) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("power_station",powerStationId);
+ return pointMapper.selectList(queryWrapper);
+ }
+
+
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/PowerStationServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/PowerStationServiceImpl.java
new file mode 100644
index 0000000..ac3f741
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/PowerStationServiceImpl.java
@@ -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 implements PowerStationService {
+ /** logger:日志文件 */
+ private static final Logger logger = LoggerFactory.getLogger(PowerStationServiceImpl.class);
+
+ @Autowired
+ PowerStationMapper powerStationMapper;
+
+ public List getAll(){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ return powerStationMapper.selectList(queryWrapper);
+ }
+
+ public PowerStation getByBizId(String bizId){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("biz_id",bizId);
+ return powerStationMapper.selectOne(queryWrapper);
+ }
+
+ public List select(PowerStationDto powerStationDto){
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.like(StringUtils.isNotBlank(powerStationDto.getName()),"name",powerStationDto.getName());
+ return powerStationMapper.selectList(queryWrapper);
+ }
+
+ public Integer selectTotal(PowerStationDto powerStationDto){
+ QueryWrapper 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 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;
+ }
+
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/ProductServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/ProductServiceImpl.java
new file mode 100644
index 0000000..8690bc8
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/ProductServiceImpl.java
@@ -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 implements ProductService {
+ /** logger:日志文件 */
+ private static final Logger logger = LoggerFactory.getLogger(ProductServiceImpl.class);
+
+}
diff --git a/bolt-core/src/main/java/com/jiluo/bolt/service/impl/RoleItemServiceImpl.java b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/RoleItemServiceImpl.java
new file mode 100644
index 0000000..4bdf8eb
--- /dev/null
+++ b/bolt-core/src/main/java/com/jiluo/bolt/service/impl/RoleItemServiceImpl.java
@@ -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