|
|
@@ -0,0 +1,590 @@
|
|
|
+package oilsupplier
|
|
|
+
|
|
|
+import (
|
|
|
+ "dashoo.cn/backend/api/business/audithistory"
|
|
|
+ "dashoo.cn/backend/api/business/auditsetting"
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/oilcatalog"
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/oilcatalogsub"
|
|
|
+ "dashoo.cn/backend/api/business/workflow"
|
|
|
+ "dashoo.cn/business3/parameter"
|
|
|
+ "dashoo.cn/utils"
|
|
|
+ "encoding/json"
|
|
|
+ "strconv"
|
|
|
+ "strings"
|
|
|
+ "time"
|
|
|
+
|
|
|
+ "dashoo.cn/backend/api/business/baseUser"
|
|
|
+ . "dashoo.cn/backend/api/controllers"
|
|
|
+ "dashoo.cn/business3/userRole"
|
|
|
+)
|
|
|
+
|
|
|
+type OilCatalogSubController struct {
|
|
|
+ BaseController
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 获取列表
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} []limsoilcatalogsub.OilCatalogSub
|
|
|
+// @router /list [get]
|
|
|
+func (this *OilCatalogSubController) GetEntityList() {
|
|
|
+
|
|
|
+ //获取分页信息
|
|
|
+ page := this.GetPageInfoForm()
|
|
|
+ where := " 1=1 "
|
|
|
+ orderby := "Id"
|
|
|
+ asc := false
|
|
|
+ Order := this.GetString("Order")
|
|
|
+ Prop := this.GetString("Prop")
|
|
|
+ if Order != "" && Prop != "" {
|
|
|
+ orderby = Prop
|
|
|
+ if Order == "asc" {
|
|
|
+ asc = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Id := this.GetString("Id")
|
|
|
+ Status := this.GetString("Status")
|
|
|
+ SubmitterId := this.GetString("SubmitterId")
|
|
|
+ Submitter := this.GetString("Submitter")
|
|
|
+ DeptId := this.GetString("DeptId")
|
|
|
+ Dept := this.GetString("Dept")
|
|
|
+ FirstAudit := this.GetString("FirstAudit")
|
|
|
+ SecondAudit := this.GetString("SecondAudit")
|
|
|
+ BusinessKey := this.GetString("BusinessKey")
|
|
|
+ ProcessKey := this.GetString("ProcessKey")
|
|
|
+ CreateUserId := this.GetString("CreateUserId")
|
|
|
+ CreateOn := this.GetString("CreateOn")
|
|
|
+ CreateBy := this.GetString("CreateBy")
|
|
|
+ ModifiedOn := this.GetString("ModifiedOn")
|
|
|
+ ModifiedUserId := this.GetString("ModifiedUserId")
|
|
|
+ ModifiedBy := this.GetString("ModifiedBy")
|
|
|
+ SubmitOn := this.GetString("SubmitOn")
|
|
|
+
|
|
|
+ if Id != "" {
|
|
|
+ where = where + " and Id = " + Id
|
|
|
+ }
|
|
|
+
|
|
|
+ if Status != "" {
|
|
|
+ where = where + " and Status = '" + Status + "'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if SubmitterId != "" {
|
|
|
+ where = where + " and SubmitterId = " + SubmitterId
|
|
|
+ }
|
|
|
+
|
|
|
+ if Submitter != "" {
|
|
|
+ where = where + " and Submitter like '%" + Submitter + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if DeptId != "" {
|
|
|
+ where = where + " and DeptId = " + DeptId
|
|
|
+ }
|
|
|
+
|
|
|
+ if Dept != "" {
|
|
|
+ where = where + " and Dept like '%" + Dept + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if FirstAudit != "" {
|
|
|
+ where = where + " and FirstAudit = " + FirstAudit
|
|
|
+ }
|
|
|
+
|
|
|
+ if SecondAudit != "" {
|
|
|
+ where = where + " and SecondAudit = " + SecondAudit
|
|
|
+ }
|
|
|
+
|
|
|
+ if BusinessKey != "" {
|
|
|
+ where = where + " and BusinessKey = '" + BusinessKey + "'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if ProcessKey != "" {
|
|
|
+ where = where + " and ProcessKey = '" + ProcessKey + "'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if CreateUserId != "" {
|
|
|
+ where = where + " and CreateUserId =" + this.User.Id
|
|
|
+ }
|
|
|
+
|
|
|
+ if CreateBy != "" {
|
|
|
+ where = where + " and CreateBy like '%" + CreateBy + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if ModifiedOn != "" {
|
|
|
+ where = where + " and ModifiedOn like '%" + ModifiedOn + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if ModifiedUserId != "" {
|
|
|
+ where = where + " and ModifiedUserId =" + ModifiedUserId
|
|
|
+ }
|
|
|
+
|
|
|
+ if ModifiedBy != "" {
|
|
|
+ where = where + " and ModifiedBy like '%" + ModifiedBy + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if CreateOn != "" {
|
|
|
+ dates := strings.Split(CreateOn, ",")
|
|
|
+ if len(dates) == 2 {
|
|
|
+ minDate := dates[0]
|
|
|
+ maxDate := dates[1]
|
|
|
+ where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if SubmitOn != "" {
|
|
|
+ dates := strings.Split(SubmitOn, ",")
|
|
|
+ if len(dates) == 2 {
|
|
|
+ minDate := dates[0]
|
|
|
+ maxDate := dates[1]
|
|
|
+ where = where + " and SubmitOn>='" + minDate + "' and SubmitOn<='" + maxDate + "'"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ svc := oilcatalogsub.GetOilCatalogSubService(utils.DBE)
|
|
|
+ var list []oilcatalogsub.OilCatalogSub
|
|
|
+ total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, orderby, asc, &list, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ datainfo.CurrentItemCount = total
|
|
|
+ datainfo.PageIndex = page.CurrentPage
|
|
|
+ datainfo.ItemsPerPage = page.Size
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 获取字典列表
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} map[string]interface{}
|
|
|
+// @router /dictlist [get]
|
|
|
+func (this *OilCatalogSubController) GetDictList() {
|
|
|
+ dictList := make(map[string]interface{})
|
|
|
+ //dictSvc := items.GetItemsService(utils.DBE)
|
|
|
+ userSvc := baseUser.GetBaseUserService(utils.DBE)
|
|
|
+ //customerSvc := svccustomer.GetCustomerService(utils.DBE)
|
|
|
+ //dictList["WellNo"] = dictSvc.GetKeyValueItems("WellNo", this.User.AccCode)
|
|
|
+ var userEntity userRole.Base_User
|
|
|
+ userSvc.GetEntityById(this.User.Id, &userEntity)
|
|
|
+ dictList["Supervisers"] = userSvc.GetUserListByDepartmentId(this.User.AccCode, userEntity.Departmentid)
|
|
|
+
|
|
|
+ //var dictCustomer []svccustomer.Customer
|
|
|
+ //customerSvc.GetEntitysByWhere(this.User.AccCode + CustomerName, "", &dictCustomer)
|
|
|
+ //dictList["EntrustCorp"] = &dictCustomer
|
|
|
+
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = dictList
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 获取实体
|
|
|
+// @Description 获取实体
|
|
|
+// @Success 200 {object} oilcatalogsub.OilCatalogSub
|
|
|
+// @router /get/:id [get]
|
|
|
+func (this *OilCatalogSubController) GetEntity() {
|
|
|
+ Id := this.Ctx.Input.Param(":id")
|
|
|
+
|
|
|
+ var model oilcatalogsub.OilCatalogSub
|
|
|
+ svc := oilcatalogsub.GetOilCatalogSubService(utils.DBE)
|
|
|
+ svc.GetEntityByIdBytbl(OilCatalogSubName, Id, &model)
|
|
|
+
|
|
|
+ this.Data["json"] = &model
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 添加
|
|
|
+// @Description 新增
|
|
|
+// @Param body body oilcatalogsub.OilCatalogSub
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /add [post]
|
|
|
+func (this *OilCatalogSubController) AddEntity() {
|
|
|
+ var model oilcatalogsub.OilCatalogSub
|
|
|
+ var jsonBlob = this.Ctx.Input.RequestBody
|
|
|
+ svc := oilcatalogsub.GetOilCatalogSubService(utils.DBE)
|
|
|
+
|
|
|
+ json.Unmarshal(jsonBlob, &model)
|
|
|
+ model.Status = "0"
|
|
|
+ model.CreateOn = time.Now()
|
|
|
+ model.CreateBy = this.User.Realname
|
|
|
+ model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+
|
|
|
+ _, err := svc.InsertEntityBytbl(OilCatalogSubName, &model)
|
|
|
+
|
|
|
+ var errinfo ErrorDataInfo
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 修改实体
|
|
|
+// @Description 修改实体
|
|
|
+// @Param body body oilcatalogsub.OilCatalogSub
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /update/:id [post]
|
|
|
+func (this *OilCatalogSubController) UpdateEntity() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var model oilcatalogsub.OilCatalogSub
|
|
|
+ svc := oilcatalogsub.GetOilCatalogSubService(utils.DBE)
|
|
|
+
|
|
|
+ var jsonBlob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonBlob, &model)
|
|
|
+ model.ModifiedOn = time.Now()
|
|
|
+ model.ModifiedBy = this.User.Realname
|
|
|
+ model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+
|
|
|
+ cols := []string{
|
|
|
+
|
|
|
+ "Id",
|
|
|
+
|
|
|
+ "Status",
|
|
|
+
|
|
|
+ "SubmitterId",
|
|
|
+
|
|
|
+ "Submitter",
|
|
|
+
|
|
|
+ "DeptId",
|
|
|
+
|
|
|
+ "Dept",
|
|
|
+
|
|
|
+ "FirstAudit",
|
|
|
+
|
|
|
+ "SecondAudit",
|
|
|
+
|
|
|
+ "BusinessKey",
|
|
|
+
|
|
|
+ "ProcessKey",
|
|
|
+
|
|
|
+ "CreateUserId",
|
|
|
+
|
|
|
+ "CreateOn",
|
|
|
+
|
|
|
+ "CreateBy",
|
|
|
+
|
|
|
+ "ModifiedOn",
|
|
|
+
|
|
|
+ "ModifiedUserId",
|
|
|
+
|
|
|
+ "ModifiedBy",
|
|
|
+ }
|
|
|
+ err := svc.UpdateEntityBytbl(OilCatalogSubName, id, &model, 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()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 删除单条信息
|
|
|
+// @Description
|
|
|
+// @Success 200 {object} ErrorInfo
|
|
|
+// @Failure 403 :id 为空
|
|
|
+// @router /delete/:Id [delete]
|
|
|
+func (this *OilCatalogSubController) DeleteEntity() {
|
|
|
+ Id := this.Ctx.Input.Param(":Id")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if Id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var model oilcatalogsub.OilCatalogSub
|
|
|
+ svc := oilcatalogsub.GetOilCatalogSubService(utils.DBE)
|
|
|
+
|
|
|
+ err := svc.DeleteEntityById(Id, &model)
|
|
|
+
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 删除单条信息
|
|
|
+// @Description
|
|
|
+// @Success 200 {object} ErrorInfo
|
|
|
+// @Failure 403 :id 为空
|
|
|
+// @router /deleteentityanditems/:Id [delete]
|
|
|
+func (this *OilCatalogSubController) DeleteEntityAndItems() {
|
|
|
+ Id := this.Ctx.Input.Param(":Id")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if Id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var model oilcatalogsub.OilCatalogSub
|
|
|
+
|
|
|
+ svc := oilcatalogsub.GetOilCatalogSubService(utils.DBE)
|
|
|
+ where := "SubId=" + Id
|
|
|
+ svc.DeleteEntityBytbl(OilCatalogName, where)
|
|
|
+
|
|
|
+
|
|
|
+ err := svc.DeleteEntityById(Id, &model)
|
|
|
+
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 提交审批
|
|
|
+// @Description 提交审批
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /commitaudit/:id [post]
|
|
|
+func (this *OilCatalogSubController) CommitAuditEntity() {
|
|
|
+ Id := this.Ctx.Input.Param(":id")
|
|
|
+
|
|
|
+ var entity oilcatalogsub.OilCatalogSub
|
|
|
+ svc := oilcatalogsub.GetOilCatalogSubService(utils.DBE)
|
|
|
+ svc.GetEntityById(Id, &entity)
|
|
|
+
|
|
|
+ var catalogsub oilcatalogsub.OilCatalogSub
|
|
|
+ // 跟新主表状态
|
|
|
+ cols := []string{"Status", "AuditIndex"}
|
|
|
+ catalogsub.Status = oilcatalogsub.FIRST_TRIAL_STATUS
|
|
|
+ catalogsub.AuditIndex = entity.AuditIndex + 1
|
|
|
+ where := "Id=" + Id
|
|
|
+ svc.UpdateEntityBywheretbl(OilCatalogSubName, &catalogsub, cols, where)
|
|
|
+ //更新从表状态
|
|
|
+ var catalog oilcatalog.OilCatalog
|
|
|
+ cols = []string{"Status"}
|
|
|
+ catalog.Status = "1"
|
|
|
+ where = "SubId=" + Id
|
|
|
+ svc.UpdateEntityBywheretbl(OilCatalogName, &catalog, cols, where)
|
|
|
+
|
|
|
+ //启动工作流
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ processInstanceId := ""
|
|
|
+ businessKey := Id + "-" + strconv.Itoa(catalogsub.AuditIndex)
|
|
|
+ processKey := workflow.OIL_Catalog
|
|
|
+ processInstanceId = svcActiviti.StartProcess2(processKey, businessKey, this.User.Id, "1", "", "")
|
|
|
+
|
|
|
+ //提交到初审
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = processKey
|
|
|
+ ActiComplete.BusinessKey = businessKey
|
|
|
+ ActiComplete.UserNames = strconv.Itoa(entity.FirstAudit)
|
|
|
+ ActiComplete.UserId = this.User.Id
|
|
|
+ ActiComplete.Result = "1"
|
|
|
+ ActiComplete.Remarks = entity.Remark
|
|
|
+ ActiComplete.CallbackUrl = ""
|
|
|
+ receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
+
|
|
|
+ cols1 := []string{"WorkflowId", "BusinessKey", "ProcessKey"}
|
|
|
+ catalogsub.BusinessKey = businessKey
|
|
|
+ catalogsub.ProcessKey = processKey
|
|
|
+ catalogsub.WorkflowId = processInstanceId
|
|
|
+ wheresub := "Id=" + Id
|
|
|
+ svc.UpdateEntityBywheretbl(OilCatalogSubName, &catalogsub, cols1, wheresub)
|
|
|
+
|
|
|
+ var audithistoryentity audithistory.Base_AuditHistory
|
|
|
+ audithistoryentity.EntityId = entity.Id
|
|
|
+ audithistoryentity.WorkflowId = entity.WorkflowId
|
|
|
+ audithistoryentity.Process = ActiComplete.ProcessKey
|
|
|
+ audithistoryentity.BusinessKey = ActiComplete.BusinessKey
|
|
|
+ audithistoryentity.Type = ""
|
|
|
+ audithistoryentity.BackStep = entity.Status
|
|
|
+ audithistoryentity.Index = entity.AuditIndex
|
|
|
+ audithistoryentity.CreateOn = time.Now()
|
|
|
+ audithistoryentity.CreateBy = this.User.Realname
|
|
|
+ audithistoryentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc.InsertEntity(audithistoryentity)
|
|
|
+
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if receiveVal == "true" {
|
|
|
+ errinfo.Message = "提交成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ } else {
|
|
|
+ errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 审批
|
|
|
+// @Description 审批
|
|
|
+// @Param body body suppliercert.OilSupplierCert
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /auditentity/:id [post]
|
|
|
+func (this *OilCatalogSubController) AuditEntity() {
|
|
|
+ var dataother ShenHeModel
|
|
|
+ Id := this.Ctx.Input.Param(":id")
|
|
|
+
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &dataother)
|
|
|
+
|
|
|
+ var entity oilcatalogsub.OilCatalogSub
|
|
|
+ var catalog oilcatalog.OilCatalog
|
|
|
+ svc := oilcatalogsub.GetOilCatalogSubService(utils.DBE)
|
|
|
+ svc.GetEntityById(Id, &entity)
|
|
|
+
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ //remarks := ""
|
|
|
+ status := ""
|
|
|
+ backstatus := "0"
|
|
|
+ var userIds string
|
|
|
+
|
|
|
+ if entity.Status == oilcatalogsub.FIRST_TRIAL_STATUS {
|
|
|
+ userIds = utils.ToStr(entity.SecondAudit)
|
|
|
+ status = oilcatalogsub.SECOND_TRIAL_STATUS
|
|
|
+ backstatus = oilcatalogsub.NOPASS_STATUS
|
|
|
+ } else if entity.Status == oilcatalogsub.SECOND_TRIAL_STATUS {
|
|
|
+ backstatus = oilcatalogsub.NO_SECOND_TRIAL_STATUS
|
|
|
+ status = oilcatalogsub.CENT_AUDIT_STATUS
|
|
|
+
|
|
|
+ paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
+ topid := paramSvc.GetBaseparameterMessage("", "paramset", "CENT_AUDIT")
|
|
|
+
|
|
|
+ var userlist []userRole.Base_User
|
|
|
+ var setting auditsetting.Base_OilAuditSetting
|
|
|
+ usvc := userRole.GetUserService(utils.DBE)
|
|
|
+ where := "AuditStepCode='" + workflow.PROF_REGULATION + "'"
|
|
|
+ usvc.GetEntity(&setting, where)
|
|
|
+
|
|
|
+ ids := usvc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
|
|
|
+ tempstr := strings.Join(ids, ",")
|
|
|
+ uids := strings.Replace(tempstr, "uid_", "", -1)
|
|
|
+ uids = strings.Trim(uids, ",")
|
|
|
+ if uids != "" {
|
|
|
+ where := "Id in (" + uids + ")" + " and UnitId=" + topid
|
|
|
+ usvc.GetEntities(&userlist, where)
|
|
|
+ }
|
|
|
+ for _, tmpUser := range userlist {
|
|
|
+ userIds += strconv.Itoa(tmpUser.Id) + ","
|
|
|
+ }
|
|
|
+
|
|
|
+ userIds = strings.Trim(userIds, ",")
|
|
|
+
|
|
|
+ } else if entity.Status == oilcatalogsub.CENT_AUDIT_STATUS {
|
|
|
+ userIds = this.User.Id
|
|
|
+ status = oilcatalogsub.ALL_PASE_STATUS
|
|
|
+ backstatus = oilcatalogsub.NO_CENT_AUDIT_STATUS
|
|
|
+ }
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = entity.ProcessKey
|
|
|
+ ActiComplete.BusinessKey = entity.BusinessKey
|
|
|
+ ActiComplete.UserNames = userIds
|
|
|
+ ActiComplete.UserId = this.User.Id
|
|
|
+ ActiComplete.Remarks = dataother.AuditorRemark
|
|
|
+ ActiComplete.CallbackUrl = ""
|
|
|
+ if dataother.SuccessStatus == 1 {
|
|
|
+ ActiComplete.Result = "1"
|
|
|
+
|
|
|
+ receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
+
|
|
|
+ if receiveVal == "true" {
|
|
|
+ // 更新主表状态
|
|
|
+
|
|
|
+ if entity.Status == oilcatalogsub.CENT_AUDIT_STATUS {
|
|
|
+ catalog.Status = "2"
|
|
|
+ } else {
|
|
|
+ catalog.Status = "1"
|
|
|
+ }
|
|
|
+ entity.Status = status
|
|
|
+ cols := []string{
|
|
|
+ "Status",
|
|
|
+ }
|
|
|
+ svc.UpdateEntityByIdCols(Id, &entity, cols)
|
|
|
+ // 从表状态
|
|
|
+
|
|
|
+ where := "SubId=" + Id
|
|
|
+ svc.UpdateEntityBywheretbl(OilCatalogName, &catalog, cols, where)
|
|
|
+ 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 {
|
|
|
+
|
|
|
+ ActiComplete.Result = "0"
|
|
|
+ receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
+
|
|
|
+ if receiveVal == "true" {
|
|
|
+ // 更新主表状态
|
|
|
+ entity.Status = backstatus
|
|
|
+ cols := []string{
|
|
|
+ "Status",
|
|
|
+ }
|
|
|
+ svc.UpdateEntityByIdCols(Id, entity, cols)
|
|
|
+ // 从表状态
|
|
|
+ catalog.Status = "0"
|
|
|
+ where := "SubId=" + Id
|
|
|
+ svc.UpdateEntityBywheretbl(OilCatalogName, &catalog, cols, where)
|
|
|
+ errinfo.Message = "提交成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ } else {
|
|
|
+ errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|