作者 陈志颖

合并分支 'dev' 到 'test'

Dev



查看合并请求 !15
... ... @@ -57,11 +57,11 @@ spec:
- name: POSTGRESQL_USER
value: "postgres"
- name: POSTGRESQL_PASSWORD
value: "postgres_55_online"
value: "chJVQkg1sys"
- name: POSTGRESQL_HOST
value: "112.124.115.55"
value: "114.55.200.59"
- name: POSTGRESQL_PORT
value: "15432"
value: "31544"
- name: LOG_LEVEL
value: "debug"
- name: ERROR_BASE_CODE
... ...
... ... @@ -52,7 +52,6 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
... ... @@ -92,7 +91,6 @@ github.com/klauspost/compress v1.8.2 h1:Bx0qjetmNjdFXASH02NSAREKpiaDwkO1DRZ3dV2K
github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w=
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
... ... @@ -137,7 +135,6 @@ github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
github.com/siddontang/ledisdb v0.0.0-20181029004158-becf5f38d373/go.mod h1:mF1DpOSOUiJRMR+FDqaqu3EBqrybQtrDDszLUZ6oxPg=
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
... ... @@ -147,9 +144,7 @@ github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXc
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
... ... @@ -184,7 +179,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf h1:fnPsqIDRbCSgumaMCRpoIoF2s4qxv0xSSS0BVZUE/ss=
golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM=
... ... @@ -206,7 +200,6 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200904194848-62affa334b73 h1:MXfv8rhZWmFeqX3GNZRsd6vOLoaCHjYEX3qkRo3YBUA=
golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
... ... @@ -221,17 +214,13 @@ golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY=
golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e h1:AyodaIpKjppX+cBfTASF2E1US3H2JFBj920Ot3rtDjs=
golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
... ... @@ -242,7 +231,6 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20200117065230-39095c1d176c h1:FodBYPZKH5tAN2O60HlglMwXGAeV/4k+NKbli79M/2c=
golang.org/x/tools v0.0.0-20200117065230-39095c1d176c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
... ... @@ -279,7 +267,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
... ...
... ... @@ -2,6 +2,7 @@ package subscriber
import (
"fmt"
coreDomain "github.com/linmadan/egglib-go/core/domain"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/factory"
... ...
package subscriber
import (
"fmt"
"github.com/linmadan/egglib-go/core/domain"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/factory"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain/event"
)
type WorthServiceSubscriber struct {
}
func (subscriber *WorthServiceSubscriber) HandleEvent(domainEvent domain.DomainEvent) error {
worthServiceGateway, err := factory.CreateWorthServiceGateway(nil)
if err != nil {
fmt.Println(err.Error())
return nil
}
switch domainEvent.EventType() {
case event.USER_CHANGE_PHONE:
phoneChangedEvent := domainEvent.(*event.PhoneChanged)
data, err := worthServiceGateway.ChangePhoneCallback(phoneChangedEvent.OldPhone, phoneChangedEvent.NewPhone)
if err != nil {
fmt.Println(err.Error())
return nil
}
fmt.Println(data)
break
}
return nil
}
func (subscriber *WorthServiceSubscriber) SubscribedToEventTypes() []string {
return []string{
event.USER_CHANGE_PHONE,
}
}
... ...
... ... @@ -110,5 +110,10 @@ func CreateExchangeSuMoneyService(options map[string]interface{}) (service.Excha
return domainService.NewExchangeSuMoneyService(transactionContext)
}
func CreateChangePhoneService(options map[string]interface{}) (service.ChangePhoneService, error) {
var transactionContext *pgTransaction.TransactionContext
if value, ok := options["transactionContext"]; ok {
transactionContext = value.(*pgTransaction.TransactionContext)
}
return domainService.NewChangePhoneService(transactionContext)
}
... ...
... ... @@ -9,3 +9,7 @@ func CreateAbilityServiceGateway(options map[string]interface{}) (serviceGateway
func CreateMmmOpenApiServiceGateway(options map[string]interface{}) (serviceGateway.MmmOpenApiServiceGateway, error) {
return serviceGateway.NewHttplibMmmOpenApiServiceGateway(), nil
}
func CreateWorthServiceGateway(options map[string]interface{}) (serviceGateway.WorthServiceGateway, error) {
return serviceGateway.NewHttplibWorthServiceGateway(), nil
}
... ...
... ... @@ -62,7 +62,7 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
// 现金池仓储初始化
var cashPoolRepository domain.CashPoolRepository
if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
if value, err := factory.CreateCashPoolRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -97,19 +97,19 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
systemExchangedSuMoney := systemSuMoneyStatistics["systemExchangedSuMoney"].(float64) // 平台已兑换素币
systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64) // 平台未兑换素币
systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64) // 平台未兑换素币
// 获取当前公司现金池
count, cashPools, err := cashPoolRepository.Find(tool_funs.SimpleStructToMap(createCashPoolCommand))
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(cashPools) > 0 { // 更新现金池
if len(cashPools) > 0 { // 更新现金池
cashPoolExchangeCash := cashPools[0].ExchangedCash
cashPoolUnExchangeCash := cashPools[0].UnExchangeCash
cashPoolCash := cashPools[0].Cash
if createCashPoolCommand.Cash < cashPoolExchangeCash {
if createCashPoolCommand.Cash < cashPoolExchangeCash {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "投入的现金值必须大于当前已兑换现金值")
}
... ... @@ -125,16 +125,16 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
var lastActivityRate float64
listExchangeCashActivityQuery := map[string]interface{}{
"companyId": createCashPoolCommand.CompanyId,
"order": "deadline DESC",
"nearest": true,
"limit": 1,
"order": "deadline DESC",
"nearest": true,
"limit": 1,
}
if _, activities, err := exchangeActivityRepository.Find(listExchangeCashActivityQuery); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if len(activities) > 0 {
lastActivityRate = activities[0].Rate
} else { // 未查询到相关兑换活动
} else { // 未查询到相关兑换活动
lastActivityRate = 0
}
}
... ... @@ -143,15 +143,15 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
// 更新现金池命令
updateCashPoolCommand := &command.UpdateCashPoolCommand{
CashPoolId: cashPools[0].CashPoolId,
Cash: createCashPoolCommand.Cash,
CashPoolId: cashPools[0].CashPoolId,
Cash: createCashPoolCommand.Cash,
ExchangedCash: cashPoolExchangeCash,
//UnExchangeCash: cashPoolUnExchangeCash + (createCashPoolCommand.Cash - cashPoolCash),
UnExchangeCash: unExchangeCash,
ExchangedSuMoney: systemExchangedSuMoney,
UnExchangeCash: unExchangeCash,
ExchangedSuMoney: systemExchangedSuMoney,
UnExchangeSuMoney: systemUnExchangeSuMoney,
Rate: newRate,
LastRate: lastActivityRate,
Rate: newRate,
LastRate: lastActivityRate,
}
// 更新现金池
... ... @@ -180,36 +180,36 @@ func (cashPoolService *CashPoolService) CreateCashPool(createCashPoolCommand *co
cashPool.LastRate, _ = decimal.NewFromFloatWithExponent(cashPool.LastRate, -2).Float64()
return cashPool, nil
}
} else { // 新增现金池
} else { // 新增现金池
// 获取上次兑换活动兑换汇率查询
var lastActivityRate float64
listExchangeCashActivityQuery := map[string]interface{}{
"companyId": createCashPoolCommand.CompanyId,
"order": "deadline DESC",
"nearest": true,
"limit": 1,
"order": "deadline DESC",
"nearest": true,
"limit": 1,
}
if _, activities, err := exchangeActivityRepository.Find(listExchangeCashActivityQuery); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if len(activities) > 0 {
lastActivityRate = activities[0].Rate
} else { // 未查询到相关兑换活动
} else { // 未查询到相关兑换活动
lastActivityRate = 0
}
}
// 更新现金池
newCashPool := &domain.CashPool{
CompanyId: createCashPoolCommand.CompanyId,
Cash: createCashPoolCommand.Cash,
ExchangedCash: 0,
UnExchangeCash: createCashPoolCommand.Cash,
ExchangedSuMoney: systemExchangedSuMoney,
CompanyId: createCashPoolCommand.CompanyId,
Cash: createCashPoolCommand.Cash,
ExchangedCash: 0,
UnExchangeCash: createCashPoolCommand.Cash,
ExchangedSuMoney: systemExchangedSuMoney,
UnExchangeSuMoney: systemUnExchangeSuMoney,
LastRate: lastActivityRate,
Rate: 0,
CreateTime: time.Now().Local(),
LastRate: lastActivityRate,
Rate: 0,
CreateTime: time.Now().Local(),
}
if cashPool, err := cashPoolRepository.Save(newCashPool); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -271,7 +271,7 @@ func (cashPoolService *CashPoolService) GetCashPool(getCashPoolQuery *query.GetC
// 现金池仓储初始化
var cashPoolRepository domain.CashPoolRepository
if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
if value, err := factory.CreateCashPoolRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -304,16 +304,16 @@ func (cashPoolService *CashPoolService) GetCashPool(getCashPoolQuery *query.GetC
var lastActivityRate float64
listExchangeCashActivityQuery := map[string]interface{}{
"companyId": getCashPoolQuery.CompanyId,
"order": "deadline DESC",
"nearest": true,
"limit": 1,
"order": "deadline DESC",
"nearest": true,
"limit": 1,
}
if _, activities, err := exchangeActivityRepository.Find(listExchangeCashActivityQuery); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if len(activities) > 0 {
lastActivityRate = activities[0].Rate
} else { // 未查询到相关兑换活动
} else { // 未查询到相关兑换活动
lastActivityRate = 0
}
}
... ... @@ -327,7 +327,7 @@ func (cashPoolService *CashPoolService) GetCashPool(getCashPoolQuery *query.GetC
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的公司")
}
//systemUnExchangeSuMoney, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64)), 64) // 平台未兑换素币
systemUnExchangeSuMoney, _ := decimal.NewFromFloatWithExponent(systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64), -2).Float64() // 平台未兑换素币
systemUnExchangeSuMoney, _ := decimal.NewFromFloatWithExponent(systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64), -2).Float64() // 平台未兑换素币
// 查找当前公司现金池
if count, cashPools, err := cashPoolRepository.Find(tool_funs.SimpleStructToMap(getCashPoolQuery)); err != nil {
... ... @@ -338,17 +338,17 @@ func (cashPoolService *CashPoolService) GetCashPool(getCashPoolQuery *query.GetC
}
// 现金池为空时处理
if count == 0 {
return map[string] interface{} {
"cashPoolId": 0,
"cash": 0,
"companyId": getCashPoolQuery.CompanyId,
"exchangedCash": 0,
"unExchangeCash": 0,
"exchangedSuMoney": 0,
return map[string]interface{}{
"cashPoolId": 0,
"cash": 0,
"companyId": getCashPoolQuery.CompanyId,
"exchangedCash": 0,
"unExchangeCash": 0,
"exchangedSuMoney": 0,
"unExchangeSuMoney": systemUnExchangeSuMoney,
"rate": 0, // 平均兑换汇率
"lastRate": 0, // 上期活动兑换汇率
"createTime": time.Now().Local(),
"rate": 0, // 平均兑换汇率
"lastRate": 0, // 上期活动兑换汇率
"createTime": time.Now().Local(),
}, nil
} else {
//cashPools[0].Rate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", cashPools[0].Rate), 64)
... ... @@ -426,13 +426,13 @@ func (cashPoolService *CashPoolService) CreateExchangeCashActivity(createExchang
// 创建兑换活动命令
newActivity := &domain.ExchangeCashActivity{
ExchangeActivityName: createExchangeCashActivityCommand.ExchangeActivityName,
CompanyId: createExchangeCashActivityCommand.CompanyId,
ExchangedCash: 0,
ExchangedSuMoney: 0,
Deadline: t2,
CountDown: int64(math.Ceil(t2.Sub(t1).Hours() / 24)), // 计算活动截止倒计时
Rate: createExchangeCashActivityCommand.ExchangeRate,
CreateTime: time.Now().Local(),
CompanyId: createExchangeCashActivityCommand.CompanyId,
ExchangedCash: 0,
ExchangedSuMoney: 0,
Deadline: t2,
CountDown: int64(math.Ceil(t2.Sub(t1).Hours() / 24)), // 计算活动截止倒计时
Rate: createExchangeCashActivityCommand.ExchangeRate,
CreateTime: time.Now().Local(),
}
// 倒计时结束判断
... ... @@ -543,13 +543,13 @@ func (cashPoolService *CashPoolService) SearchExchangeCashActivity(activityComma
var t2 = activity.Deadline
// 获取兑换活动前先更新兑换活动倒计时命令
updateExchangeCashActivity := &command.UpdateExchangeCashActivityCommand {
updateExchangeCashActivity := &command.UpdateExchangeCashActivityCommand{
ExchangeCashActivityId: activity.ActivityId,
CountDown: int64(math.Ceil(t2.Sub(t1).Hours() / 24)), // 计算倒计时
Deadline: activity.Deadline,
ExchangedSuMoney: activity.ExchangedSuMoney,
ExchangedCash: activity.ExchangedCash,
ExchangeRate: activity.Rate,
CountDown: int64(math.Ceil(t2.Sub(t1).Hours() / 24)), // 计算倒计时
Deadline: activity.Deadline,
ExchangedSuMoney: activity.ExchangedSuMoney,
ExchangedCash: activity.ExchangedCash,
ExchangeRate: activity.Rate,
}
// 倒计时结束处理
... ... @@ -579,16 +579,16 @@ func (cashPoolService *CashPoolService) SearchExchangeCashActivity(activityComma
//suMoney, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", activity.ExchangedSuMoney), 64)
cash, _ := decimal.NewFromFloatWithExponent(activity.ExchangedCash, -2).Float64()
suMoney, _ := decimal.NewFromFloatWithExponent(activity.ExchangedSuMoney, -2).Float64()
activityFormat := map[string]interface{} {
"activityId": activity.ActivityId,
activityFormat := map[string]interface{}{
"activityId": activity.ActivityId,
"exchangeActivityName": activity.ExchangeActivityName,
"companyId": activity.CompanyId,
"exchangedCash": cash,
"exchangedSuMoney": suMoney,
"deadline": activity.Deadline.Local(),
"countDown": activity.CountDown,
"rate": activity.Rate,
"createTime": activity.CreateTime.Local(),
"companyId": activity.CompanyId,
"exchangedCash": cash,
"exchangedSuMoney": suMoney,
"deadline": activity.Deadline.Local(),
"countDown": activity.CountDown,
"rate": activity.Rate,
"createTime": activity.CreateTime.Local(),
}
activitiesFormat = append(activitiesFormat, activityFormat)
}
... ... @@ -598,7 +598,7 @@ func (cashPoolService *CashPoolService) SearchExchangeCashActivity(activityComma
}
return map[string]interface{}{
"count": count,
"count": count,
"activities": activitiesFormat,
}, nil
}
... ... @@ -633,12 +633,12 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas
// 查找兑换现金活动
if count, activitiesFound, err := exchangeActivityRepository.Find(map[string]interface{}{
"companyId": listExchangeCashActivityQuery.CompanyId,
"companyId": listExchangeCashActivityQuery.CompanyId,
"activityNameMatch": listExchangeCashActivityQuery.ActivityNameMatch,
"offset": listExchangeCashActivityQuery.Offset,
"limit": listExchangeCashActivityQuery.Limit,
"countdown": 0,
"isEnd": listExchangeCashActivityQuery.IsEnd,
"offset": listExchangeCashActivityQuery.Offset,
"limit": listExchangeCashActivityQuery.Limit,
"countdown": 0,
"isEnd": listExchangeCashActivityQuery.IsEnd,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
... ... @@ -647,13 +647,13 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas
var t2 = activityFound.Deadline.Local()
// 更新兑换现金活动倒计时命令
updateExchangeCashActivity := &command.UpdateExchangeCashActivityCommand {
updateExchangeCashActivity := &command.UpdateExchangeCashActivityCommand{
ExchangeCashActivityId: activityFound.ActivityId,
CountDown: int64(math.Ceil(t2.Sub(t1).Hours() / 24)),
Deadline: activityFound.Deadline.Local(),
ExchangedSuMoney: activityFound.ExchangedSuMoney,
ExchangedCash: activityFound.ExchangedCash,
ExchangeRate: activityFound.Rate,
CountDown: int64(math.Ceil(t2.Sub(t1).Hours() / 24)),
Deadline: activityFound.Deadline.Local(),
ExchangedSuMoney: activityFound.ExchangedSuMoney,
ExchangedCash: activityFound.ExchangedCash,
ExchangeRate: activityFound.Rate,
}
// 倒计时结束处理
... ... @@ -684,16 +684,16 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas
//suMoney, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", activityFound.ExchangedSuMoney), 64)
cash, _ := decimal.NewFromFloatWithExponent(activityFound.ExchangedCash, -2).Float64()
suMoney, _ := decimal.NewFromFloatWithExponent(activityFound.ExchangedSuMoney, -2).Float64()
activityWithTs := map[string]interface{} {
"activityId": activityFound.ActivityId,
activityWithTs := map[string]interface{}{
"activityId": activityFound.ActivityId,
"exchangeActivityName": activityFound.ExchangeActivityName,
"companyId": activityFound.CompanyId,
"exchangedCash": cash,
"exchangedSuMoney": suMoney,
"deadline": activityFound.Deadline.Local().UnixNano() / 1e6, // 秒级时间戳转换
"countDown": activityFound.CountDown,
"rate": activityFound.Rate,
"createTime": activityFound.CreateTime.Local(),
"companyId": activityFound.CompanyId,
"exchangedCash": cash,
"exchangedSuMoney": suMoney,
"deadline": activityFound.Deadline.Local().UnixNano() / 1e6, // 秒级时间戳转换
"countDown": activityFound.CountDown,
"rate": activityFound.Rate,
"createTime": activityFound.CreateTime.Local(),
}
activitiesWithTs = append(activitiesWithTs, activityWithTs)
}
... ... @@ -703,7 +703,7 @@ func (cashPoolService *CashPoolService) ListExchangeCashActivity(listExchangeCas
}
return map[string]interface{}{
"count": count,
"count": count,
"activities": activitiesWithTs,
}, nil
}
... ... @@ -798,13 +798,13 @@ func (cashPoolService *CashPoolService) GetExchangeCashActivity(getExchangeCashA
var t2 = activityFound.Deadline
// 更新兑换现金活动倒计时命令
updateExchangeCashActivity := &command.UpdateExchangeCashActivityCommand {
updateExchangeCashActivity := &command.UpdateExchangeCashActivityCommand{
ExchangeCashActivityId: activityFound.ActivityId,
CountDown: int64(math.Ceil(t2.Sub(t1).Hours() / 24)),
Deadline: activityFound.Deadline,
ExchangedSuMoney: activityFound.ExchangedSuMoney,
ExchangedCash: activityFound.ExchangedCash,
ExchangeRate: activityFound.Rate,
CountDown: int64(math.Ceil(t2.Sub(t1).Hours() / 24)),
Deadline: activityFound.Deadline,
ExchangedSuMoney: activityFound.ExchangedSuMoney,
ExchangedCash: activityFound.ExchangedCash,
ExchangeRate: activityFound.Rate,
}
// 倒计时结束处理
... ... @@ -877,7 +877,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
// 现金池仓储初始化
var cashPoolRepository domain.CashPoolRepository
if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
if value, err := factory.CreateCashPoolRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -903,8 +903,8 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
if activityFound == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateExchangeCashActivityCommand.ExchangeCashActivityId)))
}
activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney // 当前活动已兑换素币
activityFoundExchangedCash := activityFound.ExchangedCash // 当前活动已兑换现金
activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney // 当前活动已兑换素币
activityFoundExchangedCash := activityFound.ExchangedCash // 当前活动已兑换现金
// 获取当前公司现金池
cashPoolFound, err := cashPoolRepository.FindOne(map[string]interface{}{
... ... @@ -968,9 +968,9 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
// 获取当前兑换活动汇率
activityFoundRate := activityFound.Rate
if updateExchangeCashActivityCommand.ExchangeRate != activityFoundRate && updateExchangeCashActivityCommand.ExchangeRate != 0 { // 更新兑换活动兑换汇率
if updateExchangeCashActivityCommand.ExchangeRate != activityFoundRate && updateExchangeCashActivityCommand.ExchangeRate != 0 { // 更新兑换活动兑换汇率
// 判断兑换活动清单中现金总金额是否超过平台未兑换现金值
if activityFoundExchangedSuMoney * updateExchangeCashActivityCommand.ExchangeRate > cashPoolFoundUnExchangeCash {
if activityFoundExchangedSuMoney*updateExchangeCashActivityCommand.ExchangeRate > cashPoolFoundUnExchangeCash {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金")
}
... ... @@ -988,9 +988,9 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
// 更新兑换清单命令
exchangeCash, _ := decimal.NewFromFloat(updateExchangeCashActivityCommand.ExchangeRate).Mul(decimal.NewFromFloat(personFoundExchangedSuMoney)).Float64()
updateExchangeCashPerson := &command.UpdateExchangeCashPersonCommand {
updateExchangeCashPerson := &command.UpdateExchangeCashPersonCommand{
//ExchangedCash: updateExchangeCashActivityCommand.ExchangeRate * personFoundExchangedSuMoney,
ExchangedCash: exchangeCash,
ExchangedCash: exchangeCash,
ExchangedSuMoney: personFoundExchangedSuMoney,
}
... ... @@ -1000,7 +1000,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
}
// 保存素币兑换清单更新
if _, err := exchangeCashPersonListRepository.Save(personFound);err != nil {
if _, err := exchangeCashPersonListRepository.Save(personFound); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
... ... @@ -1034,16 +1034,16 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
exchangedCash, _ := decimal.NewFromFloat(cashPoolFoundExchangedCash).Add(decimal.NewFromFloat(updateExchangeCashActivityCommand.ExchangedCash).Sub(decimal.NewFromFloat(activityFoundExchangedCash))).Float64()
unExchangeCash, _ := decimal.NewFromFloat(cashPoolFoundUnExchangeCash).Sub(decimal.NewFromFloat(updateExchangeCashActivityCommand.ExchangedCash).Sub(decimal.NewFromFloat(activityFoundExchangedCash))).Float64()
updateCashPoolCommand := &command.UpdateCashPoolCommand{
CashPoolId: cashPoolFound.CashPoolId,
CashPoolId: cashPoolFound.CashPoolId,
//ExchangedCash: cashPoolFoundExchangedCash + (updateExchangeCashActivityCommand.ExchangedCash - activityFoundExchangedCash),
//UnExchangeCash: cashPoolFoundUnExchangeCash - (updateExchangeCashActivityCommand.ExchangedCash - activityFoundExchangedCash),
ExchangedCash: exchangedCash,
UnExchangeCash: unExchangeCash,
ExchangedSuMoney: systemExchangedSuMoney,
UnExchangeSuMoney: systemUnExchangeSuMoney,
Rate: rate,
LastRate: cashPoolFound.LastRate,
Cash: cashPoolFound.Cash,
ExchangedCash: exchangedCash,
UnExchangeCash: unExchangeCash,
ExchangedSuMoney: systemExchangedSuMoney,
UnExchangeSuMoney: systemUnExchangeSuMoney,
Rate: rate,
LastRate: cashPoolFound.LastRate,
Cash: cashPoolFound.Cash,
}
// 更新现金池
... ... @@ -1169,7 +1169,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC
// 现金池仓储初始化
var cashPoolRepository domain.CashPoolRepository
if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
if value, err := factory.CreateCashPoolRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -1218,9 +1218,10 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC
activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney
activityFoundExchangedCash := activityFound.ExchangedCash
// TODO 更改:根据uid和companyId,判断当前员工是否有效
//更改:根据uid和companyId,判断当前员工是否有效
getEmployee := map[string]interface{}{
"account": personFound.EmployeeInfo.EmployeeAccount,
"uid": personFound.EmployeeInfo.Uid,
//"account": personFound.EmployeeInfo.EmployeeAccount,
"companyId": activityFound.CompanyId,
}
employeeFound, err := employeeRepository.FindOne(getEmployee)
... ... @@ -1257,15 +1258,15 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC
// 更新素币兑换活动命令
exchangedSuMoney, _ := decimal.NewFromFloat(activityFoundExchangedSuMoney).Add(decimal.NewFromFloat(updateExchangeCashPersonCommand.ExchangedSuMoney).Sub(decimal.NewFromFloat(personFoundExchangedSuMoney))).Float64()
exchangedCash, _ := decimal.NewFromFloat(activityFoundExchangedCash).Add(decimal.NewFromFloat(updateExchangeCashPersonCommand.ExchangedSuMoney).Sub(decimal.NewFromFloat(personFoundExchangedSuMoney)).Mul(decimal.NewFromFloat(activityFound.Rate))).Float64()
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
ExchangeCashActivityId: personFound.ExchangeCashActivityId,
//ExchangedSuMoney: activityFoundExchangedSuMoney + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney),
//ExchangedCash: activityFoundExchangedCash + (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney) * activityFound.Rate,
ExchangedSuMoney: exchangedSuMoney,
ExchangedCash: exchangedCash,
Deadline: activityFound.Deadline,
CountDown: activityFound.CountDown,
ExchangeRate: activityFound.Rate,
ExchangedSuMoney: exchangedSuMoney,
ExchangedCash: exchangedCash,
Deadline: activityFound.Deadline,
CountDown: activityFound.CountDown,
ExchangeRate: activityFound.Rate,
}
// 操作素币服务以及生成素币兑换流水记录命令
... ... @@ -1278,11 +1279,11 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC
}
// 判断操作素币类型
if updateExchangeCashPersonCommand.ExchangedSuMoney > personFoundExchangedSuMoney { // 追加素币兑换
if updateExchangeCashPersonCommand.ExchangedSuMoney > personFoundExchangedSuMoney { // 追加素币兑换
//operationSuMoneyCommand.SuMoney = math.Abs(updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney)
operationSuMoneyCommand.SuMoney, _ = decimal.NewFromFloat(updateExchangeCashPersonCommand.ExchangedSuMoney).Sub(decimal.NewFromFloat(personFoundExchangedSuMoney)).Abs().Float64()
operationSuMoneyCommand.OperationType = 4
} else { // 撤回素币兑换
} else { // 撤回素币兑换
//operationSuMoneyCommand.SuMoney = math.Abs(updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney)
operationSuMoneyCommand.SuMoney, _ = decimal.NewFromFloat(updateExchangeCashPersonCommand.ExchangedSuMoney).Sub(decimal.NewFromFloat(personFoundExchangedSuMoney)).Abs().Float64()
operationSuMoneyCommand.OperationType = 41
... ... @@ -1338,7 +1339,7 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC
// 判断是否超过平台未兑换现金
if activityUpdated.ExchangedSuMoney > activityFoundExchangedSuMoney {
if (activityUpdated.ExchangedSuMoney - activityFoundExchangedSuMoney) * activityUpdated.Rate > cashPoolFoundUnExchangeCash {
if (activityUpdated.ExchangedSuMoney-activityFoundExchangedSuMoney)*activityUpdated.Rate > cashPoolFoundUnExchangeCash {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金")
}
}
... ... @@ -1359,15 +1360,15 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashPerson(updateExchangeC
// 更新现金池命令
unExchangeCash, _ := decimal.NewFromFloat(cashPoolFoundUnExchangeCash).Sub((decimal.NewFromFloat(updateExchangeCashPersonCommand.ExchangedSuMoney).Sub(decimal.NewFromFloat(personFoundExchangedSuMoney))).Mul(decimal.NewFromFloat(activityUpdated.Rate))).Float64()
updateCashPoolCommand := &command.UpdateCashPoolCommand{
CashPoolId: cashPoolFound.CashPoolId,
Cash: cashPoolFound.Cash,
ExchangedCash: systemExchangedCash,
CashPoolId: cashPoolFound.CashPoolId,
Cash: cashPoolFound.Cash,
ExchangedCash: systemExchangedCash,
//UnExchangeCash: cashPoolFoundUnExchangeCash - (updateExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney) * activityUpdated.Rate,
UnExchangeCash: unExchangeCash,
Rate: newRate,
ExchangedSuMoney: systemExchangedSuMoney,
UnExchangeSuMoney: systemUnExchangeSuMoney,
LastRate: cashPoolFound.LastRate,
LastRate: cashPoolFound.LastRate,
}
// 更新现金池
... ... @@ -1443,7 +1444,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
// 现金池仓储初始化
var cashPoolRepository domain.CashPoolRepository
if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
if value, err := factory.CreateCashPoolRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return []interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -1505,8 +1506,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
failureDataList = append(failureDataList, row)
continue
}
activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney // 当前兑换活动未兑换素币
activityFoundExchangedCash := activityFound.ExchangedCash // 当前兑换活动已兑换素币
activityFoundExchangedSuMoney := activityFound.ExchangedSuMoney // 当前兑换活动未兑换素币
activityFoundExchangedCash := activityFound.ExchangedCash // 当前兑换活动已兑换素币
// 获取当前公司现金池
cashPoolFound, err := cashPoolRepository.FindOne(map[string]interface{}{
... ... @@ -1532,12 +1533,13 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
failureDataList = append(failureDataList, row)
continue
}
cashPoolFoundUnExchangeCash := cashPoolFound.UnExchangeCash // 当前公司现金池未兑换现金
cashPoolFoundExchangedCash := cashPoolFound.ExchangedCash // 当前公司现金池已兑换现金
cashPoolFoundUnExchangeCash := cashPoolFound.UnExchangeCash // 当前公司现金池未兑换现金
cashPoolFoundExchangedCash := cashPoolFound.ExchangedCash // 当前公司现金池已兑换现金
// TODO 更改:根据uid和companyId,判断当前员工是否有效
// 更改:根据uid、account和companyId,判断当前员工是否有效(身份有效、手机账号有效)
getEmployee := map[string]interface{}{
"account": createExchangeCashPersonCommand.PersonAccount,
"uid": createExchangeCashPersonCommand.Uid,
"account": createExchangeCashPersonCommand.PersonAccount,
"companyId": activityFound.CompanyId,
}
employeeFound, err := employeeRepository.FindOne(getEmployee)
... ... @@ -1561,14 +1563,15 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
failureDataList = append(failureDataList, row)
continue
}
employeeFoundSuMoney := employeeFound.SuMoney // 当前导入员工持有的素币值
employeeFoundSuMoney := employeeFound.SuMoney // 当前导入员工持有的素币值
// TODO 更改:根据uid和activityId判断当前员工是否已经在素币兑换清单中,
// 更改:根据uid、employeeAccount和activityId判断当前员工是否已经在素币兑换清单中,
personFound, _ := exchangeCashPersonListRepository.FindOne(map[string]interface{}{
"uid": employeeFound.EmployeeInfo.Uid,
"employeeAccount": employeeFound.EmployeeInfo.EmployeeAccount,
"activityId": activityFound.ActivityId,
"activityId": activityFound.ActivityId,
})
if personFound == nil { // 当前人员不在兑换素币清单中,新增兑换素币清单
if personFound == nil { // 当前人员不在兑换素币清单中,新增兑换素币清单
// 判断该员工兑换的素币是否超过本人持有的素币
if createExchangeCashPersonCommand.ExchangedSuMoney > employeeFoundSuMoney {
row := []interface{}{
... ... @@ -1591,8 +1594,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
EmployeeAccount: employeeFound.EmployeeInfo.EmployeeAccount,
},
ExchangeCashActivityId: createExchangeCashPersonCommand.ExchangeCashActivityId,
ExchangedSuMoney: createExchangeCashPersonCommand.ExchangedSuMoney,
ExchangedCash: newPersonExchangedCash,
ExchangedSuMoney: createExchangeCashPersonCommand.ExchangedSuMoney,
ExchangedCash: newPersonExchangedCash,
}
personSaved, err := exchangeCashPersonListRepository.Save(newPerson)
if err != nil {
... ... @@ -1617,11 +1620,11 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
}
// 操作素币,生成素币流水
operationSuMoneyCommand := &command.OperationSuMoneyCommand{
operationSuMoneyCommand := &command.OperationSuMoneyCommand{
Uid: employeeFound.EmployeeInfo.Uid,
Operator: createExchangeCashPersonCommand.Operator,
SuMoney: createExchangeCashPersonCommand.ExchangedSuMoney,
OperationType: 4, // 操作类型->记录类型对应:1->3: 增加 2->4: 扣除 3->1: 兑换物资 4->5: 兑换现金活动 41->6: 撤回兑换现金素币 5->2: 任务奖励
OperationType: 4, // 操作类型->记录类型对应:1->3: 增加 2->4: 扣除 3->1: 兑换物资 4->5: 兑换现金活动 41->6: 撤回兑换现金素币 5->2: 任务奖励
OperationDescription: "参与" + activityFound.ExchangeActivityName,
}
task, err := operationSuMoneyService.Operation(operationSuMoneyCommand.Uid, operationSuMoneyCommand.Operator, operationSuMoneyCommand.SuMoney, operationSuMoneyCommand.OperationType, operationSuMoneyCommand.OperationDescription)
... ... @@ -1649,16 +1652,16 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
// 更新兑换活动
exchangedSuMoney, _ := decimal.NewFromFloat(activityFoundExchangedSuMoney).Add(decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney)).Float64()
exchangedCash, _ := decimal.NewFromFloat(activityFoundExchangedCash).Add(decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney).Mul(decimal.NewFromFloat(activityFound.Rate))).Float64()
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
ExchangeCashActivityId: personSaved.ExchangeCashActivityId,
ExchangeActivityName: activityFound.ExchangeActivityName,
//ExchangedSuMoney: activityFoundExchangedSuMoney + createExchangeCashPersonCommand.ExchangedSuMoney,
//ExchangedCash: activityFoundExchangedCash + createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate,
ExchangedSuMoney: exchangedSuMoney,
ExchangedCash: exchangedCash,
Deadline: activityFound.Deadline,
CountDown: activityFound.CountDown,
ExchangeRate: activityFound.Rate,
ExchangedSuMoney: exchangedSuMoney,
ExchangedCash: exchangedCash,
Deadline: activityFound.Deadline,
CountDown: activityFound.CountDown,
ExchangeRate: activityFound.Rate,
}
if err := activityFound.Update(tool_funs.SimpleStructToMap(updateExchangeCashActivityCommand)); err != nil {
row := []interface{}{
... ... @@ -1693,7 +1696,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
}
// 判断是否超过平台未兑换现金
if createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate > cashPoolFoundUnExchangeCash {
if createExchangeCashPersonCommand.ExchangedSuMoney*activityFound.Rate > cashPoolFoundUnExchangeCash {
row := []interface{}{
createExchangeCashPersonCommand.PersonName,
createExchangeCashPersonCommand.PersonAccount,
... ... @@ -1727,7 +1730,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
continue
}
systemExchangedSuMoney := systemSuMoneyStatistics["systemExchangedSuMoney"].(float64) // 公司已兑换素币
systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64) // 公司未兑换素币
systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64) // 公司未兑换素币
// 更新现金池
var newRate float64
... ... @@ -1737,19 +1740,19 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
//newRate = (cashPoolFoundExchangedCash + personSaved.ExchangedCash) / systemExchangedSuMoney
newRate, _ = decimal.NewFromFloat(cashPoolFoundExchangedCash).Add(decimal.NewFromFloat(personSaved.ExchangedCash)).Div(decimal.NewFromFloat(systemExchangedSuMoney)).Float64()
}
newExchangedCash, _ := decimal.NewFromFloat(cashPoolFoundExchangedCash).Add(decimal.NewFromFloat(personSaved.ExchangedCash)).Float64()
unExchangeCash, _ := decimal.NewFromFloat(cashPoolFoundUnExchangeCash).Sub(decimal.NewFromFloat(personSaved.ExchangedCash)).Float64()
newExchangedCash, _ := decimal.NewFromFloat(cashPoolFoundExchangedCash).Add(decimal.NewFromFloat(personSaved.ExchangedCash)).Float64()
unExchangeCash, _ := decimal.NewFromFloat(cashPoolFoundUnExchangeCash).Sub(decimal.NewFromFloat(personSaved.ExchangedCash)).Float64()
updateCashPoolCommand := &command.UpdateCashPoolCommand{
CashPoolId: cashPoolFound.CashPoolId,
Cash: cashPoolFound.Cash,
CashPoolId: cashPoolFound.CashPoolId,
Cash: cashPoolFound.Cash,
//ExchangedCash: cashPoolFoundExchangedCash + personSaved.ExchangedCash,
//UnExchangeCash: cashPoolFoundUnExchangeCash - personSaved.ExchangedCash,
ExchangedCash: newExchangedCash,
ExchangedCash: newExchangedCash,
UnExchangeCash: unExchangeCash,
ExchangedSuMoney: systemExchangedSuMoney,
UnExchangeSuMoney: systemUnExchangeSuMoney,
Rate: newRate,
LastRate: cashPoolFound.LastRate,
LastRate: cashPoolFound.LastRate,
}
if err := cashPoolFound.Update(tool_funs.SimpleStructToMap(updateCashPoolCommand)); err != nil {
row := []interface{}{
... ... @@ -1782,10 +1785,10 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
failureDataList = append(failureDataList, row)
continue
}
} else { // 当前人员存在兑换素币清单中
personFoundExchangedSuMoney := personFound.ExchangedSuMoney // 当前素币清单已兑换素币
personFoundExchangedCash := personFound.ExchangedCash // 当前素币清单已兑换现金
if createExchangeCashPersonCommand.ExchangedSuMoney < personFoundExchangedSuMoney { // 当前兑换的素币小于本人已兑换素币,撤回兑换素币
} else { // 当前人员存在兑换素币清单中
personFoundExchangedSuMoney := personFound.ExchangedSuMoney // 当前素币清单已兑换素币
personFoundExchangedCash := personFound.ExchangedCash // 当前素币清单已兑换现金
if createExchangeCashPersonCommand.ExchangedSuMoney < personFoundExchangedSuMoney { // 当前兑换的素币小于本人已兑换素币,撤回兑换素币
// 素币减量
//suMoneyDecrement := personFoundExchangedSuMoney - createExchangeCashPersonCommand.ExchangedSuMoney
suMoneyDecrement, _ := decimal.NewFromFloat(personFoundExchangedSuMoney).Sub(decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney)).Float64()
... ... @@ -1796,14 +1799,14 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
// 更新兑换素币清单
exchangedSuMoney, _ := decimal.NewFromFloat(personFoundExchangedSuMoney).Sub(decimal.NewFromFloat(suMoneyDecrement)).Float64()
exchangedCash, _ := decimal.NewFromFloat(personFoundExchangedCash).Sub(decimal.NewFromFloat(cashDecrement)).Float64()
exchangedCash, _ := decimal.NewFromFloat(personFoundExchangedCash).Sub(decimal.NewFromFloat(cashDecrement)).Float64()
updateExchangeCashPersonCommand := &command.UpdateExchangeCashPersonCommand{
ListId: personFound.ListId,
ListId: personFound.ListId,
//ExchangedSuMoney: personFoundExchangedSuMoney - suMoneyDecrement,
//ExchangedCash: personFoundExchangedCash - cashDecrement,
ExchangedSuMoney: exchangedSuMoney,
ExchangedCash: exchangedCash,
Operator: createExchangeCashPersonCommand.Operator,
ExchangedCash: exchangedCash,
Operator: createExchangeCashPersonCommand.Operator,
}
if err := personFound.Update(tool_funs.SimpleStructToMap(updateExchangeCashPersonCommand)); err != nil {
row := []interface{}{
... ... @@ -1838,17 +1841,17 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
}
// 更新素币兑换活动
newExchangedSuMoney, _ := decimal.NewFromFloat(activityFoundExchangedSuMoney).Sub(decimal.NewFromFloat(suMoneyDecrement)).Float64()
newExchangedSuMoney, _ := decimal.NewFromFloat(activityFoundExchangedSuMoney).Sub(decimal.NewFromFloat(suMoneyDecrement)).Float64()
newExchangedCash, _ := decimal.NewFromFloat(activityFoundExchangedCash).Sub(decimal.NewFromFloat(cashDecrement)).Float64()
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
ExchangeCashActivityId: personFound.ExchangeCashActivityId,
//ExchangedSuMoney: activityFoundExchangedSuMoney - suMoneyDecrement,
//ExchangedCash: activityFoundExchangedCash - cashDecrement,
ExchangedSuMoney: newExchangedSuMoney,
ExchangedCash: newExchangedCash,
Deadline: activityFound.Deadline,
CountDown: activityFound.CountDown,
ExchangeRate: activityFound.Rate,
ExchangedSuMoney: newExchangedSuMoney,
ExchangedCash: newExchangedCash,
Deadline: activityFound.Deadline,
CountDown: activityFound.CountDown,
ExchangeRate: activityFound.Rate,
}
if err := activityFound.Update(tool_funs.SimpleStructToMap(updateExchangeCashActivityCommand)); err != nil {
row := []interface{}{
... ... @@ -1887,7 +1890,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
Uid: employeeFound.EmployeeInfo.Uid,
Operator: createExchangeCashPersonCommand.Operator,
SuMoney: suMoneyDecrement,
OperationType: 41, // 操作类型->记录类型对应:1->3: 增加 2->4: 扣除 3->1: 兑换物资 4->5: 兑换现金活动 41->6: 撤回兑换现金素币 5->2: 任务奖励
OperationType: 41, // 操作类型->记录类型对应:1->3: 增加 2->4: 扣除 3->1: 兑换物资 4->5: 兑换现金活动 41->6: 撤回兑换现金素币 5->2: 任务奖励
OperationDescription: activityFound.ExchangeActivityName + "调整",
}
task, err := operationSuMoneyService.Operation(operationSuMoneyCommand.Uid, operationSuMoneyCommand.Operator, operationSuMoneyCommand.SuMoney, operationSuMoneyCommand.OperationType, operationSuMoneyCommand.OperationDescription)
... ... @@ -1935,7 +1938,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
continue
}
systemExchangedSuMoney := systemSuMoneyStatistics["systemExchangedSuMoney"].(float64) // 公司已兑换素币
systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64) // 公司未兑换素币
systemUnExchangeSuMoney := systemSuMoneyStatistics["systemUnExchangeSuMoney"].(float64) // 公司未兑换素币
// 更新现金池
var newRate float64
... ... @@ -1948,8 +1951,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
cashPoolExchangedCash, _ := decimal.NewFromFloat(cashPoolFoundExchangedCash).Sub(decimal.NewFromFloat(cashDecrement)).Float64()
unExchangeCash, _ := decimal.NewFromFloat(cashPoolFoundUnExchangeCash).Add(decimal.NewFromFloat(cashDecrement)).Float64()
updateCashPoolCommand := &command.UpdateCashPoolCommand{
CashPoolId: cashPoolFound.CashPoolId,
Cash: cashPoolFound.Cash,
CashPoolId: cashPoolFound.CashPoolId,
Cash: cashPoolFound.Cash,
//ExchangedCash: cashPoolFoundExchangedCash - cashDecrement,
//UnExchangeCash: cashPoolFoundUnExchangeCash + cashDecrement,
ExchangedCash: cashPoolExchangedCash,
... ... @@ -1957,7 +1960,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
ExchangedSuMoney: systemExchangedSuMoney,
UnExchangeSuMoney: systemUnExchangeSuMoney,
Rate: newRate,
LastRate: cashPoolFound.LastRate,
LastRate: cashPoolFound.LastRate,
}
if err := cashPoolFound.Update(tool_funs.SimpleStructToMap(updateCashPoolCommand)); err != nil {
row := []interface{}{
... ... @@ -1990,7 +1993,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
failureDataList = append(failureDataList, row)
continue
}
} else { // 当前兑换素币大于等于已兑换素币,追加兑换素币
} else { // 当前兑换素币大于等于已兑换素币,追加兑换素币
// 素币增量
//suMoneyIncrement := createExchangeCashPersonCommand.ExchangedSuMoney - personFoundExchangedSuMoney
suMoneyIncrement, _ := decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney).Sub(decimal.NewFromFloat(personFoundExchangedSuMoney)).Float64()
... ... @@ -2014,12 +2017,12 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
exchangedSuMoney, _ := decimal.NewFromFloat(personFoundExchangedSuMoney).Add(decimal.NewFromFloat(suMoneyIncrement)).Float64()
exchangedCash, _ := decimal.NewFromFloat(personFoundExchangedCash).Add(decimal.NewFromFloat(cashIncrement)).Float64()
updateExchangeCashPersonCommand := &command.UpdateExchangeCashPersonCommand{
ListId: personFound.ListId,
ListId: personFound.ListId,
//ExchangedSuMoney: personFoundExchangedSuMoney + suMoneyIncrement,
//ExchangedCash: personFoundExchangedCash + cashIncrement,
ExchangedSuMoney: exchangedSuMoney,
ExchangedCash: exchangedCash,
Operator: createExchangeCashPersonCommand.Operator,
ExchangedCash: exchangedCash,
Operator: createExchangeCashPersonCommand.Operator,
}
if err := personFound.Update(tool_funs.SimpleStructToMap(updateExchangeCashPersonCommand)); err != nil {
row := []interface{}{
... ... @@ -2060,11 +2063,11 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
ExchangeCashActivityId: personFound.ExchangeCashActivityId,
//ExchangedSuMoney: activityFoundExchangedSuMoney + suMoneyIncrement,
//ExchangedCash: activityFoundExchangedCash + cashIncrement,
ExchangedSuMoney: newExchangedSuMoney,
ExchangedCash: newExchangedCash,
Deadline: activityFound.Deadline,
CountDown: activityFound.CountDown,
ExchangeRate: activityFound.Rate,
ExchangedSuMoney: newExchangedSuMoney,
ExchangedCash: newExchangedCash,
Deadline: activityFound.Deadline,
CountDown: activityFound.CountDown,
ExchangeRate: activityFound.Rate,
}
if err := activityFound.Update(tool_funs.SimpleStructToMap(updateExchangeCashActivityCommand)); err != nil {
row := []interface{}{
... ... @@ -2103,7 +2106,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
Uid: employeeFound.EmployeeInfo.Uid,
Operator: createExchangeCashPersonCommand.Operator,
SuMoney: suMoneyIncrement,
OperationType: 4, // 操作类型->记录类型对应:1->3: 增加 2->4: 扣除 3->1: 兑换物资 4->5: 兑换现金活动 41->6: 撤回兑换现金素币 5->2: 任务奖励
OperationType: 4, // 操作类型->记录类型对应:1->3: 增加 2->4: 扣除 3->1: 兑换物资 4->5: 兑换现金活动 41->6: 撤回兑换现金素币 5->2: 任务奖励
OperationDescription: activityFound.ExchangeActivityName + "调整",
}
task, err := operationSuMoneyService.Operation(operationSuMoneyCommand.Uid, operationSuMoneyCommand.Operator, operationSuMoneyCommand.SuMoney, operationSuMoneyCommand.OperationType, operationSuMoneyCommand.OperationDescription)
... ... @@ -2176,8 +2179,8 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
newCashPoolExchangedCash, _ := decimal.NewFromFloat(cashPoolFoundExchangedCash).Add(decimal.NewFromFloat(cashIncrement)).Float64()
unExchangeCash, _ := decimal.NewFromFloat(cashPoolFoundUnExchangeCash).Sub(decimal.NewFromFloat(cashIncrement)).Float64()
updateCashPoolCommand := &command.UpdateCashPoolCommand{
CashPoolId: cashPoolFound.CashPoolId,
Cash: cashPoolFound.Cash,
CashPoolId: cashPoolFound.CashPoolId,
Cash: cashPoolFound.Cash,
//ExchangedCash: cashPoolFoundExchangedCash + cashIncrement,
//UnExchangeCash: cashPoolFoundUnExchangeCash - cashIncrement,
ExchangedCash: newCashPoolExchangedCash,
... ... @@ -2185,7 +2188,7 @@ func (cashPoolService *CashPoolService) ImportCreateExchangeCashPerson(createExc
ExchangedSuMoney: systemExchangedSuMoney,
UnExchangeSuMoney: systemUnExchangeSuMoney,
Rate: newRate,
LastRate: cashPoolFound.LastRate,
LastRate: cashPoolFound.LastRate,
}
if err := cashPoolFound.Update(tool_funs.SimpleStructToMap(updateCashPoolCommand)); err != nil {
row := []interface{}{
... ... @@ -2271,7 +2274,7 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
// 现金池仓储初始化
var cashPoolRepository domain.CashPoolRepository
if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
if value, err := factory.CreateCashPoolRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -2319,7 +2322,7 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
// 判断当前员工是否有效
getEmployee := map[string]interface{}{
"uid": createExchangeCashPersonCommand.Uid,
"uid": createExchangeCashPersonCommand.Uid,
"companyId": activityFound.CompanyId,
}
employeeFound, err := employeeRepository.FindOne(getEmployee)
... ... @@ -2334,7 +2337,7 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
// 判断当前员工是否已经存在兑换素币清单中
if _, people, err := exchangeCashPersonListRepository.Find(map[string]interface{}{
"exchangeCashActivityId": activityFound.ActivityId,
"uid": employeeFound.EmployeeInfo.Uid,
"uid": employeeFound.EmployeeInfo.Uid,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
... ... @@ -2358,8 +2361,8 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
EmployeeAccount: employeeFound.EmployeeInfo.EmployeeAccount,
},
ExchangeCashActivityId: createExchangeCashPersonCommand.ExchangeCashActivityId,
ExchangedSuMoney: createExchangeCashPersonCommand.ExchangedSuMoney,
ExchangedCash: newPersonExchangedCash,
ExchangedSuMoney: createExchangeCashPersonCommand.ExchangedSuMoney,
ExchangedCash: newPersonExchangedCash,
}
// 保存兑换素币清单
... ... @@ -2369,7 +2372,7 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
}
// 操作素币命令
operationSuMoneyCommand := &command.OperationSuMoneyCommand{
operationSuMoneyCommand := &command.OperationSuMoneyCommand{
Uid: employeeFound.EmployeeInfo.Uid,
Operator: createExchangeCashPersonCommand.Operator,
SuMoney: createExchangeCashPersonCommand.ExchangedSuMoney,
... ... @@ -2387,18 +2390,18 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
}
// 更新兑换活动命令
exchangedSuMoney, _ := decimal.NewFromFloat(activityFoundExchangedSuMoney).Add(decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney)).Float64()
exchangedCash, _ := decimal.NewFromFloat(activityFoundExchangedCash).Add(decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney).Mul(decimal.NewFromFloat(activityFound.Rate))).Float64()
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
exchangedSuMoney, _ := decimal.NewFromFloat(activityFoundExchangedSuMoney).Add(decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney)).Float64()
exchangedCash, _ := decimal.NewFromFloat(activityFoundExchangedCash).Add(decimal.NewFromFloat(createExchangeCashPersonCommand.ExchangedSuMoney).Mul(decimal.NewFromFloat(activityFound.Rate))).Float64()
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
ExchangeCashActivityId: personSaved.ExchangeCashActivityId,
ExchangeActivityName: activityFound.ExchangeActivityName,
//ExchangedSuMoney: activityFoundExchangedSuMoney + createExchangeCashPersonCommand.ExchangedSuMoney,
//ExchangedCash: activityFoundExchangedCash + createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate,
ExchangedSuMoney: exchangedSuMoney,
ExchangedCash: exchangedCash,
Deadline: activityFound.Deadline,
CountDown: activityFound.CountDown,
ExchangeRate: activityFound.Rate,
ExchangedSuMoney: exchangedSuMoney,
ExchangedCash: exchangedCash,
Deadline: activityFound.Deadline,
CountDown: activityFound.CountDown,
ExchangeRate: activityFound.Rate,
}
// 更新兑换活动
... ... @@ -2429,7 +2432,7 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
cashPoolFoundExchangedCash := cashPoolsFound[0].ExchangedCash
// 判断是否超过平台未兑换现金
if createExchangeCashPersonCommand.ExchangedSuMoney * activityFound.Rate > cashPoolFoundUnExchangeCash {
if createExchangeCashPersonCommand.ExchangedSuMoney*activityFound.Rate > cashPoolFoundUnExchangeCash {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已超过投入现金池的未兑换现金")
}
... ... @@ -2454,11 +2457,11 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
}
// 更新现金池命令
newCashPoolExchangedCash, _ := decimal.NewFromFloat(cashPoolFoundExchangedCash).Add(decimal.NewFromFloat(personSaved.ExchangedCash)).Float64()
unExchangeCash, _ := decimal.NewFromFloat(cashPoolFoundUnExchangeCash).Sub(decimal.NewFromFloat(personSaved.ExchangedCash)).Float64()
newCashPoolExchangedCash, _ := decimal.NewFromFloat(cashPoolFoundExchangedCash).Add(decimal.NewFromFloat(personSaved.ExchangedCash)).Float64()
unExchangeCash, _ := decimal.NewFromFloat(cashPoolFoundUnExchangeCash).Sub(decimal.NewFromFloat(personSaved.ExchangedCash)).Float64()
updateCashPoolCommand := &command.UpdateCashPoolCommand{
CashPoolId: cashPoolsFound[0].CashPoolId,
Cash: cashPoolsFound[0].Cash,
CashPoolId: cashPoolsFound[0].CashPoolId,
Cash: cashPoolsFound[0].Cash,
//ExchangedCash: cashPoolFoundExchangedCash + personSaved.ExchangedCash,
//UnExchangeCash: cashPoolFoundUnExchangeCash - personSaved.ExchangedCash,
ExchangedCash: newCashPoolExchangedCash,
... ... @@ -2466,7 +2469,7 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
ExchangedSuMoney: systemExchangedSuMoney,
UnExchangeSuMoney: systemUnExchangeSuMoney,
Rate: newRate,
LastRate: cashPoolsFound[0].LastRate,
LastRate: cashPoolsFound[0].LastRate,
}
// 更新现金池
... ... @@ -2589,8 +2592,8 @@ func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashP
// 获取该公司活动下所有兑换员工
if count, people, err := exchangeCashPersonListRepository.FindAll(map[string]interface{}{
"exchangeCashActivityIds": activityIds,
"offset": listExchangeCashPersonQuery.Offset,
"limit": listExchangeCashPersonQuery.Limit,
"offset": listExchangeCashPersonQuery.Offset,
"limit": listExchangeCashPersonQuery.Limit,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
... ... @@ -2602,8 +2605,8 @@ func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashP
people[i].ExchangedCash, _ = decimal.NewFromFloatWithExponent(people[i].ExchangedCash, -2).Float64()
}
return map[string]interface{}{
"count": count,
"people": people,
"count": count,
"people": people,
}, nil
}
}
... ... @@ -2620,8 +2623,8 @@ func (cashPoolService *CashPoolService) ListExchangeCashPerson(listExchangeCashP
people[i].ExchangedCash, _ = decimal.NewFromFloatWithExponent(people[i].ExchangedCash, -2).Float64()
}
return map[string]interface{}{
"count": count,
"people": people,
"count": count,
"people": people,
}, nil
}
}
... ... @@ -2665,7 +2668,7 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC
// 现金池仓储初始化
var cashPoolRepository domain.CashPoolRepository
if value, err := factory.CreateCashPoolRepository(map[string] interface{} {
if value, err := factory.CreateCashPoolRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -2732,7 +2735,7 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC
// 判断当前员工是否有效
getEmployee := map[string]interface{}{
"uid": personFound.EmployeeInfo.Uid,
"uid": personFound.EmployeeInfo.Uid,
"companyId": activityFound.CompanyId,
}
employeeFound, err := employeeRepository.FindOne(getEmployee)
... ... @@ -2745,16 +2748,16 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC
// 更新兑换素币活动命令
exchangedSuMoney, _ := decimal.NewFromFloat(activityFoundExchangedSuMoney).Sub(decimal.NewFromFloat(personFoundExchangedSuMoney)).Float64()
exchangedCash, _ := decimal.NewFromFloat(activityFoundExchangedCash).Sub(decimal.NewFromFloat(personFoundExchangedCash)).Float64()
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
exchangedCash, _ := decimal.NewFromFloat(activityFoundExchangedCash).Sub(decimal.NewFromFloat(personFoundExchangedCash)).Float64()
updateExchangeCashActivityCommand := &command.UpdateExchangeCashActivityCommand{
ExchangeCashActivityId: personFound.ExchangeCashActivityId,
//ExchangedSuMoney: activityFoundExchangedSuMoney - personFoundExchangedSuMoney,
//ExchangedCash: activityFoundExchangedCash - personFoundExchangedCash,
ExchangedSuMoney: exchangedSuMoney,
ExchangedCash: exchangedCash,
Deadline: activityFound.Deadline,
CountDown: activityFound.CountDown,
ExchangeRate: activityFound.Rate,
ExchangedSuMoney: exchangedSuMoney,
ExchangedCash: exchangedCash,
Deadline: activityFound.Deadline,
CountDown: activityFound.CountDown,
ExchangeRate: activityFound.Rate,
}
// 更新兑换活动
... ... @@ -2772,11 +2775,11 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC
}
// 操作素币命令
operationSuMoneyCommand := &command.OperationSuMoneyCommand{
operationSuMoneyCommand := &command.OperationSuMoneyCommand{
Uid: personFound.EmployeeInfo.Uid,
Operator: removeExchangeCashPersonCommand.Operator,
SuMoney: personFoundExchangedSuMoney,
OperationType: 41, // 删除兑换素币清单,撤回已兑换素币
OperationType: 41, // 删除兑换素币清单,撤回已兑换素币
OperationDescription: activityFound.ExchangeActivityName + "调整",
}
... ... @@ -2824,12 +2827,12 @@ func (cashPoolService *CashPoolService) RemoveExchangeCashPerson(removeExchangeC
}
// 更新现金池命令
newExchangedCash, _ := decimal.NewFromFloat(cashPoolFoundExchangedCash).Sub(decimal.NewFromFloat(personFoundExchangedCash)).Float64()
UnExchangeCash, _ := decimal.NewFromFloat(cashPoolFoundUnExchangeCash).Add(decimal.NewFromFloat(personFoundExchangedCash)).Float64()
newExchangedCash, _ := decimal.NewFromFloat(cashPoolFoundExchangedCash).Sub(decimal.NewFromFloat(personFoundExchangedCash)).Float64()
UnExchangeCash, _ := decimal.NewFromFloat(cashPoolFoundUnExchangeCash).Add(decimal.NewFromFloat(personFoundExchangedCash)).Float64()
updateCashPoolCommand := &command.UpdateCashPoolCommand{
CashPoolId: cashPoolsFound[0].CashPoolId,
Cash: cashPoolsFound[0].Cash,
LastRate: cashPoolsFound[0].LastRate,
CashPoolId: cashPoolsFound[0].CashPoolId,
Cash: cashPoolsFound[0].Cash,
LastRate: cashPoolsFound[0].LastRate,
//ExchangedCash: cashPoolFoundExchangedCash - personFoundExchangedCash,
//UnExchangeCash: cashPoolFoundUnExchangeCash + personFoundExchangedCash,
ExchangedCash: newExchangedCash,
... ... @@ -2999,17 +3002,47 @@ func (cashPoolService *CashPoolService) ExchangeListRanking(exchangeListRankingQ
}
// 兑换素币清单排行榜
for i, _ := range exchangeCashListRankingStatistics["people"].([]struct{Uid int64; EmployeeName string; SuMoney float64; Cash float64; Ranking int}) {
uid := exchangeCashListRankingStatistics["people"].([]struct{Uid int64; EmployeeName string; SuMoney float64; Cash float64; Ranking int})[i].Uid
for i, _ := range exchangeCashListRankingStatistics["people"].([]struct {
Uid int64
EmployeeName string
SuMoney float64
Cash float64
Ranking int
}) {
uid := exchangeCashListRankingStatistics["people"].([]struct {
Uid int64
EmployeeName string
SuMoney float64
Cash float64
Ranking int
})[i].Uid
if uidName[uid] != nil {
exchangeCashListRankingStatistics["people"].([]struct{Uid int64; EmployeeName string; SuMoney float64; Cash float64; Ranking int})[i].EmployeeName = uidName[uid].(string)
exchangeCashListRankingStatistics["people"].([]struct {
Uid int64
EmployeeName string
SuMoney float64
Cash float64
Ranking int
})[i].EmployeeName = uidName[uid].(string)
}
}
// 个人素币兑换清单
if exchangeCashListRankingStatistics["currentEmployee"] != nil {
currentEmployeeExchangeCashList := exchangeCashListRankingStatistics["currentEmployee"].(struct{Uid int64;EmployeeName string;SuMoney float64; Cash float64;Ranking int})
uidExchangeCashList := exchangeCashListRankingStatistics["currentEmployee"].(struct{Uid int64;EmployeeName string;SuMoney float64; Cash float64;Ranking int}).Uid
currentEmployeeExchangeCashList := exchangeCashListRankingStatistics["currentEmployee"].(struct {
Uid int64
EmployeeName string
SuMoney float64
Cash float64
Ranking int
})
uidExchangeCashList := exchangeCashListRankingStatistics["currentEmployee"].(struct {
Uid int64
EmployeeName string
SuMoney float64
Cash float64
Ranking int
}).Uid
if uidName[uidExchangeCashList] != nil {
currentEmployeeExchangeCashList.EmployeeName = uidName[uidExchangeCashList].(string)
}
... ...
... ... @@ -17,11 +17,11 @@ import (
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/dao"
)
// 任务服务
// TaskService 任务服务
type TaskService struct {
}
// 对抢单任务进行确认
// ConfirmRobTask 对抢单任务进行确认
func (taskService *TaskService) ConfirmRobTask(confirmRobTaskCommand *command.ConfirmRobTaskCommand) (interface{}, error) {
if err := confirmRobTaskCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -411,11 +411,11 @@ func (taskService *TaskService) AcceptanceTask(acceptanceTaskCommand *command.Ac
// 搜索任务
func (taskService *TaskService) SearchTask(searchTaskCommand *command.SearchTaskCommand) (interface{}, error) {
if err := searchTaskCommand.ValidateCommand(); err != nil { // 校验搜索命令
if err := searchTaskCommand.ValidateCommand(); err != nil { // 校验搜索命令
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
transactionContext, err := factory.CreateTransactionContext(nil) // 工厂类创建事务上下文
transactionContext, err := factory.CreateTransactionContext(nil) // 工厂类创建事务上下文
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ... @@ -918,7 +918,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
}
sponsor, err := employeeRepository.FindOne(map[string]interface{}{
"uid": createTaskCommand.Sponsor,
"uid": createTaskCommand.Sponsor,
"status": 1,
})
if err != nil {
... ... @@ -935,14 +935,14 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
if sponsorInvalid == nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的发布者")
}
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的发布者:"+ sponsorInvalid.EmployeeInfo.EmployeeName)
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的发布者:"+sponsorInvalid.EmployeeInfo.EmployeeName)
}
// 获取任务指派人
var assignedPerson *domain.EmployeeInfo
if createTaskCommand.AssignedPerson != 0 {
employee, err := employeeRepository.FindOne(map[string]interface{}{
"uid": createTaskCommand.AssignedPerson,
"uid": createTaskCommand.AssignedPerson,
"status": 1,
})
if err != nil {
... ... @@ -959,7 +959,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
if employeeInvalid == nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员")
}
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员:" + employeeInvalid.EmployeeInfo.EmployeeName)
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员:"+employeeInvalid.EmployeeInfo.EmployeeName)
}
assignedPerson = employee.EmployeeInfo
}
... ... @@ -978,7 +978,7 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask
CustomerValues: createTaskCommand.CustomerValues,
TaskNature: createTaskCommand.TaskNature,
SuMoney: createTaskCommand.SuMoney,
MinSuMoney: createTaskCommand.MinSuMoney,
MinSuMoney: createTaskCommand.MinSuMoney,
MaxSuMoney: createTaskCommand.MaxSuMoney,
AcceptanceStandard: createTaskCommand.AcceptanceStandard,
TaskDescription: createTaskCommand.TaskDescription,
... ... @@ -1150,7 +1150,7 @@ func (taskService *TaskService) GetTask(getTaskQuery *query.GetTaskQuery) (inter
}
// 返回任务素币奖励范围
if taskDto.TaskStatus != 5 && task.MinSuMoney == 0 && task.MaxSuMoney == 0 {
if taskDto.TaskStatus != 5 && task.MinSuMoney == 0 && task.MaxSuMoney == 0 {
taskDto.MinSuMoney = 0
taskDto.MaxSuMoney = task.SuMoney
}
... ... @@ -1291,7 +1291,7 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask
employeeRepository = value
}
employee, err := employeeRepository.FindOne(map[string]interface{}{
"uid": updateTaskCommand.AssignedPerson,
"uid": updateTaskCommand.AssignedPerson,
"status": 1,
})
if err != nil {
... ... @@ -1308,7 +1308,7 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask
if employeeInvalid == nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员")
}
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员:" + employeeInvalid.EmployeeInfo.EmployeeName)
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员:"+employeeInvalid.EmployeeInfo.EmployeeName)
}
updateData["assignedPerson"] = employee.EmployeeInfo
} else {
... ... @@ -1457,7 +1457,7 @@ func (taskService *TaskService) ListTask(listTaskQuery *query.ListTaskQuery) (in
}
var retTasks []*domain.Task
for _, task := range tasks {
if task.TaskStatus != 5 && task.MinSuMoney == 0 && task.MaxSuMoney == 0 {
if task.TaskStatus != 5 && task.MinSuMoney == 0 && task.MaxSuMoney == 0 {
task.MinSuMoney = 0
task.MaxSuMoney = task.SuMoney
}
... ...
... ... @@ -3,9 +3,11 @@ package service
import (
"encoding/json"
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/event/subscriber"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/factory"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/unifiedUserCenter/command"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain/service"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/dao"
"time"
)
... ... @@ -27,8 +29,9 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
_ = transactionContext.RollbackTransaction()
}()
var employeeRepository domain.EmployeeRepository
if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
"transactionContext": transactionContext,
... ... @@ -37,6 +40,7 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
} else {
employeeRepository = value
}
var employeeDao *dao.EmployeeDao
if value, err := factory.CreateEmployeeDao(map[string]interface{}{
"transactionContext": transactionContext,
... ... @@ -45,10 +49,36 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
} else {
employeeDao = value
}
var cashPoolDao *dao.CashPoolDao
if value, err := factory.CreateCashPoolDao(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
} else {
cashPoolDao = value
}
// 修改手机号事件订阅初始化
var changePhoneService service.ChangePhoneService
if value, err := factory.CreateChangePhoneService(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
changePhoneService = value
err := changePhoneService.Subscribe(&subscriber.WorthServiceSubscriber{})
if err != nil {
return nil, err
}
}
var companyId int64
var uid int64
var employeeName string
var employeeAccount string
var oldPhone string
var newPhone string
var employeeAvatarUrl string
var isPrincipal bool
var status int
... ... @@ -74,6 +104,12 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
if value, ok := data["avatar"]; ok {
employeeAvatarUrl = value.(string)
}
if value, ok := data["old_phone"]; ok {
oldPhone = value.(string)
}
if value, ok := data["new_phone"]; ok {
newPhone = value.(string)
}
if value, ok := data["admin_type"]; ok {
if int(value.(float64)) == 2 {
isPrincipal = true
... ... @@ -89,16 +125,17 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
uids = append(uids, int64(uid.(float64)))
}
}
if value, ok := data["add"]; ok { // 添加员工
if value, ok := data["add"]; ok { // 添加员工
for _, addEmployee := range value.([]interface{}) {
addEmployees = append(addEmployees, addEmployee.(map[string]interface{}))
}
}
if value, ok := data["edit"]; ok { // 编辑员工
if value, ok := data["edit"]; ok { // 编辑员工
for _, editEmployee := range value.([]interface{}) {
editEmployees = append(editEmployees, editEmployee.(map[string]interface{}))
}
}
if syncEmployeeCallbackCommand.Module == "employee" {
switch syncEmployeeCallbackCommand.Action {
case "import":
... ... @@ -144,8 +181,8 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
EmployeeAvatarUrl: employeeAvatarUrl,
IsPrincipal: isPrincipal,
},
Status: status,
SuMoney: 0,
Status: status,
SuMoney: 0,
CreateTime: time.Now(),
}
... ... @@ -206,8 +243,8 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
EmployeeAvatarUrl: employeeAvatarUrl,
IsPrincipal: isPrincipal,
},
Status: status,
SuMoney: 0,
Status: status,
SuMoney: 0,
CreateTime: time.Now(),
}
if _, err := employeeRepository.Save(employee); err != nil {
... ... @@ -247,6 +284,22 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
break
case "changePhoneAllCompany": // 修改手机号
// 修改用户数据
err := employeeDao.ChangePhone(oldPhone, newPhone)
if err != nil {
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
// 修改业务数据-素币兑换清单
errUpdateExchangeCashPersonList := cashPoolDao.UpdateExchangeCashPersonListUserInfo(oldPhone, newPhone)
if errUpdateExchangeCashPersonList != nil {
return false, application.ThrowError(application.TRANSACTION_ERROR, errUpdateExchangeCashPersonList.Error())
}
// 发布修改手机号事件
if err := changePhoneService.ChangePhone(oldPhone, newPhone); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
break
default:
return false, nil
}
... ...
... ... @@ -6,6 +6,7 @@ const SERVICE_NAME = "mmm-worth"
var ABILITY_SERVICE_HOST = "https://suplus-worth-app-gateway-dev.fjmaimaimai.com"
var MMM_OPEN_API_SERVICE_HOST = "https://mmm-open-api-dev.fjmaimaimai.com"
var WORTH_SERVICE_GATEWAY_HOST = "https://suplus-worth-app-gateway-dev.fjmaimaimai.com"
var LOG_LEVEL = "debug"
var LOG_File = "logs/app.log"
... ...
... ... @@ -2,7 +2,7 @@ package constant
import "os"
var POSTGRESQL_DB_NAME = "mmm_worth"
var POSTGRESQL_DB_NAME = "mmmworth_dev"
var POSTGRESQL_USER = "postgres"
var POSTGRESQL_PASSWORD = "1993618jack"
var POSTGRESQL_HOST = "127.0.0.1"
... ...
package event
import coreDomain "github.com/linmadan/egglib-go/core/domain"
const USER_CHANGE_PHONE = "user-change-phone"
type PhoneChanged struct {
coreDomain.BaseEvent
OldPhone string `json:"oldPhone"` // 旧手机号
NewPhone string `json:"newPhone"` // 新手机号
}
func (event *PhoneChanged) EventType() string {
return USER_CHANGE_PHONE
}
... ...
... ... @@ -54,7 +54,6 @@ func (exchangeCashActivity *ExchangeCashActivity) Update(data map[string]interfa
if createTime, ok := data["createTime"]; ok && createTime.(time.Time).IsZero() {
exchangeCashActivity.CreateTime = createTime.(time.Time)
}
exchangeCashActivity.CreateTime = time.Now()
return nil
}
... ...
package service
import coreDomain "github.com/linmadan/egglib-go/core/domain"
type ChangePhoneService interface {
coreDomain.DomainEventPublisher
ChangePhone(oldPhone string, newPhone string) error
}
... ...
... ... @@ -6,3 +6,12 @@
package service
import (
coreDomain "github.com/linmadan/egglib-go/core/domain"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
)
type ExchangeCashService interface {
coreDomain.DomainEventPublisher
ExchangeCash(uid int64, operatorUid int64, suMoney float64, activityId int64, recordDescription string) (*domain.SuMoneyTransactionRecord, error)
}
\ No newline at end of file
... ...
package dao
import (
"fmt"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
)
type BidInfosDao struct {
transactionContext *pgTransaction.TransactionContext
}
//TODO ChangeBidInfosSuccessfulBidderAccount
func (dao *BidInfosDao) ChangeBidInfosSuccessfulBidderAccount(uid int64, newAccount string) {
}
func NewBidInfosDao(transactionContext *pgTransaction.TransactionContext) (*BidInfosDao, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
} else {
return &BidInfosDao{
transactionContext: transactionContext,
}, nil
}
}
... ...
package dao
import (
"fmt"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
)
type BidderInfosDao struct {
transactionContext *pgTransaction.TransactionContext
}
//TODO ChangeBidderInfosBidderAccount
func (dao *BidderInfosDao) ChangeBidderInfosBidderAccount() {
}
func NewBidderInfosDao(transactionContext *pgTransaction.TransactionContext) (*BidderInfosDao, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
} else {
return &BidderInfosDao{
transactionContext: transactionContext,
}, nil
}
}
... ...
... ... @@ -2,6 +2,7 @@ package dao
import (
"fmt"
"github.com/go-pg/pg"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg/models"
)
... ... @@ -19,37 +20,49 @@ func (dao *CashPoolDao) CalculateActivityExchangedSuMoney(activityId int64) (map
if err := tx.Model(exchangeCashPersonListModels).
ColumnExpr("sum(exchange_cash_person_list.exchanged_su_money) AS activity_exchanged_su_money").
Where("exchange_cash_person_list.activity_id = ?", activityId).
Select(&activityExchangedSuMoney); err !=nil {
Select(&activityExchangedSuMoney); err != nil {
return nil, err
}
if err := tx.Model(exchangeCashPersonListModels).
ColumnExpr("sum(exchange_cash_person_list.exchanged_cash) AS activity_exchanged_cash").
Where("exchange_cash_person_list.activity_id = ?", activityId).
Select(&activityExchangedCash); err !=nil {
Select(&activityExchangedCash); err != nil {
return nil, err
}
return map[string]interface{}{
"activityExchangedSuMoney": activityExchangedSuMoney,
"activityExchangedCash": activityExchangedCash,
"activityExchangedCash": activityExchangedCash,
}, nil
}
// UpdateExchangeCashPersonListUserInfo 更新素币兑换清单用户信息
func (dao *CashPoolDao) UpdateExchangeCashPersonListUserInfo(oldPhone string, newPhone string) error {
tx := dao.transactionContext.PgTx
if _, err := tx.QueryOne(
pg.Scan(),
"UPDATE exchange_cash_person_lists SET employee_account = ? WHERE employee_account = ?",
newPhone, oldPhone); err != nil {
return err
}
return nil
}
// 返回兑换活动清单榜单
func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interface{}) (map[string]interface{}, error) {
var retPeople []struct {
Uid int64
Uid int64
EmployeeName string
SuMoney float64
Cash float64
Ranking int
SuMoney float64
Cash float64
Ranking int
}
var retEmployee []struct {
Uid int64
Uid int64
EmployeeName string
SuMoney float64
Cash float64
Ranking int
SuMoney float64
Cash float64
Ranking int
}
tx := dao.transactionContext.PgTx
... ... @@ -67,7 +80,7 @@ func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interfac
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
queryPeople = queryPeople.Where("e.company_id = ?", companyId)
}
if activityId, ok := queryOptions["activityId"]; ok && (activityId.(int64) != 0){
if activityId, ok := queryOptions["activityId"]; ok && (activityId.(int64) != 0) {
queryPeople = queryPeople.Where("exchange_cash_person_list.activity_id = ?", activityId)
}
queryPeople = queryPeople.Group("exchange_cash_person_list.uid")
... ... @@ -104,7 +117,7 @@ func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interfac
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
queryPeopleAll = queryPeopleAll.Where("e.company_id = ?", companyId)
}
if activityId, ok := queryOptions["activityId"]; ok && (activityId.(int64) != 0){
if activityId, ok := queryOptions["activityId"]; ok && (activityId.(int64) != 0) {
queryPeopleAll = queryPeopleAll.Where("exchange_cash_person_list.activity_id = ?", activityId)
}
queryPeopleAll = queryPeopleAll.Group("exchange_cash_person_list.uid")
... ... @@ -172,12 +185,12 @@ func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interfac
return nil, err
}
return map[string]interface{} {
"people": retPeople, // 员工排行榜
"count": count, // 计数
"currentEmployee": currentEmployee, // 当前员工排名
"exchangedSuMoney": activityExchangedSuMoney, // 清单已兑换素币
"exchangedCash": activityExchangedCash, // 清单已兑换现金
return map[string]interface{}{
"people": retPeople, // 员工排行榜
"count": count, // 计数
"currentEmployee": currentEmployee, // 当前员工排名
"exchangedSuMoney": activityExchangedSuMoney, // 清单已兑换素币
"exchangedCash": activityExchangedCash, // 清单已兑换现金
}, nil
}
... ... @@ -189,4 +202,4 @@ func NewCashPoolDao(transactionContext *pgTransaction.TransactionContext) (*Cash
transactionContext: transactionContext,
}, nil
}
}
\ No newline at end of file
}
... ...
... ... @@ -57,6 +57,18 @@ func (dao *EmployeeDao) ChangePrincipal(companyId int64, employeeAccount string)
return nil
}
// ChangePhone 修改用户手机号
func (dao *EmployeeDao) ChangePhone(oldPhone string, newPhone string) error {
tx := dao.transactionContext.PgTx
if _, err := tx.QueryOne(
pg.Scan(),
"UPDATE employees SET employee_account=? WHERE employee_account=?",
newPhone, oldPhone); err != nil {
return err
}
return nil
}
// 更新用户素币
func (dao *EmployeeDao) TransferSuMoney(uid int64, suMoney float64) error {
tx := dao.transactionContext.PgTx
... ... @@ -139,7 +151,7 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{
}
// 计算系统已兑换现金素币、未兑换素币
func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] interface{}, error) {
func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string]interface{}, error) {
var systemUnExchangeSuMoney float64
var systemExchangedSuMoney float64
var systemExchangedSuMoneyRestore float64
... ... @@ -172,18 +184,18 @@ func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] int
Select(&systemExchangedSuMoneyRestore); err != nil {
return nil, err
}
return map[string] interface{} {
return map[string]interface{}{
"systemUnExchangeSuMoney": systemUnExchangeSuMoney,
"systemExchangedSuMoney": systemExchangedSuMoney - systemExchangedSuMoneyRestore,
},nil
"systemExchangedSuMoney": systemExchangedSuMoney - systemExchangedSuMoneyRestore,
}, nil
}
// 计算现金池已兑换现金、未兑换现金
func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interface{}, error) {
func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string]interface{}, error) {
tx := dao.transactionContext.PgTx
var (
systemUnExchangeCash float64
systemExchangedCash float64
systemExchangedCash float64
)
// 系统已兑换现金
cashPool := new(models.CashPool)
... ... @@ -192,7 +204,7 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf
Where("cash_pool.company_id = ?", companyId).
Order("id DESC").
Limit(1).
Select(&systemExchangedCash) ; err != nil {
Select(&systemExchangedCash); err != nil {
return nil, err
}
// 系统未兑换现金
... ... @@ -201,22 +213,22 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf
Where("cash_pool.company_id = ?", companyId).
Order("id DESC").
Limit(1).
Select(&systemUnExchangeCash) ; err != nil {
Select(&systemUnExchangeCash); err != nil {
return nil, err
}
return map[string] interface{} {
return map[string]interface{}{
"systemUnExchangeCash": systemUnExchangeCash,
"systemExchangedCash": systemExchangedCash,
"systemExchangedCash": systemExchangedCash,
}, nil
}
// 计算个人素币收支(素币明细收支)
func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transactionStartTime time.Time, transactionEndTime time.Time) (map[string]interface{}, error) {
var (
incomeSuMoney float64 // 收入的素币(2:任务奖励,3:增加)
expendSuMoney float64 // 消耗的素币(1:兑换物资,4:扣除)
expendSuMoneyExchange float64 // 5: 兑换现金
incomeSuMoneyExchangeRestore float64 // 6: 兑换素币撤回
incomeSuMoney float64 // 收入的素币(2:任务奖励,3:增加)
expendSuMoney float64 // 消耗的素币(1:兑换物资,4:扣除)
expendSuMoneyExchange float64 // 5: 兑换现金
incomeSuMoneyExchangeRestore float64 // 6: 兑换素币撤回
)
tx := dao.transactionContext.PgTx
suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
... ... @@ -261,7 +273,7 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction
return nil, err
}
return map[string]interface{}{
"incomeSuMoney": incomeSuMoney, // 个人素币收入
"incomeSuMoney": incomeSuMoney, // 个人素币收入
"expendSuMoney": expendSuMoney + (expendSuMoneyExchange - incomeSuMoneyExchangeRestore), // 个人素币支出
}, nil
}
... ... @@ -269,8 +281,8 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction
// 计算个人贡献值收支(贡献明细收支)
func (dao *EmployeeDao) CalculateContributionsTransactionRecord(uid int64, transactionStartTime time.Time, transactionEndTime time.Time) (map[string]interface{}, error) {
var (
incomeContributions float64 // 收入的贡献值(2:任务奖励,3:增加)
expendContributions float64 // 支出的贡献值 (4: 扣除)
incomeContributions float64 // 收入的贡献值(2:任务奖励,3:增加)
expendContributions float64 // 支出的贡献值 (4: 扣除)
)
tx := dao.transactionContext.PgTx
suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
... ... @@ -301,37 +313,37 @@ func (dao *EmployeeDao) CalculateContributionsTransactionRecord(uid int64, trans
return nil, err
}
return map[string]interface{}{
"incomeContributions": incomeContributions, // 个人贡献值收入
"expendContributions": expendContributions, // 个人贡献支出
"contributions": incomeContributions - expendContributions, // 个人贡献值
"incomeContributions": incomeContributions, // 个人贡献值收入
"expendContributions": expendContributions, // 个人贡献支出
"contributions": incomeContributions - expendContributions, // 个人贡献值
}, nil
}
// 贡献值、财富值总榜和年榜,
func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]interface{}) (interface{}, error) {
var retWealth []struct { // 个人财富值
Uid int64
EmployeeName string
var retWealth []struct { // 个人财富值
Uid int64
EmployeeName string
EmployeeSuMoney float64
Ranking int
Ranking int
}
var retEmployeeWealth []struct { // 个人贡献值
Uid int64
EmployeeName string
var retEmployeeWealth []struct { // 个人贡献值
Uid int64
EmployeeName string
EmployeeSuMoney float64
Ranking int
Ranking int
}
var retContributions []struct { // 员工贡献值
Uid int64
EmployeeName string
var retContributions []struct { // 员工贡献值
Uid int64
EmployeeName string
EmployeesContributions float64
Ranking int
Ranking int
}
var retEmployeeContributions []struct { // 员工贡献值
Uid int64
EmployeeName string
var retEmployeeContributions []struct { // 员工贡献值
Uid int64
EmployeeName string
EmployeesContributions float64
Ranking int
Ranking int
}
tx := dao.transactionContext.PgTx
... ... @@ -496,23 +508,23 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
}
return map[string]interface{}{
"employeesWealth": retWealth,
"employeesContributions": retContributions,
"employeesWealth": retWealth,
"employeesContributions": retContributions,
"currentEmployeeContributions": retCurrentEmployeeContributions,
"currentEmployeeWealth": retCurrentEmployeeWealth,
"currentEmployeeWealth": retCurrentEmployeeWealth,
}, nil
}
// 公司员工贡献值分组统计
func (dao *EmployeeDao) CalculateEmployeesContributions(companyId int, startTime time.Time, endTime time.Time) (map[string]interface{}, error) {
var ret []struct { // 员工贡献值
Uid int
EmployeeName string
var ret []struct { // 员工贡献值
Uid int
EmployeeName string
EmployeesContributions float64
}
var retDecrease []struct { // 员工减少的贡献值
Uid int
EmployeeName string
var retDecrease []struct { // 员工减少的贡献值
Uid int
EmployeeName string
EmployeesContributions float64
}
tx := dao.transactionContext.PgTx
... ... @@ -562,8 +574,8 @@ func (dao *EmployeeDao) CalculateEmployeesContributions(companyId int, startTime
// 公司员工财富值分组统计
func (dao *EmployeeDao) CalculateEmployeesSuMoney(companyId int, startTime time.Time, endTime time.Time) (map[string]interface{}, error) {
var ret []struct {
Uid int
EmployeeName string
Uid int
EmployeeName string
EmployeeSuMoney float64
}
tx := dao.transactionContext.PgTx
... ... @@ -574,7 +586,7 @@ func (dao *EmployeeDao) CalculateEmployeesSuMoney(companyId int, startTime time.
ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money").
Where(`e.company_id = ?`, companyId).
//Where(`e.status = ?`, 1).
Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})). // 增加,任务奖励的
Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})). // 增加,任务奖励的
Where(`su_money_transaction_record.create_time > ?`, startTime).
Where(`su_money_transaction_record.create_time < ?`, endTime).
Group("su_money_transaction_record.employee").
... ...
package dao
import (
"fmt"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
)
type OffTaskRecordsDao struct {
transactionContext *pgTransaction.TransactionContext
}
//TODO ChangeOffTaskRecordsOperatorAccount
func (dao *OffTaskRecordsDao) ChangeOffTaskRecordsOperatorAccount() {
}
func NewOffTaskRecordsDao(transactionContext *pgTransaction.TransactionContext) (*OffTaskRecordsDao, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
} else {
return &OffTaskRecordsDao{
transactionContext: transactionContext,
}, nil
}
}
... ...
package dao
import (
"fmt"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
)
type RejectTaskRecordsDao struct {
transactionContext *pgTransaction.TransactionContext
}
//TODO ChangeRejectTaskRecordsOperatorAccount
func (dao *RejectTaskRecordsDao) ChangeRejectTaskRecordsOperatorAccount() {
}
func NewRejectTaskRecordsDao(transactionContext *pgTransaction.TransactionContext) (*RejectTaskRecordsDao, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
} else {
return &RejectTaskRecordsDao{
transactionContext: transactionContext,
}, nil
}
}
... ...
package dao
import (
"fmt"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
)
type RobInfosDao struct {
transactionContext *pgTransaction.TransactionContext
}
//TODO ChangeRobInfosReceiverAccount
func (dao *RobInfosDao) ChangeRobInfosReceiverAccount() {
}
func NewRobInfosDao(transactionContext *pgTransaction.TransactionContext) (*RobInfosDao, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
} else {
return &RobInfosDao{
transactionContext: transactionContext,
}, nil
}
}
... ...
package dao
import (
"fmt"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
)
type SentNotificationDao struct {
transactionContext *pgTransaction.TransactionContext
}
// ChangeSentNotificationReceiverAccount TODO 修改已发送通知用户信息
func (dao *SentNotificationDao) ChangeSentNotificationReceiverAccount() {
}
func NewSentNotificationDao(transactionContext *pgTransaction.TransactionContext) (*SentNotificationDao, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
} else {
return &SentNotificationDao{
transactionContext: transactionContext,
}, nil
}
}
... ...
package dao
import (
"fmt"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
)
type SuMoneyTransactionRecordsDao struct {
transactionContext *pgTransaction.TransactionContext
}
// ChangeSuMoneyTransactionRecordsEmployeeAccount TODO 修改素币流水记录用户信息
func (dao *SuMoneyTransactionRecordsDao) ChangeSuMoneyTransactionRecordsEmployeeAccount() {
}
// ChangeSuMoneyTransactionRecordsOperatorAccount TODO 素币流水记操作人信息
func (dao *SuMoneyTransactionRecordsDao) ChangeSuMoneyTransactionRecordsOperatorAccount() {
}
func NewSuMoneyTransactionRecordsDao(transactionContext *pgTransaction.TransactionContext) (*SuMoneyTransactionRecordsDao, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
} else {
return &SuMoneyTransactionRecordsDao{
transactionContext: transactionContext,
}, nil
}
}
... ...
... ... @@ -362,6 +362,26 @@ func (dao *TaskDao) CalculatePersonTask(uid int64, companyId int) (map[string]in
}, nil
}
//TODO ChangeSponsorAccount 修改sponsor手机号 jsonb
func (dao *TaskDao) ChangeSponsorAccount() {
}
//TODO ChangeParticipatorAccount 修改participator手机号 jsonb_array
func (dao *TaskDao) ChangeParticipatorAccount() {
}
//TODO ChangeTaskPercentageContributorAccount 修改task_percentage contributor手机号 jsonb_array
func (dao *TaskDao) ChangeTaskPercentageContributorAccount() {
}
//TODO ChangeAssignedPersonAccount 修改assigned_person手机号 jsonb
func (dao *TaskDao) ChangeAssignedPersonAccount() {
}
func NewTaskDao(transactionContext *pgTransaction.TransactionContext) (*TaskDao, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
... ...
package domain_service
import (
"fmt"
coreDomain "github.com/linmadan/egglib-go/core/domain"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain/event"
)
type ChangePhoneService struct {
coreDomain.BaseEventPublisher
transactionContext *pgTransaction.TransactionContext
}
func (service *ChangePhoneService) ChangePhone(oldPhone string, newPhone string) error {
changePhoneEvent := new(event.PhoneChanged)
changePhoneEvent.OldPhone = oldPhone
changePhoneEvent.NewPhone = newPhone
if err := service.Publish(changePhoneEvent); err != nil {
return err
}
return nil
}
func NewChangePhoneService(transactionContext *pgTransaction.TransactionContext) (*ChangePhoneService, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
} else {
return &ChangePhoneService{
transactionContext: transactionContext,
}, nil
}
}
... ...
package service_gateway
import (
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/constant"
"strings"
"time"
)
type HttplibWorthServiceGateway struct {
httplibBaseServiceGateway
}
// ChangePhoneCallback 修改手机号码回调,通知价值APP端中台
func (serviceGateway *HttplibWorthServiceGateway) ChangePhoneCallback(oldPhone string, newPhone string) (map[string]interface{}, error) {
url := strings.Join([]string{serviceGateway.baseURL, "/v1/auth/forceRevoke"}, "/")
request := serviceGateway.createRequest(url, "post")
options := make(map[string]interface{})
options["phone"] = oldPhone
options["newPhone"] = newPhone
request.JSONBody(options)
response := make(map[string]interface{})
request.ToJSON(&response)
data, err := serviceGateway.responseHandle(response)
return data, err
}
func NewHttplibWorthServiceGateway() *HttplibWorthServiceGateway {
return &HttplibWorthServiceGateway{
httplibBaseServiceGateway: httplibBaseServiceGateway{
baseURL: constant.ABILITY_SERVICE_HOST,
connectTimeout: 100 * time.Second,
readWriteTimeout: 30 * time.Second,
},
}
}
... ...
... ... @@ -14,3 +14,7 @@ type AbilityServiceGateway interface {
type MmmOpenApiServiceGateway interface {
PushInfo(msgType int, uids []int64, title string, content string, ext map[string]interface{}) (map[string]interface{}, error)
}
type WorthServiceGateway interface {
ChangePhoneCallback(oldPhone string, newPhone string) (map[string]interface{}, error)
}
... ...
... ... @@ -8,7 +8,7 @@ import (
/**
* @Author SteveChan
* @Description //TODO
* @Description
* @Date 16:50 2020/12/10
* @Param
* @return
... ... @@ -34,7 +34,7 @@ func StringSliceEqualBCE(a, b []int) bool {
/**
* @Author SteveChan
* @Description //TODO
* @Description
* @Date 16:50 2020/12/10
* @Param
* @return
... ... @@ -50,7 +50,7 @@ func IsContain(items []interface{}, item string) bool {
/**
* @Author SteveChan
* @Description //TODO
* @Description
* @Date 16:50 2020/12/10
* @Param
* @return
... ... @@ -80,7 +80,7 @@ func (l LocalDate) MarshalJSON() ([]byte, error) {
/**
* @Author SteveChan
* @Description //TODO
* @Description
* @Date 16:49 2020/12/10
* @Param
* @return
... ...