| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310 |
- package oilsupplier
- import (
- "dashoo.cn/backend/api/business/audithistory"
- "dashoo.cn/backend/api/business/auditsetting"
- "dashoo.cn/backend/api/business/oilsupplier/infochange"
- "dashoo.cn/backend/api/business/oilsupplier/supplier"
- "dashoo.cn/backend/api/business/oilsupplier/suppliercert"
- "dashoo.cn/backend/api/business/oilsupplier/supplierfile"
- "dashoo.cn/backend/api/business/register"
- "dashoo.cn/business2/parameter"
- "dashoo.cn/business2/permission"
- "dashoo.cn/business2/userRole"
- "encoding/json"
- "fmt"
- "reflect"
- "strconv"
- "strings"
- "time"
- "dashoo.cn/backend/api/business/oilsupplier/annualaudit"
- "dashoo.cn/backend/api/business/workflow"
- . "dashoo.cn/backend/api/controllers"
- "dashoo.cn/utils"
- )
- type InfoChangeController struct {
- BaseController
- }
- type InfoShenHeModel struct {
- InfoId int
- SuccessStatus int
- AuditorRemark string
- SuppId int
- }
- type InfoChangeItemsAll struct {
- InfochangeForm []infoitems
- SupplierId string
- MInfoId string
- }
- type infoitems struct {
- SelectItem string
- SelectItemName string
- BeChangeInfo string
- ChangeInfo string
- }
- // @Title 获取实体
- // @Description 获取实体
- // @Success 200 {object} annualaudit.OilAnnualAudit
- // @router /get/:id [get]
- func (this *InfoChangeController) GetEntity() {
- CertId := this.Ctx.Input.Param(":id")
- var model []infochange.OilInfoChangeItem
- svc := infochange.GetInfoChangeService(utils.DBE)
- where := " SupplierId = " + CertId
- svc.GetEntitysByWhere(OilInfoChangeItemName, where, &model)
- var datainfo DataInfo
- datainfo.Items = model
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取实体
- // @Description 获取实体
- // @Success 200 {object} annualaudit.OilAnnualAudit
- // @router /getmain/:id [get]
- func (this *InfoChangeController) GetMainEntity() {
- Id := this.Ctx.Input.Param(":id")
- var model []infochange.OilInfoChange
- svc := infochange.GetInfoChangeService(utils.DBE)
- where := " Id = " + Id
- svc.GetEntitysByWhere(OilInfoChangeName, where, &model)
- var datainfo DataInfo
- datainfo.Items = model
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取实体
- // @Description 获取实体
- // @Success 200 {object} annualaudit.OilAnnualAudit
- // @router /getAccessCardNo/:id [get]
- func (this *InfoChangeController) GetAccessCardNo() {
- SuppId := this.Ctx.Input.Param(":id")
- var model []suppliercert.OilSupplierCert
- svc := infochange.GetInfoChangeService(utils.DBE)
- where := " SupplierId = " + SuppId
- svc.GetEntitysByOrderbyWhere(OilSupplierCertName, where, "SupplierTypeCode asc", &model)
- var datainfo DataInfo
- datainfo.Items = model
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取实体
- // @Description 获取实体
- // @Success 200 {object} annualaudit.OilAnnualAudit
- // @router /auditget/:id [get]
- func (this *InfoChangeController) GetEntityThen() {
- InfoId := this.Ctx.Input.Param(":id")
- var model []infochange.OilInfoChangeItem
- svc := infochange.GetInfoChangeService(utils.DBE)
- where := " InfoId = " + InfoId
- svc.GetEntitysByWhere(OilInfoChangeItemName, where, &model)
- var datainfo DataInfo
- datainfo.Items = model
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取列表
- // @Description get user by token
- // @Success 200 {object} []supplier.OilSupplier
- // @router /supplist [get]
- func (this *InfoChangeController) GetSuppList() {
- //获取分页信息
- page := this.GetPageInfoForm()
- where := " 1=1 "
- orderby := "b.Id"
- asc := false
- Order := this.GetString("Order")
- Prop := this.GetString("Prop")
- if Order != "" && Prop != "" {
- orderby = Prop
- if Order == "asc" {
- asc = true
- }
- }
- SupplierName := this.GetString("SupplierName")
- OilCertificateNo := this.GetString("OilCertificateNo")
- Grade := this.GetString("Grade")
- MgrUnit := this.GetString("MgrUnit")
- OperType := this.GetString("OperType")
- Country := this.GetString("Country")
- MaunAgent := this.GetString("MaunAgent")
- ConstructTeam := this.GetString("ConstructTeam")
- CommercialNo := this.GetString("CommercialNo")
- OrganCode := this.GetString("OrganCode")
- CountryTaxNo := this.GetString("CountryTaxNo")
- LocalTaxNo := this.GetString("LocalTaxNo")
- Address := this.GetString("Address")
- Province := this.GetString("Province")
- City := this.GetString("City")
- Street := this.GetString("Street")
- HouseNo := this.GetString("HouseNo")
- ZipCode := this.GetString("ZipCode")
- QualitySystemCert := this.GetString("QualitySystemCert")
- ProductQualityCert := this.GetString("ProductQualityCert")
- MaunLicense := this.GetString("MaunLicense")
- QualifCert := this.GetString("QualifCert")
- QualifCertLevel := this.GetString("QualifCertLevel")
- SafetyLicense := this.GetString("SafetyLicense")
- TechServiceLic := this.GetString("TechServiceLic")
- TJInNotify := this.GetString("TJInNotify")
- SpecIndustryCert := this.GetString("SpecIndustryCert")
- LegalPerson := this.GetString("LegalPerson")
- CategoryCode := this.GetString("CategoryCode")
- CategoryName := this.GetString("CategoryName")
- RegCapital := this.GetString("RegCapital")
- Currency := this.GetString("Currency")
- ContactName := this.GetString("ContactName")
- CompanyType := this.GetString("CompanyType")
- SetupTime := this.GetString("SetupTime")
- DepositBank := this.GetString("DepositBank")
- BankAccount := this.GetString("BankAccount")
- EMail := this.GetString("EMail")
- BankCreditRating := this.GetString("BankCreditRating")
- Mobile := this.GetString("Mobile")
- Telphone := this.GetString("Telphone")
- Fax := this.GetString("Fax")
- CompanyTel := this.GetString("CompanyTel")
- QQ := this.GetString("QQ")
- CompanyUrl := this.GetString("CompanyUrl")
- SpecSupplier := this.GetString("SpecSupplier")
- SpecTypeCode := this.GetString("SpecTypeCode")
- SpecTypeName := this.GetString("SpecTypeName")
- Remark := this.GetString("Remark")
- CreateOn := this.GetString("CreateOn")
- if SupplierName != "" {
- where = where + " and a.SupplierName like '%" + SupplierName + "%'"
- }
- if OilCertificateNo != "" {
- where = where + " and a.OilCertificateNo like '%" + OilCertificateNo + "%'"
- }
- if Grade != "" {
- where = where + " and a.Grade like '%" + Grade + "%'"
- }
- if MgrUnit != "" {
- where = where + " and a.MgrUnit like '%" + MgrUnit + "%'"
- }
- if OperType != "" {
- where = where + " and a.OperType like '%" + OperType + "%'"
- }
- if Country != "" {
- where = where + " and a.Country like '%" + Country + "%'"
- }
- if MaunAgent != "" {
- where = where + " and a.MaunAgent like '%" + MaunAgent + "%'"
- }
- if ConstructTeam != "" {
- where = where + " and a.ConstructTeam like '%" + ConstructTeam + "%'"
- }
- if CommercialNo != "" {
- where = where + " and a.CommercialNo like '%" + CommercialNo + "%'"
- }
- if OrganCode != "" {
- where = where + " and a.OrganCode like '%" + OrganCode + "%'"
- }
- if CountryTaxNo != "" {
- where = where + " and a.CountryTaxNo like '%" + CountryTaxNo + "%'"
- }
- if LocalTaxNo != "" {
- where = where + " and a.LocalTaxNo like '%" + LocalTaxNo + "%'"
- }
- if Address != "" {
- where = where + " and a.Address like '%" + Address + "%'"
- }
- if Province != "" {
- where = where + " and a.Province like '%" + Province + "%'"
- }
- if City != "" {
- where = where + " and a.City like '%" + City + "%'"
- }
- if Street != "" {
- where = where + " and a.Street like '%" + Street + "%'"
- }
- if HouseNo != "" {
- where = where + " and a.HouseNo like '%" + HouseNo + "%'"
- }
- if ZipCode != "" {
- where = where + " and a.ZipCode like '%" + ZipCode + "%'"
- }
- if QualitySystemCert != "" {
- where = where + " and a.QualitySystemCert like '%" + QualitySystemCert + "%'"
- }
- if ProductQualityCert != "" {
- where = where + " and a.ProductQualityCert like '%" + ProductQualityCert + "%'"
- }
- if MaunLicense != "" {
- where = where + " and a.MaunLicense like '%" + MaunLicense + "%'"
- }
- if QualifCert != "" {
- where = where + " and a.QualifCert like '%" + QualifCert + "%'"
- }
- if QualifCertLevel != "" {
- where = where + " and a.QualifCertLevel like '%" + QualifCertLevel + "%'"
- }
- if SafetyLicense != "" {
- where = where + " and a.SafetyLicense like '%" + SafetyLicense + "%'"
- }
- if TechServiceLic != "" {
- where = where + " and a.TechServiceLic like '%" + TechServiceLic + "%'"
- }
- if TJInNotify != "" {
- where = where + " and a.TJInNotify like '%" + TJInNotify + "%'"
- }
- if SpecIndustryCert != "" {
- where = where + " and a.SpecIndustryCert like '%" + SpecIndustryCert + "%'"
- }
- if LegalPerson != "" {
- where = where + " and a.LegalPerson like '%" + LegalPerson + "%'"
- }
- if CategoryCode != "" {
- where = where + " and a.CategoryCode like '%" + CategoryCode + "%'"
- }
- if CategoryName != "" {
- where = where + " and a.CategoryName like '%" + CategoryName + "%'"
- }
- if RegCapital != "" {
- where = where + " and a.RegCapital like '%" + RegCapital + "%'"
- }
- if Currency != "" {
- where = where + " and a.Currency like '%" + Currency + "%'"
- }
- if ContactName != "" {
- where = where + " and a.ContactName like '%" + ContactName + "%'"
- }
- if CompanyType != "" {
- where = where + " and a.CompanyType like '%" + CompanyType + "%'"
- }
- if SetupTime != "" {
- where = where + " and a.SetupTime like '%" + SetupTime + "%'"
- }
- if DepositBank != "" {
- where = where + " and a.DepositBank like '%" + DepositBank + "%'"
- }
- if BankAccount != "" {
- where = where + " and a.BankAccount like '%" + BankAccount + "%'"
- }
- if EMail != "" {
- where = where + " and a.EMail like '%" + EMail + "%'"
- }
- if BankCreditRating != "" {
- where = where + " and a.BankCreditRating like '%" + BankCreditRating + "%'"
- }
- if Mobile != "" {
- where = where + " and a.Mobile like '%" + Mobile + "%'"
- }
- if Telphone != "" {
- where = where + " and a.Telphone like '%" + Telphone + "%'"
- }
- if Fax != "" {
- where = where + " and a.Fax like '%" + Fax + "%'"
- }
- if CompanyTel != "" {
- where = where + " and a.CompanyTel like '%" + CompanyTel + "%'"
- }
- if QQ != "" {
- where = where + " and a.QQ like '%" + QQ + "%'"
- }
- if CompanyUrl != "" {
- where = where + " and a.CompanyUrl like '%" + CompanyUrl + "%'"
- }
- if SpecSupplier != "" {
- where = where + " and a.SpecSupplier like '%" + SpecSupplier + "%'"
- }
- if SpecTypeCode != "" {
- where = where + " and a.SpecTypeCode like '%" + SpecTypeCode + "%'"
- }
- if SpecTypeName != "" {
- where = where + " and a.SpecTypeName like '%" + SpecTypeName + "%'"
- }
- if Remark != "" {
- where = where + " and a.Remark like '%" + Remark + "%'"
- }
- if CreateOn != "" {
- dates := strings.Split(CreateOn, ",")
- if len(dates) == 2 {
- minDate := dates[0]
- maxDate := dates[1]
- where = where + " and a.CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'"
- }
- }
- svc := infochange.GetInfoChangeService(utils.DBE)
- var registerUser register.OilCorporateInfo
- sql := " UserName='" + this.User.Username + "'"
- svc.GetEntity(®isterUser, sql)
- //企业用户必须加创建人条件
- if this.User.IsCompanyUser == 1 {
- where = where + " and (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "')"
- } else {
- //超级管理员和有查看所有数据权限的用户不加条件
- svcPerm := permission.GetPermissionService(utils.DBE)
- isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
- if !svcPerm.IsAdmin(this.User.Id) && !isauth {
- where = where + " and (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "')"
- }
- }
- var list []infochange.SuppModelInfo
- total := svc.GetSuppPagingEntitiesWithOrderBytbl(OilSupplierName, OilInfoChangeName, page.CurrentPage, page.Size, orderby, asc, &list, where)
- //total := svc.GetPagingEntitiesWithOrderBytbl("", 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} []infochange.OilInfoChange
- // @router /alllist [get]
- func (this *InfoChangeController) GetAllEntityList() {
- //获取分页信息
- page := this.GetPageInfoForm()
- where := " 1=1 and b.OldSupplierName is not null"
- orderby := "a.Id"
- asc := false
- Order := this.GetString("Order")
- Prop := this.GetString("Prop")
- if Order != "" && Prop != "" {
- orderby = "a." + Prop
- if Order == "asc" {
- asc = true
- }
- }
- SupplierName := this.GetString("SupplierName")
- if SupplierName != "" {
- where = where + " and a.SupplierName like '%" + SupplierName + "%'"
- }
- svc := infochange.GetInfoChangeService(utils.DBE)
- var list []infochange.OilUsedName
- total := svc.GetUsedNameWithOrderBytbl(OilSupplierName, OilInfoChangeName, page.CurrentPage, page.Size, orderby, asc, &list, where)
- var datainfo DataInfo
- datainfo.Items = list
- datainfo.CurrentItemCount = total
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取列表
- // @Description get user by token
- // @Success 200 {object} []infochange.OilInfoChange
- // @router /list [get]
- func (this *InfoChangeController) 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
- }
- }
- SupplierTypeName := this.GetString("SupplierTypeName")
- RecUnitId := this.GetString("RecUnitId")
- AccessCardNo := this.GetString("AccessCardNo")
- SupplierName := this.GetString("SupplierName")
- CreateOn := this.GetString("CreateOn")
- if SupplierTypeName != "" {
- where = where + " and SupplierTypeName like '%" + SupplierTypeName + "%'"
- }
- if RecUnitId != "" {
- where = where + " and RecUnitId like '%" + RecUnitId + "%'"
- }
- if AccessCardNo != "" {
- where = where + " and AccessCardNo like '%" + AccessCardNo + "%'"
- }
- if SupplierName != "" {
- where = where + " and SupplierName like '%" + SupplierName + "%'"
- }
- if CreateOn != "" {
- dates := strings.Split(CreateOn, ",")
- if len(dates) == 2 {
- minDate := dates[0]
- maxDate := dates[1]
- where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
- }
- }
- //找出待办任务
- actisvc := workflow.GetActivitiService(utils.DBE)
- certIdList := actisvc.GetMyTasks(workflow.OIL_INFO_CHANGE, this.User.Id)
- appendIdarr := strings.Split(certIdList, ",")
- for i, item := range appendIdarr {
- idx := strings.Index(item, "-")
- if idx >= 0 {
- appendIdarr[i] = strings.Split(item, "-")[0]
- }
- }
- certIdList = strings.Join(appendIdarr, ",")
- svc := infochange.GetInfoChangeService(utils.DBE)
- var list []infochange.OilInfoChange
- var total int64 = 0
- if certIdList != "" {
- where += " and Id in (" + certIdList + ")"
- total = svc.GetPagingEntitiesWithOrderBytbl("", 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 获取实体
- // @Success 200 {object} annualaudit.OilAnnualAudit
- // @router /getinfoforitem [get]
- func (this *InfoChangeController) GetInfoForItem() {
- certId := this.GetString("certId")
- selctitem := this.GetString("selctitem")
- svc := infochange.GetInfoChangeService(utils.DBE)
- where := "Id =" + utils.ToStr(certId)
- var selecteditem = svc.GetInfoforItem(""+OilSupplierName, selctitem, where)
- this.Data["json"] = &selecteditem
- this.ServeJSON()
- }
- // @Title 获取实体
- // @Description 获取实体
- // @Success 200 {object} supplier.OilSupplier
- // @router /getchangelist/:id [get]
- func (this *InfoChangeController) GetChangeEntity() {
- Id := this.Ctx.Input.Param(":id")
- InfoId := this.GetString("InfomainId")
- var models [2]supplier.OilSupplier
- var model supplier.OilSupplier
- var enumModel supplier.OilSupplier
- svc := supplier.GetOilSupplierService(utils.DBE)
- svc.GetEntityByIdBytbl(OilSupplierName, Id, &model)
- models[0] = model
- var infoitems []infochange.OilInfoChangeItem
- where := " SupplierId = " + Id +" and InfoId ="+InfoId
- where = where + " and ChangeStatus = 0"
- svc.GetEntitysByWhere(OilInfoChangeItemName, where, &infoitems)
- tmpModel := &model
- enumModel = *tmpModel
- immumodel := reflect.ValueOf(&enumModel)
- elem := immumodel.Elem()
- if len(infoitems) == 0 {
- models[1] = enumModel
- this.Data["json"] = &models
- this.ServeJSON()
- return
- } else {
- for _, info := range infoitems {
- fmt.Println(info.SelectItem)
- fmt.Println(";;;;;;;;;", elem.FieldByName(info.SelectItem).Type().String())
- if elem.FieldByName(info.SelectItem).Type().String() == "int64" {
- intchangeinfo, _ := strconv.ParseInt(info.ChangeInfo, 10, 64)
- elem.FieldByName(info.SelectItem).SetInt(intchangeinfo)
- } else if elem.FieldByName(info.SelectItem).Type().String() == "float64" {
- floatchangeinfo, _ := strconv.ParseFloat(info.ChangeInfo, 64)
- elem.FieldByName(info.SelectItem).SetFloat(floatchangeinfo)
- } else if elem.FieldByName(info.SelectItem).Type().String() == "time.Time" {
- t, _ := time.Parse("2006-01-02", info.ChangeInfo)
- elem.FieldByName(info.SelectItem).Set(reflect.ValueOf(t))
- } else {
- elem.FieldByName(info.SelectItem).SetString(info.ChangeInfo)
- }
- }
- models[1] = enumModel
- this.Data["json"] = &models
- this.ServeJSON()
- }
- }
- // @Title 获取列表
- // @Description get user by token
- // @Success 200 {object} []annualaudit.OilAnnualAudit
- // @router /mytasks [get]
- func (this *InfoChangeController) GetMyTaskEntityList() {
- //获取分页信息
- 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
- }
- }
- SupplierTypeName := this.GetString("SupplierTypeName")
- RecUnitId := this.GetString("RecUnitId")
- AccessCardNo := this.GetString("AccessCardNo")
- SupplierName := this.GetString("SupplierName")
- CreateOn := this.GetString("CreateOn")
- if SupplierTypeName != "" {
- where = where + " and SupplierTypeName like '%" + SupplierTypeName + "%'"
- }
- if RecUnitId != "" {
- where = where + " and RecUnitId like '%" + RecUnitId + "%'"
- }
- if AccessCardNo != "" {
- where = where + " and AccessCardNo like '%" + AccessCardNo + "%'"
- }
- if SupplierName != "" {
- where = where + " and SupplierName like '%" + SupplierName + "%'"
- }
- if CreateOn != "" {
- dates := strings.Split(CreateOn, ",")
- if len(dates) == 2 {
- minDate := dates[0]
- maxDate := dates[1]
- where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
- }
- }
- svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
- var list []annualaudit.OilAnnualAudit
- //找出待办任务
- actisvc := workflow.GetActivitiService(utils.DBE)
- certIdList := actisvc.GetMyTasks(workflow.OIL_AUDIT_APPLY, this.User.Id)
- where += " and Id in (" + certIdList + ")"
- where += " and Status != -2 "
- //根据部门查询待办任务
- total := svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, where)
- //total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, 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
- // @Success 200 {object} ErrorInfo
- // @Failure 403 :id 为空
- // @router /delete/:Id [delete]
- func (this *InfoChangeController) 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 infochange.OilInfoChangeItem
- var entityempty infochange.OilInfoChangeItem
- svc := infochange.GetInfoChangeService(utils.DBE)
- opdesc := "删除-" + Id
- err := svc.DeleteOperationAndWriteLogBytbl(""+OilInfoChangeItemName, BaseOperationLogName, Id, &model, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, "", "信息变更")
- 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 /addinfochangeitem [post]
- func (this *InfoChangeController) AddInfoChangeItem() {
- var model infochange.OilInfoChangeItem
- var jsonBlob = this.Ctx.Input.RequestBody
- svc := infochange.GetInfoChangeService(utils.DBE)
- json.Unmarshal(jsonBlob, &model)
- model.CreateOn = time.Now()
- model.CreateBy = this.User.Realname
- model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- _, err := svc.InsertEntityBytbl(""+OilInfoChangeItemName, &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 新增
- // @Success 200 {object} controllers.Request
- // @router /addinfochangeitemch [post]
- func (this *InfoChangeController) AddInfoChangeItemCh() {
- var model InfoChangeItemsAll
- var jsonBlob = this.Ctx.Input.RequestBody
- svc := infochange.GetInfoChangeService(utils.DBE)
- json.Unmarshal(jsonBlob, &model)
- var err error
- where := " SupplierId = " + model.SupplierId
- where = where + " and InfoId = " + model.MInfoId
- var deleteEntity infochange.OilInfoChangeItem
- delMainId, _ := strconv.Atoi(model.MInfoId)
- deleteEntity.InfoId = delMainId
- svc.DBE.Delete(deleteEntity)
- var infoitementitys []infochange.OilInfoChangeItem
- for i := 0; i < len(model.InfochangeForm); i++ {
- var infoitementity infochange.OilInfoChangeItem
- infoitementity.SelectItem = model.InfochangeForm[i].SelectItem
- infoitementity.SelectItemName = model.InfochangeForm[i].SelectItemName
- infoitementity.ChangeInfo = model.InfochangeForm[i].ChangeInfo
- infoitementity.BeChangeInfo = model.InfochangeForm[i].BeChangeInfo
- infoitementity.ChangeStatus = 0
- infoitementity.SupplierId, _ = strconv.Atoi(model.SupplierId)
- infoitementity.InfoId, _ = strconv.Atoi(model.MInfoId)
- infoitementity.CreateOn = time.Now()
- infoitementity.CreateBy = this.User.Realname
- infoitementity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- infoitementitys = append(infoitementitys, infoitementity)
- }
- _, err = svc.InsertEntityBytbl(""+OilInfoChangeItemName, &infoitementitys)
- 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 获取二级初审人员
- // @router /getauditerbydept/:deptId [get]
- func (this *InfoChangeController) GetAuditerByDept() {
- Id := this.Ctx.Input.Param(":deptId")
- //var auditWorkflow auditsetting.Base_OilAuditSetting
- rsvc := auditsetting.GetOilAuditSettingService(utils.DBE)
- //rsvc.GetAuditStepRoleEntity(OilAuditSettingName, Id, workflow.FIRST_TRIAL, &auditWorkflow)
- var userlist []userRole.Base_User
- where := " CompanyId = " + Id
- rsvc.GetEntities(&userlist, where)
- var datainfo ErrorDataInfo
- datainfo.Item = userlist
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 获取企业法规处人员
- // @Description 获取企业法规处人员
- // @router /getauditer [get]
- func (this *InfoChangeController) GetAuditer() {
- //svc := infochange.GetInfoChangeService(utils.DBE)
- //certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
- var userlist []userRole.Base_User
- var setting auditsetting.Base_OilAuditSetting
- svc := userRole.GetUserService(utils.DBE)
- where := "AuditStepCode='" + workflow.PROF_REGULATION + "'"
- svc.GetEntity(&setting, where)
- paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
- topid := paramSvc.GetBaseparameterMessage("", "paramset", "CENT_AUDIT")
- ids := svc.GetUserIdsByRoleId(strconv.Itoa(setting.RoleId))
- tempstr := strings.Join(ids, ",")
- userIds := strings.Replace(tempstr, "uid_", "", -1)
- userIds = strings.Trim(userIds, ",")
- if userIds != "" {
- where := "Id in (" + userIds + ")" + "and UnitId=" + topid
- svc.GetEntities(&userlist, where)
- }
- //var users []userRole.Base_RoleList
- //certSrv.GetAuditUser("100000178", workflow.PROF_REGULATION, &users)
- //var users []suppliercert.UserList
- // where := "OrganizeId=100000178 and AuditStepCode='" + workflow.PROF_REGULATION + "'"
- //svc.GetEntitysByWhere(OilAuditSettingName, where, &users)
- var datainfo ErrorDataInfo
- datainfo.Item = userlist
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 添加
- // @Description 新增信息变更
- // @Success 200 {object} controllers.Request
- // @router /addinfomain [post]
- func (this *InfoChangeController) AddInfoMain() {
- SupplierId := this.GetString("SupplierId")
- Remark := this.GetString("Remark")
- var infochmain infochange.OilInfoChange
- var infochm []infochange.OilInfoChange
- var suppliermodel supplier.OilSupplier
- var errinfo ErrorDataInfo
- svc := infochange.GetInfoChangeService(utils.DBE)
- where := " SupplierId = " + SupplierId + " and Status < 4"
- svc.GetEntitysByWhere(OilInfoChangeName, where, &infochm)
- if len(infochm) > 0 {
- errinfo.Message = "有已提交在申请中的信息变更,请审批完成后再提交!"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- svc.GetEntityById(SupplierId, &suppliermodel)
- infochmain.Status = "0"
- infochmain.SupplierName = suppliermodel.SupplierName
- infochmain.OldSupplierName = suppliermodel.SupplierName
- infochmain.PACNumber = suppliermodel.PACNumber
- infochmain.SupplierCertificate = suppliermodel.SupplierCertificate
- infochmain.MgrUnit = suppliermodel.MgrUnit
- infochmain.OilCertificateNo = suppliermodel.OilCertificateNo
- infochmain.OperType = suppliermodel.OperType
- infochmain.Country = suppliermodel.Country
- infochmain.MaunAgent = suppliermodel.MaunAgent
- infochmain.CommercialNo = suppliermodel.CommercialNo
- infochmain.OrganCode = suppliermodel.OrganCode
- infochmain.SupplierId, _ = strconv.Atoi(SupplierId)
- infochmain.Remark = Remark
- infochmain.CreateOn = time.Now()
- infochmain.CreateBy = this.User.Realname
- infochmain.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- _, err := svc.InsertEntityBytbl(OilInfoChangeName, &infochmain)
- if err == nil {
- errinfo.Message = "添加成功!"
- errinfo.Code = 0
- errinfo.Item = infochmain.Id
- this.Data["json"] = &errinfo
- this.ServeJSON()
- } else {
- errinfo.Message = "添加失败!"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- }
- // @Title 获取信息变更企业名称
- // @Description 获取实体
- // @Success 200 {object}
- // @router /addsupplierlist [get]
- func (this *InfoChangeController) GetAddSupplierList() {
- svc := infochange.GetInfoChangeService(utils.DBE)
- var supplierlist []annualaudit.Suppliername
- where := "1=1"
- //企业用户必须加创建人条件
- if this.User.IsCompanyUser == 1 {
- where = where + " and a.CreateUserId = '" + this.User.Id + "'"
- } else {
- //超级管理员和有查看所有数据权限的用户不加条件
- svcPerm := permission.GetPermissionService(utils.DBE)
- isauth := svcPerm.IsAuthorized(this.User.Id, "oil_supplier.marketAccess.AllRecord")
- if !svcPerm.IsAdmin(this.User.Id) && !isauth {
- where = where + " and a.CreateUserId = '" + this.User.Id + "'"
- }
- }
- supplierlist = svc.GetSupplierList(""+OilSupplierName, where)
- var datainfo DataInfo
- datainfo.Items = supplierlist
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 提交审批
- // @Description 提交审批
- // @Success 200 {object} controllers.Request
- // @router /commitaudit/:id [post]
- func (this *InfoChangeController) CommitAuditEntity() {
- //suppId := this.Ctx.Input.Param(":id")
- firstAudit := this.GetString("auditer")
- fushenauditer := this.GetString("fushenauditer")
- Remark := this.GetString("Remark")
- InfoId := this.GetString("MInfoId")
- //取出审批列表
- svc := infochange.GetInfoChangeService(utils.DBE)
- var infochangeentity infochange.OilInfoChange
- infwhere := " Id = " + InfoId
- svc.GetEntity(&infochangeentity, infwhere)
- 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()
- }
- }()
- svcActiviti := workflow.GetActivitiService(utils.DBE)
- processInstanceId := ""
- businessKey := ""
- businessKey = InfoId + "-" + strconv.Itoa(infochangeentity.AuditIndex)
- processInstanceId = svcActiviti.StartProcess(workflow.OIL_INFO_CHANGE, businessKey, this.User.Id)
- var ActiComplete workflow.ActiCompleteVM
- ActiComplete.ProcessKey = workflow.OIL_INFO_CHANGE
- ActiComplete.BusinessKey = businessKey
- ActiComplete.UserNames = firstAudit
- ActiComplete.UserId = this.User.Id
- ActiComplete.Result = "1"
- ActiComplete.Remarks = Remark
- ActiComplete.CallbackUrl = ""
- receiveVal := svcActiviti.TaskComplete(ActiComplete)
- 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
- }
- //记下workflowID(首次提交时才会记录,中间状态请忽略) 及审批状态
- infochangeentity.WorkFlowId = processInstanceId
- infochangeentity.Status = suppliercert.FIRST_TRIAL_STATUS //二级单位初审
- infochangeentity.FirstAudit, _ = strconv.Atoi(firstAudit)
- infochangeentity.SecondAudit, _ = strconv.Atoi(fushenauditer)
- infochangeentity.AuditIndex = infochangeentity.AuditIndex + 1
- infochangeentity.BusinessKey = ActiComplete.BusinessKey
- infochangeentity.CreateOn = time.Now()
- infochangeentity.CreateBy = this.User.Realname
- infochangeentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- cols := []string{
- "Id",
- "WorkflowId",
- "Status",
- "Step",
- "FirstAudit",
- "SecondAudit",
- "AuditIndex",
- "BusinessKey",
- "CreateOn",
- "CreateBy",
- "CreateUserId",
- }
- svc.UpdateEntityByIdCols(InfoId, infochangeentity, cols)
- }
- // @Title 提交审批
- // @Description 提交审批
- // @Success 200 {object} controllers.Request
- // @router /audit/:id [post]
- func (this *InfoChangeController) AuditEntity() {
- suppId := this.Ctx.Input.Param(":id")
- firstAudit := this.GetString("auditer")
- Remark := this.GetString("Remark")
- InfoId := this.GetString("MInfoId")
- //取出审批列表
- svc := infochange.GetInfoChangeService(utils.DBE)
- var infoitems []infochange.OilInfoChangeItem
- where := " SupplierId = " + suppId
- svc.GetEntities(&infoitems, where)
- var infochangeentity infochange.OilInfoChange
- infwhere := " Id = " + InfoId
- svc.GetEntity(&infochangeentity, infwhere)
- var infomodel infochange.OilInfoChangeItem
- 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()
- }
- }()
- var items string
- for i := 0; i < len(infoitems); i++ {
- items = fmt.Sprintf("%s %s %s %s", items, infoitems[i].SelectItem, ","+infoitems[i].BeChangeInfo, ","+infoitems[i].ChangeInfo+";")
- }
- items = strings.Trim(items, ";")
- infowhere := " Id = " + InfoId
- svc.Updateentityinfo(OilInfoChangeName, items, infowhere)
- //修改从表infoid
- for i := 0; i < len(infoitems); i++ {
- infomodel.InfoId, _ = strconv.Atoi(InfoId)
- err := svc.UpdateEntityBytbl(OilInfoChangeItemName, infoitems[i].Id, &infomodel, []string{"InfoId"})
- fmt.Println(err)
- }
- svcActiviti := workflow.GetActivitiService(utils.DBE)
- processInstanceId := ""
- businessKey := ""
- if infochangeentity.WorkFlowId == "0" || len(infochangeentity.WorkFlowId) <= 0 {
- //启动工作流
- businessKey = InfoId + "-" + strconv.Itoa(infochangeentity.AuditIndex)
- processInstanceId = svcActiviti.StartProcess(workflow.OIL_INFO_CHANGE, businessKey, this.User.Id)
- }
- var ActiComplete workflow.ActiCompleteVM
- ActiComplete.ProcessKey = workflow.OIL_INFO_CHANGE
- ActiComplete.BusinessKey = businessKey
- ActiComplete.UserNames = firstAudit
- ActiComplete.UserId = this.User.Id
- ActiComplete.Result = "1"
- ActiComplete.Remarks = Remark
- ActiComplete.CallbackUrl = ""
- receiveVal := svcActiviti.TaskComplete(ActiComplete)
- 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
- }
- //记下workflowID(首次提交时才会记录,中间状态请忽略) 及审批状态
- infochangeentity.WorkFlowId = processInstanceId
- infochangeentity.Status = suppliercert.FIRST_TRIAL_STATUS //二级单位初审
- infochangeentity.AuditIndex = infochangeentity.AuditIndex + 1
- infochangeentity.BusinessKey = ActiComplete.BusinessKey
- infochangeentity.CreateOn = time.Now()
- infochangeentity.CreateBy = this.User.Realname
- infochangeentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- cols := []string{
- "Id",
- "WorkflowId",
- "Status",
- "Step",
- "FirstAudit",
- "AuditIndex",
- "BusinessKey",
- "CreateOn",
- "CreateBy",
- "CreateUserId",
- }
- svc.UpdateEntityByIdCols(InfoId, infochangeentity, cols)
- }
- // @Title 审批
- // @Description 审批
- // @Success 200 {object} controllers.Request
- // @router /infoaudit [post]
- func (this *InfoChangeController) InfoAudit() {
- svc := infochange.GetInfoChangeService(utils.DBE)
- var jsonblob = this.Ctx.Input.RequestBody
- var dataother InfoShenHeModel
- json.Unmarshal(jsonblob, &dataother)
- //取出审批列表
- var infoid = dataother.InfoId
- var infomodel infochange.OilInfoChange
- svc.GetEntityById(utils.ToStr(dataother.InfoId), &infomodel)
- var infoitems []infochange.OilInfoChangeItem
- where := "SupplierId = " + utils.ToStr(dataother.SuppId) +" and InfoId = " +utils.ToStr(dataother.InfoId)
- svc.GetEntities(&infoitems, where)
- 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()
- }
- }()
- //审核状态判断进行的操作
- step := 2
- status := ""
- backstatus := "0"
- var userIds string
- if infomodel.Status == suppliercert.FIRST_TRIAL_STATUS {
- userIds = utils.ToStr(infomodel.SecondAudit)
- status = suppliercert.SECOND_TRIAL_STATUS
- step = 2
- backstatus = suppliercert.NOPASS_STATUS
- } else if infomodel.Status == suppliercert.SECOND_TRIAL_STATUS {
- status = suppliercert.CENT_AUDIT_STATUS
- backstatus = suppliercert.NO_SECOND_TRIAL_STATUS
- step = 2
- //dictSvc := items.GetItemsService(utils.DBE)
- //deptIds := dictSvc.GetKeyValueItems("CENT_AUDIT")
- //var users []userRole.Base_RoleList
- //certSrv := suppliercert.GetOilSupplierCertService(utils.DBE)
- //for _, dept := range deptIds {
- // certSrv.GetAuditUser(dept.Value, workflow.PROF_REGULATION, &users)
- // for _, tmpUser := range users {
- // userIds += strconv.FormatInt(tmpUser.Id, 10) + ","
- // }
- //}
- 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 + "'"
- svc.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
- svc.GetEntities(&userlist, where)
- }
- for _, tmpUser := range userlist {
- userIds += strconv.Itoa(tmpUser.Id) + ","
- }
- userIds = strings.Trim(userIds, ",")
- } else if infomodel.Status == suppliercert.CENT_AUDIT_STATUS {
- status = suppliercert.ALL_PASE_STATUS
- step = 3
- backstatus = suppliercert.NO_THIRD_TRIAL_STATUS
- }
- svcActiviti := workflow.GetActivitiService(utils.DBE)
- var ActiComplete workflow.ActiCompleteVM
- ActiComplete.ProcessKey = workflow.OIL_INFO_CHANGE
- ActiComplete.BusinessKey = infomodel.BusinessKey
- ActiComplete.UserNames = userIds
- ActiComplete.UserId = this.User.Id
- ActiComplete.Remarks = dataother.AuditorRemark
- ActiComplete.CallbackUrl = ""
- var myerr error
- if dataother.SuccessStatus == 1 {
- ActiComplete.Result = "1"
- receiveVal := svcActiviti.TaskComplete(ActiComplete)
- if infomodel.Status == suppliercert.CENT_AUDIT_STATUS {
- //信息更新
- var infochangeitemmodel infochange.OilInfoChangeItem
- var supmodel supplier.OilSupplier
- infochangeitemmodel.ChangeStatus = 1
- infomodel.Status = status
- itemswhere := "InfoId = " + utils.ToStr(infoid)
- myerr = svc.UpdateEntityBywheretbl(OilInfoChangeItemName, &infochangeitemmodel, []string{"ChangeStatus"}, itemswhere)
- myerr = this.updatesupplier(OilSupplierName, dataother.SuppId, infoitems, supmodel)
- //资质更新
- where := "SupplierId = " + utils.ToStr(dataother.SuppId) + " and SupType = 2"
- var supfilemodel supplierfile.OilSupplierFile
- supfilemodel.SupType = 3
- svc.UpdateEntityBywheretbl(OilSupplierFileName, &supfilemodel, []string{"SupType"}, where)
- //var qualdetail []qualchange.OilQualChangeDetail
- //svc.UpdateEntityBytbl(OilSupplierFileName, qualdetail[i].FileId, &supfilemodel, []string{"SupType"})
- //where := "SupplierId = " + utils.ToStr(dataother.SuppId)
- //svc.GetEntities(&qualdetail, where)
- //if len(qualdetail) > 0 {
- // for i := 0; i < len(qualdetail); i++ {
- // var supfilemodel supplierfile.OilSupplierFile
- // supfilemodel.FileName = qualdetail[i].FileName
- // supfilemodel.FileUrl = qualdetail[i].FileUrl
- // supfilemodel.EffectDate = qualdetail[i].EffectDate
- // supfilemodel.SupType = 3
- // svc.UpdateEntityBytbl(OilSupplierFileName, qualdetail[i].FileId, &supfilemodel, []string{"FileName", "FileUrl", "EffectDate","SupType"})
- // }
- //}
- }
- infomodel.Status = status
- infomodel.Step = step
- if receiveVal == "true" {
- cols := []string{
- "Id",
- "Status",
- "Step",
- }
- _, myerr = svc.UpdateEntityByIdCols(infoid, infomodel, cols)
- if myerr == nil {
- errinfo.Message = "提交成功!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- } else {
- errinfo.Message = "提交失败!"
- errinfo.Code = -1
- 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" {
- if infomodel.Status == suppliercert.CENT_AUDIT_STATUS {
- infomodel.Status = backstatus
- } else {
- infomodel.Status = backstatus
- // 审批历史
- var audithistoryentity audithistory.Base_AuditHistory
- audithistoryentity.EntityId = infoid
- audithistoryentity.WorkflowId = infomodel.WorkFlowId
- audithistoryentity.Process = ActiComplete.ProcessKey
- audithistoryentity.BusinessKey = ActiComplete.BusinessKey
- audithistoryentity.Type = "04"
- audithistoryentity.BackStep = infomodel.Status
- audithistoryentity.Index = infomodel.AuditIndex
- audithistoryentity.CreateOn = time.Now()
- audithistoryentity.CreateBy = this.User.Realname
- audithistoryentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
- _, myerr = svc.InsertEntity(audithistoryentity)
- infomodel.WorkFlowId = ""
- }
- infomodel.Step = 1
- cols := []string{
- "Status",
- "Step",
- }
- _, myerr := svc.UpdateEntityByIdCols(infoid, infomodel, cols)
- if myerr == nil {
- errinfo.Message = "提交成功!"
- errinfo.Code = 0
- this.Data["json"] = &errinfo
- this.ServeJSON()
- } else {
- errinfo.Message = "提交失败!"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- }
- } else {
- errinfo.Message = "工作流异常,请联系管理员!"
- errinfo.Code = -1
- this.Data["json"] = &errinfo
- this.ServeJSON()
- return
- }
- }
- }
- //更新供方信息表
- func (this *InfoChangeController) updatesupplier(supname string, suppid int, infoitems []infochange.OilInfoChangeItem, supmodel supplier.OilSupplier) error {
- svc := infochange.GetInfoChangeService(utils.DBE)
- var err error
- if len(infoitems) > 0 {
- for i := 0; i < len(infoitems); i++ {
- //var cols []string
- //cols = append(cols, infoitems[i].SelectItem)
- where := " Id = " + utils.ToStr(suppid)
- var sql string
- sql = `UPDATE ` + supname + ` set ` + infoitems[i].SelectItem + ` = ` + infoitems[i].ChangeInfo + ` where ` + where
- _, err = svc.DBE.Exec(sql)
- //err = svc.UpdateEntityBytbl(OilSupplierName, suppid, &supmodel, cols)
- }
- }
- return err
- }
|