custom_api_controller.go 32KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043
  1. package admin_api_controllers
  2. import (
  3. "XT_Admin_Api/enums"
  4. "XT_Admin_Api/models"
  5. "XT_Admin_Api/service"
  6. "time"
  7. )
  8. type CustomAPIController struct {
  9. AdminBaseAPIAuthController
  10. }
  11. func (this *CustomAPIController) CreateCustom() {
  12. name := this.GetString("name")
  13. //xtOrgID := this.GetString("xt_org_id")
  14. customType, _ := this.GetInt64("custom_type")
  15. salesperson := this.GetString("salesperson")
  16. signTime := this.GetString("sign_time")
  17. contractPrice := this.GetString("contract_price")
  18. softwarePrice := this.GetString("software_price")
  19. hardwarePrice := this.GetString("hardware_price")
  20. yearCostPrice := this.GetString("year_cost_price")
  21. address := this.GetString("address")
  22. isImplement, _ := this.GetInt64("is_implement")
  23. lisStatus, _ := this.GetInt64("lis_status")
  24. lisContact := this.GetString("lis_contact")
  25. lisTime := this.GetString("lis_time")
  26. lisRemark := this.GetString("lis_remark")
  27. qcStatus, _ := this.GetInt64("qc_status")
  28. ybStatus, _ := this.GetInt64("yb_status")
  29. remark := this.GetString("remark")
  30. weightScaleStatus, _ := this.GetInt64("weight_scale_status")
  31. weightScaleBrand := this.GetString("weight_scale_brand")
  32. weightScaleRemark := this.GetString("weight_scale_remark")
  33. sphygmomanometerStatus, _ := this.GetInt64("sphygmomanometer_status")
  34. sphygmomanometerBrand := this.GetString("sphygmomanometer_brand")
  35. sphygmomanometerRemark := this.GetString("sphygmomanometer_remark")
  36. scannerStatus, _ := this.GetInt64("scanner_status")
  37. scannerBrand := this.GetString("scanner_brand")
  38. scannerRemark := this.GetString("scanner_remark")
  39. facialRecognitionDeviceStatus, _ := this.GetInt64("facial_recognition_device_status")
  40. facialRecognitionDeviceBrand := this.GetString("facial_recognition_device_brand")
  41. facialRecognitionDeviceRemark := this.GetString("facial_recognition_device_remark")
  42. printerStatus, _ := this.GetInt64("printer_status")
  43. printerBrand := this.GetString("printer_brand")
  44. printerRemark := this.GetString("printer_remark")
  45. hardwareRemark := this.GetString("hardware_remark")
  46. implement_time := this.GetString("implement_time")
  47. implement_person := this.GetString("implement_person")
  48. implement_remark := this.GetString("implement_remark")
  49. yb_time := this.GetString("yb_time")
  50. yb_person := this.GetString("yb_person")
  51. yb_remark := this.GetString("yb_remark")
  52. qc_time := this.GetString("qc_time")
  53. qc_person := this.GetString("qc_person")
  54. qc_remark := this.GetString("qc_remark")
  55. kyyChargeCustom := &models.KyyChargeCustom{
  56. ImplementTime: implement_time,
  57. ImplementPerson: implement_person,
  58. ImplementRemark: implement_remark,
  59. YbTime: yb_time,
  60. YbRemark: yb_remark,
  61. YbPerson: yb_person,
  62. QcTime: qc_time,
  63. QcPerson: qc_person,
  64. QcRemark: qc_remark,
  65. Name: name,
  66. Status: 1,
  67. Ctime: time.Now().Unix(),
  68. Mtime: time.Now().Unix(),
  69. Creator: 0,
  70. Modifier: 0,
  71. CustomType: customType,
  72. Salesperson: salesperson,
  73. SignTime: signTime,
  74. ContractPrice: contractPrice,
  75. SoftwarePrice: softwarePrice,
  76. HardwarePrice: hardwarePrice,
  77. YearCostPrice: yearCostPrice,
  78. Address: address,
  79. IsImplement: isImplement,
  80. LisStatus: lisStatus,
  81. LisContact: lisContact,
  82. LisTime: lisTime,
  83. LisRemark: lisRemark,
  84. QcStatus: qcStatus,
  85. YbStatus: ybStatus,
  86. Remark: remark,
  87. WeightScaleStatus: weightScaleStatus,
  88. WeightScaleBrand: weightScaleBrand,
  89. WeightScaleRemark: weightScaleRemark,
  90. SphygmomanometerStatus: sphygmomanometerStatus,
  91. SphygmomanometerBrand: sphygmomanometerBrand,
  92. SphygmomanometerRemark: sphygmomanometerRemark,
  93. ScannerStatus: scannerStatus,
  94. ScannerBrand: scannerBrand,
  95. ScannerRemark: scannerRemark,
  96. FacialRecognitionDeviceStatus: facialRecognitionDeviceStatus,
  97. FacialRecognitionDeviceBrand: facialRecognitionDeviceBrand,
  98. FacialRecognitionDeviceRemark: facialRecognitionDeviceRemark,
  99. PrinterStatus: printerStatus,
  100. PrinterBrand: printerBrand,
  101. PrinterRemark: printerRemark,
  102. HardwareRemark: hardwareRemark,
  103. }
  104. //custom, _ := service.FindCustomInfo(xtOrgID)
  105. //if custom.ID > 0 {
  106. // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNameException)
  107. // return
  108. //}
  109. err := service.CreateCustom(kyyChargeCustom)
  110. if err == nil {
  111. this.ServeSuccessJSON(map[string]interface{}{
  112. "custom": kyyChargeCustom,
  113. })
  114. }
  115. }
  116. func (this *CustomAPIController) GetCustomList() {
  117. list, _ := service.GetAllCustoms()
  118. this.ServeSuccessJSON(map[string]interface{}{
  119. "list": list,
  120. })
  121. }
  122. func (this *CustomAPIController) DeleteCustom() {
  123. id, _ := this.GetInt64("id")
  124. err := service.DeleteAdmin(id)
  125. if err == nil {
  126. this.ServeSuccessJSON(map[string]interface{}{
  127. "msg": "删除成功",
  128. })
  129. }
  130. }
  131. func (this *CustomAPIController) ModifyCustom() {
  132. id, _ := this.GetInt64("id")
  133. module, _ := this.GetInt64("module")
  134. custom, _ := service.FindCustomInfoByID(id)
  135. switch module {
  136. case 1: //编辑基本信息
  137. name := this.GetString("name")
  138. customType, _ := this.GetInt64("custom_type")
  139. salesperson := this.GetString("salesperson")
  140. signTime := this.GetString("sign_time")
  141. contractPrice := this.GetString("contract_price")
  142. softwarePrice := this.GetString("software_price")
  143. hardwarePrice := this.GetString("hardware_price")
  144. yearCostPrice := this.GetString("year_cost_price")
  145. address := this.GetString("address")
  146. custom.CustomType = customType
  147. custom.Salesperson = salesperson
  148. custom.SignTime = signTime
  149. custom.ContractPrice = contractPrice
  150. custom.SoftwarePrice = softwarePrice
  151. custom.HardwarePrice = hardwarePrice
  152. custom.YearCostPrice = yearCostPrice
  153. custom.Address = address
  154. custom.Name = name
  155. custom.ID = id
  156. custom.Mtime = time.Now().Unix()
  157. err := service.UpdateCustom(custom)
  158. if err != nil {
  159. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  160. return
  161. }
  162. this.ServeSuccessJSON(map[string]interface{}{
  163. "msg": "修改成功",
  164. })
  165. break
  166. case 2: //编辑实施信息
  167. isImplement, _ := this.GetInt64("is_implement")
  168. implementTime := this.GetString("implement_time")
  169. implementPerson := this.GetString("implement_person")
  170. implementRemark := this.GetString("implement_remark")
  171. custom.IsImplement = isImplement
  172. custom.ImplementTime = implementTime
  173. custom.ImplementPerson = implementPerson
  174. custom.ImplementRemark = implementRemark
  175. custom.ID = id
  176. custom.Mtime = time.Now().Unix()
  177. err := service.UpdateCustom(custom)
  178. if err != nil {
  179. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  180. return
  181. }
  182. this.ServeSuccessJSON(map[string]interface{}{
  183. "msg": "修改成功",
  184. })
  185. break
  186. case 3: //编辑LIS对接
  187. lisStatus, _ := this.GetInt64("lis_status")
  188. lisContact := this.GetString("lis_contact")
  189. lisTime := this.GetString("lis_time")
  190. lisRemark := this.GetString("lis_remark")
  191. custom.LisStatus = lisStatus
  192. custom.LisTime = lisTime
  193. custom.LisRemark = lisRemark
  194. custom.LisContact = lisContact
  195. custom.ID = id
  196. custom.Mtime = time.Now().Unix()
  197. err := service.UpdateCustom(custom)
  198. if err != nil {
  199. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  200. return
  201. }
  202. this.ServeSuccessJSON(map[string]interface{}{
  203. "msg": "修改成功",
  204. })
  205. break
  206. case 4: //编辑医保对接
  207. ybStatus, _ := this.GetInt64("yb_status")
  208. ybPerson := this.GetString("yb_person")
  209. ybTime := this.GetString("yb_time")
  210. ybRemark := this.GetString("yb_remark")
  211. custom.YbStatus = ybStatus
  212. custom.YbPerson = ybPerson
  213. custom.YbTime = ybTime
  214. custom.YbRemark = ybRemark
  215. custom.ID = id
  216. custom.Mtime = time.Now().Unix()
  217. err := service.UpdateCustom(custom)
  218. if err != nil {
  219. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  220. return
  221. }
  222. this.ServeSuccessJSON(map[string]interface{}{
  223. "msg": "修改成功",
  224. })
  225. break
  226. case 5: //编辑质控对接
  227. qcStatus, _ := this.GetInt64("qc_status")
  228. qcPerson := this.GetString("qc_person")
  229. qcTime := this.GetString("qc_time")
  230. qcRemark := this.GetString("qc_remark")
  231. custom.QcStatus = qcStatus
  232. custom.QcPerson = qcPerson
  233. custom.QcTime = qcTime
  234. custom.QcRemark = qcRemark
  235. custom.ID = id
  236. custom.Mtime = time.Now().Unix()
  237. err := service.UpdateCustom(custom)
  238. if err != nil {
  239. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  240. return
  241. }
  242. this.ServeSuccessJSON(map[string]interface{}{
  243. "msg": "修改成功",
  244. })
  245. break
  246. case 6: //编辑备注
  247. remark := this.GetString("remark")
  248. custom.Remark = remark
  249. custom.ID = id
  250. custom.Mtime = time.Now().Unix()
  251. err := service.UpdateCustom(custom)
  252. if err != nil {
  253. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  254. return
  255. }
  256. this.ServeSuccessJSON(map[string]interface{}{
  257. "msg": "修改成功",
  258. })
  259. break
  260. case 7: //编辑硬件信息
  261. weightScaleStatus, _ := this.GetInt64("weight_scale_status")
  262. weightScaleBrand := this.GetString("weight_scale_brand")
  263. weightScaleRemark := this.GetString("weight_scale_remark")
  264. sphygmomanometerStatus, _ := this.GetInt64("sphygmomanometer_status")
  265. sphygmomanometerBrand := this.GetString("sphygmomanometer_brand")
  266. sphygmomanometerRemark := this.GetString("sphygmomanometer_remark")
  267. scannerStatus, _ := this.GetInt64("scanner_status")
  268. scannerBrand := this.GetString("scanner_brand")
  269. scannerRemark := this.GetString("scanner_remark")
  270. facialRecognitionDeviceStatus, _ := this.GetInt64("facial_recognition_device_status")
  271. facialRecognitionDeviceBrand := this.GetString("facial_recognition_device_brand")
  272. facialRecognitionDeviceRemark := this.GetString("facial_recognition_device_remark")
  273. printerStatus, _ := this.GetInt64("printer_status")
  274. printerBrand := this.GetString("printer_brand")
  275. printerRemark := this.GetString("printer_remark")
  276. hardwareRemark := this.GetString("hardware_remark")
  277. custom.WeightScaleStatus = weightScaleStatus
  278. custom.WeightScaleBrand = weightScaleBrand
  279. custom.WeightScaleRemark = weightScaleRemark
  280. custom.SphygmomanometerStatus = sphygmomanometerStatus
  281. custom.SphygmomanometerBrand = sphygmomanometerBrand
  282. custom.SphygmomanometerRemark = sphygmomanometerRemark
  283. custom.ScannerStatus = scannerStatus
  284. custom.ScannerBrand = scannerBrand
  285. custom.ScannerRemark = scannerRemark
  286. custom.FacialRecognitionDeviceStatus = facialRecognitionDeviceStatus
  287. custom.FacialRecognitionDeviceBrand = facialRecognitionDeviceBrand
  288. custom.FacialRecognitionDeviceRemark = facialRecognitionDeviceRemark
  289. custom.PrinterStatus = printerStatus
  290. custom.PrinterBrand = printerBrand
  291. custom.PrinterRemark = printerRemark
  292. custom.HardwareRemark = hardwareRemark
  293. custom.ID = id
  294. custom.Mtime = time.Now().Unix()
  295. err := service.UpdateCustom(custom)
  296. if err != nil {
  297. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  298. return
  299. }
  300. this.ServeSuccessJSON(map[string]interface{}{
  301. "msg": "修改成功",
  302. })
  303. break
  304. }
  305. }
  306. func (this *CustomAPIController) GetCustom() {
  307. id, _ := this.GetInt64("id")
  308. custom, _ := service.FindCustomInfoByID(id)
  309. if custom.ID == 0 {
  310. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  311. return
  312. }
  313. this.ServeSuccessJSON(map[string]interface{}{
  314. "custom": custom,
  315. })
  316. }
  317. func (this *CustomAPIController) CreatePaymentCollection() {
  318. customID, _ := this.GetInt64("custom_id")
  319. customName := this.GetString("custom_name")
  320. paymentCollectionType, _ := this.GetInt64("payment_collection_type")
  321. paymentCollectionSumAmt := this.GetString("payment_collection_sumamt")
  322. softwareSumAmt := this.GetString("software_sumamt")
  323. hardwareSumAmt := this.GetString("hardware_sumamt")
  324. paymentCollectionDate := this.GetString("payment_collection_date")
  325. paymentCollectionRole := this.GetString("payment_collection_role")
  326. url := this.GetString("url")
  327. remark := this.GetString("remark")
  328. ctime := time.Now().Unix()
  329. mtime := time.Now().Unix()
  330. // 创建 KyyChargePaymentCollection 对象,并设置每个字段的值
  331. paymentCollection := models.KyyChargePaymentCollection{
  332. CustomId: customID,
  333. CustomName: customName,
  334. PaymentCollectionType: paymentCollectionType,
  335. PaymentCollectionSumamt: paymentCollectionSumAmt,
  336. SoftwareSumamt: softwareSumAmt,
  337. HardwareSumamt: hardwareSumAmt,
  338. PaymentCollectionDate: paymentCollectionDate,
  339. PaymentCollectionRole: paymentCollectionRole,
  340. Url: url,
  341. Remark: remark,
  342. Ctime: ctime,
  343. Mtime: mtime,
  344. Creator: 0,
  345. Modifier: 0,
  346. Status: 1,
  347. }
  348. err := service.CreateChargePaymentCollection(&paymentCollection)
  349. if err != nil {
  350. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  351. return
  352. }
  353. this.ServeSuccessJSON(map[string]interface{}{
  354. "paymentCollection": paymentCollection,
  355. })
  356. }
  357. func (this *CustomAPIController) GetPaymentCollectionList() {
  358. list, _ := service.GetAllPaymentCollections()
  359. this.ServeSuccessJSON(map[string]interface{}{
  360. "list": list,
  361. })
  362. }
  363. func (this *CustomAPIController) GetPaymentCollection() {
  364. id, _ := this.GetInt64("id")
  365. pc, _ := service.FindPaymentCollectionInfo(id)
  366. if pc.ID == 0 {
  367. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  368. return
  369. }
  370. this.ServeSuccessJSON(map[string]interface{}{
  371. "pc": pc,
  372. })
  373. }
  374. func (this *CustomAPIController) EditPaymentCollection() {
  375. id, _ := this.GetInt64("id")
  376. paymentCollectionType, _ := this.GetInt64("payment_collection_type")
  377. paymentCollectionSumAmt := this.GetString("payment_collection_sumamt")
  378. softwareSumAmt := this.GetString("software_sumamt")
  379. hardwareSumAmt := this.GetString("hardware_sumamt")
  380. paymentCollectionDate := this.GetString("payment_collection_date")
  381. paymentCollectionRole := this.GetString("payment_collection_role")
  382. url := this.GetString("url")
  383. remark := this.GetString("remark")
  384. mtime := time.Now().Unix()
  385. cpc, _ := service.FindPaymentCollectionInfo(id)
  386. if cpc.ID == 0 {
  387. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  388. return
  389. }
  390. cpc.PaymentCollectionType = paymentCollectionType
  391. cpc.PaymentCollectionSumamt = paymentCollectionSumAmt
  392. cpc.SoftwareSumamt = softwareSumAmt
  393. cpc.HardwareSumamt = hardwareSumAmt
  394. cpc.PaymentCollectionDate = paymentCollectionDate
  395. cpc.PaymentCollectionRole = paymentCollectionRole
  396. cpc.Url = url
  397. cpc.Remark = remark
  398. cpc.Mtime = mtime
  399. err := service.CreateChargePaymentCollection(&cpc)
  400. if err != nil {
  401. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  402. return
  403. }
  404. this.ServeSuccessJSON(map[string]interface{}{
  405. "cpc": cpc,
  406. })
  407. }
  408. func (this *CustomAPIController) DeletePaymentCollection() {
  409. id, _ := this.GetInt64("id")
  410. cpc, _ := service.FindPaymentCollectionInfo(id)
  411. if cpc.ID == 0 {
  412. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  413. return
  414. }
  415. cpc.Status = 0
  416. err := service.SaveChargePaymentCollection(&cpc)
  417. if err != nil {
  418. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  419. return
  420. }
  421. this.ServeSuccessJSON(map[string]interface{}{
  422. "msg": "删除成功",
  423. })
  424. }
  425. func (this *CustomAPIController) CheckPaymentCollection() {
  426. id, _ := this.GetInt64("id")
  427. cpc, _ := service.FindPaymentCollectionInfo(id)
  428. if cpc.ID == 0 {
  429. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  430. return
  431. }
  432. cpc.IsCheck = 1
  433. err := service.SaveChargePaymentCollection(&cpc)
  434. if err != nil {
  435. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  436. return
  437. }
  438. this.ServeSuccessJSON(map[string]interface{}{
  439. "msg": "审核成功",
  440. })
  441. }
  442. func (this *CustomAPIController) CreateContactInfo() {
  443. customID, _ := this.GetInt64("custom_id")
  444. contactName := this.GetString("contact_name")
  445. contactPhone := this.GetString("contact_phone")
  446. contactDuties := this.GetString("contact_duties")
  447. isDecision := this.GetString("is_decision")
  448. remark := this.GetString("remark")
  449. contact_way := this.GetString("contact_way")
  450. ctime := time.Now().Unix()
  451. mtime := time.Now().Unix()
  452. // 创建 KyyChargeContact 对象,并设置每个字段的值
  453. contact := models.KyyChargeContact{
  454. ID: 0,
  455. CustomId: customID,
  456. ContactName: contactName,
  457. ContactPhone: contactPhone,
  458. ContactDuties: contactDuties,
  459. IsDecision: isDecision,
  460. Remark: remark,
  461. Ctime: ctime,
  462. Mtime: mtime,
  463. Status: 1,
  464. Creator: 0,
  465. Modifier: 0,
  466. IsCheck: 0,
  467. ContactWay: contact_way,
  468. }
  469. err := service.SaveChargeContact(&contact)
  470. if err != nil {
  471. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  472. return
  473. }
  474. this.ServeSuccessJSON(map[string]interface{}{
  475. "contact": contact,
  476. })
  477. }
  478. func (this *CustomAPIController) GetContactInfoList() {
  479. list, _ := service.GetAllChargeContacts()
  480. this.ServeSuccessJSON(map[string]interface{}{
  481. "list": list,
  482. })
  483. }
  484. func (this *CustomAPIController) GetContactInfo() {
  485. id, _ := this.GetInt64("id")
  486. cc, _ := service.FindChargeContactInfo(id)
  487. if cc.ID == 0 {
  488. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  489. return
  490. }
  491. this.ServeSuccessJSON(map[string]interface{}{
  492. "contact_info": cc,
  493. })
  494. }
  495. func (this *CustomAPIController) EditContactInfo() {
  496. id, _ := this.GetInt64("id")
  497. contactName := this.GetString("contact_name")
  498. contactPhone := this.GetString("contact_phone")
  499. contactDuties := this.GetString("contact_duties")
  500. isDecision := this.GetString("is_decision")
  501. remark := this.GetString("remark")
  502. mtime := time.Now().Unix()
  503. chargeContact, _ := service.FindChargeContactInfo(id)
  504. if chargeContact.ID == 0 {
  505. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  506. return
  507. }
  508. chargeContact.ContactName = contactName
  509. chargeContact.ContactPhone = contactPhone
  510. chargeContact.ContactDuties = contactDuties
  511. chargeContact.IsDecision = isDecision
  512. chargeContact.Remark = remark
  513. chargeContact.Remark = remark
  514. chargeContact.Mtime = mtime
  515. err := service.SaveChargeContact(&chargeContact)
  516. if err != nil {
  517. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  518. return
  519. }
  520. this.ServeSuccessJSON(map[string]interface{}{
  521. "contact": chargeContact,
  522. })
  523. }
  524. func (this *CustomAPIController) DeleteContactInfo() {
  525. id, _ := this.GetInt64("id")
  526. cc, _ := service.FindChargeContactInfo(id)
  527. if cc.ID == 0 {
  528. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  529. return
  530. }
  531. cc.Status = 0
  532. err := service.SaveChargeContact(&cc)
  533. if err != nil {
  534. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  535. return
  536. }
  537. this.ServeSuccessJSON(map[string]interface{}{
  538. "msg": "删除成功",
  539. })
  540. }
  541. func (this *CustomAPIController) CheckContactInfo() {
  542. id, _ := this.GetInt64("id")
  543. chargeContact, _ := service.FindChargeContactInfo(id)
  544. if chargeContact.ID == 0 {
  545. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  546. return
  547. }
  548. chargeContact.IsCheck = 1
  549. err := service.SaveChargeContact(&chargeContact)
  550. if err != nil {
  551. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  552. return
  553. }
  554. this.ServeSuccessJSON(map[string]interface{}{
  555. "msg": "审核成功",
  556. })
  557. }
  558. func (this *CustomAPIController) CreateContractInfo() {
  559. customID, _ := this.GetInt64("custom_id")
  560. code := this.GetString("code")
  561. name := this.GetString("name")
  562. sumamt := this.GetString("sumamt")
  563. start_time := this.GetString("start_time")
  564. end_time := this.GetString("end_time")
  565. signing_person := this.GetString("signing_person")
  566. wordFileURL := this.GetString("word_file_url")
  567. pdfFileURL := this.GetString("pdf_file_url")
  568. remark := this.GetString("remark")
  569. ctime := time.Now().Unix()
  570. mtime := time.Now().Unix()
  571. // 创建 KyyChargeContract 对象,并设置每个字段的值
  572. contract := models.KyyChargeContract{
  573. CustomId: customID,
  574. Code: code,
  575. Name: name,
  576. Sumamt: sumamt,
  577. StartTime: start_time,
  578. EndTime: end_time,
  579. SigningPerson: signing_person,
  580. WordFileUrl: wordFileURL,
  581. PdfFileUrl: pdfFileURL,
  582. Remark: remark,
  583. Ctime: ctime,
  584. Mtime: mtime,
  585. }
  586. err := service.SaveChargeContract(&contract)
  587. if err != nil {
  588. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  589. return
  590. }
  591. this.ServeSuccessJSON(map[string]interface{}{
  592. "msg": "创建成功",
  593. })
  594. }
  595. func (this *CustomAPIController) GetContractInfoList() {
  596. list, _ := service.GetAllChargeContracts()
  597. this.ServeSuccessJSON(map[string]interface{}{
  598. "list": list,
  599. })
  600. }
  601. func (this *CustomAPIController) GetContractInfo() {
  602. id, _ := this.GetInt64("id")
  603. cc, _ := service.FindChargeContractInfo(id)
  604. if cc.ID == 0 {
  605. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  606. return
  607. }
  608. this.ServeSuccessJSON(map[string]interface{}{
  609. "charge_contract": cc,
  610. })
  611. }
  612. func (this *CustomAPIController) EditContractInfo() {
  613. id, _ := this.GetInt64("id")
  614. code := this.GetString("code")
  615. name := this.GetString("name")
  616. customName := this.GetString("custom_name")
  617. sumamt := this.GetString("sumamt")
  618. startTime := this.GetString("start_time")
  619. endTime := this.GetString("end_time")
  620. signingPerson := this.GetString("signing_person")
  621. wordFileURL := this.GetString("word_file_url")
  622. pdfFileURL := this.GetString("pdf_file_url")
  623. remark := this.GetString("remark")
  624. mtime := time.Now().Unix()
  625. chargeContract, _ := service.FindChargeContractInfo(id)
  626. if chargeContract.ID == 0 {
  627. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  628. return
  629. }
  630. chargeContract.Code = code
  631. chargeContract.Name = name
  632. chargeContract.CustomName = customName
  633. chargeContract.Sumamt = sumamt
  634. chargeContract.StartTime = startTime
  635. chargeContract.EndTime = endTime
  636. chargeContract.SigningPerson = signingPerson
  637. chargeContract.WordFileUrl = wordFileURL
  638. chargeContract.PdfFileUrl = pdfFileURL
  639. chargeContract.Remark = remark
  640. chargeContract.Mtime = mtime
  641. err := service.SaveChargeContract(&chargeContract)
  642. if err != nil {
  643. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  644. return
  645. }
  646. this.ServeSuccessJSON(map[string]interface{}{
  647. "msg": "修改成功",
  648. })
  649. }
  650. func (this *CustomAPIController) DeleteContractInfo() {
  651. id, _ := this.GetInt64("id")
  652. cc, _ := service.FindChargeContractInfo(id)
  653. if cc.ID == 0 {
  654. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  655. return
  656. }
  657. cc.Status = 0
  658. err := service.SaveChargeContract(&cc)
  659. if err != nil {
  660. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  661. return
  662. }
  663. this.ServeSuccessJSON(map[string]interface{}{
  664. "msg": "删除成功",
  665. })
  666. }
  667. func (this *CustomAPIController) CheckContractInfo() {
  668. id, _ := this.GetInt64("id")
  669. chargeContract, _ := service.FindChargeContractInfo(id)
  670. if chargeContract.ID == 0 {
  671. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  672. return
  673. }
  674. chargeContract.IsCheck = 1
  675. err := service.SaveChargeContract(&chargeContract)
  676. if err != nil {
  677. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  678. return
  679. }
  680. this.ServeSuccessJSON(map[string]interface{}{
  681. "msg": "审核成功",
  682. })
  683. }
  684. func (this *CustomAPIController) CreateFollowInfo() {
  685. ctime := time.Now().Unix()
  686. mtime := time.Now().Unix()
  687. customID, _ := this.GetInt64("custom_id")
  688. desc := this.GetString("desc")
  689. // 创建 KyyChargeFollow 对象,并设置每个字段的值
  690. follow := models.KyyChargeFollow{
  691. Ctime: ctime,
  692. Mtime: mtime,
  693. Creator: this.GetAdminInfo().ID,
  694. CustomId: customID,
  695. Desc: desc,
  696. Status: 1,
  697. }
  698. err := service.SaveChargeFollow(&follow)
  699. if err != nil {
  700. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  701. return
  702. }
  703. this.ServeSuccessJSON(map[string]interface{}{
  704. "follow": follow,
  705. })
  706. }
  707. func (this *CustomAPIController) GetFollowInfoList() {
  708. list, _ := service.GetAllChargeFollow()
  709. this.ServeSuccessJSON(map[string]interface{}{
  710. "list": list,
  711. })
  712. }
  713. func (this *CustomAPIController) GetFollowInfo() {
  714. id, _ := this.GetInt64("id")
  715. follow, _ := service.FindChargeFollowInfo(id)
  716. if follow.ID == 0 {
  717. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  718. return
  719. }
  720. this.ServeSuccessJSON(map[string]interface{}{
  721. "follow": follow,
  722. })
  723. }
  724. func (this *CustomAPIController) EditFollowInfo() {
  725. id, _ := this.GetInt64("id")
  726. desc := this.GetString("desc")
  727. chargeFollow, _ := service.FindChargeFollowInfo(id)
  728. chargeFollow.Desc = desc
  729. chargeFollow.Mtime = time.Now().Unix()
  730. err := service.SaveChargeFollow(&chargeFollow)
  731. if err != nil {
  732. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  733. return
  734. }
  735. this.ServeSuccessJSON(map[string]interface{}{
  736. "follow": chargeFollow,
  737. })
  738. }
  739. func (this *CustomAPIController) DeleteFollowInfo() {
  740. id, _ := this.GetInt64("id")
  741. follow, _ := service.FindChargeFollowInfo(id)
  742. if follow.ID == 0 {
  743. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  744. return
  745. }
  746. follow.Status = 0
  747. err := service.SaveChargeFollow(&follow)
  748. if err != nil {
  749. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  750. return
  751. }
  752. this.ServeSuccessJSON(map[string]interface{}{
  753. "msg": "删除成功",
  754. })
  755. }
  756. func (this *CustomAPIController) CheckFollowInfo() {
  757. id, _ := this.GetInt64("id")
  758. follow, _ := service.FindChargeFollowInfo(id)
  759. if follow.ID == 0 {
  760. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  761. return
  762. }
  763. follow.IsCheck = 1
  764. err := service.SaveChargeFollow(&follow)
  765. if err != nil {
  766. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  767. return
  768. }
  769. this.ServeSuccessJSON(map[string]interface{}{
  770. "msg": "审核成功",
  771. })
  772. }
  773. func (this *CustomAPIController) CreateDemandInfo() {
  774. demandType, _ := this.GetInt64("demand_type")
  775. demandDesc := this.GetString("demand_desc")
  776. demandStatus, _ := this.GetInt64("demand_status")
  777. demandCreator := this.GetString("demand_creator")
  778. demandCreateDate := this.GetString("demand_create_date")
  779. demandDirector := this.GetString("demand_director")
  780. ctime := time.Now().Unix()
  781. mtime := time.Now().Unix()
  782. customID, _ := this.GetInt64("custom_id")
  783. demandFinishDate := this.GetString("demand_finish_date")
  784. demandDetail := this.GetString("demand_detail")
  785. // 创建 KyyChargeDemand 对象,并设置每个字段的值
  786. demand := models.KyyChargeDemand{
  787. DemandType: demandType,
  788. DemandDesc: demandDesc,
  789. DemandStatus: demandStatus,
  790. DemandCreator: demandCreator,
  791. DemandCreateDate: demandCreateDate,
  792. DemandDirector: demandDirector,
  793. Ctime: ctime,
  794. Mtime: mtime,
  795. Status: 1,
  796. CustomId: customID,
  797. DemandFinishDate: demandFinishDate,
  798. DemandDetail: demandDetail,
  799. }
  800. err := service.SaveChargeDemand(&demand)
  801. if err != nil {
  802. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  803. return
  804. }
  805. this.ServeSuccessJSON(map[string]interface{}{
  806. "demand": demand,
  807. })
  808. }
  809. func (this *CustomAPIController) GetDemandInfoList() {
  810. list, _ := service.GetAllChargeDemand()
  811. this.ServeSuccessJSON(map[string]interface{}{
  812. "list": list,
  813. })
  814. }
  815. func (this *CustomAPIController) GetDemandInfo() {
  816. id, _ := this.GetInt64("id")
  817. cd, _ := service.FindChargeDemandInfo(id)
  818. if cd.ID == 0 {
  819. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  820. return
  821. }
  822. this.ServeSuccessJSON(map[string]interface{}{
  823. "charge_demand": cd,
  824. })
  825. }
  826. func (this *CustomAPIController) EditDemandInfo() {
  827. id, _ := this.GetInt64("id")
  828. demandType, _ := this.GetInt64("demand_type")
  829. demandDesc := this.GetString("demand_desc")
  830. demandStatus, _ := this.GetInt64("demand_status")
  831. demandCreator := this.GetString("demand_creator")
  832. demandCreateDate := this.GetString("demand_create_date")
  833. demandDirector := this.GetString("demand_director")
  834. cd, _ := service.FindChargeDemandInfo(id)
  835. cd.DemandType = demandType
  836. cd.DemandDesc = demandDesc
  837. cd.DemandStatus = demandStatus
  838. cd.DemandCreator = demandCreator
  839. cd.DemandCreateDate = demandCreateDate
  840. cd.DemandDirector = demandDirector
  841. cd.Mtime = time.Now().Unix()
  842. err := service.SaveChargeDemand(&cd)
  843. if err != nil {
  844. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  845. return
  846. }
  847. this.ServeSuccessJSON(map[string]interface{}{
  848. "demand": cd,
  849. })
  850. }
  851. func (this *CustomAPIController) DeleteDemandInfo() {
  852. id, _ := this.GetInt64("id")
  853. cd, _ := service.FindChargeDemandInfo(id)
  854. if cd.ID == 0 {
  855. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  856. return
  857. }
  858. cd.Status = 0
  859. err := service.SaveChargeDemand(&cd)
  860. if err != nil {
  861. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  862. return
  863. }
  864. this.ServeSuccessJSON(map[string]interface{}{
  865. "msg": "删除成功",
  866. })
  867. }
  868. func (this *CustomAPIController) CheckDemandInfo() {
  869. id, _ := this.GetInt64("id")
  870. cd, _ := service.FindChargeDemandInfo(id)
  871. if cd.ID == 0 {
  872. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  873. return
  874. }
  875. cd.IsCheck = 1
  876. err := service.SaveChargeDemand(&cd)
  877. if err != nil {
  878. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  879. return
  880. }
  881. this.ServeSuccessJSON(map[string]interface{}{
  882. "msg": "审核成功",
  883. })
  884. }
  885. func (this *CustomAPIController) CreateRenewalInfo() {
  886. types, _ := this.GetInt64("type")
  887. startTime := this.GetString("start_time")
  888. endTime := this.GetString("end_time")
  889. signingPersonal := this.GetString("signing_personal")
  890. customID, _ := this.GetInt64("custom_id")
  891. signTime := this.GetString("sign_time")
  892. checkPersonal := this.GetString("check_personal")
  893. ctime := time.Now().Format("2006-01-02 15:04:05") // 使用当前时间
  894. mtime := time.Now().Format("2006-01-02 15:04:05") // 使用当前时间
  895. remark := this.GetString("remark")
  896. // 创建 KyyChargeRenewal 对象,并设置每个字段的值
  897. renewal := models.KyyChargeRenewal{
  898. Type: types,
  899. StartTime: startTime,
  900. EndTime: endTime,
  901. SigningPersonal: signingPersonal,
  902. CustomId: customID,
  903. SignTime: signTime,
  904. CheckPersonal: checkPersonal,
  905. Ctime: ctime,
  906. Mtime: mtime,
  907. Status: 1,
  908. Remark: remark,
  909. }
  910. err := service.SaveChargeRenewal(&renewal)
  911. if err != nil {
  912. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  913. return
  914. }
  915. this.ServeSuccessJSON(map[string]interface{}{
  916. "renewal": renewal,
  917. })
  918. }
  919. func (this *CustomAPIController) GetRenewalInfoList() {
  920. list, _ := service.GetAllChargeRenewal()
  921. this.ServeSuccessJSON(map[string]interface{}{
  922. "list": list,
  923. })
  924. }
  925. func (this *CustomAPIController) GetRenewalInfo() {
  926. id, _ := this.GetInt64("id")
  927. cr, _ := service.FindChargeRenewalInfo(id)
  928. if cr.ID == 0 {
  929. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  930. return
  931. }
  932. this.ServeSuccessJSON(map[string]interface{}{
  933. "charge_renewal": cr,
  934. })
  935. }
  936. func (this *CustomAPIController) EditRenewalInfo() {
  937. types, _ := this.GetInt64("type")
  938. id, _ := this.GetInt64("id")
  939. startTime := this.GetString("start_time")
  940. endTime := this.GetString("end_time")
  941. signingPersonal := this.GetString("signing_personal")
  942. customID, _ := this.GetInt64("custom_id")
  943. signTime := this.GetString("sign_time")
  944. remark := this.GetString("remark")
  945. checkPersonal := this.GetString("check_personal")
  946. mtime := time.Now().Format("2006-01-02 15:04:05") // 使用当前时间
  947. cr, _ := service.FindChargeRenewalInfo(id)
  948. if cr.ID == 0 {
  949. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  950. return
  951. }
  952. cr.Type = types
  953. cr.CustomId = customID
  954. cr.StartTime = startTime
  955. cr.EndTime = endTime
  956. cr.SigningPersonal = signingPersonal
  957. cr.SignTime = signTime
  958. cr.Mtime = mtime
  959. cr.Remark = remark
  960. cr.CheckPersonal = checkPersonal
  961. err := service.SaveChargeRenewal(&cr)
  962. if err != nil {
  963. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  964. return
  965. }
  966. this.ServeSuccessJSON(map[string]interface{}{
  967. "cr": cr,
  968. })
  969. }
  970. func (this *CustomAPIController) DeleteRenewalInfo() {
  971. id, _ := this.GetInt64("id")
  972. cr, _ := service.FindChargeRenewalInfo(id)
  973. if cr.ID == 0 {
  974. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  975. return
  976. }
  977. cr.Status = 0
  978. err := service.SaveChargeRenewal(&cr)
  979. if err != nil {
  980. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  981. return
  982. }
  983. this.ServeSuccessJSON(map[string]interface{}{
  984. "msg": "删除成功",
  985. })
  986. }
  987. func (this *CustomAPIController) CheckRenewalInfo() {
  988. id, _ := this.GetInt64("id")
  989. cr, _ := service.FindChargeRenewalInfo(id)
  990. if cr.ID == 0 {
  991. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  992. return
  993. }
  994. cr.IsCheck = 1
  995. err := service.SaveChargeRenewal(&cr)
  996. if err != nil {
  997. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  998. return
  999. }
  1000. this.ServeSuccessJSON(map[string]interface{}{
  1001. "msg": "审核成功",
  1002. })
  1003. }