|
|
@@ -181,10 +181,10 @@ func (this *AnnualAuditController) GetMyTaskEntityList() {
|
|
|
}
|
|
|
certIdList = strings.Join(annuIdarr, ",")
|
|
|
var total int64 = 0
|
|
|
- if (certIdList != "") {
|
|
|
+ if certIdList != "" {
|
|
|
where += " and Id in (" + certIdList + ")"
|
|
|
//根据部门查询待办任务
|
|
|
- where += " and Status != 2 "
|
|
|
+ where += " and Status > 0 "
|
|
|
total = svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, where)
|
|
|
//total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, orderby, asc, &list, where)
|
|
|
|
|
|
@@ -321,9 +321,9 @@ func (this *AnnualAuditController) AddEntity() {
|
|
|
}
|
|
|
aplytime := suppliermodel.ApplyTime
|
|
|
subtime := this.getTimeSub(aplytime, time.Now())
|
|
|
- lefttime := subtime-3
|
|
|
+ lefttime := subtime - 3
|
|
|
if subtime > 3 {
|
|
|
- errinfo.Message = "还不到年审时间!请"+ utils.ToStr(lefttime) +"月后再来申请"
|
|
|
+ errinfo.Message = "还不到年审时间!请" + utils.ToStr(lefttime) + "月后再来申请"
|
|
|
errinfo.Code = -1
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
@@ -346,16 +346,16 @@ func (this *AnnualAuditController) AddEntity() {
|
|
|
//启动工作流
|
|
|
businessKey := utils.ToStr(annualId) + "-" + strconv.Itoa(model.AuditIndex)
|
|
|
processInstanceId := svcActiviti.StartProcess(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id)
|
|
|
- var ActiComplete workflow.ActiCompleteVM
|
|
|
- ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
- ActiComplete.BusinessKey = businessKey
|
|
|
- ActiComplete.UserNames = firstAudit
|
|
|
- ActiComplete.UserId = this.User.Id
|
|
|
- ActiComplete.Result = "1"
|
|
|
- ActiComplete.Remarks = model.Remark
|
|
|
- ActiComplete.CallbackUrl = ""
|
|
|
+ //var ActiComplete workflow.ActiCompleteVM
|
|
|
+ //ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
+ //ActiComplete.BusinessKey = businessKey
|
|
|
+ //ActiComplete.UserNames = firstAudit
|
|
|
+ //ActiComplete.UserId = this.User.Id
|
|
|
+ //ActiComplete.Result = "1"
|
|
|
+ //ActiComplete.Remarks = model.Remark
|
|
|
+ //ActiComplete.CallbackUrl = ""
|
|
|
//提交给二级单位初审
|
|
|
- receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
+ //receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
var auditmodel annualaudit.OilAnnualAudit
|
|
|
auditmodel.WorkflowId = processInstanceId
|
|
|
auditmodel.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
@@ -368,27 +368,27 @@ func (this *AnnualAuditController) AddEntity() {
|
|
|
"AuditIndex",
|
|
|
"BusinessKey",
|
|
|
}
|
|
|
- if receiveVal == "true" {
|
|
|
- _, err = svc.UpdateEntityByIdCols(annualId, auditmodel, cols)
|
|
|
- if err == nil {
|
|
|
- //新增
|
|
|
- errinfo.Message = "添加成功!"
|
|
|
- errinfo.Code = 0
|
|
|
- errinfo.Item = model.Id
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- } else {
|
|
|
- errinfo.Message = "添加失败!" + utils.AlertProcess(err.Error())
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- }
|
|
|
+ //if receiveVal == "true" {
|
|
|
+ _, err = svc.UpdateEntityByIdCols(annualId, auditmodel, cols)
|
|
|
+ if err == nil {
|
|
|
+ //新增
|
|
|
+ errinfo.Message = "添加成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ errinfo.Item = model.Id
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
} else {
|
|
|
- errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
+ errinfo.Message = "添加失败!" + utils.AlertProcess(err.Error())
|
|
|
errinfo.Code = -1
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
+ //} else {
|
|
|
+ // errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
+ // errinfo.Code = -1
|
|
|
+ // this.Data["json"] = &errinfo
|
|
|
+ // this.ServeJSON()
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
func (this *AnnualAuditController) getTimeSub(t1, t2 time.Time) int {
|
|
|
@@ -396,6 +396,7 @@ func (this *AnnualAuditController) getTimeSub(t1, t2 time.Time) int {
|
|
|
t2 = time.Date(t2.Year(), t2.Month(), t2.Day(), 0, 0, 0, 0, time.Local)
|
|
|
return int(t1.Sub(t2).Hours() / 24 / 30)
|
|
|
}
|
|
|
+
|
|
|
// @Title 提交审批
|
|
|
// @Description 提交审批
|
|
|
// @Success 200 {object} controllers.Request
|
|
|
@@ -405,66 +406,80 @@ func (this *AnnualAuditController) AddAuditEntity() {
|
|
|
var errinfo ErrorDataInfo
|
|
|
var jsonBlob = this.Ctx.Input.RequestBody
|
|
|
svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
|
|
|
- firstAudit := this.GetString("firstAudit")
|
|
|
+ annualId := this.GetString("AnnualId")
|
|
|
+ firstAudit := this.GetString("FirstAuditName")
|
|
|
+ secondAudit := this.GetString("SecondAudit")
|
|
|
+ thirdAudit := this.GetString("ThirdAudit")
|
|
|
json.Unmarshal(jsonBlob, &model)
|
|
|
- where := "CerId = " + utils.ToStr(model.SupplierId) + " and SupplierTypeName = " + model.SupplierTypeName
|
|
|
+ //where := "CerId = " + utils.ToStr(model.SupplierId) + " and SupplierTypeName = " + model.SupplierTypeName
|
|
|
var auditentity annualaudit.OilAnnualAudit
|
|
|
- svc.GetEntityByWhere(""+OilAnnualAuditName, where, &auditentity)
|
|
|
+ svc.GetEntityById(annualId, &auditentity)
|
|
|
historworkflowid := auditentity.WorkflowId
|
|
|
- annualId := auditentity.Id
|
|
|
svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ statusint, _ := strconv.Atoi(auditentity.Status)
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ var auditmodel annualaudit.OilAnnualAudit
|
|
|
//重新工作流
|
|
|
- businessKey := utils.ToStr(annualId) + "-" + strconv.Itoa(auditentity.AuditIndex)
|
|
|
- processInstanceId := svcActiviti.StartProcess(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id)
|
|
|
+ if statusint < 0 {
|
|
|
+ businessKey := utils.ToStr(annualId) + "-" + strconv.Itoa(auditentity.AuditIndex)
|
|
|
+ processInstanceId := svcActiviti.StartProcess(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id)
|
|
|
+ ActiComplete.BusinessKey = businessKey
|
|
|
+ auditmodel.WorkflowId = processInstanceId
|
|
|
+ auditmodel.BusinessKey = businessKey
|
|
|
+ } else {
|
|
|
+ auditmodel.WorkflowId = auditentity.WorkflowId
|
|
|
+ ActiComplete.BusinessKey = auditentity.BusinessKey
|
|
|
+ auditmodel.BusinessKey = auditentity.BusinessKey
|
|
|
|
|
|
- var ActiComplete workflow.ActiCompleteVM
|
|
|
+ }
|
|
|
ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
- ActiComplete.BusinessKey = businessKey
|
|
|
ActiComplete.UserNames = firstAudit
|
|
|
ActiComplete.UserId = this.User.Id
|
|
|
ActiComplete.Result = "1"
|
|
|
ActiComplete.Remarks = model.Remark
|
|
|
ActiComplete.CallbackUrl = ""
|
|
|
+
|
|
|
//提交给二级单位初审
|
|
|
receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
-
|
|
|
- // 存储审批历史
|
|
|
- var audithistoryentity audithistory.Base_AuditHistory
|
|
|
- audithistoryentity.EntityId = annualId
|
|
|
- audithistoryentity.WorkflowId = historworkflowid
|
|
|
- audithistoryentity.Process = workflow.OIL_AUDIT_APPLY
|
|
|
- audithistoryentity.BusinessKey = auditentity.BusinessKey
|
|
|
- audithistoryentity.Type = model.SupplierTypeName
|
|
|
- audithistoryentity.BackStep = utils.ToStr(auditentity.Status)
|
|
|
- audithistoryentity.Index = auditentity.AuditIndex
|
|
|
- audithistoryentity.CreateOn = time.Now()
|
|
|
- audithistoryentity.CreateBy = this.User.Realname
|
|
|
- audithistoryentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
- svc.InsertEntity(audithistoryentity)
|
|
|
-
|
|
|
- var auditmodel annualaudit.OilAnnualAudit
|
|
|
- auditmodel.WorkflowId = processInstanceId
|
|
|
+ if statusint < 0 {
|
|
|
+ // 存储审批历史
|
|
|
+ var audithistoryentity audithistory.Base_AuditHistory
|
|
|
+ audithistoryentity.EntityId, _ = strconv.Atoi(annualId)
|
|
|
+ audithistoryentity.WorkflowId = historworkflowid
|
|
|
+ audithistoryentity.Process = workflow.OIL_AUDIT_APPLY
|
|
|
+ audithistoryentity.BusinessKey = auditentity.BusinessKey
|
|
|
+ audithistoryentity.Type = model.SupplierTypeName
|
|
|
+ audithistoryentity.BackStep = utils.ToStr(auditentity.Status)
|
|
|
+ audithistoryentity.Index = auditentity.AuditIndex
|
|
|
+ audithistoryentity.CreateOn = time.Now()
|
|
|
+ audithistoryentity.CreateBy = this.User.Realname
|
|
|
+ audithistoryentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc.InsertEntity(audithistoryentity)
|
|
|
+ }
|
|
|
auditmodel.Status = suppliercert.FIRST_TRIAL_STATUS //二级单位初审
|
|
|
auditmodel.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
- auditmodel.BusinessKey = businessKey
|
|
|
+ auditmodel.SecondAudit, _ = strconv.Atoi(secondAudit)
|
|
|
+ auditmodel.ThirdAudit, _ = strconv.Atoi(thirdAudit)
|
|
|
cols := []string{
|
|
|
"Id",
|
|
|
"WorkflowId",
|
|
|
"Status",
|
|
|
"FirstAudit",
|
|
|
"BusinessKey",
|
|
|
+ "SecondAudit",
|
|
|
+ "ThirdAudit",
|
|
|
}
|
|
|
if receiveVal == "true" {
|
|
|
_, err := svc.UpdateEntityByIdCols(annualId, auditmodel, cols)
|
|
|
if err == nil {
|
|
|
//新增
|
|
|
- errinfo.Message = "添加成功!"
|
|
|
+ errinfo.Message = "提交成功!"
|
|
|
errinfo.Code = 0
|
|
|
- errinfo.Item = annualId
|
|
|
+ errinfo.Item = auditmodel.Status
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
} else {
|
|
|
- errinfo.Message = "添加失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Message = "提交失败!" + utils.AlertProcess(err.Error())
|
|
|
errinfo.Code = -1
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
@@ -544,175 +559,84 @@ func (this *AnnualAuditController) AnnualAudit() {
|
|
|
svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
|
|
|
var jsonblob = this.Ctx.Input.RequestBody
|
|
|
var dataother ShenHeModel
|
|
|
- ProfAudit := this.GetString("ProfAudit")
|
|
|
+ var errinfo ErrorInfo
|
|
|
json.Unmarshal(jsonblob, &dataother)
|
|
|
+ ProfAudit := this.GetString("ProfAudit")
|
|
|
var list annualaudit.OilAnnualAudit
|
|
|
where := " Id = '" + strconv.Itoa(dataother.AnnualId) + "'"
|
|
|
svc.GetEntityByWhere(""+OilAnnualAuditName, where, &list)
|
|
|
svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
//审核状态判断进行的操作
|
|
|
- if dataother.SuccessStatus == 1 {
|
|
|
- var errinfo ErrorInfo
|
|
|
- var auditset []auditsetting.Base_OilAuditSetting
|
|
|
- where := "OrganizeId=" + ProfAudit + " and AuditStepCode='" + workflow.PROF_RECE + "'"
|
|
|
- svc.GetEntitysByWhere(OilAuditSettingName, where, &auditset)
|
|
|
+ step := 2
|
|
|
+ status := ""
|
|
|
+ backstatus := "0"
|
|
|
+ var userIds string
|
|
|
+ if list.Status == suppliercert.FIRST_TRIAL_STATUS {
|
|
|
+ userIds = utils.ToStr(list.SecondAudit)
|
|
|
+ status = suppliercert.SECOND_TRIAL_STATUS
|
|
|
+ step = 2
|
|
|
+ backstatus = "-1"
|
|
|
+ } else if list.Status == suppliercert.SECOND_TRIAL_STATUS {
|
|
|
+ status = suppliercert.THIRD_TRIAL_STATUS
|
|
|
+ step = 2
|
|
|
+ backstatus = "-2"
|
|
|
+ supsvc := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
var users []userRole.Base_RoleList
|
|
|
- if auditset != nil {
|
|
|
- svc := auditsetting.GetOilAuditSettingService(utils.DBE)
|
|
|
- svc.GetAuditUserList(strconv.Itoa(auditset[0].Id), &users)
|
|
|
- }
|
|
|
- var userIds string
|
|
|
+ supsvc.GetAuditUser(strconv.Itoa(list.ThirdAudit), workflow.PROF_RECE, &users)
|
|
|
for _, tmpUser := range users {
|
|
|
userIds += strconv.FormatInt(tmpUser.Id, 10) + ","
|
|
|
}
|
|
|
userIds = strings.Trim(userIds, ",")
|
|
|
- var ActiComplete workflow.ActiCompleteVM
|
|
|
- ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
- ActiComplete.BusinessKey = list.BusinessKey
|
|
|
- ActiComplete.UserNames = userIds
|
|
|
- ActiComplete.UserId = this.User.Id
|
|
|
+ } else if list.Status == suppliercert.THIRD_TRIAL_STATUS {
|
|
|
+ userIds = ProfAudit
|
|
|
+ status = suppliercert.PROF_AUDIT_STATUS
|
|
|
+ step = 2
|
|
|
+ backstatus = "-3"
|
|
|
+ } else if list.Status == suppliercert.PROF_AUDIT_STATUS {
|
|
|
+ status = suppliercert.CENT_AUDIT_STATUS
|
|
|
+ step = 3
|
|
|
+ backstatus = "-4"
|
|
|
+ }
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
+ ActiComplete.BusinessKey = list.BusinessKey
|
|
|
+ ActiComplete.UserNames = userIds
|
|
|
+ ActiComplete.UserId = this.User.Id
|
|
|
+ ActiComplete.Remarks = dataother.AuditorRemark
|
|
|
+ ActiComplete.CallbackUrl = ""
|
|
|
+ if dataother.SuccessStatus == 1 {
|
|
|
ActiComplete.Result = "1"
|
|
|
- ActiComplete.Remarks = dataother.AuditorRemark
|
|
|
- ActiComplete.CallbackUrl = ""
|
|
|
- //提交给二级单位初审
|
|
|
- receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
- var auditmodel annualaudit.OilAnnualAudit
|
|
|
- auditmodel.Status = "1"
|
|
|
- cols := []string{
|
|
|
- "Id",
|
|
|
- "Status",
|
|
|
- }
|
|
|
- if receiveVal == "true" {
|
|
|
- _, err := svc.UpdateEntityByIdCols(dataother.AnnualId, auditmodel, cols)
|
|
|
- if err == nil {
|
|
|
- errinfo.Message = "审核通过!"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- } else {
|
|
|
- errinfo.Message = "审核错误!" + utils.AlertProcess(err.Error())
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- }
|
|
|
- } else {
|
|
|
- errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- }
|
|
|
-
|
|
|
- } else if dataother.SuccessStatus == 2 {
|
|
|
- var errinfo ErrorInfo
|
|
|
- var ActiComplete workflow.ActiCompleteVM
|
|
|
- ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
- ActiComplete.BusinessKey = list.BusinessKey
|
|
|
- ActiComplete.UserNames = ""
|
|
|
- ActiComplete.UserId = this.User.Id
|
|
|
- ActiComplete.Result = "0"
|
|
|
- ActiComplete.Remarks = dataother.AuditorRemark
|
|
|
- ActiComplete.CallbackUrl = ""
|
|
|
receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
var auditmodel annualaudit.OilAnnualAudit
|
|
|
- auditmodel.Status = "2"
|
|
|
- auditmodel.AuditIndex = auditmodel.AuditIndex + 1
|
|
|
- cols := []string{
|
|
|
- "Id",
|
|
|
- "Status",
|
|
|
- "AuditIndex",
|
|
|
- }
|
|
|
- if receiveVal == "true" {
|
|
|
- _, err := svc.UpdateEntityByIdCols(dataother.AnnualId, auditmodel, cols)
|
|
|
- if err == nil {
|
|
|
- errinfo.Message = "审核未通过!"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- } else {
|
|
|
- errinfo.Message = "审核错误!" + utils.AlertProcess(err.Error())
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
+ auditmodel.Status = status
|
|
|
+ oldaplydate := list.ApplyTime
|
|
|
+ if list.Status == suppliercert.PROF_AUDIT_STATUS {
|
|
|
+ //aplydatechange := oldaplydate.Format("2006-01-02")
|
|
|
+ //local, _ := time.LoadLocation("Local")
|
|
|
+ //oldtimeaply, _ := time.ParseInLocation("2006-01-02", aplydatechange, local)
|
|
|
+ auditmodel.ApplyTime = oldaplydate.AddDate(1, 0, 0)
|
|
|
+ var certmodel suppliercert.OilSupplierCert
|
|
|
+ certmodel.ApplyTime = oldaplydate.AddDate(1, 0, 0)
|
|
|
+ certmodel.AuditDate = time.Now()
|
|
|
+ certcols := []string{
|
|
|
+ "Id",
|
|
|
+ "ApplyTime",
|
|
|
+ "AuditDate",
|
|
|
}
|
|
|
- } else {
|
|
|
- errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- }
|
|
|
- } else if dataother.SuccessStatus == 3 {
|
|
|
- var errinfo ErrorInfo
|
|
|
- var ActiComplete workflow.ActiCompleteVM
|
|
|
- ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
- ActiComplete.BusinessKey = list.BusinessKey
|
|
|
- ActiComplete.UserNames = ProfAudit
|
|
|
- ActiComplete.UserId = this.User.Id
|
|
|
- ActiComplete.Result = "1"
|
|
|
- ActiComplete.Remarks = dataother.AuditorRemark
|
|
|
- ActiComplete.CallbackUrl = ""
|
|
|
- //提交给业务处室专业审核
|
|
|
- receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
- var auditmodel annualaudit.OilAnnualAudit
|
|
|
- auditmodel.Status = "3"
|
|
|
- cols := []string{
|
|
|
- "Id",
|
|
|
- "Status",
|
|
|
+ svc.UpdateEntityByIdCols(list.CerId, certmodel, certcols)
|
|
|
+ }else {
|
|
|
+ auditmodel.ApplyTime = oldaplydate
|
|
|
}
|
|
|
+ auditmodel.Step = step
|
|
|
if receiveVal == "true" {
|
|
|
- _, err := svc.UpdateEntityByIdCols(dataother.AnnualId, auditmodel, cols)
|
|
|
- if err == nil {
|
|
|
- errinfo.Message = "已分配接收人!"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- } else {
|
|
|
- errinfo.Message = "分配错误!" + utils.AlertProcess(err.Error())
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
+ cols := []string{
|
|
|
+ "Id",
|
|
|
+ "Status",
|
|
|
+ "Step",
|
|
|
+ "ApplyTime",
|
|
|
}
|
|
|
- } else {
|
|
|
- errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- }
|
|
|
- } else if dataother.SuccessStatus == 4 {
|
|
|
- var errinfo ErrorInfo
|
|
|
- var ActiComplete workflow.ActiCompleteVM
|
|
|
- ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
- ActiComplete.BusinessKey = list.BusinessKey
|
|
|
- ActiComplete.UserNames = ""
|
|
|
- ActiComplete.UserId = this.User.Id
|
|
|
- ActiComplete.Result = "1"
|
|
|
- ActiComplete.Remarks = dataother.AuditorRemark
|
|
|
- ActiComplete.CallbackUrl = ""
|
|
|
- receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
- var auditmodel annualaudit.OilAnnualAudit
|
|
|
- oldaplydate := list.ApplyTime
|
|
|
- //aplydatechange := oldaplydate.Format("2006-01-02")
|
|
|
- //local, _ := time.LoadLocation("Local")
|
|
|
- //oldtimeaply, _ := time.ParseInLocation("2006-01-02", aplydatechange, local)
|
|
|
- auditmodel.Status = "4"
|
|
|
- auditmodel.Step = 3
|
|
|
- auditmodel.ApplyTime = oldaplydate.AddDate(1,0,0)
|
|
|
- cols := []string{
|
|
|
- "Id",
|
|
|
- "Status",
|
|
|
- "Step",
|
|
|
- "ApplyTime",
|
|
|
- }
|
|
|
- var certmodel suppliercert.OilSupplierCert
|
|
|
- certmodel.ApplyTime = oldaplydate.AddDate(1,0,0)
|
|
|
- certmodel.AuditDate = time.Now()
|
|
|
- certcols := []string{
|
|
|
- "Id",
|
|
|
- "ApplyTime",
|
|
|
- "AuditDate",
|
|
|
- }
|
|
|
- if receiveVal == "true" {
|
|
|
- _, err := svc.UpdateEntityByIdCols(dataother.AnnualId, auditmodel, cols)
|
|
|
- _, err = svc.UpdateEntityByIdCols(list.CerId, certmodel, certcols)
|
|
|
+ svc.UpdateEntityByIdCols(dataother.AnnualId, auditmodel, cols)
|
|
|
+
|
|
|
paysvc := paymentinfo.GetPaymentService(utils.DBE)
|
|
|
var Amount float64
|
|
|
if list.SupplierTypeName == "01" {
|
|
|
@@ -722,59 +646,54 @@ func (this *AnnualAuditController) AnnualAudit() {
|
|
|
} else if list.SupplierTypeName == "03" {
|
|
|
Amount = 8000
|
|
|
}
|
|
|
- err = paysvc.AddPaymentinfo(list.SupplierId, list.CerId, Amount, "2")
|
|
|
- if err == nil {
|
|
|
- errinfo.Message = "审核通过!"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- } else {
|
|
|
- errinfo.Message = "审核错误!" + utils.AlertProcess(err.Error())
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- }
|
|
|
+ paysvc.AddPaymentinfo(list.SupplierId, list.Id, Amount, "2")
|
|
|
+ errinfo.Message = "提交成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
} else {
|
|
|
errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
errinfo.Code = -1
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
+ return
|
|
|
}
|
|
|
- } else if dataother.SuccessStatus == 5 {
|
|
|
- var errinfo ErrorInfo
|
|
|
- var ActiComplete workflow.ActiCompleteVM
|
|
|
- ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
- ActiComplete.BusinessKey = list.BusinessKey
|
|
|
- ActiComplete.UserNames = ""
|
|
|
- ActiComplete.UserId = this.User.Id
|
|
|
+ } else {
|
|
|
ActiComplete.Result = "0"
|
|
|
- ActiComplete.Remarks = dataother.AuditorRemark
|
|
|
- ActiComplete.CallbackUrl = ""
|
|
|
receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
- var auditmodel annualaudit.OilAnnualAudit
|
|
|
- auditmodel.Status = "5"
|
|
|
- cols := []string{
|
|
|
- "Id",
|
|
|
- "Status",
|
|
|
- }
|
|
|
if receiveVal == "true" {
|
|
|
- _, err := svc.UpdateEntityByIdCols(dataother.AnnualId, auditmodel, cols)
|
|
|
+ if list.Status == suppliercert.PROF_AUDIT_STATUS {
|
|
|
+ list.Status = suppliercert.NOPASS_STATUS
|
|
|
+ list.AuditIndex = list.AuditIndex + 1
|
|
|
+ } else {
|
|
|
+ list.Status = backstatus
|
|
|
+ list.AuditIndex = list.AuditIndex + 1
|
|
|
+ }
|
|
|
+ list.Step = 1
|
|
|
+ cols := []string{
|
|
|
+ "Status",
|
|
|
+ "Step",
|
|
|
+ "AuditIndex",
|
|
|
+ }
|
|
|
+ _, err := svc.UpdateEntityByIdCols(dataother.AnnualId, list, cols)
|
|
|
if err == nil {
|
|
|
- errinfo.Message = "审核未通过!"
|
|
|
+ errinfo.Message = "提交成功!"
|
|
|
errinfo.Code = 0
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
} else {
|
|
|
- errinfo.Message = "审核错误!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Message = "提交失败!"
|
|
|
errinfo.Code = -1
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
errinfo.Code = -1
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
+ return
|
|
|
}
|
|
|
}
|
|
|
}
|