Ejemplo n.º 1
0
        private string GetRoomUserCardXml(RoomUserCardEntity entity, PersonEntity person)
        {
            var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U

            if (entity.Deleted)
            {
                flag = "D";
            }

            var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            xmlBuilder.Append("<Tpp2Fpp>");
            xmlBuilder.Append("<ReqHeader>");
            xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName());
            xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes));
            xmlBuilder.Append("</ReqHeader>");
            xmlBuilder.Append("<ReqBody>");
            xmlBuilder.Append("<personCard>");
            xmlBuilder.AppendFormat("<person_uuid>{0}</person_uuid>", person.PersonUUID);
            xmlBuilder.AppendFormat("<crk_uuid>{0}</crk_uuid>", entity.CardUUID);
            xmlBuilder.AppendFormat("<cuser>{0}</cuser>", Constant.LkbAccount);
            xmlBuilder.AppendFormat("<cdate>{0}</cdate>", entity.CreateTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<udate>{0}</udate>", entity.UpdateTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<idcard>{0}</idcard>", DESHelper.Encrypt3Des(person.IDCardNo, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<flag>{0}</flag>", flag);
            xmlBuilder.Append("</personCard>");
            xmlBuilder.Append("</ReqBody> ");
            xmlBuilder.Append("</Tpp2Fpp> ");
            return(xmlBuilder.ToString());
        }
Ejemplo n.º 2
0
        private string GetXml(PersonEntity entity)
        {
            var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U

            if (entity.Deleted)
            {
                flag = "D";
            }

            var SexDict            = _dictRepository.GetById(entity.Sex);
            var nationDict         = _dictRepository.GetById(entity.Nation);
            var IDDocumentTypeDict = entity.IDDocumentType.HasValue ? _dictRepository.GetById(entity.IDDocumentType.Value) : null;
            var PersonTypeDict     = entity.PersonType.HasValue ? _dictRepository.GetById(entity.PersonType.Value) : null;
            var xmlBuilder         = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            xmlBuilder.Append("<Tpp2Fpp>");
            xmlBuilder.Append("<ReqHeader>");
            xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName());
            xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes));
            xmlBuilder.Append("</ReqHeader>");
            xmlBuilder.Append("<ReqBody>");
            xmlBuilder.Append("<person>");
            xmlBuilder.AppendFormat("<uuid>{0}</uuid>", entity.PersonUUID);
            xmlBuilder.AppendFormat("<cusr>{0}</cusr>", Constant.LkbAccount);
            xmlBuilder.AppendFormat("<state>{0}</state>", entity.Status);
            xmlBuilder.AppendFormat("<cdate>{0}</cdate>", entity.CreateTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<udate>{0}</udate>", entity.UpdateTime.HasValue ? entity.UpdateTime.Value.ToString("yyyyMMddHHmmss") : "");
            xmlBuilder.AppendFormat("<name>{0}</name>", DESHelper.Encrypt3Des(entity.PersonName, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<sex>{0}</sex>", SexDict.DictCode);
            xmlBuilder.AppendFormat("<nation>{0}</nation>", nationDict.DictCode);
            xmlBuilder.AppendFormat("<birthday>{0}</birthday>", entity.Birthday.ToString("yyyyMMdd"));
            xmlBuilder.AppendFormat("<regaddress>{0}</regaddress>", entity.RegAddress);
            xmlBuilder.AppendFormat("<oregaddress>{0}</oregaddress>", entity.OriginRegAddress);
            xmlBuilder.AppendFormat("<curaddress>{0}</curaddress>", entity.LivingAddress);
            xmlBuilder.AppendFormat("<tel>{0}</tel>", !entity.PhoneNo.IsBlank() ? DESHelper.Encrypt3Des(entity.PhoneNo, Constant.DescKeyBytes) : "");
            xmlBuilder.AppendFormat("<tel2>{0}</tel2>", !entity.BackUpPhoneNo.IsBlank() ? DESHelper.Encrypt3Des(entity.BackUpPhoneNo, Constant.DescKeyBytes) : "");
            xmlBuilder.AppendFormat("<idcard>{0}</idcard>", !entity.IDCardNo.IsBlank() ? DESHelper.Encrypt3Des(entity.IDCardNo, Constant.DescKeyBytes) : "");
            xmlBuilder.AppendFormat("<authorgan>{0}</authorgan>", entity.IssueOrg);
            xmlBuilder.AppendFormat("<avbdate>{0}</avbdate>", entity.ValidFrom.HasValue ? entity.ValidFrom.Value.ToString("yyyyMMdd") : "");
            xmlBuilder.AppendFormat("<avedate>{0}</avedate>", entity.ValidTo.HasValue ? entity.ValidTo.Value.ToString("yyyyMMdd") : "");
            xmlBuilder.AppendFormat("<photopath>{0}</photopath>", ""); //IDCardPic  证件照片需加密
            xmlBuilder.AppendFormat("<houseid>{0}</houseid>", "");     //居住HoseeID
            xmlBuilder.AppendFormat("<focal>{0}</focal>", entity.IsFocal);
            xmlBuilder.AppendFormat("<proof>{0}</proof>", IDDocumentTypeDict != null ? IDDocumentTypeDict.DictCode : "");
            xmlBuilder.AppendFormat("<islocal>{0}</islocal>", entity.IsLocal);
            xmlBuilder.AppendFormat("<cardisproving>{0}</cardisproving>", entity.IsIDVerified);
            xmlBuilder.AppendFormat("<ename>{0}</ename>", entity.EnglishName);
            xmlBuilder.AppendFormat("<flow>{0}</flow>", PersonTypeDict != null && PersonTypeDict.DictCode == "1" ? "1" : "");     //租客
            xmlBuilder.AppendFormat("<family>{0}</family>", PersonTypeDict != null && PersonTypeDict.DictCode == "2" ? "1" : ""); //家属
            xmlBuilder.AppendFormat("<owner>{0}</owner>", PersonTypeDict != null && PersonTypeDict.DictCode == "3" ? "1" : "");   //房东
            xmlBuilder.AppendFormat("<patrol>{0}</patrol>", PersonTypeDict != null && PersonTypeDict.DictCode == "4" ? "1" : ""); //巡防
            xmlBuilder.AppendFormat("<finger1>{0}</finger1>", "");                                                                //指纹一
            xmlBuilder.AppendFormat("<finger2>{0}</finger2>", "");                                                                //指纹二
            xmlBuilder.AppendFormat("<flag>{0}</flag>", flag);
            xmlBuilder.Append("</person>");
            xmlBuilder.Append("</ReqBody>");
            xmlBuilder.Append("</Tpp2Fpp> ");
            return(xmlBuilder.ToString());
        }
Ejemplo n.º 3
0
        private string GetXml(EntryHistoryEntity entity)
        {
            var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U

            if (entity.Deleted)
            {
                flag = "D";
            }

            var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            xmlBuilder.Append("<Tpp2Fpp>");
            xmlBuilder.Append("<ReqHeader>");
            xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName());
            xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes));
            xmlBuilder.Append("</ReqHeader>");
            xmlBuilder.Append("<ReqBody>");
            xmlBuilder.Append("<crjl>");
            xmlBuilder.AppendFormat("<cardno>{0}</cardno>", "0000" + entity.Card.CardNo);
            xmlBuilder.AppendFormat("<person_uuid>{0}</person_uuid>", entity.Person.PersonUUID);
            xmlBuilder.AppendFormat("<mac>{0}</mac>", entity.Door.Device.Mac);
            xmlBuilder.AppendFormat("<opentype>{0}</opentype>", "C");
            xmlBuilder.AppendFormat("<area_uuid>{0}</area_uuid>", entity.Door.AreaUUID);
            xmlBuilder.AppendFormat("<slide_date>{0}</slide_date>", entity.EntryTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<cdate>{0}</cdate>", entity.CreateTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<dev_uuid>{0}</dev_uuid>", entity.Door.DoorUUID);  //对应的门ID
            xmlBuilder.AppendFormat("<area_code>{0}</area_code>", entity.Door.Area.AreaCode);
            xmlBuilder.AppendFormat("<dev_date>{0}</dev_date>", "");
            xmlBuilder.AppendFormat("<flag>{0}</flag>", flag);
            xmlBuilder.Append("</crjl>");
            xmlBuilder.Append("</ReqBody> ");
            xmlBuilder.Append("</Tpp2Fpp> ");
            return(xmlBuilder.ToString());
        }
Ejemplo n.º 4
0
        private string GetXml(RoomUserEntity entity)
        {
            var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U

            if (entity.Deleted)
            {
                flag = "D";
            }

            var person = _personRepository.GetById(entity.PersonUUID); //用户
            var room   = _roomService.GetById(entity.RoomUUID);        //房间信息
            var area   = _areaService.GetById(room.AreaUUID);          // 区域信息

            //卡
            var cardQuery = from c in _cardRepository.Table
                            join uc in _userCardRepository.Table on c.CardUUID equals uc.CardUUID
                            where !uc.Deleted && uc.RoomUserUUID == entity.RoomUserUUID
                            orderby c.CreateTime descending
                            select c;

            var card = cardQuery.FirstOrDefault();

            var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            xmlBuilder.Append("<Tpp2Fpp>");
            xmlBuilder.Append("<ReqHeader>");
            xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName());
            xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes));
            xmlBuilder.Append("</ReqHeader>");
            xmlBuilder.Append("<ReqBody>");
            xmlBuilder.Append("<userhouse>");
            xmlBuilder.AppendFormat("<userid>{0}</userid>", entity.RoomUserUUID);
            xmlBuilder.AppendFormat("<houseid>{0}</houseid>", room.AreaUUID);
            xmlBuilder.AppendFormat("<date>{0}</date>", entity.LiveDate.HasValue ? entity.LiveDate.Value.ToString("yyyyMMddHHmmss") : "");
            xmlBuilder.AppendFormat("<udate>{0}</udate>", entity.CreateDate.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<reltype>{0}</reltype>", entity.FamilyRelationDict?.DictCode ?? ""); //关联类型
            xmlBuilder.AppendFormat("<parm1>{0}</parm1>", "");                                            //持卡类型:1:主卡, 2:附属卡
            xmlBuilder.AppendFormat("<parm2>{0}</parm2>", "");
            xmlBuilder.AppendFormat("<edate>{0}</edate>", entity.LeaveDate.HasValue ? entity.LeaveDate.Value.ToString("yyyyMMddHHmmss") : "");
            xmlBuilder.AppendFormat("<state>{0}</state>", "");                                                              //文档中未提及
            xmlBuilder.AppendFormat("<idcard>{0}</idcard>", DESHelper.Encrypt3Des(person.IDCardNo, Constant.DescKeyBytes)); //证件号码(需要加密) 必填
            xmlBuilder.AppendFormat("<arcode>{0}</arcode>", area.AreaCode);                                                 //房屋区域层级编码 必填
            xmlBuilder.AppendFormat("<crk_uuid>{0}</crk_uuid>", card.CardUUID);
            xmlBuilder.AppendFormat("<crk_crkno>{0}</crk_crkno>", card.CardNo);
            xmlBuilder.AppendFormat("<flag>{0}</flag>", flag);
            xmlBuilder.Append("</userhouse>");
            xmlBuilder.Append("</ReqBody> ");
            xmlBuilder.Append("</Tpp2Fpp> ");
            return(xmlBuilder.ToString());
        }
Ejemplo n.º 5
0
        private string GetXml(RoomEntity entity)
        {
            var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U

            if (entity.Deleted)
            {
                flag = "D";
            }

            var ResidenceTypeDict = entity.ResidenceType.HasValue ? _dictRepository.GetById(entity.ResidenceType.Value) : null;
            var RoomTypeDict      = entity.RoomType.HasValue ? _dictRepository.GetById(entity.RoomType.Value) : null;
            var OwnershipTypeDict = entity.OwnershipType.HasValue ? _dictRepository.GetById(entity.OwnershipType.Value) : null;
            var NatureDict        = entity.Nature.HasValue ? _dictRepository.GetById(entity.Nature.Value) : null;
            var ManageLevelDict   = entity.ManageLevel.HasValue ? _dictRepository.GetById(entity.ManageLevel.Value) : null;
            var RentalTypeDict    = entity.RentalType.HasValue ? _dictRepository.GetById(entity.RentalType.Value) : null;
            var RoomStyleDict     = entity.RoomStyle.HasValue ? _dictRepository.GetById(entity.RoomStyle.Value) : null;


            var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            xmlBuilder.Append("<Tpp2Fpp>");
            xmlBuilder.Append("<ReqHeader>");
            xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName());
            xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes));
            xmlBuilder.Append("</ReqHeader>");
            xmlBuilder.Append("<ReqBody>");
            xmlBuilder.Append("<areaextend>");
            xmlBuilder.AppendFormat("<reluuid>{0}</reluuid>", entity.AreaUUID);
            xmlBuilder.AppendFormat("<jzlx>{0}</jzlx>", ResidenceTypeDict != null ? ResidenceTypeDict.DictCode : "");
            xmlBuilder.AppendFormat("<fwlx>{0}</fwlx>", RoomTypeDict != null ? RoomTypeDict.DictCode : "");
            xmlBuilder.AppendFormat("<fwsyqlx>{0}</fwsyqlx>", OwnershipTypeDict != null ? OwnershipTypeDict.DictCode : "");
            xmlBuilder.AppendFormat("<fwxxdz>{0}</fwxxdz>", entity.Address);
            xmlBuilder.AppendFormat("<fczh>{0}</fczh>", entity.CertificationNo);
            xmlBuilder.AppendFormat("<sspcs>{0}</sspcs>", entity.PoliceStation);
            xmlBuilder.AppendFormat("<mjxx>{0}</mjxx>", entity.Policeman);
            xmlBuilder.AppendFormat("<czyt>{0}</czyt>", entity.RentalUseage);
            xmlBuilder.AppendFormat("<djba>{0}</djba>", entity.Registration);
            xmlBuilder.AppendFormat("<babdate>{0}</babdate>", entity.RegFrom.HasValue ? entity.RegFrom.Value.ToString("yyyyMMddHHmmss") : "");
            xmlBuilder.AppendFormat("<baedate>{0}</baedate>", entity.RegTo.HasValue ? entity.RegTo.Value.ToString("yyyyMMddHHmmss") : "");
            xmlBuilder.AppendFormat("<xz>{0}</xz>", NatureDict != null ? NatureDict.DictCode : "");
            xmlBuilder.AppendFormat("<gldj>{0}</gldj>", ManageLevelDict != null ? ManageLevelDict.DictCode : "");
            xmlBuilder.AppendFormat("<zlzt>{0}</zlzt>", RentalTypeDict != null ? RentalTypeDict.DictCode : "");
            xmlBuilder.AppendFormat("<jshx>{0}</jshx>", RoomStyleDict != null ? RoomStyleDict.DictCode : "");
            xmlBuilder.AppendFormat("<flag>{0}</flag>", flag);
            xmlBuilder.Append("</areaextend>");
            xmlBuilder.Append("</ReqBody> ");
            xmlBuilder.Append("</Tpp2Fpp> ");
            return(xmlBuilder.ToString());
        }
Ejemplo n.º 6
0
        private string GetXml(DeviceStatusEntity entity, DoorDto door)
        {
            var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U

            if (entity.Deleted)
            {
                flag = "D";
            }

            var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            xmlBuilder.Append("<Tpp2Fpp>");
            xmlBuilder.Append("<ReqHeader>");
            xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName());
            xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes));
            xmlBuilder.Append("</ReqHeader>");
            xmlBuilder.Append("<ReqBody>");
            xmlBuilder.Append("<deviceStatus>");
            xmlBuilder.AppendFormat("<dev_uuid>{0}</dev_uuid>", entity.DeviceUUID);
            xmlBuilder.AppendFormat("<status>{0}</status>", entity.DeviceStatus);
            xmlBuilder.AppendFormat("<hwversion>{0}</hwversion>", entity.HardwardVersion);
            xmlBuilder.AppendFormat("<sfversion>{0}</sfversion>", entity.SoftwareVersion);
            xmlBuilder.AppendFormat("<imsi>{0}</imsi>", entity.IMSI);
            xmlBuilder.AppendFormat("<msisdn>{0}</msisdn>", entity.MISSDN);
            xmlBuilder.AppendFormat("<battery>{0}</battery>", entity.Battery);
            xmlBuilder.AppendFormat("<temperature>{0}</temperature>", entity.Temperature);
            xmlBuilder.AppendFormat("<signal>{0}</signal>", entity.Signal);
            xmlBuilder.AppendFormat("<udate>{0}</udate>", entity.UpdateTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<cardPopedomCapacity>{0}</cardPopedomCapacity>", entity.CardCapacity);
            xmlBuilder.AppendFormat("<cardPopedomCount>{0}</cardPopedomCount>", entity.CardWhiteListCount);
            xmlBuilder.AppendFormat("<fingerCapacity>{0}</fingerCapacity>", entity.FingerCapacity);
            xmlBuilder.AppendFormat("<fingerCount>{0}</fingerCount>", entity.FingerCount);
            xmlBuilder.AppendFormat("<opened>{0}</opened>", entity.IsOPened);
            xmlBuilder.AppendFormat("<cdate>{0}</cdate>", entity.CreateTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<cuser>{0}</cuser>", Constant.LkbAccount);
            xmlBuilder.AppendFormat("<workmode>{0}</workmode>", entity.WorkMode);
            xmlBuilder.AppendFormat("<powermode>{0}</powermode>", entity.PowerMode);
            xmlBuilder.AppendFormat("<flag>{0}</flag>", flag);
            xmlBuilder.Append("</deviceStatus>");
            xmlBuilder.Append("</ReqBody> ");
            xmlBuilder.Append("</Tpp2Fpp> ");
            return(xmlBuilder.ToString());
        }
Ejemplo n.º 7
0
        private string GetXml(DoorEntity door, DeviceEntity device)
        {
            var flag = door.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U

            if (door.Deleted)
            {
                flag = "D";
            }
            var area           = _areaRepository.GetById(door.AreaUUID);
            var DeviceTypeDict = device.DeviceType.HasValue ? _dictService.GetById(device.DeviceType.Value) : null;
            var LockTypeDict   = device.LockType.HasValue ? _dictService.GetById(device.LockType.Value) : null;

            var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            xmlBuilder.Append("<Tpp2Fpp>");
            xmlBuilder.Append("<ReqHeader>");
            xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName());
            xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes));
            xmlBuilder.Append("</ReqHeader>");
            xmlBuilder.Append("<ReqBody>");
            xmlBuilder.Append("<device>");
            xmlBuilder.AppendFormat("<uuid>{0}</uuid>", door.DoorUUID);
            xmlBuilder.AppendFormat("<name>{0}</name>", device.DeviceName);
            xmlBuilder.AppendFormat("<mac>{0}</mac>", device.Mac);
            xmlBuilder.AppendFormat("<type>{0}</type>", DeviceTypeDict != null ? DeviceTypeDict.DictCode : ""); //设备类型 必传
            xmlBuilder.AppendFormat("<gw_uuid>{0}</gw_uuid>", "");                                              //所属控制器(网关)的uuid
            xmlBuilder.AppendFormat("<status>{0}</status>", door.Status == 1?1:2);                              //文档中未提及
            xmlBuilder.AppendFormat("<area_uuid>{0}</area_uuid>", area.AreaUUID);                               //证件号码(需要加密) 必填
            xmlBuilder.AppendFormat("<area_layercode>{0}</area_layercode>", area.AreaCode);                     //房屋区域层级编码 必填
            xmlBuilder.AppendFormat("<cdate>{0}</cdate>", door.CreateTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<udate>{0}</udate>", door.CreateTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<inner_key>{0}</inner_key>", device.InnerKey);
            xmlBuilder.AppendFormat("<cuser>{0}</cuser>", Constant.LkbAccount);
            xmlBuilder.AppendFormat("<locktype>{0}</locktype>", LockTypeDict != null ? LockTypeDict.DictCode : "");
            xmlBuilder.AppendFormat("<flag>{0}</flag>", flag);
            xmlBuilder.Append("</device>");
            xmlBuilder.Append("</ReqBody>");
            xmlBuilder.Append("</Tpp2Fpp>");
            return(xmlBuilder.ToString());
        }
Ejemplo n.º 8
0
        private string GetXml(DeviceAlarmEntity entity, DoorDto door)
        {
            var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U

            if (entity.Deleted)
            {
                flag = "D";
            }

            var AlarmTypeDict = _dictService.GetById(entity.AlarmType);

            var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            xmlBuilder.Append("<Tpp2Fpp>");
            xmlBuilder.Append("<ReqHeader>");
            xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName());
            xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes));
            xmlBuilder.Append("</ReqHeader>");
            xmlBuilder.Append("<ReqBody>");
            xmlBuilder.Append("<deviceAlarm>");
            xmlBuilder.AppendFormat("<uuid>{0}</uuid>", entity.AlarmUUID);
            xmlBuilder.AppendFormat("<occur_date>{0}</occur_date>", entity.OccurTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<cdate>{0}</cdate>", entity.CreateTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<type>{0}</type>", AlarmTypeDict.DictCode);
            xmlBuilder.AppendFormat("<status>{0}</status>", entity.Status);
            xmlBuilder.AppendFormat("<udate>{0}</udate>", entity.UpdateTime.HasValue?entity.UpdateTime.Value.ToString("yyyyMMddHHmmss"):"");
            xmlBuilder.AppendFormat("<mac>{0}</mac>", "");
            xmlBuilder.AppendFormat("<area_uuid>{0}</area_uuid>", door.AreaUUID);
            xmlBuilder.AppendFormat("<account_uuid>{0}</account_uuid>", Constant.LkbAccount);
            xmlBuilder.AppendFormat("<device_uuid>{0}</device_uuid>", entity.DeviceUUID); //存的时候是不是存门ID
            xmlBuilder.AppendFormat("<remark>{0}</remark>", entity.Remark);
            xmlBuilder.AppendFormat("<cardno>{0}</cardno>", string.Format("0000{0}", entity.CardNo));
            xmlBuilder.AppendFormat("<dev_date>{0}</dev_date>", "");
            xmlBuilder.AppendFormat("<ctrl_mac>{0}</ctrl_mac>", "");
            xmlBuilder.AppendFormat("<flag>{0}</flag>", flag);
            xmlBuilder.Append("</deviceAlarm>");
            xmlBuilder.Append("</ReqBody> ");
            xmlBuilder.Append("</Tpp2Fpp> ");
            return(xmlBuilder.ToString());
        }
Ejemplo n.º 9
0
        private string GetXml(AreaEntity entity)
        {
            var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U

            if (entity.Deleted)
            {
                flag = "D";
            }

            var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            xmlBuilder.Append("<Tpp2Fpp>");
            xmlBuilder.Append("<ReqHeader>");
            xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName());
            xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes));
            xmlBuilder.Append("</ReqHeader>");
            xmlBuilder.Append("<ReqBody>");
            xmlBuilder.Append("<area>");
            xmlBuilder.AppendFormat("<uuid>{0}</uuid>", entity.AreaUUID);
            xmlBuilder.AppendFormat("<cusr>{0}</cusr>", Constant.LkbAccount);
            xmlBuilder.AppendFormat("<state>{0}</state>", entity.Status);
            xmlBuilder.AppendFormat("<cdate>{0}</cdate>", entity.CreateTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<udate>{0}</udate>", entity.UpdateTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<order>{0}</order>", entity.OrderID);
            xmlBuilder.AppendFormat("<code>{0}</code>", entity.Code);
            xmlBuilder.AppendFormat("<cname>{0}</cname>", entity.ChineseName);
            xmlBuilder.AppendFormat("<ename>{0}</ename>", entity.EnglishName);
            xmlBuilder.AppendFormat("<areacode>{0}</areacode>", entity.AreaCode);
            xmlBuilder.AppendFormat("<type>{0}</type>", entity.AreaType);
            xmlBuilder.AppendFormat("<remark>{0}</remark>", entity.Remark);
            xmlBuilder.AppendFormat("<keycode>{0}</keycode>", entity.KeyCode);
            xmlBuilder.AppendFormat("<keycode1>{0}</keycode1>", entity.KeyCode1);
            xmlBuilder.AppendFormat("<ifparent>{0}</ifparent>", entity.IsParent);
            xmlBuilder.AppendFormat("<flag>{0}</flag>", flag);
            xmlBuilder.Append("</area>");
            xmlBuilder.Append("</ReqBody> ");
            xmlBuilder.Append("</Tpp2Fpp> ");
            return(xmlBuilder.ToString());
        }
Ejemplo n.º 10
0
        private string GetCardAuthXml(CardAuthEntity entity)
        {
            var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U

            if (entity.Deleted)
            {
                flag = "D";
            }

            var door = _doorService.GetById(entity.DoorUUID);


            var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            xmlBuilder.Append("<Tpp2Fpp>");
            xmlBuilder.Append("<ReqHeader>");
            xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName());
            xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes));
            xmlBuilder.Append("</ReqHeader>");
            xmlBuilder.Append("<ReqBody>");
            xmlBuilder.Append("<crkqx>");
            xmlBuilder.AppendFormat("<crk_uuid>{0}</crk_uuid>", entity.CardUUID);
            xmlBuilder.AppendFormat("<dev_uuid>{0}</dev_uuid>", entity.DoorUUID);
            xmlBuilder.AppendFormat("<state>{0}</state>", "2"); //出入卡状态(0:初始化;1:操作中;2:正常;3:挂失;4:注销)
            xmlBuilder.AppendFormat("<stime>{0}</stime>", Constant.FormatDateTime(entity.ValidFrom));
            xmlBuilder.AppendFormat("<etime>{0}</etime>", Constant.FormatDateTime(entity.ValidTo));
            xmlBuilder.AppendFormat("<cuser>{0}</cuser>", Constant.LkbAccount);
            xmlBuilder.AppendFormat("<cdate>{0}</cdate>", entity.CreateTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<udate>{0}</udate>", Constant.FormatDateTime(entity.UpdateTime));
            xmlBuilder.AppendFormat("<area_uuid>{0}</area_uuid>", door.AreaUUID); //区域权限因子(二级) (定长为 4位)
            xmlBuilder.AppendFormat("<flag>{0}</flag>", flag);
            xmlBuilder.Append("</crkqx>");
            xmlBuilder.Append("</ReqBody> ");
            xmlBuilder.Append("</Tpp2Fpp> ");
            return(xmlBuilder.ToString());
        }
Ejemplo n.º 11
0
        private string GetCardXml(CardEntity entity, PersonEntity person)
        {
            var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U

            if (entity.Deleted)
            {
                flag = "D";
            }

            //根据卡号需要找到房间ID  得到AreaCode及LayerCode
            var query = from r in _roomRepository.Table
                        join ru in _roomUserRepository.Table on r.RoomUUID equals ru.RoomUUID
                        join uc in _userCardRepository.Table on ru.RoomUserUUID equals uc.RoomUserUUID
                        where uc.CardUUID == entity.CardUUID
                        orderby uc.CreateTime descending
                        select new {
                r.AreaUUID,
                ru.FamilyRelation
            };

            var room = query.FirstOrDefault();

            if (room == null)
            {
                return(string.Empty);
            }

            var familyRelationDict = _dictService.GetById(room.FamilyRelation.Value);

            var area = _areaService.GetById(room.AreaUUID);

            var type1 = "2";

            if (person.PersonType == 272)
            {
                type1 = "1";
            }

            var type2 = familyRelationDict?.DictCode ?? "0";

            if (type2 == "10")
            {
                type2 = "9";
            }


            var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            xmlBuilder.Append("<Tpp2Fpp>");
            xmlBuilder.Append("<ReqHeader>");
            xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName());
            xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes));
            xmlBuilder.Append("</ReqHeader>");
            xmlBuilder.Append("<ReqBody>");
            xmlBuilder.Append("<crk>");
            xmlBuilder.AppendFormat("<uuid>{0}</uuid>", entity.CardUUID);
            xmlBuilder.AppendFormat("<crkno>{0}</crkno>", entity.CardNo);
            xmlBuilder.AppendFormat("<idcode>{0}</idcode>", DESHelper.Encrypt3Des(person.IDCardNo + type1 + type2, Constant.DescKeyBytes)); //身份信息编码( 参见杭州市规范 ) ,护照正常传入,不用编码(需要加密)
            xmlBuilder.AppendFormat("<addrcode>{0}</addrcode>", "");                                                                        //住址信息编码( 参见杭州市规范 )
            xmlBuilder.AppendFormat("<udate>{0}</udate>", Constant.FormatDateTime(entity.UpdateTime));
            xmlBuilder.AppendFormat("<cuser>{0}</cuser>", Constant.LkbAccount);
            xmlBuilder.AppendFormat("<state>{0}</state>", "2"); //出入卡状态(0:初始化;1:操作中;2:正常;3:挂失;4:注销)
            xmlBuilder.AppendFormat("<stime>{0}</stime>", Constant.FormatDateTime(entity.ValidFrom));
            xmlBuilder.AppendFormat("<etime>{0}</etime>", Constant.FormatDateTime(entity.ValidTo));
            xmlBuilder.AppendFormat("<cdate>{0}</cdate>", entity.CreateTime.ToString("yyyyMMddHHmmss"));
            xmlBuilder.AppendFormat("<key>{0}</key>", entity.AreaKey);            //区域权限因子(二级) (定长为 4位)
            xmlBuilder.AppendFormat("<mac>{0}</mac>", "");                        //
            xmlBuilder.AppendFormat("<layercode>{0}</layercode>", area.AreaCode); //归属区域层级编码
            xmlBuilder.AppendFormat("<crkno4>{0}</crkno4>", entity.CardLast4NO);
            xmlBuilder.AppendFormat("<key1>{0}</key1>", entity.AreaKey1);         //区域权限因子(一级) (定长为 4位)
            xmlBuilder.AppendFormat("<flag>{0}</flag>", flag);
            xmlBuilder.Append("</crk>");
            xmlBuilder.Append("</ReqBody> ");
            xmlBuilder.Append("</Tpp2Fpp> ");
            return(xmlBuilder.ToString());
        }
Ejemplo n.º 12
0
        private string GetXml(RenterEntity entity)
        {
            var flag = entity.SyncVersion == 0 ? "C" : "U"; //增|删|改,C|D|U

            if (entity.Deleted)
            {
                flag = "D";
            }

            var PoliticalStatus = entity.PoliticalStatus.HasValue ? _dictRepository.GetById(entity.PoliticalStatus.Value) : null;
            var EduLevel        = entity.EduLevel.HasValue ? _dictRepository.GetById(entity.EduLevel.Value) : null;
            var ResidenceType   = entity.ResidenceType.HasValue ? _dictRepository.GetById(entity.ResidenceType.Value) : null;
            var RegCertType     = entity.RegCertType.HasValue ? _dictRepository.GetById(entity.RegCertType.Value) : null;
            var RentalStatus    = entity.RentalStatus.HasValue ? _dictRepository.GetById(entity.RentalStatus.Value) : null;
            var LivingReason    = entity.LivingReason.HasValue ? _dictRepository.GetById(entity.LivingReason.Value) : null;

            var xmlBuilder = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

            xmlBuilder.Append("<Tpp2Fpp>");
            xmlBuilder.Append("<ReqHeader>");
            xmlBuilder.AppendFormat("<ReqSeqNo>{0}</ReqSeqNo>", Utils.MakeRndName());
            xmlBuilder.AppendFormat("<ReqSPID>{0}</ReqSPID>", DESHelper.Encrypt3Des(Constant.LkbAccount, Constant.DescKeyBytes));
            xmlBuilder.AppendFormat("<ReqCode>{0}</ReqCode>", DESHelper.Encrypt3Des(Constant.LkbPassword, Constant.DescKeyBytes));
            xmlBuilder.Append("</ReqHeader>");
            xmlBuilder.Append("<ReqBody>");
            xmlBuilder.Append("<personFlow>");
            xmlBuilder.AppendFormat("<reluuid>{0}</reluuid>", entity.PersonUUID);
            xmlBuilder.AppendFormat("<polity>{0}</polity>", PoliticalStatus != null ? PoliticalStatus.DictCode : "");
            xmlBuilder.AppendFormat("<education>{0}</education>", EduLevel != null ? EduLevel.DictCode : "");
            xmlBuilder.AppendFormat("<comdate>{0}</comdate>", entity.LocalArriveDate.HasValue?entity.LocalArriveDate.Value.ToString("yyyyMMdd") : "");
            xmlBuilder.AppendFormat("<pestilence>{0}</pestilence>", entity.EpidemicPrevention);
            xmlBuilder.AppendFormat("<study>{0}</study>", entity.StudyHistory);
            xmlBuilder.AppendFormat("<inoculability>{0}</inoculability>", entity.Inoculability);
            xmlBuilder.AppendFormat("<staycard>{0}</staycard>", entity.StayCard);
            xmlBuilder.AppendFormat("<workaddress>{0}</workaddress>", entity.WorkingAddress);
            xmlBuilder.AppendFormat("<marry>{0}</marry>", entity.MarriageStatus);
            xmlBuilder.AppendFormat("<matename>{0}</matename>", !entity.MateName.IsBlank()?DESHelper.Encrypt3Des(entity.MateName, Constant.DescKeyBytes):"");
            xmlBuilder.AppendFormat("<mateno>{0}</mateno>", !entity.MateNo.IsBlank() ? DESHelper.Encrypt3Des(entity.MateNo, Constant.DescKeyBytes) : "");
            xmlBuilder.AppendFormat("<girs>{0}</girs>", entity.Daughter);
            xmlBuilder.AppendFormat("<boys>{0}</boys>", entity.Sions);
            xmlBuilder.AppendFormat("<pregnantno>{0}</pregnantno>", entity.GestationNo);
            xmlBuilder.AppendFormat("<pregnantdate>{0}</pregnantdate>", entity.PregnancyTestDate.HasValue ? entity.PregnancyTestDate.Value.ToString("yyyyMMdd") : "");
            xmlBuilder.AppendFormat("<pregnantcont>{0}</pregnantcont>", entity.ContraceptionCount);
            xmlBuilder.AppendFormat("<ispregnant>{0}</ispregnant>", entity.IsPregnant);
            xmlBuilder.AppendFormat("<isshbx>{0}</isshbx>", entity.IsSocialInsur);
            xmlBuilder.AppendFormat("<isldht>{0}</isldht>", entity.IsLaborContract);
            xmlBuilder.AppendFormat("<cbdwmc>{0}</cbdwmc>", entity.InsurCompany);
            xmlBuilder.AppendFormat("<cbdwlxr>{0}</cbdwlxr>", !entity.InsurCompanyContact.IsBlank() ? DESHelper.Encrypt3Des(entity.InsurCompanyContact, Constant.DescKeyBytes) : "");
            xmlBuilder.AppendFormat("<cbdwlxdh>{0}</cbdwlxdh>", entity.ICCPhoneNo);
            xmlBuilder.AppendFormat("<jyqk>{0}</jyqk>", entity.EduHistory);
            xmlBuilder.AppendFormat("<jdxx>{0}</jdxx>", entity.School);
            xmlBuilder.AppendFormat("<jzlx>{0}</jzlx>", ResidenceType != null? ResidenceType.DictCode:"");
            xmlBuilder.AppendFormat("<hjlx>{0}</hjlx>", RegCertType != null? RegCertType.DictCode:"");
            xmlBuilder.AppendFormat("<jzzj>{0}</jzzj>", entity.RegCert);
            xmlBuilder.AppendFormat("<zlzt>{0}</zlzt>", RentalStatus != null? RentalStatus.DictCode:"");
            xmlBuilder.AppendFormat("<livereason>{0}</livereason>", LivingReason != null? LivingReason.DictCode:"");
            xmlBuilder.AppendFormat("<hzlsh>{0}</hzlsh>", entity.RegCertNo);
            xmlBuilder.AppendFormat("<remark>{0}</remark>", entity.Remark);
            xmlBuilder.AppendFormat("<flag>{0}</flag>", flag);
            xmlBuilder.Append("</personFlow>");
            xmlBuilder.Append("</ReqBody>");
            xmlBuilder.Append("</Tpp2Fpp>");
            return(xmlBuilder.ToString());
        }