@ -2188,12 +2188,23 @@ public class ZbdcModel {
if ( org_type_id = = 9 | | org_type_id = = 16 ) { //市直属中小学,区属中小学
report_level = 1 ; //是学校上报的
}
//是不是退回重新提交?
int is_tuihui_commit = 0 ; //默认不是退回重新提交
sql = "select check_type_id from t_zbdc_report where year=? and b_use=1 and bureau_id=?" ;
Record r = Db . findFirst ( sql , year , bureau_id ) ;
if ( r ! = null & & r . getInt ( "check_type_id" ) = = - 1 ) {
is_tuihui_commit = 1 ; //确认是退回重新提交的数据
}
//以前的都修改为不是当前状态,现在是全新上报
sql = "update t_zbdc_report set b_use=0 where bureau_id=? and year=?" ;
Db . update ( sql , bureau_id , year ) ;
//插入数据
sql = "insert into t_zbdc_report(bureau_id,bureau_name,year,area_id,area_name,report_level,update_ts,b_use,check_type_id) values(?,?,?,?,?,?,now(),1,2)" ;
Db . update ( sql , bureau_id , bureau_name , year , area_id , area_name , report_level ) ;
sql = "insert into t_zbdc_report(bureau_id,bureau_name,year,area_id,area_name,report_level,update_ts,b_use,check_type_id,is_tuihui_commit) values(?,?,?,?,?,?,now(),1,2,?)" ;
Db . update ( sql , bureau_id , bureau_name , year , area_id , area_name , report_level , is_tuihui_commit ) ;
}
/ * *
@ -2339,4 +2350,62 @@ public class ZbdcModel {
return jo ;
}
/ * *
* 功 能 : 根 据 单 位 ID 获 取 区 域 的 ID
*
* @param burea_id
* @return
* /
public String getAreaByBureauId ( String burea_id ) {
String sql = "select area_id from t_base_organization where org_id=?" ;
return Db . findFirst ( sql , burea_id ) . getStr ( "area_id" ) ;
}
/ * *
* 功 能 : 查 看 审 核 上 报 详 细 日 志 ( 区 域 )
* /
public Record CheckViewByArea ( int year , String area_id ) {
Record record = new Record ( ) ;
record . set ( "name" , year + "年装备信息" ) ;
//状态
String sql = "select check_type_id from t_zbdc_report where year=? and area_id=? and b_use=1 and report_level=2" ;
Record r = Db . findFirst ( sql , year , area_id ) ;
if ( r = = null ) { //如果不存在上报记录
record . set ( "check_type_id" , 0 ) ;
record . set ( "check_type_name" , "待上报" ) ;
} else {
int check_type_id = r . getInt ( "check_type_id" ) ;
record . set ( "check_type_id" , check_type_id ) ;
if ( check_type_id = = 1 ) {
record . set ( "check_type_name" , "通过" ) ;
} else if ( check_type_id = = - 1 ) {
record . set ( "check_type_name" , "退回" ) ;
} else if ( check_type_id = = 2 ) {
record . set ( "check_type_name" , "待审核" ) ;
}
}
//应提交数量
sql = "select count(1) as c from t_base_organization where area_id=? and org_id=bureau_id and org_type_id=16 and b_use=1" ;
int c = Db . findFirst ( sql , area_id ) . getInt ( "c" ) ;
record . set ( "yingtijiao_count" , c ) ;
//已提交数量
sql = "select count(1) as c from t_zbdc_report where year=? and area_id=? and report_level=1 and b_use=1 and check_type_id=2" ;
c = Db . findFirst ( sql , year , area_id ) . getInt ( "c" ) ;
record . set ( "yitijiao_count" , c ) ;
//退回未提交数
sql = "select count(1) as c from t_zbdc_report where year=? and area_id=? and report_level=1 and b_use=1 and check_type_id=-1" ;
c = Db . findFirst ( sql , year , area_id ) . getInt ( "c" ) ;
record . set ( "tuihuiweitijiao_count" , c ) ;
//退回已提交数
sql = "select count(1) as c from t_zbdc_report where year=? and area_id=? and report_level=1 and b_use=1 and check_type_id=2 and is_tuihui_commit=1" ;
c = Db . findFirst ( sql , year , area_id ) . getInt ( "c" ) ;
record . set ( "tuihui_commit_count" , c ) ;
//未提交数量
int weitijiao_count = record . getInt ( "yingtijiao_count" ) - record . getInt ( "yitijiao_count" ) - record . getInt ( "tuihuiweitijiao_count" ) ;
record . set ( "weitijiao_count" , weitijiao_count ) ;
return record ;
}
}