---1.创建报送情况表

create table UR_SYS_SUBMIT(
  DW_ID       	  VARCHAR2(50) 	   not null,
  PERD_CODE   	  VARCHAR2(8) 	 not null,
  TASK_ID    	  VARCHAR2(50),    
  RPT_ID       	  VARCHAR2(50),
  STATUS      	  VARCHAR2(1),
  RPT_USER_ID 	  VARCHAR2(50),
  RPT_DATE DATE,

  constraint PK_UR_SYS_SUBMIT PRIMARY KEY(DW_ID,PERD_CODE)
);


---2.增加系统参数（OPT_VALUE为 1.仅末级上报，0.逐级上报）

  insert into ur_sys_opt (OPT_CODE, USER_ID, OPT_NAME, OPT_VALUE)
  values ('DW_SUBMIT_LOWEST', '*', '仅允许末级单位上报数据', '0');

---3. 创建视图，查询有业务数据的单位

create or replace view v_ur_task_dw_code1 as
select dw.dw_id dw_id ,dw.dw_code dw_code ,dw.dw_name dw_name ,dw.l_code l_code ,dw.p_code p_code from ur_sys_dw dw  
where  exists  ( select 1 from  (select dw.dw_code dw_code from ur_sys_dw dw , ur_task_dw t
       where  dw.dw_id = t.dw_id) a
         where a.dw_code like dw.dw_code||'%'  );
       

---门户信息，文章类别  2012-3-31 

delete UR_BA_DOC_TYPE where DOC_TYPE in ('notes','news','policy','areaState','coState');

insert into UR_BA_DOC_TYPE (DOC_TYPE, DOC_TYPE_NAME, DISP_NO)
values ('notes', '通知公告', 3);

insert into UR_BA_DOC_TYPE (DOC_TYPE, DOC_TYPE_NAME, DISP_NO)
values ('news', '工作动态', 1);

insert into UR_BA_DOC_TYPE (DOC_TYPE, DOC_TYPE_NAME, DISP_NO)
values ('policy', '政策法规', 2);

insert into UR_BA_DOC_TYPE (DOC_TYPE, DOC_TYPE_NAME, DISP_NO)
values ('areaState', '上报指南', 4);

insert into UR_BA_DOC_TYPE (DOC_TYPE, DOC_TYPE_NAME, DISP_NO)
values ('coState', '下载专区', 5);


----修改枚举条目

update ur_sys_dict_val t set enum_name='工作动态' where t.enum_code='news' and t.dict_id='SYS_DOC_TYPE';---原为新闻动态
update ur_sys_dict_val t set enum_name='上报指南' where t.enum_code='areaState' and t.dict_id='SYS_DOC_TYPE';--原为申报指南
update ur_sys_dict_val t set enum_name='通知公告' where t.enum_code='notes' and t.dict_id='SYS_DOC_TYPE';--原为公告通知

update dim_zwtb_date set date_e = '2012-03-31' where date_id = '20120103';

------在地方政府性债务季报表中增加参数 2012年4-6月
insert into dim_zwtb_date (DATE_ID, DATE_CODE, DATE_NAME, DATE_YEAR, DATE_MONTH, DATE_S, DATE_E, IS_DELETE, DATE_PERIOD)
values ('20120406', '20120630', '2012年04-06月份', '2012Y', '201206M', '2012-04-01', '2012-06-30', '1', '2012-04_2012-06');

update ur_sys_opt set opt_value = 'gdms1.10.10' where opt_code = 'VERSION';

insert into ur_sys_dict_val (VER_ID, ENUM_ID, DICT_ID, ENUM_CODE, ENUM_NAME, P_CODE, L_CODE, IS_END, CAN_EXTEND, DW_ID, IS_USED)
values ('*', '150F1A6E74804B67AFA309A1B6A91781', '99F5A6123C9645F8BBBC717DFE6D2DB8', '2012-02-29', '2012年02月份', '', '0005', '1', '0', '*', '');

insert into ur_sys_dict_val (VER_ID, ENUM_ID, DICT_ID, ENUM_CODE, ENUM_NAME, P_CODE, L_CODE, IS_END, CAN_EXTEND, DW_ID, IS_USED)
values ('*', '084A344935524CF1AEC03F1195D257B5', '99F5A6123C9645F8BBBC717DFE6D2DB8', '2012-01-31', '2012年01月份', '', '0006', '1', '0', '*', '');

insert into ur_sys_dict_val (VER_ID, ENUM_ID, DICT_ID, ENUM_CODE, ENUM_NAME, P_CODE, L_CODE, IS_END, CAN_EXTEND, DW_ID, IS_USED)
values ('*', '307344603FE1428CAC62075900CDF6DE', '99F5A6123C9645F8BBBC717DFE6D2DB8', '2011-12-31', '2011年四季度', '', '0007', '1', '0', '*', '');

insert into ur_sys_dict_val (VER_ID, ENUM_ID, DICT_ID, ENUM_CODE, ENUM_NAME, P_CODE, L_CODE, IS_END, CAN_EXTEND, DW_ID, IS_USED)
values ('*', '5BFF5F2A5F7F4CDCA3D76140D12E6503', '99F5A6123C9645F8BBBC717DFE6D2DB8', '2011-09-30', '2011年三季度', '', '0008', '1', '0', '*', '');

insert into ur_sys_dict_val (VER_ID, ENUM_ID, DICT_ID, ENUM_CODE, ENUM_NAME, P_CODE, L_CODE, IS_END, CAN_EXTEND, DW_ID, IS_USED)
values ('*', '6A27DDEB9D0C4C5993FEFCD96B4E4FFD', '99F5A6123C9645F8BBBC717DFE6D2DB8', '2011-06-30', '2011年二季度', '', '0009', '1', '0', '*', '');

insert into ur_sys_dict_val (VER_ID, ENUM_ID, DICT_ID, ENUM_CODE, ENUM_NAME, P_CODE, L_CODE, IS_END, CAN_EXTEND, DW_ID, IS_USED)
values ('*', '688F63558BB04E59AB7484508465E9BD', '99F5A6123C9645F8BBBC717DFE6D2DB8', '2011-03-31', '2011年一季度', '', '0010', '1', '0', '*', '');

insert into dim_zwtb_date (DATE_ID, DATE_CODE, DATE_NAME, DATE_YEAR, DATE_MONTH, DATE_S, DATE_E, IS_DELETE, DATE_PERIOD)
values ('20120112', '20121231', '2012年01-12月份', '2012Y', '201212M', '2012-01-01', '2012-12-31', '0', '2012-01_2012-12');

insert into dim_zwtb_date (DATE_ID, DATE_CODE, DATE_NAME, DATE_YEAR, DATE_MONTH, DATE_S, DATE_E, IS_DELETE, DATE_PERIOD)
values ('20120406', '20120630', '2012年04-06月份', '2012Y', '201206M', '2012-04-01', '2012-06-30', '1', '2012-04_2012-06');

insert into dim_zwtb_date (DATE_ID, DATE_CODE, DATE_NAME, DATE_YEAR, DATE_MONTH, DATE_S, DATE_E, IS_DELETE, DATE_PERIOD)
values ('20120709', '20120930', '2012年07-09月份', '2012Y', '201209M', '2012-07-01', '2012-09-30', '1', '2012-07_2012-09');

insert into dim_zwtb_date (DATE_ID, DATE_CODE, DATE_NAME, DATE_YEAR, DATE_MONTH, DATE_S, DATE_E, IS_DELETE, DATE_PERIOD)
values ('20121012', '20121231', '2012年10-12月份', '2012Y', '201212M', '2012-10-01', '2012-12-31', '1', '2012-10_2012-12');
