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());
|
}
|
}
|
|
}
|