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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package com.fgkj.actions;
 
import java.util.List;
 
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.Task_Batt_Test;
import com.fgkj.dto.User_battmaint_check;
import com.fgkj.dto.User_battmaint_check_process;
import com.fgkj.dto.User_inf;
import com.fgkj.services.User_battmaint_checkService;
import com.google.gson.reflect.TypeToken;
import com.opensymphony.xwork2.ActionSupport;
 
public class User_battmaint_checkAction extends ActionSupport{
    private User_battmaint_checkService service=new User_battmaint_checkService();
    private String result;
    private Task_Batt_Test tbt;
    private String json;
    
    //作业抽查(新建抽查作业)
    public String add(){
        User_battmaint_check ubc=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(result, User_battmaint_check.class);
        ServiceModel model=service.add(ubc);
        result=ActionUtil.tojson(model);
        return SUCCESS;
    }
    
    //作业抽查管理(编辑抽查作业)
    public String update(){
        User_battmaint_check ubc=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(result, User_battmaint_check.class);
        System.out.println(ubc);
        ServiceModel model=service.update(ubc);
        result=ActionUtil.tojson(model);
        return SUCCESS;
    }
    
    //4.10作业抽查管理(编辑记录)(user_battmaint_check表修改时User_battmaint_check_process表就新增一条记录)
    public String updatePro() {
        ServiceModel model=new ServiceModel();
        User_battmaint_check ubc=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(result, User_battmaint_check.class);
        List<User_battmaint_check_process> ubcp=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken<List<User_battmaint_check_process>>(){}.getType());
        User_inf user=(User_inf)ActionUtil.getUser();
        if(user!=null){
            for (User_battmaint_check_process user_battmaint_check_process : ubcp) {
                user_battmaint_check_process.setUsr_id(user.getUId());
            }
            model=service.updatePro(ubc, ubcp);
        }
        result=ActionUtil.tojson(model);
        return SUCCESS;
    }
    
    //4.10作业抽查管理
    public String serchByCondition(){
        //System.out.println(tbt);
        tbt = ActionUtil.getGson("yyyy-MM-dd").fromJson(result, Task_Batt_Test.class);
        ServiceModel model=service.serchByCondition(tbt);
        result=ActionUtil.tojson(model);
        return SUCCESS;
    }
    
    //作业抽查(删除记录)
    public String delete(){
        User_battmaint_check ubc=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(result, User_battmaint_check.class);
        ServiceModel model=service.delete(ubc);
        result=ActionUtil.tojson(model);
        return SUCCESS;
    }
    
  //4.10作业抽查管理(删除记录(并且删除操作记录))
    public String deletePro() {
        User_battmaint_check ubc=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(result, User_battmaint_check.class);
        ServiceModel model=service.deletePro(ubc);
        result=ActionUtil.tojson(model);
        return SUCCESS;
    }
    
    public String getResult() {
        return result;
    }
 
 
    public void setResult(String result) {
        this.result = result;
    }
 
 
    public Task_Batt_Test getTbt() {
        return tbt;
    }
 
 
    public void setTbt(Task_Batt_Test tbt) {
        this.tbt = tbt;
    }
 
    public void setJson(String json) {
        this.json = json;
    }  
}