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
package com.fgkj.actions;
 
import java.util.List;
 
import com.fgkj.dao.UinfDaoFactory;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Batt_replace;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_inf;
import com.fgkj.dto.User_log;
import com.fgkj.services.Batt_replaceService;
import com.fgkj.services.User_logService;
import com.google.gson.reflect.TypeToken;
 
public class Batt_replaceAction extends ActionUtil{
    private Batt_replaceService service=new Batt_replaceService();
    private User_logService uservice=new User_logService();
    private String json;
    private String result;
    
    //添加机房电池更改记录
    public String add() {
        Batt_replace re=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Batt_replace.class);
        User_inf uinf=(User_inf) getUser();
        re.setReplaced_uid(uinf.getUId());
        ServiceModel model=service.add(re);
        result=tojson(model);
        {
            String msg="添加新机房电池更改记录:"+re.getStationid();
            User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg);
            uservice.add(ulog);//将用户的操作记录下来
        }
        return SUCCESS;
    }
    
    //修改机房电池更改记录
    public String update() {
        Batt_replace re=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Batt_replace.class);
        User_inf uinf=(User_inf) getUser();
        re.setReplaced_uid(uinf.getUId());
        ServiceModel model=service.update(re);
        result=tojson(model);
        {
            String msg="修改"+re.getStationid()+"机房电池更改记录";
            User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg);
            uservice.add(ulog);//将用户的操作记录下来
        }
        return SUCCESS;
    }
    //删除机房电池更改记录(多条)
    public String del() {
        List<Batt_replace> list=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, new TypeToken<List<Batt_replace>>(){}.getType());
        ServiceModel model=service.del(list);
        result=tojson(model);
        return SUCCESS;
    }
    //机房电池更换管理查询
    public String serchByCondition() {
        Batt_replace re=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Batt_replace.class);
        ServiceModel model=service.serchByCondition(re);
        result=tojson(model);
        return SUCCESS;
    }
    public String getResult() {
        return result;
    }
    public void setJson(String json) {
        this.json = json;
    }
    
    
 
}