|
|
@@ -9,6 +9,7 @@ import (
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/suppliercert"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/supplierfile"
|
|
|
+ "dashoo.cn/backend/api/business/paymentinfo"
|
|
|
"dashoo.cn/backend/api/business/register"
|
|
|
"dashoo.cn/business2/parameter"
|
|
|
"dashoo.cn/business2/permission"
|
|
|
@@ -1533,6 +1534,336 @@ func (this *InfoChangeController) InfoAudit() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// @Title 企业用户提交按钮 --启动工作流
|
|
|
+// @Description 企业用户提交按钮
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /company-audit/:id [post]
|
|
|
+func (this *InfoChangeController) CompanyAuditEntity() {
|
|
|
+ infoId := 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("非企业用户,请用分办功能提交!")
|
|
|
+ }
|
|
|
+
|
|
|
+ //取出准入申请表
|
|
|
+ infoSrv := infochange.GetInfoChangeService(utils.DBE)
|
|
|
+ var infoChangeEntity infochange.OilInfoChange
|
|
|
+ infoSrv.GetEntityById(infoId, &infoChangeEntity)
|
|
|
+ // TODO 检查是否可以提交
|
|
|
+ //infoSrv.IsSupplierCertCanSubmit(strconv.Itoa(supplierCertEntity.Id), certId)
|
|
|
+
|
|
|
+ //取出企业主表
|
|
|
+ supplierSvc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ var supplierEntity supplier.OilSupplier
|
|
|
+ //检查是否可提交
|
|
|
+ supplierSvc.GetEntityById(infoChangeEntity.SupplierId, &supplierEntity)
|
|
|
+
|
|
|
+ status, _ := strconv.Atoi(infoChangeEntity.Status)
|
|
|
+ if status > 0 {
|
|
|
+ panic("工作流已经启动,请刷新重试!")
|
|
|
+ }
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ //启动工作流
|
|
|
+ businessKey := infoId + "-" + strconv.Itoa(infoChangeEntity.AuditIndex)
|
|
|
+ processInstanceId := infoChangeEntity.WorkFlowId
|
|
|
+ // 如果被驳回,不再新启工作流
|
|
|
+ if processInstanceId == "" {
|
|
|
+ processInstanceId = svcActiviti.StartProcess2(workflow.OIL_INFO_CHANGE, businessKey, this.User.Id, "1", infoChangeEntity.SupplierTypeCode, supplierEntity.SupplierName)
|
|
|
+ if len(processInstanceId) <= 0 {
|
|
|
+ panic("工作流启动失败!")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 将启动和工作流,选择的分办单位id记录下来
|
|
|
+ cols := []string{
|
|
|
+ "Id",
|
|
|
+ "WorkflowId",
|
|
|
+ "BusinessKey",
|
|
|
+ "ProcessKey",
|
|
|
+ "CommitComId",
|
|
|
+ "AuditIndex",
|
|
|
+ }
|
|
|
+ infoChangeEntity.ProcessKey = workflow.OIL_INFO_CHANGE
|
|
|
+ infoChangeEntity.BusinessKey = businessKey
|
|
|
+ infoChangeEntity.WorkFlowId = processInstanceId
|
|
|
+ infoChangeEntity.CommitComId = unitId
|
|
|
+ infoChangeEntity.AuditIndex += 1
|
|
|
+ infoSrv.UpdateEntityByIdCols(infoId, infoChangeEntity, cols)
|
|
|
+
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_INFO_CHANGE
|
|
|
+ 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 *InfoChangeController) UnitAuditEntity() {
|
|
|
+ infoId := 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 := infochange.GetInfoChangeService(utils.DBE)
|
|
|
+ var infoChangeEntity infochange.OilInfoChange
|
|
|
+ svc.GetEntityById(infoId, &infoChangeEntity)
|
|
|
+ // TODO 检查是否可提交
|
|
|
+ //svc.IsSupplierCertCanSubmit(strconv.Itoa(supplierCertEntity.Id), certId)
|
|
|
+ //取出企业主表
|
|
|
+ supplierSvc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ var supplierEntity supplier.OilSupplier
|
|
|
+ supplierSvc.GetEntityById(infoChangeEntity.SupplierId, &supplierEntity)
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ //启动工作流
|
|
|
+ businessKey := infoId + "-" + strconv.Itoa(infoChangeEntity.AuditIndex)
|
|
|
+ processInstanceId := infoChangeEntity.WorkFlowId
|
|
|
+ // 如果被驳回,不再新启工作流
|
|
|
+ if processInstanceId == "" {
|
|
|
+ processInstanceId = svcActiviti.StartProcess2(workflow.OIL_INFO_CHANGE, businessKey, this.User.Id, "1", infoChangeEntity.SupplierTypeCode, supplierEntity.SupplierName)
|
|
|
+ if len(processInstanceId) <= 0 {
|
|
|
+ panic("工作流启动失败!")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 将启动和工作流,选择的初审和复审人员保存下来
|
|
|
+ cols := []string{
|
|
|
+ "Id",
|
|
|
+ "FirstAudit",
|
|
|
+ "SecondAudit",
|
|
|
+ "thirdAudit",
|
|
|
+ "WorkflowId",
|
|
|
+ "BusinessKey",
|
|
|
+ "ProcessKey",
|
|
|
+ "CommitComId",
|
|
|
+ "AuditIndex",
|
|
|
+ }
|
|
|
+ infoChangeEntity.ProcessKey = workflow.OIL_INFO_CHANGE
|
|
|
+ infoChangeEntity.BusinessKey = businessKey
|
|
|
+ infoChangeEntity.WorkFlowId = processInstanceId
|
|
|
+ infoChangeEntity.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
+ infoChangeEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
|
|
|
+ infoChangeEntity.CommitComId = strconv.Itoa(unitId)
|
|
|
+ infoChangeEntity.AuditIndex += 1
|
|
|
+ svc.UpdateEntityByIdCols(infoId, infoChangeEntity, cols)
|
|
|
+
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_INFO_CHANGE
|
|
|
+ ActiComplete.BusinessKey = infoChangeEntity.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 *InfoChangeController) SeparateAuditEntity() {
|
|
|
+ infoId := this.Ctx.Input.Param(":id")
|
|
|
+ //SuppId := this.GetString("SuppId")
|
|
|
+ firstAudit := this.GetString("FirstAudit")
|
|
|
+ secondAudit := this.GetString("SecondAudit")
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ // 取出准入表信息
|
|
|
+ infoSrv := infochange.GetInfoChangeService(utils.DBE)
|
|
|
+ var infoChangeEntity infochange.OilInfoChange
|
|
|
+ infoSrv.GetEntityById(infoId, &infoChangeEntity)
|
|
|
+ // 将选择的初审和复审人员保存下来
|
|
|
+ cols := []string{
|
|
|
+ "FirstAudit",
|
|
|
+ "SecondAudit",
|
|
|
+ "thirdAudit",
|
|
|
+ }
|
|
|
+ infoChangeEntity.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
+ infoChangeEntity.SecondAudit, _ = strconv.Atoi(secondAudit)
|
|
|
+ infoSrv.UpdateEntityByIdCols(infoId, infoChangeEntity, cols)
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_INFO_CHANGE
|
|
|
+ ActiComplete.BusinessKey = infoChangeEntity.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 *InfoChangeController) CommonAuditEntity() {
|
|
|
+ infoId := 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()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ //取出变更表信息
|
|
|
+ infoSrv := infochange.GetInfoChangeService(utils.DBE)
|
|
|
+ var infoChangeEntity infochange.OilInfoChange
|
|
|
+ infoSrv.GetEntityById(infoId, &infoChangeEntity)
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ var ActiComplete workflow.ActiCompleteVM
|
|
|
+ ActiComplete.ProcessKey = workflow.OIL_INFO_CHANGE
|
|
|
+ ActiComplete.BusinessKey = infoChangeEntity.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 /update-pay-status/:id [post]
|
|
|
+func (this *InfoChangeController) UpdatePayStatus() {
|
|
|
+ infoId := this.Ctx.Input.Param(":id")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if infoId == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ infoSrv := infochange.GetInfoChangeService(utils.DBE)
|
|
|
+ var infoChangeEntity infochange.OilInfoChange
|
|
|
+ infoSrv.GetEntityById(infoId, &infoChangeEntity)
|
|
|
+
|
|
|
+ paySrv := paymentinfo.GetPaymentService(utils.DBE)
|
|
|
+ var paymentInfoEntities []paymentinfo.OilPaymentInfo
|
|
|
+ err := paySrv.GetPaymentInfoBySrcId(infoId, "1", &paymentInfoEntities)
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ errinfo.Message = "未知错误,请稍后再试!"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(paymentInfoEntities) == 1 {
|
|
|
+ for _, item := range paymentInfoEntities {
|
|
|
+ if item.IsPay == "1" {
|
|
|
+ errinfo.Message = "已确认交费!请耐心等待"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+ if item.IsPay == "2" {
|
|
|
+ errinfo.Message = "已交费!请勿重复操作!"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ sql :="UPDATE OilPaymentInfo SET IsPay ='1' where SrcId=" + infoId + " and PayType='1'"
|
|
|
+ paySrv.DBE.Exec(sql)
|
|
|
+ errinfo.Message = "确认交费成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
//更新供方信息表
|
|
|
func (this *InfoChangeController) updatesupplier(supname string, suppid int, infoitems []infochange.OilInfoChangeItem, supmodel supplier.OilSupplier) error {
|
|
|
svc := infochange.GetInfoChangeService(utils.DBE)
|