Browse Source

fix:审批配置

Roc 8 months ago
parent
commit
1d3f07a1e6

+ 1 - 1
controllers/english_report/report.go

@@ -779,7 +779,7 @@ func (this *EnglishReportController) PrePublishReport() {
 	}
 
 	// 校验是否开启了审批流
-	opening, e := services.CheckReportOpenApprove(report_approve.FlowReportTypeEnglish, report.ClassifyIdFirst, report.ClassifyIdSecond)
+	opening, e := services.CheckReportOpenApprove(report_approve.FlowReportTypeEnglish, report.ClassifyIdFirst, report.ClassifyIdSecond, 0)
 	if e != nil {
 		br.Msg = "操作失败"
 		br.ErrMsg = "校验报告是否开启审批流失败, Err: " + e.Error()

+ 1 - 1
controllers/report.go

@@ -2201,7 +2201,7 @@ func (this *ReportController) PrePublishReport() {
 	}
 
 	// 校验是否开启了审批流
-	opening, e := services.CheckReportOpenApprove(report_approve.FlowReportTypeChinese, report.ClassifyIdFirst, report.ClassifyIdSecond)
+	opening, e := services.CheckReportOpenApprove(report_approve.FlowReportTypeChinese, report.ClassifyIdFirst, report.ClassifyIdSecond, report.ClassifyIdThird)
 	if e != nil {
 		br.Msg = "操作失败"
 		br.ErrMsg = "校验报告是否开启审批流失败, Err: " + e.Error()

+ 1 - 1
controllers/report_approve/report_approve.go

@@ -936,7 +936,7 @@ func (this *ReportApproveController) CheckApproveOpen() {
 	}
 
 	// 校验是否开启了审批流
-	opening, e := services.CheckReportOpenApprove(req.ReportType, req.ClassifyFirstId, req.ClassifySecondId)
+	opening, e := services.CheckReportOpenApprove(req.ReportType, req.ClassifyFirstId, req.ClassifySecondId, req.ClassifyThirdId)
 	if e != nil {
 		br.Msg = "操作失败"
 		br.ErrMsg = "校验报告是否开启审批流失败, Err: " + e.Error()

+ 18 - 9
controllers/report_approve/report_approve_flow.go

@@ -56,6 +56,8 @@ func (this *ReportApproveFlowController) List() {
 
 	var cond, orderRule string
 	var pars []interface{}
+	cond += fmt.Sprintf(` AND %s = ? `, report_approve.ReportApproveFlowCols.Enabled)
+	pars = append(pars, 1)
 	// 筛选项
 	{
 		keyword := strings.TrimSpace(params.Keyword)
@@ -68,6 +70,10 @@ func (this *ReportApproveFlowController) List() {
 			cond += fmt.Sprintf(` AND %s = ? AND %s = ?`, report_approve.ReportApproveFlowCols.ReportType, report_approve.ReportApproveFlowCols.ClassifySecondId)
 			pars = append(pars, params.ReportType, params.ClassifySecondId)
 		}
+		if params.ClassifyThirdId > 0 {
+			cond += fmt.Sprintf(` AND %s = ? `, report_approve.ReportApproveFlowCols.ClassifyThirdId)
+			pars = append(pars, params.ReportType, params.ClassifyThirdId)
+		}
 		if params.SortRule > 0 {
 			orderMap := map[int]string{1: "ASC", 2: "DESC"}
 			orderRule = fmt.Sprintf("%s %s", report_approve.ReportApproveFlowCols.CreateTime, orderMap[params.SortRule])
@@ -221,9 +227,9 @@ func (this *ReportApproveFlowController) Add() {
 	// 审批流是否已存在
 	{
 		flowOb := new(report_approve.ReportApproveFlow)
-		existCond := fmt.Sprintf(` AND %s = ? AND %s = ? AND %s = ?`, report_approve.ReportApproveFlowCols.ReportType, report_approve.ReportApproveFlowCols.ClassifyFirstId, report_approve.ReportApproveFlowCols.ClassifySecondId)
+		existCond := fmt.Sprintf(` AND %s = ? AND %s = ? AND %s = ? AND %s = ?`, report_approve.ReportApproveFlowCols.ReportType, report_approve.ReportApproveFlowCols.ClassifyFirstId, report_approve.ReportApproveFlowCols.ClassifySecondId, report_approve.ReportApproveFlowCols.ClassifyThirdId)
 		existPars := make([]interface{}, 0)
-		existPars = append(existPars, req.ReportType, req.ClassifyFirstId, req.ClassifySecondId)
+		existPars = append(existPars, req.ReportType, req.ClassifyFirstId, req.ClassifySecondId, req.ClassifyThirdId)
 		exist, e := flowOb.GetItemByCondition(existCond, existPars, "")
 		if e != nil && e.Error() != utils.ErrNoRow() {
 			br.Msg = "获取失败"
@@ -241,7 +247,9 @@ func (this *ReportApproveFlowController) Add() {
 	flowItem.ReportType = req.ReportType
 	flowItem.ClassifyFirstId = req.ClassifyFirstId
 	flowItem.ClassifySecondId = req.ClassifySecondId
+	flowItem.ClassifyThirdId = req.ClassifyThirdId
 	flowItem.CurrVersion = 1
+	flowItem.Enabled = 1
 	flowItem.CreateTime = time.Now().Local()
 	flowItem.ModifyTime = time.Now().Local()
 
@@ -273,7 +281,7 @@ func (this *ReportApproveFlowController) Add() {
 
 	// 更新审批对应的报告状态:未发布->待提交
 	go func() {
-		_ = services.FlowOperateResetReportState(flowItem.ReportType, flowItem.ClassifyFirstId, flowItem.ClassifySecondId, models.ReportStateUnpublished, models.ReportStateWaitSubmit)
+		_ = services.FlowOperateResetReportState(flowItem.ReportType, flowItem.ClassifyFirstId, flowItem.ClassifySecondId, flowItem.ClassifyThirdId, models.ReportStateUnpublished, models.ReportStateWaitSubmit)
 	}()
 
 	br.Data = detail
@@ -369,9 +377,9 @@ func (this *ReportApproveFlowController) Edit() {
 
 	// 审批流是否已存在
 	{
-		existCond := fmt.Sprintf(` AND %s = ? AND %s = ? AND %s = ? AND %s <> ?`, report_approve.ReportApproveFlowCols.ReportType, report_approve.ReportApproveFlowCols.ClassifyFirstId, report_approve.ReportApproveFlowCols.ClassifySecondId, report_approve.ReportApproveFlowCols.ReportApproveFlowId)
+		existCond := fmt.Sprintf(` AND %s = ? AND %s = ? AND %s = ?  AND %s = ? AND %s <> ?`, report_approve.ReportApproveFlowCols.ReportType, report_approve.ReportApproveFlowCols.ClassifyFirstId, report_approve.ReportApproveFlowCols.ClassifySecondId, report_approve.ReportApproveFlowCols.ClassifyThirdId, report_approve.ReportApproveFlowCols.ReportApproveFlowId)
 		existPars := make([]interface{}, 0)
-		existPars = append(existPars, req.ReportType, req.ClassifyFirstId, req.ClassifySecondId, req.ReportApproveFlowId)
+		existPars = append(existPars, req.ReportType, req.ClassifyFirstId, req.ClassifySecondId, req.ClassifyThirdId, req.ReportApproveFlowId)
 		exist, e := flowOb.GetItemByCondition(existCond, existPars, "")
 		if e != nil && e.Error() != utils.ErrNoRow() {
 			br.Msg = "操作失败"
@@ -403,8 +411,8 @@ func (this *ReportApproveFlowController) Edit() {
 	}
 
 	// 变更了报告分类时, 判断是否允许变更
-	if req.ReportType != flowItem.ReportType || req.ClassifyFirstId != flowItem.ClassifyFirstId || req.ClassifySecondId != flowItem.ClassifySecondId {
-		checkOk, e := services.CheckReportApproveFlowChange(flowItem.ReportType, flowItem.ClassifyFirstId, flowItem.ClassifySecondId)
+	if req.ReportType != flowItem.ReportType || req.ClassifyFirstId != flowItem.ClassifyFirstId || req.ClassifySecondId != flowItem.ClassifySecondId || req.ClassifyThirdId != flowItem.ClassifyThirdId {
+		checkOk, e := services.CheckReportApproveFlowChange(flowItem.ReportType, flowItem.ClassifyFirstId, flowItem.ClassifySecondId, flowItem.ClassifyThirdId)
 		if e != nil {
 			br.Msg = "操作失败"
 			br.ErrMsg = "校验审批流是否可变更失败, Err: " + e.Error()
@@ -420,6 +428,7 @@ func (this *ReportApproveFlowController) Edit() {
 	flowItem.ReportType = req.ReportType
 	flowItem.ClassifyFirstId = req.ClassifyFirstId
 	flowItem.ClassifySecondId = req.ClassifySecondId
+	flowItem.ClassifyThirdId = req.ClassifyThirdId
 	flowItem.CurrVersion += 1
 	flowItem.ModifyTime = time.Now().Local()
 
@@ -566,7 +575,7 @@ func (this *ReportApproveFlowController) Remove() {
 	}
 
 	// 校验是否允许删除
-	checkOk, e := services.CheckReportApproveFlowChange(flowItem.ReportType, flowItem.ClassifyFirstId, flowItem.ClassifySecondId)
+	checkOk, e := services.CheckReportApproveFlowChange(flowItem.ReportType, flowItem.ClassifyFirstId, flowItem.ClassifySecondId, flowItem.ClassifyThirdId)
 	if e != nil {
 		br.Msg = "操作失败"
 		br.ErrMsg = "校验审批流是否可变更失败, Err: " + e.Error()
@@ -586,7 +595,7 @@ func (this *ReportApproveFlowController) Remove() {
 
 	// 更新审批对应的报告状态:待提交->未发布
 	go func() {
-		_ = services.FlowOperateResetReportState(flowItem.ReportType, flowItem.ClassifyFirstId, flowItem.ClassifySecondId, models.ReportStateWaitSubmit, models.ReportStateUnpublished)
+		_ = services.FlowOperateResetReportState(flowItem.ReportType, flowItem.ClassifyFirstId, flowItem.ClassifySecondId, flowItem.ClassifyThirdId, models.ReportStateWaitSubmit, models.ReportStateUnpublished)
 	}()
 
 	br.Ret = 200

+ 1 - 0
controllers/report_chapter.go

@@ -122,6 +122,7 @@ func (this *ReportController) AddChapter() {
 	//reportChapterInfo.CreateTime = req.CreateTime
 	reportChapterInfo.CreateTime = reportInfo.CreateTime
 	reportChapterInfo.VideoKind = 2
+	reportChapterInfo.Stage = reportInfo.Stage
 
 	reportChapterInfo.LastModifyAdminId = sysUser.AdminId
 	reportChapterInfo.LastModifyAdminName = sysUser.RealName

+ 1 - 1
controllers/smart_report/smart_report.go

@@ -641,7 +641,7 @@ func (this *SmartReportController) PrePublish() {
 	}
 
 	// 校验是否开启了审批流
-	opening, e := services.CheckReportOpenApprove(report_approve.FlowReportTypeSmart, item.ClassifyIdFirst, item.ClassifyIdSecond)
+	opening, e := services.CheckReportOpenApprove(report_approve.FlowReportTypeSmart, item.ClassifyIdFirst, item.ClassifyIdSecond, 0)
 	if e != nil {
 		br.Msg = "操作失败"
 		br.ErrMsg = "校验报告是否开启审批流失败, Err: " + e.Error()

+ 4 - 1
models/report.go

@@ -1366,7 +1366,7 @@ func GetReportStateCount(state int) (count int, err error) {
 }
 
 // UpdateReportsStateByCond 批量更新报告状态
-func UpdateReportsStateByCond(classifyFirstId, classifySecondId, oldState, newState int) (err error) {
+func UpdateReportsStateByCond(classifyFirstId, classifySecondId, classifyThirdId, oldState, newState int) (err error) {
 	o := orm.NewOrmUsingDB("rddp")
 	cond := ``
 	if classifyFirstId > 0 {
@@ -1375,6 +1375,9 @@ func UpdateReportsStateByCond(classifyFirstId, classifySecondId, oldState, newSt
 	if classifySecondId > 0 {
 		cond += fmt.Sprintf(` AND classify_id_second = %d`, classifySecondId)
 	}
+	if classifyThirdId > 0 {
+		cond += fmt.Sprintf(` AND classify_id_third = %d`, classifyThirdId)
+	}
 	sql := fmt.Sprintf(`UPDATE report SET state = ?, pre_publish_time = NULL WHERE state = ? %s`, cond)
 	_, err = o.Raw(sql, newState, oldState).Exec()
 	return

+ 1 - 0
models/report_approve/report_approve.go

@@ -453,4 +453,5 @@ type ReportApproveCheckApproveOpenReq struct {
 	ReportType       int `description:"报告类型:1-中文研报;2-英文研报;3-智能研报"`
 	ClassifyFirstId  int `description:"一级分类ID"`
 	ClassifySecondId int `description:"二级分类ID"`
+	ClassifyThirdId  int `description:"三级分类ID"`
 }

+ 6 - 1
models/report_approve/report_approve_flow.go

@@ -20,6 +20,7 @@ type ReportApproveFlow struct {
 	CurrVersion         int       `description:"当前版本号"`
 	CreateTime          time.Time `description:"创建时间"`
 	ModifyTime          time.Time `description:"修改时间"`
+	Enabled             int       `description:"1:有效,0:禁用"`
 }
 
 var ReportApproveFlowCols = struct {
@@ -32,6 +33,7 @@ var ReportApproveFlowCols = struct {
 	CurrVersion         string
 	CreateTime          string
 	ModifyTime          string
+	Enabled             string
 }{
 	ReportApproveFlowId: "report_approve_flow_id",
 	FlowName:            "flow_name",
@@ -42,6 +44,7 @@ var ReportApproveFlowCols = struct {
 	CurrVersion:         "curr_version",
 	CreateTime:          "create_time",
 	ModifyTime:          "modify_time",
+	Enabled:             "enabled",
 }
 
 func (m *ReportApproveFlow) TableName() string {
@@ -183,6 +186,7 @@ type ReportApproveFlowAddReq struct {
 	ReportType       int                        `description:"报告类型:1-中文研报;2-英文研报;3-智能研报"`
 	ClassifyFirstId  int                        `description:"一级分类ID"`
 	ClassifySecondId int                        `description:"二级分类ID"`
+	ClassifyThirdId  int                        `description:"三级分类ID"`
 	Nodes            []ReportApproveNodeSaveReq `description:"审批节点信息"`
 }
 
@@ -307,7 +311,7 @@ func (m *ReportApproveFlow) UpdateFlowAndNodes(flowItem *ReportApproveFlow, node
 	}()
 
 	// 更新审批流
-	updateCols := []string{"FlowName", "ReportType", "ClassifyFirstId", "ClassifySecondId", "CurrVersion", "ModifyTime"}
+	updateCols := []string{"FlowName", "ReportType", "ClassifyFirstId", "ClassifySecondId", "ClassifyThirdId", "CurrVersion", "ModifyTime"}
 	if e = flowItem.Update(updateCols); e != nil {
 		err = fmt.Errorf("update flow err: %s", e.Error())
 		return
@@ -379,6 +383,7 @@ type ReportApproveFlowListReq struct {
 	ReportType       int    `form:"ReportType" description:"报告类型:1-中文研报;2-英文研报;3-智能研报"`
 	ClassifyFirstId  int    `form:"ClassifyFirstId" description:"一级分类ID"`
 	ClassifySecondId int    `form:"ClassifySecondId" description:"二级分类ID"`
+	ClassifyThirdId  int    `form:"ClassifyThirdId" description:"三级级分类ID"`
 	Keyword          string `form:"Keyword" description:"关键词"`
 	SortRule         int    `form:"SortRule" description:"排序方式: 1-正序; 2-倒序(默认)"`
 }

+ 115 - 0
services/classify.go

@@ -3,6 +3,7 @@ package services
 import (
 	"errors"
 	"eta/eta_api/models"
+	"eta/eta_api/models/report_approve"
 	"eta/eta_api/utils"
 	"fmt"
 	"sort"
@@ -365,6 +366,9 @@ func AddReportClassify(classifyName string, parentId int, chartPermissionIdList
 				return
 			}
 
+			// 继承父级分类审批流
+			go inheritReportApproveFlow(parentClassifyItem, classify)
+
 			moveReportByAddClassify(parentClassifyItem, classify)
 		}
 	}
@@ -488,6 +492,117 @@ func inheritReportChapterType(parentClassifyId, currClassifyId int) (err error)
 	return
 }
 
+// inheritReportApproveFlow
+// @Description: 继承父级分类下的审批流
+// @author: Roc
+// @datetime 2024-06-17 14:41:04
+// @param parentClassifyId int
+// @param currClassifyId int
+// @return err error
+func inheritReportApproveFlow(parentClassifyItem, currClassifyItem *models.Classify) (err error) {
+	defer func() {
+		if err != nil {
+			utils.FileLog.Error(fmt.Sprint("继承父级分类下的审批流失败,父级分类ID:", parentClassifyItem.Id, ";当前分类ID:", currClassifyItem.Id, ";错误信息:", err.Error()))
+		}
+	}()
+
+	var firstClassify, secondClassify, thirdClassify *models.Classify
+	if parentClassifyItem.ParentId > 0 {
+		// 获取父级分类信息
+		firstClassify, err = models.GetClassifyById(parentClassifyItem.ParentId)
+		if err != nil {
+			return
+		}
+
+		secondClassify = parentClassifyItem
+		thirdClassify = currClassifyItem
+	} else {
+		firstClassify = parentClassifyItem
+		secondClassify = currClassifyItem
+	}
+
+	flowObj := report_approve.ReportApproveFlow{}
+
+	// 获取父级的审批流
+	existCond := fmt.Sprintf(` AND %s = ? AND %s = ? `, report_approve.ReportApproveFlowCols.ReportType, report_approve.ReportApproveFlowCols.ClassifyFirstId)
+	existPars := make([]interface{}, 0)
+	existPars = append(existPars, report_approve.FlowReportTypeChinese, firstClassify.Id)
+
+	// 如果这是第三级,那么说明只需要查找第二级的审批配置就好了
+	if thirdClassify != nil {
+		existCond = fmt.Sprintf(`%s AND %s = ?`, existCond, report_approve.ReportApproveFlowCols.ClassifySecondId)
+		existPars = append(existPars, secondClassify.Id)
+	}
+	//if thirdClassify != nil {
+	//	existCond = fmt.Sprintf(`%s AND %s = ?`, existCond, report_approve.ReportApproveFlowCols.ClassifyThirdId)
+	//	existPars = append(existPars, thirdClassify.Id)
+	//}
+
+	parentFlow, err := flowObj.GetItemByCondition(existCond, existPars, "")
+	if err != nil {
+		// 如果没有配置审批流,那么就直接返回
+		if err.Error() == utils.ErrNoRow() {
+			err = nil
+		}
+		return
+	}
+
+	// 获取父级的审批节点
+	nodeObj := report_approve.ReportApproveNode{}
+	nodeCond := fmt.Sprintf(` AND %s = ? AND %s = ?`, report_approve.ReportApproveNodeCols.ReportApproveFlowId, report_approve.ReportApproveNodeCols.CurrVersion)
+	nodePars := make([]interface{}, 0)
+	nodePars = append(nodePars, parentFlow.ReportApproveFlowId, parentFlow.CurrVersion)
+	parentNodeList, err := nodeObj.GetItemsByCondition(nodeCond, nodePars, []string{}, "")
+	if err != nil {
+		return
+	}
+
+	// 新审批流
+	currFlow := &report_approve.ReportApproveFlow{
+		ReportApproveFlowId: 0,
+		FlowName:            currClassifyItem.ClassifyName,
+		ReportType:          parentFlow.ReportType,
+		ClassifyFirstId:     firstClassify.Id,
+		ClassifySecondId:    secondClassify.Id,
+		//ClassifyThirdId:     0,
+		CurrVersion: 1,
+		Enabled:     1,
+		CreateTime:  time.Now().Local(),
+		ModifyTime:  time.Now().Local(),
+	}
+	if thirdClassify != nil {
+		currFlow.ClassifyThirdId = thirdClassify.Id
+	}
+
+	// 新审批流的节点
+	nodeItems := make([]*report_approve.ReportApproveNode, 0)
+	for _, v := range parentNodeList {
+		n := &report_approve.ReportApproveNode{
+			//ReportApproveNodeId: 0,
+			//ReportApproveFlowId: 0,
+			PrevNodeId:  0,
+			NextNodeId:  0,
+			NodeType:    v.NodeType,
+			ApproveType: v.ApproveType,
+			Users:       v.Users,
+			CurrVersion: 1,
+			CreateTime:  time.Now().Local(),
+		}
+		nodeItems = append(nodeItems, n)
+	}
+
+	// 新增审批流和节点
+	err = flowObj.CreateFlowAndNodes(currFlow, nodeItems)
+	if err != nil {
+		return
+	}
+
+	parentFlow.Enabled = 0
+	err = parentFlow.Update([]string{"Enabled"})
+
+	return
+}
+
 // EditReportClassify
 // @Description: 编辑报告分类
 // @author: Roc

+ 10 - 8
services/report_approve.go

@@ -28,13 +28,15 @@ func GetReportClassifyTreeRecursive(list []*models.Classify, parentId int) []*re
 }
 
 // CheckReportApproveFlowChange 校验是否可变更分类
-func CheckReportApproveFlowChange(reportType, classifyFirstId, classifySecondId int) (ok bool, err error) {
+func CheckReportApproveFlowChange(reportType, classifyFirstId, classifySecondId, classifyThirdId int) (ok bool, err error) {
 	var count int
 	cond := ` AND classify_id_first = ? AND classify_id_second = ? AND state = ?`
 	pars := make([]interface{}, 0)
 	pars = append(pars, classifyFirstId, classifySecondId, models.ReportStateWaitApprove)
 	switch reportType {
 	case report_approve.FlowReportTypeChinese:
+		cond += ` AND classify_id_third = ?  `
+		pars = append(pars, classifyThirdId)
 		ct, e := models.GetReportListCount(cond, pars)
 		if e != nil {
 			err = fmt.Errorf("GetReportListCount err: %s", e.Error())
@@ -67,7 +69,7 @@ func CheckReportApproveFlowChange(reportType, classifyFirstId, classifySecondId
 }
 
 // CheckReportOpenApprove 校验报告是否开启了审批流
-func CheckReportOpenApprove(reportType, firstId, secondId int) (opening bool, err error) {
+func CheckReportOpenApprove(reportType, firstId, secondId, thirdId int) (opening bool, err error) {
 	// 获取审批配置
 	confMap, e := models.GetBusinessConf()
 	if e != nil {
@@ -79,9 +81,9 @@ func CheckReportOpenApprove(reportType, firstId, secondId int) (opening bool, er
 
 	// 查询对应分类是否有审批流
 	flowOb := new(report_approve.ReportApproveFlow)
-	flowCond := fmt.Sprintf(` AND %s = ? AND %s = ? AND %s = ?`, report_approve.ReportApproveFlowCols.ReportType, report_approve.ReportApproveFlowCols.ClassifyFirstId, report_approve.ReportApproveFlowCols.ClassifySecondId)
+	flowCond := fmt.Sprintf(` AND %s = ? AND %s = ? AND %s = ? AND %s = ?`, report_approve.ReportApproveFlowCols.ReportType, report_approve.ReportApproveFlowCols.ClassifyFirstId, report_approve.ReportApproveFlowCols.ClassifySecondId, report_approve.ReportApproveFlowCols.ClassifyThirdId)
 	flowPars := make([]interface{}, 0)
-	flowPars = append(flowPars, reportType, firstId, secondId)
+	flowPars = append(flowPars, reportType, firstId, secondId, thirdId)
 	flowItem, e := flowOb.GetItemByCondition(flowCond, flowPars, "")
 	if e != nil && e.Error() != utils.ErrNoRow() {
 		err = fmt.Errorf("ApproveFlow GetItemByCondition err: %s", e.Error())
@@ -914,7 +916,7 @@ func CheckCloseReportApproveConf() (yes bool, err error) {
 }
 
 // FlowOperateResetReportState 审批流变化-重置报告的初始状态
-func FlowOperateResetReportState(reportType, classifyFirstId, classifySecondId, oldState, State int) (err error) {
+func FlowOperateResetReportState(reportType, classifyFirstId, classifySecondId, classifyThirdId, oldState, State int) (err error) {
 	defer func() {
 		if err != nil {
 			tips := fmt.Sprintf("审批流变化-重置报告初始状态失败, ErrMsg: %s", err.Error())
@@ -925,7 +927,7 @@ func FlowOperateResetReportState(reportType, classifyFirstId, classifySecondId,
 
 	// 中文研报
 	if reportType == report_approve.FlowReportTypeChinese {
-		e := models.UpdateReportsStateByCond(classifyFirstId, classifySecondId, oldState, State)
+		e := models.UpdateReportsStateByCond(classifyFirstId, classifySecondId, classifyThirdId, oldState, State)
 		if e != nil {
 			err = fmt.Errorf("UpdateReportsStateByCond err: %s", e.Error())
 		}
@@ -964,7 +966,7 @@ func ConfigChangeResetReportState(changeType string) (err error) {
 
 	// 关闭审批-待提交->未发布
 	if changeType == "" {
-		e := models.UpdateReportsStateByCond(0, 0, models.ReportStateWaitSubmit, models.ReportStateUnpublished)
+		e := models.UpdateReportsStateByCond(0, 0, 0, models.ReportStateWaitSubmit, models.ReportStateUnpublished)
 		if e != nil {
 			err = fmt.Errorf("UpdateReportsStateByCond err: %s", e.Error())
 		}
@@ -1027,7 +1029,7 @@ func ConfigChangeResetReportState(changeType string) (err error) {
 
 	// 开启第三方审批->未发布->待提交
 	if changeType == models.BusinessConfReportApproveTypeOther {
-		e := models.UpdateReportsStateByCond(0, 0, models.ReportStateUnpublished, models.ReportStateWaitSubmit)
+		e := models.UpdateReportsStateByCond(0, 0, 0, models.ReportStateUnpublished, models.ReportStateWaitSubmit)
 		if e != nil {
 			err = fmt.Errorf("UpdateReportsStateByCond err: %s", e.Error())
 		}