|
|
@@ -585,7 +585,7 @@ func (this *AnnualAuditController) AddEntity() {
|
|
|
var errinfo ErrorDataInfo
|
|
|
var jsonBlob = this.Ctx.Input.RequestBody
|
|
|
svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
|
|
|
- firstAudit := this.GetString("firstAudit")
|
|
|
+ //firstAudit := this.GetString("firstAudit")
|
|
|
json.Unmarshal(jsonBlob, &model)
|
|
|
where := "SupplierId = " + utils.ToStr(model.SupplierId) + " and SupplierTypeName = " + model.SupplierTypeName + " and Status < 5"
|
|
|
var auditentity []annualaudit.OilAnnualAudit
|
|
|
@@ -640,36 +640,6 @@ func (this *AnnualAuditController) AddEntity() {
|
|
|
model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
//添加一条年审记录
|
|
|
_, err := svc.InsertEntityBytbl(""+OilAnnualAuditName, &model)
|
|
|
- annualId := model.Id
|
|
|
- svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
- //启动工作流
|
|
|
- businessKey := utils.ToStr(annualId) + "-" + strconv.Itoa(model.AuditIndex)
|
|
|
- result := strconv.Itoa(this.User.IsCompanyUser)
|
|
|
- processInstanceId := svcActiviti.StartProcess2(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id, result, model.SupplierTypeName, model.SupplierName)
|
|
|
- //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 auditmodel annualaudit.OilAnnualAudit
|
|
|
- auditmodel.WorkflowId = processInstanceId
|
|
|
- auditmodel.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
- auditmodel.AuditIndex = model.AuditIndex
|
|
|
- auditmodel.BusinessKey = businessKey
|
|
|
- cols := []string{
|
|
|
- "Id",
|
|
|
- "WorkflowId",
|
|
|
- "FirstAudit",
|
|
|
- "AuditIndex",
|
|
|
- "BusinessKey",
|
|
|
- }
|
|
|
- //if receiveVal == "true" {
|
|
|
- _, err = svc.UpdateEntityByIdCols(annualId, auditmodel, cols)
|
|
|
if err == nil {
|
|
|
//新增
|
|
|
errinfo.Message = "添加成功!"
|
|
|
@@ -683,6 +653,49 @@ func (this *AnnualAuditController) AddEntity() {
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
+ //annualId := model.Id
|
|
|
+ //svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ ////启动工作流
|
|
|
+ //businessKey := utils.ToStr(annualId) + "-" + strconv.Itoa(model.AuditIndex)
|
|
|
+ //result := strconv.Itoa(this.User.IsCompanyUser)
|
|
|
+ //processInstanceId := svcActiviti.StartProcess2(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id, result, model.SupplierTypeName, model.SupplierName)
|
|
|
+ //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 auditmodel annualaudit.OilAnnualAudit
|
|
|
+ //auditmodel.WorkflowId = processInstanceId
|
|
|
+ //auditmodel.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
+ //auditmodel.AuditIndex = model.AuditIndex
|
|
|
+ //auditmodel.BusinessKey = businessKey
|
|
|
+ //cols := []string{
|
|
|
+ // "Id",
|
|
|
+ // "WorkflowId",
|
|
|
+ // "FirstAudit",
|
|
|
+ // "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()
|
|
|
+ //}
|
|
|
//} else {
|
|
|
// errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
// errinfo.Code = -1
|
|
|
@@ -831,6 +844,190 @@ func (this *AnnualAuditController) AddAuditEntity() {
|
|
|
|
|
|
}
|
|
|
|
|
|
+// @Title 二级分办单位提交审批
|
|
|
+// @Description 提交审批
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /unit-audit/:id [post]
|
|
|
+func (this *AnnualAuditController) SeparateUnitSubmitAuditEntity() {
|
|
|
+ annualId := this.Ctx.Input.Param(":id")
|
|
|
+ firstAudit := this.GetString("firstAudit")
|
|
|
+ secondAudit := this.GetString("SecondAudit")
|
|
|
+ auditRemark := this.GetString("AuditRemark")
|
|
|
+
|
|
|
+ userId := this.User.Id
|
|
|
+ var baseUserInfo userRole.Base_User
|
|
|
+ userService := userRole.GetUserService(utils.DBE)
|
|
|
+ userService.GetEntityById(userId, &baseUserInfo)
|
|
|
+ unitId := baseUserInfo.UnitId
|
|
|
+
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
|
|
|
+ var auditEntity annualaudit.OilAnnualAudit
|
|
|
+ svc.GetEntityById(annualId, &auditEntity)
|
|
|
+ var supplierEntity supplier.OilSupplier
|
|
|
+ svc.GetEntityById(auditEntity.SupplierId, &supplierEntity)
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ //启动工作流
|
|
|
+ businessKey := annualId + "-" + strconv.Itoa(auditEntity.AuditIndex)
|
|
|
+ processInstanceId := auditEntity.WorkflowId
|
|
|
+ // 如果被驳回,不再新启工作流
|
|
|
+ if processInstanceId == "" {
|
|
|
+ processInstanceId = svcActiviti.StartProcess2(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id, "1", auditEntity.SupplierTypeName, supplierEntity.SupplierName)
|
|
|
+ if len(processInstanceId) <= 0 {
|
|
|
+ panic("工作流启动失败!")
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 将启动和工作流,选择的初审和复审人员保存下来
|
|
|
+ cols := []string{
|
|
|
+ "Id",
|
|
|
+ "FirstAudit",
|
|
|
+ "SecondAudit",
|
|
|
+ "WorkflowId",
|
|
|
+ "BusinessKey",
|
|
|
+ "ProcessKey",
|
|
|
+ "CommitComId",
|
|
|
+ "AuditIndex",
|
|
|
+ }
|
|
|
+ auditEntity.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
+ auditEntity.BusinessKey = businessKey
|
|
|
+ auditEntity.WorkflowId = processInstanceId
|
|
|
+ auditEntity.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
+ auditEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
|
|
|
+ auditEntity.CommitComId = strconv.Itoa(unitId)
|
|
|
+ auditEntity.AuditIndex += 1
|
|
|
+ svc.UpdateEntityByIdCols(annualId, auditEntity, cols)
|
|
|
+
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
+ ActiComplete.BusinessKey = auditEntity.BusinessKey
|
|
|
+ ActiComplete.UserId = this.User.Id // 当前审批操作人员
|
|
|
+ //ActiComplete.UserNames = secondAudit // 当前审批操作人员
|
|
|
+ ActiComplete.Result = "2" //分办提交给二级单位初审
|
|
|
+ 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 /separate-audit/:id [post]
|
|
|
+func (this *AnnualAuditController) SeparateAuditEntity() {
|
|
|
+ annualId := this.Ctx.Input.Param(":id")
|
|
|
+ firstAudit := this.GetString("FirstAudit")
|
|
|
+ secondAudit := this.GetString("SecondAudit")
|
|
|
+ // 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()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ // 取出准入表信息
|
|
|
+ srv := annualaudit.GetOilAnnualAuditService(utils.DBE)
|
|
|
+ var annualEntity annualaudit.OilAnnualAudit
|
|
|
+ srv.GetEntityById(annualId, &annualEntity)
|
|
|
+ // 将选择的初审和复审人员保存下来
|
|
|
+ cols := []string{
|
|
|
+ "FirstAudit",
|
|
|
+ "SecondAudit",
|
|
|
+ "thirdAudit",
|
|
|
+ }
|
|
|
+ annualEntity.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
+ annualEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
|
|
|
+ srv.UpdateEntityByIdCols(annualId, annualEntity, cols)
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
+ ActiComplete.BusinessKey = annualEntity.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 *AnnualAuditController) CommonAuditEntity() {
|
|
|
+ annualId := 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()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ //取出准入表信息
|
|
|
+ svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
|
|
|
+ var annualEntity annualaudit.OilAnnualAudit
|
|
|
+ svc.GetEntityById(annualId, &annualEntity)
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
+ ActiComplete.BusinessKey = annualEntity.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} ErrorInfo
|