|
|
@@ -1,6 +1,7 @@
|
|
|
package oilsupplier
|
|
|
|
|
|
import (
|
|
|
+ "dashoo.cn/backend/api/business/audithistory"
|
|
|
"dashoo.cn/business2/userRole"
|
|
|
"encoding/json"
|
|
|
"strconv"
|
|
|
@@ -382,6 +383,14 @@ func (this *OilSupplierCertAppendController) GetMyTaskEntityList() {
|
|
|
//找出待办任务
|
|
|
actisvc := workflow.GetActivitiService(utils.DBE)
|
|
|
appendIdList := actisvc.GetMyTasks(workflow.OIL_APPEND_APPLY, this.User.Id)
|
|
|
+ appendIdarr := strings.Split(appendIdList, ",")
|
|
|
+ for i, item := range appendIdarr {
|
|
|
+ idx := strings.Index(item,"-")
|
|
|
+ if (idx >= 0 ) {
|
|
|
+ appendIdarr[i] = strings.Split(item, "-")[0]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ appendIdList = strings.Join(appendIdarr, ",")
|
|
|
where += " and Id in (" + appendIdList + ")"
|
|
|
//根据部门查询待办任务
|
|
|
|
|
|
@@ -412,7 +421,8 @@ func (this *OilSupplierCertAppendController) AuditEntity() {
|
|
|
certSrv := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
|
|
|
var supplierCertAppendEntity suppliercertappend.OilSupplierCertAppend
|
|
|
certSrv.GetEntityById(certappendId, &supplierCertAppendEntity)
|
|
|
-
|
|
|
+ var historworkflowid string
|
|
|
+ historworkflowid = supplierCertAppendEntity.WorkFlowId
|
|
|
var errinfo ErrorDataInfo
|
|
|
defer func() { //finally处理失败的异常
|
|
|
if err := recover(); err != nil {
|
|
|
@@ -428,23 +438,49 @@ func (this *OilSupplierCertAppendController) AuditEntity() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
}()
|
|
|
+ var suppappend suppliercertappend.OilSupplierCertAppend
|
|
|
+ //第二次提交先清空工作流
|
|
|
+ if supplierCertAppendEntity.AuditIndex > 0 {
|
|
|
+ suppappend.WorkFlowId = ""
|
|
|
+ cols := []string{
|
|
|
+ "WorkflowId",
|
|
|
+ }
|
|
|
+ certSrv.UpdateEntityByIdCols(certappendId, suppappend, cols)
|
|
|
+ supplierCertAppendEntity.WorkFlowId = ""
|
|
|
+ }
|
|
|
svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
processInstanceId := ""
|
|
|
+ businessKey := ""
|
|
|
if supplierCertAppendEntity.WorkFlowId == "0" || len(supplierCertAppendEntity.WorkFlowId) <= 0 {
|
|
|
//启动工作流
|
|
|
- processInstanceId = svcActiviti.StartProcess(workflow.OIL_APPEND_APPLY, certappendId, this.User.Id)
|
|
|
+ businessKey = certappendId + "-" + strconv.Itoa(supplierCertAppendEntity.AuditIndex)
|
|
|
+ processInstanceId = svcActiviti.StartProcess(workflow.OIL_APPEND_APPLY, businessKey, this.User.Id)
|
|
|
}
|
|
|
var ActiComplete workflow.ActiCompleteVM
|
|
|
ActiComplete.ProcessKey = workflow.OIL_APPEND_APPLY
|
|
|
- ActiComplete.BusinessKey = certappendId
|
|
|
+ ActiComplete.BusinessKey = businessKey
|
|
|
ActiComplete.UserNames = firstAudit
|
|
|
ActiComplete.UserId = this.User.Id
|
|
|
ActiComplete.Result = "1"
|
|
|
ActiComplete.Remarks = AuditRemark
|
|
|
ActiComplete.CallbackUrl = ""
|
|
|
receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
-
|
|
|
if receiveVal == "true" {
|
|
|
+ if supplierCertAppendEntity.AuditIndex > 0 {
|
|
|
+ // 审批历史
|
|
|
+ var audithistoryentity audithistory.Base_AuditHistory
|
|
|
+ audithistoryentity.EntityId, _ = strconv.Atoi(certappendId)
|
|
|
+ audithistoryentity.WorkflowId = historworkflowid
|
|
|
+ audithistoryentity.Process = workflow.OIL_APPEND_APPLY
|
|
|
+ audithistoryentity.BusinessKey = businessKey
|
|
|
+ audithistoryentity.Type = supplierCertAppendEntity.AppendType
|
|
|
+ audithistoryentity.BackStep = supplierCertAppendEntity.Status
|
|
|
+ audithistoryentity.Index = supplierCertAppendEntity.AuditIndex
|
|
|
+ audithistoryentity.CreateOn = time.Now()
|
|
|
+ audithistoryentity.CreateBy = this.User.Realname
|
|
|
+ audithistoryentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ certSrv.InsertEntity(audithistoryentity)
|
|
|
+ }
|
|
|
errinfo.Message = "提交成功!"
|
|
|
errinfo.Code = 0
|
|
|
this.Data["json"] = &errinfo
|
|
|
@@ -461,11 +497,15 @@ func (this *OilSupplierCertAppendController) AuditEntity() {
|
|
|
model.WorkFlowId = processInstanceId
|
|
|
model.Status = suppliercert.FIRST_TRIAL_STATUS //二级单位初审
|
|
|
model.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
+ model.AuditIndex = supplierCertAppendEntity.AuditIndex
|
|
|
+ model.BusinessKey = businessKey
|
|
|
cols := []string{
|
|
|
"Id",
|
|
|
"WorkFlowId",
|
|
|
"Status",
|
|
|
"FirstAudit",
|
|
|
+ "AuditIndex",
|
|
|
+ "BusinessKey",
|
|
|
}
|
|
|
certSrv.UpdateEntityByIdCols(certappendId, model, cols)
|
|
|
}
|
|
|
@@ -553,7 +593,7 @@ func (this *OilSupplierCertAppendController) AuditEntityFir() {
|
|
|
svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
var ActiComplete workflow.ActiCompleteVM
|
|
|
ActiComplete.ProcessKey = workflow.OIL_APPEND_APPLY
|
|
|
- ActiComplete.BusinessKey = appendId
|
|
|
+ ActiComplete.BusinessKey = supplierCertAppendEntity.BusinessKey
|
|
|
ActiComplete.UserNames = userIds
|
|
|
ActiComplete.UserId = this.User.Id
|
|
|
ActiComplete.Remarks = dataother.AuditorRemark
|
|
|
@@ -596,19 +636,34 @@ func (this *OilSupplierCertAppendController) AuditEntityFir() {
|
|
|
} else {
|
|
|
ActiComplete.Result = "0"
|
|
|
receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
-
|
|
|
if receiveVal == "true" {
|
|
|
- supplierCertAppendEntity.Status = "0"
|
|
|
- supplierCertAppendEntity.Step = step
|
|
|
+ if supplierCertAppendEntity.Status == "5" {
|
|
|
+ supplierCertAppendEntity.Status = "-1"
|
|
|
+ supplierCertAppendEntity.Step = step
|
|
|
+ supplierCertAppendEntity.AuditIndex = supplierCertAppendEntity.AuditIndex + 1
|
|
|
+ }else {
|
|
|
+ supplierCertAppendEntity.Status = "0"
|
|
|
+ supplierCertAppendEntity.Step = 1
|
|
|
+ supplierCertAppendEntity.AuditIndex = supplierCertAppendEntity.AuditIndex + 1
|
|
|
+ }
|
|
|
cols := []string{
|
|
|
"Status",
|
|
|
"Step",
|
|
|
+ "AuditIndex",
|
|
|
}
|
|
|
- certSrv.UpdateEntityByIdCols(appendId, supplierCertAppendEntity, cols)
|
|
|
- errinfo.Message = "提交成功!"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
+ _,err := certSrv.UpdateEntityByIdCols(appendId, supplierCertAppendEntity, cols)
|
|
|
+ if err == nil {
|
|
|
+ errinfo.Message = "提交成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }else {
|
|
|
+ errinfo.Message = "提交失败!"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
errinfo.Code = -1
|