新需求开发

This commit is contained in:
haozq 2025-06-20 18:25:25 +08:00
parent 19d4134128
commit e84c75e99a
28 changed files with 2191 additions and 25 deletions

View File

@ -70,6 +70,17 @@ public class LoginUser implements Serializable
private String test;
private String sgccToken;
public String getSgccToken() {
return sgccToken;
}
public void setSgccToken(String sgccToken) {
this.sgccToken = sgccToken;
}
public String getTest() {
return test;
}

Binary file not shown.

View File

@ -13,6 +13,16 @@
<dependencies>
<!---结束-->
<dependency>
<groupId>com.sgcc.sgsm</groupId>
<artifactId>sgsm</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/sgsm-1.0.0.jar</systemPath>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>

View File

@ -7,6 +7,7 @@ import com.securitycontrol.auth.form.LoginBody;
import com.securitycontrol.auth.service.SysLoginService;
import com.securitycontrol.auth.service.SysRecordLogService;
import com.securitycontrol.auth.utils.SMHelper;
import com.securitycontrol.auth.utils.SMUtil;
import com.securitycontrol.common.core.constant.Constant;
import com.securitycontrol.common.core.constant.SecurityConstants;
import com.securitycontrol.common.core.domain.Result;
@ -92,6 +93,37 @@ public class TokenController {
@Value("${isc.url}")
public String url;
/**
* 从基建全过程跳转获取token
* @param form
* @return
*/
@PostMapping("sgccLogin")
public Result<?> sgccLogin(@RequestBody LoginBody form) {
String loginName="";
if(StringHelper.isEmpty(form.getToken())){
throw new ServiceException("token已失效",201);
}else{
String sm4Old = SMUtil.decryptBySM4(form.getToken(), "dExRIyURnVBug9kA");
if(StringHelper.isNotEmpty(sm4Old)){
String[] list=sm4Old.split("@");
if(list.length!=7){
throw new ServiceException("token已失效",201);
}else{
loginName=list[5];
}
}
}
LoginUser userInfo = sysLoginService.login(loginName, "Bonus@admin123",form.getLoginType(),null);
userInfo.setSgccToken(form.getToken());
// 获取登录token
return Result.ok(tokenService.createToken(userInfo));
}
@PostMapping("login2")
public Result<?> login2(@RequestBody LoginBody form) {
try {
@ -135,6 +167,15 @@ public class TokenController {
}
}
@PostMapping("login3")
public Result<?> login3(@RequestBody LoginBody form) {
try {

View File

@ -25,6 +25,17 @@ public class LoginBody{
private String accessToken;
private String token;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
@ApiModelProperty("1.省侧大屏 2.施工现场大屏 3.app")
private String loginType;

View File

@ -0,0 +1,289 @@
package com.securitycontrol.auth.utils;
import org.apache.tomcat.util.codec.binary.Base64;
import javax.crypto.*;
import javax.crypto.spec.DESKeySpec;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
/**
* 封装 DES加密 /Base64编码的工具类
*
* @author yulianyu
*
*/
public class EncodeUtil {
private static byte rawKeyData[] = null;
static {
/*
* SecureRandom sr; try { sr = new SecureRandom("qt".getBytes("utf-8"));
* } catch (UnsupportedEncodingException e) { sr = new
* SecureRandom("qt".getBytes()); } // 为我们选择的DES算法生成一个KeyGenerator对象
* KeyGenerator kg = null; try { kg = KeyGenerator.getInstance("DES"); }
* catch (NoSuchAlgorithmException e) { } kg.init(sr); // 生成密匙 SecretKey
* key = kg.generateKey(); rawKeyData = key.getEncoded(); // 获取密匙数据
*/rawKeyData = HEXStringToByte("7ca4f7ceb3e91016");
}
/**
* 传入字符串返回一个加密串
*
* @param s
* @return
*/
public static String encode(String s) {
try {
byte[] encryptedData = encrypt(s);
s = byteToHEXString(encryptedData);
} catch (Exception e) {
}
return s;
}
/**
* 传入数字返回一个加密串
*
* @param s
* @return
*/
public static String encode(long goodsId) {
try {
byte[] encryptedData = encrypt("" + goodsId);
return byteToHEXString(encryptedData);
} catch (Exception e) {
}
return "";
}
/**
* 传入加密串返回解密串
*
* @param s
* @return
*/
public static String decode(String s) {
try {
return decrypt(HEXStringToByte(s));
} catch (Exception e) {
}
return s;
}
/**
* 传入字符串返回一个加密串
*
* @param s
* @return
*/
public static String encodeBase64(String s) {
byte[] binaryData = null;
try {
binaryData = s.getBytes("utf-8");
} catch (UnsupportedEncodingException e) {
return s;
}
// byte[] newbt = Base64.encodeBase64(binaryData);
return encodeBase64(binaryData);// new String(newbt);
}
public static String encodeBase64(byte[] binaryData) {
byte[] newbt = Base64.encodeBase64(binaryData);
return new String(newbt);
}
public static byte[] enBase64(byte[] binaryData) {
return Base64.encodeBase64(binaryData);
}
public static byte[] deBase64(byte[] bytes) throws IOException {
return Base64.decodeBase64(bytes);
}
public static String stringEncode(String str) {
return java.net.URLEncoder.encode(str);
}
/**
* 传入加密串返回解密串
*
* @param s
* @return
*/
public static String decodeBase64(String s) {
try {
return decodeBase64(s.getBytes("utf-8"));
} catch (UnsupportedEncodingException e) {
return s;
}
}
public static String decodeBase64(byte[] bytes) {
byte[] oldbt = null;
String t = null;
try {
oldbt = Base64.decodeBase64(bytes);
t = new String(oldbt, "utf-8");
} catch (UnsupportedEncodingException e) {
}
return t;
}
public static String byteToHEXString(byte[] bArray) {
StringBuilder sb = new StringBuilder(100);
for (int i = 0; i < bArray.length; i++) {
String hex = Integer.toHexString(bArray[i] & 0xff);
if (hex.length() == 1) {
sb.append("0").append(hex);
} else {
sb.append(hex);
}
}
return sb.toString().toUpperCase();
}
public static byte[] HEXStringToByte(String strString) {
byte[] ret = new byte[strString.length() / 2];
for (int i = 0; i < ret.length; i++) {
ret[i] = Integer.decode("#" + strString.substring(2 * i, 2 * i + 2)).byteValue();
}
return ret;
}
/**
* 加密方法
*
* @param str
* @return
* @throws InvalidKeyException
* @throws NoSuchAlgorithmException
* @throws IllegalBlockSizeException
* @throws BadPaddingException
* @throws NoSuchPaddingException
* @throws InvalidKeySpecException
* @throws UnsupportedEncodingException
*/
public static byte[] encrypt(String str) throws InvalidKeyException, NoSuchAlgorithmException,
IllegalBlockSizeException, BadPaddingException, NoSuchPaddingException, InvalidKeySpecException,
UnsupportedEncodingException {
// DES算法要求有一个可信任的随机数源
// SecureRandom sr = new SecureRandom();
// 从原始密匙数据创建一个DESKeySpec对象
DESKeySpec dks = new DESKeySpec(rawKeyData);
// 创建一个密匙工厂然后用它把DESKeySpec转换成一个SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey key = keyFactory.generateSecret(dks);
// Cipher对象实际完成加密操作
Cipher cipher = Cipher.getInstance("DES");
// 用密匙初始化Cipher对象
cipher.init(Cipher.ENCRYPT_MODE, key);
// 现在获取数据并加密
byte data[] = str.getBytes("utf-8");
// 正式执行加密操作
byte[] encryptedData = cipher.doFinal(data);
return encryptedData;
}
/**
* 解密方法
*
* @param rawKeyData
* @param encryptedData
* @throws IllegalBlockSizeException
* @throws BadPaddingException
* @throws InvalidKeyException
* @throws NoSuchAlgorithmException
* @throws NoSuchPaddingException
* @throws InvalidKeySpecException
* @throws UnsupportedEncodingException
*/
public static String decrypt(byte[] encryptedData) throws IllegalBlockSizeException, BadPaddingException,
InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException,
UnsupportedEncodingException {
// DES算法要求有一个可信任的随机数源
// SecureRandom sr = new SecureRandom();
// 从原始密匙数据创建一个DESKeySpec对象
DESKeySpec dks = new DESKeySpec(rawKeyData);
// 创建一个密匙工厂然后用它把DESKeySpec对象转换成一个SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey key = keyFactory.generateSecret(dks);
// Cipher对象实际完成解密操作
Cipher cipher = Cipher.getInstance("DES");
// 用密匙初始化Cipher对象
cipher.init(Cipher.DECRYPT_MODE, key);
// 正式执行解密操作
byte decryptedData[] = cipher.doFinal(encryptedData);
return new String(decryptedData, "utf-8");
}
public String getCurrentMillyTime() {
return Long.valueOf(System.currentTimeMillis()).toString();
}
/**
* 字节数组转16进制
*
* @param bytes
* 需要转换的byte数组
* @return 转换后的Hex字符串
*/
public static String byteToHex(byte[] bytes) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < bytes.length; i++) {
String hex = Integer.toHexString(bytes[i] & 0xFF);
if (hex.length() < 2) {
sb.append(0);
}
sb.append(hex);
}
return sb.toString();
}
/**
* hex字符串转byte数组
*
* @param inHex
* 待转换的Hex字符串
* @return 转换后的byte数组结果
*/
public static byte[] hexToByte(String inHex) {
int hexlen = inHex.length();
byte[] result;
if (hexlen % 2 == 1) {
// 奇数
hexlen++;
result = new byte[(hexlen / 2)];
inHex = "0" + inHex;
} else {
// 偶数
result = new byte[(hexlen / 2)];
}
int j = 0;
for (int i = 0; i < hexlen; i += 2) {
result[j] = StringToByte(inHex.substring(i, i + 2));
j++;
}
return result;
}
/**
* Hex字符串转byte
*
* @param inHex
* 待转换的Hex字符串
* @return 转换后的byte
*/
public static byte StringToByte(String inHex) {
return (byte) Integer.parseInt(inHex, 16);
}
}

View File

@ -0,0 +1,441 @@
package com.securitycontrol.auth.utils;
import com.securitycontrol.common.core.exception.ServiceException;
import com.securitycontrol.common.core.utils.aes.StringHelper;
import com.sgitg.sgcc.sm.SM2Utils;
import com.sgitg.sgcc.sm.SM3Utils;
import com.sgitg.sgcc.sm.SM4Utils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
@Slf4j
public class SMUtil {
private final static SM2Utils SM2_UTILS = new SM2Utils();
private final static SM4Utils SM4_UTILS = new SM4Utils();
/**
* session中SM4密钥主键(不能变)
* @since 2018年11月22日 v1.0
*/
public final static String SESSION_SECRET ="pegsecret";
/**
* SM4前端临时静态密钥(默认)
*
* @since 2018年11月22日 v1.0
*/
private final static String FOUR_STATIC_ASK = "N200y834yEhD5gX5";
/**
* SM4密钥入库(分段)
* fi5bde20D0whcKxJ()?
* @since 2018年11月22日 v1.0
*/
private final static String FOUR_LIBRARY_ASK_FRONT = "fi5bde20";
private final static String FOUR_LIBRARY_ASK_AFTER = "D0whcKxJ";
/**
* SM2私钥(默认解动态密钥)
* 用于解SM4密
* @since 2018年11月22日 v1.0
*/
private final static String SM2_PRI_ASK = "9c721e71fe522ebdc8ee239ae1e29206760e9cd6a5e7a01641cf580c796d9a3b";
private final static String CARD_ENCRYPT_KEY = "dExRdyURnVBug9kA";
public static String encryptCardNo(String cardNo){
try {
//姓名 身份证 手机号 账号地址银行卡
if(StringUtils.isBlank(cardNo)){
return null;
}
return encryptBySM4ECB(cardNo,CARD_ENCRYPT_KEY);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static String decryptCardNo(String cardNo){
try {
if(StringUtils.isBlank(cardNo)){
return null;
}
return decryptBySM4(cardNo,CARD_ENCRYPT_KEY);
} catch (Exception e) {
e.printStackTrace();
return cardNo;
}
}
/**
* 国密SM2算法加密方法(对称加解密)
* @param plainText 需要加密的数据
* @param pubKey 加密所需要的hex编码公钥
* @return 返回加密后hex编码字符串
*/
public final static String encryptBySM2(String plainText, String pubKey){
//将需要加密的信息进行utf8编码转换为byte数组
byte[] msg= StringUtil.toUTF8ByteArray(plainText);
//hex编码的公钥进行转换为byte数组
byte[] key = EncodeUtil.hexToByte(pubKey);
byte [] cipherByteArray = null;
try {
cipherByteArray = SM2_UTILS.SG_SM2EncData(key,msg);
} catch (IOException e) {
throw new RuntimeException("国密SM2算法加密失败",e);
}
//将加密后的byte数组进行hex编码以String字符形式输出
return (EncodeUtil.byteToHex(cipherByteArray));
}
/**
* 国密SM2算法解密方法(对称加解密)
* @param cipherText 加密后的hex编码数据
* @param priKey 解密需要的hex 编码的私钥
* @return 加密后明文数据
*/
public final static String decryptBySM2(String cipherText, String priKey) {
//加密后的密文先进行hex解码为byte数组
byte[] cipher = EncodeUtil.hexToByte(cipherText);
//私钥进行hex解码为byte数组
byte [] prikey = EncodeUtil.hexToByte(priKey);
byte[] plainByteArray = null;
try {
plainByteArray = SM2_UTILS.SG_SM2DecData(prikey, cipher);
} catch (IOException e) {
throw new RuntimeException("国密SM2算法解密失败",e);
}
if(plainByteArray == null){
throw new RuntimeException("国密SM2算法解密失败");
}
//解密后进行字符转为字符串形式
return StringUtil.fromUTF8ByteArray(plainByteArray);
}
/**
* 国密SM3算法加密(不可逆)
* @param plainText 需要进行加密的数据
* @return 返回加密后hex编码字符
*/
public final static String SM3Digest(String plainText) {
final SM3Utils SM3_UTILS = new SM3Utils();
// 需要加密的数据转化为byte数组
byte[] byteArray = StringUtil.toUTF8ByteArray(plainText);
SM3_UTILS.SG_SM3UpDate(byteArray);
byte[] sg_SM3Final = null;
try {
sg_SM3Final = SM3_UTILS.SG_SM3Final();
} catch (Exception e) {
throw new RuntimeException("国密SM3算法加密失败",e);
}
return (EncodeUtil.byteToHex(sg_SM3Final)).toLowerCase();
}
/**
* 使用国密 SM4算法ECB模式进行加密密数据(密钥使用各自模块定义的密钥)
* @param plainText 需要进行解密hex编码密文
* @param sm4key 解密需要的hex编码的秘钥
* @return 返回解密后的明文信息
*/
public static final String encryptBySM4ECB(String plainText,String sm4key){
//调用国密SM4算法的ecb模式对明文数据进行加密
byte[] sg_EncECBData =SM4_UTILS.SG_EncECBData(StringUtil.toUTF8ByteArray(sm4key), StringUtil.toUTF8ByteArray(plainText));
return (EncodeUtil.byteToHex(sg_EncECBData));
}
/**
* 使用国密 SM4算法ECB模式进行解密数据(密钥使用各自模块定义的密钥)
* @param cipherText 需要进行解密hex编码密文
* @param sm4key 解密需要的hex编码的秘钥
* @return 返回解密后的明文信息
*/
public static final String decryptBySM4(String cipherText, String sm4key) {
//调用国密SM4算法ECB模式对密文进行解密
byte[] sg_EncECBData = SM4_UTILS.SG_DecECBData(StringUtil.toUTF8ByteArray(sm4key), EncodeUtil.hexToByte(cipherText));
return StringUtil.fromUTF8ByteArray(sg_EncECBData);
}
/**
* 获取SM2公钥
* @return
* @since 2018年11月22日 v1.0
*/
public static String getSM2Key(){
String key = "0453f1d34ffd6489c41c8ffba7a604e48097ed605361c794fc9b6d7df064f081f72d9bdc592db2fcc8c6599350e67969bb9227d1ac04a50268353226c45bb35424";
return key;
}
/**
* 生成128位随机数SM4秘钥即16位字符串
*
* @return
* @since 2019年1月2日 v1.0
*/
public static String generateSM4Key() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 16; i++) {
int f = (int) (Math.random()*62);
if(f < 10) {
sb.append(f);
}else if(f < 36) {
sb.append((char)(f + 'A'-10));
}else {
sb.append((char)(f + 'a'-36));
}
}
return sb.toString();
}
/**
* 登录时解密sm4密钥(专用)
* @param data
* @return
* @since 2018年11月22日 v1.0
*/
public static String decryptBySM2Login(String data){
if(StringUtils.isNotBlank(data)){
data = decryptBySM2(data, SM2_PRI_ASK);//
}
return data;
}
/**
* 解密数为明文(解密数据库SM4;单独用)
* @param data
* @return
* @since 2018年11月22日 v1.0
*/
public static String databaseDecryptBySM4(String data){
if(StringUtils.isNotBlank(data)){
data = decryptBySM4(data, FOUR_LIBRARY_ASK_FRONT.concat(FOUR_LIBRARY_ASK_AFTER));//
}
return data;
}
/**
* 加密数据为密文(加密数据库SM4;单独用)
* @param data
* @return
* @since 2018年11月22日 v1.0
*/
public static String databaseEncryptBySM4(String data){
if(StringUtils.isNotBlank(data)){
data = encryptBySM4ECB(data, FOUR_LIBRARY_ASK_FRONT.concat(FOUR_LIBRARY_ASK_AFTER));//
}
return data;
}
/**
* 解密数为明文(用前端默认密钥解密 SM4;单独用)
* @param data
* @return
* @since 2018年11月22日 v1.0
*/
public static String foreDefaultDecryptBySM4(String data){
if(StringUtils.isNotBlank(data)){
data = decryptBySM4(data, FOUR_STATIC_ASK);//
}
return data;
}
/**
* 加密数据为密文(用前端默认密钥加密 SM;单独用4)
* @param data
* @return
* @since 2018年11月22日 v1.0
*/
public static String foreDefaultEncryptBySM4(String data){
if(StringUtils.isNotBlank(data)){
data = encryptBySM4ECB(data, FOUR_STATIC_ASK);//
}
return data;
}
/**
* 解密数为明文
* (用前解密SM4[session密钥:-session密钥解,-默认密钥解];单独用)
* @param data
* @return
* @since 2018年11月22日 v1.0
*/
// public static String foreWebDecryptBySM4(String data, HttpSession session){
// if(StringUtils.isNotBlank(data)){
// if(session != null){
// String four_solution = ToolUtil.empty(session.getAttribute(SESSION_SECRET));
// if(StringUtils.isNotBlank(four_solution)){//登录
// data = decryptBySM4(data, four_solution);//前解
// }else{//未登录
// data = foreDefaultDecryptBySM4(data);//前默认解
// }
// }else{
// data = foreDefaultDecryptBySM4(data);//前默认解
// }
// }
// return data;
// }
/**
* 加密数据为密文
* (前加密SM4[session密钥:-session密钥加密,-默认密钥加密];单独用)
* @param data
* @return
* @since 2018年11月22日 v1.0
*/
// public static String foreWebEncryptBySM4(String data, HttpSession session){
// if(StringUtils.isNotBlank(data)){
// if(session != null){
// String four_solution = ToolUtil.empty(session.getAttribute(SESSION_SECRET));
// if(StringUtils.isNotBlank(four_solution)){//登录
// data = encryptBySM4ECB(data, four_solution);//后加
// }else{//未登录
// data = foreDefaultEncryptBySM4(data);////(默密)加给前端
// }
// }else{
// data = foreDefaultEncryptBySM4(data);////(默密)加给前端
// }
// }
// return data;
// }
//
/**
* 解密数为明文(session中密钥解密 SM4;单独用)
* @param data
* @return
* @since 2018年11月22日 v1.0
*/
// public static String sessionDecryptBySM4(String data, HttpSession session){
// if(StringUtils.isNotBlank(data) && session != null){
// String four_solution = ToolUtil.empty(session.getAttribute(SESSION_SECRET));
// if(StringUtils.isNotBlank(four_solution)){
// data = decryptBySM4(data, four_solution);
// }
// }
// return data;
// }
/**
* 加密数据为密文(session中密钥加密 SM4;单独用)
* @param data
* @return
* @since 2018年11月22日 v1.0
*/
// public static String sessionEncryptBySM4(String data, HttpSession session){
// if(StringUtils.isNotBlank(data) && session != null){
// String four_solution = ToolUtil.empty(session.getAttribute(SESSION_SECRET));
// if(StringUtils.isNotBlank(four_solution)){
// data = encryptBySM4ECB(data, four_solution);
// }
// }
// return data;
// }
/**
* 校验时密文 解密 成明文
* @param data
* @param session
* @return
* @since 2018年11月22日 v1.0
*/
// public static String validateDecryptBySM4(String data, HttpSession session){
// if(StringUtils.isNotBlank(data)){
// if(session != null){
// try {
// String four_solution = ToolUtil.empty(session.getAttribute(SESSION_SECRET));
// data = decryptBySM4(data, four_solution);//
// } catch (Exception e) {
// try {
// data = foreDefaultDecryptBySM4(data);
// } catch (Exception e2) {
// // TODO: handle exception
// }
// }
// }
// }
// return data;
// }
/**
* 重要数据加密入库(前端传输后端入库)
* 如果已登录则取出session中的SM4密钥否则取静态密钥用此密钥给前端传输的重要数据解密后用后端密钥给重要数据加密并返回
*
* @param data
* @return
* @since 2018年11月22日 v1.0
*/
// public static final String getEncryptData(String data, HttpSession session) {
// //session 获取sm4key ;无用默认密钥,有用session 密钥解密数据;然后用数密加密数据入库
// if(StringUtils.isNotBlank(data)){
// try {
// data = foreWebDecryptBySM4(data, session);
// data = databaseEncryptBySM4(data);//后加
// } catch (Exception e) {
//
// }
//
// }
// return data;
// }
/**
* 重要数据解密出库(后端出库传回前端)
* 如果已登录则取出session中的SM4密钥否则取静态密钥用此密钥给前端传输的重要数据解密后用后端密钥给重要数据加密并返回
*
* @param data
* @return
* @since 2018年11月22日 v1.0
*/
// public static final String getDecryptData(String data, HttpSession session) {
// //后解,后加
// if(StringUtils.isNotBlank(data)){
// try {
// data = databaseDecryptBySM4(data);
// data = foreWebEncryptBySM4(data, session);
// } catch (Exception e) {
// }
// }
// return data;
// }
//
/**
* 登录时解密sm4密钥(专用)
* @param data
* @return
* @since 2018年11月22日 v1.0
*/
public static String decryptBySM2SecurityFilter(String data){
if(StringUtils.isNotBlank(data)){
data = decryptBySM2(data, SM2_PRI_ASK);//
}
return data;
}
/*public static final String getDecryptData(String data, Object sm4key) {
String decryptData = decryptBySM4(data, SM4_KEY);
if(sm4key != null) {
return encryptBySM4ECB(decryptData, sm4key.toString());
} else {
return encryptBySM4ECB(decryptData, FOUR_STATIC_ASK);
}
return null;
}*/
public static void main(String[] args) {
String token = "7ffc49ea57f80a0960994448328802149aeb5d815d252c32ca723e4bb7e2202eb60c61c1144a3ec164de22cce55d42b2011762f84d6d3aec2b7ea7967776ca84ad9d3feefe582334074933a673db44adb60c61c1144a3ec164de22cce55d42b2011762f84d6d3aec2b7ea7967776ca84a6609f52454a36fe52a4c42cf168fae3ba42af60ee034aa2d79d8f1a9a56f3e0" ;
String sm4Old = SMUtil.decryptBySM4(token, "dExRIyURnVBug9kA");
log.info("sm4Old:{}", sm4Old);
if(StringHelper.isNotEmpty(sm4Old)){
String[] list=sm4Old.split("@");
if(list.length!=7){
throw new ServiceException("token已失效",201);
}else{
System.err.println(list[5]);
}
}
}
}

View File

@ -0,0 +1,682 @@
package com.securitycontrol.auth.utils;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.util.*;
/**
* @title :字符串常用操作
* @description :字符串常用操作公共方法
* @date: 2010-02-24
*/
public class StringUtil {
/***************************************************************************
* java字符串相应类型的处理
**************************************************************************/
/**
* @description: 补充字符的方法,1direction的取值为r(在原字符串右边补充)l(在原字符串左边补充)
* @param oldStr原字符串
* @param strLen返回字符串长度
* @param padChar插入字符串
* @param direction插入方向
* @return补充后的字符串
* @author 徐玉明
* @date: 2010-02-24
*/
public static String padString(String oldStr, int strLen, char padChar,
char direction) {
String newStr = oldStr;
try {
if (oldStr.length() >= strLen) {
newStr = oldStr;
} else {
if (direction == 'r') {
while (newStr.length() < strLen) {
newStr = newStr + padChar;
}
} else {
while (newStr.length() < strLen) {
newStr = padChar + newStr;
}
}
}
return newStr;
} catch (Exception e) {
return oldStr;
}
}
/**
* @description: 提供字符串到Vector的转变
* @param tStr要解析的字符串
* @param sStr分隔符
* @return转变后的向量
* @author 徐玉明
* @date: 2010-02-24
*/
public static Vector Str2Vect(String tStr, String sStr) {
Vector vector = new Vector();
StringTokenizer st = new StringTokenizer(tStr, sStr);
while (st.hasMoreTokens()) {
vector.add(st.nextToken());
}
return vector;
}
/** 提供Vector到字符串的转变转变后的字符串以sStr作为分割符 * */
/**
* @description: 向量到字符串的转变
* @param tVect要转换的向量
* @param sStr转换后的分隔符
* @return转变后的向量
* @author 徐玉明
* @date: 2010-02-24
*/
public static String Vect2Str(Vector tVect, String sStr) {
String reStr = "";
if (tVect.size() > 0)
reStr = (String) tVect.get(0);
for (int i = 1; i < tVect.size(); i++) {
reStr += sStr + (String) tVect.get(i);
}
return reStr;
}
/**
* @description: 向量转换为没有分隔符的字符串
* @param tVect要转换的向量
* @return转变后的向量
* @author 徐玉明
* @date: 2010-02-24
*/
public static String Vect2Str(Vector tVect) {
String reStr = "";
for (int i = 0; i < tVect.size(); i++) {
reStr += (String) tVect.get(i);
}
return reStr;
}
/**
* @description: 字符串到字符串数组的转变
* @param tStr要解析的字符串
* @param sStr分隔符
* @author 徐玉明
* @date: 2010-02-24
*/
public static String[] Str2Strs(String tStr, String sStr) {
StringTokenizer st = new StringTokenizer(tStr, sStr);
String[] reStrs = new String[st.countTokens()];
int n = 0;
while (st.hasMoreTokens()) {
reStrs[n] = st.nextToken();
n++;
}
return reStrs;
}
/**
* @description: 字符串到字符串数组的转变
* @param tStrs要解析的字符串
* @param sStr分隔符
* @author 徐玉明
* @date: 2010-02-24
*/
public static String Strs2Str(String[] tStrs, String sStr) {
String reStr = "";
int len = tStrs.length;
if (len > 0) {
if (tStrs[0] != null)
reStr = tStrs[0];
}
for (int i = 1; i < len; i++) {
if (tStrs[i] != null) {
if (tStrs[i].length() > 0)
reStr += sStr + tStrs[i];
}
}
return reStr;
}
/**
* @description:提供字符串数组到字符串的转变
* @param tStrs要转换的字符串数组
* @param sStr分隔符
* @param tostr转换成的目标字符串
* @return:转换后的字符串
* @author 徐玉明
* @date: 2010-02-24
*/
public static String Strs2Str(String[] tStrs, String sStr, String tostr) {
String reStr = "";
int len = tStrs.length;
if (len > 0) {
if (tStrs[0] != null)
reStr = "'" + tStrs[0] + "'";
}
for (int i = 1; i < len; i++) {
if (tStrs[i] != null) {
if (tStrs[i].length() > 0)
reStr += sStr + ",'" + tStrs[i] + "'";
}
}
return reStr;
}
/**
* @description:提供字符串数组到字符串的转变
* @param tStrs要转换的字符串数组
* @return:转换后的字符串
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String Strs2Str(String[] tStrs) {
String reStr = "";
int len = tStrs.length;
for (int i = 0; i < len; i++) {
if (tStrs[i] != null) {
if (tStrs[i].length() > 0)
reStr += tStrs[i];
}
}
return reStr;
}
/**
* @description:字符串以指定长度进行切割结果放入Vector对象中
* @param tStr要分割的字符串
* @param nleng要分割后每段的长度
* @return:保存分割结果的向量
* @author: 徐玉明
* @date: 2010-02-24
*/
public Vector Str2Vect(String tStr, int nleng) {
int strLength = tStr.length();
int ndiv = strLength / nleng;
Vector reVect = new Vector();
if (strLength % nleng == 0)
ndiv--;
for (int i = 0; i < (ndiv); i++) {
reVect.add(tStr.substring(i * nleng, (i + 1) * nleng));
}
reVect.add(tStr.substring(ndiv * nleng, strLength));
return reVect;
}
/**
* @description:字符串相除
* @param a被除数
* @param b除数
* @return:字符串相除的结果
* @exception:产生异常返回"-"
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String Divide(String a, String b) {
try {
return String.valueOf(Double.valueOf(a).doubleValue()
/ Double.valueOf(b).doubleValue());
} catch (Exception e) {
return "-";
}
}
/**
* @description:字符串相除
* @param a被除数
* @param b除数
* @param re:产生异常时返回的字符串信息
* @return:字符串相除的结果
* @exception:产生异常返回re
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String Divide(String a, String b, String re) {
try {
return String.valueOf(Double.valueOf(a).doubleValue()
/ Double.valueOf(b).doubleValue());
} catch (Exception e) {
return re;
}
}
/**
* @description:字符串相减
* @param a被除数
* @param b除数
* @param re:产生异常时返回的字符串信息
* @return:字符串相减的结果
* @exception:产生异常返回re
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String decrease(String a, String b, String re) {
try {
return String.valueOf(Double.valueOf(a).doubleValue()
- Double.valueOf(b).doubleValue());
} catch (Exception e) {
return re;
}
}
/**
* @description:字符串相减
* @param a被除数
* @param b除数
* @return:字符串相减的结果
* @exception:产生异常返回a
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String decrease(String a, String b) {
try {
return String.valueOf(Double.valueOf(a).doubleValue()
- Double.valueOf(b).doubleValue());
} catch (Exception e) {
return a;
}
}
/**
* @description:字符串减一
* @param a将要被处理的字符串
* @return:减一后的结果
* @exception:产生异常返回a
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String decrease(String a) {
try {
return String.valueOf(Double.valueOf(a).doubleValue() - 1);
} catch (Exception e) {
return a;
}
}
/**
* @description:字符串相加
* @param a加数
* @param b加数
* @param re产生异常时返回的字符串
* @return:相加后的结果
* @exception:产生异常返回re
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String adding(String a, String b, String re) {
try {
return String.valueOf(Double.valueOf(a).doubleValue()
+ Double.valueOf(b).doubleValue());
} catch (Exception e) {
return re;
}
}
/**
* @description:字符串相加
* @param a加数
* @param b加数
* @return:相加后的结果
* @exception:产生异常返回a
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String adding(String a, String b) {
try {
return String.valueOf(Double.valueOf(a).doubleValue()
+ Double.valueOf(b).doubleValue());
} catch (Exception e) {
return a;
}
}
/**
* @description:字符串加一
* @param a将要被处理的字符串
* @return:加一后的结果
* @exception:产生异常返回a
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String adding(String a) {
try {
return String.valueOf(Double.valueOf(a).doubleValue() + 1);
} catch (Exception e) {
return a;
}
}
/**
* @description:字符串相乘
* @param a被乘数
* @param b:乘数
* @param re产生异常时返回的字符串
* @return:相乘后的结果
* @exception:产生异常返回re
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String multiply(String a, String b, String re) {
try {
return String.valueOf(Double.valueOf(a).doubleValue()
* Double.valueOf(b).doubleValue());
} catch (Exception e) {
return re;
}
}
/**
* @description:字符串相乘
* @param a被乘数
* @param b:乘数
* @return:相乘的结果
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String multiply(String a, String b) {
try {
return String.valueOf(Double.valueOf(a).doubleValue()
* Double.valueOf(b).doubleValue());
} catch (Exception e) {
return a;
}
}
/**
* @description:字符串进行计算(a-b)/b
* @param a被减数
* @param b:减数以及除数
* @param re:产生异常时返回的字符串描述信息
* @return:计算处理后的结果
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String Tqb(String a, String b, String re) {
try {
return String.valueOf((Double.valueOf(a).doubleValue() - Double
.valueOf(b).doubleValue())
/ (Double.valueOf(b).doubleValue()));
} catch (Exception e) {
return re;
}
}
/**
* @description:字符串进行计算(a-b)/b
* @param a被减数
* @param b:减数以及除数
* @exception :"-"
* @return:计算处理后的结果
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String Tqb(String a, String b) {
try {
return String.valueOf((Double.valueOf(a).doubleValue() - Double
.valueOf(b).doubleValue())
/ (Double.valueOf(b).doubleValue()));
} catch (Exception e) {
return "-";
}
}
/**
* @description:字符串替换
* @param str:源字符串
* @param str1:新字符串
* @param str2:将要被替换的字符串
* @return:替换后的结果
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String replace(String str, String str1, String str2) {
int n = -1;
String subStr = "";
String re = "";
if ((n = str.indexOf(str1)) > -1) {
subStr = str.substring(n + str1.length(), str.length());
re = str.substring(0, n) + str2 + replace(subStr, str1, str2);
} else {
re = str;
}
return re;
}
/**
* @description:将字符串转换成Utf-8编码格式
* @param s:将要被处理的字符串
* @return:替换后的结果
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String toUtf8String(String s) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c >= 0 && c <= 255) {
sb.append(c);
} else {
byte[] b;
try {
b = Character.toString(c).getBytes("utf-8");
} catch (Exception ex) {
// System.out.println(ex);
b = new byte[0];
}
for (int j = 0; j < b.length; j++) {
int k = b[j];
if (k < 0)
k += 256;
sb.append("%" + Integer.toHexString(k).toUpperCase());
}
}
}
return sb.toString();
}
/**
* @description:字符串拆分
* @param message:需要拆分的字符串
* @param separator:分隔符
* @return:生成的数组
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String[] splitToArray(String message, String separator) {
List list = new ArrayList();
int start = 0;
int index = 0;
while ((index = message.indexOf(separator, start)) != -1) {
list.add(message.substring(start, index));
start = index + separator.length();
}
if (start < message.length()) {
list.add(message.substring(start, message.length()));
}
return (String[]) list.toArray(new String[list.size()]);
}
/**
* @description:将字符串转换为java.sql.date类型
* @param str:日期字符串
* @param formatStr:日期格式字符串
* @return:生成的日期
* @author: 徐玉明
* @date: 2010-02-24
*/
public static java.sql.Date str2SqlDate(String str, String formatStr) {
java.sql.Date sqlDate = new java.sql.Date(0);// 默认获得当前时间
try {
sqlDate = new java.sql.Date(new java.text.SimpleDateFormat(
formatStr).parse(str).getTime());
} catch (ParseException e) {
e.printStackTrace();
}
return sqlDate;
}
/**
* @description:返回对象的描述
* @param obj:将要描述的对象
* @return:对象的描述
* @author: 徐玉明
* @date: 2010-02-24
*/
public static String clear(Object obj){
if(null == obj )return "";
return obj.toString();
}
/**
* 将全角改成半角
*/
public static String replCharForInsert(Object obj){
return StringUtil.clear(obj).replaceAll("", "<").replaceAll("", ">").replaceAll("", "#").replaceAll("", "&").replaceAll("", ";");
}
/**
* richEditor保存前将过滤器转换成的全角转换回半角
* @param map 前台页面转换成的map对象
* @param fieldName 要装换的字段值
*/
public static void richEditorHandler(Map map,String fieldName){
if(map.containsKey(fieldName)){
String remark = StringUtil.replCharForInsert(map.get(fieldName)); //将数据库中经过拦截器转换成的全角符号赚换回来
map.put(fieldName, remark);
}
}
/**
* 将String字符串转化为byte数组 utf-8格式
*/
public static byte[] toUTF8ByteArray(String str){
return str.getBytes(StandardCharsets.UTF_8);
}
/**
* 将byte数组转化为String字符串
*/
public static String fromUTF8ByteArray(byte[] bs){
return new String(bs, StandardCharsets.UTF_8);
}
public static String pathManipulation(String path) {
Map<String, String> map = new HashMap<String, String>();
map.put("a", "a");
map.put("b", "b");
map.put("c", "c");
map.put("d", "d");
map.put("e", "e");
map.put("f", "f");
map.put("g", "g");
map.put("h", "h");
map.put("i", "i");
map.put("j", "j");
map.put("k", "k");
map.put("l", "l");
map.put("m", "m");
map.put("n", "n");
map.put("o", "o");
map.put("p", "p");
map.put("q", "q");
map.put("r", "r");
map.put("s", "s");
map.put("t", "t");
map.put("u", "u");
map.put("v", "v");
map.put("w", "w");
map.put("x", "x");
map.put("y", "y");
map.put("z", "z");
map.put("A", "A");
map.put("B", "B");
map.put("C", "C");
map.put("D", "D");
map.put("E", "E");
map.put("F", "F");
map.put("G", "G");
map.put("H", "H");
map.put("I", "I");
map.put("J", "J");
map.put("K", "K");
map.put("L", "L");
map.put("M", "M");
map.put("N", "N");
map.put("O", "O");
map.put("P", "P");
map.put("Q", "Q");
map.put("R", "R");
map.put("S", "S");
map.put("T", "T");
map.put("U", "U");
map.put("V", "V");
map.put("W", "W");
map.put("X", "X");
map.put("Y", "Y");
map.put("Z", "Z");
map.put(":", ":");
map.put("/", "/");
map.put("\\", "\\");
map.put(".", ".");
map.put("-", "-");
map.put("_", "_");
map.put("0", "0");
map.put("1", "1");
map.put("2", "2");
map.put("3", "3");
map.put("4", "4");
map.put("5", "5");
map.put("6", "6");
map.put("7", "7");
map.put("8", "8");
map.put("9", "9");
String temp = "";
for (int i = 0; i < path.length(); i++) {
if (map.get(path.charAt(i) + "") != null) {
temp += map.get(path.charAt(i) + "");
}
}
return temp;
}
}

View File

@ -880,7 +880,7 @@ public class DateTimeHelper {
Long starTime = star.getTime();
Long endTime = endDay.getTime();
Long num = endTime - starTime;
System.out.println("相差天数为:" + num / 24 / 60 / 60 / 1000);
// System.out.println("相差天数为:" + num / 24 / 60 / 60 / 1000);
return (num / 24 / 60 / 60 / 1000) + 1;
} catch (ParseException e) {
log.error("两个日期之间的差值", e);

View File

@ -39,4 +39,6 @@ public class CameraImageVo {
* 备注
*/
private String remark;
}

View File

@ -27,4 +27,6 @@ public class HkInfoVo {
private String proCode;
private String idCard;
private String time;
}

View File

@ -18,7 +18,7 @@ import com.securitycontrol.common.security.interceptor.HeaderInterceptor;
public class WebMvcConfig implements WebMvcConfigurer
{
/** 不需要拦截地址 */
public static final String[] EXCLUDE_URLS = { "/login/**","/userLogin/**","/sys/sysLog/saveLogs", "/logout", "/refresh","/getUserTicket","/sys/logs/saveLogs","/error","/sys/select/**" };
public static final String[] EXCLUDE_URLS = { "/login/**","/userLogin/**","/sys/sysLog/saveLogs", "/sgccLogin/**","/logout", "/refresh","/getUserTicket","/sys/logs/saveLogs","/error","/sys/select/**" };
@Override
public void addInterceptors(InterceptorRegistry registry)
{

View File

@ -66,6 +66,7 @@ public class TokenService {
String jwtToken=JwtUtils.createToken(claimsMap);
rspMap.put("access_token", jwtToken);
rspMap.put("iscUserId", loginUser.getIscUserId());
rspMap.put("sgccToken", loginUser.getSgccToken());
rspMap.put("us", JSON.toJSONString(loginUser.getSysUser()));
int time=60*120;

View File

@ -20,4 +20,6 @@ public class GatewayApplication {
System.out.println("基建现场智慧工地应用系统网关启动成功");
}
}

View File

@ -48,6 +48,16 @@
<artifactId>okhttp</artifactId>
</dependency>
<!--第三方sdk-->
<dependency>
<groupId>NetDeviceSDKP2_V2_2_7</groupId>
<artifactId>NetDeviceSDKP</artifactId>
<version>1.3.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/NetDeviceSDKP2_V2_2_7.jar</systemPath>
</dependency>
<!--海康sdk-->
<dependency>
<groupId>jna-1.1.0</groupId>

View File

@ -14,6 +14,10 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.scheduling.annotation.EnableScheduling;
import rk.netDevice.sdk.p2.*;
import java.io.IOException;
import java.text.SimpleDateFormat;
/**
* 系统模块
@ -41,16 +45,135 @@ public class VscInterApplication implements CommandLineRunner {
@Override
public void run(String... args) {
try{
//第三方sdk初始化
//海康sdk初始化
AlarmUtil util = new AlarmUtil();
int row = util.initDevice();
if (row == 1) {
log.info("初始化失败");
}
newService.loginDoor();
init();
// newService.loginDVR();//初始化DVR
}catch (Exception e){
log.info("初始化失败");
log.error(e.toString(),e);
}
}
public void init() throws InterruptedException {
// 初始化
RSServer rsServer = RSServer.Initiate(18099);
// 添加监听
rsServer.addDataListener(new IDataListener() {
@Override
public void receiveTimmingAck(TimmingAck data) {// 校时指令应答处理
System.out.println("校时应答->设备编号:" + data.getDeviceId()
+ "\t执行结果" + data.getStatus());
}
@Override
public void receiveTelecontrolAck(TelecontrolAck data) {// 遥控指令应答处理
System.out.println("遥控应答->设备编号:" + data.getDeviceId()
+ "\t继电器编号:" + data.getRelayId() + "\t执行结果:"
+ data.getStatus());
}
@Override
public void receiveStoreData(StoreData data) {// 已存储数据接收处理
// 遍历节点数据数据包括网络设备的数据以及各个节点数据温湿度数据存放在节点数据中
for (NodeData nd : data.getNodeList()) {
SimpleDateFormat sdf = new SimpleDateFormat(
"yy-MM-dd HH:mm:ss");
String str = sdf.format(nd.getRecordTime());
System.out.println("存储数据->设备地址:" + data.getDeviceId()
+ "\t节点:" + nd.getNodeId() + "\t温度:" + nd.getTem()
+ "\t湿度:" + nd.getHum() + "\t存储时间:" + str);
}
}
@Override
public void receiveRealtimeData(RealTimeData data) {// 实时数据接收处理
// 遍历节点数据数据包括网络设备的数据以及各个节点数据温湿度数据存放在节点数据中
for (NodeData nd : data.getNodeList()) {
System.out.println("实时数据->设备地址:" + data.getDeviceId()
+ "\t节点:" + nd.getNodeId() + "\t温度:" + nd.getTem()
+ "\t湿度:" + nd.getHum() + "\t经度:" + data.getLng()
+ "\t纬度:" + data.getLat() + "\t坐标类型:"
+ data.getCoordinateType() + "\t继电器状态:"
+ data.getRelayStatus());
}
}
@Override
public void receiveLoginData(LoginData data) {// 登录数据接收处理
System.out.println("登录->设备地址:" + data.getDeviceId());
}
@Override
public void receiveParamIds(ParamIdsData data) {
String str = "设备参数编号列表->设备编号:" + data.getDeviceId()
+ "\t参数总数量" + data.getTotalCount() + "\t本帧参数数量"
+ data.getCount() + "\r\n";
for (int paramId : data.getPararmIdList())// 遍历设备中参数id编号
{
str += paramId + ",";
}
System.out.println(str);
}
@Override
public void receiveParam(ParamData data) {
String str = "设备参数->设备编号:" + data.getDeviceId() + "\r\n";
for (ParamItem pararm : data.getParameterList()) {
str += "参数编号:"
+ pararm.getParamId()
+ "\t参数描述"
+ pararm.getDescription()
+ "\t参数值"
+ (pararm.getValueDescription() == null ? pararm
.getValue() : pararm.getValueDescription()
.get(pararm.getValue())) + "\r\n";
}
System.out.println(str);
}
@Override
public void receiveWriteParamAck(WriteParamAck data) {
String str = "下载设备参数->设备编号:" + data.getDeviceId() + "\t参数数量"
+ data.getCount() + "\t"
+ (data.isSuccess() ? "下载成功" : "下载失败");
System.out.println(str);
}
@Override
public void receiveTransDataAck(TransDataAck data) {
String str = "数据透传->设备编号:" + data.getDeviceId() + "\t响应结果"
+ data.getData() + "\r\n字节数" + data.getTransDataLen();
System.out.println(str);
}
@Override
public void receiveHeartbeatData(HeartbeatData heartbeatData) {
}
});
rsServer.start();
}
}

View File

@ -29,15 +29,16 @@ public class Config {
private HkServiceImpl hkService;
// public static String tables="jj_ball@jj_bid_info@jj_bid_project@jj_bidding_project@jj_class_meeting_people@jj_class_meetting@jj_class_metting_info@jj_code@jj_data_code@jj_day_plan@jj_dept_gc_project@jj_gt@jj_on_duty@jj_person@jj_prj_enginnering_experience@jj_project@jj_risk@jj_risk_precaution@jj_single_info@jj_single_project@jj_team@jj_team_info@jj_team_people@jj_ticket@jj_ticket_info@jj_ticket_people@jj_unit@jj_user@jj_weeks_plan@t_device";
public static String tables="jj_class_meeting_people@jj_class_meetting@jj_class_metting_info@jj_day_plan@jj_dept_gc_project@jj_gt@jj_on_duty@jj_risk@jj_risk_precaution@jj_single_info@jj_single_project@jj_team@jj_team_people@jj_ticket@jj_ticket_info@jj_ticket_people@jj_unit@jj_user@jj_weeks_plan";
// public static String tables="jj_class_meeting_people@jj_class_meetting@jj_class_metting_info@jj_day_plan@jj_dept_gc_project@jj_gt@jj_on_duty@jj_risk@jj_risk_precaution@jj_single_info@jj_single_project@jj_team@jj_team_people@jj_ticket@jj_ticket_info@jj_ticket_people@jj_unit@jj_user@jj_weeks_plan";
public static String tables="jj_class_meetting@jj_class_metting_info";
/**
* 全部球机定时更状态
*/
// @PostConstruct
// @Scheduled(cron = "0 0 */1 * * ?")
private void getDataInfo() throws InterruptedException {
String token=service.login();
List<String> table= Arrays.asList(tables.split("@"));
@ -50,8 +51,8 @@ public class Config {
/**
* 获取海康人员闸机数据
*/
// @Scheduled(cron = "0 0 */3 * * ?")
@Scheduled(cron = "0/30 * * * * ?")
// @Scheduled(cron = "0 0 */3 * * ?")
// @Scheduled(cron = "0/30 * * * * ?")
private void getHkUser() {
try{
hkService.getHkUser();
@ -65,8 +66,6 @@ public class Config {
@Scheduled(cron = "0 0 */6 * * ?")
private void initHk() {
try{

View File

@ -116,45 +116,45 @@ public class FMSGCallBack_V31 implements HCNetSDK.FMSGCallBack_V31 {
String successful="0";
if (0x4c == strACSInfo.dwMinor) {
fileReason="人脸信息未录入";
insertUserAccess(strACSInfo, pAlarmer, successful, fileReason,imageUrl,wd);//数据入库
// insertUserAccess(strACSInfo, pAlarmer, successful, fileReason,imageUrl,wd);//数据入库
log.error("人脸认证失败=======");
}else if (0x06 == strACSInfo.dwMinor) {
//未授权人员
log.error("未授权人员=======");
fileReason="未授权人员";
insertUserAccess(strACSInfo, pAlarmer, successful, fileReason,imageUrl,wd);//数据入库
// insertUserAccess(strACSInfo, pAlarmer, successful, fileReason,imageUrl,wd);//数据入库
}else if (0x08 == strACSInfo.dwMinor) {
//卡号过期
fileReason="卡号过期";
insertUserAccess(strACSInfo, pAlarmer, successful, fileReason,imageUrl,wd);//数据入库
// insertUserAccess(strACSInfo, pAlarmer, successful, fileReason,imageUrl,wd);//数据入库
log.error("卡号过期=======");
}else if (0x50 == strACSInfo.dwMinor) {
//人脸抓拍失败
fileReason="人脸抓拍失败";
insertUserAccess(strACSInfo, pAlarmer, successful, fileReason,imageUrl,wd);//数据入库
// insertUserAccess(strACSInfo, pAlarmer, successful, fileReason,imageUrl,wd);//数据入库
log.error("人脸抓拍失败=======");
}else if (0x70 == strACSInfo.dwMinor) {
//人证比对失败
fileReason="人证比对失败";
insertUserAccess(strACSInfo, pAlarmer, successful, fileReason,imageUrl,wd);//数据入库
// insertUserAccess(strACSInfo, pAlarmer, successful, fileReason,imageUrl,wd);//数据入库
log.error("人证比对失败=======");
}else if (0x71 == strACSInfo.dwMinor) {
//禁止名单事件
fileReason="禁止名单事件";
insertUserAccess(strACSInfo, pAlarmer, successful, fileReason,imageUrl,wd);//数据入库
// insertUserAccess(strACSInfo, pAlarmer, successful, fileReason,imageUrl,wd);//数据入库
log.error("禁止名单事件=======");
}else if (0x4b == strACSInfo.dwMinor) {
log.error("人脸认证通过=======");
successful = "1";
fileReason = "人脸认证通过";
if (!"0".equals(String.valueOf(strACSInfo.struAcsEventInfo.dwEmployeeNo))) {
// if (!"0".equals(String.valueOf(strACSInfo.struAcsEventInfo.dwEmployeeNo))) {
insertUserAccess(strACSInfo, pAlarmer, successful, fileReason,imageUrl,wd);//数据入库
log.error("strACSInfo:{} ", JSON.toJSON(strACSInfo));
log.error("设备IP :{}", new String(pAlarmer.sDeviceIP).trim());
log.error("人员工号:{}", String.valueOf(strACSInfo.struAcsEventInfo.dwEmployeeNo));
log.error("当前日期:{}", DateTimeHelper.getNowDate());
log.error("当前时间:{}", DateTimeHelper.getNowTime());
}
// }
}
}
}

View File

@ -1052,19 +1052,17 @@ public class HCNetDeviceUtil {
}
jsonSearchCond.put("searchID", DateTimeHelper.getNowTime());
jsonSearchCond.put("searchResultPosition", 0);
jsonSearchCond.put("maxResults", 50);
jsonSearchCond.put("maxResults", 1000);
jsonObject.put("UserInfoSearchCond", jsonSearchCond);
String strInbuff = jsonObject.toString();
System.out.println("查询的json报文:" + strInbuff);
// System.out.println("查询的json报文:" + strInbuff);
//把string传递到Byte数组中后续用.getPointer()方法传入指针地址中
HCNetSDK.BYTE_ARRAY ptrInbuff = new HCNetSDK.BYTE_ARRAY(strInbuff.length());
System.arraycopy(strInbuff.getBytes(), 0, ptrInbuff.byValue, 0, strInbuff.length());
ptrInbuff.write();
//定义接收结果的结构体
HCNetSDK.BYTE_ARRAY ptrOutuff = new HCNetSDK.BYTE_ARRAY(10 * 1024);
IntByReference pInt = new IntByReference(0);
while (true) {

View File

@ -0,0 +1,456 @@
package com.securitycontrol.inter.sdk;
import rk.netDevice.sdk.p2.*;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SwingDemo extends JFrame {
/**
*
*/
private static final long serialVersionUID = -7855826301914463533L;
private JTextField txtPort;
private JScrollPane scrollPane;
private JTextArea textArea;
private JButton btnStart;
private JButton btnStop;
private JCheckBox chkRelay0;
private JCheckBox chkRelay1;
private JCheckBox chkRelay2;
private JCheckBox chkRelay3;
private JCheckBox chkRelay4;
private JCheckBox chkRelay5;
private JCheckBox chkRelay6;
private JCheckBox chkRelay7;
private JButton btnTimming;
private JButton btnCallStore;
private RSServer rsServer;// 定义监听服务对象
private IDataListener listener = new IDataListener() {
@Override
public void receiveTimmingAck(TimmingAck data) {// 校时指令应答处理
textArea.append("校时应答->设备编号:" + data.getDeviceId() + "\t执行结果"
+ data.getStatus() + "\r\n");
}
@Override
public void receiveTelecontrolAck(TelecontrolAck data) {// 遥控指令应答处理
textArea.append("遥控应答->设备编号:" + data.getDeviceId() + "\t继电器编号:"
+ data.getRelayId() + "\t执行结果:" + data.getStatus() + "\r\n");
}
@Override
public void receiveStoreData(StoreData data) {// 已存储数据接收处理
// 遍历节点数据数据包括网络设备的数据以及各个节点数据温湿度数据存放在节点数据中
for (NodeData nd : data.getNodeList()) {
SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
String str = sdf.format(nd.getRecordTime());
textArea.append("存储数据->设备地址:" + data.getDeviceId() + "\t节点:"
+ nd.getNodeId() + "\t温度:" + nd.getTem() + "\t湿度:"
+ nd.getHum() + "\t存储时间:" + str+"\t坐标类型"+nd.getCoordinateType()+"\t经度:"+nd.getLng()+"\t纬度"+nd.getLat() + "\r\n");
}
}
@Override
public void receiveRealtimeData(RealTimeData data) {// 实时数据接收处理
// 遍历节点数据数据包括网络设备的数据以及各个节点数据温湿度数据存放在节点数据中
SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
String time = sdf.format(new Date());
for (NodeData nd : data.getNodeList()) {
textArea.append(time+"\t实时数据->设备地址:" + data.getDeviceId() + "\t节点:"
+ nd.getNodeId() + "\t温度:" + nd.getTem() + "\t湿度:"
+ nd.getHum() + "\t经度" + data.getLng() + "\t纬度"
+ data.getLat() + "\t坐标类型" + data.getCoordinateType()
+ "\t继电器状态" + data.getRelayStatus() + "\t浮点型数据"
+ nd.getFloatValue() + "\t32位有符号数据"
+ nd.getSignedInt32Value() + "\t32位无符号数据"
+ nd.getUnSignedInt32Value() + "\r\n");
}
}
@Override
public void receiveLoginData(LoginData data) {// 登录数据接收处理
textArea.append("登录->设备地址:" + data.getDeviceId() + "\r\n");
}
@Override
public void receiveParamIds(ParamIdsData data) {
String str = "设备参数编号列表->设备编号:" + data.getDeviceId() + "\t参数总数量"
+ data.getTotalCount() + "\t本帧参数数量" + data.getCount()
+ "\r\n";
for (int paramId : data.getPararmIdList())// 遍历设备中参数id编号
{
str += paramId + ",";
}
textArea.append(str + "\r\n");
}
@Override
public void receiveParam(ParamData data) {
String str = "设备参数->设备编号:" + data.getDeviceId() + "\r\n";
for (ParamItem pararm : data.getParameterList()) {
str += "参数编号:"
+ pararm.getParamId()
+ "\t参数描述"
+ pararm.getDescription()
+ "\t参数值"
+ (pararm.getValueDescription() == null ? pararm
.getValue() : pararm.getValueDescription().get(
pararm.getValue())) + "\r\n";
}
textArea.append(str + "\r\n");
}
@Override
public void receiveWriteParamAck(WriteParamAck data) {
String str = "下载设备参数->设备编号:" + data.getDeviceId() + "\t参数数量"
+ data.getCount() + "\t"
+ (data.isSuccess() ? "下载成功" : "下载失败");
textArea.append(str + "\r\n");
}
@Override
public void receiveTransDataAck(TransDataAck data) {
String str = "数据透传->设备编号:" + data.getDeviceId() + "\t响应结果"
+ data.getData() + "\r\n字节数" + data.getTransDataLen();
textArea.append(str + "\r\n");
}
@Override
public void receiveHeartbeatData(HeartbeatData heartbeatData) {
}
};
private JTextField txtDeviceId;
private JTextField txtParamIds;
private JTextField txtParamId;
private JTextField txtParamVal;
private JPanel panel_2;
private JLabel label_4;
private JTextField txtTransData;
private JButton btnTrans;
public SwingDemo() {
setTitle("Demo");
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(653, 710);
setLocationRelativeTo(null);
JLabel lblNewLabel = new JLabel("\u7AEF\u53E3:");
lblNewLabel.setBounds(10, 10, 40, 15);
txtPort = new JTextField();
txtPort.setBounds(45, 7, 66, 21);
txtPort.setText("2404");
txtPort.setColumns(10);
btnStart = new JButton("\u542F\u52A8");
btnStart.setBounds(135, 6, 85, 23);
btnStart.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
btnStart.setEnabled(false);
new Thread(new Runnable() {
@Override
public void run() {
rsServer = RSServer.Initiate(Integer.parseInt(txtPort
.getText()),"C:/param.dat");// 初始化
rsServer.addDataListener(listener);// 添加数据监听事件
try {
rsServer.start();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}// 启动监听服务
}
}).start();
}
});
btnStop = new JButton("\u505C\u6B62");
btnStop.setBounds(237, 6, 85, 23);
btnStop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
btnStart.setEnabled(true);
rsServer.stop();
}
});
scrollPane = new JScrollPane();
scrollPane.setBounds(10, 400, 624, 275);
textArea = new JTextArea();
scrollPane.setViewportView(textArea);
JLabel label = new JLabel("\u8BBE\u5907\u5730\u5740:");
label.setBounds(10, 48, 66, 15);
txtDeviceId = new JTextField();
txtDeviceId.setBounds(75, 45, 84, 21);
txtDeviceId.setText("10000000");
txtDeviceId.setColumns(10);
btnTimming = new JButton("\u6821\u65F6");
btnTimming.setBounds(336, 6, 85, 23);
btnTimming.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int deviceId = Integer.parseInt(txtDeviceId.getText());
rsServer.timming(deviceId);
}
});
btnCallStore = new JButton("\u53EC\u5524\u6570\u636E");
btnCallStore.setBounds(428, 6, 90, 23);
btnCallStore.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int deviceId = Integer.parseInt(txtDeviceId.getText());
rsServer.callStoreData(deviceId);
}
});
JPanel panel = new JPanel();
panel.setBounds(10, 84, 624, 57);
panel.setBorder(new TitledBorder(null,
"\u7EE7\u7535\u5668\u63A7\u5236", TitledBorder.LEADING,
TitledBorder.TOP, null, null));
JPanel panel_1 = new JPanel();
panel_1.setBounds(10, 147, 624, 112);
panel_1.setBorder(new TitledBorder(null, "\u8BBE\u5907\u53C2\u6570",
TitledBorder.LEADING, TitledBorder.TOP, null, null));
panel_2 = new JPanel();
panel_2.setBounds(10, 269, 624, 113);
panel_2.setBorder(new TitledBorder(null, "\u6570\u636E\u900F\u4F20",
TitledBorder.LEADING, TitledBorder.TOP, null, null));
panel_2.setLayout(null);
label_4 = new JLabel(
"\u900F\u4F20\u6570\u636E\uFF0C16\u8FDB\u5236\u5B57\u7B26\u4E32");
label_4.setBounds(10, 23, 419, 15);
panel_2.add(label_4);
txtTransData = new JTextField();
txtTransData.setBounds(10, 48, 604, 21);
panel_2.add(txtTransData);
txtTransData.setColumns(10);
btnTrans = new JButton("\u6570\u636E\u900F\u4F20");
btnTrans.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int deviceId = Integer.parseInt(txtDeviceId.getText());
rsServer.trans(deviceId, txtTransData.getText());
}
});
btnTrans.setBounds(10, 79, 93, 23);
panel_2.add(btnTrans);
panel_1.setLayout(null);
JLabel label_1 = new JLabel(
"\u53C2\u6570\u7F16\u53F7\uFF0C\u7528\u4E8E\u8BFB\u53D6\u8BBE\u5907\u53C2\u6570\uFF08\u591A\u4E2A\u7F16\u53F7\u7528\u82F1\u6587,\u5206\u9694\uFF09");
label_1.setBounds(10, 22, 421, 15);
panel_1.add(label_1);
txtParamIds = new JTextField();
txtParamIds.setText("1,2,3,4,5,6,7,8,9,10");
txtParamIds.setBounds(10, 47, 421, 21);
panel_1.add(txtParamIds);
txtParamIds.setColumns(10);
JLabel label_2 = new JLabel("\u53C2\u6570\u7F16\u53F7");
label_2.setBounds(10, 78, 54, 15);
panel_1.add(label_2);
txtParamId = new JTextField();
txtParamId.setBounds(68, 75, 66, 21);
panel_1.add(txtParamId);
txtParamId.setColumns(10);
JLabel label_3 = new JLabel("\u53C2\u6570\u503C");
label_3.setBounds(144, 78, 54, 15);
panel_1.add(label_3);
txtParamVal = new JTextField();
txtParamVal.setBounds(202, 75, 66, 21);
panel_1.add(txtParamVal);
txtParamVal.setColumns(10);
JButton btnReadParametersList = new JButton(
"\u8BFB\u53D6\u8BBE\u5907\u53C2\u6570\u5217\u8868");
btnReadParametersList.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int deviceId = Integer.parseInt(txtDeviceId.getText());
rsServer.callParamList(deviceId);// 发送召唤设备参数列表指令
}
});
btnReadParametersList.setBounds(460, 18, 142, 23);
panel_1.add(btnReadParametersList);
JButton btnReadParameters = new JButton(
"\u8BFB\u53D6\u8BBE\u5907\u53C2\u6570");
btnReadParameters.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int deviceId = Integer.parseInt(txtDeviceId.getText());
List<Integer> ids = new ArrayList<Integer>();
String[] idArray = txtParamIds.getText().split(",");
for (String str : idArray) {
try {
ids.add(Integer.parseInt(str));
} catch (Exception e) {
}
}
if (ids.size() >= 115) {
JOptionPane.showMessageDialog(null, "一次读取参数数量不能超过115个",
"提示", JOptionPane.INFORMATION_MESSAGE);
return;
}
rsServer.callParam(deviceId, ids);
}
});
btnReadParameters.setBounds(460, 46, 142, 23);
panel_1.add(btnReadParameters);
JButton btnWriteParameters = new JButton(
"\u4E0B\u8F7D\u8BBE\u5907\u53C2\u6570");
btnWriteParameters.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int deviceId = Integer.parseInt(txtDeviceId.getText());
List<ParamItem> parameters = new ArrayList<ParamItem>();
try {
parameters.add(ParamItem.New(
Integer.parseInt(txtParamId.getText()),
txtParamVal.getText()));
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex.getMessage(), "提示",
JOptionPane.INFORMATION_MESSAGE);
return;
}
if (parameters.size() > 115) {
JOptionPane.showMessageDialog(null, "一次性下发参数数量不能超过115个",
"提示", JOptionPane.INFORMATION_MESSAGE);
return;
}
rsServer.writeParam(deviceId, parameters);
}
});
btnWriteParameters.setBounds(460, 74, 142, 23);
panel_1.add(btnWriteParameters);
chkRelay0 = new JCheckBox("\u7EE7\u7535\u56680");
panel.add(chkRelay0);
chkRelay1 = new JCheckBox("\u7EE7\u7535\u56681");
panel.add(chkRelay1);
chkRelay2 = new JCheckBox("\u7EE7\u7535\u56682");
panel.add(chkRelay2);
chkRelay3 = new JCheckBox("\u7EE7\u7535\u56683");
panel.add(chkRelay3);
chkRelay4 = new JCheckBox("\u7EE7\u7535\u56684");
panel.add(chkRelay4);
chkRelay5 = new JCheckBox("\u7EE7\u7535\u56685");
panel.add(chkRelay5);
chkRelay6 = new JCheckBox("\u7EE7\u7535\u56686");
panel.add(chkRelay6);
chkRelay7 = new JCheckBox("\u7EE7\u7535\u56687");
panel.add(chkRelay7);
chkRelay7.addItemListener(new ChkItemListener(7));
chkRelay6.addItemListener(new ChkItemListener(6));
chkRelay5.addItemListener(new ChkItemListener(5));
chkRelay4.addItemListener(new ChkItemListener(4));
chkRelay3.addItemListener(new ChkItemListener(3));
chkRelay2.addItemListener(new ChkItemListener(2));
chkRelay1.addItemListener(new ChkItemListener(1));
chkRelay0.addItemListener(new ChkItemListener(0));
getContentPane().setLayout(null);
getContentPane().add(txtPort);
getContentPane().add(lblNewLabel);
getContentPane().add(btnStart);
getContentPane().add(btnStop);
getContentPane().add(btnTimming);
getContentPane().add(btnCallStore);
getContentPane().add(txtDeviceId);
getContentPane().add(label);
getContentPane().add(panel_1);
getContentPane().add(panel);
getContentPane().add(panel_2);
getContentPane().add(scrollPane);
}
class ChkItemListener implements ItemListener {
private int relayId = 0;
public ChkItemListener(int relayId) {
this.relayId = relayId;
}
@Override
public void itemStateChanged(ItemEvent e) {
JCheckBox jcb = (JCheckBox) e.getItem();
int deviceId = Integer.parseInt(txtDeviceId.getText());
if (jcb.isSelected()) {
try {
rsServer.telecontrol(deviceId, relayId, 0, 0);
} catch (Exception e1) {
e1.printStackTrace();
}
} else {
try {
rsServer.telecontrol(deviceId, relayId, 1, 0);
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
}
public static void main(String[] args) {
new SwingDemo().setVisible(true);
}
}

View File

@ -67,6 +67,7 @@ public class DataCenterDataService {
map.put("type",type);
map.put("page",page+"");
map.put("limit",limit+"");
map.put("limit",limit+"");
String param="type="+type+"&page="+page+"&limit="+limit+"&token="+token;
if(StringHelper.isNotEmpty(startTime)){
String times="&createStartTime="+startTime+"&createEndTime="+ DateTimeHelper.getNowDate();

View File

@ -91,6 +91,8 @@ public class HkUserInfoController extends BaseController {
}
}
/**
* 人员进出记录及在线人员
* @param dto
@ -128,7 +130,10 @@ public class HkUserInfoController extends BaseController {
"}";
}
@PostMapping("updateWorkContent")
public Result<String> updateWorkContent(@RequestBody HkInfoVo dto) {
return service.updateWorkContent(dto);
}

View File

@ -4,6 +4,7 @@ import com.securitycontrol.entity.screen.dto.AlarmMgeDto;
import com.securitycontrol.entity.screen.jj.CameraImageVo;
import com.securitycontrol.entity.screen.jj.HkAccessUserVo;
import com.securitycontrol.entity.screen.jj.HkInfoVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -53,4 +54,19 @@ public interface HkUserInfoMapper {
* @return
*/
int updateImage(CameraImageVo dto);
/**
* 查询最近两条数据
* @return
*/
List<HkInfoVo> getClassList();
void updateWorkInfo(@Param("param") HkInfoVo hkInfoVo,@Param("type") String number);
/**
* 更新工种内容
* @param hkInfoVo
* @param number
*/
void updateWorkContent(@Param("param") HkInfoVo hkInfoVo,@Param("id") String id,@Param("type") String number);
}

View File

@ -52,4 +52,11 @@ public interface HkUserInfoService {
* @return
*/
Result<String> updateImage(CameraImageVo dto);
/**
* 修改工种内容
* @param dto
* @return
*/
Result<String> updateWorkContent(HkInfoVo dto);
}

View File

@ -5,6 +5,7 @@ import com.securitycontrol.common.core.domain.Result;
import com.securitycontrol.common.core.utils.ImageUtil;
import com.securitycontrol.common.core.utils.UUIDUtils;
import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
import com.securitycontrol.common.core.utils.aes.ListHelper;
import com.securitycontrol.common.core.utils.aes.StringHelper;
import com.securitycontrol.entity.screen.dto.AlarmMgeDto;
import com.securitycontrol.entity.screen.jj.CameraImageVo;
@ -20,6 +21,7 @@ import springfox.documentation.spring.web.json.Json;
import java.io.File;
import java.util.List;
import java.util.concurrent.ExecutionException;
/**
* @author 黑子
@ -43,7 +45,10 @@ public class HkUserInfoServiceImpl implements HkUserInfoService {
List<HkInfoVo> list=mapper.getTodayMetting(dto);
for (HkInfoVo vo:list){
HkInfoVo hisWorkContent=mapper.hisWorkContent(vo);
vo.setYWorkContent(hisWorkContent.getWorkType()+";"+hisWorkContent.getWorkGx()+";"+hisWorkContent.getWorkContent());
if(hisWorkContent!=null){
vo.setYWorkContent(hisWorkContent.getWorkContent());
}
}
return Result.ok(list,"查询成功");
}catch (Exception e){
@ -152,4 +157,26 @@ public class HkUserInfoServiceImpl implements HkUserInfoService {
}
return Result.fail("处理失败");
}
/**
* 修改工种内容
* @param dto
* @return
*/
@Override
public Result<String> updateWorkContent(HkInfoVo dto) {
try{
List<HkInfoVo> list=mapper.getClassList();
if(ListHelper.isNotEmpty(list) && list.size()==2){
mapper.updateWorkInfo(list.get(0),"1");
mapper.updateWorkInfo(list.get(1),"2");
mapper.updateWorkContent(dto,list.get(0).getId(),"1");
mapper.updateWorkContent(dto,list.get(1).getId(),"2");
}
return Result.ok("修改成功","修改成功");
}catch (Exception e){
log.error(e.toString(),e);
}
return Result.fail("修改失败");
}
}

View File

@ -11,6 +11,29 @@
update hk_camera_image set is_sure=#{isSure},remark=#{remark}
where id=#{id}
</update>
<update id="updateWorkInfo">
update jj_class_meetting set
<if test='type==1 or type=="1"'>
current_constr_date=CURRENT_DATE
</if>
<if test='type==2 or type=="2"'>
current_constr_date=SUBDATE(CURRENT_DATE(), 1)
</if>
where id=#{param.id}
</update>
<update id="updateWorkContent">
update jj_class_metting_info set
<if test='type==1 or type=="1"'>
work_content=#{param.workContent},main_risk=#{param.mainRisk}
</if>
<if test='type==2 or type=="2"'>
work_content=#{param.yWorkContent}
</if>
where class_id=#{id}
</update>
<select id="getTodayMetting" resultType="com.securitycontrol.entity.screen.jj.HkInfoVo">
select jcm.id ,jcmi.main_risk mainRisk,jcmi.work_gx workGx,jcmi.work_type workType,jcmi.work_content workContent,
@ -29,7 +52,7 @@
jcmi.work_manage_num=#{idCard} and jcm.current_constr_date = DATE(NOW() - INTERVAL 1 DAY)
</select>
<select id="getUserInfo" resultType="com.securitycontrol.entity.screen.jj.HkAccessUserVo">
select hua.user_code userCode,hua.user_name userName ,hua.access_time accessTime,hua.access_type accessType ,hua.access_image image
select hua.id, hua.user_code userCode,IFNULL(hua.user_name,'未知人员') userName ,hua.access_time accessTime,hua.access_type accessType ,hua.access_image image
from hk_user_access hua
left join (
select max(id) id
@ -41,9 +64,10 @@
<if test="userName!=null and userName!=''">
and hua.user_name like concat('%',#{userName},'%')
</if>
ORDER BY hua.id desc
</select>
<select id="getUserInfoDetails" resultType="com.securitycontrol.entity.screen.jj.HkAccessUserVo">
select user_name userName,access_time accessTime,access_type accessType,ip,access_image image
select IFNULL(user_name,'未知人员') userName,access_time accessTime,access_type accessType,ip,access_image image
from hk_user_access
where 1=1
<if test="userName!=null and userName!=''">
@ -55,10 +79,18 @@
<select id="getCameraImage" resultType="com.securitycontrol.entity.screen.jj.CameraImageVo">
select hi.id,hi.create_time createTime,image,hi.is_sure isSure,hi.remark
FROM hk_camera_image hi
left join jj_class_meetting jcm on hi.create_date=jcm.current_constr_date and jcm.single_project_code='1612P021000T01'
left join jj_class_meetting jcm on hi.create_date=jcm.current_constr_date and jcm.single_project_code='1612P021000T01' and jcm.delete_flag=0
where jcm.id is null
<if test="startTime!=null and startTime!=''">
and hi.create_date between #{startTime} and #{endTime}
</if>
ORDER BY hi.id desc
</select>
<select id="getClassList" resultType="com.securitycontrol.entity.screen.jj.HkInfoVo">
select id,current_constr_date
from jj_class_meetting jcm
where jcm.single_project_code='1612P021000T01' and jcm.delete_flag=0
ORDER BY current_constr_date desc
limit 2
</select>
</mapper>