@ -99,16 +99,18 @@ public class VerificationModel {
* /
* /
public int insertVerificationRecord ( int module_id , int business_id ) {
public int insertVerificationRecord ( int module_id , int business_id ) {
//(1)检查这个模块中的此业务ID是否存在, 如果不存在, 则全新创建, 如果存在, 则添加下一条
//(1)检查这个模块中的此业务ID是否存在, 如果不存在, 则全新创建, 如果存在, 则添加下一条
String sql = "select ifnull(max(step_id),0) as step_id,verification_status as verificationStatus from t_verification_record where module_id=? and business_id=? order by record_id desc";
String sql = "select ifnull(max(step_id),0) as step_id,ifnull( verification_status,0) as verificationStatus from t_verification_record where module_id=? and business_id=? order by record_id desc";
List < Record > list = Db . find ( sql , module_id , business_id ) ;
List < Record > list = Db . find ( sql , module_id , business_id ) ;
String verificationSql = "select verification_status as verificationStatus from t_verification_record where module_id=? and business_id=? order by record_id desc" ;
List < Record > verificationList = Db . find ( verificationSql , module_id , business_id ) ;
//如果存在旧的,表示是被拒绝后,重新创建一条审核记录
if ( list . size ( ) > 0 ) {
int step_id = list . get ( 0 ) . getInt ( "step_id" ) ;
int step_id = list . get ( 0 ) . getInt ( "step_id" ) ;
if ( verificationList . size ( ) > 0 ) {
int verification_status = list . get ( 0 ) . getInt ( "verification_status" ) ;
int verificationStatus = verificationList . get ( 0 ) . getInt ( "verificationStatus" ) ;
//TODO
//0 表示没有找到数据,是全新的
if ( verification_status > 0 & & verification_status ! = 4 ) {
//4:退回修改
//4:退回修改
if ( verificationStatus ! = 4 ) {
//没有找到的话,就是全新的!
if ( step_id = = 0 ) {
if ( step_id = = 0 ) {
//开始第一步的step_id
//开始第一步的step_id
step_id = getFirstStepId ( module_id ) ;
step_id = getFirstStepId ( module_id ) ;
@ -116,7 +118,6 @@ public class VerificationModel {
//获取下一步的step_id
//获取下一步的step_id
step_id = getNextStepId ( module_id ) ;
step_id = getNextStepId ( module_id ) ;
}
}
}
} else {
} else {
if ( step_id = = 0 ) {
if ( step_id = = 0 ) {
//开始第一步的step_id
//开始第一步的step_id
@ -137,9 +138,6 @@ public class VerificationModel {
Db . save ( "t_verification_record" , "record_id" , record ) ;
Db . save ( "t_verification_record" , "record_id" , record ) ;
//返回新生成的ID
//返回新生成的ID
return record . getInt ( "record_id" ) ;
return record . getInt ( "record_id" ) ;
} else {
return - 1 ;
}
}
}
/ * *
/ * *