作者 tangxuhui
FROM 192.168.0.243:5000/mmm/allied-creation-gateway:20210809
ENV APP_DIR $GOPATH/src/project-20210826
ENV APP_DIR $GOPATH/src/project-20210908
RUN mkdir -p $APP_DIR
WORKDIR $APP_DIR/
COPY ./pkg pkg
... ...
... ... @@ -14,7 +14,10 @@ type CompanyDividendsService struct {
func (srv CompanyStatisticsService) GetDividendContracts(cmd *command.GetDividendContractsCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
result, err := gateway.CooperationStatistics(allied_creation_cooperation.GetContractDividends, cmd)
result, err := gateway.CooperationStatistics(allied_creation_cooperation.GetContractDividends, map[string]interface{}{
"contractId": cmd.ContractId,
"companyId": cmd.Operator.CompanyId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
... ...
... ... @@ -44,6 +44,7 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
// 模式列表
var modeStatistics []CooperationModeStatistics
var responseModeStatistics []CooperationModeStatistics
var modeNumbers []string
err = json.UnmarshalFromString(json.MarshalToString(cooperationModeStatistics), &modeStatistics)
if err != nil {
... ... @@ -54,19 +55,35 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
}
var cooperationModes = make([]interface{}, 0)
if len(modeNumbers) > 0 {
models, err := gateway.CooperationModesSearch(allied_creation_cooperation.ReqCooperationModesSearch{
PageSize: domain.NormalQueryRowCount,
PageNumber: 1,
CompanyId: cmd.Operator.CompanyId,
//OrgId: cmd.Operator.OrgId,
CooperationModeNumbers: modeNumbers,
OrgId: cmd.Operator.OrgId,
//CooperationModeNumbers: modeNumbers,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
mapModels := make(map[string]CooperationModeStatistics)
for i := range responseModeStatistics {
item := responseModeStatistics[i]
mapModels[item.CooperationModeNumber] = item
}
if len(models.List) > 0 {
for i := range models.List {
item := models.List[i]
if value, ok := mapModels[item.CooperationModeNumber]; !ok {
responseModeStatistics = append(responseModeStatistics, CooperationModeStatistics{
CooperationPeople: 0,
DividendsEstimate: 0,
OrderAmount: 0,
CooperationModeNumber: item.CooperationModeNumber,
SettlementAmount: 0,
})
} else {
responseModeStatistics = append(responseModeStatistics, value)
}
cooperationModes = append(cooperationModes, map[string]interface{}{
"cooperationModeId": item.CooperationModeId,
"cooperationModeName": item.CooperationModeName,
... ... @@ -90,6 +107,7 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
PageSize: 1,
CompanyId: cmd.Operator.CompanyId,
OrgId: cmd.Operator.OrgId,
Status: 1,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ... @@ -115,7 +133,7 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
return map[string]interface{}{
"projectOverviewStatistics": projectOverviewStatistics,
"currentMonthDividendsStatistics": companyDividendsStatistics,
"cooperationModeStatistics": cooperationModeStatistics,
"cooperationModeStatistics": responseModeStatistics,
"cooperationGoodsStatistics": cooperationGoodsStatistics,
"cooperationModes": cooperationModes,
}, nil
... ... @@ -202,7 +220,7 @@ type CooperationModeStatistics struct {
// 共创人数
CooperationPeople float64 `json:"cooperationPeople"`
// 分红预算
DividendsEstimate string `json:"dividendsEstimate"`
DividendsEstimate float64 `json:"dividendsEstimate"`
// 订单金额
OrderAmount float64 `json:"orderAmount"`
// 共创模式编号
... ...
... ... @@ -180,11 +180,11 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
excelImport := excel.NewExcelImport()
excelImport.RowBegin = 2 //第二行开始读取
excelImport.RowBegin = 3 //第二行开始读取
excelImport.DataFields = []excel.DataField{
{EnName: "userCode", CnName: "*用户编号"},
{EnName: "userName", CnName: "*用户姓名"},
{EnName: "organization", CnName: "*组织机构"},
{EnName: "org", CnName: "*组织机构"},
{EnName: "department", CnName: "*所属部门"},
{EnName: "phone", CnName: "*手机号"},
{EnName: "email", CnName: "邮箱"},
... ... @@ -200,7 +200,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
CompanyId: importDataCommand.Operator.CompanyId,
UserType: domain.UserTypeEmployee,
UserCode: v["userCode"],
Org: v["organization"],
Org: v["org"],
Department: v["department"],
UserName: v["userName"],
Phone: v["phone"],
... ... @@ -222,15 +222,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return srv.importResultWithHeader(map[string]interface{}{
"userCode": "*用户编号",
"userName": "*用户姓名",
"organization": "*组织机构",
"department": "*所属部门",
"phone": "*手机号",
"email": "邮箱",
"enableStatus": "状态",
}, result.FailRows, len(excelData)), nil
return srv.importResultWithHeader(excelImport.DataFields, result.FailRows, len(excelData)), nil
}
func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) {
... ... @@ -266,7 +258,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import
}
// 导入结果
func (srv ExcelDataService) importResultWithHeader(header interface{}, failRows []interface{}, totalRow int) interface{} {
func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, failRows []interface{}, totalRow int) interface{} {
var result = map[string]interface{}{
"successCount": 0,
"fail": struct{}{},
... ... @@ -278,6 +270,11 @@ func (srv ExcelDataService) importResultWithHeader(header interface{}, failRows
fail := map[string]interface{}{
"body": failRows,
}
var header = make(map[string]string)
for i := 0; i < len(headers); i++ {
item := headers[i]
header[item.EnName] = item.CnName
}
fail["header"] = header
result["fail"] = fail
}
... ...