P15GEN2\59518
2024-05-29 d4210c7c4b04abde20037ea8aa0f54ef8a2649aa
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package grand;
 
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
 
import javax.servlet.http.HttpServletRequest;
 
import foundation.action.ActionProvider;
import foundation.dao.Filter;
import foundation.data.object.DataObject;
 
public class TestTool extends ActionProvider {
    
    @Override
    protected void publishMethod() {
        //1. 初始化审批流
        addMethod("clearApproveFlows");    
        
        //2. 初始化经销商相关数据
        addMethod("clearDealerWorkings");
        
        //3. 获取请求数据
        addMethod("echo");
    }
    
    public void clearApproveFlows() throws Exception {
        DataObject dataObject;
        
        //1. main
        dataObject = DataObject.getInstance("sys_state_working_main");
        dataObject.emptyTable();
        
        //2. step
        dataObject = DataObject.getInstance("sys_state_working_step");
        dataObject.emptyTable();
        
        //3. user
        dataObject = DataObject.getInstance("sys_state_working_user");
        dataObject.emptyTable();
        
        //4. history
        dataObject = DataObject.getInstance("sys_state_working_history");
        dataObject.emptyTable();
    }
    
    
    public void clearDealerWorkings() throws Exception {
        DataObject dataObject;
        
        List<String> tables = new ArrayList<String>();
        tables.add("md_org_account");
        tables.add("md_org_account_change");
        tables.add("md_org_account_change_reason");
        tables.add("md_org_account_employee");
        tables.add("md_org_account_position");
        tables.add("md_org_account_product");
        tables.add("md_org_account_province");
        tables.add("md_org_account_version");
        tables.add("md_org_file_index");
        tables.add("md_org_register");
        tables.add("md_org_shipto");
        tables.add("md_org_shipto_file");
        tables.add("md_target_dealer");
        tables.add("md_target_dealer_version");
        tables.add("agm_agreement");    
        tables.add("agm_agreement_file");    
        tables.add("agm_authorization");    
        tables.add("agm_authorization_product");    
        tables.add("agm_authorization_province");    
        tables.add("agm_record");    
        tables.add("agm_record_product");    
        tables.add("agm_record_province");    
        tables.add("md_org_account_hospital");
        tables.add("md_org_account_hospital_apply");
        tables.add("md_org_account_hospital_product");
        tables.add("md_org_account_hospital_version");
        
        for (String table: tables) {
            dataObject = DataObject.getInstance(table);
            dataObject.emptyTable();
            
        }
        
        dataObject = DataObject.getInstance("md_prod_price_detail");
        dataObject.deleteEntitySet(new Filter("account_id is not null"));
    }
 
    public void echo() throws Exception {
        HttpServletRequest request = dataReader.getRequest();
        
        //1.
        System.out.println("Header-----------------");
        Enumeration<String> names = request.getHeaderNames();
        
        while (names.hasMoreElements()) {
            String name = names.nextElement();
            System.out.println(name + "=" + request.getHeader(name));
        }
        
        //2.
        System.out.println("Parameter-----------------");
        names = request.getParameterNames();
        
        while (names.hasMoreElements()) {
            String name = names.nextElement();
            System.out.println(name + "=" + request.getParameter(name));
        }        
        
        //3. 
        System.out.println("body-----------------");
        String body = dataReader.getBody();
        System.out.println(body);
    }
    
}