作者 陈志颖

合并分支 'dev' 到 'master'

Dev



查看合并请求 !7
正在显示 45 个修改的文件 包含 636 行增加318 行删除
1 -# 合伙人项目  
2 -vendor 文件夹如果不是迫不得已,请不要手动修改其中的文件!  
3 -如果手动修改vendor中的文件,需自行进行版本管理。(慎重考虑!慎重考虑!慎重考虑!)  
  1 +# 服务端工作交接事项
  2 +## 合伙人管理后台项目
  3 +
  4 +### 代码以及文档
  5 +- [代码地址](http://gitlab.fjmaimaimai.com/mmm-go/partnermg.git)
  6 +- [项目原型svn](svn://218.106.157.184/repo/项目文件/项目【合伙人】)
  7 +- [yapi-合伙人前端](http://47.97.5.102:36666/project/209/interface/api)
  8 +
  9 +服务端地址
  10 +```
  11 +测试开发环境pg数据库地址:114.55.200.59:31543,开发库:partner_dev,测试库:partner_test
  12 +正式环境pg数据库地址:114.55.200.59:31544,正式库:partner
  13 +
  14 +服务端开发环境地址:http://mmm-partnermg-dev.fjmaimaimai.com
  15 +服务端测试环境地址:http://mmm-partnermg-test.fjmaimaimai.com
  16 +服务端正式环境地址:https://public-interface.fjmaimaimai.com/mmm-partnermg
  17 +```
  18 +### 项目整体
  19 +- 项目使用框架
  20 + - http框架:beego
  21 + - orm框架:go-pg
  22 + - 数据存储:postgresql
  23 + - 项目结构分层:DDD领域驱动
  24 +
  25 +- 项目结构
  26 +```
  27 +├─conf 项目配置文件
  28 +├─deploy 项目部署文件
  29 +├─pkg
  30 +│ ├─application
  31 +│ │ ├─adminPermission 用户权限菜单
  32 +│ │ ├─businessBonus (在0.5.0后已经移除)
  33 +│ │ ├─company 企业公司功能
  34 +│ │ ├─event 事件订阅以及处理
  35 +│ │ ├─factory 工厂类,实例具体的实现(数据仓储)
  36 +│ │ ├─orderinfo 合伙人订单以及分红数据
  37 +│ │ ├─partnerCategory 合伙人分类信息
  38 +│ │ ├─partnerInfo 合伙人信息
  39 +│ │ ├─syncOrder 同步其他系统的订单数据
  40 +│ │ ├─unifiedUserCenter 从企业平台接收企业和管理员用户数据
  41 +│ │ └─users 管理员用户信息
  42 +│ ├─constant 变量配置(数据库等)
  43 +│ ├─domain 领域模型(核心数据处理,接口定义)
  44 +│ │ ├─event 领域事件定义
  45 +│ │ └─service 领域服务定义
  46 +│ ├─infrastructure 基础设施
  47 +│ │ ├─dao 特殊的数据库操作
  48 +│ │ ├─domainService 实现领域服务
  49 +│ │ ├─pg postgresql 数据库模型定义
  50 +│ │ ├─repository 数据仓储具体实现(对应domain定义数据库的数据存储接口)
  51 +│ │ ├─serviceGateway 其他系统服务调用
  52 +│ │
  53 +│ ├─lib
  54 +│ ├─log
  55 +│ └─port 数据接入层(http接入,消息)
  56 +│ ├─beego beego接入
  57 +│ └─consumer kafka消息订阅
  58 +└─vendor
  59 +```
  60 +### 系统对接的外部数据
  61 +
  62 +1. 外部数据来源,接收企业平台发送过来的数据。目前接收的是公司和员工的数据
  63 + 主要内容在文件夹
  64 + partnermg/pkg/application/unifiedUserCenter,
  65 + partnermg/pkg/port/beego/controller/sync_data_controller.go,
  66 + partnermg/pkg/port/beego/routers/routers.go,
  67 + 具体对接需要的数据格式文档地址:
  68 + [yapi-企业平台-子系统对接](http://47.97.5.102:36666/project/187/interface/api)
  69 +
  70 +2. 外部数据来源,接收香米小程序的订单,需要对接kafka消息。
  71 + 主要内容在
  72 + partnermg/pkg/application/syncOrder,
  73 + partnermg/pkg/port/consumer,
  74 + 具体对接需要的数据格式文档地址:
  75 + [yapi-合伙人-后端](http://47.97.5.102:36666/project/211/interface/api/9013)
  76 +
  77 +3. 需要调用外部的api接口,调用企业平台,统一用户中心的接口
  78 + 主要内容在
  79 + partnermg/pkg/infrastructure/serviceGateway
  80 +
  81 +### 系统入口
  82 +- [测试环境--企业平台网站地址](https://enterprise-platform-dev.fjmaimaimai.com)
  83 +- [开发环境--企业平台网站地址](https://enterprise-platform-local.fjmaimaimai.com)
  84 +- 天联共创后台自身没有独立的登录入口,需要经过企业平台进行跳转登录
  85 +
  86 +
  87 +## 建议
  88 +1. vendor 目前作用是存放依赖,加快在容器中的构建速度。
  89 +2. 有"go.mod"文件存在,可以直接删除vendor文件夹。不过相应的dockerfile 也要进行一定的修改。
  90 +3. vendor 文件夹如果不是迫不得已,请不要手动修改其中的文件!可以使用命令 “go mod vendor”。
  91 +如果手动修改vendor中的文件,需自行进行版本管理。(慎重考虑!慎重考虑!慎重考虑!)。
  92 +
  93 +
@@ -4,7 +4,6 @@ go 1.14 @@ -4,7 +4,6 @@ go 1.14
4 4
5 require ( 5 require (
6 github.com/360EntSecGroup-Skylar/excelize/v2 v2.3.1 6 github.com/360EntSecGroup-Skylar/excelize/v2 v2.3.1
7 - github.com/GeeTeam/gt3-golang-sdk v0.0.0-20200116043922-446ca8a507d2  
8 github.com/Shopify/sarama v1.23.1 7 github.com/Shopify/sarama v1.23.1
9 github.com/ajg/form v1.5.1 // indirect 8 github.com/ajg/form v1.5.1 // indirect
10 github.com/astaxie/beego v1.12.2 9 github.com/astaxie/beego v1.12.2
@@ -17,7 +17,7 @@ type CreatePartnerInfoCommand struct { @@ -17,7 +17,7 @@ type CreatePartnerInfoCommand struct {
17 // 状态(1:启用或者0:禁用) 17 // 状态(1:启用或者0:禁用)
18 Status int `json:"status"` 18 Status int `json:"status"`
19 // 合伙类别 19 // 合伙类别
20 - PartnerCategory []int64 `json:"partnerCategory,omitempty"` 20 + PartnerCategory []*domain.PartnerCategory `json:"partnerCategory,omitempty"`
21 //合作时间 21 //合作时间
22 CooperateTime time.Time `json:"cooperateTime"` 22 CooperateTime time.Time `json:"cooperateTime"`
23 // 区域 23 // 区域
@@ -26,6 +26,8 @@ type CreatePartnerInfoCommand struct { @@ -26,6 +26,8 @@ type CreatePartnerInfoCommand struct {
26 Salesman []domain.Salesman `json:"salesman,omitempty"` 26 Salesman []domain.Salesman `json:"salesman,omitempty"`
27 //公司id 27 //公司id
28 CompanyId int64 `json:"companyId"` 28 CompanyId int64 `json:"companyId"`
  29 + //备注
  30 + Remark string `json:"remark"`
29 } 31 }
30 32
31 func (command CreatePartnerInfoCommand) ValidateCommand() error { 33 func (command CreatePartnerInfoCommand) ValidateCommand() error {
  1 +/**
  2 + @author: stevechan
  3 + @date: 2020/12/29
  4 + @note:
  5 +**/
  6 +
  7 +package command
  8 +
  9 +import (
  10 + "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/lib"
  11 +)
  12 +
  13 +// 移除合伙人
  14 +type RemovePartnerInfoCommand struct {
  15 + // 合伙人Id
  16 + Id int64 `json:"id" valid:"Required"`
  17 +}
  18 +
  19 +func (command *RemovePartnerInfoCommand) ValidateCommand() error {
  20 + if command.Id == 0 {
  21 + return lib.ThrowError(lib.ARG_ERROR, "合伙人id错误")
  22 + }
  23 + return nil
  24 +}
@@ -10,10 +10,12 @@ import ( @@ -10,10 +10,12 @@ import (
10 type UpdatePartnerInfoCommand struct { 10 type UpdatePartnerInfoCommand struct {
11 // 合伙人Id 11 // 合伙人Id
12 Id int64 `json:"id"` 12 Id int64 `json:"id"`
  13 + // 合伙人姓名
  14 + PartnerName string `json:"partnerName"`
13 // 状态(1:启用或者0:禁用) 15 // 状态(1:启用或者0:禁用)
14 Status int `json:"status"` 16 Status int `json:"status"`
15 // 合伙类别 (1.研发合伙人 2.业务合伙人 3.事业) 17 // 合伙类别 (1.研发合伙人 2.业务合伙人 3.事业)
16 - PartnerCategory []int64 `json:"partnerCategory,omitempty"` 18 + PartnerCategory []*domain.PartnerCategory `json:"partnerCategory,omitempty"`
17 // 区域 19 // 区域
18 RegionInfo *domain.RegionInfo `json:"regionInfo"` 20 RegionInfo *domain.RegionInfo `json:"regionInfo"`
19 //关联业务员 21 //关联业务员
@@ -22,6 +24,8 @@ type UpdatePartnerInfoCommand struct { @@ -22,6 +24,8 @@ type UpdatePartnerInfoCommand struct {
22 CooperateTime time.Time `json:"cooperateTime"` 24 CooperateTime time.Time `json:"cooperateTime"`
23 //公司id 25 //公司id
24 CompanyId int64 `json:"companyId"` 26 CompanyId int64 `json:"companyId"`
  27 + //备注
  28 + Remark string `json:"remark"`
25 } 29 }
26 30
27 func (command *UpdatePartnerInfoCommand) ValidateCommand() error { 31 func (command *UpdatePartnerInfoCommand) ValidateCommand() error {
@@ -31,7 +35,6 @@ func (command *UpdatePartnerInfoCommand) ValidateCommand() error { @@ -31,7 +35,6 @@ func (command *UpdatePartnerInfoCommand) ValidateCommand() error {
31 if command.RegionInfo == nil { 35 if command.RegionInfo == nil {
32 return lib.ThrowError(lib.ARG_ERROR, "区域必填") 36 return lib.ThrowError(lib.ARG_ERROR, "区域必填")
33 } 37 }
34 -  
35 if command.Id == 0 { 38 if command.Id == 0 {
36 return lib.ThrowError(lib.ARG_ERROR, "合伙人id错误") 39 return lib.ThrowError(lib.ARG_ERROR, "合伙人id错误")
37 } 40 }
@@ -2,11 +2,12 @@ package query @@ -2,11 +2,12 @@ package query
2 2
3 type ListPartnerInfoQuery struct { 3 type ListPartnerInfoQuery struct {
4 // 合伙人类别 4 // 合伙人类别
5 - Partnertype int `json:"partnerType"` 5 + PartnerType int `json:"partnerType"`
6 //所属区域 6 //所属区域
7 RegionInfo string `json:"regionInfo"` 7 RegionInfo string `json:"regionInfo"`
8 // 合伙人姓名 8 // 合伙人姓名
9 PartnerName string `json:"partnerName"` 9 PartnerName string `json:"partnerName"`
  10 + // 公司id
10 CompanyId int64 `json:"companyId"` 11 CompanyId int64 `json:"companyId"`
11 // 查询偏离量 12 // 查询偏离量
12 Offset int `json:"offset"` 13 Offset int `json:"offset"`
@@ -15,6 +16,5 @@ type ListPartnerInfoQuery struct { @@ -15,6 +16,5 @@ type ListPartnerInfoQuery struct {
15 } 16 }
16 17
17 func (q *ListPartnerInfoQuery) ValidateQuery() error { 18 func (q *ListPartnerInfoQuery) ValidateQuery() error {
18 -  
19 return nil 19 return nil
20 } 20 }
@@ -21,7 +21,13 @@ func NewPartnerInfoService(options map[string]interface{}) *PartnerInfoService { @@ -21,7 +21,13 @@ func NewPartnerInfoService(options map[string]interface{}) *PartnerInfoService {
21 return newPartnerInfoService 21 return newPartnerInfoService
22 } 22 }
23 23
24 -// CreatePartnerInfo 创建合伙人 24 +/**
  25 + * @Author SteveChan
  26 + * @Description // 创建合伙人
  27 + * @Date 15:42 2020/12/29
  28 + * @Param
  29 + * @return
  30 + **/
25 func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.CreatePartnerInfoCommand) (data *domain.PartnerInfo, err error) { 31 func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.CreatePartnerInfoCommand) (data *domain.PartnerInfo, err error) {
26 var ( 32 var (
27 transactionContext, _ = factory.CreateTransactionContext(nil) 33 transactionContext, _ = factory.CreateTransactionContext(nil)
@@ -35,16 +41,21 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre @@ -35,16 +41,21 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre
35 defer func() { 41 defer func() {
36 transactionContext.RollbackTransaction() 42 transactionContext.RollbackTransaction()
37 }() 43 }()
  44 +
38 //检查账号是否存在 45 //检查账号是否存在
39 var ( 46 var (
40 - partnerinfoDao *dao.PartnerInfoDao 47 + partnerInfoDao *dao.PartnerInfoDao
  48 + partnerInfoRepository domain.PartnerInfoRepository
  49 + categoryRepository domain.PartnerCategoryRepository
  50 + categories []domain.PartnerCategory
41 ) 51 )
42 - if partnerinfoDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{ 52 + if partnerInfoDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{
43 "transactionContext": transactionContext, 53 "transactionContext": transactionContext,
44 }); err != nil { 54 }); err != nil {
45 return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error()) 55 return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
46 } 56 }
47 - ok, err := partnerinfoDao.PartnerAccountExist(cmd.Account, cmd.CompanyId) 57 +
  58 + ok, err := partnerInfoDao.PartnerAccountExist(cmd.Account, cmd.CompanyId)
48 if err != nil { 59 if err != nil {
49 return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error()) 60 return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
50 } 61 }
@@ -52,11 +63,6 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre @@ -52,11 +63,6 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre
52 return nil, lib.ThrowError(lib.BUSINESS_ERROR, "账号已存在") 63 return nil, lib.ThrowError(lib.BUSINESS_ERROR, "账号已存在")
53 } 64 }
54 65
55 - var (  
56 - partnerInfoRepository domain.PartnerInfoRepository  
57 - categoryRepository domain.PartnerCategoryRepository  
58 - categorys []domain.PartnerCategory  
59 - )  
60 if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{ 66 if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
61 "transactionContext": transactionContext, 67 "transactionContext": transactionContext,
62 }); err != nil { 68 }); err != nil {
@@ -67,13 +73,60 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre @@ -67,13 +73,60 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre
67 }); err != nil { 73 }); err != nil {
68 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 74 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
69 } 75 }
70 - _, categorys, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{  
71 - Ids: cmd.PartnerCategory, 76 +
  77 + // 获取所有合伙人类型
  78 + var categoryMap = make(map[int64]string)
  79 + _, categories, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
  80 + Ids: []int64{},
  81 + })
  82 + if err != nil {
  83 + e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
  84 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
  85 + }
  86 + if len(categories) > 0 {
  87 + for _, category := range categories {
  88 + categoryMap[category.Id] = category.Name
  89 + }
  90 + }
  91 +
  92 + // id去重
  93 + num := make(map[int64]bool)
  94 + for _, partnerCategory := range cmd.PartnerCategory {
  95 + if !num[partnerCategory.Id] {
  96 + num[partnerCategory.Id] = true
  97 + } else {
  98 + return nil, lib.ThrowError(lib.BUSINESS_ERROR, "合伙类型不能重复")
  99 + }
  100 + }
  101 +
  102 + // 编号去重
  103 + for _, partnerCategory := range cmd.PartnerCategory {
  104 + if ok, err := partnerInfoDao.PartnerCodeExist(partnerCategory.Id, partnerCategory.Code, cmd.CompanyId, 0); err != nil {
  105 + return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
  106 + } else if ok {
  107 + return nil, lib.ThrowError(lib.BUSINESS_ERROR, categoryMap[partnerCategory.Id]+"编号"+partnerCategory.Code+"已存在")
  108 + }
  109 + }
  110 +
  111 + var ids []int64
  112 + for _, partnerCategory := range cmd.PartnerCategory {
  113 + ids = append(ids, partnerCategory.Id)
  114 + }
  115 + _, categories, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
  116 + Ids: ids,
72 }) 117 })
73 if err != nil { 118 if err != nil {
74 e := fmt.Sprintf("获取合伙人分类数据失败:%s", err) 119 e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
75 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e) 120 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
76 } 121 }
  122 + for i, category := range categories {
  123 + for _, partnerCategory := range cmd.PartnerCategory {
  124 + if category.Id == partnerCategory.Id {
  125 + categories[i].Code = partnerCategory.Code
  126 + }
  127 + }
  128 + }
  129 +
77 newPartnerInfo := domain.PartnerInfo{ 130 newPartnerInfo := domain.PartnerInfo{
78 Partner: domain.Partner{ 131 Partner: domain.Partner{
79 Account: cmd.Account, 132 Account: cmd.Account,
@@ -86,7 +139,8 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre @@ -86,7 +139,8 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre
86 Salesman: cmd.Salesman, 139 Salesman: cmd.Salesman,
87 CooperateTime: cmd.CooperateTime, 140 CooperateTime: cmd.CooperateTime,
88 CompanyId: cmd.CompanyId, 141 CompanyId: cmd.CompanyId,
89 - PartnerCategoryInfos: categorys, 142 + PartnerCategoryInfos: categories,
  143 + Remark: cmd.Remark,
90 } 144 }
91 if err = partnerInfoRepository.Save(&newPartnerInfo); err != nil { 145 if err = partnerInfoRepository.Save(&newPartnerInfo); err != nil {
92 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 146 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
@@ -106,11 +160,18 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre @@ -106,11 +160,18 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(cmd *command.Cre
106 return &newPartnerInfo, nil 160 return &newPartnerInfo, nil
107 } 161 }
108 162
109 -// GetPartnerInfo 返回合伙人 163 +/**
  164 + * @Author SteveChan
  165 + * @Description // 返回合伙人,增加合伙人编号字段
  166 + * @Date 15:43 2020/12/29
  167 + * @Param
  168 + * @return
  169 + **/
110 func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerInfoQuery) (data *domain.PartnerInfo, err error) { 170 func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerInfoQuery) (data *domain.PartnerInfo, err error) {
111 var ( 171 var (
112 transactionContext, _ = factory.CreateTransactionContext(nil) 172 transactionContext, _ = factory.CreateTransactionContext(nil)
113 ) 173 )
  174 +
114 if err = q.ValidateQuery(); err != nil { 175 if err = q.ValidateQuery(); err != nil {
115 return nil, lib.ThrowError(lib.ARG_ERROR, err.Error()) 176 return nil, lib.ThrowError(lib.ARG_ERROR, err.Error())
116 } 177 }
@@ -120,17 +181,21 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI @@ -120,17 +181,21 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI
120 defer func() { 181 defer func() {
121 transactionContext.RollbackTransaction() 182 transactionContext.RollbackTransaction()
122 }() 183 }()
  184 +
123 var ( 185 var (
124 PartnerInfoRepository domain.PartnerInfoRepository 186 PartnerInfoRepository domain.PartnerInfoRepository
125 categoryRepository domain.PartnerCategoryRepository 187 categoryRepository domain.PartnerCategoryRepository
126 - categorys []domain.PartnerCategory 188 + categories []domain.PartnerCategory
127 partnerData *domain.PartnerInfo 189 partnerData *domain.PartnerInfo
128 ) 190 )
  191 +
129 if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{ 192 if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
130 "transactionContext": transactionContext, 193 "transactionContext": transactionContext,
131 }); err != nil { 194 }); err != nil {
132 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 195 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
133 } 196 }
  197 +
  198 + // 获取合伙人数据
134 partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{ 199 partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
135 UserId: q.Id, CompanyId: q.CompanyId, 200 UserId: q.Id, CompanyId: q.CompanyId,
136 }) 201 })
@@ -140,33 +205,49 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI @@ -140,33 +205,49 @@ func (PartnerInfoService *PartnerInfoService) GetPartnerInfo(q query.GetPartnerI
140 if !partnerData.IsCompany(q.CompanyId) { 205 if !partnerData.IsCompany(q.CompanyId) {
141 return nil, lib.ThrowError(lib.BUSINESS_ERROR, "企业信息异常操作") 206 return nil, lib.ThrowError(lib.BUSINESS_ERROR, "企业信息异常操作")
142 } 207 }
  208 +
  209 + // 获取合伙人类别
143 if categoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{ 210 if categoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{
144 "transactionContext": transactionContext, 211 "transactionContext": transactionContext,
145 }); err != nil { 212 }); err != nil {
146 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 213 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
147 } 214 }
148 - categoryIds := []int64{} 215 + var categoryIds []int64
149 for _, v := range partnerData.PartnerCategoryInfos { 216 for _, v := range partnerData.PartnerCategoryInfos {
150 categoryIds = append(categoryIds, v.Id) 217 categoryIds = append(categoryIds, v.Id)
151 } 218 }
152 if len(categoryIds) > 0 { 219 if len(categoryIds) > 0 {
153 - _, categorys, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{ 220 + _, categories, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
154 Ids: categoryIds, 221 Ids: categoryIds,
155 }) 222 })
156 if err != nil { 223 if err != nil {
157 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 224 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
158 } 225 }
  226 + for i, category := range categories {
  227 + for _, partnerCategory := range partnerData.PartnerCategoryInfos {
  228 + if category.Id == partnerCategory.Id {
  229 + categories[i].Code = partnerCategory.Code
  230 + }
159 } 231 }
160 - partnerData.PartnerCategoryInfos = categorys 232 + }
  233 + }
  234 + partnerData.PartnerCategoryInfos = categories
161 err = transactionContext.CommitTransaction() 235 err = transactionContext.CommitTransaction()
162 return partnerData, nil 236 return partnerData, nil
163 } 237 }
164 238
165 -//UpdatePartnerInfo 更新合伙人 239 +/**
  240 + * @Author SteveChan
  241 + * @Description // 更新合伙人
  242 + * @Date 00:07 2020/12/30
  243 + * @Param
  244 + * @return
  245 + **/
166 func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.UpdatePartnerInfoCommand) (err error) { 246 func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.UpdatePartnerInfoCommand) (err error) {
167 var ( 247 var (
168 transactionContext, _ = factory.CreateTransactionContext(nil) 248 transactionContext, _ = factory.CreateTransactionContext(nil)
169 ) 249 )
  250 +
170 if err = cmd.ValidateCommand(); err != nil { 251 if err = cmd.ValidateCommand(); err != nil {
171 return application.ThrowError(application.ARG_ERROR, err.Error()) 252 return application.ThrowError(application.ARG_ERROR, err.Error())
172 } 253 }
@@ -176,30 +257,90 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd @@ -176,30 +257,90 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd
176 defer func() { 257 defer func() {
177 transactionContext.RollbackTransaction() 258 transactionContext.RollbackTransaction()
178 }() 259 }()
  260 +
179 var ( 261 var (
180 partnerInfoRepository domain.PartnerInfoRepository 262 partnerInfoRepository domain.PartnerInfoRepository
181 categoryRepository domain.PartnerCategoryRepository 263 categoryRepository domain.PartnerCategoryRepository
182 - categorys []domain.PartnerCategory 264 + categories []domain.PartnerCategory
  265 + partnerInfoDao *dao.PartnerInfoDao
183 ) 266 )
  267 +
  268 + if partnerInfoDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{
  269 + "transactionContext": transactionContext,
  270 + }); err != nil {
  271 + return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
  272 + }
  273 +
184 if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{ 274 if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
185 "transactionContext": transactionContext, 275 "transactionContext": transactionContext,
186 }); err != nil { 276 }); err != nil {
187 return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error()) 277 return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
188 } 278 }
  279 +
189 if categoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{ 280 if categoryRepository, err = factory.CreatePartnerCategoryRepository(map[string]interface{}{
190 "transactionContext": transactionContext, 281 "transactionContext": transactionContext,
191 }); err != nil { 282 }); err != nil {
192 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 283 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
193 } 284 }
194 - _, categorys, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{  
195 - Ids: cmd.PartnerCategory, 285 +
  286 + // 获取合伙人类型
  287 + var categoryMap = make(map[int64]string)
  288 + _, categories, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
  289 + Ids: []int64{},
  290 + })
  291 + if err != nil {
  292 + e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
  293 + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
  294 + }
  295 + if len(categories) > 0 {
  296 + for _, category := range categories {
  297 + categoryMap[category.Id] = category.Name
  298 + }
  299 + }
  300 +
  301 + // id去重
  302 + num := make(map[int64]bool)
  303 + for _, partnerCategory := range cmd.PartnerCategory {
  304 + if !num[partnerCategory.Id] {
  305 + num[partnerCategory.Id] = true
  306 + } else {
  307 + return lib.ThrowError(lib.BUSINESS_ERROR, "合伙类型不能重复")
  308 + }
  309 + }
  310 +
  311 + // 编号去重
  312 + for _, partnerCategory := range cmd.PartnerCategory {
  313 + if ok, err := partnerInfoDao.PartnerCodeExist(partnerCategory.Id, partnerCategory.Code, cmd.CompanyId, cmd.Id); err != nil {
  314 + return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
  315 + } else if ok {
  316 + return lib.ThrowError(lib.BUSINESS_ERROR, categoryMap[partnerCategory.Id]+"编号"+partnerCategory.Code+"已存在")
  317 + }
  318 + }
  319 +
  320 + var ids []int64
  321 + for _, partnerCategory := range cmd.PartnerCategory {
  322 + ids = append(ids, partnerCategory.Id)
  323 + }
  324 +
  325 + _, categories, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{
  326 + Ids: ids,
196 }) 327 })
197 if err != nil { 328 if err != nil {
198 e := fmt.Sprintf("获取合伙人分类数据失败:%s", err) 329 e := fmt.Sprintf("获取合伙人分类数据失败:%s", err)
199 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e) 330 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
200 } 331 }
  332 +
  333 + for i, category := range categories {
  334 + for _, partnerCategory := range cmd.PartnerCategory {
  335 + if category.Id == partnerCategory.Id {
  336 + categories[i].Code = partnerCategory.Code
  337 + }
  338 + }
  339 + }
  340 +
201 partnerInfo, err := partnerInfoRepository.FindOne(domain.PartnerFindOneQuery{ 341 partnerInfo, err := partnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
202 - UserId: cmd.Id, CompanyId: cmd.CompanyId, 342 + UserId: cmd.Id,
  343 + CompanyId: cmd.CompanyId,
203 }) 344 })
204 if err != nil { 345 if err != nil {
205 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 346 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
@@ -207,11 +348,15 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd @@ -207,11 +348,15 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd
207 if !partnerInfo.IsCompany(cmd.CompanyId) { 348 if !partnerInfo.IsCompany(cmd.CompanyId) {
208 return lib.ThrowError(lib.BUSINESS_ERROR, "异常操作") 349 return lib.ThrowError(lib.BUSINESS_ERROR, "异常操作")
209 } 350 }
  351 +
  352 + partnerInfo.Partner.PartnerName = cmd.PartnerName
210 partnerInfo.Salesman = cmd.Salesman 353 partnerInfo.Salesman = cmd.Salesman
211 partnerInfo.Status = cmd.Status 354 partnerInfo.Status = cmd.Status
212 partnerInfo.RegionInfo = *cmd.RegionInfo 355 partnerInfo.RegionInfo = *cmd.RegionInfo
213 partnerInfo.CooperateTime = cmd.CooperateTime 356 partnerInfo.CooperateTime = cmd.CooperateTime
214 - partnerInfo.PartnerCategoryInfos = categorys 357 + partnerInfo.PartnerCategoryInfos = categories
  358 + partnerInfo.Remark = cmd.Remark
  359 +
215 if err = partnerInfoRepository.Save(partnerInfo); err != nil { 360 if err = partnerInfoRepository.Save(partnerInfo); err != nil {
216 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 361 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
217 } 362 }
@@ -231,7 +376,13 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd @@ -231,7 +376,13 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(cmd *command.Upd
231 return 376 return
232 } 377 }
233 378
234 -// ListPartnerInfo 合伙人列表 379 +/**
  380 + * @Author SteveChan
  381 + * @Description //合伙人列表,返回合伙人编号
  382 + * @Date 00:07 2020/12/30
  383 + * @Param
  384 + * @return
  385 + **/
235 func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQuery *query.ListPartnerInfoQuery) (int, []domain.PartnerInfo, error) { 386 func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQuery *query.ListPartnerInfoQuery) (int, []domain.PartnerInfo, error) {
236 var ( 387 var (
237 transactionContext, _ = factory.CreateTransactionContext(nil) 388 transactionContext, _ = factory.CreateTransactionContext(nil)
@@ -246,14 +397,13 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue @@ -246,14 +397,13 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue
246 return 0, nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error()) 397 return 0, nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
247 } 398 }
248 defer func() { 399 defer func() {
249 -  
250 transactionContext.RollbackTransaction() 400 transactionContext.RollbackTransaction()
251 -  
252 }() 401 }()
  402 +
253 var ( 403 var (
254 partnerInfoRepository domain.PartnerInfoRepository 404 partnerInfoRepository domain.PartnerInfoRepository
255 categoryRepository domain.PartnerCategoryRepository 405 categoryRepository domain.PartnerCategoryRepository
256 - categorys []domain.PartnerCategory 406 + categories []domain.PartnerCategory
257 ) 407 )
258 if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{ 408 if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
259 "transactionContext": transactionContext, 409 "transactionContext": transactionContext,
@@ -271,8 +421,8 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue @@ -271,8 +421,8 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue
271 PartnerName: listPartnerInfoQuery.PartnerName, 421 PartnerName: listPartnerInfoQuery.PartnerName,
272 CompanyId: listPartnerInfoQuery.CompanyId, 422 CompanyId: listPartnerInfoQuery.CompanyId,
273 } 423 }
274 - if listPartnerInfoQuery.Partnertype > 0 {  
275 - queryOption.PartnerCategory = []int{listPartnerInfoQuery.Partnertype} 424 + if listPartnerInfoQuery.PartnerType > 0 {
  425 + queryOption.PartnerCategory = []int{listPartnerInfoQuery.PartnerType}
276 } 426 }
277 // RegionInfo 427 // RegionInfo
278 if len(listPartnerInfoQuery.RegionInfo) > 0 { 428 if len(listPartnerInfoQuery.RegionInfo) > 0 {
@@ -284,18 +434,19 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue @@ -284,18 +434,19 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue
284 if count, err = partnerInfoRepository.CountAll(queryOption); err != nil { 434 if count, err = partnerInfoRepository.CountAll(queryOption); err != nil {
285 return 0, nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 435 return 0, nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
286 } 436 }
287 - _, categorys, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{}) 437 + _, categories, err = categoryRepository.Find(domain.PartnerCategoryFindQuery{})
288 if err != nil { 438 if err != nil {
289 return count, partnerInfos, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 439 return count, partnerInfos, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
290 } 440 }
291 - categorysMap := make(map[int64]domain.PartnerCategory)  
292 - for i := range categorys {  
293 - categorysMap[categorys[i].Id] = categorys[i] 441 + categoriesMap := make(map[int64]domain.PartnerCategory)
  442 + for i := range categories {
  443 + categoriesMap[categories[i].Id] = categories[i]
294 } 444 }
295 for i := range partnerInfos { 445 for i := range partnerInfos {
296 - categoryInPartner := []domain.PartnerCategory{} 446 + var categoryInPartner []domain.PartnerCategory
297 for _, vv := range partnerInfos[i].PartnerCategoryInfos { 447 for _, vv := range partnerInfos[i].PartnerCategoryInfos {
298 - if categoryData, ok := categorysMap[vv.Id]; ok { 448 + if categoryData, ok := categoriesMap[vv.Id]; ok {
  449 + categoryData.Code = vv.Code
299 categoryInPartner = append(categoryInPartner, categoryData) 450 categoryInPartner = append(categoryInPartner, categoryData)
300 } 451 }
301 } 452 }
@@ -307,6 +458,61 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue @@ -307,6 +458,61 @@ func (PartnerInfoService *PartnerInfoService) ListPartnerInfo(listPartnerInfoQue
307 return count, partnerInfos, nil 458 return count, partnerInfos, nil
308 } 459 }
309 460
  461 +/**
  462 + * @Author SteveChan
  463 + * @Description // 移除合伙人
  464 + * @Date 16:40 2020/12/29
  465 + * @Param
  466 + * @return
  467 + **/
  468 +func (PartnerInfoService *PartnerInfoService) RemovePartnerInfo(cmd command.RemovePartnerInfoCommand) (err error) {
  469 + var (
  470 + transactionContext, _ = factory.CreateTransactionContext(nil)
  471 + )
  472 + if err = cmd.ValidateCommand(); err != nil {
  473 + return application.ThrowError(application.ARG_ERROR, err.Error())
  474 + }
  475 + if err = transactionContext.StartTransaction(); err != nil {
  476 + return err
  477 + }
  478 + defer func() {
  479 + transactionContext.RollbackTransaction()
  480 + }()
  481 +
  482 + var (
  483 + partnerInfoRepository domain.PartnerInfoRepository
  484 + orderBaseRepository domain.OrderBaseRepository
  485 + orders []domain.OrderBase
  486 + )
  487 +
  488 + if partnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
  489 + "transactionContext": transactionContext,
  490 + }); err != nil {
  491 + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  492 + }
  493 +
  494 + if orderBaseRepository, err = factory.CreateOrderBaseRepository(map[string]interface{}{
  495 + "transactionContext": transactionContext,
  496 + }); err != nil {
  497 + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  498 + }
  499 +
  500 + // 判断合伙人是否有业务数据
  501 + orders, _, err = orderBaseRepository.Find(domain.OrderBaseFindQuery{
  502 + PartnerId: cmd.Id,
  503 + })
  504 + if len(orders) > 0 {
  505 + return lib.ThrowError(lib.BUSINESS_ERROR, "该合伙人有业务数据,不可删除!")
  506 + }
  507 +
  508 + if err = partnerInfoRepository.Remove(cmd.Id); err != nil {
  509 + return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  510 + }
  511 +
  512 + transactionContext.CommitTransaction()
  513 + return nil
  514 +}
  515 +
310 func (PartnerInfoService *PartnerInfoService) UpdateStatus(cmd command.StatusPartnerInfoCommand) (err error) { 516 func (PartnerInfoService *PartnerInfoService) UpdateStatus(cmd command.StatusPartnerInfoCommand) (err error) {
311 if len(cmd.Ids) == 0 { 517 if len(cmd.Ids) == 0 {
312 return nil 518 return nil
@@ -324,14 +530,14 @@ func (PartnerInfoService *PartnerInfoService) UpdateStatus(cmd command.StatusPar @@ -324,14 +530,14 @@ func (PartnerInfoService *PartnerInfoService) UpdateStatus(cmd command.StatusPar
324 transactionContext.RollbackTransaction() 530 transactionContext.RollbackTransaction()
325 }() 531 }()
326 var ( 532 var (
327 - partnerinfoDao *dao.PartnerInfoDao 533 + partnerInfoDao *dao.PartnerInfoDao
328 ) 534 )
329 - if partnerinfoDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{ 535 + if partnerInfoDao, err = factory.CreatePartnerInfoDao(map[string]interface{}{
330 "transactionContext": transactionContext, 536 "transactionContext": transactionContext,
331 }); err != nil { 537 }); err != nil {
332 return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error()) 538 return lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
333 } 539 }
334 - err = partnerinfoDao.UpdatePartnerStatus(cmd.Ids, cmd.CompanyId, cmd.Status) 540 + err = partnerInfoDao.UpdatePartnerStatus(cmd.Ids, cmd.CompanyId, cmd.Status)
335 if err != nil { 541 if err != nil {
336 e := fmt.Sprintf("更新合伙人(id=%v)的数据失败;%s", cmd.Ids, err) 542 e := fmt.Sprintf("更新合伙人(id=%v)的数据失败;%s", cmd.Ids, err)
337 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e) 543 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
@@ -16,7 +16,7 @@ import ( @@ -16,7 +16,7 @@ import (
16 16
17 //从其他系统接收订单数据 17 //从其他系统接收订单数据
18 const ( 18 const (
19 - BEST_SHOP_UNIONID string = "gh_18eb644002fb" //海鲜干货小程序原始id 19 + BEST_SHOP_UNIONID string = "gh_18eb644002fb" //香米小程序原始id
20 ) 20 )
21 21
22 type SyncOrderService struct { 22 type SyncOrderService struct {
@@ -79,6 +79,7 @@ func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBests @@ -79,6 +79,7 @@ func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBests
79 // 79 //
80 logs.Warning("订单数据已存在:order_code=%s", cmd.OrderCode) 80 logs.Warning("订单数据已存在:order_code=%s", cmd.OrderCode)
81 } else { 81 } else {
  82 + //复制数据到order_base表
82 err = s.CreateOrderFromBestshop(cmd) 83 err = s.CreateOrderFromBestshop(cmd)
83 } 84 }
84 return err 85 return err
@@ -225,6 +226,8 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord @@ -225,6 +226,8 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord
225 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e) 226 return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
226 } 227 }
227 for _, v := range companyData.Applets { 228 for _, v := range companyData.Applets {
  229 + //BEST_SHOP_UNIONID string = "gh_18eb644002fb" //香米小程序原始id
  230 + //接收香米小程序的订单数据
228 if len(v.Id) > 0 { 231 if len(v.Id) > 0 {
229 canCopyOrder = true 232 canCopyOrder = true
230 } 233 }
@@ -237,7 +240,7 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord @@ -237,7 +240,7 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord
237 orderbase domain.OrderBase 240 orderbase domain.OrderBase
238 ordergoods []domain.OrderGood 241 ordergoods []domain.OrderGood
239 ) 242 )
240 - //TODO 添加orderBase 243 + //添加orderBase
241 orderBestshop.CopyToOrderBase(&orderbase) 244 orderBestshop.CopyToOrderBase(&orderbase)
242 orderbase.CompanyId = companyData.Id 245 orderbase.CompanyId = companyData.Id
243 for i := range orderBestshop.Goods { 246 for i := range orderBestshop.Goods {
@@ -245,13 +248,15 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord @@ -245,13 +248,15 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord
245 orderBestshop.Goods[i].CopyToOrderGood(&good) 248 orderBestshop.Goods[i].CopyToOrderGood(&good)
246 good.CompanyId = partnerData.CompanyId 249 good.CompanyId = partnerData.CompanyId
247 good.Compute() 250 good.Compute()
  251 + //初始接收的订单按照待支付状态处理
248 good.CurrentBonusStatus.WartPayPartnerBonus(&good) 252 good.CurrentBonusStatus.WartPayPartnerBonus(&good)
249 ordergoods = append(ordergoods, good) 253 ordergoods = append(ordergoods, good)
250 } 254 }
251 orderbase.Goods = ordergoods 255 orderbase.Goods = ordergoods
252 orderbase.PartnerId = partnerData.Partner.Id 256 orderbase.PartnerId = partnerData.Partner.Id
253 orderbase.CompanyId = partnerData.CompanyId 257 orderbase.CompanyId = partnerData.CompanyId
254 - orderbase.PartnerCategory = domain.PartnerCategory{Id: 1, Name: "事业合伙人"} // 默认设定为事业合伙人订单 258 + // 默认设定为事业合伙人订单
  259 + orderbase.PartnerCategory = domain.PartnerCategory{Id: 1, Name: "事业合伙人"}
255 orderbase.Compute() 260 orderbase.Compute()
256 err = orderBaseRepository.Save(&orderbase) 261 err = orderBaseRepository.Save(&orderbase)
257 if err != nil { 262 if err != nil {
@@ -6,8 +6,9 @@ import ( @@ -6,8 +6,9 @@ import (
6 ) 6 )
7 7
8 type SyncCallbackCommand struct { 8 type SyncCallbackCommand struct {
9 - //position:职位,department:部门,employee:员工,company:公司 9 + //模块:position:职位,department:部门,employee:员工,company:公司
10 Module string `json:"module"` 10 Module string `json:"module"`
  11 + //动作:
11 //add:添加,edit:编辑,delete删除,batchDelete:批量删除, 12 //add:添加,edit:编辑,delete删除,batchDelete:批量删除,
12 //setCompanyCharge:更改公司主管,batchForbid:批量禁用用户, 13 //setCompanyCharge:更改公司主管,batchForbid:批量禁用用户,
13 //batchRemove:批量更改用户部门,changeAdmin换管理员 14 //batchRemove:批量更改用户部门,changeAdmin换管理员
@@ -8,14 +8,14 @@ var LOG_LEVEL = "debug" @@ -8,14 +8,14 @@ var LOG_LEVEL = "debug"
8 var LOG_File = "./logs/partnermg.log" 8 var LOG_File = "./logs/partnermg.log"
9 9
10 var ( 10 var (
11 - UCENTER_HOST = "https://suplus-ucenter-dev.fjmaimaimai.com" //统一用户中心地址 11 + UCENTER_HOST = "https://suplus-ucenter-test.fjmaimaimai.com" //统一用户中心地址
12 UCENTER_SECRET = "cykbjnfqgctn" 12 UCENTER_SECRET = "cykbjnfqgctn"
13 UCENTER_APP_KEY = "39aefef9e22744a3b2d2d3791824ae7b" 13 UCENTER_APP_KEY = "39aefef9e22744a3b2d2d3791824ae7b"
14 UCENTER_CHECK_ALT = "rsF0pL!6DwjBO735" 14 UCENTER_CHECK_ALT = "rsF0pL!6DwjBO735"
15 ) 15 )
16 16
17 var ( 17 var (
18 - BUSINESS_ADMIN_HOST = "http://suplus-business-admin-dev.fjmaimaimai.com" //企业平台的地址 18 + BUSINESS_ADMIN_HOST = "http://suplus-business-admin-test.fjmaimaimai.com" //企业平台的地址
19 ) 19 )
20 20
21 func init() { 21 func init() {
@@ -34,9 +34,7 @@ func init() { @@ -34,9 +34,7 @@ func init() {
34 if os.Getenv("UCENTER_CHECK_ALT") != "" { 34 if os.Getenv("UCENTER_CHECK_ALT") != "" {
35 UCENTER_CHECK_ALT = os.Getenv("UCENTER_CHECK_ALT") 35 UCENTER_CHECK_ALT = os.Getenv("UCENTER_CHECK_ALT")
36 } 36 }
37 -  
38 if os.Getenv("BUSINESS_ADMIN_HOST") != "" { 37 if os.Getenv("BUSINESS_ADMIN_HOST") != "" {
39 BUSINESS_ADMIN_HOST = os.Getenv("BUSINESS_ADMIN_HOST") 38 BUSINESS_ADMIN_HOST = os.Getenv("BUSINESS_ADMIN_HOST")
40 } 39 }
41 -  
42 } 40 }
@@ -14,7 +14,7 @@ var KafkaCfg KafkaConfig @@ -14,7 +14,7 @@ var KafkaCfg KafkaConfig
14 14
15 func init() { 15 func init() {
16 KafkaCfg = KafkaConfig{ 16 KafkaCfg = KafkaConfig{
17 - Servers: []string{""}, 17 + Servers: []string{"127.0.0.1:9092"},
18 ConsumerId: "partnermg_local", 18 ConsumerId: "partnermg_local",
19 } 19 }
20 if os.Getenv("KAFKA_HOST") != "" { 20 if os.Getenv("KAFKA_HOST") != "" {
@@ -2,11 +2,11 @@ package constant @@ -2,11 +2,11 @@ package constant
2 2
3 import "os" 3 import "os"
4 4
5 -var POSTGRESQL_DB_NAME = "partner_dev" 5 +var POSTGRESQL_DB_NAME = "partner_test"
6 var POSTGRESQL_USER = "postgres" 6 var POSTGRESQL_USER = "postgres"
7 -var POSTGRESQL_PASSWORD = "eagle1010"  
8 -var POSTGRESQL_HOST = "114.55.200.59"  
9 -var POSTGRESQL_PORT = "31543" 7 +var POSTGRESQL_PASSWORD = "1993618jack" // eagle1010
  8 +var POSTGRESQL_HOST = "127.0.0.1" // 114.55.200.59
  9 +var POSTGRESQL_PORT = "5432" // 31543
10 var DISABLE_CREATE_TABLE = true 10 var DISABLE_CREATE_TABLE = true
11 var DISABLE_SQL_GENERATE_PRINT = false 11 var DISABLE_SQL_GENERATE_PRINT = false
12 12
@@ -9,7 +9,7 @@ import ( @@ -9,7 +9,7 @@ import (
9 const ( 9 const (
10 OrderReal = iota + 1 //实发订单 10 OrderReal = iota + 1 //实发订单
11 OrderIntention //意向订单 11 OrderIntention //意向订单
12 - OrderTypeBestShop //来自小程序海鲜干货的订单 12 + OrderTypeBestShop //来自小程序香米的订单
13 ) 13 )
14 14
15 func GetOrderBaseTypeName(orderType int) string { 15 func GetOrderBaseTypeName(orderType int) string {
@@ -114,7 +114,7 @@ type OrderBase struct { @@ -114,7 +114,7 @@ type OrderBase struct {
114 DataFrom OrderDataFrom `json:"dataFrom"` 114 DataFrom OrderDataFrom `json:"dataFrom"`
115 //备注 115 //备注
116 Remark OrderBaseRemark `json:"remark"` 116 Remark OrderBaseRemark `json:"remark"`
117 - 117 + //合伙人类型
118 PartnerCategory PartnerCategory `json:"partnerCategory"` 118 PartnerCategory PartnerCategory `json:"partnerCategory"`
119 } 119 }
120 120
@@ -182,32 +182,41 @@ func (order *OrderBase) AddGoods(goods []OrderGood) { @@ -182,32 +182,41 @@ func (order *OrderBase) AddGoods(goods []OrderGood) {
182 order.Compute() 182 order.Compute()
183 } 183 }
184 184
185 -func (order *OrderBase) ModifyGoodNumber(goodid int64, number int64) {  
186 - for i := range order.Goods {  
187 - if order.Goods[i].Id != goodid {  
188 - continue  
189 - }  
190 - // thisGood := order.Goods[i] 185 +// func (order *OrderBase) ModifyGoodNumber(goodid int64, number int64) {
  186 +// for i := range order.Goods {
  187 +// if order.Goods[i].Id != goodid {
  188 +// continue
  189 +// }
  190 +// // thisGood := order.Goods[i]
191 191
192 - }  
193 - order.Compute()  
194 -} 192 +// }
  193 +// order.Compute()
  194 +// }
195 195
196 //Compute 数据汇总核算 196 //Compute 数据汇总核算
197 func (order *OrderBase) Compute() error { 197 func (order *OrderBase) Compute() error {
198 planPartnerBonus := decimal.NewFromFloat(0) 198 planPartnerBonus := decimal.NewFromFloat(0)
199 planOrderAmount := decimal.NewFromFloat(0) 199 planOrderAmount := decimal.NewFromFloat(0)
200 var ( 200 var (
  201 + //预计的货品总数,不包含调整后的值
201 planOrderCount int = 0 202 planOrderCount int = 0
  203 + //调整后的货品总数,混合相加计算预计值和调整值中的一个,优先取调整值计算
202 useOrderCount int = 0 204 useOrderCount int = 0
  205 + //订单的货品列表中是否存在调整货品数量
203 HasUseOrderCount bool = false 206 HasUseOrderCount bool = false
204 ) 207 )
  208 + //调整后的合伙人分红,混合相加计算预计值和调整值中的一个,优先取调整值计算
205 usePartnerBonus := decimal.NewFromFloat(0) 209 usePartnerBonus := decimal.NewFromFloat(0)
  210 + //订单的货品列表中是否存在调整的合伙人分红
206 var hasUsePartnerBonus bool = false 211 var hasUsePartnerBonus bool = false
  212 + //调整后的订单总额,混合相加计算预计值和调整值中的一个,优先取调整值计算
207 useOrderAmount := decimal.NewFromFloat(0) 213 useOrderAmount := decimal.NewFromFloat(0)
208 var hasUseOrderAmount bool = false 214 var hasUseOrderAmount bool = false
  215 + //已支付分红
209 partnerBonusHas := decimal.NewFromFloat(0) 216 partnerBonusHas := decimal.NewFromFloat(0)
  217 + //未支付分红
210 partnerBonusNot := decimal.NewFromFloat(0) 218 partnerBonusNot := decimal.NewFromFloat(0)
  219 + //分红支出
211 partnerBonusExpense := decimal.NewFromFloat(0) 220 partnerBonusExpense := decimal.NewFromFloat(0)
212 //初始订单的支付状态 221 //初始订单的支付状态
213 order.BonusStatus = OrderGoodWaitPay 222 order.BonusStatus = OrderGoodWaitPay
@@ -215,14 +224,20 @@ func (order *OrderBase) Compute() error { @@ -215,14 +224,20 @@ func (order *OrderBase) Compute() error {
215 for i := range order.Goods { 224 for i := range order.Goods {
216 if order.Goods[i].BonusStatus == OrderGoodHasPay { 225 if order.Goods[i].BonusStatus == OrderGoodHasPay {
217 //确定订单的支付状态 226 //确定订单的支付状态
  227 + //订单的货品列表中“存在”支付状态的为已支付,则整体订单设定为已支付状态
218 order.BonusStatus = OrderGoodHasPay 228 order.BonusStatus = OrderGoodHasPay
219 } 229 }
  230 + //计算预计的合伙人分红,不含调整的值
220 planPartnerBonus = planPartnerBonus.Add(decimal.NewFromFloat(order.Goods[i].GoodCompute.PlanPartnerBonus)) 231 planPartnerBonus = planPartnerBonus.Add(decimal.NewFromFloat(order.Goods[i].GoodCompute.PlanPartnerBonus))
  232 + //计算预计的订单总金额,不含调整的值
221 planOrderAmount = planOrderAmount.Add(decimal.NewFromFloat(order.Goods[i].GoodCompute.PlanAmount)) 233 planOrderAmount = planOrderAmount.Add(decimal.NewFromFloat(order.Goods[i].GoodCompute.PlanAmount))
  234 + //计算预计的订单中货品总数,不含调整的值
222 planOrderCount += order.Goods[i].PlanGoodNumber 235 planOrderCount += order.Goods[i].PlanGoodNumber
  236 + //获取调整货品调整后(数量)的总金额,
223 goodUseAmount := decimal.NewFromFloat(order.Goods[i].GoodCompute.UseAmount) 237 goodUseAmount := decimal.NewFromFloat(order.Goods[i].GoodCompute.UseAmount)
  238 +
224 if goodUseAmount.GreaterThanOrEqual(decimal.NewFromFloat(0)) { 239 if goodUseAmount.GreaterThanOrEqual(decimal.NewFromFloat(0)) {
225 - //调整值非负值得情况 240 + //调整后货品总金额,非负值(大于等于0)的情况
226 hasUseOrderAmount = true 241 hasUseOrderAmount = true
227 useOrderAmount = useOrderAmount.Add(goodUseAmount) 242 useOrderAmount = useOrderAmount.Add(goodUseAmount)
228 } else { 243 } else {
@@ -230,12 +245,14 @@ func (order *OrderBase) Compute() error { @@ -230,12 +245,14 @@ func (order *OrderBase) Compute() error {
230 } 245 }
231 goodUsePartnerBonus := decimal.NewFromFloat(order.Goods[i].GoodCompute.UsePartnerBonus) 246 goodUsePartnerBonus := decimal.NewFromFloat(order.Goods[i].GoodCompute.UsePartnerBonus)
232 if goodUsePartnerBonus.GreaterThanOrEqual(decimal.NewFromFloat(0)) { 247 if goodUsePartnerBonus.GreaterThanOrEqual(decimal.NewFromFloat(0)) {
  248 + //货品中存在调整后的合伙人分红,即调整大于等于0
233 hasUsePartnerBonus = true 249 hasUsePartnerBonus = true
234 usePartnerBonus = usePartnerBonus.Add(goodUsePartnerBonus) 250 usePartnerBonus = usePartnerBonus.Add(goodUsePartnerBonus)
235 } else { 251 } else {
236 usePartnerBonus = usePartnerBonus.Add(decimal.NewFromFloat(order.Goods[i].GoodCompute.PlanPartnerBonus)) 252 usePartnerBonus = usePartnerBonus.Add(decimal.NewFromFloat(order.Goods[i].GoodCompute.PlanPartnerBonus))
237 } 253 }
238 if order.Goods[i].UseGoodNumber >= 0 { 254 if order.Goods[i].UseGoodNumber >= 0 {
  255 + //货品中存在调整后的数量,调整值大于等于0
239 HasUseOrderCount = true 256 HasUseOrderCount = true
240 useOrderCount += order.Goods[i].UseGoodNumber 257 useOrderCount += order.Goods[i].UseGoodNumber
241 } else { 258 } else {
@@ -256,6 +273,7 @@ func (order *OrderBase) Compute() error { @@ -256,6 +273,7 @@ func (order *OrderBase) Compute() error {
256 if hasUsePartnerBonus { 273 if hasUsePartnerBonus {
257 order.OrderCompute.UsePartnerBonus, _ = usePartnerBonus.Round(2).BigFloat().Float64() 274 order.OrderCompute.UsePartnerBonus, _ = usePartnerBonus.Round(2).BigFloat().Float64()
258 } else { 275 } else {
  276 + //订单中的货品列表中合伙人分成没有调整值的情况下,对订单的调整值设置为负值用以标识
259 order.OrderCompute.UsePartnerBonus = -1 277 order.OrderCompute.UsePartnerBonus = -1
260 } 278 }
261 if hasUseOrderAmount { 279 if hasUseOrderAmount {
@@ -266,6 +284,7 @@ func (order *OrderBase) Compute() error { @@ -266,6 +284,7 @@ func (order *OrderBase) Compute() error {
266 Div(decimal.NewFromInt(100)). 284 Div(decimal.NewFromInt(100)).
267 Round(2).BigFloat().Float64() 285 Round(2).BigFloat().Float64()
268 } else { 286 } else {
  287 + //订单中的货品列表中货品总金额没有调整值的情况下,对订单的调整值设置为负值用以标识
269 order.OrderCompute.UseOrderAmount = -1 288 order.OrderCompute.UseOrderAmount = -1
270 order.OrderCompute.SalesmanBonus, _ = planOrderAmount. 289 order.OrderCompute.SalesmanBonus, _ = planOrderAmount.
271 Mul(decimal.NewFromFloat(order.SalesmanBonusPercent)). 290 Mul(decimal.NewFromFloat(order.SalesmanBonusPercent)).
@@ -70,7 +70,7 @@ type OrderGood struct { @@ -70,7 +70,7 @@ type OrderGood struct {
70 UseGoodNumber int `json:"useGoodNumber"` 70 UseGoodNumber int `json:"useGoodNumber"`
71 //货品单价 71 //货品单价
72 Price float64 `json:"price"` 72 Price float64 `json:"price"`
73 - //合伙人分红比例 73 + //合伙人分红比例 比如12.7等同于12.7%,使用负值表示分红比例未进行设置
74 PartnerBonusPercent float64 `json:"partnerBonusPercent"` 74 PartnerBonusPercent float64 `json:"partnerBonusPercent"`
75 //分红支付状态 75 //分红支付状态
76 BonusStatus int `json:"bonusStatus"` 76 BonusStatus int `json:"bonusStatus"`
@@ -87,6 +87,20 @@ type OrderGood struct { @@ -87,6 +87,20 @@ type OrderGood struct {
87 DataFrom OrderDataFrom `json:"data_from"` 87 DataFrom OrderDataFrom `json:"data_from"`
88 } 88 }
89 89
  90 +//NewOrderGood 初始值设定
  91 +func NewOrderGood() OrderGood {
  92 + return OrderGood{
  93 + UseGoodNumber: -1,
  94 + BonusStatus: OrderGoodWaitPay,
  95 + PartnerBonusPercent: -1,
  96 + GoodCompute: GoodCompute{
  97 + UsePartnerBonus: -1,
  98 + UseAmount: -1,
  99 + },
  100 + CurrentBonusStatus: OrderGoodBonusWaitPay{},
  101 + }
  102 +}
  103 +
90 //GetCurrentGoodNumber 获取当前的商品数量 104 //GetCurrentGoodNumber 获取当前的商品数量
91 func (good OrderGood) GetCurrentGoodNumber() int { 105 func (good OrderGood) GetCurrentGoodNumber() int {
92 if good.UseGoodNumber >= 0 { 106 if good.UseGoodNumber >= 0 {
@@ -111,7 +125,7 @@ func (good OrderGood) GetCurrentPartnerBonus() float64 { @@ -111,7 +125,7 @@ func (good OrderGood) GetCurrentPartnerBonus() float64 {
111 return good.GoodCompute.PlanPartnerBonus 125 return good.GoodCompute.PlanPartnerBonus
112 } 126 }
113 127
114 -//GetCurrentAmount 获取当前的商品合伙人分红 128 +//ModifyOrderGoodNumber 修改货品数量
115 func (good *OrderGood) ModifyOrderGoodNumber(number int, orderType int) error { 129 func (good *OrderGood) ModifyOrderGoodNumber(number int, orderType int) error {
116 if good.PlanGoodNumber < number { 130 if good.PlanGoodNumber < number {
117 return fmt.Errorf("修改数量不能大于初始值:%d", good.PlanGoodNumber) 131 return fmt.Errorf("修改数量不能大于初始值:%d", good.PlanGoodNumber)
@@ -120,6 +134,7 @@ func (good *OrderGood) ModifyOrderGoodNumber(number int, orderType int) error { @@ -120,6 +134,7 @@ func (good *OrderGood) ModifyOrderGoodNumber(number int, orderType int) error {
120 return err 134 return err
121 } 135 }
122 136
  137 +//ModifyPertnerBonusPercent 修改货品的分红比例
123 func (good *OrderGood) ModifyPertnerBonusPercent(percent float64, orderType int) error { 138 func (good *OrderGood) ModifyPertnerBonusPercent(percent float64, orderType int) error {
124 err := good.CurrentBonusStatus.ModifyPertnerBonusPercent(good, percent, orderType) 139 err := good.CurrentBonusStatus.ModifyPertnerBonusPercent(good, percent, orderType)
125 return err 140 return err
@@ -162,6 +177,7 @@ type OrderGoodBonusHasPay struct{} @@ -162,6 +177,7 @@ type OrderGoodBonusHasPay struct{}
162 177
163 var _ OrderGoodBonusStatus = (*OrderGoodBonusHasPay)(nil) 178 var _ OrderGoodBonusStatus = (*OrderGoodBonusHasPay)(nil)
164 179
  180 +//WartPayPartnerBonus 货品的支付状态从“待支付”状态变更为“待支付”
165 func (waitPay OrderGoodBonusWaitPay) WartPayPartnerBonus(good *OrderGood) error { 181 func (waitPay OrderGoodBonusWaitPay) WartPayPartnerBonus(good *OrderGood) error {
166 good.GoodCompute.PartnerBonusExpense = 0 182 good.GoodCompute.PartnerBonusExpense = 0
167 good.GoodCompute.PartnerBonusHas = 0 183 good.GoodCompute.PartnerBonusHas = 0
@@ -178,6 +194,7 @@ func (waitPay OrderGoodBonusWaitPay) WartPayPartnerBonus(good *OrderGood) error @@ -178,6 +194,7 @@ func (waitPay OrderGoodBonusWaitPay) WartPayPartnerBonus(good *OrderGood) error
178 return nil 194 return nil
179 } 195 }
180 196
  197 +//PayPartnerBonus 货品的支付状态从“待支付”状态变更为“已支付”
181 func (waitPay OrderGoodBonusWaitPay) PayPartnerBonus(good *OrderGood) error { 198 func (waitPay OrderGoodBonusWaitPay) PayPartnerBonus(good *OrderGood) error {
182 //待支付状态转支付时 199 //待支付状态转支付时
183 //合伙人已收收分红等于合伙人应收分红(或者调整的) 200 //合伙人已收收分红等于合伙人应收分红(或者调整的)
@@ -196,6 +213,7 @@ func (waitPay OrderGoodBonusWaitPay) PayPartnerBonus(good *OrderGood) error { @@ -196,6 +213,7 @@ func (waitPay OrderGoodBonusWaitPay) PayPartnerBonus(good *OrderGood) error {
196 return nil 213 return nil
197 } 214 }
198 215
  216 +//PayPartnerBonus 货品的支付状态从“已支付”状态变更为“已支付”
199 func (hasPay OrderGoodBonusHasPay) PayPartnerBonus(good *OrderGood) error { 217 func (hasPay OrderGoodBonusHasPay) PayPartnerBonus(good *OrderGood) error {
200 //已支付的值保持不变 218 //已支付的值保持不变
201 //未支付的值保持不变 219 //未支付的值保持不变
@@ -210,10 +228,12 @@ func (hasPay OrderGoodBonusHasPay) PayPartnerBonus(good *OrderGood) error { @@ -210,10 +228,12 @@ func (hasPay OrderGoodBonusHasPay) PayPartnerBonus(good *OrderGood) error {
210 return nil 228 return nil
211 } 229 }
212 230
  231 +//WartPayPartnerBonus 货品的支付状态从“已支付”状态变更为“待支付”
213 func (hasPay OrderGoodBonusHasPay) WartPayPartnerBonus(good *OrderGood) error { 232 func (hasPay OrderGoodBonusHasPay) WartPayPartnerBonus(good *OrderGood) error {
214 return errors.New("已支付的货单不能将状态回退为待支付") 233 return errors.New("已支付的货单不能将状态回退为待支付")
215 } 234 }
216 235
  236 +//ModifyOrderGoodNumber 货品的支付状态为“已支付”状态变时,修改货品数量
217 func (hasPay OrderGoodBonusHasPay) ModifyOrderGoodNumber(good *OrderGood, number int, orderType int) error { 237 func (hasPay OrderGoodBonusHasPay) ModifyOrderGoodNumber(good *OrderGood, number int, orderType int) error {
218 //规则描述: 238 //规则描述:
219 //实际自建订单(orderType==1),已支付分红状态下“可以”修改货品数量 239 //实际自建订单(orderType==1),已支付分红状态下“可以”修改货品数量
@@ -233,6 +253,7 @@ func (hasPay OrderGoodBonusHasPay) ModifyOrderGoodNumber(good *OrderGood, number @@ -233,6 +253,7 @@ func (hasPay OrderGoodBonusHasPay) ModifyOrderGoodNumber(good *OrderGood, number
233 return nil 253 return nil
234 } 254 }
235 255
  256 +//ModifyOrderGoodNumber 货品的支付状态为“待支付”状态变时,修改货品数量
236 func (waitPay OrderGoodBonusWaitPay) ModifyOrderGoodNumber(good *OrderGood, number int, orderType int) error { 257 func (waitPay OrderGoodBonusWaitPay) ModifyOrderGoodNumber(good *OrderGood, number int, orderType int) error {
237 //规则描述: 258 //规则描述:
238 //实际自建订单(orderType==1),未支付分红状态下“可以”修改货品数量 259 //实际自建订单(orderType==1),未支付分红状态下“可以”修改货品数量
@@ -247,6 +268,7 @@ func (waitPay OrderGoodBonusWaitPay) ModifyOrderGoodNumber(good *OrderGood, numb @@ -247,6 +268,7 @@ func (waitPay OrderGoodBonusWaitPay) ModifyOrderGoodNumber(good *OrderGood, numb
247 return nil 268 return nil
248 } 269 }
249 270
  271 +//ModifyPertnerBonusPercent 货品的支付状态为“待支付”状态变时,修改货品合伙人分红比例
250 func (waitPay OrderGoodBonusWaitPay) ModifyPertnerBonusPercent(good *OrderGood, percent float64, orderType int) error { 272 func (waitPay OrderGoodBonusWaitPay) ModifyPertnerBonusPercent(good *OrderGood, percent float64, orderType int) error {
251 //规则描述: 273 //规则描述:
252 //实际自建订单(orderType==1),未支付分红状态下“不可以”修改合伙人分红比例 274 //实际自建订单(orderType==1),未支付分红状态下“不可以”修改合伙人分红比例
@@ -276,20 +298,6 @@ func (hasPay OrderGoodBonusHasPay) ModifyPertnerBonusPercent(good *OrderGood, pe @@ -276,20 +298,6 @@ func (hasPay OrderGoodBonusHasPay) ModifyPertnerBonusPercent(good *OrderGood, pe
276 return errors.New("已支付分红的货品订单,不能修改合伙人分红比例") 298 return errors.New("已支付分红的货品订单,不能修改合伙人分红比例")
277 } 299 }
278 300
279 -//NewOrderGood 初始值设定  
280 -func NewOrderGood() OrderGood {  
281 - return OrderGood{  
282 - UseGoodNumber: -1,  
283 - BonusStatus: OrderGoodWaitPay,  
284 - PartnerBonusPercent: -1,  
285 - GoodCompute: GoodCompute{  
286 - UsePartnerBonus: -1,  
287 - UseAmount: -1,  
288 - },  
289 - CurrentBonusStatus: OrderGoodBonusWaitPay{},  
290 - }  
291 -}  
292 -  
293 //Compute 数据汇总核算 301 //Compute 数据汇总核算
294 func (good *OrderGood) Compute() error { 302 func (good *OrderGood) Compute() error {
295 //计算预计货品总值 303 //计算预计货品总值
@@ -299,25 +307,28 @@ func (good *OrderGood) Compute() error { @@ -299,25 +307,28 @@ func (good *OrderGood) Compute() error {
299 if good.PlanGoodNumber < 0 { 307 if good.PlanGoodNumber < 0 {
300 planGoodNumber = 0 308 planGoodNumber = 0
301 } 309 }
302 - planamount := price.Mul(decimal.NewFromInt(int64(planGoodNumber))) //price*planGoodNumber 310 + //计算预计货品总值(planamount), 货品单价*预计货品数量(price*planGoodNumber)
  311 + planamount := price.Mul(decimal.NewFromInt(int64(planGoodNumber)))
303 var partnerBonusPercent float64 312 var partnerBonusPercent float64
304 if good.PartnerBonusPercent < 0 { 313 if good.PartnerBonusPercent < 0 {
  314 + //判断合伙人分成比例是否设置,若未设置则按照 0 来计算分成
305 partnerBonusPercent = 0 315 partnerBonusPercent = 0
306 } else { 316 } else {
307 partnerBonusPercent = good.PartnerBonusPercent 317 partnerBonusPercent = good.PartnerBonusPercent
308 } 318 }
309 - //price*useGoodNumber 319 + //计算预计合伙人分红(planPartnerBonus), 预计货品总值*合伙人分成比例/100(planamount*partnerBonusPercent/100)
310 planPartnerBonus := planamount.Mul(decimal.NewFromFloat(partnerBonusPercent)).Div(decimal.NewFromInt(100)) //price*planGoodNumber*PartnerBonusPercent 320 planPartnerBonus := planamount.Mul(decimal.NewFromFloat(partnerBonusPercent)).Div(decimal.NewFromInt(100)) //price*planGoodNumber*PartnerBonusPercent
  321 + //货品预计总值
311 good.GoodCompute.PlanAmount, _ = planamount.Round(2).BigFloat().Float64() 322 good.GoodCompute.PlanAmount, _ = planamount.Round(2).BigFloat().Float64()
312 good.GoodCompute.PlanPartnerBonus, _ = planPartnerBonus.Round(2).BigFloat().Float64() 323 good.GoodCompute.PlanPartnerBonus, _ = planPartnerBonus.Round(2).BigFloat().Float64()
313 if good.UseGoodNumber < 0 { 324 if good.UseGoodNumber < 0 {
314 - //没有出现数量调整 325 + //没有出现数量调整,使用负值进行标记
315 good.GoodCompute.UsePartnerBonus = -1 326 good.GoodCompute.UsePartnerBonus = -1
316 good.GoodCompute.UseAmount = -1 327 good.GoodCompute.UseAmount = -1
317 } else { 328 } else {
318 //计算调整后的货品总值 329 //计算调整后的货品总值
319 - //计算调整后的合伙人分红  
320 - useamount := price.Mul(decimal.NewFromInt(int64(good.UseGoodNumber))) //price*useGoodNumber/price*useGoodNumber 330 + useamount := price.Mul(decimal.NewFromInt(int64(good.UseGoodNumber)))
  331 + //计算调整后的合伙人分红 //price*useGoodNumber/price*useGoodNumber
321 usePartnerBonus := useamount.Mul(decimal.NewFromFloat(partnerBonusPercent)).Div(decimal.NewFromInt(100)) //price*useGoodNumber*PartnerBonusPercent 332 usePartnerBonus := useamount.Mul(decimal.NewFromFloat(partnerBonusPercent)).Div(decimal.NewFromInt(100)) //price*useGoodNumber*PartnerBonusPercent
322 good.GoodCompute.UsePartnerBonus, _ = usePartnerBonus.Round(2).BigFloat().Float64() 333 good.GoodCompute.UsePartnerBonus, _ = usePartnerBonus.Round(2).BigFloat().Float64()
323 good.GoodCompute.UseAmount, _ = useamount.Round(2).BigFloat().Float64() 334 good.GoodCompute.UseAmount, _ = useamount.Round(2).BigFloat().Float64()
@@ -6,6 +6,8 @@ type PartnerCategory struct { @@ -6,6 +6,8 @@ type PartnerCategory struct {
6 Id int64 `json:"id"` 6 Id int64 `json:"id"`
7 // 名称 7 // 名称
8 Name string `json:"name,omitempty"` 8 Name string `json:"name,omitempty"`
  9 + // 合伙人编码
  10 + Code string `json:"code"`
9 } 11 }
10 12
11 type PartnerCategoryFindQuery struct { 13 type PartnerCategoryFindQuery struct {
@@ -48,6 +48,8 @@ type PartnerInfo struct { @@ -48,6 +48,8 @@ type PartnerInfo struct {
48 PartnerCategory int `json:"partnerCategory"` 48 PartnerCategory int `json:"partnerCategory"`
49 //公司id 49 //公司id
50 CompanyId int64 `json:"companyId"` 50 CompanyId int64 `json:"companyId"`
  51 + //备注
  52 + Remark string `json:"remark"`
51 } 53 }
52 54
53 func (p *PartnerInfo) IsUsable() bool { 55 func (p *PartnerInfo) IsUsable() bool {
@@ -72,11 +74,13 @@ type PartnerFindQuery struct { @@ -72,11 +74,13 @@ type PartnerFindQuery struct {
72 PartnerName string //合伙人姓名 74 PartnerName string //合伙人姓名
73 CompanyId int64 75 CompanyId int64
74 Ids []int64 76 Ids []int64
  77 + PartnerType []*PartnerCategory
75 } 78 }
76 79
77 type PartnerInfoRepository interface { 80 type PartnerInfoRepository interface {
78 Save(dm *PartnerInfo) error 81 Save(dm *PartnerInfo) error
79 FindOne(queryOptions PartnerFindOneQuery) (*PartnerInfo, error) 82 FindOne(queryOptions PartnerFindOneQuery) (*PartnerInfo, error)
80 Find(queryOptions PartnerFindQuery) ([]PartnerInfo, error) 83 Find(queryOptions PartnerFindQuery) ([]PartnerInfo, error)
  84 + Remove(Id int64) error
81 CountAll(queryOptions PartnerFindQuery) (int, error) 85 CountAll(queryOptions PartnerFindQuery) (int, error)
82 } 86 }
@@ -2,7 +2,7 @@ package dao @@ -2,7 +2,7 @@ package dao
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 - 5 + "github.com/go-pg/pg/v10"
6 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/models" 6 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/models"
7 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction" 7 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction"
8 ) 8 )
@@ -28,7 +28,6 @@ func (dao PartnerInfoDao) PartnerAccountExist(account string, companyId int64) ( @@ -28,7 +28,6 @@ func (dao PartnerInfoDao) PartnerAccountExist(account string, companyId int64) (
28 Where("account=?", account). 28 Where("account=?", account).
29 Where("company_id=?", companyId). 29 Where("company_id=?", companyId).
30 Exists() 30 Exists()
31 -  
32 return ok, err 31 return ok, err
33 } 32 }
34 33
@@ -42,3 +41,21 @@ func (dao PartnerInfoDao) UpdatePartnerStatus(ids []int64, companyId int64, stat @@ -42,3 +41,21 @@ func (dao PartnerInfoDao) UpdatePartnerStatus(ids []int64, companyId int64, stat
42 Update() 41 Update()
43 return err 42 return err
44 } 43 }
  44 +
  45 +/**
  46 + * @Author SteveChan
  47 + * @Description // 编号查重
  48 + * @Date 17:55 2020/12/28
  49 + * @Param
  50 + * @return
  51 + **/
  52 +func (dao PartnerInfoDao) PartnerCodeExist(categoryId int64, code string, companyId int64, id int64) (bool, error) {
  53 + tx := dao.transactionContext.PgDd
  54 + m := &models.PartnerInfo{}
  55 + ok, err := tx.Model(m).
  56 + Where(`partner_category_infos@> '[{"id":?,"code":?}]'`, categoryId, pg.Ident(code)).
  57 + Where("company_id=?", companyId).
  58 + Where("id <> ?", id).
  59 + Exists()
  60 + return ok, err
  61 +}
@@ -35,4 +35,5 @@ type OrderBestshop struct { @@ -35,4 +35,5 @@ type OrderBestshop struct {
35 //是否将数据同步到 order_base ,order_good 35 //是否将数据同步到 order_base ,order_good
36 IsCopy bool `pg:",use_zero"` 36 IsCopy bool `pg:",use_zero"`
37 CompanyId int64 37 CompanyId int64
  38 + OrderArea string
38 } 39 }
@@ -7,4 +7,6 @@ type PartnerCategoryInfo struct { @@ -7,4 +7,6 @@ type PartnerCategoryInfo struct {
7 Id int64 7 Id int64
8 // 名称 8 // 名称
9 Name string 9 Name string
  10 + // 合伙人编码
  11 + Code string
10 } 12 }
@@ -36,6 +36,8 @@ type PartnerInfo struct { @@ -36,6 +36,8 @@ type PartnerInfo struct {
36 PartnerCategoryInfos []domain.PartnerCategory 36 PartnerCategoryInfos []domain.PartnerCategory
37 //公司id 37 //公司id
38 CompanyId int64 38 CompanyId int64
  39 + //备注
  40 + Remark string
39 } 41 }
40 42
41 var _ pg.BeforeUpdateHook = (*PartnerInfo)(nil) 43 var _ pg.BeforeUpdateHook = (*PartnerInfo)(nil)
@@ -43,6 +43,7 @@ func (respository OrderBestshopRepository) transformPgModelToDomainModel(orderMo @@ -43,6 +43,7 @@ func (respository OrderBestshopRepository) transformPgModelToDomainModel(orderMo
43 PartnerId: orderModel.PartnerId, 43 PartnerId: orderModel.PartnerId,
44 IsCopy: orderModel.IsCopy, 44 IsCopy: orderModel.IsCopy,
45 CompanyId: orderModel.CompanyId, 45 CompanyId: orderModel.CompanyId,
  46 + OrderArea: orderModel.OrderArea,
46 }, nil 47 }, nil
47 } 48 }
48 49
@@ -65,6 +66,7 @@ func (respository OrderBestshopRepository) Add(order *domain.OrderBestShop) erro @@ -65,6 +66,7 @@ func (respository OrderBestshopRepository) Add(order *domain.OrderBestShop) erro
65 PartnerId: order.PartnerId, 66 PartnerId: order.PartnerId,
66 IsCopy: order.IsCopy, 67 IsCopy: order.IsCopy,
67 CompanyId: order.CompanyId, 68 CompanyId: order.CompanyId,
  69 + OrderArea: order.OrderArea,
68 } 70 }
69 _, err := tx.Model(&m).Insert() 71 _, err := tx.Model(&m).Insert()
70 order.Id = m.Id 72 order.Id = m.Id
@@ -91,6 +93,7 @@ func (respository OrderBestshopRepository) Edit(order *domain.OrderBestShop) err @@ -91,6 +93,7 @@ func (respository OrderBestshopRepository) Edit(order *domain.OrderBestShop) err
91 PartnerId: order.PartnerId, 93 PartnerId: order.PartnerId,
92 IsCopy: order.IsCopy, 94 IsCopy: order.IsCopy,
93 CompanyId: order.CompanyId, 95 CompanyId: order.CompanyId,
  96 + OrderArea: order.OrderArea,
94 } 97 }
95 _, err := tx.Model(&m).Where("id=?", order.Id).Update() 98 _, err := tx.Model(&m).Where("id=?", order.Id).Update()
96 order.Id = m.Id 99 order.Id = m.Id
@@ -12,21 +12,6 @@ type PartnerCategoryRepository struct { @@ -12,21 +12,6 @@ type PartnerCategoryRepository struct {
12 transactionContext *transaction.TransactionContext 12 transactionContext *transaction.TransactionContext
13 } 13 }
14 14
15 -func (repository PartnerCategoryRepository) transformPgModelToDomainModel(m *models.PartnerCategoryInfo) (domain.PartnerCategory, error) {  
16 - pc := domain.PartnerCategory{  
17 - Id: m.Id,  
18 - Name: m.Name,  
19 - }  
20 - return pc, nil  
21 -}  
22 -  
23 -func NewPartnerCategoryRepository(transactionContext *transaction.TransactionContext) (*PartnerCategoryRepository, error) {  
24 - if transactionContext == nil {  
25 - return nil, fmt.Errorf("transactionContext参数不能为nil")  
26 - }  
27 - return &PartnerCategoryRepository{transactionContext: transactionContext}, nil  
28 -}  
29 -  
30 func (repository PartnerCategoryRepository) Find(queryOptions domain.PartnerCategoryFindQuery) (int, []domain.PartnerCategory, error) { 15 func (repository PartnerCategoryRepository) Find(queryOptions domain.PartnerCategoryFindQuery) (int, []domain.PartnerCategory, error) {
31 tx := repository.transactionContext.PgTx 16 tx := repository.transactionContext.PgTx
32 var ( 17 var (
@@ -48,3 +33,19 @@ func (repository PartnerCategoryRepository) Find(queryOptions domain.PartnerCate @@ -48,3 +33,19 @@ func (repository PartnerCategoryRepository) Find(queryOptions domain.PartnerCate
48 } 33 }
49 return cnt, partnerCategoryInfos, nil 34 return cnt, partnerCategoryInfos, nil
50 } 35 }
  36 +
  37 +func (repository PartnerCategoryRepository) transformPgModelToDomainModel(m *models.PartnerCategoryInfo) (domain.PartnerCategory, error) {
  38 + pc := domain.PartnerCategory{
  39 + Id: m.Id,
  40 + Name: m.Name,
  41 + Code: m.Code,
  42 + }
  43 + return pc, nil
  44 +}
  45 +
  46 +func NewPartnerCategoryRepository(transactionContext *transaction.TransactionContext) (*PartnerCategoryRepository, error) {
  47 + if transactionContext == nil {
  48 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  49 + }
  50 + return &PartnerCategoryRepository{transactionContext: transactionContext}, nil
  51 +}
@@ -18,50 +18,18 @@ var ( @@ -18,50 +18,18 @@ var (
18 _ domain.PartnerInfoRepository = (*PartnerInfoRepository)(nil) 18 _ domain.PartnerInfoRepository = (*PartnerInfoRepository)(nil)
19 ) 19 )
20 20
21 -func (repository *PartnerInfoRepository) transformPgModelToDomainModel(partnerInfoModel *models.PartnerInfo) (domain.PartnerInfo, error) {  
22 - m := domain.PartnerInfo{  
23 - Partner: domain.Partner{  
24 - Id: partnerInfoModel.Id,  
25 - PartnerName: partnerInfoModel.PartnerName,  
26 - Account: partnerInfoModel.Account,  
27 - },  
28 - PartnerCategory: partnerInfoModel.PartnerCategory,  
29 - Password: partnerInfoModel.Password,  
30 - Status: partnerInfoModel.Status,  
31 - CreateAt: partnerInfoModel.CreateAt,  
32 - Salesman: partnerInfoModel.Salesman,  
33 - RegionInfo: partnerInfoModel.RegionInfo,  
34 - CooperateTime: partnerInfoModel.CooperateTime,  
35 - CompanyId: partnerInfoModel.CompanyId,  
36 - }  
37 - p := []domain.PartnerCategory{}  
38 - for _, v := range partnerInfoModel.PartnerCategoryInfos {  
39 - catagory := domain.PartnerCategory{  
40 - Id: v.Id,  
41 - }  
42 - p = append(p, catagory)  
43 - }  
44 - m.PartnerCategoryInfos = p  
45 - return m, nil  
46 -}  
47 -  
48 -func NewPartnerInfoRepository(transactionContext *transaction.TransactionContext) (*PartnerInfoRepository, error) {  
49 - if transactionContext == nil {  
50 - return nil, fmt.Errorf("transactionContext参数不能为nil")  
51 - }  
52 - return &PartnerInfoRepository{transactionContext: transactionContext}, nil  
53 -}  
54 -  
55 func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) error { 21 func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) error {
56 var ( 22 var (
57 err error 23 err error
58 tx = repository.transactionContext.PgTx 24 tx = repository.transactionContext.PgTx
59 ) 25 )
60 26
61 - categorys := []domain.PartnerCategory{} 27 + var categories []domain.PartnerCategory
62 for _, v := range dm.PartnerCategoryInfos { 28 for _, v := range dm.PartnerCategoryInfos {
63 - categorys = append(categorys, domain.PartnerCategory{ 29 + categories = append(categories, domain.PartnerCategory{
64 Id: v.Id, 30 Id: v.Id,
  31 + Name: v.Name,
  32 + Code: v.Code,
65 }) 33 })
66 } 34 }
67 m := &models.PartnerInfo{ 35 m := &models.PartnerInfo{
@@ -75,7 +43,8 @@ func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) error { @@ -75,7 +43,8 @@ func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) error {
75 RegionInfo: dm.RegionInfo, 43 RegionInfo: dm.RegionInfo,
76 CooperateTime: dm.CooperateTime, 44 CooperateTime: dm.CooperateTime,
77 CompanyId: dm.CompanyId, 45 CompanyId: dm.CompanyId,
78 - PartnerCategoryInfos: categorys, 46 + PartnerCategoryInfos: categories,
  47 + Remark: dm.Remark,
79 } 48 }
80 if m.Id == 0 { 49 if m.Id == 0 {
81 err = tx.Insert(m) 50 err = tx.Insert(m)
@@ -86,7 +55,7 @@ func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) error { @@ -86,7 +55,7 @@ func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) error {
86 } else { 55 } else {
87 _, err = tx.Model(m).WherePK(). 56 _, err = tx.Model(m).WherePK().
88 Column("partner_name", "account", "password", "status", "partner_category", "salesman", 57 Column("partner_name", "account", "password", "status", "partner_category", "salesman",
89 - "region_info", "cooperate_time", "update_at", "partner_category_infos"). 58 + "region_info", "cooperate_time", "update_at", "partner_category_infos", "remark").
90 Update() 59 Update()
91 if err != nil { 60 if err != nil {
92 return err 61 return err
@@ -124,7 +93,7 @@ func (repository *PartnerInfoRepository) FindOne(queryOptions domain.PartnerFind @@ -124,7 +93,7 @@ func (repository *PartnerInfoRepository) FindOne(queryOptions domain.PartnerFind
124 93
125 func (repository *PartnerInfoRepository) Find(queryOption domain.PartnerFindQuery) ([]domain.PartnerInfo, error) { 94 func (repository *PartnerInfoRepository) Find(queryOption domain.PartnerFindQuery) ([]domain.PartnerInfo, error) {
126 db := repository.transactionContext.PgTx 95 db := repository.transactionContext.PgTx
127 - partnerModels := []models.PartnerInfo{} 96 + var partnerModels []models.PartnerInfo
128 query := db.Model(&partnerModels) 97 query := db.Model(&partnerModels)
129 if len(queryOption.PartnerName) > 0 { 98 if len(queryOption.PartnerName) > 0 {
130 query = query.Where("partner_name like ?", "%"+queryOption.PartnerName+"%") 99 query = query.Where("partner_name like ?", "%"+queryOption.PartnerName+"%")
@@ -159,7 +128,7 @@ func (repository *PartnerInfoRepository) Find(queryOption domain.PartnerFindQuer @@ -159,7 +128,7 @@ func (repository *PartnerInfoRepository) Find(queryOption domain.PartnerFindQuer
159 err error 128 err error
160 partnerReturn = make([]domain.PartnerInfo, 0) 129 partnerReturn = make([]domain.PartnerInfo, 0)
161 ) 130 )
162 - query = query.Order("id DESC") 131 + query = query.Order("create_at DESC")
163 err = query.Select() 132 err = query.Select()
164 if err != nil { 133 if err != nil {
165 return partnerReturn, err 134 return partnerReturn, err
@@ -174,7 +143,28 @@ func (repository *PartnerInfoRepository) Find(queryOption domain.PartnerFindQuer @@ -174,7 +143,28 @@ func (repository *PartnerInfoRepository) Find(queryOption domain.PartnerFindQuer
174 return partnerReturn, nil 143 return partnerReturn, nil
175 } 144 }
176 145
177 -func (repository PartnerInfoRepository) CountAll(queryOption domain.PartnerFindQuery) (int, error) { 146 +/**
  147 + * @Author SteveChan
  148 + * @Description // 移除合伙人
  149 + * @Date 15:33 2020/12/29
  150 + * @Param
  151 + * @return
  152 + **/
  153 +func (repository *PartnerInfoRepository) Remove(id int64) error {
  154 + var (
  155 + err error
  156 + tx = repository.transactionContext.PgTx
  157 + )
  158 + m := &models.PartnerInfo{
  159 + Id: id,
  160 + }
  161 + _, err = tx.Model(m).
  162 + Where("id=?", id).
  163 + Delete()
  164 + return err
  165 +}
  166 +
  167 +func (repository *PartnerInfoRepository) CountAll(queryOption domain.PartnerFindQuery) (int, error) {
178 db := repository.transactionContext.PgTx 168 db := repository.transactionContext.PgTx
179 partnerModels := models.PartnerInfo{} 169 partnerModels := models.PartnerInfo{}
180 query := db.Model(&partnerModels) 170 query := db.Model(&partnerModels)
@@ -202,3 +192,40 @@ func (repository PartnerInfoRepository) CountAll(queryOption domain.PartnerFindQ @@ -202,3 +192,40 @@ func (repository PartnerInfoRepository) CountAll(queryOption domain.PartnerFindQ
202 cnt, err := query.Count() 192 cnt, err := query.Count()
203 return cnt, err 193 return cnt, err
204 } 194 }
  195 +
  196 +func (repository *PartnerInfoRepository) transformPgModelToDomainModel(partnerInfoModel *models.PartnerInfo) (domain.PartnerInfo, error) {
  197 + m := domain.PartnerInfo{
  198 + Partner: domain.Partner{
  199 + Id: partnerInfoModel.Id,
  200 + PartnerName: partnerInfoModel.PartnerName,
  201 + Account: partnerInfoModel.Account,
  202 + },
  203 + PartnerCategory: partnerInfoModel.PartnerCategory,
  204 + Password: partnerInfoModel.Password,
  205 + Status: partnerInfoModel.Status,
  206 + CreateAt: partnerInfoModel.CreateAt,
  207 + Salesman: partnerInfoModel.Salesman,
  208 + RegionInfo: partnerInfoModel.RegionInfo,
  209 + CooperateTime: partnerInfoModel.CooperateTime,
  210 + CompanyId: partnerInfoModel.CompanyId,
  211 + Remark: partnerInfoModel.Remark,
  212 + }
  213 + var p []domain.PartnerCategory
  214 + for _, v := range partnerInfoModel.PartnerCategoryInfos {
  215 + category := domain.PartnerCategory{
  216 + Id: v.Id,
  217 + Name: v.Name,
  218 + Code: v.Code,
  219 + }
  220 + p = append(p, category)
  221 + }
  222 + m.PartnerCategoryInfos = p
  223 + return m, nil
  224 +}
  225 +
  226 +func NewPartnerInfoRepository(transactionContext *transaction.TransactionContext) (*PartnerInfoRepository, error) {
  227 + if transactionContext == nil {
  228 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  229 + }
  230 + return &PartnerInfoRepository{transactionContext: transactionContext}, nil
  231 +}
@@ -64,6 +64,7 @@ func (gateway MmmBusinessAdminServiceGateway) httpDo(reqURL string, mathod strin @@ -64,6 +64,7 @@ func (gateway MmmBusinessAdminServiceGateway) httpDo(reqURL string, mathod strin
64 return body, nil 64 return body, nil
65 } 65 }
66 66
  67 +// GetUserAuth 请求企业平台确认用户是否可以使用天联共创后台
67 func (gateway MmmBusinessAdminServiceGateway) GetUserAuth(userId int64) (*ResponseGetUserAuth, error) { 68 func (gateway MmmBusinessAdminServiceGateway) GetUserAuth(userId int64) (*ResponseGetUserAuth, error) {
68 param := map[string]interface{}{ 69 param := map[string]interface{}{
69 "userId": fmt.Sprint(userId), 70 "userId": fmt.Sprint(userId),
@@ -36,13 +36,14 @@ func (c *PartnerInfoController) CreatePartnerInfo() { @@ -36,13 +36,14 @@ func (c *PartnerInfoController) CreatePartnerInfo() {
36 //用与适配前端定义的数据结构 36 //用与适配前端定义的数据结构
37 type Parameter struct { 37 type Parameter struct {
38 PartnerName string `json:"partnerName"` 38 PartnerName string `json:"partnerName"`
39 - PartnerType []int64 `json:"partnerType"` 39 + PartnerType []*domain.PartnerCategory `json:"partnerType"`
40 Area string `json:"area"` 40 Area string `json:"area"`
41 Account string `json:"account"` 41 Account string `json:"account"`
42 State int `json:"state"` 42 State int `json:"state"`
43 CooperationTime string `json:"cooperationTime"` 43 CooperationTime string `json:"cooperationTime"`
44 SalesmanName string `json:"salesmanName"` 44 SalesmanName string `json:"salesmanName"`
45 Phone string `json:"phone"` 45 Phone string `json:"phone"`
  46 + Remark string `json:"remark"`
46 } 47 }
47 var ( 48 var (
48 param Parameter 49 param Parameter
@@ -69,6 +70,7 @@ func (c *PartnerInfoController) CreatePartnerInfo() { @@ -69,6 +70,7 @@ func (c *PartnerInfoController) CreatePartnerInfo() {
69 PartnerCategory: param.PartnerType, 70 PartnerCategory: param.PartnerType,
70 CooperateTime: cooperateTime, 71 CooperateTime: cooperateTime,
71 CompanyId: companyId, 72 CompanyId: companyId,
  73 + Remark: param.Remark,
72 } 74 }
73 if len(param.SalesmanName) > 0 || len(param.Phone) > 0 { 75 if len(param.SalesmanName) > 0 || len(param.Phone) > 0 {
74 cmd.Salesman = []domain.Salesman{ 76 cmd.Salesman = []domain.Salesman{
@@ -104,12 +106,14 @@ func (c *PartnerInfoController) UpdatePartnerInfo() { @@ -104,12 +106,14 @@ func (c *PartnerInfoController) UpdatePartnerInfo() {
104 //用与适配前端定义的数据结构 106 //用与适配前端定义的数据结构
105 type Parameter struct { 107 type Parameter struct {
106 ID int64 `json:"id"` 108 ID int64 `json:"id"`
107 - PartnerType []int64 `json:"partnerType"` 109 + PartnerName string `json:"partnerName"`
  110 + PartnerType []*domain.PartnerCategory `json:"partnerType"`
108 Area string `json:"area"` 111 Area string `json:"area"`
109 State int `json:"state"` 112 State int `json:"state"`
110 CooperationTime string `json:"cooperationTime"` 113 CooperationTime string `json:"cooperationTime"`
111 SalesmanName string `json:"salesmanName"` 114 SalesmanName string `json:"salesmanName"`
112 Phone string `json:"phone"` 115 Phone string `json:"phone"`
  116 + Remark string `json:"remark"`
113 } 117 }
114 var ( 118 var (
115 param Parameter 119 param Parameter
@@ -129,6 +133,7 @@ func (c *PartnerInfoController) UpdatePartnerInfo() { @@ -129,6 +133,7 @@ func (c *PartnerInfoController) UpdatePartnerInfo() {
129 companyId := c.GetUserCompany() 133 companyId := c.GetUserCompany()
130 cmd := partnerInfoCmd.UpdatePartnerInfoCommand{ 134 cmd := partnerInfoCmd.UpdatePartnerInfoCommand{
131 Id: param.ID, 135 Id: param.ID,
  136 + PartnerName: param.PartnerName,
132 Status: param.State, 137 Status: param.State,
133 PartnerCategory: param.PartnerType, 138 PartnerCategory: param.PartnerType,
134 CooperateTime: cooperateTime, 139 CooperateTime: cooperateTime,
@@ -142,6 +147,7 @@ func (c *PartnerInfoController) UpdatePartnerInfo() { @@ -142,6 +147,7 @@ func (c *PartnerInfoController) UpdatePartnerInfo() {
142 }, 147 },
143 }, 148 },
144 CompanyId: companyId, 149 CompanyId: companyId,
  150 + Remark: param.Remark,
145 } 151 }
146 serve := partnerInfoService.NewPartnerInfoService(nil) 152 serve := partnerInfoService.NewPartnerInfoService(nil)
147 err = serve.UpdatePartnerInfo(&cmd) 153 err = serve.UpdatePartnerInfo(&cmd)
@@ -190,16 +196,18 @@ func (c *PartnerInfoController) GetPartnerInfo() { @@ -190,16 +196,18 @@ func (c *PartnerInfoController) GetPartnerInfo() {
190 "cooperationTime": partnerInfo.CooperateTime.Local().Format("2006-01-02"), 196 "cooperationTime": partnerInfo.CooperateTime.Local().Format("2006-01-02"),
191 "state": partnerInfo.Status, 197 "state": partnerInfo.Status,
192 "id": partnerInfo.Partner.Id, 198 "id": partnerInfo.Partner.Id,
  199 + "remark": partnerInfo.Remark,
193 } 200 }
194 if len(partnerInfo.Salesman) > 0 { 201 if len(partnerInfo.Salesman) > 0 {
195 rspResult["salesmanName"] = partnerInfo.Salesman[0].Name 202 rspResult["salesmanName"] = partnerInfo.Salesman[0].Name
196 rspResult["phone"] = partnerInfo.Salesman[0].Telephone 203 rspResult["phone"] = partnerInfo.Salesman[0].Telephone
197 } 204 }
198 - partnerTypes := []map[string]interface{}{} 205 + var partnerTypes []map[string]interface{}
199 for _, v := range partnerInfo.PartnerCategoryInfos { 206 for _, v := range partnerInfo.PartnerCategoryInfos {
200 m := map[string]interface{}{ 207 m := map[string]interface{}{
201 "id": v.Id, 208 "id": v.Id,
202 "name": v.Name, 209 "name": v.Name,
  210 + "code": v.Code,
203 } 211 }
204 partnerTypes = append(partnerTypes, m) 212 partnerTypes = append(partnerTypes, m)
205 } 213 }
@@ -208,6 +216,40 @@ func (c *PartnerInfoController) GetPartnerInfo() { @@ -208,6 +216,40 @@ func (c *PartnerInfoController) GetPartnerInfo() {
208 return 216 return
209 } 217 }
210 218
  219 +/**
  220 + * @Author SteveChan
  221 + * @Description // 移除合伙人
  222 + * @Date 15:31 2020/12/29
  223 + * @Param
  224 + * @return
  225 + **/
  226 +func (c *PartnerInfoController) RemovePartnerInfo() {
  227 + //用与适配前端定义的数据结构
  228 + type Parameter struct {
  229 + ID int64 `json:"id"`
  230 + }
  231 + var (
  232 + param Parameter
  233 + err error
  234 + )
  235 + if err = c.BindJsonData(&param); err != nil {
  236 + logs.Error(err)
  237 + c.ResponseError(errors.New("json数据解析失败"))
  238 + return
  239 + }
  240 + cmd := partnerInfoCmd.RemovePartnerInfoCommand{
  241 + Id: param.ID,
  242 + }
  243 + serve := partnerInfoService.NewPartnerInfoService(nil)
  244 + err = serve.RemovePartnerInfo(cmd)
  245 + if err != nil {
  246 + c.ResponseError(err)
  247 + return
  248 + }
  249 + c.ResponseData(nil)
  250 + return
  251 +}
  252 +
211 //PartnerInfoSetState 合伙人批量禁用.启用 253 //PartnerInfoSetState 合伙人批量禁用.启用
212 func (c *PartnerInfoController) PartnerInfoSetState() { 254 func (c *PartnerInfoController) PartnerInfoSetState() {
213 //用与适配前端定义的数据结构 255 //用与适配前端定义的数据结构
@@ -224,19 +266,19 @@ func (c *PartnerInfoController) PartnerInfoSetState() { @@ -224,19 +266,19 @@ func (c *PartnerInfoController) PartnerInfoSetState() {
224 c.ResponseError(errors.New("json数据解析失败")) 266 c.ResponseError(errors.New("json数据解析失败"))
225 return 267 return
226 } 268 }
227 - comanyId := c.GetUserCompany() 269 + companyId := c.GetUserCompany()
228 var cmd partnerInfoCmd.StatusPartnerInfoCommand 270 var cmd partnerInfoCmd.StatusPartnerInfoCommand
229 switch param.Status { 271 switch param.Status {
230 case 0: 272 case 0:
231 cmd = partnerInfoCmd.StatusPartnerInfoCommand{ 273 cmd = partnerInfoCmd.StatusPartnerInfoCommand{
232 Ids: param.Id, 274 Ids: param.Id,
233 - CompanyId: comanyId, 275 + CompanyId: companyId,
234 Status: domain.PARTNER_STATUS_NO, 276 Status: domain.PARTNER_STATUS_NO,
235 } 277 }
236 case 1: 278 case 1:
237 cmd = partnerInfoCmd.StatusPartnerInfoCommand{ 279 cmd = partnerInfoCmd.StatusPartnerInfoCommand{
238 Ids: param.Id, 280 Ids: param.Id,
239 - CompanyId: comanyId, 281 + CompanyId: companyId,
240 Status: domain.PARTNER_STATUS_YES, 282 Status: domain.PARTNER_STATUS_YES,
241 } 283 }
242 default: 284 default:
@@ -256,7 +298,7 @@ func (c *PartnerInfoController) PartnerInfoSetState() { @@ -256,7 +298,7 @@ func (c *PartnerInfoController) PartnerInfoSetState() {
256 //ListPartnerInfo 合伙人列表 298 //ListPartnerInfo 合伙人列表
257 func (c *PartnerInfoController) ListPartnerInfo() { 299 func (c *PartnerInfoController) ListPartnerInfo() {
258 type Parameter struct { 300 type Parameter struct {
259 - Partnertype int `json:"partnerType"` 301 + PartnerType int `json:"partnerType"`
260 Area string `json:"area"` 302 Area string `json:"area"`
261 PartnerName string `json:"partnerName"` 303 PartnerName string `json:"partnerName"`
262 PageSize int `json:"pageSize"` 304 PageSize int `json:"pageSize"`
@@ -280,7 +322,7 @@ func (c *PartnerInfoController) ListPartnerInfo() { @@ -280,7 +322,7 @@ func (c *PartnerInfoController) ListPartnerInfo() {
280 } 322 }
281 companyId := c.GetUserCompany() 323 companyId := c.GetUserCompany()
282 query := partnerQuery.ListPartnerInfoQuery{ 324 query := partnerQuery.ListPartnerInfoQuery{
283 - Partnertype: param.Partnertype, 325 + PartnerType: param.PartnerType,
284 PartnerName: param.PartnerName, 326 PartnerName: param.PartnerName,
285 RegionInfo: param.Area, 327 RegionInfo: param.Area,
286 Limit: param.PageSize, 328 Limit: param.PageSize,
@@ -294,7 +336,7 @@ func (c *PartnerInfoController) ListPartnerInfo() { @@ -294,7 +336,7 @@ func (c *PartnerInfoController) ListPartnerInfo() {
294 c.ResponseError(err) 336 c.ResponseError(err)
295 return 337 return
296 } 338 }
297 - resp := []map[string]interface{}{} 339 + var resp []map[string]interface{}
298 indexBegin := query.Offset 340 indexBegin := query.Offset
299 for i := range partners { 341 for i := range partners {
300 m := map[string]interface{}{ 342 m := map[string]interface{}{
@@ -309,6 +351,7 @@ func (c *PartnerInfoController) ListPartnerInfo() { @@ -309,6 +351,7 @@ func (c *PartnerInfoController) ListPartnerInfo() {
309 "partnerType": partners[i].PartnerCategoryInfos, 351 "partnerType": partners[i].PartnerCategoryInfos,
310 "salesmanName": "", 352 "salesmanName": "",
311 "phone": "", 353 "phone": "",
  354 + "remark": partners[i].Remark,
312 } 355 }
313 if len(partners[i].Salesman) > 0 { 356 if len(partners[i].Salesman) > 0 {
314 m["salesmanName"] = partners[i].Salesman[0].Name 357 m["salesmanName"] = partners[i].Salesman[0].Name
@@ -316,6 +359,9 @@ func (c *PartnerInfoController) ListPartnerInfo() { @@ -316,6 +359,9 @@ func (c *PartnerInfoController) ListPartnerInfo() {
316 } 359 }
317 resp = append(resp, m) 360 resp = append(resp, m)
318 } 361 }
  362 + if len(resp) == 0 {
  363 + resp = []map[string]interface{}{}
  364 + }
319 c.ResponsePageList(resp, count, param.PageNumber) 365 c.ResponsePageList(resp, count, param.PageNumber)
320 return 366 return
321 } 367 }
@@ -32,7 +32,7 @@ func (c *UserController) ListUser() { @@ -32,7 +32,7 @@ func (c *UserController) ListUser() {
32 //用与适配前端定义的数据结构 32 //用与适配前端定义的数据结构
33 type Paramter struct { 33 type Paramter struct {
34 SearchText string `json:"searchText"` 34 SearchText string `json:"searchText"`
35 - PageSize int `json::"pageSize"` 35 + PageSize int `json:"pageSize"`
36 PageNumber int `json:"pageNumber"` 36 PageNumber int `json:"pageNumber"`
37 } 37 }
38 var ( 38 var (
@@ -23,6 +23,7 @@ func init() { @@ -23,6 +23,7 @@ func init() {
23 beego.NSRouter("/edit", &controllers.PartnerInfoController{}, "POST:UpdatePartnerInfo"), 23 beego.NSRouter("/edit", &controllers.PartnerInfoController{}, "POST:UpdatePartnerInfo"),
24 beego.NSRouter("/detail", &controllers.PartnerInfoController{}, "POST:GetPartnerInfo"), 24 beego.NSRouter("/detail", &controllers.PartnerInfoController{}, "POST:GetPartnerInfo"),
25 beego.NSRouter("/batchDisabled", &controllers.PartnerInfoController{}, "POST:PartnerInfoSetState"), 25 beego.NSRouter("/batchDisabled", &controllers.PartnerInfoController{}, "POST:PartnerInfoSetState"),
  26 + beego.NSRouter("/remove", &controllers.PartnerInfoController{}, "POST:RemovePartnerInfo"),
26 ), 27 ),
27 beego.NSNamespace("/dividends", 28 beego.NSNamespace("/dividends",
28 beego.NSRouter("/list", &controllers.OrderDividendController{}, "POST:PageListOrderDividend"), 29 beego.NSRouter("/list", &controllers.OrderDividendController{}, "POST:PageListOrderDividend"),
@@ -8,7 +8,9 @@ import ( @@ -8,7 +8,9 @@ import (
8 //外部调用,企业平台,总后台调用 8 //外部调用,企业平台,总后台调用
9 func init() { 9 func init() {
10 nsPlatform := beego.NewNamespace("/platform", 10 nsPlatform := beego.NewNamespace("/platform",
  11 + //同步企业相关数据
11 beego.NSRouter("/action", &controllers.SyncDataController{}, "post:SyncData"), 12 beego.NSRouter("/action", &controllers.SyncDataController{}, "post:SyncData"),
  13 + //更换公司管理员
12 beego.NSRouter("/admins_change", &controllers.SyncDataController{}, "post:CompanyAdminChance"), 14 beego.NSRouter("/admins_change", &controllers.SyncDataController{}, "post:CompanyAdminChance"),
13 ) 15 )
14 nsUcenter := beego.NewNamespace("/ucenter", 16 nsUcenter := beego.NewNamespace("/ucenter",
@@ -51,6 +51,7 @@ func (c *MessageConsumer) ConsumeClaim(groupSession sarama.ConsumerGroupSession, @@ -51,6 +51,7 @@ func (c *MessageConsumer) ConsumeClaim(groupSession sarama.ConsumerGroupSession,
51 } 51 }
52 if err = topicHandle(message); err != nil { 52 if err = topicHandle(message); err != nil {
53 logs.Error("Message claimed: kafka消息处理错误 topic =", message.Topic, message.Offset, err) 53 logs.Error("Message claimed: kafka消息处理错误 topic =", message.Topic, message.Offset, err)
  54 +
54 } 55 }
55 groupSession.MarkMessage(message, "") 56 groupSession.MarkMessage(message, "")
56 } 57 }
@@ -30,6 +30,9 @@ func init() { @@ -30,6 +30,9 @@ func init() {
30 if runEnv == "partnermg_prd" { 30 if runEnv == "partnermg_prd" {
31 initHandleRoutersProd() 31 initHandleRoutersProd()
32 } 32 }
  33 + if runEnv == "partnermg_dev" {
  34 + initHandleRoutersDev()
  35 + }
33 } 36 }
34 37
35 func initHandleRoutersTest() { 38 func initHandleRoutersTest() {
@@ -39,3 +42,7 @@ func initHandleRoutersTest() { @@ -39,3 +42,7 @@ func initHandleRoutersTest() {
39 func initHandleRoutersProd() { 42 func initHandleRoutersProd() {
40 TopicHandleRouters["xiangmi_project"] = handles.DataFromXiangMi 43 TopicHandleRouters["xiangmi_project"] = handles.DataFromXiangMi
41 } 44 }
  45 +
  46 +func initHandleRoutersDev() {
  47 + TopicHandleRouters["xiangmi_project_dev"] = handles.DataFromXiangMi
  48 +}
此 diff 太大无法显示。
1 -package geetest  
2 -  
3 -import (  
4 - "crypto/md5"  
5 - "encoding/hex"  
6 - "encoding/json"  
7 - "errors"  
8 - "io/ioutil"  
9 - "net/http"  
10 - "net/url"  
11 - "strings"  
12 - "time"  
13 -)  
14 -  
15 -type GeetestLib struct {  
16 - CaptchaID string  
17 - PrivateKey string  
18 - Client *http.Client  
19 -}  
20 -  
21 -type FailbackRegisterRespnse struct {  
22 - Success int `json:"success"`  
23 - GT string `json:"gt"`  
24 - Challenge string `json:"challenge"`  
25 - NewCaptcha int `json:"new_captcha"`  
26 -}  
27 -  
28 -const (  
29 - geetestHost = "http://api.geetest.com"  
30 - registerURL = geetestHost + "/register.php"  
31 - validateURL = geetestHost + "/validate.php"  
32 -)  
33 -  
34 -func MD5Encode(input string) string {  
35 - md5Instant := md5.New()  
36 - md5Instant.Write([]byte(input))  
37 - return hex.EncodeToString(md5Instant.Sum(nil))  
38 -}  
39 -  
40 -// 初始化 GeetestLib  
41 -func NewGeetestLib(capthcaID string, privateKey string, timeOut time.Duration) (geetest GeetestLib){  
42 - client := &http.Client{Timeout: timeOut}  
43 - geetest = GeetestLib{capthcaID, privateKey, client}  
44 - return  
45 -}  
46 -  
47 -func (g *GeetestLib) getFailBackRegisterResponse(success int, challenge string) []byte {  
48 - if challenge == "" {  
49 - challenge = hex.EncodeToString(md5.New().Sum(nil))  
50 - }  
51 -  
52 - response := FailbackRegisterRespnse{  
53 - success,  
54 - g.CaptchaID,  
55 - challenge,  
56 - 1,  
57 - }  
58 - res, _ := json.Marshal(response)  
59 - return res  
60 -}  
61 -  
62 -func (g *GeetestLib) do(req *http.Request) (body []byte, err error) {  
63 - req.Header.Set("Content-Type", "application/x-www-form-urlencoded")  
64 - var resp *http.Response  
65 - if resp, err = g.Client.Do(req); err != nil {  
66 - return  
67 - }  
68 - defer resp.Body.Close()  
69 - if resp.StatusCode >= http.StatusInternalServerError {  
70 - err = errors.New("http status code 5xx")  
71 - return  
72 - }  
73 -  
74 - if body, err = ioutil.ReadAll(resp.Body); err != nil {  
75 - return  
76 - }  
77 - return  
78 -}  
79 -  
80 -func (g *GeetestLib) PreProcess(userID string, userIP string) (int8, []byte) {  
81 - params := url.Values{}  
82 - params.Add("gt", g.CaptchaID)  
83 - params.Add("new_captcha", "1")  
84 - if userID != "" {  
85 - params.Add("user_id", userID)  
86 - }  
87 - if userIP != "" {  
88 - params.Add("ip_adress", userIP)  
89 - }  
90 - req, _ := http.NewRequest("GET", registerURL+"?"+params.Encode(), nil)  
91 - body, err := g.do(req)  
92 - if err != nil {  
93 - return 0, g.getFailBackRegisterResponse(0, "")  
94 - }  
95 - challenge := string(body)  
96 - if len(challenge) != 32 {  
97 - return 0, g.getFailBackRegisterResponse(0, "")  
98 - } else {  
99 - challenge = MD5Encode(challenge + g.PrivateKey)  
100 - return 1, g.getFailBackRegisterResponse(1, challenge)  
101 - }  
102 -}  
103 -  
104 -func (g *GeetestLib) checkParas(challenge string, validate string, seccode string) bool {  
105 - if challenge == "" || validate == "" || seccode == "" {  
106 - return false  
107 - }  
108 - return true  
109 -}  
110 -  
111 -func (g *GeetestLib) checkSuccessRes(challenge string, validate string) bool {  
112 - return MD5Encode(g.PrivateKey+"geetest"+challenge) == validate  
113 -}  
114 -  
115 -func (g *GeetestLib) checkFailbackRes(challenge string, validate string) bool {  
116 - return MD5Encode(challenge) == validate  
117 -}  
118 -  
119 -func (g *GeetestLib) SuccessValidate(challenge string, validate string, seccode string, userID string, userIP string) bool {  
120 - if !g.checkParas(challenge, validate, seccode) {  
121 - return false  
122 - }  
123 - if !g.checkSuccessRes(challenge, validate) {  
124 - return false  
125 - }  
126 - params := url.Values{}  
127 - params.Add("seccode", seccode)  
128 - params.Add("challenge", challenge)  
129 - params.Add("captchaid", g.CaptchaID)  
130 - params.Add("sdk", "golang_v1.0.0")  
131 - if userID != "" {  
132 - params.Add("user_id", userID)  
133 - }  
134 - if userIP != "" {  
135 - params.Add("ip_adress", userIP)  
136 - }  
137 - req, _ := http.NewRequest("POST", validateURL, strings.NewReader(params.Encode()))  
138 - body, err := g.do(req)  
139 - if err != nil {  
140 - return false  
141 - }  
142 - res := string(body)  
143 - return res == MD5Encode(seccode)  
144 -}  
145 -  
146 -func (g *GeetestLib) FailbackValidate(challenge string, validate string, seccode string) bool {  
147 - if !g.checkParas(challenge, validate, seccode) {  
148 - return false  
149 - }  
150 - if !g.checkFailbackRes(challenge, validate) {  
151 - return false  
152 - }  
153 - return true  
154 -}  
@@ -3,9 +3,6 @@ @@ -3,9 +3,6 @@
3 github.com/360EntSecGroup-Skylar/excelize/v2 3 github.com/360EntSecGroup-Skylar/excelize/v2
4 # github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798 4 # github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798
5 github.com/DataDog/zstd 5 github.com/DataDog/zstd
6 -# github.com/GeeTeam/gt3-golang-sdk v0.0.0-20200116043922-446ca8a507d2  
7 -## explicit  
8 -github.com/GeeTeam/gt3-golang-sdk/geetest  
9 # github.com/Shopify/sarama v1.23.1 6 # github.com/Shopify/sarama v1.23.1
10 ## explicit 7 ## explicit
11 github.com/Shopify/sarama 8 github.com/Shopify/sarama