123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140 |
- 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.FindCustomInfoByIDTwo(id)
- if ci.ID == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- ci.IsCheck = 1
- ci.CheckPerson = this.GetAdminInfo().Name
- err := service.SaveCustomTwo(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")
- sign_end_time := this.GetString("sign_end_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,
- SignEndTime: sign_end_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")
- sign_end_time := this.GetString("sign_end_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.SignEndTime = sign_end_time
- 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
- cpc.CheckPerson = this.GetAdminInfo().Name
-
- 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
- chargeContact.CheckPerson = this.GetAdminInfo().Name
-
- 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.CheckPerson = this.GetAdminInfo().Name
-
- 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.FindChargeFollowInfoTwo(id)
- if len(follow) == 0 {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- var ids []int64
- for _, item := range follow {
-
- ids = append(ids, item.ID)
- }
- err := service.CheckChargeFollowTwo(ids)
- 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
- //chargeContract
- cd.CheckPerson = this.GetAdminInfo().Name
-
- 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
- cr.CheckPerson = this.GetAdminInfo().Name
-
- 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
- }
|