12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100 |
- 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) DeleteCustom() {
- 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) 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
- }
|