|
|
@@ -656,17 +656,95 @@ func (this *OilSupplierCertAppendController) AuditEntity() {
|
|
|
// @Description 企业用户提交按钮
|
|
|
// @Success 200 {object} controllers.Request
|
|
|
// @router /company-audit/:id [post]
|
|
|
-func (this *OilSupplierCertAppendController) companySubmitAuditEntity() {
|
|
|
- certId := this.Ctx.Input.Param(":id")
|
|
|
- unitId := this.GetString("UnitId") // 分办单位id
|
|
|
+func (this *OilSupplierCertAppendController) CompanySubmitAuditEntity() {
|
|
|
+ certAppendId := 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()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ if this.User.IsCompanyUser == 0 {
|
|
|
+ // 0二级单位; 1企业用户
|
|
|
+ panic("非企业用户,请用分办功能提交!")
|
|
|
+ }
|
|
|
+
|
|
|
+ //取出准入申请表
|
|
|
+ certSrv := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
|
|
|
+ var supplierCertAppendEntity suppliercertappend.OilSupplierCertAppend
|
|
|
+ certSrv.GetEntityById(certAppendId, &supplierCertAppendEntity)
|
|
|
+ // 检查是否允许提交
|
|
|
+ certSrv.IsSupplierCertAppendCanSubmit(strconv.Itoa(supplierCertAppendEntity.Id), certAppendId)
|
|
|
+
|
|
|
+ //取出企业主表
|
|
|
+ supplierSvc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ var supplierEntity supplier.OilSupplier
|
|
|
+ //检查是否可提交
|
|
|
+ supplierSvc.GetEntityById(supplierCertAppendEntity.SupplierId, &supplierEntity)
|
|
|
+
|
|
|
+ status, _ := strconv.Atoi(supplierCertAppendEntity.Status)
|
|
|
+ if status > 0 {
|
|
|
+ panic("工作流已经启动,请刷新重试!")
|
|
|
+ }
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ //启动工作流
|
|
|
+ businessKey := certAppendId + "-" + strconv.Itoa(supplierCertAppendEntity.AuditIndex)
|
|
|
+ processInstanceId := supplierCertAppendEntity.WorkFlowId
|
|
|
+ // 如果被驳回,不再新启工作流
|
|
|
+ if processInstanceId == "" {
|
|
|
+ processInstanceId = svcActiviti.StartProcess2(workflow.OIL_ENUSER_SUPPLIER_APPLY, businessKey, this.User.Id, "1", supplierCertAppendEntity.AppendType, supplierEntity.SupplierName)
|
|
|
+ if len(processInstanceId) <= 0 {
|
|
|
+ panic("工作流启动失败!")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 将启动和工作流,选择的初审和复审人员保存下来
|
|
|
+ cols := []string{
|
|
|
+ "Id",
|
|
|
+ "WorkflowId",
|
|
|
+ "BusinessKey",
|
|
|
+ "ProcessKey",
|
|
|
+ "CommitComId",
|
|
|
+ "AuditIndex",
|
|
|
+ }
|
|
|
+ supplierCertAppendEntity.ProcessKey = workflow.OIL_ENUSER_SUPPLIER_APPLY
|
|
|
+ supplierCertAppendEntity.BusinessKey = businessKey
|
|
|
+ supplierCertAppendEntity.WorkFlowId = processInstanceId
|
|
|
+ supplierCertAppendEntity.CommitComId = unitId
|
|
|
+ supplierCertAppendEntity.AuditIndex += 1
|
|
|
+ certSrv.UpdateEntityByIdCols(certAppendId, supplierCertAppendEntity, cols)
|
|
|
+
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_ENUSER_SUPPLIER_APPLY
|
|
|
+ ActiComplete.BusinessKey = businessKey
|
|
|
+ ActiComplete.UserId = this.User.Id
|
|
|
+ ActiComplete.Result = "1" //提交给二级单位分办
|
|
|
+ ActiComplete.Remarks = AuditRemark
|
|
|
+ ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
|
|
|
+
|
|
|
+ receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
+ if receiveVal != "true" {
|
|
|
+ panic("工作流异常,请联系管理员!" + receiveVal)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// @Title 二级分办单位提交审批----启动工作流
|
|
|
// @Description 二级分办单位提交审批按钮
|
|
|
// @Success 200 {object} controllers.Request
|
|
|
// @router /unit-audit/:id [post]
|
|
|
-func (this *OilSupplierCertAppendController) separateUnitSubmitAuditEntity() {
|
|
|
+func (this *OilSupplierCertAppendController) SeparateUnitSubmitAuditEntity() {
|
|
|
certAppendId := this.Ctx.Input.Param(":id")
|
|
|
firstAudit := this.GetString("firstAudit")
|
|
|
secondAudit := this.GetString("SecondAudit")
|
|
|
@@ -749,6 +827,212 @@ func (this *OilSupplierCertAppendController) separateUnitSubmitAuditEntity() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// @Title 二级单位分办 --审批
|
|
|
+// @Description 二级分办
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /separate-audit/:id [post]
|
|
|
+func (this *OilSupplierCertAppendController) AppendSeparateAuditEntity() {
|
|
|
+ certAppendId := this.Ctx.Input.Param(":id")
|
|
|
+ firstAudit := this.GetString("FirstAudit")
|
|
|
+ secondAudit := this.GetString("SecondAudit")
|
|
|
+ thirdAudit := this.GetString("ThirdAudit")
|
|
|
+ // typeCode := this.GetString("TypeCode")
|
|
|
+ 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 := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
|
|
|
+ var supplierCertAppendEntity suppliercertappend.OilSupplierCertAppend
|
|
|
+ certSrv.GetEntityById(certAppendId, &supplierCertAppendEntity)
|
|
|
+ // 将选择的初审和复审人员保存下来
|
|
|
+ cols := []string{
|
|
|
+ "FirstAudit",
|
|
|
+ "SecondAudit",
|
|
|
+ "thirdAudit",
|
|
|
+ }
|
|
|
+ supplierCertAppendEntity.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
+ supplierCertAppendEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
|
|
|
+ supplierCertAppendEntity.ThirdAudit, _ = strconv.Atoi(thirdAudit) // 专业处室
|
|
|
+ certSrv.UpdateEntityByIdCols(certAppendId, supplierCertAppendEntity, cols)
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_ENUSER_SUPPLIER_APPLY
|
|
|
+ ActiComplete.BusinessKey = supplierCertAppendEntity.BusinessKey
|
|
|
+ ActiComplete.UserId = this.User.Id // 审批人员
|
|
|
+ // ActiComplete.UserNames = secondAudit // 初审人员
|
|
|
+ ActiComplete.Result = "1" //分办完成后只向前走
|
|
|
+ ActiComplete.Remarks = AuditRemark
|
|
|
+ ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
|
|
|
+ receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
+ if receiveVal != "true" {
|
|
|
+ panic("工作流异常,请联系管理员!" + receiveVal)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 分办之后的各级审批 --审批 包含:二级单位初审、复审, 业务处室专业审核
|
|
|
+// @Description 分办之后的各级审批
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /common-audit/:id [post]
|
|
|
+func (this *OilSupplierCertAppendController) AppendCommonAuditEntity() {
|
|
|
+ certAppendId := this.Ctx.Input.Param(":id")
|
|
|
+ result := this.GetString("result")
|
|
|
+ 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 := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
|
|
|
+ var supplierCertAppendEntity suppliercertappend.OilSupplierCertAppend
|
|
|
+ certSrv.GetEntityById(certAppendId, &supplierCertAppendEntity)
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_ENUSER_SUPPLIER_APPLY
|
|
|
+ ActiComplete.BusinessKey = supplierCertAppendEntity.BusinessKey
|
|
|
+ ActiComplete.UserId = this.User.Id //审批人员
|
|
|
+ ActiComplete.Result = result //前台审批[同意、不同意]
|
|
|
+ ActiComplete.Remarks = AuditRemark
|
|
|
+ ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
|
|
|
+ receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
+ if receiveVal != "true" {
|
|
|
+ panic("工作流异常,请联系管理员!" + receiveVal)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 业务处室接收分办 专业审批
|
|
|
+// @Description 业务处室接收分办 专业审批
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /business-separate-audit/:id [post]
|
|
|
+func (this *OilSupplierCertAppendController) AppendBusinessOfficeSeparateAuditEntity() {
|
|
|
+ certAppendId := this.Ctx.Input.Param(":id")
|
|
|
+ ProfessionalAudit := this.GetString("ProfessionalAudit")
|
|
|
+ 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 supplierCertAppendEntity suppliercertappend.OilSupplierCertAppend
|
|
|
+ certSrv.GetEntityById(certAppendId, &supplierCertAppendEntity)
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_ENUSER_SUPPLIER_APPLY
|
|
|
+ ActiComplete.BusinessKey = supplierCertAppendEntity.BusinessKey
|
|
|
+ ActiComplete.UserId = this.User.Id //审批人员
|
|
|
+ ActiComplete.Result = "1" //前台审批[同意、不同意]
|
|
|
+ ActiComplete.UserNames = ProfessionalAudit
|
|
|
+ ActiComplete.Remarks = AuditRemark
|
|
|
+ ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
|
|
|
+ receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
+ if receiveVal != "true" {
|
|
|
+ panic("工作流异常,请联系管理员!" + receiveVal)
|
|
|
+ }
|
|
|
+ cols := []string{
|
|
|
+ "Id",
|
|
|
+ "Status",
|
|
|
+ "ProfessionalAudit",
|
|
|
+ }
|
|
|
+ supplierCertAppendId := strings.Split(supplierCertAppendEntity.BusinessKey, "-")[0]
|
|
|
+ supplierCertAppendEntity.Status = suppliercert.PROF_AUDIT_STATUS //专业处室接收
|
|
|
+ supplierCertAppendEntity.ProfessionalAudit, _ = strconv.Atoi(ProfessionalAudit)
|
|
|
+ certSrv.UpdateEntityByIdCols(supplierCertAppendId, supplierCertAppendEntity, cols)
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 集中审批
|
|
|
+// @Description 集中审批
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /concentrate-audit/:id [post]
|
|
|
+func (this *OilSupplierCertController) AppendConcentrateAuditEntity() {
|
|
|
+ certAppendId := this.Ctx.Input.Param(":id")
|
|
|
+ AuditRemark := this.GetString("AuditRemark") // TODO 前台选择的审批结果
|
|
|
+
|
|
|
+ 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 := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE)
|
|
|
+ var supplierCertAppendEntity suppliercertappend.OilSupplierCertAppend
|
|
|
+ certSrv.GetEntityById(certAppendId, &supplierCertAppendEntity)
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_ENUSER_SUPPLIER_APPLY
|
|
|
+ ActiComplete.BusinessKey = supplierCertAppendEntity.BusinessKey
|
|
|
+ ActiComplete.UserId = this.User.Id //审批人员
|
|
|
+ ActiComplete.Result = "1" //前台审批[同意、不同意] // TODO 前台选择的审批结果
|
|
|
+ ActiComplete.Remarks = AuditRemark
|
|
|
+ ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
|
|
|
+ receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
+ if receiveVal != "true" {
|
|
|
+ panic("工作流异常,请联系管理员!" + receiveVal)
|
|
|
+ }
|
|
|
+ //cols := []string{
|
|
|
+ // "Id",
|
|
|
+ // "Status",
|
|
|
+ //}
|
|
|
+ //supplierCertId := strings.Split(supplierCertEntity.BusinessKey, "-")[0]
|
|
|
+ //supplierCertEntity.Status = suppliercert.PROF_AUDIT_STATUS //专业处室接收
|
|
|
+ //certSrv.UpdateEntityByIdCols(supplierCertId, supplierCertEntity, cols)
|
|
|
+}
|
|
|
+
|
|
|
// @Title 审批
|
|
|
// @Description 审批
|
|
|
// @Param body body suppliercert.OilSupplierCert
|