切换导航条
此项目
正在载入...
登录
allied-creation
/
allied-creation-gateway
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
yangfu
3 years ago
提交
57f2f9ce0ff8f74ecc4bdcbeb3064603d1cb6138
1 个父辈
98efea11
用户导出导出修改
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
48 行增加
和
10 行删除
pkg/application/mobile/cooperation/service/credit_accounts_company.go
pkg/application/web/excelData/service/service.go
pkg/infrastructure/domainService/service.go
pkg/infrastructure/service_gateway/allied_creation_cooperation/module_cooperation_statistics.go
pkg/infrastructure/service_gateway/allied_creation_user/param_user.go
pkg/port/beego/controllers/base_controller.go
pkg/application/mobile/cooperation/service/credit_accounts_company.go
查看文件 @
57f2f9c
...
...
@@ -120,7 +120,7 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre
if
cmd
.
EndTime
>
0
{
queryOptions
[
"endTime"
]
=
time
.
Unix
(
cmd
.
EndTime
/
1000
,
0
)
}
cooperationUsersStatistics
,
err
:=
gateway
.
CooperationStatistics
(
allied_creation_cooperation
.
Company
CooperationUsers
Statistics
,
queryOptions
)
cooperationUsersStatistics
,
err
:=
gateway
.
CooperationStatistics
(
allied_creation_cooperation
.
Company
PaymentHistory
Statistics
,
queryOptions
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
...
...
pkg/application/web/excelData/service/service.go
查看文件 @
57f2f9c
...
...
@@ -7,6 +7,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/query"
"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"
"strconv"
"time"
...
...
@@ -61,6 +62,10 @@ func (srv ExcelDataService) ExportCooperationUser(companyUserListQuery *query.Co
// ImportCompanyUser 导入公司用户信息
func
(
srv
ExcelDataService
)
ImportCompanyUser
(
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
{
...
...
@@ -70,13 +75,13 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
{
EnName
:
"DepartmentID"
,
CnName
:
"*所属部门"
},
{
EnName
:
"Phone"
,
CnName
:
"*手机号"
},
{
EnName
:
"Email"
,
CnName
:
"邮箱"
},
{
EnName
:
"Status"
,
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
,
...
...
@@ -93,19 +98,18 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
}
item
.
OrganizationID
,
err
=
strconv
.
Atoi
(
v
[
"OrganizationID"
])
if
err
!=
nil
{
fail
++
continue
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
fmt
.
Sprintf
(
"用户:%v 组织值:%v 类型无效(数值类型)"
,
item
.
UserInfo
.
UserName
,
item
.
OrganizationID
))
}
item
.
DepartmentID
,
err
=
strconv
.
Atoi
(
v
[
"DepartmentID"
])
if
err
!=
nil
{
fail
++
continue
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
fmt
.
Sprintf
(
"用户:%v 部门值:%v 类型无效(数值类型)"
,
item
.
UserInfo
.
UserName
,
item
.
DepartmentID
))
}
users
=
append
(
users
,
item
)
}
userGateway
:=
allied_creation_user
.
NewHttplibAlliedCreationUser
(
importDataCommand
.
Operator
)
result
,
err
:=
userGateway
.
UserBatchAdd
(
allied_creation_user
.
ReqBatchAddUser
{
Users
:
users
,
Users
:
users
,
Password
:
initPassword
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
...
...
@@ -115,6 +119,10 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
// 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
{
...
...
@@ -155,7 +163,8 @@ func (srv ExcelDataService) ImportCooperationUser(importDataCommand *command.Imp
}
userGateway
:=
allied_creation_user
.
NewHttplibAlliedCreationUser
(
importDataCommand
.
Operator
)
result
,
err
:=
userGateway
.
UserBatchAdd
(
allied_creation_user
.
ReqBatchAddUser
{
Users
:
users
,
Users
:
users
,
Password
:
initPassword
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
...
...
pkg/infrastructure/domainService/service.go
0 → 100644
查看文件 @
57f2f9c
package
domainService
import
(
"crypto/sha1"
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
//GetInitPassword 获取公司初始化密码
func
GetInitPassword
(
operator
domain
.
Operator
)
(
string
,
string
,
error
)
{
var
password
string
alliedCreationBasic
:=
allied_creation_basic
.
NewHttplibAlliedCreationBasic
(
operator
)
reqResult
,
err
:=
alliedCreationBasic
.
SystemSettingGet
(
allied_creation_basic
.
ReqSystemSettingGet
{
domain
.
InitPasswordSettingKey
,
})
if
err
!=
nil
{
log
.
Logger
.
Error
(
err
.
Error
())
return
""
,
""
,
err
}
if
len
(
reqResult
.
Value
)
==
0
{
return
""
,
""
,
fmt
.
Errorf
(
"初始化密码不能为空 "
)
}
password
=
fmt
.
Sprintf
(
"%x"
,
sha1
.
Sum
([]
byte
(
reqResult
.
Value
)))
return
password
,
reqResult
.
Value
,
err
}
...
...
pkg/infrastructure/service_gateway/allied_creation_cooperation/module_cooperation_statistics.go
查看文件 @
57f2f9c
...
...
@@ -28,6 +28,8 @@ const (
CompanyCooperationUsersStatistics
=
"CompanyCooperationUsersStatistics"
//公司 - 共创用户模式统计
CooperationUserModeStatistics
=
"CooperationUserModeStatistics"
// 公司 - 共创用户分红支付统计
CompanyPaymentHistoryStatistics
=
"CompanyPaymentHistoryStatistics"
// 个人 - 共创企业统计
CooperationCompanyStatistics
=
"CooperationCompanyStatistics"
...
...
pkg/infrastructure/service_gateway/allied_creation_user/param_user.go
查看文件 @
57f2f9c
...
...
@@ -342,7 +342,7 @@ type (
type
(
ReqBatchAddUser
struct
{
Users
[]
BatchAddUserItem
`json:"users"`
Password
int
`json:"password"`
Password
string
`json:"password"`
}
DataBatchAddUser
struct
{
...
...
pkg/port/beego/controllers/base_controller.go
查看文件 @
57f2f9c
...
...
@@ -118,7 +118,7 @@ func (controller *BaseController) GetExcelFile() (io.Reader, error) {
return
nil
,
fmt
.
Errorf
(
"上传文件不存在"
)
}
ext
:=
filepath
.
Ext
(
fileHeader
.
Filename
)
if
!
(
ext
==
"
xlsx"
||
ext
==
"
xls"
)
{
if
!
(
ext
==
"
.xlsx"
||
ext
==
".
xls"
)
{
return
nil
,
fmt
.
Errorf
(
"仅支持上传文件格式 xls/xlsx"
)
}
return
excelFile
,
nil
...
...
请
注册
或
登录
后发表评论