#coding:utf-8
import jpype,json
from jpype import *
def kfpt_TranSeq(csbz):
jarpath3 = r'C:/lo4jar'
jvmPath = jpype.getDefaultJVMPath()
jpype.startJVM(jvmPath, "-ea", "-Djava.class.path=%s" %jarpath3, "-Djava.ext.dirs=%s" %jarpath3)
tclass1 = jpype.JClass("com.foresee.util.TranSeqGeneratorNumUtil")
jpype.JClass("com.foresee.open.sdk.client.OpenApiClient")
TranSeq = tclass1.generateTranseq("" + csbz + "", "", "")
return TranSeq
jpype.shutdownJVM()
def kfpt_request(url, body):
jpype.getDefaultJVMPath()
customerAppId = "0001"
providerAppId = "10001101"
key = "6E19qYLYx8"
t1 = JPackage("com.foresee.open.sdk.client").OpenApiClient(customerAppId,key)
bodyjson = json.dumps(body)
rps = t1.requestApp(url,bodyjson,providerAppId)
return rps
def TranSeq(csbz, clientNo, swjgdm):
tclass1 = jpype.JClass("com.foresee.util.TranSeqGeneratorNumUtil")
TranSeq = tclass1.generateTranseq("" + str(csbz) + "", "" + str(clientNo) + "", "" + str(swjgdm) + "")
return TranSeq
#coding:utf-8
from common import myclass
# 纳税人实名登录
def test_LOGIN():
url = "http://nsrzx/dj/smzdl"
# 业务报文参数
content = {
"sjly": "0",
"yhzh": "Pn",
"yhmm": "wI=",
"sjc": 15801,
"dljklx": "smz",
"signValue": "",
"cert": "",
"random": ""
}
# 技术报文参数
tranSeq = myclass.kfpt_TranSeq('kfpt')
body = {
"tranSeq": tranSeq,
"sessionId": "",
"appid": "",
"gdslxDm": "1",
"areaCode": "44",
"clientNo": "",
"nsrsbh": "9144681K",
"djxh": "",
"swjgDm": "000000",
"sjjg": "00000000",
"contentType": "JSON",
"contentEncryptType": "",
"content": content
}
response_login = myclass.kfpt_request(url, body)
print(response_login)
if __name__=="__main__":
test_LOGIN()
#coding:utf-8
from common import myclass
from common import login
# 纳税人发票统计及填表数据
def test_TBSJ():
url_tbxy = 'http://fpcj/hqfptjjtbsj'
# 业务报文参数
content = {
"djxh":login.djxh[0],
"nsrsbh":login.nsrsbh,
"oldnsrsbh":login.nsrsbh,
"sssqq":"2017-01-01",
"sssqz":"2017-12-31",
"fpzldm":"",
"fplx":"xxfp",
"areaCode":"44",
"provinceid":"440000",
}
# 技术报文参数
body = {
"tranSeq": login.TranSeq,
"sessionId":login.sessionID[0],
"appid": "",
"gdslxDm": "1",
"areaCode": "44",
"clientNo": login.clientNo[0],
"nsrsbh": "91441500708171681K",
"djxh": login.djxh[0],
"swjgDm": "0000000",
"sjjg": "000000000",
"contentType": "JSON",
"contentEncryptType": "",
"content": content
}
response_nsrANDtbxy = myclass.kfpt_request(url_tbxy,body)
print(response_nsrANDtbxy)
if __name__=="__main__":
test_TBSJ()