切换导航条
此项目
正在载入...
登录
allied-creation
/
allied-creation-gateway
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
Administrator
3 years ago
提交
ee0d2fcff8586c4f95fa04f03a4b500c0a4d7d33
2 个父辈
1d0f2efb
edfe7689
合并分支 'test' 到 'master'
Test 查看合并请求
!2
隐藏空白字符变更
内嵌
并排对比
正在显示
17 个修改的文件
包含
255 行增加
和
219 行删除
Dockerfile
pkg/application/mobile/cooperation/service/cooperation_projects.go
pkg/application/mobile/cooperation/service/credit_accounts_company.go
pkg/application/mobile/cooperation/service/credit_accounts_person.go
pkg/application/mobile/cooperation/service/statistics_company.go
pkg/application/mobile/cooperation/service/statistics_person.go
pkg/application/web/contractChangeLog/dto/dto.go
pkg/application/web/excelData/service/service.go
pkg/application/web/roles/service/roles.go
pkg/domain/enums.go
pkg/infrastructure/service_gateway/allied_creation_cooperation/param_cooperation_project.go
pkg/infrastructure/service_gateway/allied_creation_cooperation/param_credit_account.go
pkg/infrastructure/service_gateway/allied_creation_user/module_org.go
pkg/infrastructure/service_gateway/allied_creation_user/param_role.go
pkg/infrastructure/service_gateway/allied_creation_user/param_user.go
pkg/port/beego/controllers/web_client/excel_data_controller.go
pkg/port/beego/routers/web_excel_data.go
Dockerfile
查看文件 @
ee0d2fc
FROM 192.168.0.243:5000/mmm/allied-creation-gateway:20210809
ENV APP_DIR $GOPATH/src/project-202109
09
ENV APP_DIR $GOPATH/src/project-202109
16
RUN mkdir -p $APP_DIR
WORKDIR $APP_DIR/
COPY ./pkg pkg
...
...
pkg/application/mobile/cooperation/service/cooperation_projects.go
查看文件 @
ee0d2fc
package
service
import
(
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
"strconv"
"github.com/linmadan/egglib-go/core/application"
...
...
@@ -103,16 +105,16 @@ func (srv CooperationProjectService) SearchCooperationProject(projectQuery *comm
// PersonSearchCooperationProject 共创用户获取共创项目列表
func
(
srv
CooperationProjectService
)
PersonSearchCooperationProject
(
projectQuery
*
command
.
PersonSearchCooperationProjectQuery
)
(
int
,
interface
{},
error
)
{
extQueries
:=
extQuires
(
projectQuery
.
Operator
)
creationCooperationGateway
:=
allied_creation_cooperation
.
NewHttplibAlliedCreationCooperation
(
projectQuery
.
Operator
)
//orgidStr := strconv.Itoa(projectQuery.OrgId)
result
,
err
:=
creationCooperationGateway
.
CooperationProjectsSearch
(
allied_creation_cooperation
.
ReqCooperationProjectSearch
{
PageNumber
:
projectQuery
.
PageNumber
+
1
,
//手机序号从0开始的
PageSize
:
projectQuery
.
PageSize
,
OrgId
:
projectQuery
.
OrgId
,
Status
:
1
,
//搜索状态为“招标中”项目
Keyword
:
projectQuery
.
Keyword
,
//UserBaseId: projectQuery.Operator.UserBaseId,
PageNumber
:
projectQuery
.
PageNumber
+
1
,
//手机序号从0开始的
PageSize
:
projectQuery
.
PageSize
,
OrgId
:
projectQuery
.
OrgId
,
Status
:
1
,
//搜索状态为“招标中”项目
Keyword
:
projectQuery
.
Keyword
,
SearchCooperationProjectExtQueries
:
extQueries
,
})
if
err
!=
nil
{
return
0
,
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
...
...
@@ -120,6 +122,40 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery
return
int
(
result
.
Total
),
result
.
List
,
nil
}
func
extQuires
(
operator
domain
.
Operator
)
[]
*
allied_creation_cooperation
.
SearchCooperationProjectExtQuery
{
var
extQueries
=
make
([]
*
allied_creation_cooperation
.
SearchCooperationProjectExtQuery
,
0
)
if
operator
.
UserBaseId
>
0
{
gatewayUser
:=
allied_creation_user
.
NewHttplibAlliedCreationUser
(
operator
)
users
,
err
:=
gatewayUser
.
UserSearch
(
allied_creation_user
.
ReqUserSearch
{
Limit
:
100
,
Offset
:
0
,
UserBaseId
:
operator
.
UserBaseId
,
EnableStatus
:
domain
.
UserStatusEnable
,
})
if
err
!=
nil
{
return
extQueries
}
for
i
:=
range
users
.
Users
{
u
:=
users
.
Users
[
i
]
q
:=
&
allied_creation_cooperation
.
SearchCooperationProjectExtQuery
{
ExtCompanyId
:
int64
(
u
.
Company
.
CompanyId
),
//ExtOrgId: int64(u.Org.OrgId),
//ExtOrgIds: int64(u.UserOrg),
ExtUserId
:
int64
(
u
.
UserId
),
ExtUserBaseId
:
int64
(
u
.
UserBaseId
),
ExtCooperationProjectUndertakerTypes
:
[]
int32
{
int32
(
u
.
UserType
&
3
),
3
},
}
for
j
:=
range
u
.
UserOrg
{
org
:=
u
.
UserOrg
[
j
]
q
.
ExtOrgIds
=
append
(
q
.
ExtOrgIds
,
int64
(
org
.
OrgID
))
}
extQueries
=
append
(
extQueries
,
q
)
}
}
return
extQueries
}
// PersonSearchCooperationProject 共创用户获取共创项目列表
//func (srv CooperationProjectService) PersonRecommendCooperationProject(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) {
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
...
...
pkg/application/mobile/cooperation/service/credit_accounts_company.go
查看文件 @
ee0d2fc
...
...
@@ -124,8 +124,8 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi
PageSize
:
cmd
.
PageSize
,
PaymentStatus
:
2
,
OrgId
:
cmd
.
Operator
.
OrgId
,
BeginTime
:
beginTime
,
EndTime
:
endTime
,
PaymentBeginTime
:
beginTime
,
PaymentEndTime
:
endTime
,
CooperationContractNumbers
:
cooperationContractNumbers
,
}
resultMenu
,
err
:=
gateway
.
CreditAccountsSearch
(
req
)
...
...
@@ -137,10 +137,10 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi
"cooperationContractNumbers"
:
cooperationContractNumbers
,
}
if
cmd
.
BeginTime
>
0
{
queryOptions
[
"
b
eginTime"
]
=
beginTime
queryOptions
[
"
paymentB
eginTime"
]
=
beginTime
}
if
cmd
.
EndTime
>
0
{
queryOptions
[
"
e
ndTime"
]
=
endTime
queryOptions
[
"
paymentE
ndTime"
]
=
endTime
}
// 2.分红统计
dividendStatisticsResult
,
err
:=
gateway
.
CooperationStatistics
(
allied_creation_cooperation
.
CreditAccountStatistics
,
queryOptions
)
...
...
@@ -200,10 +200,10 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre
"sortByActuallyPaidAmount"
:
2
,
}
if
cmd
.
BeginTime
>
0
{
queryOptions
[
"
b
eginTime"
]
=
time
.
Unix
(
cmd
.
BeginTime
/
1000
,
0
)
queryOptions
[
"
paymentB
eginTime"
]
=
time
.
Unix
(
cmd
.
BeginTime
/
1000
,
0
)
}
if
cmd
.
EndTime
>
0
{
queryOptions
[
"
e
ndTime"
]
=
time
.
Unix
(
cmd
.
EndTime
/
1000
,
0
)
queryOptions
[
"
paymentE
ndTime"
]
=
time
.
Unix
(
cmd
.
EndTime
/
1000
,
0
)
}
cooperationUsersStatistics
,
err
:=
gateway
.
CooperationStatistics
(
allied_creation_cooperation
.
CompanyPaymentHistoryStatistics
,
queryOptions
)
if
err
!=
nil
{
...
...
pkg/application/mobile/cooperation/service/credit_accounts_person.go
查看文件 @
ee0d2fc
...
...
@@ -25,12 +25,12 @@ func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.Credit
endTime
=
time
.
Unix
(
cmd
.
EndTime
/
1000
,
0
)
}
resultMenu
,
err
:=
gateway
.
CreditAccountsSearch
(
allied_creation_cooperation
.
ReqCreditAccountsSearch
{
PageNumber
:
cmd
.
PageNumber
+
1
,
//手机序号从0开始的
PageSize
:
cmd
.
PageSize
,
PaymentStatus
:
2
,
UserBaseId
:
cmd
.
Operator
.
UserBaseId
,
BeginTime
:
beginTime
,
EndTime
:
endTime
,
PageNumber
:
cmd
.
PageNumber
+
1
,
//手机序号从0开始的
PageSize
:
cmd
.
PageSize
,
PaymentStatus
:
2
,
UserBaseId
:
cmd
.
Operator
.
UserBaseId
,
PaymentBeginTime
:
beginTime
,
PaymentEndTime
:
endTime
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
...
...
@@ -39,10 +39,10 @@ func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.Credit
"userBaseId"
:
cmd
.
Operator
.
UserBaseId
,
}
if
cmd
.
BeginTime
>
0
{
queryOptions
[
"
b
eginTime"
]
=
beginTime
queryOptions
[
"
paymentB
eginTime"
]
=
beginTime
}
if
cmd
.
EndTime
>
0
{
queryOptions
[
"
e
ndTime"
]
=
endTime
queryOptions
[
"
paymentE
ndTime"
]
=
endTime
}
// 2.分红统计
dividendStatisticsResult
,
err
:=
gateway
.
CooperationStatistics
(
allied_creation_cooperation
.
CreditAccountStatistics
,
queryOptions
)
...
...
@@ -85,10 +85,10 @@ func (srv PersonCreditAccountService) PaymentHistoryStatistics(cmd *command.Cred
"sortByActuallyPaidAmount"
:
2
,
}
if
cmd
.
BeginTime
>
0
{
queryOptions
[
"
b
eginTime"
]
=
time
.
Unix
(
cmd
.
BeginTime
/
1000
,
0
)
queryOptions
[
"
paymentB
eginTime"
]
=
time
.
Unix
(
cmd
.
BeginTime
/
1000
,
0
)
}
if
cmd
.
EndTime
>
0
{
queryOptions
[
"
e
ndTime"
]
=
time
.
Unix
(
cmd
.
EndTime
/
1000
,
0
)
queryOptions
[
"
paymentE
ndTime"
]
=
time
.
Unix
(
cmd
.
EndTime
/
1000
,
0
)
}
cooperationUsersStatistics
,
err
:=
gateway
.
CooperationStatistics
(
allied_creation_cooperation
.
PersonCompanyPaymentHistoryStatistics
,
queryOptions
)
if
err
!=
nil
{
...
...
pkg/application/mobile/cooperation/service/statistics_company.go
查看文件 @
ee0d2fc
...
...
@@ -237,8 +237,8 @@ func (srv CompanyStatisticsService) GoodsStatistics(cmd *command.GoodsStatistics
"companyId"
:
cmd
.
Operator
.
CompanyId
,
"orgId"
:
cmd
.
Operator
.
OrgId
,
"rankType"
:
cmd
.
RankingType
,
//当前月
//"offset":cmd.PageNumber*cmd.PageSize,
"top"
:
100
,
"offset"
:
cmd
.
PageNumber
*
cmd
.
PageSize
,
"limit"
:
cmd
.
PageSize
,
})
if
err
!=
nil
{
return
0
,
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
...
...
pkg/application/mobile/cooperation/service/statistics_person.go
查看文件 @
ee0d2fc
...
...
@@ -56,7 +56,7 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC
beginTime
:=
time
.
Date
(
year
,
month
,
1
,
0
,
0
,
0
,
0
,
time
.
Local
)
endTime
:=
beginTime
.
AddDate
(
0
,
1
,
0
)
// 2.本月分红统计 - 个人
dividendStatistics
Result
,
err
:=
gateway
.
CooperationStatistics
(
allied_creation_cooperation
.
CreditAccountStatistics
,
map
[
string
]
interface
{}{
unPaid
Result
,
err
:=
gateway
.
CooperationStatistics
(
allied_creation_cooperation
.
CreditAccountStatistics
,
map
[
string
]
interface
{}{
"userBaseId"
:
cmd
.
Operator
.
UserBaseId
,
"beginTime"
:
beginTime
,
"endTime"
:
endTime
,
...
...
@@ -71,14 +71,24 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC
Paid
float64
`json:"paid"`
Unpaid
float64
`json:"unpaid"`
}
var
annualDividend
=
&
AnnualDividend
{}
if
err
:=
json
.
UnmarshalFromString
(
json
.
MarshalToString
(
dividendStatisticsResult
),
annualDividend
);
err
!=
nil
{
var
annualUnPaidDividend
=
&
AnnualDividend
{}
if
err
:=
json
.
UnmarshalFromString
(
json
.
MarshalToString
(
unPaidResult
),
annualUnPaidDividend
);
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
// 2.本月分红统计 - 个人
paymentResult
,
err
:=
gateway
.
CooperationStatistics
(
allied_creation_cooperation
.
CreditAccountStatistics
,
map
[
string
]
interface
{}{
"userBaseId"
:
cmd
.
Operator
.
UserBaseId
,
"paymentBeginTime"
:
beginTime
,
"paymentEndTime"
:
endTime
,
})
var
annualPaymentDividend
=
&
AnnualDividend
{}
if
err
:=
json
.
UnmarshalFromString
(
json
.
MarshalToString
(
paymentResult
),
annualPaymentDividend
);
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
dividendStatistics
:=
map
[
string
]
interface
{}{
"dividendAmount"
:
annualDividend
.
Paid
+
annualDividend
.
Unpaid
,
// 分红金额 annualDividend.Total
"paidAmount"
:
annualDividend
.
Paid
,
// 已支付
"unPaidAmount"
:
annualDividend
.
Unpaid
,
// 未支付
"dividendAmount"
:
annualPaymentDividend
.
Paid
+
annualUnPaidDividend
.
Unpaid
,
// 分红金额 annualDividend.Total
"paidAmount"
:
annualPaymentDividend
.
Paid
,
// 已支付
"unPaidAmount"
:
annualUnPaidDividend
.
Unpaid
,
// 未支付
}
return
map
[
string
]
interface
{}{
...
...
@@ -156,6 +166,9 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer
// CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目)
func
(
srv
PersonStatisticsService
)
CooperationProjectRecommend
(
projectQuery
*
command
.
ListCooperationProjectQuery
)
(
int64
,
interface
{},
error
)
{
if
projectQuery
.
Operator
.
UserBaseId
>
0
{
}
creationCooperationGateway
:=
allied_creation_cooperation
.
NewHttplibAlliedCreationCooperation
(
projectQuery
.
Operator
)
result
,
err
:=
creationCooperationGateway
.
CooperationProjectsSearch
(
allied_creation_cooperation
.
ReqCooperationProjectSearch
{
...
...
pkg/application/web/contractChangeLog/dto/dto.go
查看文件 @
ee0d2fc
...
...
@@ -11,6 +11,7 @@ type ContractChangeLogItem struct {
OperationType
int
`json:"operationType"`
Undertakers
string
`json:"undertakers"`
UpdatedAt
string
`json:"updatedAt"`
OperatorTime
string
`json:"operationTime"`
}
func
ToContractChangeLogList
(
param
*
allied_creation_cooperation
.
DataContractChangeLogsSearch
)
[]
ContractChangeLogItem
{
...
...
@@ -25,6 +26,7 @@ func ToContractChangeLogList(param *allied_creation_cooperation.DataContractChan
OperationType
:
int
(
v
.
OperationType
),
Undertakers
:
v
.
Undertakers
,
UpdatedAt
:
v
.
UpdatedAt
.
Format
(
"2006-01-02 15:04:05"
),
OperatorTime
:
v
.
OperatorTime
.
Format
(
"2006-01-02 15:04:05"
),
}
listData
=
append
(
listData
,
item
)
}
...
...
pkg/application/web/excelData/service/service.go
查看文件 @
ee0d2fc
...
...
@@ -2,6 +2,8 @@ package service
import
(
"fmt"
"strings"
"github.com/linmadan/egglib-go/core/application"
"github.com/linmadan/egglib-go/utils/excel"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command"
...
...
@@ -9,7 +11,6 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/domainService"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
"strings"
)
type
ExcelDataService
struct
{
...
...
@@ -119,58 +120,60 @@ func (srv ExcelDataService) ImportCompanyUser2(importDataCommand *command.Import
// ImportCooperationUser 导入共创用户信息
func
(
srv
ExcelDataService
)
ImportCooperationUser
(
importDataCommand
*
command
.
ImportDataCommand
)
(
interface
{},
error
)
{
//initPassword, _, err := domainService.GetInitPassword(importDataCommand.Operator)
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
//excelImport := excel.NewExcelImport()
//excelImport.RowBegin = 2 //第二行开始读取
//excelImport.DataFields = []excel.DataField{
// {EnName: "UserCode", CnName: "*用户编号"},
// {EnName: "UserName", CnName: "*用户姓名"},
// {EnName: "CooperationCompany", CnName: "*合伙公司"},
// {EnName: "CooperationDeadline", CnName: "*合伙到期"},
// {EnName: "Phone", CnName: "*手机号"},
// {EnName: "Email", CnName: "邮箱"},
//}
//excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader)
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
//users := make([]allied_creation_user.BatchAddUserItem, 0)
//var fail int
//for _, v := range excelData {
// item := allied_creation_user.BatchAddUserItem{
// CompanyID: importDataCommand.Operator.CompanyId,
// UserType: domain.UserTypeCooperation,
// UserCode: v["UserCode"],
// OrganizationID: int(importDataCommand.Operator.OrgId),
// UserInfo: allied_creation_user.BatchAddUserItemUserInfo{
// UserName: v["UserName"],
// Phone: v["Phone"],
// Email: v["Email"],
// },
// CooperationInfo: allied_creation_user.BatchAddUserItemCooperationInfo{
// CooperationCompany: v["CooperationCompany"],
// },
// }
// item.CooperationInfo.CooperationDeadline, err = time.Parse("2006-01-02", v["CooperationDeadline"])
// if err != nil {
// fail++
// continue
// }
// users = append(users, item)
//}
//userGateway := allied_creation_user.NewHttplibAlliedCreationUser(importDataCommand.Operator)
//result, err := userGateway.UserBatchAdd(allied_creation_user.ReqBatchAddUser{
// Users: users,
// Password: initPassword,
//})
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
//return result, nil
return
nil
,
nil
initPassword
,
_
,
err
:=
domainService
.
GetInitPassword
(
importDataCommand
.
Operator
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
userGateway
:=
allied_creation_user
.
NewHttplibAlliedCreationUser
(
importDataCommand
.
Operator
)
orgResult
,
err
:=
userGateway
.
OrgGet
(
allied_creation_user
.
ReqOrgGet
{
OrgId
:
int
(
importDataCommand
.
Operator
.
OrgId
),
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
}
excelImport
:=
excel
.
NewExcelImport
()
excelImport
.
RowBegin
=
3
//第二行开始读取
excelImport
.
DataFields
=
[]
excel
.
DataField
{
{
EnName
:
"userCode"
,
CnName
:
"*用户编码"
},
{
EnName
:
"userName"
,
CnName
:
"*用户姓名"
},
{
EnName
:
"cooperationCompany"
,
CnName
:
"*合伙公司"
},
{
EnName
:
"cooperationDeadline"
,
CnName
:
"*合伙到期"
},
{
EnName
:
"enableStatus"
,
CnName
:
"*用户状态"
},
{
EnName
:
"phone"
,
CnName
:
"*手机号"
},
{
EnName
:
"email"
,
CnName
:
"邮箱"
},
}
excelData
,
err
:=
excelImport
.
OpenExcelFromIoReader
(
importDataCommand
.
Reader
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
users
:=
make
([]
allied_creation_user
.
BatchAddUserItem
,
0
)
for
_
,
v
:=
range
excelData
{
if
srv
.
fieldValueAllEmpty
(
v
)
{
continue
}
item
:=
allied_creation_user
.
BatchAddUserItem
{
CompanyId
:
importDataCommand
.
Operator
.
CompanyId
,
UserType
:
domain
.
UserTypeCooperation
,
UserCode
:
v
[
"userCode"
],
Org
:
orgResult
.
OrgCode
,
UserName
:
strings
.
TrimSpace
(
v
[
"userName"
]),
Phone
:
strings
.
TrimSpace
(
v
[
"phone"
]),
Email
:
strings
.
TrimSpace
(
v
[
"email"
]),
EnableStatus
:
strings
.
TrimSpace
(
v
[
"enableStatus"
]),
CooperationCompany
:
v
[
"cooperationCompany"
],
CooperationDeadline
:
v
[
"cooperationDeadline"
],
}
users
=
append
(
users
,
item
)
}
result
,
err
:=
userGateway
.
UserBatchAdd
(
allied_creation_user
.
ReqBatchAddUser
{
Users
:
users
,
Password
:
initPassword
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
return
srv
.
importResultWithHeader
(
excelImport
.
DataFields
,
result
.
FailRows
,
len
(
users
)),
nil
}
// ImportCompanyUser 导入公司用户信息
...
...
@@ -182,13 +185,13 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
excelImport
:=
excel
.
NewExcelImport
()
excelImport
.
RowBegin
=
3
//第二行开始读取
excelImport
.
DataFields
=
[]
excel
.
DataField
{
{
EnName
:
"userCode"
,
CnName
:
"*用户编
号
"
},
{
EnName
:
"userCode"
,
CnName
:
"*用户编
码
"
},
{
EnName
:
"userName"
,
CnName
:
"*用户姓名"
},
{
EnName
:
"org"
,
CnName
:
"*组织机构"
},
{
EnName
:
"department"
,
CnName
:
"*所属部门"
},
{
EnName
:
"enableStatus"
,
CnName
:
"*用户状态"
},
{
EnName
:
"phone"
,
CnName
:
"*手机号"
},
{
EnName
:
"email"
,
CnName
:
"邮箱"
},
{
EnName
:
"enableStatus"
,
CnName
:
"状态"
},
}
excelData
,
err
:=
excelImport
.
OpenExcelFromIoReader
(
importDataCommand
.
Reader
)
if
err
!=
nil
{
...
...
@@ -196,21 +199,19 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
}
users
:=
make
([]
allied_creation_user
.
BatchAddUserItem
,
0
)
for
_
,
v
:=
range
excelData
{
if
srv
.
fieldValueAllEmpty
(
v
)
{
continue
}
item
:=
allied_creation_user
.
BatchAddUserItem
{
CompanyId
:
importDataCommand
.
Operator
.
CompanyId
,
UserType
:
domain
.
UserTypeEmployee
,
UserCode
:
v
[
"userCode"
],
Org
:
v
[
"org"
],
Department
:
v
[
"department"
],
UserName
:
v
[
"userName"
],
Phone
:
v
[
"phone"
],
Email
:
v
[
"email"
],
EnableStatus
:
domain
.
UserStatusEnable
,
}
if
status
,
ok
:=
v
[
"status"
];
ok
{
if
strings
.
TrimSpace
(
status
)
!=
"启用"
{
item
.
EnableStatus
=
domain
.
UserStatusDisable
}
UserCode
:
strings
.
TrimSpace
(
v
[
"userCode"
]),
Org
:
strings
.
TrimSpace
(
v
[
"org"
]),
Department
:
strings
.
TrimSpace
(
v
[
"department"
]),
UserName
:
strings
.
TrimSpace
(
v
[
"userName"
]),
Phone
:
strings
.
TrimSpace
(
v
[
"phone"
]),
Email
:
strings
.
TrimSpace
(
v
[
"email"
]),
EnableStatus
:
strings
.
TrimSpace
(
v
[
"enableStatus"
]),
}
users
=
append
(
users
,
item
)
}
...
...
@@ -222,16 +223,16 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
return
srv
.
importResultWithHeader
(
excelImport
.
DataFields
,
result
.
FailRows
,
len
(
excelData
)),
nil
return
srv
.
importResultWithHeader
(
excelImport
.
DataFields
,
result
.
FailRows
,
len
(
users
)),
nil
}
func
(
srv
ExcelDataService
)
ImportOrganization
(
importDataCommand
*
command
.
ImportDataCommand
)
(
interface
{},
error
)
{
excelImport
:=
excel
.
NewExcelImport
()
excelImport
.
RowBegin
=
2
//第二行开始读取
excelImport
.
RowBegin
=
3
//第二行开始读取
excelImport
.
DataFields
=
[]
excel
.
DataField
{
{
EnName
:
"OrgCode"
,
CnName
:
"*部门编码"
},
{
EnName
:
"OrgName"
,
CnName
:
"*部门名称"
},
{
EnName
:
"ParentOrgCode"
,
CnName
:
"*上级部门编码"
},
{
EnName
:
"orgCode"
,
CnName
:
"*部门编码"
},
{
EnName
:
"orgName"
,
CnName
:
"*部门名称"
},
{
EnName
:
"parentOrgCode"
,
CnName
:
"*上级部门编码"
},
}
excelData
,
err
:=
excelImport
.
OpenExcelFromIoReader
(
importDataCommand
.
Reader
)
if
err
!=
nil
{
...
...
@@ -239,11 +240,14 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import
}
items
:=
make
([]
allied_creation_user
.
BatchAddOrgItem
,
0
)
for
_
,
v
:=
range
excelData
{
if
srv
.
fieldValueAllEmpty
(
v
)
{
continue
}
item
:=
allied_creation_user
.
BatchAddOrgItem
{
CompanyId
:
importDataCommand
.
Operator
.
CompanyId
,
OrgCode
:
v
[
"OrgCode"
],
OrgName
:
v
[
"OrgName"
],
ParentOrgCode
:
v
[
"ParentOrgCode"
],
OrgCode
:
v
[
"orgCode"
],
OrgName
:
v
[
"orgName"
],
ParentOrgCode
:
v
[
"parentOrgCode"
],
}
items
=
append
(
items
,
item
)
}
...
...
@@ -254,7 +258,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
return
result
,
nil
return
srv
.
importResultWithHeader
(
excelImport
.
DataFields
,
result
.
FailRows
,
len
(
items
))
,
nil
}
// 导入结果
...
...
@@ -281,14 +285,25 @@ func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, fa
return
result
}
func
(
srv
ExcelDataService
)
fieldValueAllEmpty
(
param
map
[
string
]
string
)
bool
{
isAllEmpty
:=
true
for
_
,
v
:=
range
param
{
value
:=
strings
.
TrimSpace
(
v
)
if
len
(
value
)
>
0
{
isAllEmpty
=
false
}
}
return
isAllEmpty
}
// ImportCompanyUser 导入公司用户信息
func
(
srv
ExcelDataService
)
FileImportTemplate
(
importDataCommand
*
command
.
ImportDataCommand
)
(
interface
{},
error
)
{
var
mapTemplate
=
map
[
string
]
string
{
domain
.
TemplateCompanyUser
:
"https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx"
,
// 模板待更新
domain
.
TemplateOrganization
:
"https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx"
,
domain
.
TemplateCooperationUser
:
"https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx"
,
domain
.
TemplateDividendsOrders
:
"https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx"
,
domain
.
ImportCompanyUser
:
"https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210916/object/1631807485_EaxECeRz23WpzrMZmbwdEPRJ3Pdxpx5X.xlsx"
,
domain
.
ImportOrganization
:
"https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210916/object/1631807490_r2XWhGmbWWmpbeePBkZ3EJQFKcZEMpEm.xlsx"
,
domain
.
ImportDividendsOrders
:
"https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210917/object/1631843469_DykNwexeYYtzxzbwsER5RrzCS7QRwGmd.xlsx"
,
domain
.
ImportCooperationUser
:
"https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210918/object/1631932960_fen6RZS7ZesyDPMzXactKKCenhRMkfRb.xlsx"
,
domain
.
ImportDividendsReturnOrders
:
"https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210918/object/1631933214_MbTxsQtnEEMprHADFR6MedfZBkxYWBYA.xlsx"
,
}
var
url
string
var
ok
bool
...
...
pkg/application/web/roles/service/roles.go
查看文件 @
ee0d2fc
...
...
@@ -139,9 +139,9 @@ func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *qu
roleMenuBeforeEditQuery
.
Operator
)
roleId
,
_
:=
strconv
.
Atoi
(
roleMenuBeforeEditQuery
.
RoleId
)
roles
,
err
:=
creationUserGateway
.
RoleSearch
(
allied_creation_user
.
ReqRoleSearch
{
OrgId
:
roleMenuBeforeEditQuery
.
Operator
.
OrgId
,
Limit
:
999
,
RoleType
:
1
,
CompanyId
:
roleMenuBeforeEditQuery
.
Operator
.
CompanyId
,
Limit
:
999
,
RoleType
:
1
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
...
...
pkg/domain/enums.go
查看文件 @
ee0d2fc
...
...
@@ -51,25 +51,14 @@ const (
const
(
// 导入公司用户
ImportCompanyUser
=
"
ImportCompanyUser
"
ImportCompanyUser
=
"
ADMIN_SYSTEM-MANAGE_BASE_USER
"
// 导入公司组织
ImportOrganization
=
"
ImportOrganization
"
ImportOrganization
=
"
ADMIN_SYSTEM-MANAGE_BASE_DEPARTMENT
"
// 导入共创用户
ImportCooperationUser
=
"
ImportCooperationUser
"
ImportCooperationUser
=
"
ADMIN_SYSTEM-MANAGE_BASE_ALLIED-USER
"
// 导入分红订单
ImportDividendsOrders
=
"ImportDividendsOrders"
)
//excel 导入模板
const
(
// 导入公司用户
TemplateCompanyUser
=
"TemplateCompanyUser"
// 导入公司组织
TemplateOrganization
=
"TemplateOrganization"
// 导入共创用户
TemplateCooperationUser
=
"TemplateCooperationUser"
// 分红订单模板
TemplateDividendsOrders
=
"TemplateDividendsOrders"
ImportDividendsOrders
=
"BUSINESS_ALLIED-CREATION_BONUS_ORDER"
// 导入退货订单
ImportDividendsReturnOrders
=
"BUSINESS_ALLIED-CREATION_BONUS_RETURN"
)
...
...
pkg/infrastructure/service_gateway/allied_creation_cooperation/param_cooperation_project.go
查看文件 @
ee0d2fc
...
...
@@ -171,6 +171,20 @@ type (
//查询共创项目
type
(
SearchCooperationProjectExtQuery
struct
{
// 公司ID,通过集成REST上下文获取
ExtCompanyId
int64
`cname:"公司ID" json:"extCompanyId,omitempty"`
// 组织机构ID
ExtOrgId
int64
`cname:"组织机构ID" json:"extOrgId,omitempty"`
// 关联的组织机构ID列表
ExtOrgIds
[]
int64
`cname:"关联的组织机构ID列表" json:"extOrgIds,omitempty"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
ExtUserId
int64
`cname:"用户ID" json:"extUserId,omitempty"`
// 用户基础数据id
ExtUserBaseId
int64
`cname:"用户基础数据ID" json:"extUserBaseId,omitempty"`
// 共创项目承接对象,1员工,2共创用户,3公开,可多选
ExtCooperationProjectUndertakerTypes
[]
int32
`json:"extCooperationProjectUndertakerTypes"`
}
ReqCooperationProjectSearch
struct
{
PageNumber
int
`json:"pageNumber"`
PageSize
int
`json:"pageSize"`
...
...
@@ -192,6 +206,8 @@ type (
UserBaseId
int64
`cname:"用户基础数据ID" json:"userBaseId"`
// 共创项目承接对象,1员工,2共创用户,4公开,可以多选
CooperationProjectUndertakerType
int32
`json:"cooperationProjectUndertakerType"`
// 额外的查询条件
SearchCooperationProjectExtQueries
[]
*
SearchCooperationProjectExtQuery
`cname:"额外的查询条件" json:"searchCooperationProjectExtQueries"`
}
DataCooperationProjectSearchItem
struct
{
CooperationProjectID
string
`json:"cooperationProjectId"`
...
...
pkg/infrastructure/service_gateway/allied_creation_cooperation/param_credit_account.go
查看文件 @
ee0d2fc
...
...
@@ -90,6 +90,10 @@ type (
UserBaseId
int64
`cname:"用户基础数据ID" json:"userBaseId"`
BeginTime
time
.
Time
`json:"beginTime"`
EndTime
time
.
Time
`json:"endTime"`
// 支付开始时间
PaymentBeginTime
time
.
Time
`json:"paymentBeginTime"`
// 支付结束时间
PaymentEndTime
time
.
Time
`json:"paymentEndTime"`
// 合约编号列表
CooperationContractNumbers
[]
string
`json:"cooperationContractNumbers"`
}
...
...
pkg/infrastructure/service_gateway/allied_creation_user/module_org.go
查看文件 @
ee0d2fc
...
...
@@ -226,7 +226,7 @@ func (gateway HttplibAlliedCreationUser) OrgSearch(param ReqOrgSearch) (*DataOrg
return
&
data
,
err
}
func
(
gateway
HttplibAlliedCreationUser
)
OrgBatchAdd
(
param
ReqBatchAddOrg
)
(
*
Data
BatchAddOrg
,
error
)
{
func
(
gateway
HttplibAlliedCreationUser
)
OrgBatchAdd
(
param
ReqBatchAddOrg
)
(
*
Data
ImportResponse
,
error
)
{
url
:=
fmt
.
Sprintf
(
"%s%s"
,
gateway
.
baseUrL
,
"/org/batch-add"
)
method
:=
"post"
req
:=
gateway
.
CreateRequest
(
url
,
method
)
...
...
@@ -252,7 +252,7 @@ func (gateway HttplibAlliedCreationUser) OrgBatchAdd(param ReqBatchAddOrg) (*Dat
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"解析批量添加用户:%w"
,
err
)
}
var
data
Data
BatchAddOrg
var
data
Data
ImportResponse
err
=
gateway
.
GetResponseData
(
result
,
&
data
)
return
&
data
,
err
}
...
...
pkg/infrastructure/service_gateway/allied_creation_user/param_role.go
查看文件 @
ee0d2fc
...
...
@@ -33,6 +33,8 @@ type (
RoleName
string
`json:"roleName"`
// 组织ID
OrgId
int64
`json:"orgId"`
// 企业id
CompanyId
int64
`cname:"企业id" json:"companyId"`
// 匹配多个组织
InOrgIds
[]
int64
`cname:"匹配多个组织" json:"inOrgIds,omitempty"`
// 角色名称
...
...
pkg/infrastructure/service_gateway/allied_creation_user/param_user.go
查看文件 @
ee0d2fc
...
...
@@ -393,11 +393,11 @@ type (
// 部门编码
Department
string
`json:"department,omitempty"`
// 状态(1:启用 2:禁用 3:注销)
EnableStatus
int
`json:"enableStatus,omitempty"`
EnableStatus
string
`json:"enableStatus,omitempty"`
// 共创公司 cooperationCompany
CooperationCompany
string
`json:"cooperationCompany"`
// 共创到期时间 (yyyy-MM-dd) cooperationDeadline
CooperationDeadline
time
.
Time
`json:"cooperationDeadline"`
CooperationDeadline
string
`json:"cooperationDeadline"`
// 失败理由
FailReason
string
`json:"failReason"`
}
...
...
pkg/port/beego/controllers/web_client/excel_data_controller.go
查看文件 @
ee0d2fc
package
web_client
import
(
"fmt"
"io"
"strings"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
...
...
@@ -43,8 +45,8 @@ func (controller *ExcelDataController) fieldValueAllEmpty(param map[string]strin
return
isAllEmpty
}
//导出公司用户
func
(
controller
*
ExcelDataController
)
ExportCompanyUser
()
{
// ExportCompanyUser 导出公司用户
func
(
controller
ExcelDataController
)
ExportCompanyUser
()
{
excelService
:=
service
.
NewExcelDataService
(
nil
)
companyUserListQuery
:=
&
query
.
CompanyUserListQuery
{}
err
:=
controller
.
Unmarshal
(
companyUserListQuery
)
...
...
@@ -70,8 +72,8 @@ func (controller *ExcelDataController) ExportCompanyUser() {
controller
.
responseExcelByFile
(
controller
.
Ctx
,
excelTool
,
"导出公司用户"
)
}
//导出共创用户
func
(
controller
*
ExcelDataController
)
ExportCooperationUser
()
{
// ExportCooperationUser 导出共创用户
func
(
controller
ExcelDataController
)
ExportCooperationUser
()
{
excelService
:=
service
.
NewExcelDataService
(
nil
)
companyUserListQuery
:=
&
query
.
CompanyUserListQuery
{}
err
:=
controller
.
Unmarshal
(
companyUserListQuery
)
...
...
@@ -97,12 +99,12 @@ func (controller *ExcelDataController) ExportCooperationUser() {
controller
.
responseExcelByFile
(
controller
.
Ctx
,
excelTool
,
"导出共创用户"
)
}
// ImportDividendsOrder TODO 导入分红订单
func
(
controller
*
ExcelDataController
)
ImportDividendsOrder
()
{
// ImportDividendsOrder 导入分红订单
func
(
controller
ExcelDataController
)
ImportDividendsOrder
()
{
importDividendsOrder
(
controller
)
}
func
importDividendsOrder
(
controller
*
ExcelDataController
)
{
func
importDividendsOrder
(
controller
ExcelDataController
)
{
fileReader
,
err
:=
controller
.
GetExcelFile
()
if
err
!=
nil
{
...
...
@@ -110,7 +112,7 @@ func importDividendsOrder(controller *ExcelDataController) {
return
}
excelImport
:=
excel
.
NewExcelImport
()
excelImport
.
RowBegin
=
2
//第2
行开始读取
excelImport
.
RowBegin
=
3
//第3
行开始读取
excelImport
.
DataFields
=
[]
excel
.
DataField
{
{
EnName
:
"OriginalOrderNum"
,
CnName
:
"*来源单号"
},
{
EnName
:
"DividendsCustomerName"
,
CnName
:
"*客户名称"
},
...
...
@@ -120,7 +122,7 @@ func importDividendsOrder(controller *ExcelDataController) {
{
EnName
:
"OrderGoodQuantity"
,
CnName
:
"*产品数量"
},
{
EnName
:
"OrderGoodPrice"
,
CnName
:
"*产品价格"
},
{
EnName
:
"Expense"
,
CnName
:
"费用"
},
{
EnName
:
"CooperationContractNumber"
,
CnName
:
"项目合约编号"
},
{
EnName
:
"CooperationContractNumber"
,
CnName
:
"
*
项目合约编号"
},
}
excelData
,
err
:=
excelImport
.
OpenExcelFromIoReader
(
fileReader
)
if
err
!=
nil
{
...
...
@@ -161,11 +163,11 @@ func importDividendsOrder(controller *ExcelDataController) {
}
// ImportDividendsReturnedOrder 导入分红退货单
func
(
controller
*
ExcelDataController
)
ImportDividendsReturnedOrder
()
{
func
(
controller
ExcelDataController
)
ImportDividendsReturnedOrder
()
{
importDividendsReturnedOrder
(
controller
)
}
func
importDividendsReturnedOrder
(
controller
*
ExcelDataController
)
{
func
importDividendsReturnedOrder
(
controller
ExcelDataController
)
{
fileReader
,
err
:=
controller
.
GetExcelFile
()
if
err
!=
nil
{
...
...
@@ -173,7 +175,7 @@ func importDividendsReturnedOrder(controller *ExcelDataController) {
return
}
excelImport
:=
excel
.
NewExcelImport
()
excelImport
.
RowBegin
=
2
//第2行表头开始读取
excelImport
.
RowBegin
=
3
//第2行表头开始读取
excelImport
.
DataFields
=
[]
excel
.
DataField
{
{
EnName
:
"OriginalOrderNum"
,
CnName
:
"*来源单号"
},
{
EnName
:
"DividendsReturnedCustomerName"
,
CnName
:
"*客户名称"
},
...
...
@@ -183,7 +185,7 @@ func importDividendsReturnedOrder(controller *ExcelDataController) {
{
EnName
:
"RegionName"
,
CnName
:
"退货区域"
},
{
EnName
:
"OrderGoodQuantity"
,
CnName
:
"*退货数量"
},
{
EnName
:
"OrderGoodPrice"
,
CnName
:
"*退货价格"
},
{
EnName
:
"CooperationContractNumber"
,
CnName
:
"项目合约编号"
},
{
EnName
:
"CooperationContractNumber"
,
CnName
:
"
*
项目合约编号"
},
}
excelData
,
err
:=
excelImport
.
OpenExcelFromIoReader
(
fileReader
)
if
err
!=
nil
{
...
...
@@ -223,89 +225,51 @@ func importDividendsReturnedOrder(controller *ExcelDataController) {
controller
.
Response
(
result
,
nil
)
}
func
(
controller
*
ExcelDataController
)
ImportCompanyUser
()
{
importCompanyUser
(
controller
)
}
func
importCompanyUser
(
controller
*
ExcelDataController
)
{
excelService
:=
service
.
NewExcelDataService
(
nil
)
r
,
err
:=
controller
.
GetExcelFile
()
if
err
!=
nil
{
controller
.
Response
(
nil
,
err
)
return
}
cmd
:=
&
command
.
ImportDataCommand
{}
cmd
.
Operator
=
controller
.
GetOperator
()
cmd
.
Reader
=
r
data
,
err
:=
excelService
.
ImportCompanyUser
(
cmd
)
controller
.
Response
(
data
,
err
)
}
func
(
controller
*
ExcelDataController
)
ImportCooperationUser
()
{
importCooperationUser
(
controller
)
}
func
importCooperationUser
(
controller
*
ExcelDataController
)
{
excelService
:=
service
.
NewExcelDataService
(
nil
)
r
,
err
:=
controller
.
GetExcelFile
()
if
err
!=
nil
{
controller
.
Response
(
nil
,
err
)
return
// FileImport 文件导入
func
(
controller
ExcelDataController
)
FileImport
()
{
code
:=
controller
.
GetString
(
"code"
)
switch
code
{
case
domain
.
ImportDividendsOrders
:
importDividendsOrder
(
controller
)
case
domain
.
ImportDividendsReturnOrders
:
importDividendsReturnedOrder
(
controller
)
default
:
defaultImport
(
controller
)
}
cmd
:=
&
command
.
ImportDataCommand
{}
cmd
.
Operator
=
controller
.
GetOperator
()
cmd
.
Reader
=
r
data
,
err
:=
excelService
.
ImportCooperationUser
(
cmd
)
controller
.
Response
(
data
,
err
)
}
func
(
controller
*
ExcelDataController
)
ImportOrganization
()
{
func
defaultImport
(
controller
ExcelDataController
)
{
var
(
data
interface
{}
err
error
r
io
.
Reader
)
excelService
:=
service
.
NewExcelDataService
(
nil
)
r
,
err
:
=
controller
.
GetExcelFile
()
r
,
err
=
controller
.
GetExcelFile
()
if
err
!=
nil
{
controller
.
Response
(
nil
,
err
)
return
}
cmd
:=
&
command
.
ImportDataCommand
{}
controller
.
ParseForm
(
cmd
)
cmd
.
Operator
=
controller
.
GetOperator
()
cmd
.
Reader
=
r
data
,
err
:=
excelService
.
ImportOrganization
(
cmd
)
controller
.
Response
(
data
,
err
)
}
func
(
controller
*
ExcelDataController
)
FileImport
()
{
// excelService := service.NewExcelDataService(nil)
// r, err := controller.GetExcelFile()
// if err != nil {
// controller.Response(nil, err)
// return
// }
// cmd := &command.ImportDataCommand{}
//controller.Unmarshal(cmd)
// controller.ParseForm(cmd)
// cmd.Operator = controller.GetOperator()
// cmd.Reader = r
// var (
// data interface{}
// err error
// )
code
:=
controller
.
GetString
(
"code"
)
switch
code
{
switch
cmd
.
Code
{
case
domain
.
ImportCompanyUser
:
importCompanyUser
(
controller
)
data
,
err
=
excelService
.
ImportCompanyUser
(
cmd
)
case
domain
.
ImportCooperationUser
:
importCooperationUser
(
controller
)
case
domain
.
ImportDividendsOrders
:
importDividendsOrder
(
controller
)
data
,
err
=
excelService
.
ImportCooperationUser
(
cmd
)
case
domain
.
ImportOrganization
:
importDividendsReturnedOrder
(
controller
)
data
,
err
=
excelService
.
ImportOrganization
(
cmd
)
default
:
err
=
fmt
.
Errorf
(
"导入不存在 Code:%v"
,
cmd
.
Code
)
}
//
controller.Response(data, err)
controller
.
Response
(
data
,
err
)
}
func
(
controller
*
ExcelDataController
)
FileImportTemplate
()
{
func
(
controller
ExcelDataController
)
FileImportTemplate
()
{
excelService
:=
service
.
NewExcelDataService
(
nil
)
cmd
:=
&
command
.
ImportDataCommand
{}
//controller.Unmarshal(cmd)
code
:=
controller
.
GetString
(
":code"
)
cmd
.
Code
=
code
var
data
interface
{}
...
...
pkg/port/beego/routers/web_excel_data.go
查看文件 @
ee0d2fc
...
...
@@ -9,14 +9,9 @@ func init() {
web
.
Router
(
"/v1/web/excel/export/company-user"
,
&
web_client
.
ExcelDataController
{},
"Post:ExportCompanyUser"
)
web
.
Router
(
"/v1/web/excel/export/cooperation-user"
,
&
web_client
.
ExcelDataController
{},
"Post:ExportCooperationUser"
)
web
.
Router
(
"/v1/web/excel/import/company-user"
,
&
web_client
.
ExcelDataController
{},
"Post:ImportCompanyUser"
)
web
.
Router
(
"/v1/web/excel/import/cooperation-user"
,
&
web_client
.
ExcelDataController
{},
"Post:ImportCooperationUser"
)
web
.
Router
(
"/v1/web/excel/import/dividends-orders"
,
&
web_client
.
ExcelDataController
{},
"Post:ImportDividendsOrder"
)
web
.
Router
(
"/v1/web/excel/import/dividends-returned-orders"
,
&
web_client
.
ExcelDataController
{},
"Post:ImportDividendsReturnedOrder"
)
web
.
Router
(
"/v1/web/excel/import/organization"
,
&
web_client
.
ExcelDataController
{},
"Post:ImportOrganization"
)
web
.
Router
(
"/v1/web/file-import"
,
&
web_client
.
ExcelDataController
{},
"Post:FileImport"
)
web
.
Router
(
"/v1/web/file-import-template/:code"
,
&
web_client
.
ExcelDataController
{},
"Get:FileImportTemplate"
)
}
...
...
请
注册
或
登录
后发表评论