From 6b23fc4c9dbc66dfe56c76bd46e95075a54e9bd0 Mon Sep 17 00:00:00 2001 From: zouxk Date: Thu, 26 Dec 2019 13:18:58 +0800 Subject: [PATCH] =?UTF-8?q?jd=5Fsignoff=E6=9B=B4=E6=94=B9=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E5=8F=82=E6=95=B0=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HEZON_ITK/jd_clear_field.cpp | 57 ++++++++++------- HEZON_ITK/jd_signoff.cpp | 116 ++++++++++++++++++----------------- 2 files changed, 94 insertions(+), 79 deletions(-) diff --git a/HEZON_ITK/jd_clear_field.cpp b/HEZON_ITK/jd_clear_field.cpp index 3cf44e2..a4a7d8d 100644 --- a/HEZON_ITK/jd_clear_field.cpp +++ b/HEZON_ITK/jd_clear_field.cpp @@ -198,23 +198,25 @@ extern "C" { 映射 -path 路径 -name 用户名 - -step 流程阶段: 编制:49,校对:50,审核:51,会签:52,批准:53 */ - static int sign(JNIEnv* env, jclass class_Test, const char* path, char* name, int step) { + static int sign(JNIEnv* env, jclass class_Test, const char* path, char* name, char* sign_location, char* sign_str) { printf("signin\n"); - jmethodID methodId_main = env->GetStaticMethodID(class_Test, "sign", "(Ljava/lang/String;Ljava/lang/String;I)I"); + jmethodID methodId_main = env->GetStaticMethodID(class_Test, "sign", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String)I"); if (methodId_main == NULL) { printf("error\n"); return 0; } string path1 = GBKToUTF8(path); string name1 = GBKToUTF8(name); + string sign_location1 = GBKToUTF8(sign_location); + string sign_str1 = GBKToUTF8(sign_str); jstring jpath = env->NewStringUTF(path1.c_str()); jstring jname = env->NewStringUTF(name1.c_str()); - jint jstep = (jint)step; - printf("path:%s,name%s,step%d\n", path1.c_str(), name1.c_str(), step); + jstring jsign_location = env->NewStringUTF(sign_location1.c_str()); + jstring jsign_str = env->NewStringUTF(sign_str1.c_str()); + printf("path:%s,name:%s,sign_location:%s\n,sign_str:%s\n", path1.c_str(), name1.c_str(), sign_location1.c_str(), sign_str1.c_str()); jint result = 0; - result = env->CallStaticIntMethod(class_Test, methodId_main, jpath, jname, jstep); + result = env->CallStaticIntMethod(class_Test, methodId_main, jpath, jname, jsign_location, jsign_str); int res = result; printf("result:%d\n", res); printf("signout\n"); @@ -239,9 +241,11 @@ extern "C" { int JD_clear(METHOD_message_t* msg, va_list args, tag_t new_rev) { printf("升版执行\n"); //获取数据集 - char *temp_path, *attach_type; - int n_attachs; + const char *sign_location1, *sign_str; + char *temp_path, *attach_type,*prop,**pref_values1; + int n_attachs, pref_count1; tag_t ref_obj, excelx_tag, excel_tag, wordx_tag, word_tag, type_tag, word_ref, excel_ref, *dataset; + stringstream sign_date; ITEM_attached_object_t *rev_attachments; AE_reference_type_t ae_ref; TCTYPE_find_type("MSExcelX", "Dataset", &excelx_tag); @@ -348,19 +352,28 @@ extern "C" { ITKCALL(AOM_ask_value_tags(new_rev, "IMAN_master_form_rev", &objects_count, &objects)); + + PREF_ask_char_values("jd2_signoff_list", &pref_count1, &pref_values1); + stringstream temps; + for (int i = 0;i < pref_count1;i++) { + temps << pref_values1[i]; + temps << ","; + } + sign_str = temps.str().c_str(); //表单签名 for (auto iii = 0; iii < objects_count; iii++) { AOM_lock(objects[iii]); - AOM_set_value_string(objects[iii], "jd2_bz", ""); - AOM_set_value_string(objects[iii], "jd2_bzrq", ""); - AOM_set_value_string(objects[iii], "jd2_jd", ""); - AOM_set_value_string(objects[iii], "jd2_jdrq", ""); - AOM_set_value_string(objects[iii], "jd2_sh", ""); - AOM_set_value_string(objects[iii], "jd2_shrq", ""); - AOM_set_value_string(objects[iii], "jd2_hq", ""); - AOM_set_value_string(objects[iii], "jd2_hqrq", ""); - AOM_set_value_string(objects[iii], "jd2_pz", ""); - AOM_set_value_string(objects[iii], "jd2_pzrq", ""); + for (int i = 0;i < pref_count1;i++) { + sign_date.str(""); + sign_date << pref_values1[i]; + sign_date << "rq"; + AOM_ask_value_string(objects[iii], pref_values1[i], &prop); + if (tc_strlen(prop) != 0) { + AOM_set_value_string(objects[iii], pref_values1[i], ""); + AOM_set_value_string(objects[iii], sign_date.str().c_str(), ""); + } + } + printf("sign clear\n"); ITKCALL(AOM_save(objects[iii])); AOM_unlock(objects[iii]); } @@ -398,13 +411,13 @@ extern "C" { printf("file_type:%d\n", file_type); if (file_type == 0) { class_Test = env->FindClass("sign2file/SignToWord"); - int res = sign(env, class_Test, ss.str().c_str(), "", 54); + int res = sign(env, class_Test, ss.str().c_str(), "", "clear", (char*)sign_str); if (res) { replace_dataset_named_reference(dataset[i], word_ref, ss.str().c_str(), "word"); } } else if (file_type == 1) { class_Test = env->FindClass("sign2file/SignToExcel"); - int res = sign(env, class_Test, ss.str().c_str(), "", 54); + int res = sign(env, class_Test, ss.str().c_str(), "", "clear", (char*)sign_str); if (res) { replace_dataset_named_reference(dataset[i], excel_ref, ss.str().c_str(), "excel"); } @@ -442,13 +455,13 @@ extern "C" { printf("file_type:%d\n", file_type); if (file_type == 0) { class_Test = env->FindClass("sign2file/SignToWord"); - int res = sign(env, class_Test, ss.str().c_str(), "", 54); + int res = sign(env, class_Test, ss.str().c_str(), "", "clear", (char*)sign_str); if (res) { replace_dataset_named_reference(dataset[i], word_ref, ss.str().c_str(), "word"); } } else if (file_type == 1) { class_Test = env->FindClass("sign2file/SignToExcel"); - int res = sign(env, class_Test, ss.str().c_str(), "", 54); + int res = sign(env, class_Test, ss.str().c_str(), "", "clear", (char*)sign_str); if (res) { replace_dataset_named_reference(dataset[i], excel_ref, ss.str().c_str(), "excel"); } diff --git a/HEZON_ITK/jd_signoff.cpp b/HEZON_ITK/jd_signoff.cpp index 5c70ac8..1da2d4f 100644 --- a/HEZON_ITK/jd_signoff.cpp +++ b/HEZON_ITK/jd_signoff.cpp @@ -159,23 +159,25 @@ string GBKToUTF8(const char* strGBK) 映射 -path 路径 -name 用户名 --step 流程阶段: 编制:49,校对:50,审核:51,会签:52,批准:53 */ -static int sign(JNIEnv* env, jclass class_Test,const char* path, char* name, int step) { +static int sign(JNIEnv* env, jclass class_Test,const char* path, char* name, char* sign_location, char* sign_str) { printf("signin\n"); - jmethodID methodId_main = env->GetStaticMethodID(class_Test, "sign", "(Ljava/lang/String;Ljava/lang/String;I)I"); + jmethodID methodId_main = env->GetStaticMethodID(class_Test, "sign", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String)I"); if (methodId_main==NULL) { printf("error\n"); return 0; } string path1 = GBKToUTF8(path); string name1 = GBKToUTF8(name); + string sign_location1= GBKToUTF8(sign_location); + string sign_str1 = GBKToUTF8(sign_str); jstring jpath = env->NewStringUTF(path1.c_str()); jstring jname = env->NewStringUTF(name1.c_str()); - jint jstep = (jint)step; - printf("path:%s,name%s,step%d\n", path1.c_str(), name1.c_str(),step); + jstring jsign_location = env->NewStringUTF(sign_location1.c_str()); + jstring jsign_str = env->NewStringUTF(sign_str1.c_str()); + printf("path:%s,name:%s,sign_location:%s\n,sign_str:%s\n", path1.c_str(), name1.c_str(), sign_location1.c_str(),sign_str1.c_str()); jint result = 0; - result = env->CallStaticIntMethod(class_Test, methodId_main, jpath, jname, jstep); + result = env->CallStaticIntMethod(class_Test, methodId_main, jpath, jname, jsign_location, jsign_str); int res = result; printf("result:%d\n", res); printf("signout\n"); @@ -201,12 +203,14 @@ void add_path(JNIEnv* env, const std::string& path) //吉德表单签名 int jd_signoff(EPM_action_message_t msg) { - const char bz = '1', jd = '2', sh = '3', hq = '4', pz = '5', bz_back = '0', clear='6'; + const char *sign_location, *sign_str; - int ifail = ITK_ok, att_count, objects_count, step; + int ifail = ITK_ok, att_count, objects_count,pref_count; tag_t rootTask, *attachments, user_tag, *objects; - char *user_name; + char *user_name,**pref_values, *prop; logical verdict; + bool flag; + stringstream sign_date; //获取时间 time_t t; time(&t); @@ -252,7 +256,31 @@ int jd_signoff(EPM_action_message_t msg) { ITK_ask_argument_named_value(TC_next_argument(arguments), &temp_key, &temp_val); paras[temp_key] = temp_val; } - step = paras["step"].c_str()[0]; + sign_location = paras["sign_location"].c_str(); + printf("sign_location:%s\n", sign_location); + + sign_date << sign_location; + sign_date << "rq"; + + //读取首选项 + PREF_ask_char_values("jd2_signoff_list", &pref_count, &pref_values); + flag = false; + stringstream temps; + for (int i = 0;i < pref_count;i++) { + printf("signoff:%s\n", pref_values[i]); + temps << pref_values[i]; + temps << ","; + if (strcmp(pref_values[i], sign_location)==0) { + flag = true; + } + } + if (strcmp("clear", sign_location)==0) { + flag = true; + } + if (!flag) { + return -1; + } + sign_str = temps.str().c_str(); //创建tc_export目录 stringstream dir; @@ -365,7 +393,6 @@ int jd_signoff(EPM_action_message_t msg) { jclass class_Test; int file_type = -1; - printf("step:%d\n", step); printf("user_name:%s\n", user_name); printf("date:%s\n", date.str().c_str()); @@ -374,50 +401,25 @@ int jd_signoff(EPM_action_message_t msg) { ITKCALL(AOM_ask_value_tags(attachments[ii], "IMAN_master_form_rev", &objects_count, &objects)); //表单签名 for (auto iii = 0; iii < objects_count; iii++) { - printf("step:%c\n",step); AOM_lock(objects[iii]); - switch (step) { - case bz: - AOM_set_value_string(objects[iii], "jd2_bz", user_name); - AOM_set_value_string(objects[iii], "jd2_bzrq", date.str().c_str()); - printf("bz signoff\n"); - break; - case jd: - AOM_set_value_string(objects[iii], "jd2_jd", user_name); - AOM_set_value_string(objects[iii], "jd2_jdrq", date.str().c_str()); - printf("jd signoff\n"); - break; - case sh: - AOM_set_value_string(objects[iii], "jd2_sh", user_name); - AOM_set_value_string(objects[iii], "jd2_shrq", date.str().c_str()); - printf("sh signoff\n"); - break; - case hq: - AOM_set_value_string(objects[iii], "jd2_hq", user_name); - AOM_set_value_string(objects[iii], "jd2_hqrq", date.str().c_str()); - printf("hq signoff\n"); - break; - case pz: - AOM_set_value_string(objects[iii], "jd2_pz", user_name); - AOM_set_value_string(objects[iii], "jd2_pzrq", date.str().c_str()); - printf("pz signoff\n"); - break; - case clear: - AOM_set_value_string(objects[iii], "jd2_bz", ""); - AOM_set_value_string(objects[iii], "jd2_bzrq", ""); - printf("clear signoff\n"); - case bz_back: - AOM_set_value_string(objects[iii], "jd2_jd", ""); - AOM_set_value_string(objects[iii], "jd2_jdrq", ""); - AOM_set_value_string(objects[iii], "jd2_sh", ""); - AOM_set_value_string(objects[iii], "jd2_shrq", ""); - AOM_set_value_string(objects[iii], "jd2_hq", ""); - AOM_set_value_string(objects[iii], "jd2_hqrq", ""); - AOM_set_value_string(objects[iii], "jd2_pz", ""); - AOM_set_value_string(objects[iii], "jd2_pzrq", ""); - printf("bz_back signoff\n"); - break; + if (strcmp("clear",sign_location)==0) { + for (int i = 0;i < pref_count;i++) { + sign_date.str(""); + sign_date << pref_values[i]; + sign_date << "rq"; + AOM_ask_value_string(attachments[ii], pref_values[i], &prop); + if (tc_strlen(prop)!=0) { + AOM_set_value_string(objects[iii], pref_values[i], ""); + AOM_set_value_string(objects[iii], sign_date.str().c_str(), ""); + } + } + printf("sign clear\n"); + } else { + AOM_set_value_string(objects[iii], sign_location, user_name); + AOM_set_value_string(objects[iii], sign_date.str().c_str(), date.str().c_str()); + printf("%s,%s signoff\n", sign_location, sign_date.str().c_str()); } + ITKCALL(AOM_save(objects[iii])); AOM_unlock(objects[iii]); } @@ -455,13 +457,13 @@ int jd_signoff(EPM_action_message_t msg) { printf("file_type:%d\n", file_type); if (file_type == 0) { class_Test = env->FindClass("sign2file/SignToWord"); - int res = sign(env, class_Test, ss.str().c_str(), user_name, step); + int res = sign(env, class_Test, ss.str().c_str(), user_name, (char*)sign_location, (char*)sign_str); if (res) { replace_dataset_named_reference(dataset[i], word_ref, ss.str().c_str(), "word"); } } else if (file_type == 1) { class_Test = env->FindClass("sign2file/SignToExcel"); - int res = sign(env, class_Test, ss.str().c_str(), user_name, step); + int res = sign(env, class_Test, ss.str().c_str(), user_name, (char*)sign_location, (char*)sign_str); if (res) { replace_dataset_named_reference(dataset[i], excel_ref, ss.str().c_str(), "excel"); } @@ -499,13 +501,13 @@ int jd_signoff(EPM_action_message_t msg) { printf("file_type:%d\n", file_type); if (file_type == 0) { class_Test = env->FindClass("sign2file/SignToWord"); - int res = sign(env, class_Test, ss.str().c_str(), user_name, step); + int res = sign(env, class_Test, ss.str().c_str(), user_name, (char*)sign_location, (char*)sign_str); if (res) { replace_dataset_named_reference(dataset[i], word_ref, ss.str().c_str(), "word"); } } else if (file_type == 1) { class_Test = env->FindClass("sign2file/SignToExcel"); - int res = sign(env, class_Test, ss.str().c_str(), user_name, step); + int res = sign(env, class_Test, ss.str().c_str(), user_name, (char*)sign_location, (char*)sign_str); if (res) { replace_dataset_named_reference(dataset[i], excel_ref, ss.str().c_str(), "excel"); }