设备人数bug修复
This commit is contained in:
parent
35554aa6cc
commit
cc565109bf
@ -84,6 +84,9 @@ public class APIController {
|
||||
side = false;
|
||||
}
|
||||
String data = IdCardUtils.getIdCardInfo(MapUtils.getString(map, "imageUrl"), side);
|
||||
if (data == null) {
|
||||
return Result.ok();
|
||||
}
|
||||
JSONObject object = JSONUtil.parseObj(data);
|
||||
if (object.containsKey("result")) {
|
||||
result.setResult(object.get("result"));
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
</select>
|
||||
<select id="selectProjectEnvironmentDevList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
|
||||
select *,(case when round((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(real_time))/60) <=10 then 1 else 2 end) dev_online
|
||||
select *,(case when round((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(real_time))/60) <=10 then 1 else 0 end) devonline
|
||||
from environment_dev
|
||||
where project_sn=#{projectSn}
|
||||
</select>
|
||||
|
||||
@ -207,7 +207,7 @@ public class EnvironmentDevServiceImpl extends ServiceImpl<EnvironmentDevMapper,
|
||||
//查询报警数
|
||||
List<Map<String, Object>> alarmList=environmentAlarmMapper.selectEnvironmentDevTodayAlarmCount(map);
|
||||
for(EntityMap dev:devList){
|
||||
if("1".equals(MapUtils.getString(dev,"devOnline"))){
|
||||
if("1".equals(MapUtils.getString(dev,"devonline"))){
|
||||
totalDevOnlineNum++;
|
||||
}
|
||||
//取出报警次数
|
||||
|
||||
@ -25,6 +25,15 @@ public class IdCardUtils {
|
||||
private static String password;
|
||||
private static String projectid;
|
||||
private static String endpoint;
|
||||
/**
|
||||
* 是否启用华为云账号功能
|
||||
*/
|
||||
private static Boolean enable;
|
||||
|
||||
@Value("${hw-ocr-enable}")
|
||||
public void setEnable(Boolean enable) {
|
||||
IdCardUtils.enable = enable;
|
||||
}
|
||||
|
||||
@Value("${hw-ocr-username}")
|
||||
public void setUsername(String hwusername) {
|
||||
@ -51,6 +60,7 @@ public class IdCardUtils {
|
||||
endpoint = hwendpoint;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 识别身份证信息
|
||||
*
|
||||
@ -60,7 +70,7 @@ public class IdCardUtils {
|
||||
* 注意事项:此处申请华为云必须在华为云上海一区开通身份证识别功能,然后拷贝项目ID到此处进行识别
|
||||
*/
|
||||
public static String getIdCardInfo(String imageurl, boolean side) {
|
||||
|
||||
if (enable) {
|
||||
// String JSONSTR = "{ \n \"auth\": { \n \"identity\": { \n \"methods\": [ \n \"password\" \n ], \n \"password\": { \n \"user\": { \n\"name\": \"" + username + "\", \n \"password\": \"" + password + "\", \n \"domain\": { \n \"name\": \"" + domainname + "\" \n } \n } \n} \n}, \n\"scope\": { \n \"project\": { \n\"name\": \"cn-east-3\" \n} \n} \n} \n}";
|
||||
// String token = HttpRequest.post(tokenurl).body(String.valueOf(JSONUtil.parse(JSONSTR))).execute().header("X-Subject-Token");
|
||||
// String url = "https://ocr.cn-east-3.myhuaweicloud.com/v2/" + projectid + "/ocr/id-card";
|
||||
@ -74,24 +84,26 @@ public class IdCardUtils {
|
||||
|
||||
// String tokenurl = "https://iam.cn-east-3.myhuaweicloud.com/v3/auth/tokens";
|
||||
// String JSONSTR = "{ \n \"auth\": { \n \"identity\": { \n \"methods\": [ \n \"password\" \n ], \n \"password\": { \n \"user\": { \n\"name\": \"" + username + "\", \n \"password\": \"" + password + "\", \n \"domain\": { \n \"name\": \"" + username + "\" \n } \n } \n} \n}, \n\"scope\": { \n \"project\": { \n\"name\": \"cn-east-3\" \n} \n} \n} \n}";
|
||||
//获取token
|
||||
String tokenUrl = "https://iam." + endpoint + ".myhuaweicloud.com/v3/auth/tokens";
|
||||
String JSONSTR = getTokenStr(domainname, username, password, endpoint);
|
||||
String tokenBody = JSONUtil.toJsonStr(JSONSTR);
|
||||
log.info("token_url:{},body:{}", tokenUrl, tokenBody);
|
||||
String token = HttpRequest.post(tokenUrl).body(tokenBody).execute().header("x-subject-token");
|
||||
log.info("response-token:{}", token);
|
||||
//获取token
|
||||
String tokenUrl = "https://iam." + endpoint + ".myhuaweicloud.com/v3/auth/tokens";
|
||||
String JSONSTR = getTokenStr(domainname, username, password, endpoint);
|
||||
String tokenBody = JSONUtil.toJsonStr(JSONSTR);
|
||||
log.info("token_url:{},body:{}", tokenUrl, tokenBody);
|
||||
String token = HttpRequest.post(tokenUrl).body(tokenBody).execute().header("x-subject-token");
|
||||
log.info("response-token:{}", token);
|
||||
|
||||
//获取身份证信息
|
||||
String cardUrl = "https://ocr." + endpoint + ".myhuaweicloud.com/v2/" + projectid + "/ocr/id-card";
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("url", imageurl);
|
||||
param.put("side", side ? "front" : "back");
|
||||
String cardBoday = JSONUtil.toJsonStr(param);
|
||||
log.info("token_url:{},body:{}", cardUrl, cardBoday);
|
||||
String result = HttpRequest.post(cardUrl).header("x-auth-token", token).body(cardBoday).execute().body();
|
||||
log.info(result);
|
||||
return result;
|
||||
//获取身份证信息
|
||||
String cardUrl = "https://ocr." + endpoint + ".myhuaweicloud.com/v2/" + projectid + "/ocr/id-card";
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("url", imageurl);
|
||||
param.put("side", side ? "front" : "back");
|
||||
String cardBoday = JSONUtil.toJsonStr(param);
|
||||
log.info("token_url:{},body:{}", cardUrl, cardBoday);
|
||||
String result = HttpRequest.post(cardUrl).header("x-auth-token", token).body(cardBoday).execute().body();
|
||||
log.info(result);
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getTokenStr(String domainname, String username, String passwrd, String endpoint) {
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
#http.port=30250
|
||||
http.port=18070
|
||||
http.port=21323
|
||||
#spring.datasource.url=jdbc:mysql://124.71.178.44:3306/wisdomsite_lgdc?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true
|
||||
#spring.datasource.url=jdbc:mysql://183.60.227.61:20246/wisdomsite?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&serverTimezone=UTC
|
||||
#spring.datasource.url=jdbc:mysql://36.137.53.203:3306/wisdomsite?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true
|
||||
#spring.datasource.url=jdbc:mysql://139.9.66.234:3386/wisdomsite_ty?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true
|
||||
#spring.datasource.url=jdbc:mysql://182.90.224.237:3306/wisdomsite?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
#spring.datasource.url=jdbc:mysql://139.9.66.234:3306/wisdomsite?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true
|
||||
spring.datasource.url=jdbc:mysql://124.71.67.160:3306/wisdomsite?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/wisdomsite?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
|
||||
spring.datasource.username=ENC(XR4C/hvTYCUqudS49Wh/jA==)
|
||||
#spring.datasource.password=ENC(hHkiHEc6vSWjqfOtg2/2Uiihs0vX3l7V)
|
||||
spring.datasource.password=ENC(hHkiHEc6vSWjqfOtg2/2Uiihs0vX3l7V)
|
||||
server.port=8070
|
||||
spring.datasource.password=ENC(LsKaVL2ycDu+uUNoPndYLA==)
|
||||
server.port=8188
|
||||
#server.port=30246
|
||||
basePath=C:/jxj/prod/backEnd/itbgpImage/
|
||||
server.tomcat.basedir=C:/jxj/prod/backEnd/tempImage/
|
||||
|
||||
@ -86,6 +86,7 @@ hw-ocr-password=jxj27696951
|
||||
hw-ocr-domainname=szjxjzh
|
||||
hw-ocr-projectid=0633b705cc000f3e2f55c010af021eec
|
||||
hw-ocr-endpoint=cn-east-3
|
||||
hw-ocr-enable=false
|
||||
# \u8679\u8F6F\u914D\u7F6E
|
||||
arcsoft.appId=4F9jmKsCYKsQskYBTXK7sQZLH8dFdT7LK5Yjx5XA8gkB
|
||||
arcsoft.sdkKey=FUPhPPfPXrAmFrecmCSiG5BjmHSwp86QogvdCM7g8B5k
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user