Compare commits
10 Commits
b24be48dfe
...
867b21bd12
| Author | SHA1 | Date |
|---|---|---|
|
|
867b21bd12 | 7 months ago |
|
|
54f1bd0fb8 | 8 months ago |
|
|
cf5e12a069 | 9 months ago |
|
|
42902276e9 | 10 months ago |
|
|
c31e4b6210 | 10 months ago |
|
|
8ef26d874e | 1 year ago |
|
|
8c1670b09f | 1 year ago |
|
|
1dd0e5dd9a | 1 year ago |
|
|
c5ab39e8c9 | 1 year ago |
|
|
66d7ef4f86 | 1 year ago |
@ -0,0 +1,30 @@
|
|||||||
|
package com.rehome.adminclientappmqttserver.controller;
|
||||||
|
|
||||||
|
import com.rehome.adminclientappmqttserver.entity.User;
|
||||||
|
import com.rehome.adminclientappmqttserver.entity.Userdyw;
|
||||||
|
import com.rehome.adminclientappmqttserver.service.UserService;
|
||||||
|
import com.rehome.adminclientappmqttserver.service.UserdywService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前端控制器 大亚湾综合能源
|
||||||
|
* @author huangwenfei
|
||||||
|
* @since 2024-11-05 10:04
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/userDyw")
|
||||||
|
public class UserDywController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserdywService userdywService;
|
||||||
|
|
||||||
|
public void saveUser(Userdyw user){
|
||||||
|
userdywService.saveByUsername(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.rehome.adminclientappmqttserver.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.rehome.adminclientappmqttserver.entity.Userbh;
|
||||||
|
import com.rehome.adminclientappmqttserver.entity.Useryf;
|
||||||
|
import com.rehome.adminclientappmqttserver.entity.Userzy;
|
||||||
|
import com.rehome.adminclientappmqttserver.service.UserbhService;
|
||||||
|
import com.rehome.adminclientappmqttserver.service.UseryfService;
|
||||||
|
import com.rehome.adminclientappmqttserver.service.UserzyService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器 博贺电厂
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author huangwenfei
|
||||||
|
* @since 2022-03-09
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/userBh")
|
||||||
|
public class UserbhController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserbhService userbhService;
|
||||||
|
|
||||||
|
public void saveUserBh(Userbh user){
|
||||||
|
userbhService.saveByUsernameBh(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.rehome.adminclientappmqttserver.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author huangwenfei
|
||||||
|
* @since 2023-08-29
|
||||||
|
*/
|
||||||
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
|
@Proxy(lazy = false)
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
public class Userbh implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
private String nfc;
|
||||||
|
|
||||||
|
@Column( length = 32)
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package com.rehome.adminclientappmqttserver.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EntityListeners;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author huangwenfei
|
||||||
|
* @since 2024-11-05 09:49
|
||||||
|
*/
|
||||||
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
|
@Proxy(lazy = false)
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
public class Userdyw implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
@Column( length = 50)
|
||||||
|
private String imeinum;
|
||||||
|
|
||||||
|
@Column( length = 100)
|
||||||
|
private String sysversion;
|
||||||
|
|
||||||
|
private String phonemodel;
|
||||||
|
|
||||||
|
private String appversion;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.rehome.adminclientappmqttserver.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.rehome.adminclientappmqttserver.entity.Userbh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类 博贺电厂
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author huangwenfei
|
||||||
|
* @since 2025-02-11
|
||||||
|
*/
|
||||||
|
public interface UserbhService {
|
||||||
|
public void saveByUsernameBh(Userbh user);
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.rehome.adminclientappmqttserver.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.rehome.adminclientappmqttserver.entity.Userdyw;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author huangwenfei
|
||||||
|
* @since 2021-08-17
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface UserdywService {
|
||||||
|
void saveByUsername(Userdyw user);
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.rehome.adminclientappmqttserver.service.impl;
|
||||||
|
|
||||||
|
import com.rehome.adminclientappmqttserver.dao.UserbhRepository;
|
||||||
|
import com.rehome.adminclientappmqttserver.entity.Userbh;
|
||||||
|
import com.rehome.adminclientappmqttserver.service.UserbhService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类 博贺电厂
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author huangwenfei
|
||||||
|
* @since 2025-02-11
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class UserbhServiceImpl implements UserbhService {
|
||||||
|
@Resource
|
||||||
|
private UserbhRepository userbhRepository;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveByUsernameBh(Userbh user) {
|
||||||
|
this.userbhRepository.save(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.rehome.adminclientappmqttserver.service.impl;
|
||||||
|
|
||||||
|
import com.rehome.adminclientappmqttserver.dao.UserdywRepository;
|
||||||
|
import com.rehome.adminclientappmqttserver.entity.Userdyw;
|
||||||
|
import com.rehome.adminclientappmqttserver.service.UserdywService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务实现类 大亚湾综合能源
|
||||||
|
* @author huangwenfei
|
||||||
|
* @since 2024-11-05 09:56
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class UserdywServiceImpl implements UserdywService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserdywRepository userdywRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveByUsername(Userdyw user) {
|
||||||
|
this.userdywRepository.save(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
package com.rehome.adminclientappmqttserver.utils;
|
||||||
|
|
||||||
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
|
import org.bouncycastle.openssl.PEMKeyPair;
|
||||||
|
import org.bouncycastle.openssl.PEMParser;
|
||||||
|
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
|
||||||
|
|
||||||
|
import javax.net.ssl.KeyManagerFactory;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
|
import javax.net.ssl.TrustManagerFactory;
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.security.KeyPair;
|
||||||
|
import java.security.KeyStore;
|
||||||
|
import java.security.Security;
|
||||||
|
import java.security.cert.CertificateFactory;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
|
||||||
|
public class MqttSSLSocketFactory {
|
||||||
|
public static SSLSocketFactory getSingleSocketFactory(InputStream caCrtFileInputStream) throws Exception {
|
||||||
|
Security.addProvider(new BouncyCastleProvider());
|
||||||
|
X509Certificate caCert = null;
|
||||||
|
|
||||||
|
BufferedInputStream bis = new BufferedInputStream(caCrtFileInputStream);
|
||||||
|
CertificateFactory cf = CertificateFactory.getInstance("X.509");
|
||||||
|
|
||||||
|
while (bis.available() > 0) {
|
||||||
|
caCert = (X509Certificate) cf.generateCertificate(bis);
|
||||||
|
}
|
||||||
|
KeyStore caKs = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
|
caKs.load(null, null);
|
||||||
|
caKs.setCertificateEntry("cert-certificate", caCert);
|
||||||
|
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
||||||
|
tmf.init(caKs);
|
||||||
|
SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
|
||||||
|
sslContext.init(null, tmf.getTrustManagers(), null);
|
||||||
|
return sslContext.getSocketFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SSLSocketFactory getTwoDirSocketFactory(InputStream caCrtFile, InputStream crtFile, InputStream keyFile,
|
||||||
|
String password) throws Exception {
|
||||||
|
Security.addProvider(new BouncyCastleProvider());
|
||||||
|
|
||||||
|
// load CA certificate
|
||||||
|
X509Certificate caCert = null;
|
||||||
|
|
||||||
|
BufferedInputStream bis = new BufferedInputStream(caCrtFile);
|
||||||
|
CertificateFactory cf = CertificateFactory.getInstance("X.509");
|
||||||
|
|
||||||
|
while (bis.available() > 0) {
|
||||||
|
caCert = (X509Certificate) cf.generateCertificate(bis);
|
||||||
|
}
|
||||||
|
|
||||||
|
// load client certificate
|
||||||
|
bis = new BufferedInputStream(crtFile);
|
||||||
|
X509Certificate cert = null;
|
||||||
|
while (bis.available() > 0) {
|
||||||
|
cert = (X509Certificate) cf.generateCertificate(bis);
|
||||||
|
}
|
||||||
|
|
||||||
|
// load client private cert
|
||||||
|
PEMParser pemParser = new PEMParser(new InputStreamReader(keyFile));
|
||||||
|
Object object = pemParser.readObject();
|
||||||
|
JcaPEMKeyConverter converter = new JcaPEMKeyConverter();
|
||||||
|
KeyPair key = converter.getKeyPair((PEMKeyPair) object);
|
||||||
|
|
||||||
|
KeyStore caKs = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
|
caKs.load(null, null);
|
||||||
|
caKs.setCertificateEntry("cert-certificate", caCert);
|
||||||
|
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
||||||
|
tmf.init(caKs);
|
||||||
|
|
||||||
|
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||||
|
ks.load(null, null);
|
||||||
|
ks.setCertificateEntry("certificate", cert);
|
||||||
|
ks.setKeyEntry("private-cert", key.getPrivate(), password.toCharArray(),
|
||||||
|
new java.security.cert.Certificate[]{cert});
|
||||||
|
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
|
||||||
|
kmf.init(ks, password.toCharArray());
|
||||||
|
|
||||||
|
SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
|
||||||
|
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
|
||||||
|
|
||||||
|
return sslContext.getSocketFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
package com.rehome.adminclientappmqttserver.utils;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class UUIDUtil {
|
||||||
|
public static String getUUID() {
|
||||||
|
return UUID.randomUUID().toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@ -0,0 +1,27 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEogIBAAKCAQEApkLWaF5mqX/9Qv0PiFgvsEO9vNNzKcGjyAyLZBNQb70PgF33
|
||||||
|
i7XsOBwNzo/xdisBXmWsCOPWVM60MUIGT4v7iCNueWQlMOsYYNxV47EV3ZclZbz4
|
||||||
|
Ji5sKKczn1U1l25w5v3jNZEYcxHU6uwmtiBFCZa2SeEV0jI356qNU5Wvt9u/Io9Z
|
||||||
|
tb5tZ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Xb8Jgrr4sEB
|
||||||
|
1Z+7U+ytCC4yfzLKOAiHo78nadS+/ulGaY+xE3C87UmAz8+WbKKyYznGSgxm3Z7w
|
||||||
|
jCzkzTco4oV0AzHzkbbsSwKBgDaOVgyVXSR+3Py3MO116s7CKmruUaFcSMPaMTBS
|
||||||
|
U8dnfCwASrzSIng6+jD2C7CDCBXqcy5V7FCYwQr9PQCDSZZN8VonO3UkJJGu+Tmp
|
||||||
|
SJYfRGOx+ydljntcxF/N0sRbji971hQwXlNp/LPWQutnqkRcrY8Blv6TSg6KWpYJ
|
||||||
|
7AylAoGAMp/nSsfpjnoYW+8KdC+iEZw66FjCg5HV11rWCUqj7gsgNOfCUhku826M
|
||||||
|
23SwZWWVQzOR5dJsmtUuzO1cXcpxKSpMdpVikB4TYFm4U1l5QZuSG+L2516IjwwJ
|
||||||
|
q96skUIZ649Tu1B5ecQLMPD0S/Hc8Guhcr31KGnisOQt/CbSA1w=
|
||||||
|
-----END RSA PRIVATE KEY-----
|
||||||
Binary file not shown.
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#安装 oracle 执行这个命令
|
||||||
|
mvn install:install-file -Dfile=/Users/admin/ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.1.0 -Dpackaging=jar
|
||||||
|
|
||||||
Loading…
Reference in New Issue