iceClientUtil.py
2.03 KB
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
import logging
import pandas as pd
import sys,traceback,Ice
Ice.loadSlice("--all -I.. ice/bsd.ice")
Ice.loadSlice("--all -I.. ice/Hdao_gps.ice")
Ice.loadSlice("--all -I.. --underscore ice/district.ice")
Ice.loadSlice("--all -I.. --underscore ice/ipoi.ice")
Ice.loadSlice("--all -I.. --underscore ice/HDao_mile.ice")
import datetime
import BaseStationData
import HDaoGps,HDaoMile
import DISTRICT
import pymysql
import POI
print("sys config " + __name__)
log_name = './log/iceinvoker/iceclientutl.log'
log_format = '[%(asctime)s-%(filename)s-%(levelname)s:%(message)s]'
log_level = logging.DEBUG
log_mode = 'a'
logging.basicConfig(filename=log_name, format=log_format, level=log_level, filemode=log_mode)
class IceClientUtil:
# env_host = "192.168.3.101"
# env_host = "192.168.5.31"
env_host = "192.168.5.26"
daoGpsServicePrx = None
def __init__(self, handle_month):
logging.info("init construct bean")
self.handleDescription = "dj renewal match iccid and device location"
self.handleMonth = handle_month
self.hmonth = handle_month.replace('-', '')[2:6]
with Ice.initialize(sys.argv) as communicator:
obj = communicator.stringToProxy(f'HDaoGpsSvc:default -h {self.env_host} -p 23469')
obj.ice_ping()
self.daoGpsServicePrx = HDaoGps.DaoGpsServicePrx.checkedCast(obj)
def getLatestGpsRecord(self, sn,type = 5):
try:
if not self.daoGpsServicePrx:
raise RuntimeError("Invalid proxy")
req = HDaoGps.LatestGpsGetRequest()
req.userID = int(sn)
req.apType = type
req.extraMapReq = 0
rsp = self.daoGpsServicePrx.getLatestGpsRecord(req)
# print(rsp[1].gps.gpsTime)
print(rsp)
return rsp
except:
traceback.print_exc()
return None
if __name__ == "__main__":
iceClientUtil = IceClientUtil()
sn = '561063062817521'
gpsRecord = iceClientUtil.getLatestGpsRecord(sn)
print(gpsRecord)