作者 tangxuhui
... ... @@ -677,6 +677,7 @@ func (svr AuthService) GetCompanyOrgsByUser(queryParam *query.GetCompanyOrgsByUs
Phone: queryParam.Operator.Phone,
UserType: domain.UserTypeEmployee,
PullRealTime: true,
EnableStatus: domain.UserStatusEnable,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -19,7 +19,7 @@ type CreditAccountPaySearchCommand struct {
// 开始时间
BeginTime int64 `json:"beginTime"`
// 结算时间
EndTime int64 `json:"beginTime"`
EndTime int64 `json:"endTime"`
}
func (cmd *CreditAccountPaySearchCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -30,7 +30,7 @@ type CreditAccountItem struct {
} `json:"userInfo"`
} `json:"participator"` // 参与人
ParticipateType string `json:"participateType"` // 参与类型
PaymentDocumentAttachment []domain.Attachment `json:"paymentDocumentAttachment"` // 支付凭证附件,复数
PaymentDocumentAttachment []domain.Attachment `json:"paymentDocumentAttachments"` // 支付凭证附件,复数
Org domain.Org `json:"org"` // 数据所属组织机构
Company domain.CompanyData `json:"company"` // 公司
CreatedAt int64 `json:"createdAt"` // 创建时间
... ...
package service
import (
"github.com/linmadan/egglib-go/utils/json"
"time"
"github.com/linmadan/egglib-go/core/application"
... ... @@ -83,24 +84,59 @@ func (srv CompanyCreditAccountService) CreditAccountPay(cmd *command.CreditAccou
func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
var beginTime, endTime time.Time
if cmd.BeginTime > 0 {
beginTime = time.Unix(cmd.BeginTime/1000, 0)
}
if cmd.EndTime > 0 {
endTime = time.Unix(cmd.EndTime/1000, 0)
}
req := allied_creation_cooperation.ReqCreditAccountsSearch{
PageNumber: cmd.PageNumber + 1, //手机序号从0开始的
PageSize: cmd.PageSize,
PaymentStatus: 2,
//TODO:时间段过滤
})
OrgId: cmd.Operator.OrgId,
BeginTime: beginTime,
EndTime: endTime,
}
resultMenu, err := gateway.CreditAccountsSearch(req)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
var items []*dto.CreditAccountItem
queryOptions := map[string]interface{}{
"orgId": cmd.Operator.OrgId,
}
if cmd.BeginTime > 0 {
queryOptions["beginTime"] = beginTime
}
if cmd.EndTime > 0 {
queryOptions["endTime"] = endTime
}
// 2.分红统计
dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
type AnnualDividend struct {
Total float64 `json:"total"`
Accounting float64 `json:"accounting"`
Accounted float64 `json:"accounted"`
Paid float64 `json:"paid"`
Unpaid float64 `json:"unpaid"`
}
var annualDividend = &AnnualDividend{}
if err := json.UnmarshalFromString(json.MarshalToString(dividendStatisticsResult), annualDividend); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
var items = make([]*dto.CreditAccountItem, 0)
for i := 0; i < len(resultMenu.Grid.List); i++ {
items = append(items, dto.ToCreditAccountItem(&resultMenu.Grid.List[i]))
}
return map[string]interface{}{
"grid": map[string]interface{}{
"list": items,
//TODO:sum 时间段支付金额
"sum": 6000,
"sum": annualDividend.Paid,
},
}, nil
}
... ...
... ... @@ -2,7 +2,9 @@ package service
import (
"github.com/linmadan/egglib-go/core/application"
"github.com/linmadan/egglib-go/utils/json"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
"time"
)
... ... @@ -15,19 +17,58 @@ type PersonCreditAccountService struct {
func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
var beginTime, endTime time.Time
if cmd.BeginTime > 0 {
beginTime = time.Unix(cmd.BeginTime/1000, 0)
}
if cmd.EndTime > 0 {
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,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
queryOptions := map[string]interface{}{
"userBaseId": cmd.Operator.UserBaseId,
}
if cmd.BeginTime > 0 {
queryOptions["beginTime"] = beginTime
}
if cmd.EndTime > 0 {
queryOptions["endTime"] = endTime
}
// 2.分红统计
dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
type AnnualDividend struct {
Total float64 `json:"total"`
Accounting float64 `json:"accounting"`
Accounted float64 `json:"accounted"`
Paid float64 `json:"paid"`
Unpaid float64 `json:"unpaid"`
}
var annualDividend = &AnnualDividend{}
if err := json.UnmarshalFromString(json.MarshalToString(dividendStatisticsResult), annualDividend); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
var items = make([]*dto.CreditAccountItem, 0)
for i := 0; i < len(resultMenu.Grid.List); i++ {
items = append(items, dto.ToCreditAccountItem(&resultMenu.Grid.List[i]))
}
return map[string]interface{}{
"grid": map[string]interface{}{
"list": resultMenu.Grid.List,
"sum": 6000,
"list": items,
"sum": annualDividend.Paid,
},
}, nil
}
... ...
... ... @@ -188,6 +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},
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ...
package service
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"strconv"
"github.com/linmadan/egglib-go/core/application"
... ... @@ -163,6 +164,7 @@ func (orgsService OrgsService) DepartmentsUsers(departmentsUsersQuery *query.Dep
CompanyId: departmentsUsersQuery.Operator.CompanyId,
OrganizationId: departmentsUsersQuery.Operator.OrgId,
Limit: 1000,
InEnableStatus: []int{domain.UserStatusEnable, domain.UserStatusDisable},
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ...
... ... @@ -88,6 +88,8 @@ type (
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"`
BeginTime time.Time `json:"beginTime"`
EndTime time.Time `json:"endTime"`
}
DataCreditAccountsSearch struct {
... ...
... ... @@ -101,6 +101,8 @@ type (
PullRealTime bool `cname:"拉取最新数据" json:"pullRealTime,omitempty"`
// 状态(1:启用 2:禁用 3:注销)
EnableStatus int `cname:"状态(1:启用 2:禁用 3:注销)" json:"enableStatus,omitempty"`
// 状态(1:启用 2:禁用 3:注销)
InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"`
}
//DataUserSearch 搜索用户列表
... ...