bug修复
This commit is contained in:
parent
1babfb30d2
commit
aa77916f5f
@ -1,12 +1,14 @@
|
||||
package com.zhgd.xmgl.device.ammeter.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.device.ammeter.service.IAmmeterDeviceService;
|
||||
import com.zhgd.xmgl.device.ammeter.util.AmmeterUtils;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.ammeter.entity.Ammeter;
|
||||
import com.zhgd.xmgl.modules.ammeter.entity.AmmeterSupplierRecord;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -27,7 +29,7 @@ public class QcAmmeterDeviceServiceImpl implements IAmmeterDeviceService {
|
||||
String s = AmmeterUtils.addDevice(ammeter.getAmmeterNo(), ammeter.getAmmeterNo(), "admin", 0, ammeterSupplierRecord.getSupplierProductId(), ammeterSupplierRecord.getMasterKey(), ammeterSupplierRecord.getAppKey(), ammeterSupplierRecord.getAppSecret());
|
||||
if (StringUtils.isNotEmpty(s)) {
|
||||
JSONObject jsonObject = JSON.parseObject(s);
|
||||
if (jsonObject.getInteger("code") == 0) {
|
||||
if (ObjectUtil.equal(jsonObject.getInteger("code"), 0)) {
|
||||
JSONObject result = JSON.parseObject(jsonObject.getString("result"));
|
||||
ammeter.setDeviceId(result.getString("deviceId"));
|
||||
ammeter.setDeviceStatus(result.getInteger("deviceStatus"));
|
||||
|
||||
@ -60,7 +60,7 @@ public class AmmeterUtils {
|
||||
// log.info("=====添加设备接口返回信息resultStr:" + resultStr);
|
||||
// return null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("err:", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -628,6 +628,7 @@ public class AmmeterUtils {
|
||||
log.info("Sign string: " + string);
|
||||
// hmac-sha1编码
|
||||
byte[] bytes = null;
|
||||
if (secret != null) {
|
||||
SecretKey secretKey = new SecretKeySpec(secret.getBytes("utf-8"), "HmacSha1");
|
||||
Mac mac = Mac.getInstance(secretKey.getAlgorithm());
|
||||
mac.init(secretKey);
|
||||
@ -637,6 +638,8 @@ public class AmmeterUtils {
|
||||
// 得到需要提交的signature签名数据
|
||||
return encryptedString;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转化成为16进制字符串
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user