...
This commit is contained in:
parent
99ad1a491d
commit
cd181674e9
221
代码/数据库/oracle/pkg/data_import_util_pkg.pck
Normal file
221
代码/数据库/oracle/pkg/data_import_util_pkg.pck
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
CREATE OR REPLACE PACKAGE data_import_util_pkg IS
|
||||||
|
|
||||||
|
-- Author : WANGKANE
|
||||||
|
-- Created : 2019/12/28 11:33:02
|
||||||
|
-- Purpose : 数据导入工具
|
||||||
|
|
||||||
|
--定义异常
|
||||||
|
no_cardealer_code_excpt CONSTANT INTEGER := -20000;
|
||||||
|
no_cardealer_code_message CONSTANT VARCHAR2(100) := '缺少车商代码。';
|
||||||
|
|
||||||
|
PROCEDURE import_cardealer_achvmnt
|
||||||
|
(
|
||||||
|
a_the_year IN VARCHAR2,
|
||||||
|
a_the_month IN VARCHAR2,
|
||||||
|
a_car_dealer_code IN VARCHAR2,
|
||||||
|
a_checked_achievement IN NUMBER,
|
||||||
|
a_policy_amount IN INTEGER,
|
||||||
|
a_cpic_amount IN INTEGER,
|
||||||
|
a_picc_amount IN INTEGER,
|
||||||
|
a_pingan_amount IN INTEGER,
|
||||||
|
a_others_amount IN INTEGER
|
||||||
|
);
|
||||||
|
|
||||||
|
PROCEDURE import_repairing_order
|
||||||
|
(
|
||||||
|
a_branch_name VARCHAR2,
|
||||||
|
a_order_no VARCHAR2,
|
||||||
|
a_order_type VARCHAR2,
|
||||||
|
a_notify_no VARCHAR2,
|
||||||
|
a_damage_area VARCHAR2,
|
||||||
|
a_damage_date DATE,
|
||||||
|
a_generating_date DATE,
|
||||||
|
a_policy_no VARCHAR2,
|
||||||
|
a_policy_no_jqx VARCHAR2,
|
||||||
|
a_plate_number VARCHAR2,
|
||||||
|
a_brand_name VARCHAR2,
|
||||||
|
a_is_insurance_object VARCHAR2,
|
||||||
|
a_is_success VARCHAR2,
|
||||||
|
a_recommend_dealer_code VARCHAR2,
|
||||||
|
a_recommend_dealer_name VARCHAR2,
|
||||||
|
a_recomm_dealer_code_in_notify VARCHAR2,
|
||||||
|
a_recomm_dealer_name_in_notify VARCHAR2,
|
||||||
|
a_recomm_dealer_name_in_survey VARCHAR2,
|
||||||
|
a_agent_name VARCHAR2,
|
||||||
|
a_surveyor VARCHAR2,
|
||||||
|
a_check_date DATE,
|
||||||
|
a_repairing_start_date DATE,
|
||||||
|
a_repairing_finish_date DATE,
|
||||||
|
a_status VARCHAR2,
|
||||||
|
a_lost_item_id VARCHAR2,
|
||||||
|
a_surveyor_recomm_status VARCHAR2
|
||||||
|
);
|
||||||
|
|
||||||
|
END data_import_util_pkg;
|
||||||
|
/
|
||||||
|
CREATE OR REPLACE PACKAGE BODY data_import_util_pkg IS
|
||||||
|
|
||||||
|
PROCEDURE import_cardealer_achvmnt
|
||||||
|
(
|
||||||
|
a_the_year IN VARCHAR2,
|
||||||
|
a_the_month IN VARCHAR2,
|
||||||
|
a_car_dealer_code IN VARCHAR2,
|
||||||
|
a_checked_achievement IN NUMBER,
|
||||||
|
a_policy_amount IN INTEGER,
|
||||||
|
a_cpic_amount IN INTEGER,
|
||||||
|
a_picc_amount IN INTEGER,
|
||||||
|
a_pingan_amount IN INTEGER,
|
||||||
|
a_others_amount IN INTEGER
|
||||||
|
) IS
|
||||||
|
BEGIN
|
||||||
|
--防御性验证
|
||||||
|
IF a_car_dealer_code IS NULL
|
||||||
|
THEN
|
||||||
|
raise_application_error(no_cardealer_code_excpt, no_cardealer_code_message);
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
--先删除旧数据
|
||||||
|
BEGIN
|
||||||
|
DELETE car_dealer.car_dealer_achievement
|
||||||
|
WHERE the_year = a_the_year
|
||||||
|
AND the_month = a_the_month
|
||||||
|
AND car_dealer_code = a_car_dealer_code;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN OTHERS THEN
|
||||||
|
NULL;
|
||||||
|
END;
|
||||||
|
|
||||||
|
--插入数据
|
||||||
|
INSERT INTO car_dealer.car_dealer_achievement
|
||||||
|
(the_year,
|
||||||
|
the_month,
|
||||||
|
car_dealer_code,
|
||||||
|
checked_achievement,
|
||||||
|
policy_amount,
|
||||||
|
cpic_amount,
|
||||||
|
picc_amount,
|
||||||
|
pingan_amount,
|
||||||
|
others_amount)
|
||||||
|
VALUES
|
||||||
|
(a_the_year,
|
||||||
|
a_the_month,
|
||||||
|
a_car_dealer_code,
|
||||||
|
a_checked_achievement,
|
||||||
|
a_policy_amount,
|
||||||
|
a_cpic_amount,
|
||||||
|
a_picc_amount,
|
||||||
|
a_pingan_amount,
|
||||||
|
a_others_amount);
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
END;
|
||||||
|
|
||||||
|
PROCEDURE import_repairing_order
|
||||||
|
(
|
||||||
|
a_branch_name VARCHAR2,
|
||||||
|
a_order_no VARCHAR2,
|
||||||
|
a_order_type VARCHAR2,
|
||||||
|
a_notify_no VARCHAR2,
|
||||||
|
a_damage_area VARCHAR2,
|
||||||
|
a_damage_date DATE,
|
||||||
|
a_generating_date DATE,
|
||||||
|
a_policy_no VARCHAR2,
|
||||||
|
a_policy_no_jqx VARCHAR2,
|
||||||
|
a_plate_number VARCHAR2,
|
||||||
|
a_brand_name VARCHAR2,
|
||||||
|
a_is_insurance_object VARCHAR2,
|
||||||
|
a_is_success VARCHAR2,
|
||||||
|
a_recommend_dealer_code VARCHAR2,
|
||||||
|
a_recommend_dealer_name VARCHAR2,
|
||||||
|
a_recomm_dealer_code_in_notify VARCHAR2,
|
||||||
|
a_recomm_dealer_name_in_notify VARCHAR2,
|
||||||
|
a_recomm_dealer_name_in_survey VARCHAR2,
|
||||||
|
a_agent_name VARCHAR2,
|
||||||
|
a_surveyor VARCHAR2,
|
||||||
|
a_check_date DATE,
|
||||||
|
a_repairing_start_date DATE,
|
||||||
|
a_repairing_finish_date DATE,
|
||||||
|
a_status VARCHAR2,
|
||||||
|
a_lost_item_id VARCHAR2,
|
||||||
|
a_surveyor_recomm_status VARCHAR2
|
||||||
|
) IS
|
||||||
|
BEGIN
|
||||||
|
--防御性验证
|
||||||
|
IF a_order_no IS NULL
|
||||||
|
THEN
|
||||||
|
raise_application_error(no_cardealer_code_excpt, no_cardealer_code_message);
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
--先删除旧数据
|
||||||
|
BEGIN
|
||||||
|
DELETE car_dealer.repair_order_info a WHERE a_order_no = a.order_no;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN OTHERS THEN
|
||||||
|
NULL;
|
||||||
|
END;
|
||||||
|
|
||||||
|
--写入数据
|
||||||
|
INSERT INTO repair_order_info
|
||||||
|
(branch_name,
|
||||||
|
order_no,
|
||||||
|
order_type,
|
||||||
|
notify_no,
|
||||||
|
damage_area,
|
||||||
|
damage_date,
|
||||||
|
generating_date,
|
||||||
|
policy_no,
|
||||||
|
policy_no_jqx,
|
||||||
|
plate_number,
|
||||||
|
brand_name,
|
||||||
|
is_insurance_object,
|
||||||
|
is_success,
|
||||||
|
recommend_dealer_code,
|
||||||
|
recommend_dealer_name,
|
||||||
|
recomm_dealer_code_in_notify,
|
||||||
|
recomm_dealer_name_in_notify,
|
||||||
|
recomm_dealer_name_in_survey,
|
||||||
|
agent_name,
|
||||||
|
surveyor,
|
||||||
|
check_date,
|
||||||
|
repairing_start_date,
|
||||||
|
repairing_finish_date,
|
||||||
|
status,
|
||||||
|
lost_item_id,
|
||||||
|
surveyor_recomm_status)
|
||||||
|
VALUES
|
||||||
|
(a_branch_name,
|
||||||
|
a_order_no,
|
||||||
|
a_order_type,
|
||||||
|
a_notify_no,
|
||||||
|
a_damage_area,
|
||||||
|
a_damage_date,
|
||||||
|
a_generating_date,
|
||||||
|
a_policy_no,
|
||||||
|
a_policy_no_jqx,
|
||||||
|
a_plate_number,
|
||||||
|
a_brand_name,
|
||||||
|
a_is_insurance_object,
|
||||||
|
a_is_success,
|
||||||
|
a_recommend_dealer_code,
|
||||||
|
a_recommend_dealer_name,
|
||||||
|
a_recomm_dealer_code_in_notify,
|
||||||
|
a_recomm_dealer_name_in_notify,
|
||||||
|
a_recomm_dealer_name_in_survey,
|
||||||
|
a_agent_name,
|
||||||
|
a_surveyor,
|
||||||
|
a_check_date,
|
||||||
|
a_repairing_start_date,
|
||||||
|
a_repairing_finish_date,
|
||||||
|
a_status,
|
||||||
|
a_lost_item_id,
|
||||||
|
a_surveyor_recomm_status);
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
END;
|
||||||
|
|
||||||
|
BEGIN
|
||||||
|
-- Initialization
|
||||||
|
NULL;
|
||||||
|
END data_import_util_pkg;
|
||||||
|
/
|
Loading…
x
Reference in New Issue
Block a user