|
|
@@ -674,6 +674,36 @@ func (this *AnnualAuditController) AddAuditEntity() {
|
|
|
secondAudit := this.GetString("SecondAudit")
|
|
|
thirdAudit := this.GetString("ThirdAudit")
|
|
|
json.Unmarshal(jsonBlob, &model)
|
|
|
+
|
|
|
+ var setting auditsetting.Base_OilAuditSetting
|
|
|
+ var userlist []userRole.Base_User
|
|
|
+ usvc := userRole.GetUserService(utils.DBE)
|
|
|
+ where := ""
|
|
|
+ if this.User.IsCompanyUser == 1 {
|
|
|
+ if model.SupplierTypeName == "01" {
|
|
|
+ where = "AuditStepCode='" + workflow.SUB_OFFICE_WZ + "'"
|
|
|
+ } else if model.SupplierTypeName == "02" {
|
|
|
+ where = "AuditStepCode='" + workflow.SUB_OFFICE_JS + "'"
|
|
|
+
|
|
|
+ } else if model.SupplierTypeName == "03" {
|
|
|
+ where = "AuditStepCode='" + workflow.SUB_OFFICE_JF + "'"
|
|
|
+ }
|
|
|
+ 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=" + firstAudit
|
|
|
+ usvc.GetEntities(&userlist, where)
|
|
|
+ }
|
|
|
+ userIds := ""
|
|
|
+ for _, tmpUser := range userlist {
|
|
|
+ userIds += strconv.Itoa(tmpUser.Id) + ","
|
|
|
+ }
|
|
|
+ firstAudit = strings.Trim(userIds, ",")
|
|
|
+ }
|
|
|
+
|
|
|
//where := "CerId = " + utils.ToStr(model.SupplierId) + " and SupplierTypeName = " + model.SupplierTypeName
|
|
|
var auditentity annualaudit.OilAnnualAudit
|
|
|
svc.GetEntityById(annualId, &auditentity)
|
|
|
@@ -764,102 +794,6 @@ func (this *AnnualAuditController) AddAuditEntity() {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-// @Title 提交审批-分办
|
|
|
-// @Description 提交审批
|
|
|
-// @Success 200 {object} controllers.Request
|
|
|
-// @router /addauditcommfen [post]
|
|
|
-func (this *AnnualAuditController) AddAuditEntityFen() {
|
|
|
- var model ComShenHeModel
|
|
|
- var errinfo ErrorDataInfo
|
|
|
- var jsonBlob = this.Ctx.Input.RequestBody
|
|
|
- svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
|
|
|
- annualId := this.GetString("AnnualId")
|
|
|
- firstAudit := this.GetString("FirstAuditName")
|
|
|
- secondAudit := this.GetString("SecondAudit")
|
|
|
- thirdAudit := this.GetString("ThirdAudit")
|
|
|
- json.Unmarshal(jsonBlob, &model)
|
|
|
- //where := "CerId = " + utils.ToStr(model.SupplierId) + " and SupplierTypeName = " + model.SupplierTypeName
|
|
|
- var auditentity annualaudit.OilAnnualAudit
|
|
|
- svc.GetEntityById(annualId, &auditentity)
|
|
|
- historworkflowid := auditentity.WorkflowId
|
|
|
- svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
- statusint, _ := strconv.Atoi(auditentity.Status)
|
|
|
- var ActiComplete workflow.ActiCompleteVM
|
|
|
- var auditmodel annualaudit.OilAnnualAudit
|
|
|
- //重新工作流
|
|
|
- if statusint < 0 {
|
|
|
- businessKey := utils.ToStr(annualId) + "-" + strconv.Itoa(auditentity.AuditIndex)
|
|
|
- processInstanceId := svcActiviti.StartProcess(workflow.OIL_AUDIT_APPLY, businessKey, this.User.Id)
|
|
|
- ActiComplete.BusinessKey = businessKey
|
|
|
- auditmodel.WorkflowId = processInstanceId
|
|
|
- auditmodel.BusinessKey = businessKey
|
|
|
- } else {
|
|
|
- auditmodel.WorkflowId = auditentity.WorkflowId
|
|
|
- ActiComplete.BusinessKey = auditentity.BusinessKey
|
|
|
- auditmodel.BusinessKey = auditentity.BusinessKey
|
|
|
-
|
|
|
- }
|
|
|
- ActiComplete.ProcessKey = workflow.OIL_AUDIT_APPLY
|
|
|
- ActiComplete.UserNames = firstAudit
|
|
|
- ActiComplete.UserId = this.User.Id
|
|
|
- ActiComplete.Result = "1"
|
|
|
- ActiComplete.Remarks = model.Remark
|
|
|
- ActiComplete.CallbackUrl = ""
|
|
|
-
|
|
|
- //提交给二级单位初审
|
|
|
- receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
- if statusint < 0 {
|
|
|
- // 存储审批历史
|
|
|
- var audithistoryentity audithistory.Base_AuditHistory
|
|
|
- audithistoryentity.EntityId, _ = strconv.Atoi(annualId)
|
|
|
- audithistoryentity.WorkflowId = historworkflowid
|
|
|
- audithistoryentity.Process = workflow.OIL_AUDIT_APPLY
|
|
|
- audithistoryentity.BusinessKey = auditentity.BusinessKey
|
|
|
- audithistoryentity.Type = model.SupplierTypeName
|
|
|
- audithistoryentity.BackStep = utils.ToStr(auditentity.Status)
|
|
|
- audithistoryentity.Index = auditentity.AuditIndex
|
|
|
- audithistoryentity.CreateOn = time.Now()
|
|
|
- audithistoryentity.CreateBy = this.User.Realname
|
|
|
- audithistoryentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
- svc.InsertEntity(audithistoryentity)
|
|
|
- }
|
|
|
- auditmodel.Status = suppliercert.FIRST_TRIAL_STATUS //二级单位初审
|
|
|
- auditmodel.FirstAudit, _ = strconv.Atoi(firstAudit)
|
|
|
- auditmodel.SecondAudit, _ = strconv.Atoi(secondAudit)
|
|
|
- auditmodel.ThirdAudit, _ = strconv.Atoi(thirdAudit)
|
|
|
- cols := []string{
|
|
|
- "Id",
|
|
|
- "WorkflowId",
|
|
|
- "Status",
|
|
|
- "FirstAudit",
|
|
|
- "BusinessKey",
|
|
|
- "SecondAudit",
|
|
|
- "ThirdAudit",
|
|
|
- }
|
|
|
- if receiveVal == "true" {
|
|
|
- _, err := svc.UpdateEntityByIdCols(annualId, auditmodel, cols)
|
|
|
- if err == nil {
|
|
|
- //新增
|
|
|
- errinfo.Message = "提交成功!"
|
|
|
- errinfo.Code = 0
|
|
|
- errinfo.Item = auditmodel.Status
|
|
|
- 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
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
// @Title 删除单条信息
|
|
|
// @Description
|
|
|
// @Success 200 {object} ErrorInfo
|
|
|
@@ -939,6 +873,11 @@ func (this *AnnualAuditController) AnnualAudit() {
|
|
|
var supplierEntity supplier.OilSupplier
|
|
|
wheresup := "Id=" + strconv.Itoa(list.SupplierId)
|
|
|
svc.GetEntity(&supplierEntity, wheresup)
|
|
|
+
|
|
|
+ var certEntity suppliercert.OilSupplierCert
|
|
|
+ wherecert := "Id=" + strconv.Itoa(list.CerId)
|
|
|
+ svc.GetEntity(&certEntity, wherecert)
|
|
|
+
|
|
|
svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
//审核状态判断进行的操作
|
|
|
step := 2
|
|
|
@@ -1018,56 +957,49 @@ func (this *AnnualAuditController) AnnualAudit() {
|
|
|
auditmodel.Status = status
|
|
|
oldaplydate := list.ApplyTime
|
|
|
if list.Status == suppliercert.PROF_AUDIT_STATUS {
|
|
|
- //aplydatechange := oldaplydate.Format("2006-01-02")
|
|
|
- //local, _ := time.LoadLocation("Local")
|
|
|
- //oldtimeaply, _ := time.ParseInLocation("2006-01-02", aplydatechange, local)
|
|
|
- //auditmodel.ApplyTime = oldaplydate.AddDate(1, 0, 0)
|
|
|
- var certmodel suppliercert.OilSupplierCert
|
|
|
- //certmodel.ApplyTime = oldaplydate.AddDate(1, 0, 0)
|
|
|
- certmodel.AuditDate = time.Now()
|
|
|
- certcols := []string{
|
|
|
- "Id",
|
|
|
- //"ApplyTime",
|
|
|
- "AuditDate",
|
|
|
- }
|
|
|
- svc.UpdateEntityByIdCols(list.CerId, certmodel, certcols)
|
|
|
- paysvc := paymentinfo.GetPaymentService(utils.DBE)
|
|
|
- var Amount float64
|
|
|
- asvc := oilcostmanage.GetOilCostManageService(utils.DBE)
|
|
|
- Amount = asvc.GetAmount("APPEND",list.SupplierTypeName)
|
|
|
- //if list.SupplierTypeName == "01" {
|
|
|
- // Amount = 6000
|
|
|
- //} else if list.SupplierTypeName == "02" {
|
|
|
- // Amount = 7000
|
|
|
- //} else if list.SupplierTypeName == "03" {
|
|
|
- // Amount = 8000
|
|
|
- //}
|
|
|
- var payinfo paymentinfo.OilPaymentInfo
|
|
|
- payinfo.SupplierId = list.SupplierId
|
|
|
- payinfo.SrcId = list.Id
|
|
|
- payinfo.SupplierCertId = list.CerId
|
|
|
- payinfo.USCCode = supplierEntity.CommercialNo
|
|
|
- payinfo.SupplierName = supplierEntity.SupplierName
|
|
|
- payinfo.PayType = "2"
|
|
|
- payinfo.IsPay = "0"
|
|
|
- payinfo.Amount = strconv.FormatFloat(Amount,'E',-1,64)
|
|
|
- payinfo.CreateUserId = list.CreateUserId
|
|
|
- payinfo.CreateBy = list.CreateBy
|
|
|
- payinfo.CreateOn = time.Now()
|
|
|
- paysvc.InsertEntity(&payinfo)
|
|
|
- //发短信
|
|
|
- toMobile := supplierEntity.Mobile
|
|
|
- bFlag:=""
|
|
|
- if list.SupplierTypeName == "01"{
|
|
|
- bFlag="物资类"
|
|
|
- }else if list.SupplierTypeName == "02"{
|
|
|
- bFlag="基建类"
|
|
|
- }else{
|
|
|
- bFlag="技术服务类"
|
|
|
+
|
|
|
+ if certEntity.InStyle == "1" {
|
|
|
+ var certmodel suppliercert.OilSupplierCert
|
|
|
+ certmodel.AuditDate = time.Now()
|
|
|
+ certcols := []string{
|
|
|
+ "Id",
|
|
|
+ //"ApplyTime",
|
|
|
+ "AuditDate",
|
|
|
+ }
|
|
|
+ svc.UpdateEntityByIdCols(list.CerId, certmodel, certcols)
|
|
|
+ paysvc := paymentinfo.GetPaymentService(utils.DBE)
|
|
|
+ var Amount float64
|
|
|
+ asvc := oilcostmanage.GetOilCostManageService(utils.DBE)
|
|
|
+ Amount = asvc.GetAmount("APPEND",list.SupplierTypeName)
|
|
|
+ var payinfo paymentinfo.OilPaymentInfo
|
|
|
+ payinfo.SupplierId = list.SupplierId
|
|
|
+ payinfo.SrcId = list.Id
|
|
|
+ payinfo.SupplierCertId = list.CerId
|
|
|
+ payinfo.USCCode = supplierEntity.CommercialNo
|
|
|
+ payinfo.SupplierName = supplierEntity.SupplierName
|
|
|
+ payinfo.PayType = "2"
|
|
|
+ payinfo.IsPay = "0"
|
|
|
+ payinfo.Amount = strconv.FormatFloat(Amount,'E',-1,64)
|
|
|
+ payinfo.CreateUserId = list.CreateUserId
|
|
|
+ payinfo.CreateBy = list.CreateBy
|
|
|
+ payinfo.CreateOn = time.Now()
|
|
|
+ paysvc.InsertEntity(&payinfo)
|
|
|
+ //发短信
|
|
|
+ toMobile := supplierEntity.Mobile
|
|
|
+ bFlag:=""
|
|
|
+ if list.SupplierTypeName == "01"{
|
|
|
+ bFlag="物资类"
|
|
|
+ }else if list.SupplierTypeName == "02"{
|
|
|
+ bFlag="基建类"
|
|
|
+ }else{
|
|
|
+ bFlag="技术服务类"
|
|
|
+ }
|
|
|
+ msg:= "您的"+ bFlag + "年审审核通过,请及时确认缴费信息!"
|
|
|
+ msgService := msg2.GetMsgService(utils.DBE)
|
|
|
+ msgService.HandleMsg(toMobile,msg,"4-1",list.CreateBy,supplierEntity.ContactName,strconv.Itoa(list.CreateUserId))
|
|
|
+ } else {
|
|
|
+ status = suppliercert.ALL_PASE_STATUS
|
|
|
}
|
|
|
- msg:= "您的"+ bFlag + "年审审核通过,请及时确认缴费信息!"
|
|
|
- msgService := msg2.GetMsgService(utils.DBE)
|
|
|
- msgService.HandleMsg(toMobile,msg,"4-1",list.CreateBy,supplierEntity.ContactName,strconv.Itoa(list.CreateUserId))
|
|
|
}else {
|
|
|
auditmodel.ApplyTime = oldaplydate
|
|
|
}
|