1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120 |
- package admin_api_controllers
-
- import (
- "XT_Admin_Api/enums"
- "XT_Admin_Api/models"
- "XT_Admin_Api/service"
- "fmt"
- "time"
- )
-
- type CustomAPIController struct {
- AdminBaseAPIAuthController
- }
-
- func (this *CustomAPIController) CheckCustom() {
- id, _ := this.GetInt64("id")
- ci, _ := service.FindCustomInfoByID(id)
- if ci.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- ci.IsCheck = 1
- ci.CheckPerson = this.GetAdminInfo().Name
- err := service.SaveCustom(&ci)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "审核成功",
- })
-
- }
-
- func (this *CustomAPIController) CreateCustom() {
- name := this.GetString("name")
- //xtOrgID := this.GetString("xt_org_id")
- customType, _ := this.GetInt64("custom_type")
- salesperson := this.GetString("salesperson")
- signTime := this.GetString("sign_time")
- contractPrice := this.GetString("contract_price")
- softwarePrice := this.GetString("software_price")
- hardwarePrice := this.GetString("hardware_price")
- yearCostPrice := this.GetString("year_cost_price")
- address := this.GetString("address")
- isImplement, _ := this.GetInt64("is_implement")
- lisStatus, _ := this.GetInt64("lis_status")
- lisContact := this.GetString("lis_contact")
- lisTime := this.GetString("lis_time")
- lisRemark := this.GetString("lis_remark")
- qcStatus, _ := this.GetInt64("qc_status")
- ybStatus, _ := this.GetInt64("yb_status")
- remark := this.GetString("remark")
- weightScaleStatus, _ := this.GetInt64("weight_scale_status")
- weightScaleBrand := this.GetString("weight_scale_brand")
- weightScaleRemark := this.GetString("weight_scale_remark")
- sphygmomanometerStatus, _ := this.GetInt64("sphygmomanometer_status")
- sphygmomanometerBrand := this.GetString("sphygmomanometer_brand")
- sphygmomanometerRemark := this.GetString("sphygmomanometer_remark")
- scannerStatus, _ := this.GetInt64("scanner_status")
- scannerBrand := this.GetString("scanner_brand")
- scannerRemark := this.GetString("scanner_remark")
- facialRecognitionDeviceStatus, _ := this.GetInt64("facial_recognition_device_status")
- facialRecognitionDeviceBrand := this.GetString("facial_recognition_device_brand")
- facialRecognitionDeviceRemark := this.GetString("facial_recognition_device_remark")
- printerStatus, _ := this.GetInt64("printer_status")
- printerBrand := this.GetString("printer_brand")
- printerRemark := this.GetString("printer_remark")
- hardwareRemark := this.GetString("hardware_remark")
- implement_time := this.GetString("implement_time")
- implement_person := this.GetString("implement_person")
- implement_remark := this.GetString("implement_remark")
- yb_time := this.GetString("yb_time")
- yb_person := this.GetString("yb_person")
- yb_remark := this.GetString("yb_remark")
- qc_time := this.GetString("qc_time")
- qc_person := this.GetString("qc_person")
- qc_remark := this.GetString("qc_remark")
-
- client_remark := this.GetString("client_remark")
- topline_time := this.GetString("topline_time")
-
- kyyChargeCustom := &models.KyyChargeCustom{
- ImplementTime: implement_time,
- ImplementPerson: implement_person,
- ImplementRemark: implement_remark,
- YbTime: yb_time,
- YbRemark: yb_remark,
- YbPerson: yb_person,
- QcTime: qc_time,
- QcPerson: qc_person,
- QcRemark: qc_remark,
- Name: name,
- Status: 1,
- Ctime: time.Now().Unix(),
- Mtime: time.Now().Unix(),
- Creator: 0,
- Modifier: 0,
- CustomType: customType,
- Salesperson: salesperson,
- SignTime: signTime,
- ContractPrice: contractPrice,
- SoftwarePrice: softwarePrice,
- HardwarePrice: hardwarePrice,
- YearCostPrice: yearCostPrice,
- Address: address,
- IsImplement: isImplement,
- LisStatus: lisStatus,
- LisContact: lisContact,
- LisTime: lisTime,
- LisRemark: lisRemark,
- QcStatus: qcStatus,
- YbStatus: ybStatus,
- Remark: remark,
- WeightScaleStatus: weightScaleStatus,
- WeightScaleBrand: weightScaleBrand,
- WeightScaleRemark: weightScaleRemark,
- SphygmomanometerStatus: sphygmomanometerStatus,
- SphygmomanometerBrand: sphygmomanometerBrand,
- SphygmomanometerRemark: sphygmomanometerRemark,
- ScannerStatus: scannerStatus,
- ScannerBrand: scannerBrand,
- ScannerRemark: scannerRemark,
- FacialRecognitionDeviceStatus: facialRecognitionDeviceStatus,
- FacialRecognitionDeviceBrand: facialRecognitionDeviceBrand,
- FacialRecognitionDeviceRemark: facialRecognitionDeviceRemark,
- PrinterStatus: printerStatus,
- PrinterBrand: printerBrand,
- PrinterRemark: printerRemark,
- HardwareRemark: hardwareRemark,
- ClientRemark: client_remark,
- ToplineTime: topline_time,
- }
- //custom, _ := service.FindCustomInfo(xtOrgID)
- //if custom.ID > 0 {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNameException)
- // return
- //}
- err := service.CreateCustom(kyyChargeCustom)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "custom": kyyChargeCustom,
- })
- }
- }
- func (this *CustomAPIController) GetCustomList() {
- list, _ := service.GetAllCustoms()
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- }
-
- // func (this *CustomAPIController) DeleteAdmin() {
- // id, _ := this.GetInt64("id")
- // err := service.DeleteAdmin(id)
- // if err == nil {
- // this.ServeSuccessJSON(map[string]interface{}{
- // "msg": "删除成功",
- // })
- // }
- // }
- func (this *CustomAPIController) ModifyCustom() {
- id, _ := this.GetInt64("id")
- module, _ := this.GetInt64("module")
- custom, _ := service.FindCustomInfoByIDTwo(id)
- switch module {
- case 1: //编辑基本信息
- name := this.GetString("name")
- customType, _ := this.GetInt64("custom_type")
- salesperson := this.GetString("salesperson")
- signTime := this.GetString("sign_time")
- contractPrice := this.GetString("contract_price")
- softwarePrice := this.GetString("software_price")
- hardwarePrice := this.GetString("hardware_price")
- yearCostPrice := this.GetString("year_cost_price")
- address := this.GetString("address")
- client_remark := this.GetString("client_remark")
- topline_time := this.GetString("topline_time")
- custom.CustomType = customType
- custom.Salesperson = salesperson
- custom.SignTime = signTime
- custom.ContractPrice = contractPrice
- custom.SoftwarePrice = softwarePrice
- custom.HardwarePrice = hardwarePrice
- custom.YearCostPrice = yearCostPrice
- custom.Address = address
- custom.Name = name
- custom.ID = id
- custom.Mtime = time.Now().Unix()
- custom.ClientRemark = client_remark
- custom.ToplineTime = topline_time
- err := service.UpdateCustomTwo(custom)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
-
- break
- case 2: //编辑实施信息
- isImplement, _ := this.GetInt64("is_implement")
- implementTime := this.GetString("implement_time")
- implementPerson := this.GetString("implement_person")
- implementRemark := this.GetString("implement_remark")
- custom.IsImplement = isImplement
- custom.ImplementTime = implementTime
- custom.ImplementPerson = implementPerson
- custom.ImplementRemark = implementRemark
- custom.ID = id
- custom.Mtime = time.Now().Unix()
- err := service.UpdateCustomTwo(custom)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
- break
- case 3: //编辑LIS对接
- lisStatus, _ := this.GetInt64("lis_status")
- lisContact := this.GetString("lis_contact")
- lisTime := this.GetString("lis_time")
- lisRemark := this.GetString("lis_remark")
- custom.LisStatus = lisStatus
- custom.LisTime = lisTime
- custom.LisRemark = lisRemark
- custom.LisContact = lisContact
- custom.ID = id
- custom.Mtime = time.Now().Unix()
- err := service.UpdateCustomTwo(custom)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
- break
- case 4: //编辑医保对接
- ybStatus, _ := this.GetInt64("yb_status")
- ybPerson := this.GetString("yb_person")
- ybTime := this.GetString("yb_time")
- ybRemark := this.GetString("yb_remark")
- custom.YbStatus = ybStatus
- custom.YbPerson = ybPerson
- custom.YbTime = ybTime
- custom.YbRemark = ybRemark
- custom.ID = id
- custom.Mtime = time.Now().Unix()
- err := service.UpdateCustomTwo(custom)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
-
- break
- case 5: //编辑质控对接
- qcStatus, _ := this.GetInt64("qc_status")
- qcPerson := this.GetString("qc_person")
- qcTime := this.GetString("qc_time")
- qcRemark := this.GetString("qc_remark")
- custom.QcStatus = qcStatus
- custom.QcPerson = qcPerson
- custom.QcTime = qcTime
- custom.QcRemark = qcRemark
- custom.ID = id
- custom.Mtime = time.Now().Unix()
- err := service.UpdateCustomTwo(custom)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
-
- break
- case 6: //编辑备注
- remark := this.GetString("remark")
- custom.Remark = remark
- custom.ID = id
- custom.Mtime = time.Now().Unix()
- err := service.UpdateCustomTwo(custom)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
-
- break
- case 7: //编辑硬件信息
- weightScaleStatus, _ := this.GetInt64("weight_scale_status")
- weightScaleBrand := this.GetString("weight_scale_brand")
- weightScaleRemark := this.GetString("weight_scale_remark")
- sphygmomanometerStatus, _ := this.GetInt64("sphygmomanometer_status")
- sphygmomanometerBrand := this.GetString("sphygmomanometer_brand")
- sphygmomanometerRemark := this.GetString("sphygmomanometer_remark")
- scannerStatus, _ := this.GetInt64("scanner_status")
- scannerBrand := this.GetString("scanner_brand")
- scannerRemark := this.GetString("scanner_remark")
- facialRecognitionDeviceStatus, _ := this.GetInt64("facial_recognition_device_status")
- facialRecognitionDeviceBrand := this.GetString("facial_recognition_device_brand")
- facialRecognitionDeviceRemark := this.GetString("facial_recognition_device_remark")
- printerStatus, _ := this.GetInt64("printer_status")
- printerBrand := this.GetString("printer_brand")
- printerRemark := this.GetString("printer_remark")
- hardwareRemark := this.GetString("hardware_remark")
-
- custom.WeightScaleStatus = weightScaleStatus
- custom.WeightScaleBrand = weightScaleBrand
- custom.WeightScaleRemark = weightScaleRemark
- custom.SphygmomanometerStatus = sphygmomanometerStatus
- custom.SphygmomanometerBrand = sphygmomanometerBrand
- custom.SphygmomanometerRemark = sphygmomanometerRemark
-
- custom.ScannerStatus = scannerStatus
- custom.ScannerBrand = scannerBrand
- custom.ScannerRemark = scannerRemark
-
- custom.FacialRecognitionDeviceStatus = facialRecognitionDeviceStatus
- custom.FacialRecognitionDeviceBrand = facialRecognitionDeviceBrand
- custom.FacialRecognitionDeviceRemark = facialRecognitionDeviceRemark
-
- custom.PrinterStatus = printerStatus
- custom.PrinterBrand = printerBrand
- custom.PrinterRemark = printerRemark
-
- custom.HardwareRemark = hardwareRemark
-
- custom.ID = id
- custom.Mtime = time.Now().Unix()
- err := service.UpdateCustomTwo(custom)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
- break
- }
-
- }
-
- func (this *CustomAPIController) GetCustom() {
- id, _ := this.GetInt64("id")
- custom, _ := service.FindCustomInfoByID(id)
- if custom.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "custom": custom,
- })
- }
-
- func (this *CustomAPIController) CreatePaymentCollection() {
- customID, _ := this.GetInt64("custom_id")
- customName := this.GetString("custom_name")
- paymentCollectionType, _ := this.GetInt64("payment_collection_type")
- paymentCollectionSumAmt := this.GetString("payment_collection_sumamt")
- softwareSumAmt := this.GetString("software_sumamt")
- hardwareSumAmt := this.GetString("hardware_sumamt")
- paymentCollectionDate := this.GetString("payment_collection_date")
- paymentCollectionRole := this.GetString("payment_collection_role")
- url := this.GetString("url")
- remark := this.GetString("remark")
- ctime := time.Now().Unix()
- mtime := time.Now().Unix()
-
- // 创建 KyyChargePaymentCollection 对象,并设置每个字段的值
- paymentCollection := models.KyyChargePaymentCollection{
- CustomId: customID,
- CustomName: customName,
- PaymentCollectionType: paymentCollectionType,
- PaymentCollectionSumamt: paymentCollectionSumAmt,
- SoftwareSumamt: softwareSumAmt,
- HardwareSumamt: hardwareSumAmt,
- PaymentCollectionDate: paymentCollectionDate,
- PaymentCollectionRole: paymentCollectionRole,
- Url: url,
- Remark: remark,
- Ctime: ctime,
- Mtime: mtime,
- Creator: 0,
- Modifier: 0,
- Status: 1,
- }
- err := service.CreateChargePaymentCollection(&paymentCollection)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "paymentCollection": paymentCollection,
- })
-
- }
- func (this *CustomAPIController) GetPaymentCollectionList() {
- list, _ := service.GetAllPaymentCollections()
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- }
- func (this *CustomAPIController) GetPaymentCollection() {
- id, _ := this.GetInt64("id")
- pc, _ := service.FindPaymentCollectionInfo(id)
- if pc.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "pc": pc,
- })
- }
- func (this *CustomAPIController) EditPaymentCollection() {
- id, _ := this.GetInt64("id")
- paymentCollectionType, _ := this.GetInt64("payment_collection_type")
- paymentCollectionSumAmt := this.GetString("payment_collection_sumamt")
- softwareSumAmt := this.GetString("software_sumamt")
- hardwareSumAmt := this.GetString("hardware_sumamt")
- paymentCollectionDate := this.GetString("payment_collection_date")
- paymentCollectionRole := this.GetString("payment_collection_role")
- url := this.GetString("url")
- remark := this.GetString("remark")
- mtime := time.Now().Unix()
-
- cpc, _ := service.FindPaymentCollectionInfo(id)
- if cpc.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- cpc.PaymentCollectionType = paymentCollectionType
- cpc.PaymentCollectionSumamt = paymentCollectionSumAmt
- cpc.SoftwareSumamt = softwareSumAmt
- cpc.HardwareSumamt = hardwareSumAmt
- cpc.PaymentCollectionDate = paymentCollectionDate
- cpc.PaymentCollectionRole = paymentCollectionRole
- cpc.Url = url
- cpc.Remark = remark
- cpc.Mtime = mtime
-
- err := service.CreateChargePaymentCollection(&cpc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "cpc": cpc,
- })
-
- }
-
- func (this *CustomAPIController) DeleteCustom() {
- id, _ := this.GetInt64("id")
- ct, _ := service.FindCustomInfoByIDTwo(id)
- if ct.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- ct.Status = 0
- err := service.SaveCustomTwo(ct)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "删除成功",
- })
- }
-
- func (this *CustomAPIController) DeletePaymentCollection() {
- id, _ := this.GetInt64("id")
- cpc, _ := service.FindPaymentCollectionInfo(id)
- if cpc.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- cpc.Status = 0
- err := service.SaveChargePaymentCollection(&cpc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "删除成功",
- })
- }
- func (this *CustomAPIController) CheckPaymentCollection() {
- id, _ := this.GetInt64("id")
- cpc, _ := service.FindPaymentCollectionInfo(id)
- if cpc.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- cpc.IsCheck = 1
- err := service.SaveChargePaymentCollection(&cpc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "审核成功",
- })
-
- }
- func (this *CustomAPIController) CreateContactInfo() {
- customID, _ := this.GetInt64("custom_id")
- contactName := this.GetString("contact_name")
- contactPhone := this.GetString("contact_phone")
- contactDuties := this.GetString("contact_duties")
- isDecision := this.GetString("is_decision")
- remark := this.GetString("remark")
- contact_way := this.GetString("contact_way")
-
- ctime := time.Now().Unix()
- mtime := time.Now().Unix()
-
- // 创建 KyyChargeContact 对象,并设置每个字段的值
- contact := models.KyyChargeContact{
- ID: 0,
- CustomId: customID,
- ContactName: contactName,
- ContactPhone: contactPhone,
- ContactDuties: contactDuties,
- IsDecision: isDecision,
- Remark: remark,
- Ctime: ctime,
- Mtime: mtime,
- Status: 1,
- Creator: 0,
- Modifier: 0,
- IsCheck: 0,
- ContactWay: contact_way,
- }
- err := service.SaveChargeContact(&contact)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "contact": contact,
- })
- }
- func (this *CustomAPIController) GetContactInfoList() {
- list, _ := service.GetAllChargeContacts()
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- }
- func (this *CustomAPIController) GetContactInfo() {
- id, _ := this.GetInt64("id")
- cc, _ := service.FindChargeContactInfo(id)
- if cc.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "contact_info": cc,
- })
- }
- func (this *CustomAPIController) EditContactInfo() {
- id, _ := this.GetInt64("id")
- contactName := this.GetString("contact_name")
- contactPhone := this.GetString("contact_phone")
- contactDuties := this.GetString("contact_duties")
- isDecision := this.GetString("is_decision")
- remark := this.GetString("remark")
- mtime := time.Now().Unix()
- chargeContact, _ := service.FindChargeContactInfo(id)
- if chargeContact.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- chargeContact.ContactName = contactName
- chargeContact.ContactPhone = contactPhone
- chargeContact.ContactDuties = contactDuties
- chargeContact.IsDecision = isDecision
- chargeContact.Remark = remark
- chargeContact.Remark = remark
- chargeContact.Mtime = mtime
-
- err := service.SaveChargeContact(&chargeContact)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "contact": chargeContact,
- })
-
- }
- func (this *CustomAPIController) DeleteContactInfo() {
- id, _ := this.GetInt64("id")
- cc, _ := service.FindChargeContactInfo(id)
- if cc.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- cc.Status = 0
- err := service.SaveChargeContact(&cc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "删除成功",
- })
- }
- func (this *CustomAPIController) CheckContactInfo() {
- id, _ := this.GetInt64("id")
- chargeContact, _ := service.FindChargeContactInfo(id)
- if chargeContact.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- chargeContact.IsCheck = 1
- err := service.SaveChargeContact(&chargeContact)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "审核成功",
- })
- }
- func (this *CustomAPIController) CreateContractInfo() {
- customID, _ := this.GetInt64("custom_id")
- code := this.GetString("code")
- name := this.GetString("name")
- sumamt := this.GetString("sumamt")
- custom_name := this.GetString("custom_name")
-
- start_time := this.GetString("start_time")
- end_time := this.GetString("end_time")
- signing_person := this.GetString("signing_person")
- wordFileURL := this.GetString("word_file_url")
- pdfFileURL := this.GetString("pdf_file_url")
- remark := this.GetString("remark")
- ctime := time.Now().Unix()
- mtime := time.Now().Unix()
-
- // 创建 KyyChargeContract 对象,并设置每个字段的值
- contract := models.KyyChargeContract{
- CustomId: customID,
- Code: code,
- Name: name,
- Sumamt: sumamt,
- StartTime: start_time,
- EndTime: end_time,
- SigningPerson: signing_person,
- WordFileUrl: wordFileURL,
- PdfFileUrl: pdfFileURL,
- CustomName: custom_name,
- Remark: remark,
- Ctime: ctime,
- Mtime: mtime,
- Status: 1,
- }
- err := service.SaveChargeContract(&contract)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "创建成功",
- })
-
- }
- func (this *CustomAPIController) GetContractInfoList() {
- list, _ := service.GetAllChargeContracts()
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- }
- func (this *CustomAPIController) GetContractInfo() {
- id, _ := this.GetInt64("id")
- cc, _ := service.FindChargeContractInfo(id)
- if cc.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "charge_contract": cc,
- })
- }
- func (this *CustomAPIController) EditContractInfo() {
- id, _ := this.GetInt64("id")
- code := this.GetString("code")
- name := this.GetString("name")
- customName := this.GetString("custom_name")
- sumamt := this.GetString("sumamt")
- startTime := this.GetString("start_time")
- endTime := this.GetString("end_time")
- signingPerson := this.GetString("signing_person")
- wordFileURL := this.GetString("word_file_url")
- pdfFileURL := this.GetString("pdf_file_url")
- remark := this.GetString("remark")
- mtime := time.Now().Unix()
-
- chargeContract, _ := service.FindChargeContractInfo(id)
- if chargeContract.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- chargeContract.Code = code
- chargeContract.Name = name
- chargeContract.CustomName = customName
- chargeContract.Sumamt = sumamt
- chargeContract.StartTime = startTime
- chargeContract.EndTime = endTime
- chargeContract.SigningPerson = signingPerson
- chargeContract.WordFileUrl = wordFileURL
- chargeContract.PdfFileUrl = pdfFileURL
- chargeContract.Remark = remark
- chargeContract.Mtime = mtime
- err := service.SaveChargeContract(&chargeContract)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "修改成功",
- })
-
- }
- func (this *CustomAPIController) DeleteContractInfo() {
- id, _ := this.GetInt64("id")
- cc, _ := service.FindChargeContractInfo(id)
- if cc.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- cc.Status = 0
- err := service.SaveChargeContract(&cc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "删除成功",
- })
- }
- func (this *CustomAPIController) CheckContractInfo() {
- id, _ := this.GetInt64("id")
- chargeContract, _ := service.FindChargeContractInfo(id)
- if chargeContract.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- chargeContract.IsCheck = 1
- err := service.SaveChargeContract(&chargeContract)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "审核成功",
- })
- }
- func (this *CustomAPIController) CreateFollowInfo() {
- ctime := time.Now().Unix()
- mtime := time.Now().Unix()
- customID, _ := this.GetInt64("custom_id")
- desc := this.GetString("desc")
- // 创建 KyyChargeFollow 对象,并设置每个字段的值
- follow := models.KyyChargeFollow{
- Ctime: ctime,
- Mtime: mtime,
- Creator: this.GetAdminInfo().ID,
- CustomId: customID,
- Desc: desc,
- Status: 1,
- }
- err := service.SaveChargeFollow(&follow)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "follow": follow,
- })
-
- }
- func (this *CustomAPIController) GetFollowInfoList() {
- list, _ := service.GetAllChargeFollow()
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- }
- func (this *CustomAPIController) GetFollowInfo() {
- id, _ := this.GetInt64("id")
- follow, _ := service.FindChargeFollowInfo(id)
- if follow.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "follow": follow,
- })
- }
- func (this *CustomAPIController) EditFollowInfo() {
- id, _ := this.GetInt64("id")
- desc := this.GetString("desc")
- chargeFollow, _ := service.FindChargeFollowInfo(id)
- chargeFollow.Desc = desc
- chargeFollow.Mtime = time.Now().Unix()
- err := service.SaveChargeFollow(&chargeFollow)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "follow": chargeFollow,
- })
-
- }
- func (this *CustomAPIController) DeleteFollowInfo() {
- id, _ := this.GetInt64("id")
- follow, _ := service.FindChargeFollowInfo(id)
- if follow.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- follow.Status = 0
- err := service.SaveChargeFollow(&follow)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "删除成功",
- })
- }
- func (this *CustomAPIController) CheckFollowInfo() {
- id, _ := this.GetInt64("id")
- follow, _ := service.FindChargeFollowInfo(id)
- if follow.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- follow.IsCheck = 1
- err := service.SaveChargeFollow(&follow)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "审核成功",
- })
- }
- func (this *CustomAPIController) CreateDemandInfo() {
- demandType, _ := this.GetInt64("demand_type")
- demandDesc := this.GetString("demand_desc")
- demandStatus, _ := this.GetInt64("demand_status")
- demandCreator := this.GetString("demand_creator")
- demandCreateDate := this.GetString("demand_create_date")
- demandDirector := this.GetString("demand_director")
- ctime := time.Now().Unix()
- mtime := time.Now().Unix()
- customID, _ := this.GetInt64("custom_id")
- demandFinishDate := this.GetString("demand_finish_date")
- demandDetail := this.GetString("demand_detail")
-
- // 创建 KyyChargeDemand 对象,并设置每个字段的值
- demand := models.KyyChargeDemand{
- DemandType: demandType,
- DemandDesc: demandDesc,
- DemandStatus: demandStatus,
- DemandCreator: demandCreator,
- DemandCreateDate: demandCreateDate,
- DemandDirector: demandDirector,
- Ctime: ctime,
- Mtime: mtime,
- Status: 1,
- CustomId: customID,
- DemandFinishDate: demandFinishDate,
- DemandDetail: demandDetail,
- }
- err := service.SaveChargeDemand(&demand)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "demand": demand,
- })
-
- }
- func (this *CustomAPIController) GetDemandInfoList() {
- list, _ := service.GetAllChargeDemand()
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- }
- func (this *CustomAPIController) GetDemandInfo() {
- id, _ := this.GetInt64("id")
- cd, _ := service.FindChargeDemandInfo(id)
- if cd.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "charge_demand": cd,
- })
- }
- func (this *CustomAPIController) EditDemandInfo() {
- id, _ := this.GetInt64("id")
- demandType, _ := this.GetInt64("demand_type")
- demandDesc := this.GetString("demand_desc")
- demandStatus, _ := this.GetInt64("demand_status")
- demandCreator := this.GetString("demand_creator")
- demandCreateDate := this.GetString("demand_create_date")
- demandFinishDate := this.GetString("demand_finish_date")
- demandDetail := this.GetString("demand_detail")
-
- demandDirector := this.GetString("demand_director")
- cd, _ := service.FindChargeDemandInfo(id)
- cd.DemandType = demandType
- cd.DemandDesc = demandDesc
- cd.DemandStatus = demandStatus
- cd.DemandCreator = demandCreator
- cd.DemandCreateDate = demandCreateDate
- cd.DemandFinishDate = demandFinishDate
- cd.DemandDirector = demandDirector
- cd.DemandDetail = demandDetail
- cd.Mtime = time.Now().Unix()
- err := service.SaveChargeDemand(&cd)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "demand": cd,
- })
- }
- func (this *CustomAPIController) DeleteDemandInfo() {
- id, _ := this.GetInt64("id")
- cd, _ := service.FindChargeDemandInfo(id)
- if cd.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- cd.Status = 0
- err := service.SaveChargeDemand(&cd)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "删除成功",
- })
- }
- func (this *CustomAPIController) CheckDemandInfo() {
- id, _ := this.GetInt64("id")
- cd, _ := service.FindChargeDemandInfo(id)
- if cd.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- cd.IsCheck = 1
- err := service.SaveChargeDemand(&cd)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "审核成功",
- })
- }
- func (this *CustomAPIController) CreateRenewalInfo() {
- types, _ := this.GetInt64("type")
- startTime := this.GetString("start_time")
- endTime := this.GetString("end_time")
- signingPersonal := this.GetString("signing_personal")
- customID, _ := this.GetInt64("custom_id")
- signTime := this.GetString("sign_time")
- checkPersonal := this.GetString("check_personal")
- ctime := time.Now().Format("2006-01-02 15:04:05") // 使用当前时间
- mtime := time.Now().Format("2006-01-02 15:04:05") // 使用当前时间
- remark := this.GetString("remark")
-
- // 创建 KyyChargeRenewal 对象,并设置每个字段的值
- renewal := models.KyyChargeRenewal{
- Type: types,
- StartTime: startTime,
- EndTime: endTime,
- SigningPersonal: signingPersonal,
- CustomId: customID,
- SignTime: signTime,
- CheckPersonal: checkPersonal,
- Ctime: ctime,
- Mtime: mtime,
- Status: 1,
- Remark: remark,
- }
- err := service.SaveChargeRenewal(&renewal)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "renewal": renewal,
- })
-
- }
- func (this *CustomAPIController) GetRenewalInfoList() {
- list, _ := service.GetAllChargeRenewal()
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- }
- func (this *CustomAPIController) GetRenewalInfo() {
- id, _ := this.GetInt64("id")
- cr, _ := service.FindChargeRenewalInfo(id)
- if cr.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "charge_renewal": cr,
- })
- }
- func (this *CustomAPIController) EditRenewalInfo() {
- types, _ := this.GetInt64("type")
- id, _ := this.GetInt64("id")
- startTime := this.GetString("start_time")
- endTime := this.GetString("end_time")
- signingPersonal := this.GetString("signing_personal")
- customID, _ := this.GetInt64("custom_id")
- signTime := this.GetString("sign_time")
- remark := this.GetString("remark")
-
- checkPersonal := this.GetString("check_personal")
- mtime := time.Now().Format("2006-01-02 15:04:05") // 使用当前时间
-
- cr, _ := service.FindChargeRenewalInfo(id)
- if cr.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- cr.Type = types
- cr.CustomId = customID
- cr.StartTime = startTime
- cr.EndTime = endTime
- cr.SigningPersonal = signingPersonal
- cr.SignTime = signTime
- cr.Mtime = mtime
- cr.Remark = remark
- cr.CheckPersonal = checkPersonal
- err := service.SaveChargeRenewal(&cr)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "cr": cr,
- })
- }
- func (this *CustomAPIController) DeleteRenewalInfo() {
- id, _ := this.GetInt64("id")
- cr, _ := service.FindChargeRenewalInfo(id)
- if cr.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- cr.Status = 0
- err := service.SaveChargeRenewal(&cr)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "删除成功",
- })
- }
- func (this *CustomAPIController) CheckRenewalInfo() {
- id, _ := this.GetInt64("id")
- cr, _ := service.FindChargeRenewalInfo(id)
- if cr.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- cr.IsCheck = 1
- err := service.SaveChargeRenewal(&cr)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "审核成功",
- })
- }
-
- func (c *CustomAPIController) GetQNUpToken() {
- redisClient := service.RedisClient()
- defer redisClient.Close()
-
- token, err := redisClient.Get("qn_token").Result()
-
- if err != nil {
- defer fmt.Println(err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGetQiniuUpToken)
- return
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "uptoken": token,
- })
- return
- }
|