|
@@ -1,7 +1,6 @@
|
|
|
package oilsupplier
|
|
package oilsupplier
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
- "dashoo.cn/backend/api/business/audithistory"
|
|
|
|
|
"dashoo.cn/backend/api/business/codecsequence"
|
|
"dashoo.cn/backend/api/business/codecsequence"
|
|
|
msg2 "dashoo.cn/backend/api/business/msg"
|
|
msg2 "dashoo.cn/backend/api/business/msg"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/annualaudit"
|
|
"dashoo.cn/backend/api/business/oilsupplier/annualaudit"
|
|
@@ -606,16 +605,114 @@ func (this *OilSupplierCertController) DeleteEntity() {
|
|
|
// @Title 提交审批
|
|
// @Title 提交审批
|
|
|
// @Description 提交审批
|
|
// @Description 提交审批
|
|
|
// @Success 200 {object} controllers.Request
|
|
// @Success 200 {object} controllers.Request
|
|
|
-// @router /audit/:id [post]
|
|
|
|
|
|
|
+// @router /first-audit/:id [post]
|
|
|
func (this *OilSupplierCertController) AuditEntity() {
|
|
func (this *OilSupplierCertController) AuditEntity() {
|
|
|
|
|
+ certId := this.Ctx.Input.Param(":id")
|
|
|
|
|
+ unitId := this.GetString("UnitId")
|
|
|
|
|
+ AuditRemark := this.GetString("AuditRemark")
|
|
|
|
|
+ var errinfo ErrorDataInfo
|
|
|
|
|
+ defer func() { //finally处理失败的异常
|
|
|
|
|
+ if err := recover(); err != nil {
|
|
|
|
|
+ errinfo.Message = err.(string)
|
|
|
|
|
+ errinfo.Code = -1
|
|
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
|
|
+ this.ServeJSON()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //返回正确结果
|
|
|
|
|
+ errinfo.Message = "提交成功"
|
|
|
|
|
+ errinfo.Code = 0
|
|
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
|
|
+ this.ServeJSON()
|
|
|
|
|
+ }
|
|
|
|
|
+ }()
|
|
|
|
|
+
|
|
|
|
|
+ //取出审批列表
|
|
|
|
|
+ certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
|
|
+ var supplierCertEntity suppliercert.OilSupplierCert
|
|
|
|
|
+ certSrv.GetEntityById(certId, &supplierCertEntity)
|
|
|
|
|
+ //取出企业主表
|
|
|
|
|
+ supplierSvc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
|
|
+ var supplierEntity supplier.OilSupplier
|
|
|
|
|
+ supplierSvc.GetEntityById(supplierCertEntity.SupplierId, &supplierEntity)
|
|
|
|
|
+ result := strconv.Itoa(this.User.IsCompanyUser)
|
|
|
|
|
+ status, _ := strconv.Atoi(supplierCertEntity.Status)
|
|
|
|
|
+ if status > 0 {
|
|
|
|
|
+ panic("工作流已经启动,请刷新重试!")
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
|
|
+ //启动工作流
|
|
|
|
|
+ businessKey := certId + "-" + strconv.Itoa(supplierCertEntity.AuditIndex)
|
|
|
|
|
+ processInstanceId := svcActiviti.StartProcess2(workflow.OIL_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, result, supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
|
|
|
|
|
+ //同时完成此步骤
|
|
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_ENUSER_SUPPLIER_APPLY
|
|
|
|
|
+ ActiComplete.BusinessKey = businessKey
|
|
|
|
|
+ // ActiComplete.UserNames =
|
|
|
|
|
+ ActiComplete.UserId = this.User.Id
|
|
|
|
|
+ ActiComplete.Result = result
|
|
|
|
|
+ ActiComplete.Remarks = AuditRemark
|
|
|
|
|
+ ActiComplete.CallbackUrl = ""
|
|
|
|
|
+ receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
|
|
+ if receiveVal != "true" {
|
|
|
|
|
+ panic("工作流异常,请联系管理员!")
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //记下workflowID(首次提交时才会记录,中间状态请忽略) 及审批状态
|
|
|
|
|
+ supplierCertEntity.WorkflowId = processInstanceId
|
|
|
|
|
+ if this.User.IsCompanyUser == 1 {
|
|
|
|
|
+ supplierCertEntity.Status = suppliercert.FEN_TRIAL_STATUS //分办
|
|
|
|
|
+ } else if this.User.IsCompanyUser == 0 {
|
|
|
|
|
+ supplierCertEntity.Status = suppliercert.FIRST_TRIAL_STATUS //二级单位初审
|
|
|
|
|
+ }
|
|
|
|
|
+ supplierCertEntity.Step = 1
|
|
|
|
|
+ supplierCertEntity.FirstAudit, _ = strconv.Atoi(this.User.Id)
|
|
|
|
|
+ supplierCertEntity.AuditIndex = supplierCertEntity.AuditIndex + 1
|
|
|
|
|
+ supplierCertEntity.BusinessKey = ActiComplete.BusinessKey
|
|
|
|
|
+ supplierCertEntity.ProcessKey = ActiComplete.ProcessKey
|
|
|
|
|
+ supplierCertEntity.CommitComId = unitId
|
|
|
|
|
+ cols := []string{
|
|
|
|
|
+ "Id",
|
|
|
|
|
+ "WorkflowId",
|
|
|
|
|
+ "Status",
|
|
|
|
|
+ "Step",
|
|
|
|
|
+ "FirstAudit",
|
|
|
|
|
+ "AuditIndex",
|
|
|
|
|
+ "BusinessKey",
|
|
|
|
|
+ "ProcessKey",
|
|
|
|
|
+ "CommitComId",
|
|
|
|
|
+ }
|
|
|
|
|
+ certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// @Title 分办审批
|
|
|
|
|
+// @Description 分办审批
|
|
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
|
|
+// @router /audit/:id [post]
|
|
|
|
|
+func (this *OilSupplierCertController) SeparateAuditEntity() {
|
|
|
certId := this.Ctx.Input.Param(":id")
|
|
certId := this.Ctx.Input.Param(":id")
|
|
|
firstAudit := this.GetString("FirstAuditName")
|
|
firstAudit := this.GetString("FirstAuditName")
|
|
|
- unitId := this.GetString("FirstAuditName")
|
|
|
|
|
AuditRemark := this.GetString("AuditRemark")
|
|
AuditRemark := this.GetString("AuditRemark")
|
|
|
secondAudit := this.GetString("SecondAudit")
|
|
secondAudit := this.GetString("SecondAudit")
|
|
|
thirdAudit := this.GetString("ThirdAudit")
|
|
thirdAudit := this.GetString("ThirdAudit")
|
|
|
typeCode := this.GetString("TypeCode")
|
|
typeCode := this.GetString("TypeCode")
|
|
|
|
|
|
|
|
|
|
+ var errinfo ErrorDataInfo
|
|
|
|
|
+ defer func() { //finally处理失败的异常
|
|
|
|
|
+ if err := recover(); err != nil {
|
|
|
|
|
+ errinfo.Message = "提交失败," + err.(string)
|
|
|
|
|
+ errinfo.Code = -1
|
|
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
|
|
+ this.ServeJSON()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //返回正确结果
|
|
|
|
|
+ errinfo.Message = "审核提交成功"
|
|
|
|
|
+ errinfo.Code = 0
|
|
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
|
|
+ this.ServeJSON()
|
|
|
|
|
+ }
|
|
|
|
|
+ }()
|
|
|
|
|
+
|
|
|
var setting auditsetting.Base_OilAuditSetting
|
|
var setting auditsetting.Base_OilAuditSetting
|
|
|
var userlist []userRole.Base_User
|
|
var userlist []userRole.Base_User
|
|
|
usvc := userRole.GetUserService(utils.DBE)
|
|
usvc := userRole.GetUserService(utils.DBE)
|
|
@@ -653,55 +750,13 @@ func (this *OilSupplierCertController) AuditEntity() {
|
|
|
var supplierEntity supplier.OilSupplier
|
|
var supplierEntity supplier.OilSupplier
|
|
|
supplierSvc.GetEntityById(supplierCertEntity.SupplierId, &supplierEntity)
|
|
supplierSvc.GetEntityById(supplierCertEntity.SupplierId, &supplierEntity)
|
|
|
|
|
|
|
|
- // svc := organize.GetOrganizeService(utils.DBE)
|
|
|
|
|
- // unitId := svc.GetMyUnitDepartmentId(this.User.DepartmentId)
|
|
|
|
|
-
|
|
|
|
|
- var errinfo ErrorDataInfo
|
|
|
|
|
- defer func() { //finally处理失败的异常
|
|
|
|
|
- if err := recover(); err != nil {
|
|
|
|
|
- errinfo.Message = "提交失败," + err.(string)
|
|
|
|
|
- errinfo.Code = -1
|
|
|
|
|
- this.Data["json"] = &errinfo
|
|
|
|
|
- this.ServeJSON()
|
|
|
|
|
- } else {
|
|
|
|
|
- //返回正确结果
|
|
|
|
|
- errinfo.Message = "审核提交成功"
|
|
|
|
|
- errinfo.Code = 0
|
|
|
|
|
- this.Data["json"] = &errinfo
|
|
|
|
|
- this.ServeJSON()
|
|
|
|
|
- }
|
|
|
|
|
- }()
|
|
|
|
|
-
|
|
|
|
|
- ////判断当前部门是否企业用户
|
|
|
|
|
- //result := "1"
|
|
|
|
|
- //if this.User.IsCompanyUser == 1 {
|
|
|
|
|
- // result = "0"
|
|
|
|
|
- //}
|
|
|
|
|
-
|
|
|
|
|
svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
- ////获得有审核权限的人员
|
|
|
|
|
- //var users []userRole.Base_RoleList
|
|
|
|
|
- //var userIds string
|
|
|
|
|
- //var auditWorkflow auditsetting.Base_OilAuditSetting
|
|
|
|
|
- //rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
|
|
|
|
|
- //rsvc.GetAuditStepRoleEntity(OilAuditSettingName, firstAudit, workflow.FIRST_TRIAL, &auditWorkflow)
|
|
|
|
|
- //users = rsvc.GetUserByRole(strconv.Itoa(auditWorkflow.RoleId), this.User.AccCode) //
|
|
|
|
|
-
|
|
|
|
|
- processInstanceId := ""
|
|
|
|
|
- businessKey := ""
|
|
|
|
|
- result := strconv.Itoa(this.User.IsCompanyUser)
|
|
|
|
|
- status, _ := strconv.Atoi(supplierCertEntity.Status)
|
|
|
|
|
- if status <= 0 {
|
|
|
|
|
- //启动工作流
|
|
|
|
|
- businessKey = certId + "-" + strconv.Itoa(supplierCertEntity.AuditIndex)
|
|
|
|
|
- processInstanceId = svcActiviti.StartProcess2(workflow.OIL_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, result, supplierCertEntity.SupplierTypeCode, supplierEntity.SupplierName)
|
|
|
|
|
- } else {
|
|
|
|
|
- processInstanceId = supplierCertEntity.WorkflowId
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ processInstanceId := supplierCertEntity.WorkflowId
|
|
|
|
|
+ businessKey := supplierCertEntity.BusinessKey
|
|
|
|
|
+ result := "1" //分办默认向前走
|
|
|
|
|
|
|
|
var ActiComplete workflow.ActiCompleteVM
|
|
var ActiComplete workflow.ActiCompleteVM
|
|
|
ActiComplete.ProcessKey = workflow.OIL_ENUSER_SUPPLIER_APPLY
|
|
ActiComplete.ProcessKey = workflow.OIL_ENUSER_SUPPLIER_APPLY
|
|
|
-
|
|
|
|
|
ActiComplete.BusinessKey = businessKey
|
|
ActiComplete.BusinessKey = businessKey
|
|
|
ActiComplete.UserNames = firstAudit
|
|
ActiComplete.UserNames = firstAudit
|
|
|
ActiComplete.UserId = this.User.Id
|
|
ActiComplete.UserId = this.User.Id
|
|
@@ -709,20 +764,6 @@ func (this *OilSupplierCertController) AuditEntity() {
|
|
|
ActiComplete.Remarks = AuditRemark
|
|
ActiComplete.Remarks = AuditRemark
|
|
|
ActiComplete.CallbackUrl = ""
|
|
ActiComplete.CallbackUrl = ""
|
|
|
receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
-
|
|
|
|
|
- var audithistoryentity audithistory.Base_AuditHistory
|
|
|
|
|
- audithistoryentity.EntityId = supplierCertEntity.Id
|
|
|
|
|
- audithistoryentity.WorkflowId = supplierCertEntity.WorkflowId
|
|
|
|
|
- audithistoryentity.Process = ActiComplete.ProcessKey
|
|
|
|
|
- audithistoryentity.BusinessKey = ActiComplete.BusinessKey
|
|
|
|
|
- audithistoryentity.Type = supplierCertEntity.SupplierTypeCode
|
|
|
|
|
- audithistoryentity.BackStep = supplierCertEntity.Status
|
|
|
|
|
- audithistoryentity.Index = supplierCertEntity.AuditIndex
|
|
|
|
|
- audithistoryentity.CreateOn = time.Now()
|
|
|
|
|
- audithistoryentity.CreateBy = this.User.Realname
|
|
|
|
|
- audithistoryentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
|
|
- certSrv.InsertEntity(audithistoryentity)
|
|
|
|
|
-
|
|
|
|
|
if receiveVal == "true" {
|
|
if receiveVal == "true" {
|
|
|
errinfo.Message = "提交成功!"
|
|
errinfo.Message = "提交成功!"
|
|
|
errinfo.Code = 0
|
|
errinfo.Code = 0
|
|
@@ -736,36 +777,24 @@ func (this *OilSupplierCertController) AuditEntity() {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- fmt.Println("-----------processInstanceId------------")
|
|
|
|
|
//记下workflowID(首次提交时才会记录,中间状态请忽略) 及审批状态
|
|
//记下workflowID(首次提交时才会记录,中间状态请忽略) 及审批状态
|
|
|
-
|
|
|
|
|
supplierCertEntity.WorkflowId = processInstanceId
|
|
supplierCertEntity.WorkflowId = processInstanceId
|
|
|
if this.User.IsCompanyUser == 1 {
|
|
if this.User.IsCompanyUser == 1 {
|
|
|
supplierCertEntity.Status = suppliercert.FEN_TRIAL_STATUS //分办
|
|
supplierCertEntity.Status = suppliercert.FEN_TRIAL_STATUS //分办
|
|
|
} else if this.User.IsCompanyUser == 0 {
|
|
} else if this.User.IsCompanyUser == 0 {
|
|
|
supplierCertEntity.Status = suppliercert.FIRST_TRIAL_STATUS //二级单位初审
|
|
supplierCertEntity.Status = suppliercert.FIRST_TRIAL_STATUS //二级单位初审
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
supplierCertEntity.Step = 2
|
|
supplierCertEntity.Step = 2
|
|
|
- supplierCertEntity.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
|
|
supplierCertEntity.AuditIndex = supplierCertEntity.AuditIndex + 1
|
|
supplierCertEntity.AuditIndex = supplierCertEntity.AuditIndex + 1
|
|
|
- supplierCertEntity.BusinessKey = ActiComplete.BusinessKey
|
|
|
|
|
supplierCertEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
|
|
supplierCertEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
|
|
|
supplierCertEntity.ThirdAudit, _ = strconv.Atoi(thirdAudit)
|
|
supplierCertEntity.ThirdAudit, _ = strconv.Atoi(thirdAudit)
|
|
|
- supplierCertEntity.ProcessKey = ActiComplete.ProcessKey
|
|
|
|
|
- supplierCertEntity.CommitComId = unitId
|
|
|
|
|
cols := []string{
|
|
cols := []string{
|
|
|
"Id",
|
|
"Id",
|
|
|
- "WorkflowId",
|
|
|
|
|
"Status",
|
|
"Status",
|
|
|
"Step",
|
|
"Step",
|
|
|
- "FirstAudit",
|
|
|
|
|
"AuditIndex",
|
|
"AuditIndex",
|
|
|
- "BusinessKey",
|
|
|
|
|
"SecondAudit",
|
|
"SecondAudit",
|
|
|
"ThirdAudit",
|
|
"ThirdAudit",
|
|
|
- "ProcessKey",
|
|
|
|
|
- "CommitComId",
|
|
|
|
|
}
|
|
}
|
|
|
certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
|
|
certSrv.UpdateEntityByIdCols(certId, supplierCertEntity, cols)
|
|
|
}
|
|
}
|