|
@@ -97,7 +97,7 @@ func CheckReportOpenApprove(reportType, firstId, secondId int) (opening bool, er
|
|
|
}
|
|
|
|
|
|
// CheckReportCurrState 校验报告当前应有的状态
|
|
|
-func CheckReportCurrState(reportType, firstId, secondId, operate int) (state int, err error) {
|
|
|
+func CheckReportCurrState(reportType, firstId, secondId, thirdId, operate int) (state int, err error) {
|
|
|
// 获取审批配置
|
|
|
confMap, e := models.GetBusinessConf()
|
|
|
if e != nil {
|
|
@@ -109,9 +109,9 @@ func CheckReportCurrState(reportType, firstId, secondId, operate int) (state int
|
|
|
|
|
|
// 查询对应分类是否有审批流
|
|
|
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())
|
|
@@ -148,7 +148,7 @@ func CheckReportCurrState(reportType, firstId, secondId, operate int) (state int
|
|
|
}
|
|
|
|
|
|
// SubmitReportApprove 提交审批
|
|
|
-func SubmitReportApprove(reportType, reportId int, reportTitle string, firstId, secondId int, sysAdminId int, sysAdminName string) (approveId int, err error) {
|
|
|
+func SubmitReportApprove(reportType, reportId int, reportTitle string, firstId, secondId, thirdId int, sysAdminId int, sysAdminName string) (approveId int, err error) {
|
|
|
// 默认内部审批, 如果是走的第三方审批, 那么仅修改状态
|
|
|
confMap, e := models.GetBusinessConf()
|
|
|
if e != nil {
|
|
@@ -171,9 +171,9 @@ func SubmitReportApprove(reportType, reportId int, reportTitle string, firstId,
|
|
|
|
|
|
// 查询审批流
|
|
|
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 {
|
|
|
err = fmt.Errorf("ApproveFlow GetItemByCondition err: %s", e.Error())
|
|
@@ -216,6 +216,7 @@ func SubmitReportApprove(reportType, reportId int, reportTitle string, firstId,
|
|
|
newApprove.ReportTitle = reportTitle
|
|
|
newApprove.ClassifyFirstId = firstId
|
|
|
newApprove.ClassifySecondId = secondId
|
|
|
+ newApprove.ClassifyThirdId = thirdId
|
|
|
newApprove.State = report_approve.ReportApproveStateApproving
|
|
|
newApprove.FlowId = flowItem.ReportApproveFlowId
|
|
|
newApprove.FlowVersion = flowItem.CurrVersion
|
|
@@ -504,6 +505,7 @@ func PassReportApprove(approveItem *report_approve.ReportApprove, recordItem *re
|
|
|
newRecord.ApproveUserSort = nextUser.Sort
|
|
|
newRecord.CreateTime = now
|
|
|
newRecord.ModifyTime = now
|
|
|
+ newRecord.NodeState = report_approve.ReportApproveStateApproving
|
|
|
if e = newRecord.Create(); e != nil {
|
|
|
err = fmt.Errorf("生成审批记录失败, Err: %s", e.Error())
|
|
|
return
|
|
@@ -759,6 +761,7 @@ func BuildNextNodeRecordAndMsg(approveNodeItem *report_approve.ReportApproveNode
|
|
|
r.ApproveUserSort = u.Sort
|
|
|
r.CreateTime = now
|
|
|
r.ModifyTime = now
|
|
|
+ r.NodeState = report_approve.ReportApproveStateApproving // 当前节点审批状态
|
|
|
newRecords = append(newRecords, r)
|
|
|
// 依次审批仅生成一条记录
|
|
|
if approveNode.ApproveType == report_approve.NodeApproveTypeRoll {
|