作者 tangxuhui
... ... @@ -47,7 +47,7 @@ spec:
- cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
containers:
- name: allied-creation-gateway
image: 192.168.0.243:5000/mmm/allied-creation-gateway:dev
image: 192.168.0.243:5000/mmm/allied-creation-gateway:test
imagePullPolicy: Always
ports:
- containerPort: 8082
... ...
... ... @@ -43,6 +43,95 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
}
// 模式列表
var modeStatistics = struct {
TotalCooperationModeStatistics interface{} `json:"totalCooperationModeStatistics"`
CooperationModeStatistics interface{} `json:"cooperationModeStatistics"`
CooperationModes interface{} `json:"cooperationModes"`
}{}
err = json.UnmarshalFromString(json.MarshalToString(cooperationModeStatistics), &modeStatistics)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// 项目概览统计
contracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
PageNumber: 1,
PageSize: 1,
CompanyId: cmd.Operator.CompanyId,
OrgId: cmd.Operator.OrgId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
PageNumber: 1,
PageSize: 1,
CompanyId: cmd.Operator.CompanyId,
OrgId: cmd.Operator.OrgId,
Status: 1,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser(
cmd.Operator)
users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{
Limit: 1,
Offset: 0,
CompanyId: cmd.Operator.CompanyId,
OrganizationId: cmd.Operator.OrgId,
UserType: domain.UserTypeCooperation,
InEnableStatus: []int{domain.UserStatusEnable},
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
var projectOverviewStatistics = map[string]interface{}{
"contractSum": contracts.Grid.Total,
"cooperationUserCount": users.Count,
"projectSum": projects.Total,
}
return map[string]interface{}{
"projectOverviewStatistics": projectOverviewStatistics,
"currentMonthDividendsStatistics": companyDividendsStatistics,
"cooperationModeStatistics": modeStatistics.CooperationModeStatistics,
"cooperationGoodsStatistics": cooperationGoodsStatistics,
"cooperationModes": modeStatistics.CooperationModes,
"totalCooperationModeStatistics": modeStatistics.TotalCooperationModeStatistics,
}, nil
}
// IndexStatistics 首页统计 (入口页面统计数据)
func (srv CompanyStatisticsService) IndexStatisticsBak(cmd *command.IndexStatisticsCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
companyDividendsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CompanyDividendsStatistics, map[string]interface{}{
"companyId": cmd.Operator.CompanyId,
"orgId": cmd.Operator.OrgId,
"action": 1, //当前月
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
cooperationModeStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationModeStatistics, map[string]interface{}{
"companyId": cmd.Operator.CompanyId,
"orgId": cmd.Operator.OrgId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
cooperationGoodsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationGoodsStatistics, map[string]interface{}{
"companyId": cmd.Operator.CompanyId,
"orgId": cmd.Operator.OrgId,
"rankType": 1, //月榜
"top": 5,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// 模式列表
var modeStatistics []CooperationModeStatistics
var responseModeStatistics []CooperationModeStatistics
var modeNumbers []string
... ...
... ... @@ -280,3 +280,22 @@ func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, fa
}
return result
}
// 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",
}
var url string
var ok bool
if url, ok = mapTemplate[importDataCommand.Code]; !ok {
return nil, application.ThrowError(application.BUSINESS_ERROR, fmt.Sprintf("模板:%v 不存在", importDataCommand.Code))
}
return map[string]string{
"url": url,
}, nil
}
... ...
... ... @@ -38,6 +38,7 @@ type UserOrg struct {
type UserRole struct {
RoleID string `json:"roleId"`
OrgId int64 `json:"orgId,string"`
RoleName string `json:"roleName"`
OrgName string `json:"orgName"`
RoleType int `json:"roleType"`
... ...
... ... @@ -72,6 +72,7 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp
for _, v := range resultUser.UserRole {
userRole = append(userRole, dto.UserRole{
RoleID: strconv.Itoa(v.RoleID),
OrgId: v.OrgId,
RoleName: v.RoleName,
OrgName: v.Ext.OrgName,
RoleType: v.RoleType,
... ...
... ... @@ -48,3 +48,27 @@ const (
MaxQueryRowCount = 1000
NormalQueryRowCount = 100
)
const (
// 导入公司用户
ImportCompanyUser = "ImportCompanyUser"
// 导入公司组织
ImportOrganization = "ImportOrganization"
// 导入共创用户
ImportCooperationUser = "ImportCooperationUser"
// 导入分红订单
ImportDividendsOrders = "ImportDividendsOrders"
)
const (
// 导入公司用户
TemplateCompanyUser = "TemplateCompanyUser"
// 导入公司组织
TemplateOrganization = "TemplateOrganization"
// 导入共创用户
TemplateCooperationUser = "TemplateCooperationUser"
// 分红订单模板
TemplateDividendsOrders = "TemplateDividendsOrders"
)
... ...
... ... @@ -48,6 +48,7 @@ type UserDetail struct {
RoleID int `json:"roleId"`
RoleName string `json:"roleName"`
RoleType int `json:"roleType"`
OrgId int64 `json:"orgId"`
Ext struct {
OrgName string `json:"orgName"`
} `json:"ext,omitempty"`
... ...
... ... @@ -2,6 +2,7 @@ package web_client
import (
"errors"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"path/filepath"
"strings"
... ... @@ -283,8 +284,19 @@ func (controller ExcelDataController) FileImport() {
cmd.Reader = r
var data interface{}
switch cmd.Code {
case "ImportCompanyUser":
case domain.ImportCompanyUser:
data, err = excelService.ImportCompanyUser(cmd)
}
controller.Response(data, err)
}
func (controller ExcelDataController) FileImportTemplate() {
excelService := service.NewExcelDataService(nil)
cmd := &command.ImportDataCommand{}
//controller.Unmarshal(cmd)
code := controller.GetString(":code")
cmd.Code = code
var data interface{}
data, err := excelService.FileImportTemplate(cmd)
controller.Response(data, err)
}
... ...
... ... @@ -18,4 +18,5 @@ func init() {
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")
}
... ...