zsh_root
2024-01-02 7b595546af704983dbafcd0d385c8768ddacefc2
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
package BaoWen;
 
import Frame.TcpIpManage;
import Method.BaoWenShow;
import VectroData.ForwardDatas;
import person.person_Dell;
import tag.Tag_Dell;
import tcp.TcpClientOneToMany;
 
public class Dell_Add_Alert_Delete_Person {
 
    /**
     * add_person,[tagid],[name],[sex],[department],[phone],[end]
     * ËµÃ÷
     * 1.    add_person£º°üÍ·
     * 2.    [tagid]£º±êÇ©id´¿Êý×Ö,²»ÄÜΪ¿Õ
     * 3.    [name]£ºÐÕÃû
     * 4.    [sex] £ºÐÔ±ð
     * 5.    [department] £º²¿ÃÅ
     * 6.    [phone] £ºµç»°
     * 7.    [end] £º½áÊø±êÖ¾
     * Ìí¼Ó³É¹¦·µ»Ø
     * add_person_success_tagid
     * Ìí¼Óʧ°Ü·µ»Ø
     * add_person_failure*/
 
    public static void add_person(String message) {
 
        StringBuffer tip=new StringBuffer("add_person_");
        String[]  info=message.split(",");
        if(info.length ==7) {
 
            String tagid=info[1];
            String name=info[2];
            String sex=info[3];
            String department=info[4];
            String phone=info[5];
            if(Tag_Dell.get_tag(tagid) !=null) {
                tip.append("failure");
            }else {
                Tag_Dell.addtag_person_excel_into(tagid, name, department, sex, phone);
                tip.append("success_"+tagid);
            }
 
        }else {
            tip.append("failure");
        }
        UdpOrTco_out(tip.toString());
        tip.setLength(0);
        info=null;
 
    }
 
    /**
     * 23.    ÐÞ¸ÄÒ»¸öÈËÔ±ÐÅÏ¢alert_person
     * alert_person,[tagid],[name],[sex],[department],[phone],[end]
     * ËµÃ÷
     * 1.    alert_person£º°üÍ·
     * 2.    [tagid]£º±êÇ©id´¿Êý×Ö,²»ÄÜΪ¿Õ
     * 3.    [name]£ºÐÕÃû
     * 4.    [sex] £ºÐÔ±ð
     * 5.    [department] £º²¿ÃÅ
     * 6.    [phone] £ºµç»°
     * 7.    [end] £º½áÊø±êÖ¾
     * Ìí¼Ó³É¹¦·µ»Ø
     * alert_person_success_tagid
     * Ìí¼Óʧ°Ü·µ»Ø
     * alert_person_failure_tagid**/
 
 
    public static void alert_person(String message) {
        StringBuffer tip=new StringBuffer("alert_person_");
        String[]  info=message.split(",");
        if(info.length ==7) {
 
            String tagid=info[1];
            String name=info[2];
            String sex=info[3];
            String department=info[4];
            String phone=info[5];
            if(Tag_Dell.get_tag(tagid) ==null) {
                tip.append("failure");
            }else {
                Tag_Dell.alert_tag_name(tagid, name);
                person_Dell.alert3_person_tb_person(name, tagid, sex, phone, department);
                tip.append("success_"+tagid);
            }
 
        }else {
            tip.append("failure");
        }
        UdpOrTco_out(tip.toString());
        tip.setLength(0);
        info=null;
 
    }
 
    /**
     * 24.    É¾³ýÒ»¸öÈËÔ±ÐÅÏ¢delete_person
     * delete_person,[tagid],[end]
     * ËµÃ÷
     * 1.    delete_person£º°üÍ·
     * 2.    [tagid]£º±êÇ©id´¿Êý×Ö,²»ÄÜΪ¿Õ
     * 3.    Ìí¼Ó³É¹¦·µ»Ø
     * delete_person_success_tagid
     * Ìí¼Óʧ°Ü·µ»Ø
     * delete_person_failure * **/
 
    public static void delete_person(String message) {
        StringBuffer tip=new StringBuffer("delete_person_");
        String[]  info=message.split(",");
        if(info.length ==3) {
            String tagid=info[1];
            if(Tag_Dell.get_tag(tagid) ==null) {
                tip.append("failure");
            }else {
                Tag_Dell.alert_tag_name(tagid, "δ°ó¶¨");
                person_Dell.remove_person_and_database(tagid);
                tip.append("success_"+tagid);
            }
 
        }else {
            tip.append("failure");
        }
        UdpOrTco_out(tip.toString());
        tip.setLength(0);
        info=null;
    }
 
 
    /**TCP»òÕßUDP½«ÐÅϢת·¢×ß*/
    public static void UdpOrTco_out(String info) {
        int lenth=info.toString().getBytes().length;
 
        /**Èç¹û´æÔÚÐèÒªUDPת·¢Î»ÖÃÐÅÏ¢**/
        if(ForwardDatas.get_mou_tb_forword("UDP").size() !=0) {
            Udp_Out.zhuanfa_all_udp_data(info.toString().getBytes(), lenth);
 
            //ÏÔʾUDPת·¢µÄÊý¾Ý
            if(TcpIpManage.getStar()&& TcpIpManage.getDatatypeis().equals("UDPת·¢")) {
                //ÏÔʾUDPת·¢µÄÊý¾Ý
                BaoWenShow.show(info.toString(), "UDPת·¢","Ñ¡Ôñ±êÇ©");
            }
        }
 
        /**Èç¹û´æÔÚÐèÒªTCPת·¢Î»ÖÃÐÅÏ¢**/
        if(ForwardDatas.get_mou_tb_forword("TCP").size() !=0) {
            TcpClientOneToMany.send(info.toString());
        }
    }
 
}