作者 陈志颖

fix:空现金池时更新兑换活动

@@ -386,3 +386,160 @@ @@ -386,3 +386,160 @@
386 } 386 }
387 2020/11/24 10:14:53.298 [D] [server.go:2843] <====Send RequestId:POST./statistics/employees-ranking-list.1606184093080911000 BodyData:{"code":0,"data":{"currentEmployeeContributions":{"Uid":3259769336137728,"EmployeeName":"杨志","EmployeesContributions":7232,"Ranking":3},"currentEmployeeWealth":{"Uid":3259769336137728,"EmployeeName":"杨志","EmployeeSuMoney":7032,"Ranking":3},"employeesContributions":[{"Uid":3259769335767040,"EmployeeName":"朱武","EmployeesContributions":88100,"Ranking":1},{"Uid":3259769336174592,"EmployeeName":"索超","EmployeesContributions":26217.3,"Ranking":2},{"Uid":3259769336137728,"EmployeeName":"杨志","EmployeesContributions":7232,"Ranking":3},{"Uid":3259769336070144,"EmployeeName":"杜迁","EmployeesContributions":3635,"Ranking":4},{"Uid":3259769336037376,"EmployeeName":"朱贵2","EmployeesContributions":3325,"Ranking":5},{"Uid":3259769336137728,"EmployeeName":"杨志358","EmployeesContributions":3309.8,"Ranking":6},{"Uid":3288265494991872,"EmployeeName":"李四","EmployeesContributions":10.5,"Ranking":7},{"Uid":3259769336317952,"EmployeeName":"陈达","EmployeesContributions":0,"Ran 387 2020/11/24 10:14:53.298 [D] [server.go:2843] <====Send RequestId:POST./statistics/employees-ranking-list.1606184093080911000 BodyData:{"code":0,"data":{"currentEmployeeContributions":{"Uid":3259769336137728,"EmployeeName":"杨志","EmployeesContributions":7232,"Ranking":3},"currentEmployeeWealth":{"Uid":3259769336137728,"EmployeeName":"杨志","EmployeeSuMoney":7032,"Ranking":3},"employeesContributions":[{"Uid":3259769335767040,"EmployeeName":"朱武","EmployeesContributions":88100,"Ranking":1},{"Uid":3259769336174592,"EmployeeName":"索超","EmployeesContributions":26217.3,"Ranking":2},{"Uid":3259769336137728,"EmployeeName":"杨志","EmployeesContributions":7232,"Ranking":3},{"Uid":3259769336070144,"EmployeeName":"杜迁","EmployeesContributions":3635,"Ranking":4},{"Uid":3259769336037376,"EmployeeName":"朱贵2","EmployeesContributions":3325,"Ranking":5},{"Uid":3259769336137728,"EmployeeName":"杨志358","EmployeesContributions":3309.8,"Ranking":6},{"Uid":3288265494991872,"EmployeeName":"李四","EmployeesContributions":10.5,"Ranking":7},{"Uid":3259769336317952,"EmployeeName":"陈达","EmployeesContributions":0,"Ran
388 2020/11/24 10:14:53.298 [D] [server.go:1925] | 127.0.0.1| 200 | 218.323689ms| match| POST  /statistics/employees-ranking-list r:/statistics/employees-ranking-list 388 2020/11/24 10:14:53.298 [D] [server.go:1925] | 127.0.0.1| 200 | 218.323689ms| match| POST  /statistics/employees-ranking-list r:/statistics/employees-ranking-list
  389 +2020/11/24 11:46:17.200 [I] [???:0] http server Running on http://:8082
  390 +2020/11/24 11:48:10.830 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606189690830647000
  391 + Auth=
  392 + BodyData:{
  393 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  394 + "deadline": "2020-11-20T21:44:27.822562+08:00",
  395 + "exchangeRate": 1.1
  396 +}
  397 +2020/11/24 11:48:11.579 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606189690830647000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-20T23:59:59+08:00","countDown":0,"rate":1.1,"createTime":"2020-11-23T11:08:23.237467+08:00"},"msg":"ok"}
  398 +2020/11/24 11:48:11.579 [D] [server.go:1925] | 127.0.0.1| 200 | 749.528378ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  399 +2020/11/24 11:48:50.658 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606189730658567000
  400 + Auth=
  401 + BodyData:{
  402 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  403 + "deadline": "2020-11-20T21:44:27.822562+08:00",
  404 + "exchangeRate": 1.1
  405 +}
  406 +2020/11/24 11:48:50.732 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606189730658567000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-20T21:44:27.822562+08:00","countDown":0,"rate":1.1,"createTime":"2020-11-23T11:08:23.237467+08:00"},"msg":"ok"}
  407 +2020/11/24 11:48:50.732 [D] [server.go:1925] | 127.0.0.1| 200 | 74.453429ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  408 +2020/11/24 11:49:00.247 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606189740247618000
  409 + Auth=
  410 + BodyData:{
  411 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  412 + "deadline": "2020-11-20T21:44:27.822562+08:00",
  413 + "exchangeRate": 1.1
  414 +}
  415 +2020/11/24 11:49:00.369 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606189740247618000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-20T21:44:27.822562+08:00","countDown":0,"rate":1.1,"createTime":"2020-11-23T11:08:23.237467+08:00"},"msg":"ok"}
  416 +2020/11/24 11:49:00.369 [D] [server.go:1925] | 127.0.0.1| 200 | 122.011188ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  417 +2020/11/24 11:49:01.642 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606189741642713000
  418 + Auth=
  419 + BodyData:{
  420 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  421 + "deadline": "2020-11-20T21:44:27.822562+08:00",
  422 + "exchangeRate": 1.1
  423 +}
  424 +2020/11/24 11:49:01.757 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606189741642713000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-20T21:44:27.822562+08:00","countDown":0,"rate":1.1,"createTime":"2020-11-23T11:08:23.237467+08:00"},"msg":"ok"}
  425 +2020/11/24 11:49:01.757 [D] [server.go:1925] | 127.0.0.1| 200 | 114.891328ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  426 +2020/11/24 11:49:02.715 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606189742715009000
  427 + Auth=
  428 + BodyData:{
  429 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  430 + "deadline": "2020-11-20T21:44:27.822562+08:00",
  431 + "exchangeRate": 1.1
  432 +}
  433 +2020/11/24 11:49:02.722 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606189742715009000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-20T21:44:27.822562+08:00","countDown":0,"rate":1.1,"createTime":"2020-11-23T11:08:23.237467+08:00"},"msg":"ok"}
  434 +2020/11/24 11:49:02.723 [D] [server.go:1925] | 127.0.0.1| 200 | 8.145799ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  435 +2020/11/24 11:49:03.784 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606189743784065000
  436 + Auth=
  437 + BodyData:{
  438 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  439 + "deadline": "2020-11-20T21:44:27.822562+08:00",
  440 + "exchangeRate": 1.1
  441 +}
  442 +2020/11/24 11:49:03.798 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606189743784065000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-20T21:44:27.822562+08:00","countDown":0,"rate":1.1,"createTime":"2020-11-23T11:08:23.237467+08:00"},"msg":"ok"}
  443 +2020/11/24 11:49:03.798 [D] [server.go:1925] | 127.0.0.1| 200 | 14.245609ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  444 +2020/11/24 11:49:11.859 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606189751859860000
  445 + Auth=
  446 + BodyData:{
  447 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  448 + "deadline": "2020-11-21T21:44:27.822562+08:00",
  449 + "exchangeRate": 1.1
  450 +}
  451 +2020/11/24 11:49:11.940 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606189751859860000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-21T21:44:27.822562+08:00","countDown":0,"rate":1.1,"createTime":"2020-11-23T11:08:23.237467+08:00"},"msg":"ok"}
  452 +2020/11/24 11:49:11.940 [D] [server.go:1925] | 127.0.0.1| 200 | 80.663504ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  453 +2020/11/24 11:49:28.865 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606189768865023000
  454 + Auth=
  455 + BodyData:{
  456 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  457 + "deadline": "2020-11-21T21:44:27.822562+08:00",
  458 + "exchangeRate": 1.2
  459 +}
  460 +2020/11/24 11:49:28.891 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606189768865023000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-21T21:44:27.822562+08:00","countDown":0,"rate":1.2,"createTime":"2020-11-23T11:08:23.237467+08:00"},"msg":"ok"}
  461 +2020/11/24 11:49:28.891 [D] [server.go:1925] | 127.0.0.1| 200 | 26.924025ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  462 +2020/11/24 11:51:50.769 [I] [???:0] http server Running on http://:8082
  463 +2020/11/24 11:51:57.285 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606189917285531000
  464 + Auth=
  465 + BodyData:{
  466 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  467 + "deadline": "2020-11-21T21:44:27.822562+08:00",
  468 + "exchangeRate": 1.2
  469 +}
  470 +2020/11/24 11:51:57.488 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606189917285531000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-21T21:44:27.822562+08:00","countDown":-2,"rate":1.2,"createTime":"2020-11-23T11:08:23.237467+08:00"},"msg":"ok"}
  471 +2020/11/24 11:51:57.488 [D] [server.go:1925] | 127.0.0.1| 200 | 203.175598ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  472 +2020/11/24 11:51:59.160 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606189919160786000
  473 + Auth=
  474 + BodyData:{
  475 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  476 + "deadline": "2020-11-21T21:44:27.822562+08:00",
  477 + "exchangeRate": 1.2
  478 +}
  479 +2020/11/24 11:51:59.219 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606189919160786000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-21T21:44:27.822562+08:00","countDown":-2,"rate":1.2,"createTime":"2020-11-23T11:08:23.237467+08:00"},"msg":"ok"}
  480 +2020/11/24 11:51:59.219 [D] [server.go:1925] | 127.0.0.1| 200 | 58.445365ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  481 +2020/11/24 11:52:00.251 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606189920251542000
  482 + Auth=
  483 + BodyData:{
  484 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  485 + "deadline": "2020-11-21T21:44:27.822562+08:00",
  486 + "exchangeRate": 1.2
  487 +}
  488 +2020/11/24 11:52:00.389 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606189920251542000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-21T21:44:27.822562+08:00","countDown":-2,"rate":1.2,"createTime":"2020-11-23T11:08:23.237467+08:00"},"msg":"ok"}
  489 +2020/11/24 11:52:00.389 [D] [server.go:1925] | 127.0.0.1| 200 | 137.612313ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  490 +2020/11/24 11:57:38.022 [I] [???:0] http server Running on http://:8082
  491 +2020/11/24 11:57:41.482 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606190261482367000
  492 + Auth=
  493 + BodyData:{
  494 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  495 + "deadline": "2020-11-21T21:44:27.822562+08:00",
  496 + "exchangeRate": 1.2
  497 +}
  498 +2020/11/24 11:57:41.540 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606190261482367000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-21T21:44:27.822562+08:00","countDown":-2,"rate":1.2,"createTime":"2020-11-24T11:57:41.494318+08:00"},"msg":"ok"}
  499 +2020/11/24 11:57:41.540 [D] [server.go:1925] | 127.0.0.1| 200 | 58.670594ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  500 +2020/11/24 11:57:42.687 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606190262687810000
  501 + Auth=
  502 + BodyData:{
  503 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  504 + "deadline": "2020-11-21T21:44:27.822562+08:00",
  505 + "exchangeRate": 1.2
  506 +}
  507 +2020/11/24 11:57:42.720 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606190262687810000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-21T21:44:27.822562+08:00","countDown":-2,"rate":1.2,"createTime":"2020-11-24T11:57:42.714394+08:00"},"msg":"ok"}
  508 +2020/11/24 11:57:42.720 [D] [server.go:1925] | 127.0.0.1| 200 | 32.885047ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  509 +2020/11/24 11:57:53.860 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606190273860478000
  510 + Auth=
  511 + BodyData:{
  512 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  513 + "deadline": "2020-11-25T21:44:27.822562+08:00",
  514 + "exchangeRate": 1.2
  515 +}
  516 +2020/11/24 11:57:53.871 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606190273860478000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-25T21:44:27.822562+08:00","countDown":-2,"rate":1.2,"createTime":"2020-11-24T11:57:53.863293+08:00"},"msg":"ok"}
  517 +2020/11/24 11:57:53.871 [D] [server.go:1925] | 127.0.0.1| 200 | 11.524971ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  518 +2020/11/24 11:58:56.912 [I] [???:0] http server Running on http://:8082
  519 +2020/11/24 11:59:01.987 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606190341987404000
  520 + Auth=
  521 + BodyData:{
  522 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  523 + "deadline": "2020-11-25T21:44:27.822562+08:00",
  524 + "exchangeRate": 1.2
  525 +}
  526 +2020/11/24 11:59:02.027 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606190341987404000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-25T21:44:27.822562+08:00","countDown":2,"rate":1.2,"createTime":"2020-11-24T11:59:02.00598+08:00"},"msg":"ok"}
  527 +2020/11/24 11:59:02.028 [D] [server.go:1925] | 127.0.0.1| 200 | 40.923833ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  528 +2020/11/24 11:59:03.575 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606190343575805000
  529 + Auth=
  530 + BodyData:{
  531 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  532 + "deadline": "2020-11-25T21:44:27.822562+08:00",
  533 + "exchangeRate": 1.2
  534 +}
  535 +2020/11/24 11:59:03.583 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606190343575805000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-25T21:44:27.822562+08:00","countDown":2,"rate":1.2,"createTime":"2020-11-24T11:59:03.582687+08:00"},"msg":"ok"}
  536 +2020/11/24 11:59:03.583 [D] [server.go:1925] | 127.0.0.1| 200 | 8.078491ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
  537 +2020/11/24 11:59:04.435 [D] [server.go:2843] ====>Recv User:<nil> RequestId:PUT./cash-pool/activity/95.1606190344435072000
  538 + Auth=
  539 + BodyData:{
  540 + "exchangeActivityName": "这是更新后的公司358的兑换活动,哈哈哈",
  541 + "deadline": "2020-11-25T21:44:27.822562+08:00",
  542 + "exchangeRate": 1.2
  543 +}
  544 +2020/11/24 11:59:04.439 [D] [server.go:2843] <====Send RequestId:PUT./cash-pool/activity/95.1606190344435072000 BodyData:{"code":0,"data":{"activityId":95,"exchangeActivityName":"这是更新后的公司358的兑换活动,哈哈哈","companyId":358,"exchangedCash":0,"exchangedSuMoney":0,"deadline":"2020-11-25T21:44:27.822562+08:00","countDown":2,"rate":1.2,"createTime":"2020-11-24T11:59:04.4382+08:00"},"msg":"ok"}
  545 +2020/11/24 11:59:04.439 [D] [server.go:1925] | 127.0.0.1| 200 | 4.796071ms| match| PUT  /cash-pool/activity/95 r:/cash-pool/activity/:activityId
@@ -859,8 +859,29 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang @@ -859,8 +859,29 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
859 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 859 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
860 } 860 }
861 if len(cashPoolsFound) == 0 { 861 if len(cashPoolsFound) == 0 {
  862 + var t1 = time.Now().Local()
  863 + var t2 = updateExchangeCashActivityCommand.Deadline.Local()
862 864
863 - return nil, application.ThrowError(application.RES_NO_FIND_ERROR, "当前公司未创建现金池") 865 + updateExchangeCashActivityCommand.CountDown = int64(math.Ceil(t2.Sub(t1).Hours() / 24))
  866 +
  867 + // 更新兑换活动
  868 + if err := activityFound.Update(tool_funs.SimpleStructToMap(updateExchangeCashActivityCommand)); err != nil {
  869 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  870 + }
  871 +
  872 + // 保存兑换活动更新
  873 + if activityUpdated, err := exchangeCashActivityRepository.Save(activityFound); err != nil {
  874 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  875 + } else {
  876 + if err := transactionContext.CommitTransaction(); err != nil {
  877 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  878 + }
  879 + activityUpdated.ExchangedSuMoney, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", activityUpdated.ExchangedSuMoney), 64)
  880 + activityUpdated.ExchangedCash, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", activityUpdated.ExchangedCash), 64)
  881 + activityUpdated.Deadline = activityUpdated.Deadline.Local()
  882 + activityUpdated.CreateTime = activityUpdated.CreateTime.Local()
  883 + return activityUpdated, nil
  884 + }
864 } 885 }
865 886
866 // 获取当前兑换活动汇率 887 // 获取当前兑换活动汇率
@@ -51,7 +51,11 @@ func (exchangeCashActivity *ExchangeCashActivity) Update(data map[string]interfa @@ -51,7 +51,11 @@ func (exchangeCashActivity *ExchangeCashActivity) Update(data map[string]interfa
51 if exchangeRate, ok := data["exchangeRate"]; ok && exchangeRate != 0 { 51 if exchangeRate, ok := data["exchangeRate"]; ok && exchangeRate != 0 {
52 exchangeCashActivity.Rate = exchangeRate.(float64) 52 exchangeCashActivity.Rate = exchangeRate.(float64)
53 } 53 }
54 - return nil 54 + if createTime, ok := data["createTime"]; ok && createTime.(time.Time).IsZero() {
  55 + exchangeCashActivity.CreateTime = createTime.(time.Time)
  56 + }
  57 + exchangeCashActivity.CreateTime = time.Now()
  58 + return nil
55 } 59 }
56 60
57 func (exchangeCashActivity *ExchangeCashActivity) TransferSuMoney(rate float64) error { 61 func (exchangeCashActivity *ExchangeCashActivity) TransferSuMoney(rate float64) error {
@@ -64,3 +64,10 @@ func JsonToMap(jsonStr string) (map[string]string, error) { @@ -64,3 +64,10 @@ func JsonToMap(jsonStr string) (map[string]string, error) {
64 64
65 return m, nil 65 return m, nil
66 } 66 }
  67 +
  68 +func InsertSlice(index int, newstr []string, src []string) (ns []string) {
  69 + ns = append(ns, src[:index]...) // 切片后加..., 相当于拆包成单个元素
  70 + ns = append(ns, newstr...)
  71 + ns = append(ns, src[index:]...)
  72 + return
  73 +}
@@ -6,6 +6,7 @@ import ( @@ -6,6 +6,7 @@ import (
6 "github.com/360EntSecGroup-Skylar/excelize/v2" 6 "github.com/360EntSecGroup-Skylar/excelize/v2"
7 "github.com/astaxie/beego" 7 "github.com/astaxie/beego"
8 "github.com/linmadan/egglib-go/web/beego/utils" 8 "github.com/linmadan/egglib-go/web/beego/utils"
  9 + utils_tool "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/utils"
9 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command" 10 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command"
10 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/query" 11 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/query"
11 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/service" 12 "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/service"
@@ -433,6 +434,7 @@ func (controller *SuMoneyController) ImportExchangeList () { @@ -433,6 +434,7 @@ func (controller *SuMoneyController) ImportExchangeList () {
433 // 文件行数校验 434 // 文件行数校验
434 rows, _ := xlsx.GetRows("Sheet1") 435 rows, _ := xlsx.GetRows("Sheet1")
435 436
  437 + // 表格超行判断
436 if len(rows) > 302 { 438 if len(rows) > 302 {
437 err := fmt.Errorf("%s", "导入行数超过300行") 439 err := fmt.Errorf("%s", "导入行数超过300行")
438 response = utils.ResponseError(controller.Ctx, err) 440 response = utils.ResponseError(controller.Ctx, err)
@@ -441,13 +443,27 @@ func (controller *SuMoneyController) ImportExchangeList () { @@ -441,13 +443,27 @@ func (controller *SuMoneyController) ImportExchangeList () {
441 return 443 return
442 } 444 }
443 445
444 - //空行记录  
445 - nullLine := make([]interface{}, 0) 446 + // 空表格判断
  447 + if len(rows) < 3 {
  448 + err := fmt.Errorf("%s", "当前导入的为空表格")
  449 + response = utils.ResponseError(controller.Ctx, err)
  450 + controller.Data["json"] = response
  451 + controller.ServeJSON()
  452 + return
  453 + }
  454 +
  455 + newstr := []string{"null"}
446 456
447 - // 单元格非空校验 457 + // 空字段判断
  458 + nullLine := make([]interface{}, 0)
448 for i, row := range rows { 459 for i, row := range rows {
449 if i > 2 { 460 if i > 2 {
450 if len(row) != 3 { 461 if len(row) != 3 {
  462 + for j, cell := range row {
  463 + if cell == "" {
  464 + utils_tool.InsertSlice(j, row, newstr)
  465 + }
  466 + }
451 row = append(row, "单元格包含空字符") 467 row = append(row, "单元格包含空字符")
452 nullLine = append(nullLine, row) 468 nullLine = append(nullLine, row)
453 } 469 }
@@ -474,17 +490,12 @@ func (controller *SuMoneyController) ImportExchangeList () { @@ -474,17 +490,12 @@ func (controller *SuMoneyController) ImportExchangeList () {
474 // 新增成功计数 490 // 新增成功计数
475 var successDataCount int64 491 var successDataCount int64
476 492
477 - //fmt.Print(len(rows), "\n")  
478 -  
479 for i, row := range rows { 493 for i, row := range rows {
480 - //fmt.Printf("Row Number:%d, Row: %+v\n, Row Length: %d\n", i, row, len(row))  
481 if i > 2 && len(row) > 1 { 494 if i > 2 && len(row) > 1 {
482 // 创建兑换清单命令 495 // 创建兑换清单命令
483 createExchangeCashPersonCommand := &command.CreateExchangeCashPersonCommand{} 496 createExchangeCashPersonCommand := &command.CreateExchangeCashPersonCommand{}
484 createExchangeCashPersonCommand.ExchangeCashActivityId, _ = strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 ) 497 createExchangeCashPersonCommand.ExchangeCashActivityId, _ = strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 )
485 - //createExchangeCashPersonCommand.ExchangeCashActivityId, _ = strconv.ParseInt(interface{}(importExchangeCashListCommand.Where).(map[string]interface{})["activityId"].(string), 10, 64)  
486 createExchangeCashPersonCommand.Operator = int64(jsonMap["uid"].(float64)) 498 createExchangeCashPersonCommand.Operator = int64(jsonMap["uid"].(float64))
487 - //createExchangeCashPersonCommand.Operator = int64(interface{}(importExchangeCashListCommand.Where).(map[string]interface{})["uid"].(float64))  
488 createExchangeCashPersonCommand.PersonName = row[0] 499 createExchangeCashPersonCommand.PersonName = row[0]
489 createExchangeCashPersonCommand.PersonAccount = row[1] 500 createExchangeCashPersonCommand.PersonAccount = row[1]
490 r2, _ := strconv.ParseFloat(row[2], 64) 501 r2, _ := strconv.ParseFloat(row[2], 64)