作者 tangxuhui

列表添加 权限标识

... ... @@ -44,9 +44,10 @@ type CreditAccountItem struct {
UserAccount string `json:"userAccount"` // 用户账号,
} `json:"userInfo"`
} `json:"operator"`
AuthFlag bool `json:"authFlag"`
}
func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *CreditAccountItem {
func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount, operatorOrgId int64) *CreditAccountItem {
data := CreditAccountItem{
CreditAccountId: param.CreditAccountId,
ActuallyPaidAmount: param.ActuallyPaidAmount,
... ... @@ -62,6 +63,7 @@ func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *Cred
CreatedAt: param.CreatedAt.UnixNano() / 1e6, // 创建时间
UpdatedAt: param.UpdatedAt.UnixNano() / 1e6, // 更新时间
AccountDetail: param.AccountDetail,
AuthFlag: param.Org.OrgID == int(operatorOrgId),
}
if !param.PaymentTime.IsZero() {
data.PaymentTime = param.PaymentTime.UnixNano() / 1e6
... ...
... ... @@ -29,7 +29,7 @@ func (srv *CreditAccountService) ListCreditAccount(listQuery *query.ListCreditAc
}
listData := []dto.CreditAccountItem{}
for i := range result.Grid.List {
item := dto.ToCreditAccountItem(&result.Grid.List[i])
item := dto.ToCreditAccountItem(&result.Grid.List[i], listQuery.Operator.OrgId)
listData = append(listData, *item)
}
return int64(result.Grid.Total), listData, nil
... ... @@ -44,7 +44,7 @@ func (srv *CreditAccountService) GetCreditAccount(getQuery *query.GetCreditAccou
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return dto.ToCreditAccountItem(&result.CreditAccount), nil
return dto.ToCreditAccountItem(&result.CreditAccount, getQuery.Operator.OrgId), nil
}
//PayCreditAccount 支付账期结算
... ...
... ... @@ -15,28 +15,29 @@ type DividendsEstimateDividendItem struct {
OrderTime int64 `json:"orderTime"` //订单/退货单日期
OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
RegionName string `json:"regionName"` //区域名称
AuthFlag bool `json:"authFlag"`
}
func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDividendsEstimateSearchDividend) []DividendsEstimateDividendItem {
listdata := []DividendsEstimateDividendItem{}
for _, v := range param.List {
item := DividendsEstimateDividendItem{
OrderGoodId: v.OrderGoodId,
OrderGoodName: v.OrderGoodName,
CooperationContractNumber: v.CooperationContractNumber,
CustomerName: v.CustomerName,
DividendsIncentivesAmount: v.OrderAmount,
OrderOrReturnedOrderNum: v.OrderNumber,
// func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDividendsEstimateSearchDividend) []DividendsEstimateDividendItem {
// listdata := []DividendsEstimateDividendItem{}
// for _, v := range param.List {
// item := DividendsEstimateDividendItem{
// OrderGoodId: v.OrderGoodId,
// OrderGoodName: v.OrderGoodName,
// CooperationContractNumber: v.CooperationContractNumber,
// CustomerName: v.CustomerName,
// DividendsIncentivesAmount: v.OrderAmount,
// OrderOrReturnedOrderNum: v.OrderNumber,
OriginalOrderNum: v.OriginalOrderNum,
RegionName: v.RegionName,
}
item.OrderTime = v.OrderDate.UnixNano() / 1e6
listdata = append(listdata, item)
}
// OriginalOrderNum: v.OriginalOrderNum,
// RegionName: v.RegionName,
// }
// item.OrderTime = v.OrderDate.UnixNano() / 1e6
// listdata = append(listdata, item)
// }
return listdata
}
// return listdata
// }
//金额激励列表
type DividendsEstimateMoneyItem struct {
... ... @@ -108,4 +109,5 @@ type DividendsEstimateItem struct {
OrgId int `json:"orgId,string,"` // 组织机构ID
OrgName string `json:"orgName"` // 组织名称
} `json:"org"` // 数据所属组织机构
AuthFlag bool `json:"authFlag"`
}
... ...
... ... @@ -96,6 +96,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat
CooperationContractNumber: v.CooperationContractNumber,
DividendsIncentivesStage: v.DividendsStage,
IsCanceled: v.IsCanceled,
AuthFlag: v.Org.OrgId == int(searchDividendsEstimateQuery.Operator.OrgId),
}
item.DividendsUser.Phone = v.DividendsUser.UserInfo.UserPhone
item.DividendsUser.UsersName = v.DividendsUser.UserInfo.UserName
... ... @@ -125,7 +126,22 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncenti
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
listdata := dto.ToDividendsEstimateDividendItem(result)
listdata := []dto.DividendsEstimateDividendItem{}
for _, v := range result.List {
item := dto.DividendsEstimateDividendItem{
OrderGoodId: v.OrderGoodId,
OrderGoodName: v.OrderGoodName,
CooperationContractNumber: v.CooperationContractNumber,
CustomerName: v.CustomerName,
DividendsIncentivesAmount: v.OrderAmount,
OrderOrReturnedOrderNum: v.OrderNumber,
OriginalOrderNum: v.OriginalOrderNum,
RegionName: v.RegionName,
}
item.OrderTime = v.OrderDate.UnixNano() / 1e6
listdata = append(listdata, item)
}
return result.Total, listdata, nil
}
... ...
... ... @@ -29,6 +29,7 @@ type DividendsOrder struct {
Remarks string `json:"remarks"`
Goods []DividendsOrderGoods `json:"goods"`
Returned bool `json:"returned"`
AuthFlag bool `json:"authFlag"`
}
type DividendsOrderGoods struct {
... ... @@ -44,7 +45,7 @@ type DividendsOrderGoods struct {
OrderGoodDividendsStatus int32 `json:"orderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红
}
func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *DividendsOrder {
func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder, operatorOrgId int64) *DividendsOrder {
goods := []DividendsOrderGoods{}
for _, v := range param.Goods {
good := DividendsOrderGoods{
... ... @@ -75,6 +76,7 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide
Remarks: param.Remarks,
Goods: goods,
Returned: param.Returned,
AuthFlag: param.Org.OrgID == int(operatorOrgId),
}
return &data
... ...
... ... @@ -48,7 +48,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return dto.ToDividendsOrder(&result.DividendsOrder), nil
return dto.ToDividendsOrder(&result.DividendsOrder, createDividendsOrderCommand.Operator.OrgId), nil
}
// 返回分红订单实体对象
... ... @@ -61,7 +61,7 @@ func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividen
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return dto.ToDividendsOrder(&result.DividendsOrder), nil
return dto.ToDividendsOrder(&result.DividendsOrder, getDividendsOrderQuery.Operator.OrgId), nil
}
// 移除分红订单实体对象
... ... @@ -93,7 +93,7 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD
}
dataList := []dto.DividendsOrder{}
for i := range result.Grid.List {
item := dto.ToDividendsOrder(&result.Grid.List[i])
item := dto.ToDividendsOrder(&result.Grid.List[i], searchDividendsOrderQuery.Operator.OrgId)
dataList = append(dataList, *item)
}
return result.Grid.Total, dataList, nil
... ...
... ... @@ -33,10 +33,12 @@ type DividendsReturnedOrderInfo struct {
RegionName string `json:"regionName"`
RegionNumber string `json:"regionNumber"` //区域编码
} `json:"region"` //区域信息
Goods []allied_creation_cooperation.DividendsReturnedOrderGoods `json:"goods"` //货品
AuthFlag bool `json:"authFlag"`
Goods []allied_creation_cooperation.DividendsReturnedOrderGoods `json:"goods"` //货品
}
func ToDividendsReturnedOrderInfo(param *allied_creation_cooperation.DividendsReturnedOrder) *DividendsReturnedOrderInfo {
func ToDividendsReturnedOrderInfo(param *allied_creation_cooperation.DividendsReturnedOrder, operatorOrgId int64) *DividendsReturnedOrderInfo {
goods := param.Goods
if len(param.Goods) == 0 {
goods = []allied_creation_cooperation.DividendsReturnedOrderGoods{}
... ... @@ -58,6 +60,7 @@ func ToDividendsReturnedOrderInfo(param *allied_creation_cooperation.DividendsRe
DividendsReturnedOrderRefund: param.DividendsReturnedOrderRefund,
OriginalOrderNum: param.OriginalOrderNum,
Remarks: param.Remarks,
AuthFlag: param.Org.OrgID == int(operatorOrgId),
}
return &data
}
... ...
... ... @@ -44,7 +44,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return dto.ToDividendsReturnedOrderInfo(&result.DividendsReturnedOrder), nil
return dto.ToDividendsReturnedOrderInfo(&result.DividendsReturnedOrder, createDividendsReturnedOrderCommand.Operator.OrgId), nil
}
// 返回分红退货单服务
... ... @@ -56,7 +56,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return dto.ToDividendsReturnedOrderInfo(&result.DividendsReturnedOrder), nil
return dto.ToDividendsReturnedOrderInfo(&result.DividendsReturnedOrder, getDividendsReturnedOrderQuery.Operator.OrgId), nil
}
// 移除分红退货单服务
... ... @@ -85,7 +85,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide
}
dataList := []dto.DividendsReturnedOrderInfo{}
for i := range result.Grid.List {
item := dto.ToDividendsReturnedOrderInfo(&result.Grid.List[i])
item := dto.ToDividendsReturnedOrderInfo(&result.Grid.List[i], searchDividendsReturnedOrderQuery.Operator.OrgId)
dataList = append(dataList, *item)
}
return result.Grid.Total, dataList, nil
... ...
... ... @@ -10,4 +10,5 @@ type NoticeSettingItem struct {
NoticeSettingID int `json:"noticeSettingId,string"`
OrgID int `json:"orgId,string"`
OrgName string `json:"orgName"`
AuthFlag bool `json:"authFlag"`
}
... ...
... ... @@ -69,6 +69,7 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingList(noticeSettin
NoticeSettingID: v.NoticeSettingID,
OrgID: v.OrgID,
ModuleActionName: v.ModuleActionName,
AuthFlag: v.OrgID == int(noticeSettingListQuery.Operator.OrgId),
}
orgData, _ := creationUserGateway.OrgGet(allied_creation_user.ReqOrgGet{
OrgId: v.OrgID,
... ... @@ -163,6 +164,7 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingGet(noticeSetting
ModuleAction: result.ModuleAction,
NoticeSettingID: result.NoticeSettingID,
OrgID: result.OrgID,
AuthFlag: result.OrgID == int(noticeSettingGetQuery.Operator.OrgId),
}
return data, nil
}
... ...