作者 Administrator

合并分支 'test' 到 'master'

Test



查看合并请求 !2
FROM 192.168.0.243:5000/mmm/allied-creation-gateway:20210809
ENV APP_DIR $GOPATH/src/project-20210909
ENV APP_DIR $GOPATH/src/project-20210916
RUN mkdir -p $APP_DIR
WORKDIR $APP_DIR/
COPY ./pkg pkg
... ...
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,16 @@ 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,
SearchCooperationProjectExtQueries: extQueries,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -120,6 +122,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(
... ...
... ... @@ -124,8 +124,8 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi
PageSize: cmd.PageSize,
PaymentStatus: 2,
OrgId: cmd.Operator.OrgId,
BeginTime: beginTime,
EndTime: endTime,
PaymentBeginTime: beginTime,
PaymentEndTime: endTime,
CooperationContractNumbers: cooperationContractNumbers,
}
resultMenu, err := gateway.CreditAccountsSearch(req)
... ... @@ -137,10 +137,10 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi
"cooperationContractNumbers": cooperationContractNumbers,
}
if cmd.BeginTime > 0 {
queryOptions["beginTime"] = beginTime
queryOptions["paymentBeginTime"] = beginTime
}
if cmd.EndTime > 0 {
queryOptions["endTime"] = endTime
queryOptions["paymentEndTime"] = endTime
}
// 2.分红统计
dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions)
... ... @@ -200,10 +200,10 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre
"sortByActuallyPaidAmount": 2,
}
if cmd.BeginTime > 0 {
queryOptions["beginTime"] = time.Unix(cmd.BeginTime/1000, 0)
queryOptions["paymentBeginTime"] = time.Unix(cmd.BeginTime/1000, 0)
}
if cmd.EndTime > 0 {
queryOptions["endTime"] = time.Unix(cmd.EndTime/1000, 0)
queryOptions["paymentEndTime"] = time.Unix(cmd.EndTime/1000, 0)
}
cooperationUsersStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CompanyPaymentHistoryStatistics, queryOptions)
if err != nil {
... ...
... ... @@ -29,8 +29,8 @@ func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.Credit
PageSize: cmd.PageSize,
PaymentStatus: 2,
UserBaseId: cmd.Operator.UserBaseId,
BeginTime: beginTime,
EndTime: endTime,
PaymentBeginTime: beginTime,
PaymentEndTime: endTime,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ... @@ -39,10 +39,10 @@ func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.Credit
"userBaseId": cmd.Operator.UserBaseId,
}
if cmd.BeginTime > 0 {
queryOptions["beginTime"] = beginTime
queryOptions["paymentBeginTime"] = beginTime
}
if cmd.EndTime > 0 {
queryOptions["endTime"] = endTime
queryOptions["paymentEndTime"] = endTime
}
// 2.分红统计
dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions)
... ... @@ -85,10 +85,10 @@ func (srv PersonCreditAccountService) PaymentHistoryStatistics(cmd *command.Cred
"sortByActuallyPaidAmount": 2,
}
if cmd.BeginTime > 0 {
queryOptions["beginTime"] = time.Unix(cmd.BeginTime/1000, 0)
queryOptions["paymentBeginTime"] = time.Unix(cmd.BeginTime/1000, 0)
}
if cmd.EndTime > 0 {
queryOptions["endTime"] = time.Unix(cmd.EndTime/1000, 0)
queryOptions["paymentEndTime"] = time.Unix(cmd.EndTime/1000, 0)
}
cooperationUsersStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.PersonCompanyPaymentHistoryStatistics, queryOptions)
if err != nil {
... ...
... ... @@ -237,8 +237,8 @@ func (srv CompanyStatisticsService) GoodsStatistics(cmd *command.GoodsStatistics
"companyId": cmd.Operator.CompanyId,
"orgId": cmd.Operator.OrgId,
"rankType": cmd.RankingType, //当前月
//"offset":cmd.PageNumber*cmd.PageSize,
"top": 100,
"offset": cmd.PageNumber * cmd.PageSize,
"limit": cmd.PageSize,
})
if err != nil {
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ...
... ... @@ -56,7 +56,7 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC
beginTime := time.Date(year, month, 1, 0, 0, 0, 0, time.Local)
endTime := beginTime.AddDate(0, 1, 0)
// 2.本月分红统计 - 个人
dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{
unPaidResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{
"userBaseId": cmd.Operator.UserBaseId,
"beginTime": beginTime,
"endTime": endTime,
... ... @@ -71,14 +71,24 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC
Paid float64 `json:"paid"`
Unpaid float64 `json:"unpaid"`
}
var annualDividend = &AnnualDividend{}
if err := json.UnmarshalFromString(json.MarshalToString(dividendStatisticsResult), annualDividend); err != nil {
var annualUnPaidDividend = &AnnualDividend{}
if err := json.UnmarshalFromString(json.MarshalToString(unPaidResult), annualUnPaidDividend); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// 2.本月分红统计 - 个人
paymentResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{
"userBaseId": cmd.Operator.UserBaseId,
"paymentBeginTime": beginTime,
"paymentEndTime": endTime,
})
var annualPaymentDividend = &AnnualDividend{}
if err := json.UnmarshalFromString(json.MarshalToString(paymentResult), annualPaymentDividend); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
dividendStatistics := map[string]interface{}{
"dividendAmount": annualDividend.Paid + annualDividend.Unpaid, // 分红金额 annualDividend.Total
"paidAmount": annualDividend.Paid, // 已支付
"unPaidAmount": annualDividend.Unpaid, // 未支付
"dividendAmount": annualPaymentDividend.Paid + annualUnPaidDividend.Unpaid, // 分红金额 annualDividend.Total
"paidAmount": annualPaymentDividend.Paid, // 已支付
"unPaidAmount": annualUnPaidDividend.Unpaid, // 未支付
}
return map[string]interface{}{
... ... @@ -156,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{
... ...
... ... @@ -11,6 +11,7 @@ type ContractChangeLogItem struct {
OperationType int `json:"operationType"`
Undertakers string `json:"undertakers"`
UpdatedAt string `json:"updatedAt"`
OperatorTime string `json:"operationTime"`
}
func ToContractChangeLogList(param *allied_creation_cooperation.DataContractChangeLogsSearch) []ContractChangeLogItem {
... ... @@ -25,6 +26,7 @@ func ToContractChangeLogList(param *allied_creation_cooperation.DataContractChan
OperationType: int(v.OperationType),
Undertakers: v.Undertakers,
UpdatedAt: v.UpdatedAt.Format("2006-01-02 15:04:05"),
OperatorTime: v.OperatorTime.Format("2006-01-02 15:04:05"),
}
listData = append(listData, item)
}
... ...
... ... @@ -2,6 +2,8 @@ package service
import (
"fmt"
"strings"
"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"
... ... @@ -9,7 +11,6 @@ import (
"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"
"strings"
)
type ExcelDataService struct {
... ... @@ -119,58 +120,60 @@ func (srv ExcelDataService) ImportCompanyUser2(importDataCommand *command.Import
// 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
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 nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
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,
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 nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return srv.importResultWithHeader(excelImport.DataFields, result.FailRows, len(users)), nil
}
// ImportCompanyUser 导入公司用户信息
... ... @@ -182,13 +185,13 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD
excelImport := excel.NewExcelImport()
excelImport.RowBegin = 3 //第二行开始读取
excelImport.DataFields = []excel.DataField{
{EnName: "userCode", CnName: "*用户编"},
{EnName: "userCode", CnName: "*用户编"},
{EnName: "userName", CnName: "*用户姓名"},
{EnName: "org", CnName: "*组织机构"},
{EnName: "department", CnName: "*所属部门"},
{EnName: "enableStatus", CnName: "*用户状态"},
{EnName: "phone", CnName: "*手机号"},
{EnName: "email", CnName: "邮箱"},
{EnName: "enableStatus", CnName: "状态"},
}
excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader)
if err != nil {
... ... @@ -196,21 +199,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)
}
... ... @@ -222,16 +223,16 @@ 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
}
func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) {
excelImport := excel.NewExcelImport()
excelImport.RowBegin = 2 //第二行开始读取
excelImport.RowBegin = 3 //第二行开始读取
excelImport.DataFields = []excel.DataField{
{EnName: "OrgCode", CnName: "*部门编码"},
{EnName: "OrgName", CnName: "*部门名称"},
{EnName: "ParentOrgCode", CnName: "*上级部门编码"},
{EnName: "orgCode", CnName: "*部门编码"},
{EnName: "orgName", CnName: "*部门名称"},
{EnName: "parentOrgCode", CnName: "*上级部门编码"},
}
excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader)
if err != nil {
... ... @@ -239,11 +240,14 @@ 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"],
OrgName: v["OrgName"],
ParentOrgCode: v["ParentOrgCode"],
OrgCode: v["orgCode"],
OrgName: v["orgName"],
ParentOrgCode: v["parentOrgCode"],
}
items = append(items, item)
}
... ... @@ -254,7 +258,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return result, nil
return srv.importResultWithHeader(excelImport.DataFields, result.FailRows, len(items)), nil
}
// 导入结果
... ... @@ -281,14 +285,25 @@ func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, fa
return result
}
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
}
// 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",
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/20210917/object/1631843469_DykNwexeYYtzxzbwsER5RrzCS7QRwGmd.xlsx",
domain.ImportCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210918/object/1631932960_fen6RZS7ZesyDPMzXactKKCenhRMkfRb.xlsx",
domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210918/object/1631933214_MbTxsQtnEEMprHADFR6MedfZBkxYWBYA.xlsx",
}
var url string
var ok bool
... ...
... ... @@ -139,7 +139,7 @@ func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *qu
roleMenuBeforeEditQuery.Operator)
roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId)
roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
OrgId: roleMenuBeforeEditQuery.Operator.OrgId,
CompanyId: roleMenuBeforeEditQuery.Operator.CompanyId,
Limit: 999,
RoleType: 1,
})
... ...
... ... @@ -51,25 +51,14 @@ const (
const (
// 导入公司用户
ImportCompanyUser = "ImportCompanyUser"
ImportCompanyUser = "ADMIN_SYSTEM-MANAGE_BASE_USER"
// 导入公司组织
ImportOrganization = "ImportOrganization"
ImportOrganization = "ADMIN_SYSTEM-MANAGE_BASE_DEPARTMENT"
// 导入共创用户
ImportCooperationUser = "ImportCooperationUser"
ImportCooperationUser = "ADMIN_SYSTEM-MANAGE_BASE_ALLIED-USER"
// 导入分红订单
ImportDividendsOrders = "ImportDividendsOrders"
)
//excel 导入模板
const (
// 导入公司用户
TemplateCompanyUser = "TemplateCompanyUser"
// 导入公司组织
TemplateOrganization = "TemplateOrganization"
// 导入共创用户
TemplateCooperationUser = "TemplateCooperationUser"
// 分红订单模板
TemplateDividendsOrders = "TemplateDividendsOrders"
ImportDividendsOrders = "BUSINESS_ALLIED-CREATION_BONUS_ORDER"
// 导入退货订单
ImportDividendsReturnOrders = "BUSINESS_ALLIED-CREATION_BONUS_RETURN"
)
... ...
... ... @@ -171,6 +171,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"`
... ... @@ -192,6 +206,8 @@ type (
UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"`
// 共创项目承接对象,1员工,2共创用户,4公开,可以多选
CooperationProjectUndertakerType int32 `json:"cooperationProjectUndertakerType"`
// 额外的查询条件
SearchCooperationProjectExtQueries []*SearchCooperationProjectExtQuery `cname:"额外的查询条件" json:"searchCooperationProjectExtQueries"`
}
DataCooperationProjectSearchItem struct {
CooperationProjectID string `json:"cooperationProjectId"`
... ...
... ... @@ -90,6 +90,10 @@ type (
UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"`
BeginTime time.Time `json:"beginTime"`
EndTime time.Time `json:"endTime"`
// 支付开始时间
PaymentBeginTime time.Time `json:"paymentBeginTime"`
// 支付结束时间
PaymentEndTime time.Time `json:"paymentEndTime"`
// 合约编号列表
CooperationContractNumbers []string `json:"cooperationContractNumbers"`
}
... ...
... ... @@ -226,7 +226,7 @@ func (gateway HttplibAlliedCreationUser) OrgSearch(param ReqOrgSearch) (*DataOrg
return &data, err
}
func (gateway HttplibAlliedCreationUser) OrgBatchAdd(param ReqBatchAddOrg) (*DataBatchAddOrg, error) {
func (gateway HttplibAlliedCreationUser) OrgBatchAdd(param ReqBatchAddOrg) (*DataImportResponse, error) {
url := fmt.Sprintf("%s%s", gateway.baseUrL, "/org/batch-add")
method := "post"
req := gateway.CreateRequest(url, method)
... ... @@ -252,7 +252,7 @@ func (gateway HttplibAlliedCreationUser) OrgBatchAdd(param ReqBatchAddOrg) (*Dat
if err != nil {
return nil, fmt.Errorf("解析批量添加用户:%w", err)
}
var data DataBatchAddOrg
var data DataImportResponse
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
... ... @@ -33,6 +33,8 @@ type (
RoleName string `json:"roleName"`
// 组织ID
OrgId int64 `json:"orgId"`
// 企业id
CompanyId int64 `cname:"企业id" json:"companyId"`
// 匹配多个组织
InOrgIds []int64 `cname:"匹配多个组织" json:"inOrgIds,omitempty"`
// 角色名称
... ...
... ... @@ -393,11 +393,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"`
}
... ...
package web_client
import (
"fmt"
"io"
"strings"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
... ... @@ -43,8 +45,8 @@ func (controller *ExcelDataController) fieldValueAllEmpty(param map[string]strin
return isAllEmpty
}
//导出公司用户
func (controller *ExcelDataController) ExportCompanyUser() {
// ExportCompanyUser 导出公司用户
func (controller ExcelDataController) ExportCompanyUser() {
excelService := service.NewExcelDataService(nil)
companyUserListQuery := &query.CompanyUserListQuery{}
err := controller.Unmarshal(companyUserListQuery)
... ... @@ -70,8 +72,8 @@ func (controller *ExcelDataController) ExportCompanyUser() {
controller.responseExcelByFile(controller.Ctx, excelTool, "导出公司用户")
}
//导出共创用户
func (controller *ExcelDataController) ExportCooperationUser() {
// ExportCooperationUser 导出共创用户
func (controller ExcelDataController) ExportCooperationUser() {
excelService := service.NewExcelDataService(nil)
companyUserListQuery := &query.CompanyUserListQuery{}
err := controller.Unmarshal(companyUserListQuery)
... ... @@ -97,12 +99,12 @@ func (controller *ExcelDataController) ExportCooperationUser() {
controller.responseExcelByFile(controller.Ctx, excelTool, "导出共创用户")
}
// ImportDividendsOrder TODO 导入分红订单
func (controller *ExcelDataController) ImportDividendsOrder() {
// ImportDividendsOrder 导入分红订单
func (controller ExcelDataController) ImportDividendsOrder() {
importDividendsOrder(controller)
}
func importDividendsOrder(controller *ExcelDataController) {
func importDividendsOrder(controller ExcelDataController) {
fileReader, err := controller.GetExcelFile()
if err != nil {
... ... @@ -110,7 +112,7 @@ func importDividendsOrder(controller *ExcelDataController) {
return
}
excelImport := excel.NewExcelImport()
excelImport.RowBegin = 2 //第2行开始读取
excelImport.RowBegin = 3 //第3行开始读取
excelImport.DataFields = []excel.DataField{
{EnName: "OriginalOrderNum", CnName: "*来源单号"},
{EnName: "DividendsCustomerName", CnName: "*客户名称"},
... ... @@ -120,7 +122,7 @@ func importDividendsOrder(controller *ExcelDataController) {
{EnName: "OrderGoodQuantity", CnName: "*产品数量"},
{EnName: "OrderGoodPrice", CnName: "*产品价格"},
{EnName: "Expense", CnName: "费用"},
{EnName: "CooperationContractNumber", CnName: "项目合约编号"},
{EnName: "CooperationContractNumber", CnName: "*项目合约编号"},
}
excelData, err := excelImport.OpenExcelFromIoReader(fileReader)
if err != nil {
... ... @@ -161,11 +163,11 @@ func importDividendsOrder(controller *ExcelDataController) {
}
// ImportDividendsReturnedOrder 导入分红退货单
func (controller *ExcelDataController) ImportDividendsReturnedOrder() {
func (controller ExcelDataController) ImportDividendsReturnedOrder() {
importDividendsReturnedOrder(controller)
}
func importDividendsReturnedOrder(controller *ExcelDataController) {
func importDividendsReturnedOrder(controller ExcelDataController) {
fileReader, err := controller.GetExcelFile()
if err != nil {
... ... @@ -173,7 +175,7 @@ func importDividendsReturnedOrder(controller *ExcelDataController) {
return
}
excelImport := excel.NewExcelImport()
excelImport.RowBegin = 2 //第2行表头开始读取
excelImport.RowBegin = 3 //第2行表头开始读取
excelImport.DataFields = []excel.DataField{
{EnName: "OriginalOrderNum", CnName: "*来源单号"},
{EnName: "DividendsReturnedCustomerName", CnName: "*客户名称"},
... ... @@ -183,7 +185,7 @@ func importDividendsReturnedOrder(controller *ExcelDataController) {
{EnName: "RegionName", CnName: "退货区域"},
{EnName: "OrderGoodQuantity", CnName: "*退货数量"},
{EnName: "OrderGoodPrice", CnName: "*退货价格"},
{EnName: "CooperationContractNumber", CnName: "项目合约编号"},
{EnName: "CooperationContractNumber", CnName: "*项目合约编号"},
}
excelData, err := excelImport.OpenExcelFromIoReader(fileReader)
if err != nil {
... ... @@ -223,89 +225,51 @@ func importDividendsReturnedOrder(controller *ExcelDataController) {
controller.Response(result, nil)
}
func (controller *ExcelDataController) ImportCompanyUser() {
importCompanyUser(controller)
}
func importCompanyUser(controller *ExcelDataController) {
excelService := service.NewExcelDataService(nil)
r, err := controller.GetExcelFile()
if err != nil {
controller.Response(nil, err)
return
}
cmd := &command.ImportDataCommand{}
cmd.Operator = controller.GetOperator()
cmd.Reader = r
data, err := excelService.ImportCompanyUser(cmd)
controller.Response(data, err)
}
func (controller *ExcelDataController) ImportCooperationUser() {
importCooperationUser(controller)
}
func importCooperationUser(controller *ExcelDataController) {
excelService := service.NewExcelDataService(nil)
r, err := controller.GetExcelFile()
if err != nil {
controller.Response(nil, err)
return
// FileImport 文件导入
func (controller ExcelDataController) FileImport() {
code := controller.GetString("code")
switch code {
case domain.ImportDividendsOrders:
importDividendsOrder(controller)
case domain.ImportDividendsReturnOrders:
importDividendsReturnedOrder(controller)
default:
defaultImport(controller)
}
cmd := &command.ImportDataCommand{}
cmd.Operator = controller.GetOperator()
cmd.Reader = r
data, err := excelService.ImportCooperationUser(cmd)
controller.Response(data, err)
}
func (controller *ExcelDataController) ImportOrganization() {
func defaultImport(controller ExcelDataController) {
var (
data interface{}
err error
r io.Reader
)
excelService := service.NewExcelDataService(nil)
r, err := controller.GetExcelFile()
r, err = controller.GetExcelFile()
if err != nil {
controller.Response(nil, err)
return
}
cmd := &command.ImportDataCommand{}
controller.ParseForm(cmd)
cmd.Operator = controller.GetOperator()
cmd.Reader = r
data, err := excelService.ImportOrganization(cmd)
controller.Response(data, err)
}
func (controller *ExcelDataController) FileImport() {
// excelService := service.NewExcelDataService(nil)
// r, err := controller.GetExcelFile()
// if err != nil {
// controller.Response(nil, err)
// return
// }
// cmd := &command.ImportDataCommand{}
//controller.Unmarshal(cmd)
// controller.ParseForm(cmd)
// cmd.Operator = controller.GetOperator()
// cmd.Reader = r
// var (
// data interface{}
// err error
// )
code := controller.GetString("code")
switch code {
switch cmd.Code {
case domain.ImportCompanyUser:
importCompanyUser(controller)
data, err = excelService.ImportCompanyUser(cmd)
case domain.ImportCooperationUser:
importCooperationUser(controller)
case domain.ImportDividendsOrders:
importDividendsOrder(controller)
data, err = excelService.ImportCooperationUser(cmd)
case domain.ImportOrganization:
importDividendsReturnedOrder(controller)
data, err = excelService.ImportOrganization(cmd)
default:
err = fmt.Errorf("导入不存在 Code:%v", cmd.Code)
}
// controller.Response(data, err)
controller.Response(data, err)
}
func (controller *ExcelDataController) FileImportTemplate() {
func (controller ExcelDataController) FileImportTemplate() {
excelService := service.NewExcelDataService(nil)
cmd := &command.ImportDataCommand{}
//controller.Unmarshal(cmd)
code := controller.GetString(":code")
cmd.Code = code
var data interface{}
... ...
... ... @@ -9,14 +9,9 @@ func init() {
web.Router("/v1/web/excel/export/company-user", &web_client.ExcelDataController{}, "Post:ExportCompanyUser")
web.Router("/v1/web/excel/export/cooperation-user", &web_client.ExcelDataController{}, "Post:ExportCooperationUser")
web.Router("/v1/web/excel/import/company-user", &web_client.ExcelDataController{}, "Post:ImportCompanyUser")
web.Router("/v1/web/excel/import/cooperation-user", &web_client.ExcelDataController{}, "Post:ImportCooperationUser")
web.Router("/v1/web/excel/import/dividends-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsOrder")
web.Router("/v1/web/excel/import/dividends-returned-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsReturnedOrder")
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")
}
... ...