1
81041
2019-06-20 ab3c4acf83f54f8449ca8664c4a2bb79bd30f297
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package com.fgkj.actions;
 
import com.fgkj.dao.UinfDaoFactory;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Batt_Maint_Dealarm;
import com.fgkj.dto.Batt_attention;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_inf;
import com.fgkj.dto.User_log;
import com.fgkj.services.Batt_attentionService;
import com.fgkj.services.User_logService;
 
public class Batt_attentionAction extends ActionUtil{
    private Batt_attentionService service = new Batt_attentionService();
    private User_logService uservice=new User_logService();
    private String json;
    private String result;
    
    //添加关注
    public String add() {
        Batt_attention attention = getGson().fromJson(json, Batt_attention.class);
        User_inf uinf = (User_inf)getUser();
        attention.setUid(uinf.getUId());
        ServiceModel model = service.add(attention);
        {
            String msg="添加对"+attention.getBattGroupId()+"电池组的"+attention.getMonNum()+"单体的关注";
            User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg);
            uservice.add(ulog);//将用户的操作记录下来
        }
        result = tojson(model);
        return SUCCESS;
 
    }
 
    public String update() {
        Batt_attention attention = getGson().fromJson(json, Batt_attention.class);
        ServiceModel model = service.update(attention);
        result = tojson(model);
        return SUCCESS;
    }
    
    //取消关注
    public String delete() {
        Batt_attention attention = getGson().fromJson(json, Batt_attention.class);
        User_inf uinf = (User_inf)getUser();
        attention.setUid(uinf.getUId());
        ServiceModel model = service.delete(attention);
        {
            String msg="取消对"+attention.getBattGroupId()+"电池组的"+attention.getMonNum()+"号单体的关注";
            User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Delete, msg);
            uservice.add(ulog);//将用户的操作记录下来
        }
        result = tojson(model);
        return SUCCESS;
    }
    
    //根据电池组的筛选条件,查询单体的实际电压
    public String serchByCondition() {
        Batt_Maint_Dealarm bmd = getGson().fromJson(json, Batt_Maint_Dealarm.class);
        User_inf uinf = (User_inf)getUser();
        bmd.getBinf().setNum(uinf.getUId());
        ServiceModel model = service.serchByCondition(bmd);
        result = tojson(model);
        return SUCCESS;
    }
     //关注之前识别是否关注过
    public String judgeInOrNot() {
        Batt_attention attention = getGson().fromJson(json, Batt_attention.class);
        User_inf uinf = (User_inf)getUser();
        attention.setUid(uinf.getUId());
        ServiceModel model = service.judgeInOrNot(attention);
        result = tojson(model);
        return SUCCESS;
    }
 
    public String getResult() {
        return result;
    }
 
    public void setJson(String json) {
        this.json = json;
    }
    
    
}