地质所 沉降监测网建设项目
chenhuan
2024-05-16 0fdd42e318f51f9e3c6581473416af1cca69877f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.javaweb.third.baidu.bean.imgCensor;
 
 
import com.alibaba.fastjson.JSONObject;
import com.javaweb.third.baidu.bean.BaseResult;
 
/**
 * 恶心判定结果
 * @author wujiyue
 */
public class DisgustResult extends BaseResult {
 
    private Double result;
    private boolean isDisgust;
    public DisgustResult(String json){
        this.setJson(json);
        try{
            JSONObject jsonObject= JSONObject.parseObject(json);
            String e_code=String.valueOf(jsonObject.get("error_code"));
            if(notNull(e_code)){
                this.setError_code(e_code);
                String e_msg=String.valueOf(jsonObject.get("error_msg"));
                this.setError_msg(e_msg);
                this.setRequestOk(false);
            }else {
                this.setRequestOk(true);
                this.setLog_id(jsonObject.getString("log_id"));
                this.result=jsonObject.getDouble("result");
                if(this.result>0.5f){
                    this.isDisgust=true;
                }else{
                    this.isDisgust=false;
                }
 
            }
        }catch (Exception ex){
            ex.printStackTrace();
            this.setRequestOk(false);
            this.setError_msg("解析json字符串出现异常!");
        }
    }
 
    @Override
    public String toString() {
        return "DisgustResult{" +
                "result=" + result +
                ", isDisgust=" + isDisgust +
                '}';
    }
 
    public static DisgustResult create(String jsonStr) {
        return new DisgustResult(jsonStr);
    }
}