Commit ce479188 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

优化脚本

parent 15799985
......@@ -493,5 +493,5 @@ def main():
print('审批采购计划出现错误,请检查脚本或者数据')
print("发生异常:", str(e))
commonFuc().check_text_exist_result_text('succeed','succeed')
if __name__ == '__main__':
main()
\ No newline at end of file
main()
\ No newline at end of file
......@@ -2,7 +2,7 @@
import traceback
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from air_case.public.public import approval_center
from air_case.public1 import approval_center
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
from common.timeUtils import timeUtils
......
def approval_center():
module = "b2_herp3_bs"
# 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
print(info)
username1 = info['username1']
username = username1
## print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# 登录获取用户id等信息,使用创建的用户登录============结束
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "apprCenter_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# 请求体
request_body = commonFuc().get_business_data(module, "payload50_6")
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
# 断言
# checkDict=commonFuc().get_business_data(module,'checkDict10')
# commonFuc().check_result(checkDict,result)
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', result)
data1 = commonFuc().analysis_json('data', data)
commonFuc().check_text_exist(0, result)
taskId = commonFuc().analysis_json('taskId', data1[0])
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "approvalBatch_url")
# 请求体
request_body = commonFuc().get_business_data(module, "payload50_7", taskId)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('resultaaaaaaaaaaaaaaaaaaaaaaaaaaa', result)
# 断言
# checkDict=commonFuc().get_business_data(module,'checkDict10')
# commonFuc().check_result(checkDict,result)
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', result)
if code >= 0:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
......@@ -104,23 +104,23 @@ class parseCode(object):
if isinstance(val, str):
model_file.write("private String " + key + ";\n")
key_d = "".join(key[:1].upper() + key[1:])
model_file.write("public String get" + key_d + "() { return " + key
model_file.write("public1 String get" + key_d + "() { return " + key
+ ";}\n")
model_file.write("public void set" + key_d + "(String " + key +
model_file.write("public1 void set" + key_d + "(String " + key +
") { this." + key + " = " + key + ";}\n")
elif isinstance(val, list):
model_file.write("private List<Object> " + key + ";\n")
key_d = "".join(key[:1].upper() + key[1:])
model_file.write("public List<Object> get" + key_d + "() { return " + key
model_file.write("public1 List<Object> get" + key_d + "() { return " + key
+ ";}\n")
model_file.write("public void set" + key_d + "(List<Object> " + key +
model_file.write("public1 void set" + key_d + "(List<Object> " + key +
") { this." + key + " = " + key + ";}\n")
elif isinstance(val, int):
model_file.write("private int " + key + ";\n")
key_d = "".join(key[:1].upper() + key[1:])
model_file.write("public int get" + key_d + "() { return " + key
model_file.write("public1 int get" + key_d + "() { return " + key
+ ";}\n")
model_file.write("public void set" + key_d + "(int " + key +
model_file.write("public1 void set" + key_d + "(int " + key +
") { this." + key + " = " + key + ";}\n")
def param_set(self, key, val, result):
......@@ -213,7 +213,7 @@ class parseCode(object):
file = open(filename, 'w')
file.write("package " + file_hash["package"] + ".controller;\n\n\n")
file.write("@RestController\n")
file.write("public class " + file_hash["className"].replace(".java", "") + " {" + "\n")
file.write("public1 class " + file_hash["className"].replace(".java", "") + " {" + "\n")
file.write("\n\n")
file.write(file_hash["methodPath"])
file.write("\n@ResponseBody \n")
......@@ -222,11 +222,11 @@ class parseCode(object):
param_body = ""
for key, val in file_hash["params"].items():
param_body = self.param_set(key, val, param_body)
file.write("public " + file_hash["response"] + " " + file_hash["method"] + "(" + param_body[:-1] + ") {\n")
file.write("public1 " + file_hash["response"] + " " + file_hash["method"] + "(" + param_body[:-1] + ") {\n")
else:
entity_name = file_hash["entity_name"]
param_body = "@RequestBody " + entity_name + " " + str.lower(entity_name)
file.write("public " + file_hash["response"] + " " + file_hash["method"] + "("
file.write("public1 " + file_hash["response"] + " " + file_hash["method"] + "("
+ param_body + ") {\n")
model_path = file_hash["root_path"] + "/model"
if not os.path.exists(model_path):
......@@ -236,7 +236,7 @@ class parseCode(object):
os.remove(model_filename)
model_file = open(model_filename, 'a')
model_file.write("package " + file_hash["package"] + ".model;\n\n\n")
model_file.write("public class " + entity_name + "{\n\n")
model_file.write("public1 class " + entity_name + "{\n\n")
for key, val in file_hash["params"].items():
self.get_set_entity(model_file, key, val)
model_file.write("}\n")
......
......@@ -55,9 +55,9 @@
<tr width="600">
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0分9</td>
<td class="details-col-elapsed">100.0%</td>
<td class='details-col-elapsed'>0</td>
<td class='details-col-elapsed'>0分0</td>
<td class="details-col-elapsed">0.0%</td>
</tr>
</table>
......@@ -73,8 +73,8 @@
<tr width="600">
<td class="details-col-elapsed"><a href='../log/a_a7流程五_中心库入库结算_正结算3_内网验收入库结算/log.html' target='_blank'>a_a7流程五_中心库入库结算_正结算3_内网验收入库结算</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">9.54</td>
<td class="fail">失败</td>
<td class="details-col-elapsed">0.167</td>
<td class="details-col-elapsed">xiaohesheng</td>
</tr>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment