|  | @@ -371,7 +371,7 @@ func (d *ApproverDao) InitStatus(auditType string, bid int, dataType int, dataId
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // 审批通过
 | 
	
		
			
				|  |  | -func (d *ApproverDao) PassHandler(auditType string, id int, uid int, auditId int, opinion string, rectifiedInfo string) error {
 | 
	
		
			
				|  |  | +func (d *ApproverDao) PassHandler(auditType string, id int, uid int, auditId int, opinion string, content string, rectifiedTime string) error {
 | 
	
		
			
				|  |  |  	session := d.engine.NewSession()
 | 
	
		
			
				|  |  |  	defer session.Close()
 | 
	
		
			
				|  |  |  	// add Begin() before any action
 | 
	
	
		
			
				|  | @@ -381,7 +381,7 @@ func (d *ApproverDao) PassHandler(auditType string, id int, uid int, auditId int
 | 
	
		
			
				|  |  |  		return err
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	if auditor.AuditId != uid {
 | 
	
		
			
				|  |  | -		return errors.New("该用户没有审批权限!")
 | 
	
		
			
				|  |  | +		return errors.New("该用户没有审批权限")
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	var msgContent string
 | 
	
	
		
			
				|  | @@ -452,7 +452,7 @@ func (d *ApproverDao) PassHandler(auditType string, id int, uid int, auditId int
 | 
	
		
			
				|  |  |  			return err
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		// 增加审批日志
 | 
	
		
			
				|  |  | -		auditReacord := &models.CmSafeAudit{BidsectionId: auditor.BidsectionId, SafeId: auditor.DataId, AuditId: auditor.AuditId, Times: safe.Times, CreateTime: time.Now(), Status: 0, Progress: auditor.Progress + 1, Opinion: opinion, Rectifiedinfo: rectifiedInfo}
 | 
	
		
			
				|  |  | +		auditReacord := &models.CmSafeAudit{BidsectionId: auditor.BidsectionId, SafeId: auditor.DataId, AuditId: auditor.AuditId, Times: safe.Times, CreateTime: time.Now(), Status: 0, Progress: auditor.Progress + 1, Opinion: opinion}
 | 
	
		
			
				|  |  |  		_, err = session.Insert(auditReacord)
 | 
	
		
			
				|  |  |  		if err != nil {
 | 
	
		
			
				|  |  |  			session.Rollback()
 | 
	
	
		
			
				|  | @@ -481,7 +481,7 @@ func (d *ApproverDao) PassHandler(auditType string, id int, uid int, auditId int
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  			// 将cm_tree的safe_rectification待整改+1
 | 
	
		
			
				|  |  | -			_, err := session.Exec("update cm_tree set safe_rectification_in = safe_rectification_in + 1, safe_rectification = if(safe_rectification >= 1, safe_rectification - 1, 0) where bidsection_id = ?", auditor.BidsectionId)
 | 
	
		
			
				|  |  | +			_, err = session.Exec("update cm_tree set safe_rectification_in = safe_rectification_in + 1, safe_rectification = if(safe_rectification >= 1, safe_rectification - 1, 0) where bidsection_id = ?", auditor.BidsectionId)
 | 
	
		
			
				|  |  |  			if err != nil {
 | 
	
		
			
				|  |  |  				session.Rollback()
 | 
	
		
			
				|  |  |  				return err
 | 
	
	
		
			
				|  | @@ -501,6 +501,23 @@ func (d *ApproverDao) PassHandler(auditType string, id int, uid int, auditId int
 | 
	
		
			
				|  |  |  					session.Rollback()
 | 
	
		
			
				|  |  |  					return err
 | 
	
		
			
				|  |  |  				}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +				// 将整改单的状态->完成,并且填入整改日期
 | 
	
		
			
				|  |  | +				rectification := &models.CmRectification{}
 | 
	
		
			
				|  |  | +				rectification.BidsectionId = safe.BidsectionId
 | 
	
		
			
				|  |  | +				rectification.ProjectId = safe.ProjectId
 | 
	
		
			
				|  |  | +				rectification.DataId = safe.Id
 | 
	
		
			
				|  |  | +				rectification.DataType = 0
 | 
	
		
			
				|  |  | +				rectification.CreateTime = time.Now()
 | 
	
		
			
				|  |  | +				newRectifiedTime, _ := time.Parse("2006-01-02 15:04:05", rectifiedTime)
 | 
	
		
			
				|  |  | +				rectification.RectifiedTime = newRectifiedTime
 | 
	
		
			
				|  |  | +				rectification.Content = content
 | 
	
		
			
				|  |  | +				rectification.Status = 1
 | 
	
		
			
				|  |  | +				_, err = session.Insert(rectification)
 | 
	
		
			
				|  |  | +				if err != nil {
 | 
	
		
			
				|  |  | +					session.Rollback()
 | 
	
		
			
				|  |  | +					return err
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  |  			} else {
 | 
	
		
			
				|  |  |  				// 复查流程
 | 
	
		
			
				|  |  |  				// 查找最后一个审批人
 | 
	
	
		
			
				|  | @@ -573,7 +590,7 @@ func (d *ApproverDao) PassHandler(auditType string, id int, uid int, auditId int
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		// 增加审批日志
 | 
	
		
			
				|  |  | -		auditReacord := &models.CmQualityAudit{BidsectionId: auditor.BidsectionId, QualityId: auditor.DataId, AuditId: auditor.AuditId, Times: quality.Times, CreateTime: time.Now(), Status: 0, Progress: auditor.Progress + 1, Opinion: opinion, Rectifiedinfo: rectifiedInfo}
 | 
	
		
			
				|  |  | +		auditReacord := &models.CmQualityAudit{BidsectionId: auditor.BidsectionId, QualityId: auditor.DataId, AuditId: auditor.AuditId, Times: quality.Times, CreateTime: time.Now(), Status: 0, Progress: auditor.Progress + 1, Opinion: opinion}
 | 
	
		
			
				|  |  |  		_, err = session.Insert(auditReacord)
 | 
	
		
			
				|  |  |  		if err != nil {
 | 
	
		
			
				|  |  |  			session.Rollback()
 | 
	
	
		
			
				|  | @@ -602,7 +619,7 @@ func (d *ApproverDao) PassHandler(auditType string, id int, uid int, auditId int
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  			// 将cm_tree的quality_rectification待整改+1
 | 
	
		
			
				|  |  | -			_, err := session.Exec("update cm_tree set quality_rectification_in = quality_rectification_in + 1, quality_rectification = if(quality_rectification >= 1, quality_rectification - 1, 0) where bidsection_id = ?", auditor.BidsectionId)
 | 
	
		
			
				|  |  | +			_, err = session.Exec("update cm_tree set quality_rectification_in = quality_rectification_in + 1, quality_rectification = if(quality_rectification >= 1, quality_rectification - 1, 0) where bidsection_id = ?", auditor.BidsectionId)
 | 
	
		
			
				|  |  |  			if err != nil {
 | 
	
		
			
				|  |  |  				session.Rollback()
 | 
	
		
			
				|  |  |  				return err
 | 
	
	
		
			
				|  | @@ -622,6 +639,24 @@ func (d *ApproverDao) PassHandler(auditType string, id int, uid int, auditId int
 | 
	
		
			
				|  |  |  					session.Rollback()
 | 
	
		
			
				|  |  |  					return err
 | 
	
		
			
				|  |  |  				}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +				// 将整改单的状态->完成,并且填入整改日期
 | 
	
		
			
				|  |  | +				rectification := &models.CmRectification{}
 | 
	
		
			
				|  |  | +				rectification.BidsectionId = quality.BidsectionId
 | 
	
		
			
				|  |  | +				rectification.ProjectId = quality.ProjectId
 | 
	
		
			
				|  |  | +				rectification.DataId = quality.Id
 | 
	
		
			
				|  |  | +				rectification.DataType = 1
 | 
	
		
			
				|  |  | +				rectification.CreateTime = time.Now()
 | 
	
		
			
				|  |  | +				newRectifiedTime, _ := time.Parse("2006-01-02 15:04:05", rectifiedTime)
 | 
	
		
			
				|  |  | +				rectification.RectifiedTime = newRectifiedTime
 | 
	
		
			
				|  |  | +				rectification.Content = content
 | 
	
		
			
				|  |  | +				rectification.Status = 1
 | 
	
		
			
				|  |  | +				_, err = session.Insert(rectification)
 | 
	
		
			
				|  |  | +				if err != nil {
 | 
	
		
			
				|  |  | +					session.Rollback()
 | 
	
		
			
				|  |  | +					return err
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  			} else {
 | 
	
		
			
				|  |  |  				// 复查流程
 | 
	
		
			
				|  |  |  				// 查找最后一个审批人
 |