|
@@ -254,10 +254,8 @@ func CancelReportApprove(reportType, reportId, approveId, sysAdminId int, sysAdm
|
|
|
if confApproveType == "" {
|
|
|
confApproveType = models.BusinessConfReportApproveTypeEta
|
|
|
}
|
|
|
+ // 第三方审批仅修改报告状态
|
|
|
if confApproveType == models.BusinessConfReportApproveTypeOther {
|
|
|
- return
|
|
|
- }
|
|
|
- if openApprove && confApproveType == models.BusinessConfReportApproveTypeOther {
|
|
|
e = updateReportApproveState(reportType, reportId, 0, models.ReportStateWaitSubmit)
|
|
|
if e != nil {
|
|
|
err = fmt.Errorf("更新报告审批撤回失败, Err: %s", e.Error())
|
|
@@ -871,11 +869,11 @@ func CheckCloseReportApproveConf() (yes bool, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-// FlowOperateResetReportState 重置报告的初始状态
|
|
|
+// FlowOperateResetReportState 审批流变化-重置报告的初始状态
|
|
|
func FlowOperateResetReportState(reportType, classifyFirstId, classifySecondId, oldState, State int) (err error) {
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
|
- tips := fmt.Sprintf("重置报告初始状态失败, ErrMsg: %s", err.Error())
|
|
|
+ tips := fmt.Sprintf("审批流变化-重置报告初始状态失败, ErrMsg: %s", err.Error())
|
|
|
utils.FileLog.Info(tips)
|
|
|
go alarm_msg.SendAlarmMsg(tips, 2)
|
|
|
}
|
|
@@ -909,3 +907,95 @@ func FlowOperateResetReportState(reportType, classifyFirstId, classifySecondId,
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// ConfigChangeResetReportState 审批配置变化-重置报告的初始状态
|
|
|
+func ConfigChangeResetReportState(changeType string) (err error) {
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ tips := fmt.Sprintf("审批配置变化-重置报告初始状态失败, ErrMsg: %s", err.Error())
|
|
|
+ utils.FileLog.Info(tips)
|
|
|
+ go alarm_msg.SendAlarmMsg(tips, 2)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ // 关闭审批-待提交->未发布
|
|
|
+ if changeType == "" {
|
|
|
+ e := models.UpdateReportsStateByCond(0, 0, models.ReportStateWaitSubmit, models.ReportStateUnpublished)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("UpdateReportsStateByCond err: %s", e.Error())
|
|
|
+ }
|
|
|
+ e = models.UpdateEnglishReportsStateByCond(0, 0, models.ReportStateWaitSubmit, models.ReportStateUnpublished)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("UpdateEnglishReportsStateByCond err: %s", e.Error())
|
|
|
+ }
|
|
|
+ e = smart_report.UpdateSmartReportsStateByCond(0, 0, models.ReportStateWaitSubmit, models.ReportStateUnpublished)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("UpdateSmartReportsStateByCond err: %s", e.Error())
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 开启内部审批-未发布->部分待提交
|
|
|
+ if changeType == models.BusinessConfReportApproveTypeEta {
|
|
|
+ flowOb := new(report_approve.ReportApproveFlow)
|
|
|
+ flows, e := flowOb.GetItemsByCondition(``, make([]interface{}, 0), []string{}, "")
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("GetApproveFlows err: %s", e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ reportSecondIds, englishSecondIds, smartSecondIds := make([]int, 0), make([]int, 0), make([]int, 0)
|
|
|
+ for _, v := range flows {
|
|
|
+ if v.ReportType == report_approve.FlowReportTypeChinese {
|
|
|
+ reportSecondIds = append(reportSecondIds, v.ClassifySecondId)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if v.ReportType == report_approve.FlowReportTypeEnglish {
|
|
|
+ englishSecondIds = append(englishSecondIds, v.ClassifySecondId)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if v.ReportType == report_approve.FlowReportTypeSmart {
|
|
|
+ smartSecondIds = append(smartSecondIds, v.ClassifySecondId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(reportSecondIds) > 0 {
|
|
|
+ e = models.UpdateReportsStateBySecondIds(models.ReportStateUnpublished, models.ReportStateWaitSubmit, reportSecondIds)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("UpdateReportsStateBySecondIds err: %s", e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(englishSecondIds) > 0 {
|
|
|
+ e = models.UpdateEnglishReportsStateBySecondIds(models.ReportStateUnpublished, models.ReportStateWaitSubmit, englishSecondIds)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("UpdateEnglishReportsStateBySecondIds err: %s", e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(smartSecondIds) > 0 {
|
|
|
+ e = smart_report.UpdateSmartReportsStateBySecondIds(models.ReportStateUnpublished, models.ReportStateWaitSubmit, smartSecondIds)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("UpdateSmartReportsStateBySecondIds err: %s", e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 开启第三方审批->未发布->待提交
|
|
|
+ if changeType == models.BusinessConfReportApproveTypeOther {
|
|
|
+ e := models.UpdateReportsStateByCond(0, 0, models.ReportStateUnpublished, models.ReportStateWaitSubmit)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("UpdateReportsStateByCond err: %s", e.Error())
|
|
|
+ }
|
|
|
+ e = models.UpdateEnglishReportsStateByCond(0, 0, models.ReportStateUnpublished, models.ReportStateWaitSubmit)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("UpdateEnglishReportsStateByCond err: %s", e.Error())
|
|
|
+ }
|
|
|
+ e = smart_report.UpdateSmartReportsStateByCond(0, 0, models.ReportStateUnpublished, models.ReportStateWaitSubmit)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("UpdateSmartReportsStateByCond err: %s", e.Error())
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|