作者 tangxuhui
... ... @@ -696,7 +696,7 @@ func (svr AuthService) GetCompanyOrgsByUser(queryParam *query.GetCompanyOrgsByUs
for i := range result.Users {
user := result.Users[i]
if _, ok := mapCompany[user.Company.CompanyId]; !ok {
if _, ok := mapCompany[user.Company.CompanyId]; !ok && len(user.UserOrg) > 0 {
companys = append(companys, dto.CompanyItem{
CompanyId: user.Company.CompanyId,
CompanyName: user.Company.CompanyName,
... ...
package service
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"strconv"
"github.com/linmadan/egglib-go/core/application"
... ... @@ -81,9 +82,13 @@ func (srv CooperationApplicationsService) SearchCooperationApplications(applicat
IsCanceled: 1,
})
for i := 0; i < len(resultApplications.Grid.List); i++ {
resultApplications.Grid.List[i].Department.DepartmentID = resultApplications.Grid.List[i].Org.OrgID
resultApplications.Grid.List[i].Department.DepartmentName = resultApplications.Grid.List[i].Org.OrgName
resultApplications.Grid.List[i].Department.DepartmentID = int(resultApplications.Grid.List[i].CooperationApplicationApplicant.Department.DepartmentId)
resultApplications.Grid.List[i].Department.DepartmentName = resultApplications.Grid.List[i].CooperationApplicationApplicant.Department.DepartmentName
if len(resultApplications.Grid.List[i].Department.DepartmentName) == 0 && resultApplications.Grid.List[i].Department.DepartmentID == 0 {
resultApplications.Grid.List[i].Department.DepartmentName = domain.CooperationUserDepartmentName
}
}
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
... ... @@ -168,10 +173,6 @@ func (srv CooperationApplicationsService) PersonSearchCooperationApplications(ap
}
// var dataList []dto.CooperationApplication
// for i := range resultApplications.Gride.List {
// item := dto.ToCooperationApplication(&resultApplications.Gride.List[i])
// dataList = append(dataList, *item)
// }
return resultApplications, nil
}
... ...
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,17 @@ 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,
SearchCooperationProjectExtQueriesFlag: 1,
SearchCooperationProjectExtQueries: extQueries,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -120,6 +123,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(
... ...
... ... @@ -109,7 +109,12 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi
}
var items = make([]*dto.CreditAccountItem, 0)
if len(cooperationContractNumbers) == 0 {
return items, nil
return map[string]interface{}{
"grid": map[string]interface{}{
"list": items,
"sum": 0,
},
}, nil
}
var beginTime, endTime time.Time
... ... @@ -176,10 +181,14 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
var response = struct {
type responseType struct {
RankItems interface{} `json:"rankItems"`
TotalPaymentAmount interface{} `json:"totalPaymentAmount"`
}{}
}
var response = responseType{
RankItems: []struct{}{},
TotalPaymentAmount: 0,
}
cooperationContractNumbers, err := gateway.RelevantCooperationContractNumbers(allied_creation_cooperation.RelevantCooperationContractNumbers, map[string]interface{}{
"companyId": cmd.Operator.CompanyId,
"orgId": cmd.Operator.OrgId,
... ...
... ... @@ -166,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{
... ...
... ... @@ -188,7 +188,7 @@ func (srv UserService) DepartmentsUsers(departmentsUsersQuery *query.Departments
CompanyId: departmentsUsersQuery.Operator.CompanyId,
OrganizationId: departmentsUsersQuery.Operator.OrgId,
UserType: domain.UserTypeEmployee, //TODO:是否要共创用户
InEnableStatus: []int{domain.UserStatusEnable, domain.UserStatusDisable},
InEnableStatus: []int{domain.UserStatusEnable},
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ...
... ... @@ -75,6 +75,7 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec
PageSize: 0,
CompanyId: resultProject.Company.CompanyId,
OrgId: int64(resultProject.Org.OrgId),
CooperationApplicationStatus: 2, //审核通过的
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
package command
import (
"encoding/json"
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type ExportDataCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 业务编码
Ids []string `json:"ids"`
Where json.RawMessage `json:"where"`
// 业务编码
Code string `form:"code"`
}
func (exportDataCommand *ExportDataCommand) Valid(validation *validation.Validation) {
}
func (exportDataCommand *ExportDataCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(exportDataCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
func (exportDataCommand *ExportDataCommand) UnmarshalQuery(query interface{}) error {
return json.Unmarshal(exportDataCommand.Where, query)
}
... ...
package service
import (
"fmt"
"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/service_gateway/allied_creation_user"
)
// ExportCompanyUser 导出公司用户信息列表
func (srv ExcelDataService) ExportCompanyUser(companyUserListQuery *query.CompanyUserListQuery) (ExportCompanyUserData, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(companyUserListQuery.Operator)
result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
Limit: 10000,
CompanyId: companyUserListQuery.Operator.CompanyId,
OrganizationId: 0,
DepartmentId: 0,
UserName: companyUserListQuery.UserName,
DepName: companyUserListQuery.DepartmentName,
Phone: "",
UserType: domain.UserTypeEmployee,
InOrgIds: companyUserListQuery.Operator.OrgIds,
PullRealTime: true,
})
if err != nil {
return ExportCompanyUserData{}, fmt.Errorf("获取企业用户数据失败:%w", err)
}
return ExportCompanyUserData(result.Users), nil
}
// ExportCooperationUser 导出共创用户信息列表
func (srv ExcelDataService) ExportCooperationUser(companyUserListQuery *query.CooperationUserListQuery) (ExportCooperationUserData, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(companyUserListQuery.Operator)
result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
Limit: 10000,
CompanyId: companyUserListQuery.Operator.CompanyId,
OrganizationId: 0,
DepartmentId: 0,
UserName: companyUserListQuery.UserName,
CooperationCompany: companyUserListQuery.CooperationCompany,
Phone: "",
UserType: domain.UserTypeCooperation,
InOrgIds: companyUserListQuery.Operator.OrgIds,
})
if err != nil {
return ExportCooperationUserData{}, fmt.Errorf("获取企业用户数据失败:%w", err)
}
return ExportCooperationUserData(result.Users), nil
}
... ...
... ... @@ -7,7 +7,6 @@ import (
"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"
"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"
... ... @@ -20,158 +19,62 @@ func NewExcelDataService(param map[string]interface{}) *ExcelDataService {
return &ExcelDataService{}
}
// ExportCompanyUser 导出公司用户信息列表
func (srv ExcelDataService) ExportCompanyUser(companyUserListQuery *query.CompanyUserListQuery) (ExportCompanyUserData, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(companyUserListQuery.Operator)
result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
Limit: 10000,
CompanyId: companyUserListQuery.Operator.CompanyId,
OrganizationId: 0,
DepartmentId: 0,
UserName: companyUserListQuery.UserName,
DepName: companyUserListQuery.DepartmentName,
Phone: "",
UserType: domain.UserTypeEmployee,
InOrgIds: companyUserListQuery.Operator.OrgIds,
// 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())
}
userGateway := allied_creation_user.NewHttplibAlliedCreationUser(importDataCommand.Operator)
orgResult, err := userGateway.OrgGet(allied_creation_user.ReqOrgGet{
OrgId: int(importDataCommand.Operator.OrgId),
})
if err != nil {
return ExportCompanyUserData{}, fmt.Errorf("获取企业用户数据失败:%w", err)
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return ExportCompanyUserData(result.Users), nil
}
// ExportCooperationUser 导出共创用户信息列表
func (srv ExcelDataService) ExportCooperationUser(companyUserListQuery *query.CompanyUserListQuery) (ExportCooperationUserData, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(companyUserListQuery.Operator)
result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
Limit: 10000,
CompanyId: companyUserListQuery.Operator.CompanyId,
OrganizationId: 0,
DepartmentId: 0,
UserName: companyUserListQuery.UserName,
DepName: companyUserListQuery.DepartmentName,
Phone: "",
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,
InOrgIds: companyUserListQuery.Operator.OrgIds,
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 ExportCooperationUserData{}, fmt.Errorf("获取企业用户数据失败:%w", err)
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return ExportCooperationUserData(result.Users), nil
}
// ImportCompanyUser 导入公司用户信息
func (srv ExcelDataService) ImportCompanyUser2(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: "OrganizationID", CnName: "*组织机构"},
// {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)
//for _, v := range excelData {
// item := allied_creation_user.BatchAddUserItem{
// CompanyID: importDataCommand.Operator.CompanyId,
// UserType: domain.UserTypeEmployee,
// UserCode: v["UserCode"],
// OrganizationID: 0,
// DepartmentID: 0,
// UserInfo: allied_creation_user.BatchAddUserItemUserInfo{
// UserName: v["UserName"],
// Phone: v["Phone"],
// Email: v["Email"],
// },
// CooperationInfo: allied_creation_user.BatchAddUserItemCooperationInfo{},
// }
// item.OrganizationID, err = strconv.Atoi(v["OrganizationID"])
// if err != nil {
// 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 {
// 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,
// Password: initPassword,
//})
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
//return result, nil
return nil, nil
}
// 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
return srv.importResultWithHeader(excelImport.DataFields, result.FailRows, len(users)), nil
}
// ImportCompanyUser 导入公司用户信息
... ... @@ -197,21 +100,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)
}
... ... @@ -223,9 +124,10 @@ 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
}
// ImportOrganization 导入组织
func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) {
excelImport := excel.NewExcelImport()
excelImport.RowBegin = 3 //第二行开始读取
... ... @@ -240,6 +142,9 @@ 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"],
... ... @@ -255,7 +160,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import
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(items)), nil
}
// 导入结果
... ... @@ -282,15 +187,25 @@ func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, fa
return result
}
// ImportCompanyUser 导入公司用户信息
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
}
// FileImportTemplate 导入模板
func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) {
var mapTemplate = map[string]string{
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/20210916/object/1631807770_sBtA4dYcmESZy6Q2ycfGSCKGdFtBETQZ.xlsx",
// 模板待更新
domain.ImportCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx",
domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx",
domain.ImportDividendsOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743206_NPYTKw6RGhXn4TpYNEQhGGdCkXKXTnxM.xlsx",
domain.ImportCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210926/object/1632635345_SbfzmkXjQHhCwPw4MB7zb5EBBtdp2MSE.xlsx",
domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743214_rNHm6ZBXZaC5xKTrsE7M4h45MY6n6Ff3.xlsx",
}
var url string
var ok bool
... ...
... ... @@ -5,7 +5,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
)
//exportCompanyUserData 导出公司用户数据
// ExportCompanyUserData 导出公司用户数据
type ExportCompanyUserData []allied_creation_user.UserDetail
var _ excel.ExcelMaker = (*ExportCompanyUserData)(nil)
... ... @@ -69,7 +69,7 @@ func (data ExportCompanyUserData) TableTitle() []string {
return nil
}
//exportCompanyUserData 导出共创用户数据
//ExportCooperationUserData 导出共创用户数据
type ExportCooperationUserData []allied_creation_user.UserDetail
var _ excel.ExcelMaker = (*ExportCooperationUserData)(nil)
... ... @@ -78,10 +78,12 @@ func (data ExportCooperationUserData) DataFieldList() []excel.DataField {
return []excel.DataField{
{EnName: "UserCode", CnName: "用户编码"},
{EnName: "UserName", CnName: "用户姓名"},
{EnName: "CooperationCompany", CnName: "合作公司"},
{EnName: "CooperationDeadline", CnName: "合作到期"},
{EnName: "Phone", CnName: "手机号"},
{EnName: "Email", CnName: "邮箱"},
{EnName: "CooperationCompany", CnName: "共创公司"},
{EnName: "CooperationDeadline", CnName: "共创到期"},
{EnName: "EnableStatus", CnName: "状态"},
//{EnName: "Email", CnName: "邮箱"},
}
}
... ... @@ -97,11 +99,27 @@ func (data ExportCooperationUserData) CellValue(index int, enName string) (value
case "CooperationCompany":
return data[index].CooperationInfo.CooperationCompany
case "CooperationDeadline":
if data[index].CooperationInfo.CooperationDeadline.IsZero() || data[index].CooperationInfo.CooperationDeadline.Unix() == 0 {
return ""
}
return data[index].CooperationInfo.CooperationDeadline.Format("2006-01-02")
case "Phone":
return data[index].UserInfo.Phone
case "Email":
return data[index].UserInfo.Email
case "EnableStatus":
status := data[index].EnableStatus
statusName := ""
// 状态(1:启用 2:禁用 3:注销)
switch status {
case 1:
statusName = "启用"
case 2:
statusName = "禁用"
case 3:
statusName = "注销"
}
return statusName
}
return nil
}
... ...
... ... @@ -18,6 +18,7 @@ type OrgItem struct {
type DepartmentUsersDto struct {
Departments []*Department `json:"departments,omitempty"`
Users []interface{} `json:"users,omitempty"`
Applicants []interface{} `json:"applicants,omitempty"`
}
type Department struct {
... ... @@ -30,6 +31,7 @@ type User struct {
UserID int `json:"userId,string"`
UserCode string `json:"userCode"`
UserInfo map[string]interface{} `json:"userInfo"`
Department interface{} `json:"department,omitempty"`
}
func (dto *DepartmentUsersDto) LoadDto(dataType int, subDepartment *allied_creation_user.DataOrgGetSubDepartment, userSearch *allied_creation_user.DataUserSearch) error {
... ...
... ... @@ -12,6 +12,8 @@ type DepartmentsUsersQuery struct {
Operator domain.Operator `json:"-"`
// 类型0:部门用户列表 1:全部用户列表(不包含部门)
Type int `json:"type"`
// 共创项目ID - 获取项目申请人列表
CooperationProjectId int `json:"cooperationProjectId,string"`
}
func (departmentsUsersQuery *DepartmentsUsersQuery) Valid(validation *validation.Validation) {
... ...
package service
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
"strconv"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
... ... @@ -174,6 +175,44 @@ func (orgsService OrgsService) DepartmentsUsers(departmentsUsersQuery *query.Dep
if err := departmentUsersDto.LoadDto(departmentsUsersQuery.Type, orgs, users); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// 项目申请人
if departmentsUsersQuery.CooperationProjectId != 0 {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(departmentsUsersQuery.Operator)
resultProject, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{
CooperationProjectId: departmentsUsersQuery.CooperationProjectId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
resultApplication, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{
CooperationProjectNumber: resultProject.CooperationProject.CooperationProjectNumber,
PageNumber: 0,
PageSize: 1000,
CompanyId: resultProject.Company.CompanyId,
OrgId: int64(resultProject.Org.OrgId),
CooperationApplicationStatus: 2, //审核通过的
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
applications := make([]interface{}, 0)
for i := range resultApplication.Grid.List {
item := resultApplication.Grid.List[i]
user := dto.User{
UserID: item.CooperationApplicationApplicant.UserID,
UserCode: item.CooperationApplicationApplicant.UserInfo.UserCode,
UserInfo: map[string]interface{}{
"userName": item.CooperationApplicationApplicant.UserInfo.UserName,
"phone": item.CooperationApplicationApplicant.UserInfo.UserPhone,
},
Department: item.CooperationApplicationApplicant.Department,
}
applications = append(applications, user)
}
departmentUsersDto.Applicants = applications
}
return departmentUsersDto, nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
// 共创项目用户查询
type CooperationProjectUsersQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创项目ID - 获取项目申请人列表
CooperationProjectId int `json:"cooperationProjectId,string"`
}
func (departmentsUsersQuery *CooperationProjectUsersQuery) Valid(validation *validation.Validation) {
}
func (departmentsUsersQuery *CooperationProjectUsersQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(departmentsUsersQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
... ... @@ -3,6 +3,7 @@ package service
import (
"crypto/sha1"
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
"strconv"
"time"
... ... @@ -570,3 +571,46 @@ func (usersService *UsersService) GetInitPassword(operator domain.Operator) (str
password = fmt.Sprintf("%x", sha1.Sum([]byte(reqResult.Value)))
return password, reqResult.Value, err
}
// SelectorCooperationProjectUsers 共创项目用户下拉列表
func (usersService *UsersService) SelectorCooperationProjectUsers(q *query.CooperationProjectUsersQuery) (interface{}, error) {
applications := make([]interface{}, 0)
// 项目申请人
if q.CooperationProjectId != 0 {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(q.Operator)
resultProject, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{
CooperationProjectId: q.CooperationProjectId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
resultApplication, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{
CooperationProjectNumber: resultProject.CooperationProject.CooperationProjectNumber,
PageNumber: 0,
PageSize: 1000,
CompanyId: resultProject.Company.CompanyId,
OrgId: int64(resultProject.Org.OrgId),
CooperationApplicationStatus: 2, //审核通过的
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
for i := range resultApplication.Grid.List {
item := resultApplication.Grid.List[i]
user := map[string]interface{}{
"userId": item.CooperationApplicationApplicant.UserID,
"userCode": item.CooperationApplicationApplicant.UserInfo.UserCode,
"userInfo": map[string]interface{}{
"userName": item.CooperationApplicationApplicant.UserInfo.UserName,
"phone": item.CooperationApplicationApplicant.UserInfo.UserPhone,
},
"department": item.CooperationApplicationApplicant.Department,
}
applications = append(applications, user)
}
}
return map[string]interface{}{
"applicants": applications,
}, nil
}
... ...
... ... @@ -62,3 +62,14 @@ const (
// 导入退货订单
ImportDividendsReturnOrders = "BUSINESS_ALLIED-CREATION_BONUS_RETURN"
)
const (
// 导入公司用户
ExportCompanyUser = "ExportCompanyUser"
// 导入共创用户
ExportCooperationUser = "ExportCooperationUser"
)
const (
CooperationUserDepartmentName = "共创用户"
)
... ...
... ... @@ -173,6 +173,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"`
... ... @@ -194,6 +208,10 @@ type (
UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"`
// 共创项目承接对象,1员工,2共创用户,4公开,可以多选
CooperationProjectUndertakerType int32 `json:"cooperationProjectUndertakerType"`
// 额外的查询条件 0:不需要额外查询 1:额外查询
SearchCooperationProjectExtQueriesFlag int `cname:"额外的查询条件标识" json:"searchCooperationProjectExtQueriesFlag"`
// 额外的查询条件
SearchCooperationProjectExtQueries []*SearchCooperationProjectExtQuery `cname:"额外的查询条件" json:"searchCooperationProjectExtQueries"`
}
DataCooperationProjectSearchItem struct {
CooperationProjectID string `json:"cooperationProjectId"`
... ...
... ... @@ -43,6 +43,8 @@ type UserDetail struct {
Department *struct {
DepartmentId int `json:"departmentId"`
DepartmentName string `json:"departmentName"`
// 部门编号
DepartmentNumber string `json:"departmentNumber"`
} `json:"department,omitempty"`
UserRole []struct {
RoleID int `json:"roleId"`
... ... @@ -393,11 +395,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"`
}
... ...
... ... @@ -97,8 +97,8 @@ func (controller *BaseController) GetOperator() domain.Operator {
OrgIds: loginToken.OrgIds,
}
// TODO:打印测试日志
log.Logger.Debug("operator " + json.MarshalToString(op))
// 打印测试日志
// log.Logger.Debug("operator " + json.MarshalToString(op))
return op
}
... ...
... ... @@ -45,60 +45,6 @@ func (controller *ExcelDataController) fieldValueAllEmpty(param map[string]strin
return isAllEmpty
}
// ExportCompanyUser 导出公司用户
func (controller ExcelDataController) ExportCompanyUser() {
excelService := service.NewExcelDataService(nil)
companyUserListQuery := &query.CompanyUserListQuery{}
err := controller.Unmarshal(companyUserListQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
controller.Response(nil, err)
return
}
companyUserListQuery.Operator = controller.GetOperator()
data, err := excelService.ExportCompanyUser(companyUserListQuery)
if err != nil {
log.Logger.Debug("excelService.ExportCompanyUser err:" + err.Error())
controller.Response(nil, err)
return
}
excelTool := excel.NewExcelExport()
err = excelTool.ExportData(data, "")
if err != nil {
log.Logger.Debug("excelTool.ExportData err:" + err.Error())
controller.Response(nil, err)
return
}
controller.responseExcelByFile(controller.Ctx, excelTool, "导出公司用户")
}
// ExportCooperationUser 导出共创用户
func (controller ExcelDataController) ExportCooperationUser() {
excelService := service.NewExcelDataService(nil)
companyUserListQuery := &query.CompanyUserListQuery{}
err := controller.Unmarshal(companyUserListQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
controller.Response(nil, err)
return
}
companyUserListQuery.Operator = controller.GetOperator()
data, err := excelService.ExportCooperationUser(companyUserListQuery)
if err != nil {
log.Logger.Debug("excelService.ExportCompanyUser err:" + err.Error())
controller.Response(nil, err)
return
}
excelTool := excel.NewExcelExport()
err = excelTool.ExportData(data, "")
if err != nil {
log.Logger.Debug("excelTool.ExportData err:" + err.Error())
controller.Response(nil, err)
return
}
controller.responseExcelByFile(controller.Ctx, excelTool, "导出共创用户")
}
// ImportDividendsOrder 导入分红订单
func (controller ExcelDataController) ImportDividendsOrder() {
importDividendsOrder(controller)
... ... @@ -276,3 +222,69 @@ func (controller ExcelDataController) FileImportTemplate() {
data, err := excelService.FileImportTemplate(cmd)
controller.Response(data, err)
}
// FileExport 文件导出
func (controller ExcelDataController) FileExport() {
fileExport(controller, "")
}
func fileExport(controller ExcelDataController, code string) {
// 1.读取command
exportDataCommand := &command.ExportDataCommand{}
err := controller.Unmarshal(exportDataCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
controller.Response(nil, err)
return
}
exportDataCommand.Operator = controller.GetOperator()
if exportDataCommand.Code == "" && code != "" {
exportDataCommand.Code = code
}
// 2.读取data
var data excel.ExcelMaker
var filename string
var excelService = service.NewExcelDataService(nil)
switch exportDataCommand.Code {
case domain.ExportCompanyUser:
companyUserListQuery := &query.CompanyUserListQuery{}
exportDataCommand.UnmarshalQuery(companyUserListQuery)
companyUserListQuery.Operator = exportDataCommand.Operator
data, err = excelService.ExportCompanyUser(companyUserListQuery)
filename = "导出公司用户"
case domain.ExportCooperationUser:
companyUserListQuery := &query.CooperationUserListQuery{}
exportDataCommand.UnmarshalQuery(companyUserListQuery)
companyUserListQuery.Operator = exportDataCommand.Operator
data, err = excelService.ExportCooperationUser(companyUserListQuery)
filename = "导出共创用户"
default:
err = fmt.Errorf("export type :%v not exists", exportDataCommand.Code)
}
if err != nil {
log.Logger.Debug("excelService.Export err:" + err.Error())
controller.Response(nil, err)
return
}
// 3.返回文件
excelTool := excel.NewExcelExport()
err = excelTool.ExportData(data, "")
if err != nil {
log.Logger.Debug("excelTool.ExportData err:" + err.Error())
controller.Response(nil, err)
return
}
controller.responseExcelByFile(controller.Ctx, excelTool, filename)
}
// ExportCompanyUser 导出公司用户
func (controller ExcelDataController) ExportCompanyUser() {
fileExport(controller, domain.ExportCompanyUser)
}
// ExportCooperationUser 导出共创用户
func (controller ExcelDataController) ExportCooperationUser() {
fileExport(controller, domain.ExportCooperationUser)
}
... ...
... ... @@ -157,3 +157,13 @@ func (controller *UsersController) SelectorCompanyOrgAll() {
_, data, err := usersService.SelectorCompanyOrgAll(selectorQuery)
controller.Response(data, err)
}
//CompanyOrgSelector 全组织部门选择表
func (controller *UsersController) SelectorCooperationProjectUsers() {
usersService := service.NewUsersService(nil)
selectorQuery := &query.CooperationProjectUsersQuery{}
controller.Unmarshal(selectorQuery)
selectorQuery.Operator = controller.GetOperator()
data, err := usersService.SelectorCooperationProjectUsers(selectorQuery)
controller.Response(data, err)
}
... ...
... ... @@ -13,5 +13,6 @@ func init() {
web.Router("/v1/web/excel/import/dividends-returned-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsReturnedOrder")
web.Router("/v1/web/file-import", &web_client.ExcelDataController{}, "Post:FileImport")
web.Router("/v1/web/file-export", &web_client.ExcelDataController{}, "Post:FileExport")
web.Router("/v1/web/file-import-template/:code", &web_client.ExcelDataController{}, "Get:FileImportTemplate")
}
... ...
... ... @@ -21,4 +21,6 @@ func init() {
web.Router("/v1/web/users/selector/org", &web_client.UsersController{}, "Post:SelectorCompanyOrg")
web.Router("/v1/web/users/selector/role", &web_client.UsersController{}, "Post:SelectorCompanyRole")
web.Router("/v1/web/users/selector/org/all", &web_client.UsersController{}, "Post:SelectorCompanyOrgAll")
web.Router("/v1/web/users/selector/cooperation-project-users", &web_client.UsersController{}, "Post:SelectorCooperationProjectUsers")
}
... ...
... ... @@ -13,13 +13,56 @@ func PKCS5Padding(plaintext []byte, blockSize int) []byte {
}
//@brief:去除填充数据
func PKCS5UnPadding(origData []byte) []byte {
func PKCS5UnPadding(origData []byte, blockSize int) []byte {
length := len(origData)
unpadding := int(origData[length-1])
return origData[:(length - unpadding)]
}
//@brief:AES加密
// PKCS7Padding right-pads the given byte slice with 1 to n bytes, where
// n is the block size. The size of the result is x times n, where x
// is at least 1.
func PKCS7Padding(b []byte, blockSize int) []byte {
if blockSize <= 0 {
return nil
}
if b == nil || len(b) == 0 {
return nil
}
n := blockSize - (len(b) % blockSize)
pb := make([]byte, len(b)+n)
copy(pb, b)
copy(pb[len(b):], bytes.Repeat([]byte{byte(n)}, n))
return pb
}
// PKCS7UnPadding validates and unpads data from the given bytes slice.
// The returned value will be 1 to n bytes smaller depending on the
// amount of padding, where n is the block size.
func PKCS7UnPadding(b []byte, blockSize int) []byte {
if blockSize <= 0 {
return nil
}
if b == nil || len(b) == 0 {
return nil
}
if len(b)%blockSize != 0 {
return nil
}
c := b[len(b)-1]
n := int(c)
if n == 0 || n > len(b) {
return nil
}
for i := 0; i < n; i++ {
if b[len(b)-n+i] != c {
return nil
}
}
return b[:len(b)-n]
}
// AES加密
func AesEncrypt(origData, key []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
... ... @@ -28,14 +71,14 @@ func AesEncrypt(origData, key []byte) ([]byte, error) {
//AES分组长度为128位,所以blockSize=16,单位字节
blockSize := block.BlockSize()
origData = PKCS5Padding(origData, blockSize)
origData = PKCS7Padding(origData, blockSize)
blockMode := cipher.NewCBCEncrypter(block, key[:blockSize]) //初始向量的长度必须等于块block的长度16字节
crypted := make([]byte, len(origData))
blockMode.CryptBlocks(crypted, origData)
return crypted, nil
}
//@brief:AES解密
// AES解密
func AesDecrypt(crypted, key []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
... ... @@ -47,6 +90,6 @@ func AesDecrypt(crypted, key []byte) ([]byte, error) {
blockMode := cipher.NewCBCDecrypter(block, key[:blockSize]) //初始向量的长度必须等于块block的长度16字节
origData := make([]byte, len(crypted))
blockMode.CryptBlocks(origData, crypted)
origData = PKCS5UnPadding(origData)
origData = PKCS7UnPadding(origData, blockSize)
return origData, nil
}
... ...
... ... @@ -8,7 +8,7 @@ import (
func Test_Aes(t *testing.T) {
//key的长度必须是16、24或者32字节,分别用于选择AES-128, AES-192, or AES-256
var aeskey = []byte("12345678abcdefgh")
var aeskey = []byte("mmm.qrcode.(%^&)")
pass := []byte("vdncloud123456")
xpass, err := AesEncrypt(pass, aeskey)
if err != nil {
... ...