|
|
@@ -183,6 +183,7 @@ func (this *OilContractReviewController) AddEntity() {
|
|
|
itemSvc := contractEvaluationItems.GetOilContractEvaluationItemsService(utils.DBE)
|
|
|
var reviewMode contractReview.OilContractReview
|
|
|
reviewMode.IsFinal = modeVO.IsFinal
|
|
|
+ reviewMode.IsBusiness = modeVO.IsBusiness
|
|
|
reviewMode.ContractId = modeVO.ContractId
|
|
|
reviewMode.Status = "0"
|
|
|
reviewMode.Unit = this.User.Unit
|
|
|
@@ -194,6 +195,7 @@ func (this *OilContractReviewController) AddEntity() {
|
|
|
|
|
|
var items2 []contractEvaluationItems.OilContractEvaluationItems
|
|
|
var items3 []contractEvaluationItems.OilContractEvaluationItems
|
|
|
+ var items4 []contractEvaluationItems.OilContractEvaluationItems // 业务处室发起评价
|
|
|
|
|
|
// 新增配置项
|
|
|
for i, v := range modeVO.Items {
|
|
|
@@ -230,14 +232,44 @@ func (this *OilContractReviewController) AddEntity() {
|
|
|
temp3.Content = v.Content
|
|
|
items3 = append(items3, temp3)
|
|
|
|
|
|
+ // 保存专业处室发起评价
|
|
|
+ var temp4 contractEvaluationItems.OilContractEvaluationItems
|
|
|
+ temp4.ContentReviewId = reviewMode.Id
|
|
|
+ temp4.Type = v.Category
|
|
|
+ temp4.Category = 2
|
|
|
+ temp4.ItemId = v.Id
|
|
|
+ temp4.ParentId = v.ParentId
|
|
|
+ temp4.SequenceNo = v.SequenceNo
|
|
|
+ temp4.Content = v.Content
|
|
|
+ temp4.NormalScore = v.NormalScore
|
|
|
+ temp4.Score = v.Score
|
|
|
+ temp4.Value = v.Value
|
|
|
+ temp4.LevelCode = v.LevelCode
|
|
|
+ temp4.Remark = v.Remark
|
|
|
+ temp4.Content = v.Content
|
|
|
+ items4 = append(items4, temp4)
|
|
|
+
|
|
|
+ }
|
|
|
+ errBool := true
|
|
|
+ if modeVO.IsBusiness == 0 {
|
|
|
+ _, err2 := itemSvc.DBE.Insert(items2)
|
|
|
+
|
|
|
+ // 专业处室评价默认二级
|
|
|
+ _, err3 := itemSvc.DBE.Insert(items3)
|
|
|
+ if err2 == nil && err3 == nil {
|
|
|
+ errBool = false
|
|
|
+ }
|
|
|
}
|
|
|
- _, err2 := itemSvc.DBE.Insert(items2)
|
|
|
|
|
|
- // 专业处室评价默认二级
|
|
|
- _, err3 := itemSvc.DBE.Insert(items3)
|
|
|
+ if modeVO.IsBusiness == 1 {
|
|
|
+ _, err4 := itemSvc.DBE.Insert(items4)
|
|
|
+ if err4 == nil {
|
|
|
+ errBool = false
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
var errinfo ErrorDataInfo
|
|
|
- if err == nil && err2 == nil && err3 == nil {
|
|
|
+ if err == nil && errBool == false {
|
|
|
//新增
|
|
|
errinfo.Message = "添加成功!"
|
|
|
errinfo.Code = 0
|
|
|
@@ -568,61 +600,100 @@ func (this *OilContractReviewController) UpdateEntity() {
|
|
|
}
|
|
|
err := svc.UpdateEntityBytbl(OilContractReviewName, id, &reviewMode, cols)
|
|
|
|
|
|
- where := "ContentReviewId=" + id + " AND Category = 0 "
|
|
|
- // 清除掉之前的
|
|
|
- itemSvc.DeleteEntityBytbl(OilContractEvaluationItemsName, where)
|
|
|
-
|
|
|
- var items []contractEvaluationItems.OilContractEvaluationItems
|
|
|
- // 新增配置项
|
|
|
- for i, v := range modeVO.Items {
|
|
|
- fmt.Print(i)
|
|
|
- var temp contractEvaluationItems.OilContractEvaluationItems
|
|
|
- temp.ContentReviewId, _ = strconv.Atoi(id)
|
|
|
- temp.Type = v.Category //v.Type
|
|
|
- temp.ItemId = v.Id
|
|
|
- temp.Category = 0
|
|
|
- temp.ParentId = v.ParentId
|
|
|
- temp.SequenceNo = v.SequenceNo
|
|
|
- temp.Content = v.Content
|
|
|
- temp.NormalScore = v.NormalScore
|
|
|
- temp.Score = v.Score
|
|
|
- temp.Value = v.Value
|
|
|
- temp.LevelCode = v.LevelCode
|
|
|
- temp.Remark = v.Remark
|
|
|
- temp.Content = v.Content
|
|
|
- items = append(items, temp)
|
|
|
- }
|
|
|
+ errBool := true
|
|
|
+ if modeVO.IsBusiness == 0 {
|
|
|
+ where := "ContentReviewId=" + id + " AND Category = 0 "
|
|
|
+ // 清除掉之前的
|
|
|
+ itemSvc.DeleteEntityBytbl(OilContractEvaluationItemsName, where)
|
|
|
+
|
|
|
+ var items []contractEvaluationItems.OilContractEvaluationItems
|
|
|
+ // 新增配置项
|
|
|
+ for i, v := range modeVO.Items {
|
|
|
+ fmt.Print(i)
|
|
|
+ var temp contractEvaluationItems.OilContractEvaluationItems
|
|
|
+ temp.ContentReviewId, _ = strconv.Atoi(id)
|
|
|
+ temp.Type = v.Category //v.Type
|
|
|
+ temp.ItemId = v.Id
|
|
|
+ temp.Category = 0
|
|
|
+ temp.ParentId = v.ParentId
|
|
|
+ temp.SequenceNo = v.SequenceNo
|
|
|
+ temp.Content = v.Content
|
|
|
+ temp.NormalScore = v.NormalScore
|
|
|
+ temp.Score = v.Score
|
|
|
+ temp.Value = v.Value
|
|
|
+ temp.LevelCode = v.LevelCode
|
|
|
+ temp.Remark = v.Remark
|
|
|
+ temp.Content = v.Content
|
|
|
+ items = append(items, temp)
|
|
|
+ }
|
|
|
|
|
|
- _, err2 := itemSvc.DBE.Insert(items)
|
|
|
+ _, err2 := itemSvc.DBE.Insert(items)
|
|
|
+
|
|
|
+ where2 := "ContentReviewId=" + id + " AND Category = 1 "
|
|
|
+ // 清除掉之前的
|
|
|
+ itemSvc.DeleteEntityBytbl(OilContractEvaluationItemsName, where2)
|
|
|
+
|
|
|
+ var items2 []contractEvaluationItems.OilContractEvaluationItems
|
|
|
+ // 新增配置项
|
|
|
+ for i, v := range modeVO.Items {
|
|
|
+ fmt.Print(i)
|
|
|
+ var temp2 contractEvaluationItems.OilContractEvaluationItems
|
|
|
+ temp2.ContentReviewId, _ = strconv.Atoi(id)
|
|
|
+ temp2.Type = v.Category //v.Type
|
|
|
+ temp2.ItemId = v.Id
|
|
|
+ temp2.Category = 1
|
|
|
+ temp2.ParentId = v.ParentId
|
|
|
+ temp2.SequenceNo = v.SequenceNo
|
|
|
+ temp2.Content = v.Content
|
|
|
+ temp2.NormalScore = v.NormalScore
|
|
|
+ temp2.Score = v.Score
|
|
|
+ temp2.Value = v.Value
|
|
|
+ temp2.LevelCode = v.LevelCode
|
|
|
+ temp2.Remark = v.Remark
|
|
|
+ temp2.Content = v.Content
|
|
|
+ items2 = append(items2, temp2)
|
|
|
+ }
|
|
|
|
|
|
- where2 := "ContentReviewId=" + id + " AND Category = 1 "
|
|
|
- // 清除掉之前的
|
|
|
- itemSvc.DeleteEntityBytbl(OilContractEvaluationItemsName, where2)
|
|
|
+ _, err3 := itemSvc.DBE.Insert(items2)
|
|
|
|
|
|
- var items2 []contractEvaluationItems.OilContractEvaluationItems
|
|
|
- // 新增配置项
|
|
|
- for i, v := range modeVO.Items {
|
|
|
- fmt.Print(i)
|
|
|
- var temp2 contractEvaluationItems.OilContractEvaluationItems
|
|
|
- temp2.ContentReviewId, _ = strconv.Atoi(id)
|
|
|
- temp2.Type = v.Category //v.Type
|
|
|
- temp2.ItemId = v.Id
|
|
|
- temp2.Category = 1
|
|
|
- temp2.ParentId = v.ParentId
|
|
|
- temp2.SequenceNo = v.SequenceNo
|
|
|
- temp2.Content = v.Content
|
|
|
- temp2.NormalScore = v.NormalScore
|
|
|
- temp2.Score = v.Score
|
|
|
- temp2.Value = v.Value
|
|
|
- temp2.LevelCode = v.LevelCode
|
|
|
- temp2.Remark = v.Remark
|
|
|
- temp2.Content = v.Content
|
|
|
- items2 = append(items2, temp2)
|
|
|
+ if err2 == nil && err3 == nil {
|
|
|
+ errBool = false
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- _, err3 := itemSvc.DBE.Insert(items2)
|
|
|
+ if modeVO.IsBusiness == 1 {
|
|
|
+ where3 := "ContentReviewId=" + id + " AND Category = 2 "
|
|
|
+ // 清除掉之前的
|
|
|
+ itemSvc.DeleteEntityBytbl(OilContractEvaluationItemsName, where3)
|
|
|
+
|
|
|
+ var items3 []contractEvaluationItems.OilContractEvaluationItems
|
|
|
+ // 新增配置项
|
|
|
+ for i, v := range modeVO.Items {
|
|
|
+ fmt.Print(i)
|
|
|
+ var temp3 contractEvaluationItems.OilContractEvaluationItems
|
|
|
+ temp3.ContentReviewId, _ = strconv.Atoi(id)
|
|
|
+ temp3.Type = v.Category //v.Type
|
|
|
+ temp3.ItemId = v.Id
|
|
|
+ temp3.Category = 2
|
|
|
+ temp3.ParentId = v.ParentId
|
|
|
+ temp3.SequenceNo = v.SequenceNo
|
|
|
+ temp3.Content = v.Content
|
|
|
+ temp3.NormalScore = v.NormalScore
|
|
|
+ temp3.Score = v.Score
|
|
|
+ temp3.Value = v.Value
|
|
|
+ temp3.LevelCode = v.LevelCode
|
|
|
+ temp3.Remark = v.Remark
|
|
|
+ temp3.Content = v.Content
|
|
|
+ items3 = append(items3, temp3)
|
|
|
+ }
|
|
|
+
|
|
|
+ _, err4 := itemSvc.DBE.Insert(items3)
|
|
|
+ if err4 == nil {
|
|
|
+ errBool = false
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if err == nil && err2 == nil && err3 == nil {
|
|
|
+ if err == nil && errBool == false {
|
|
|
errinfo.Message = "修改成功!"
|
|
|
errinfo.Code = 0
|
|
|
this.Data["json"] = &errinfo
|
|
|
@@ -835,7 +906,11 @@ func (this *OilContractReviewController) CommonAuditEntity() {
|
|
|
|
|
|
svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
var ActiComplete workflow.ActiCompleteVM
|
|
|
- ActiComplete.ProcessKey = workflow.OIL_DAILY_CONTRACT_EVALUATION
|
|
|
+ if contractReviewEntity.IsBusiness == 1 {
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_DAILY_CONTRACT_EVA_BY_BUSINESS // 业务处室分办提交的日常评价
|
|
|
+ } else {
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_DAILY_CONTRACT_EVALUATION // 二级单位提交的日常评价
|
|
|
+ }
|
|
|
ActiComplete.BusinessKey = contractReviewEntity.BusinessKey
|
|
|
ActiComplete.UserId = this.User.Id //审批人员
|
|
|
ActiComplete.Result = result //前台审批[同意、不同意]
|
|
|
@@ -925,3 +1000,95 @@ func (this *OilContractReviewController) BusinessOfficeSeparateAuditEntity() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// @Title 业务处室提交评价审核
|
|
|
+// @Description 业务处室提交评价审核
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /business-submit-review/:id [post]
|
|
|
+func (this *OilContractReviewController) BusinessSubmitEvaEntity() {
|
|
|
+ Id := this.Ctx.Input.Param(":id")
|
|
|
+ ProfessionalAudit := this.GetString("ProfessionalAudit")
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ if ProfessionalAudit == "" {
|
|
|
+ errInfo.Message = "请选择审批人"
|
|
|
+ errInfo.Code = -1
|
|
|
+ this.Data["json"] = &errInfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+ //取出日常评审主表信息
|
|
|
+ conRev := contractReview.GetOilContractReviewService(utils.DBE)
|
|
|
+ var contractReviewEntity contractReview.OilContractReview
|
|
|
+ conRev.GetEntityById(Id, &contractReviewEntity)
|
|
|
+
|
|
|
+ //取出合同表
|
|
|
+ contractSvc := contract.GetOilContractService(utils.DBE)
|
|
|
+ var contractEntity contract.OilContract
|
|
|
+ contractSvc.GetEntityById(contractReviewEntity.ContractId, &contractEntity)
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ //启动工作流
|
|
|
+ businessKey := contractReviewEntity.BusinessKey
|
|
|
+ processInstanceId := contractReviewEntity.WorkflowId
|
|
|
+ // 如果被驳回,不再新启工作流
|
|
|
+ if processInstanceId == "" {
|
|
|
+ //启动工作流
|
|
|
+ businessKey = Id + "-" + strconv.Itoa(contractReviewEntity.AuditIndex)
|
|
|
+ processInstanceId = svcActiviti.StartProcess2(workflow.OIL_DAILY_CONTRACT_EVA_BY_BUSINESS, businessKey, this.User.Id, "1", contractEntity.ContractClass, contractEntity.SupplierName)
|
|
|
+ if len(processInstanceId) <= 0 {
|
|
|
+ panic("工作流启动失败!")
|
|
|
+ }
|
|
|
+ contractReviewEntity.AuditIndex += 1
|
|
|
+ }
|
|
|
+ // 将启动和工作流,选择的初审和复审人员保存下来
|
|
|
+ cols := []string{
|
|
|
+ "Id",
|
|
|
+ "WorkflowId",
|
|
|
+ "BusinessKey",
|
|
|
+ "ProcessKey",
|
|
|
+ "CommitComId",
|
|
|
+ "AuditIndex",
|
|
|
+ "ProfessionalAudit",
|
|
|
+ }
|
|
|
+ contractReviewEntity.ProcessKey = workflow.OIL_DAILY_CONTRACT_EVA_BY_BUSINESS
|
|
|
+ contractReviewEntity.BusinessKey = businessKey
|
|
|
+ contractReviewEntity.WorkflowId = processInstanceId
|
|
|
+ contractReviewEntity.CommitComId = strconv.Itoa(unitId)
|
|
|
+ contractReviewEntity.ProfessionalAudit, _ = strconv.Atoi(ProfessionalAudit)
|
|
|
+ conRev.UpdateEntityByIdCols(Id, contractReviewEntity, cols)
|
|
|
+
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_DAILY_CONTRACT_EVA_BY_BUSINESS
|
|
|
+ ActiComplete.BusinessKey = contractReviewEntity.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)
|
|
|
+ }
|
|
|
+}
|