作者 yangfu
... ... @@ -161,6 +161,7 @@ func (srv CooperationApplicationsService) PersonSearchCooperationApplications(ap
CompanyId: int(applicationQuery.Operator.CompanyId),
CooperationApplicationStatus: applicationQuery.Status,
UserBaseId: applicationQuery.Operator.UserBaseId,
IsCanceled: 1,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ...
... ... @@ -70,6 +70,7 @@ func (cooperationApplicationService *CooperationApplicationService) ListCooperat
PageNumber: listCooperationApplicationQuery.PageNumber,
PageSize: listCooperationApplicationQuery.PageSize,
CompanyId: int(listCooperationApplicationQuery.Operator.CompanyId),
IsCanceled: 3,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -94,11 +94,11 @@ type ContractUndertaker struct {
Department domain.Department `json:"department"`
HasReferrer bool `json:"hasReferrer"`
HasSalesman bool `json:"hasSalesman"`
ReferrerUser struct {
ReferrerUser *struct {
UserId int `json:"userId,string,"`
UserInfo domain.UserInfo `json:"userInfo"`
} `json:"referrerUser"`
SalesmanUser struct {
SalesmanUser *struct {
UserId int `json:"userId,string,"`
UserInfo domain.UserInfo `json:"userInfo"`
} `json:"salesmanUser"`
... ... @@ -189,14 +189,26 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
UserCode: v.UserInfo.UserCode,
},
}
u.SalesmanUser.UserId = v.Salesman.UserId
u.SalesmanUser.UserInfo.UsersId = v.Salesman.UserId
u.SalesmanUser.UserInfo.UsersName = v.Salesman.UserName
u.SalesmanUser.UserInfo.Phone = v.Salesman.UserPhone
u.ReferrerUser.UserId = v.Referrer.UserId
u.ReferrerUser.UserInfo.UsersId = v.Referrer.UserId
u.ReferrerUser.UserInfo.UsersName = v.Referrer.UserName
u.ReferrerUser.UserInfo.Phone = v.Referrer.UserPhone
if v.Salesman.UserId > 0 {
u.SalesmanUser = &struct {
UserId int `json:"userId,string,"`
UserInfo domain.UserInfo `json:"userInfo"`
}{}
u.SalesmanUser.UserId = v.Salesman.UserId
u.SalesmanUser.UserInfo.UsersId = v.Salesman.UserId
u.SalesmanUser.UserInfo.UsersName = v.Salesman.UserName
u.SalesmanUser.UserInfo.Phone = v.Salesman.UserPhone
}
if v.Referrer.UserId > 0 {
u.ReferrerUser = &struct {
UserId int `json:"userId,string,"`
UserInfo domain.UserInfo `json:"userInfo"`
}{}
u.ReferrerUser.UserId = v.Referrer.UserId
u.ReferrerUser.UserInfo.UsersId = v.Referrer.UserId
u.ReferrerUser.UserInfo.UsersName = v.Referrer.UserName
u.ReferrerUser.UserInfo.Phone = v.Referrer.UserPhone
}
contractUndertaker = append(contractUndertaker, u)
}
undertakerTypesUncheckedAvailable := param.UndertakerTypesUncheckedAvailable
... ...
package query
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type ListContractSelectorQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int `json:"pageNumber"`
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
CooperationContractNumber string `json:"cooperationContractNumber"`
SponsorName string `json:"sponsorName"`
}
... ...
... ... @@ -118,6 +118,7 @@ func (cooperationContractService *CooperationContractService) ListCooperationCon
PageSize: listCooperationContractQuery.PageSize,
SponsorName: listCooperationContractQuery.SponsorName,
CooperationContractNumber: listCooperationContractQuery.CooperationContractNumber,
OrgIds: listCooperationContractQuery.Operator.OrgIds,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -214,6 +215,7 @@ func (cooperationContractService *CooperationContractService) SearchCooperationC
PageNumber: queryParam.PageNumber,
PageIndex: queryParam.PageSize,
CompanyId: queryParam.Operator.CompanyId,
OrgIds: queryParam.Operator.OrgIds,
})
return result.Grid.Total, result.Grid.List, err
... ... @@ -231,3 +233,27 @@ func (cooperationContractService *CooperationContractService) RemoveCooperationC
return removeCooperationContractCommand, nil
}
// 分红单,分红退货单 返回共创合约下拉选择列表
func (cooperationContractService *CooperationContractService) ContractSelectorForDividendsOrder(
listCooperationContractQuery *query.ListContractSelectorQuery) (int, interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator)
result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
PageNumber: listCooperationContractQuery.PageNumber,
PageSize: listCooperationContractQuery.PageSize,
SponsorName: listCooperationContractQuery.SponsorName,
CooperationContractNumber: listCooperationContractQuery.CooperationContractNumber,
OrgId: listCooperationContractQuery.Operator.OrgId,
IncentivesType: 1,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
data := []dto.CooperationContractItem{}
for i := range result.Grid.List {
item := dto.ToCooperationContractItem(&result.Grid.List[i], listCooperationContractQuery.Operator.OrgId)
data = append(data, *item)
}
return result.Grid.Total, data, nil
}
... ...
... ... @@ -28,13 +28,16 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat
func (dividendsEstimateService *DividendsEstimateService) EstimateDividendsIncentives(estimateDividendsIncentivesCommand *command.EstimateDividendsIncentivesCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
estimateDividendsIncentivesCommand.Operator)
_, err := creationCooperationGateway.DividendsEstimateDividendsIncentives(allied_creation_cooperation.ReqDividendsEstimateDividendsIncentives{
result, err := creationCooperationGateway.DividendsEstimateDividendsIncentives(allied_creation_cooperation.ReqDividendsEstimateDividendsIncentives{
OrderGoodIds: estimateDividendsIncentivesCommand.OrderGoodIds,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return estimateDividendsIncentivesCommand, nil
respData := map[string]string{
"result": result.Report,
}
return respData, nil
}
// 确定预算金额激励分红
... ... @@ -221,11 +224,11 @@ func (dividendsEmmateService *DividendsEstimateService) MoneyIncentivesSelector(
//ConfimDividendsEstimate 确定分红预算
func (dividendsEstimateService *DividendsEstimateService) ConfimDividendsEstimate(confimDividendsEstimateCommand *command.ConfimDividendsEstimateCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(confimDividendsEstimateCommand.Operator)
_, err := creationCooperationGateway.CreditAccountsAdd(allied_creation_cooperation.ReqCreditAccountsAdd{
result, err := creationCooperationGateway.CreditAccountsAdd(allied_creation_cooperation.ReqCreditAccountsAdd{
DividendsEstimateIds: confimDividendsEstimateCommand.DividendsEstimateId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return confimDividendsEstimateCommand, nil
return result, nil
}
... ...
... ... @@ -126,7 +126,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
return updateDividendsReturnedOrderCommand, nil
}
// 更新分红退货单服务
// 分红单下拉选择列表
func (dividendsReturnedOrderService *DividendsReturnedOrderService) SelectorDividendsOrder(selectorDividendsOrderQuery *query.SelectorDividendsOrderQuery) (
int, interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(selectorDividendsOrderQuery.Operator)
... ... @@ -134,6 +134,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SelectorDivi
DividendsOrderNumber: selectorDividendsOrderQuery.DividendsOrderNumber,
PageNumber: 1,
PageSize: 999,
OrgId: selectorDividendsOrderQuery.Operator.OrgId,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -171,6 +171,7 @@ type (
OrgId int64 `json:"orgId"` // 组织机构ID
UserId int64 `json:"userId"`
UserBaseId int64 `json:"userBaseId"`
IsCanceled int `json:"isCanceled"` //1正常,2取消,3所有
}
DataCooperationApplicationSearch struct {
... ...
... ... @@ -235,6 +235,9 @@ type (
OrgId int64 ` json:"orgId"`
// 用户基础数据id
UserBaseId int64 `json:"userBaseId"`
// 组织机构ID
OrgIds []int64 ` json:"orgIds"`
IncentivesType int `json:"incentivesType"` //作为合约激励方式的判断,1业绩分红激励,2金额激励
}
DataCooperationContractSearch struct {
... ... @@ -248,13 +251,14 @@ type (
//根据承接人查询并返回共创项目合约
type (
ReqCooperationContractSearchByUndertaker struct {
CooperationContractName string `json:"cooperationContractName"` //合约名称
SponsorName string `json:"sponsorName"` //项目发起人姓名
PageNumber int `json:"pageNumber"`
PageIndex int `json:"pageIndex"`
CompanyId int64 ` json:"companyId"`
OrgId int64 ` json:"orgId"`
UserBaseId int64 `json:"userBaseId"`
CooperationContractName string `json:"cooperationContractName"` //合约名称
SponsorName string `json:"sponsorName"` //项目发起人姓名
PageNumber int `json:"pageNumber"`
PageIndex int `json:"pageIndex"`
CompanyId int64 ` json:"companyId"`
OrgId int64 ` json:"orgId"`
UserBaseId int64 `json:"userBaseId"`
OrgIds []int64 ` json:"orgIds"`
}
DataCooperationContractSearchByUndertaker struct {
... ...
... ... @@ -7,12 +7,12 @@ type (
ReqContractChangeLogsSearch struct {
OperationType int `json:"operationType,"` // 合约变更操作类型,1编辑、2暂停、3恢复
CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号
PageNumber int ` json:"pageNumber,"` // 页码
PageNumber int `json:"pageNumber,"` // 页码
PageSize int `json:"pageSize,"` // 页面大小
CompanyId int `json:"companyId"` //公司ID
OrgId int64 `json:"orgId"` // 组织机构ID
OrgIds []int64 `json:"orgIds"` // 关联的组织机构ID列表
UserId int64 ` json:"userId"` // 用户ID,
UserId int64 `json:"userId"` // 用户ID,
UserBaseId int64 `json:"userBaseId"` // 用户基础数据id
}
... ...
... ... @@ -138,6 +138,20 @@ type (
DividendsEstimateIds []string `json:"dividendsEstimateIds"`
}
DataCreditAccountsAdd []struct {
DataCreditAccountsAdd struct {
// 账期结算单ID
CreditAccountId int64 `json:"creditAccountId,string"`
// 账期结算实付金额
ActuallyPaidAmount float64 `json:"actuallyPaidAmount"`
// 账期结算单号
CreditAccountOrderNum string `json:"creditAccountOrderNum"`
// 账期结算支付状态,1待支付,2已支付
PaymentStatus int32 `json:"paymentStatus"`
// 共创账期结算支付时间
PaymentTime time.Time `json:"paymentTime"`
// 账期结算金额
SettlementAmount float64 `json:"settlementAmount"`
// 共创账期结算时间
SettlementTime time.Time `json:"settlementTime"`
}
)
... ...
... ... @@ -244,6 +244,7 @@ type (
OrderGoodIds []string `json:"orderGoodIds"`
}
DataDividendsEstimateDividendsIncentives []struct {
DataDividendsEstimateDividendsIncentives struct {
Report string `json:"report"`
}
)
... ...
... ... @@ -127,6 +127,7 @@ type (
CompanyId int `json:"companyId"`
CustomerName string `json:"customerName"`
DividendsOrderNumber string `json:"dividendsOrderNumber"`
OrgId int64 `json:"orgId"`
OrgIds []int64 `json:"orgIds"`
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
... ...
... ... @@ -106,3 +106,18 @@ func (controller *CooperationContractController) RemoveCooperationContract() {
data, err := cooperationContractService.RemoveCooperationContract(removeCooperationContractCommand)
controller.Response(data, err)
}
//分红订单,分红退货单获取关联合约选择列表
func (controller *CooperationContractController) SelectorContractForDividendsOrder() {
cooperationContractService := service.NewCooperationContractService(nil)
listCooperationContractQuery := &query.ListContractSelectorQuery{}
err := controller.Unmarshal(listCooperationContractQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
controller.Response(nil, err)
return
}
listCooperationContractQuery.Operator = controller.GetOperator()
cnt, data, err := cooperationContractService.ContractSelectorForDividendsOrder(listCooperationContractQuery)
controller.ReturnPageListData(int64(cnt), data, err, listCooperationContractQuery.PageNumber)
}
... ...
... ... @@ -11,4 +11,5 @@ func init() {
web.Router("/v1/web/dividends-order/remove", &web_client.DividendsOrderController{}, "Post:RemoveDividendsOrder")
web.Router("/v1/web/dividends-order/:orderId", &web_client.DividendsOrderController{}, "Get:GetDividendsOrder")
web.Router("/v1/web/dividends-order/search", &web_client.DividendsOrderController{}, "Post:SearchDividendsOrder")
web.Router("/v1/web/dividends-order/selector/contract", &web_client.CooperationContractController{}, "Post:SelectorContractForDividendsOrder")
}
... ...