|
|
@@ -31,12 +31,12 @@ func (this *OilCatalogSubController) GetEntityList() {
|
|
|
//获取分页信息
|
|
|
page := this.GetPageInfoForm()
|
|
|
where := " 1=1 "
|
|
|
- orderby := "Id"
|
|
|
+ orderBy := "Id"
|
|
|
asc := false
|
|
|
Order := this.GetString("Order")
|
|
|
Prop := this.GetString("Prop")
|
|
|
if Order != "" && Prop != "" {
|
|
|
- orderby = Prop
|
|
|
+ orderBy = Prop
|
|
|
if Order == "asc" {
|
|
|
asc = true
|
|
|
}
|
|
|
@@ -104,8 +104,10 @@ func (this *OilCatalogSubController) GetEntityList() {
|
|
|
where = where + " and ProcessKey = '" + ProcessKey + "'"
|
|
|
}
|
|
|
|
|
|
- if CreateUserId != "" {
|
|
|
+ if CreateUserId == "" {
|
|
|
where = where + " and CreateUserId =" + this.User.Id
|
|
|
+ } else {
|
|
|
+ where = where + " and CreateUserId =" + CreateUserId
|
|
|
}
|
|
|
|
|
|
if CreateBy != "" {
|
|
|
@@ -144,13 +146,13 @@ func (this *OilCatalogSubController) GetEntityList() {
|
|
|
|
|
|
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
|
|
|
+ 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()
|
|
|
}
|
|
|
|
|
|
@@ -356,7 +358,6 @@ func (this *OilCatalogSubController) DeleteEntityAndItems() {
|
|
|
where := "SubId=" + Id
|
|
|
svc.DeleteEntityBytbl(OilCatalogName, where)
|
|
|
|
|
|
-
|
|
|
err := svc.DeleteEntityById(Id, &model)
|
|
|
|
|
|
if err == nil {
|
|
|
@@ -383,13 +384,14 @@ func (this *OilCatalogSubController) CommitAuditEntity() {
|
|
|
svc := oilcatalogsub.GetOilCatalogSubService(utils.DBE)
|
|
|
svc.GetEntityById(Id, &entity)
|
|
|
|
|
|
- var catalogsub oilcatalogsub.OilCatalogSub
|
|
|
+ var cataLogSub oilcatalogsub.OilCatalogSub
|
|
|
// 更新主表状态
|
|
|
- cols := []string{"Status", "AuditIndex"}
|
|
|
- catalogsub.Status = oilcatalogsub.FIRST_TRIAL_STATUS
|
|
|
- catalogsub.AuditIndex = entity.AuditIndex + 1
|
|
|
+ cols := []string{"Status", "AuditIndex", "SubmitOn"}
|
|
|
+ cataLogSub.Status = oilcatalogsub.FIRST_TRIAL_STATUS
|
|
|
+ cataLogSub.AuditIndex = entity.AuditIndex + 1
|
|
|
+ cataLogSub.SubmitOn = time.Now()
|
|
|
where := "Id=" + Id
|
|
|
- svc.UpdateEntityBywheretbl(OilCatalogSubName, &catalogsub, cols, where)
|
|
|
+ svc.UpdateEntityBywheretbl(OilCatalogSubName, &cataLogSub, cols, where)
|
|
|
//更新从表状态
|
|
|
var catalog oilcatalog.OilCatalog
|
|
|
cols = []string{"Status"}
|
|
|
@@ -400,7 +402,7 @@ func (this *OilCatalogSubController) CommitAuditEntity() {
|
|
|
//启动工作流
|
|
|
svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
processInstanceId := ""
|
|
|
- businessKey := Id + "-" + strconv.Itoa(catalogsub.AuditIndex)
|
|
|
+ businessKey := Id + "-" + strconv.Itoa(cataLogSub.AuditIndex)
|
|
|
processKey := workflow.OIL_Catalog
|
|
|
processInstanceId = svcActiviti.StartProcess2(processKey, businessKey, this.User.Id, "1", "", "")
|
|
|
|
|
|
@@ -416,35 +418,35 @@ func (this *OilCatalogSubController) CommitAuditEntity() {
|
|
|
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
|
|
|
+ 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
|
|
|
+ errInfo.Message = "提交成功!"
|
|
|
+ errInfo.Code = 0
|
|
|
+ this.Data["json"] = &errInfo
|
|
|
this.ServeJSON()
|
|
|
} else {
|
|
|
- errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
+ errInfo.Message = "工作流异常,请联系管理员!"
|
|
|
+ errInfo.Code = -1
|
|
|
+ this.Data["json"] = &errInfo
|
|
|
this.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
@@ -456,64 +458,64 @@ func (this *OilCatalogSubController) CommitAuditEntity() {
|
|
|
// @Success 200 {object} controllers.Request
|
|
|
// @router /auditentity/:id [post]
|
|
|
func (this *OilCatalogSubController) AuditEntity() {
|
|
|
- var dataother ShenHeModel
|
|
|
+ var dataOther ShenHeModel
|
|
|
Id := this.Ctx.Input.Param(":id")
|
|
|
|
|
|
var jsonblob = this.Ctx.Input.RequestBody
|
|
|
- json.Unmarshal(jsonblob, &dataother)
|
|
|
+ json.Unmarshal(jsonblob, &dataOther)
|
|
|
|
|
|
var entity oilcatalogsub.OilCatalogSub
|
|
|
var catalog oilcatalog.OilCatalog
|
|
|
svc := oilcatalogsub.GetOilCatalogSubService(utils.DBE)
|
|
|
svc.GetEntityById(Id, &entity)
|
|
|
|
|
|
- var errinfo ErrorDataInfo
|
|
|
+ var errInfo ErrorDataInfo
|
|
|
defer func() { //finally处理失败的异常
|
|
|
if err := recover(); err != nil {
|
|
|
- errinfo.Message = "提交失败," + err.(string)
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
+ errInfo.Message = "提交失败," + err.(string)
|
|
|
+ errInfo.Code = -1
|
|
|
+ this.Data["json"] = &errInfo
|
|
|
this.ServeJSON()
|
|
|
} else {
|
|
|
//返回正确结果
|
|
|
- errinfo.Message = "审核提交成功"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
+ errInfo.Message = "审核提交成功"
|
|
|
+ errInfo.Code = 0
|
|
|
+ this.Data["json"] = &errInfo
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
}()
|
|
|
|
|
|
//remarks := ""
|
|
|
status := ""
|
|
|
- backstatus := "0"
|
|
|
+ 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
|
|
|
+ backStatus = oilcatalogsub.NOPASS_STATUS
|
|
|
} else if entity.Status == oilcatalogsub.SECOND_TRIAL_STATUS {
|
|
|
- backstatus = oilcatalogsub.NO_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")
|
|
|
+ topId := paramSvc.GetBaseparameterMessage("", "paramset", "CENT_AUDIT")
|
|
|
|
|
|
- var userlist []userRole.Base_User
|
|
|
+ var userList []userRole.Base_User
|
|
|
var setting auditsetting.Base_OilAuditSetting
|
|
|
- usvc := userRole.GetUserService(utils.DBE)
|
|
|
+ uSvc := userRole.GetUserService(utils.DBE)
|
|
|
where := "AuditStepCode='" + workflow.PROF_REGULATION + "'"
|
|
|
- usvc.GetEntity(&setting, where)
|
|
|
+ uSvc.GetEntity(&setting, where)
|
|
|
|
|
|
- ids := usvc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
|
|
|
- tempstr := strings.Join(ids, ",")
|
|
|
- uids := strings.Replace(tempstr, "uid_", "", -1)
|
|
|
+ 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)
|
|
|
+ where := "Id in (" + uids + ")" + " and UnitId=" + topId
|
|
|
+ uSvc.GetEntities(&userList, where)
|
|
|
}
|
|
|
- for _, tmpUser := range userlist {
|
|
|
+ for _, tmpUser := range userList {
|
|
|
userIds += strconv.Itoa(tmpUser.Id) + ","
|
|
|
}
|
|
|
|
|
|
@@ -522,7 +524,7 @@ func (this *OilCatalogSubController) AuditEntity() {
|
|
|
} else if entity.Status == oilcatalogsub.CENT_AUDIT_STATUS {
|
|
|
userIds = this.User.Id
|
|
|
status = oilcatalogsub.ALL_PASE_STATUS
|
|
|
- backstatus = oilcatalogsub.NO_CENT_AUDIT_STATUS
|
|
|
+ backStatus = oilcatalogsub.NO_CENT_AUDIT_STATUS
|
|
|
}
|
|
|
|
|
|
svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
@@ -531,9 +533,9 @@ func (this *OilCatalogSubController) AuditEntity() {
|
|
|
ActiComplete.BusinessKey = entity.BusinessKey
|
|
|
ActiComplete.UserNames = userIds
|
|
|
ActiComplete.UserId = this.User.Id
|
|
|
- ActiComplete.Remarks = dataother.AuditorRemark
|
|
|
+ ActiComplete.Remarks = dataOther.AuditorRemark
|
|
|
ActiComplete.CallbackUrl = ""
|
|
|
- if dataother.SuccessStatus == 1 {
|
|
|
+ if dataOther.SuccessStatus == 1 {
|
|
|
ActiComplete.Result = "1"
|
|
|
|
|
|
receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
@@ -555,14 +557,14 @@ func (this *OilCatalogSubController) AuditEntity() {
|
|
|
|
|
|
where := "SubId=" + Id + " and CatalogType=" + entity.Type
|
|
|
svc.UpdateEntityBywheretbl(OilCatalogName, &catalog, cols, where)
|
|
|
- errinfo.Message = "提交成功!"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
+ errInfo.Message = "提交成功!"
|
|
|
+ errInfo.Code = 0
|
|
|
+ this.Data["json"] = &errInfo
|
|
|
this.ServeJSON()
|
|
|
} else {
|
|
|
- errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
+ errInfo.Message = "工作流异常,请联系管理员!"
|
|
|
+ errInfo.Code = -1
|
|
|
+ this.Data["json"] = &errInfo
|
|
|
this.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
@@ -573,7 +575,7 @@ func (this *OilCatalogSubController) AuditEntity() {
|
|
|
|
|
|
if receiveVal == "true" {
|
|
|
// 更新主表状态
|
|
|
- entity.Status = backstatus
|
|
|
+ entity.Status = backStatus
|
|
|
cols := []string{
|
|
|
"Status",
|
|
|
}
|
|
|
@@ -582,16 +584,16 @@ func (this *OilCatalogSubController) AuditEntity() {
|
|
|
catalog.Status = "0"
|
|
|
where := "SubId=" + Id + " and CatalogType=" + entity.Type
|
|
|
svc.UpdateEntityBywheretbl(OilCatalogName, &catalog, cols, where)
|
|
|
- errinfo.Message = "提交成功!"
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
+ errInfo.Message = "提交成功!"
|
|
|
+ errInfo.Code = 0
|
|
|
+ this.Data["json"] = &errInfo
|
|
|
this.ServeJSON()
|
|
|
} else {
|
|
|
- errinfo.Message = "工作流异常,请联系管理员!"
|
|
|
- errinfo.Code = -1
|
|
|
- this.Data["json"] = &errinfo
|
|
|
+ errInfo.Message = "工作流异常,请联系管理员!"
|
|
|
+ errInfo.Code = -1
|
|
|
+ this.Data["json"] = &errInfo
|
|
|
this.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+}
|