作者 yangfu
... ... @@ -37,7 +37,7 @@ type CreditAccountItem struct {
UpdatedAt int64 `json:"updatedAt"` // 更新时间
AccountDetail []struct {
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
DividendsType string `json:"dividendsType"`
DividendsType int `json:"dividendsType"`
DividendsAmount float64 `json:"dividendsAmount"`
} `json:"accountDetail"` //结算明细
}
... ...
... ... @@ -24,6 +24,7 @@ func (cooperationApplicationService *CooperationApplicationService) AuditCoopera
CooperationApplicationIds: auditCooperationApplicationCommand.CooperationApplicationId,
CooperationApplicationDescription: auditCooperationApplicationCommand.CooperationApplicationVerifyDescription,
Action: auditCooperationApplicationCommand.CooperationApplicationStatus,
Code: "BatchApproval",
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -27,9 +27,20 @@ type CreditAccountItem struct {
UpdatedAt int64 `json:"updatedAt"` // 更新时间
AccountDetail []struct {
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
DividendsType string `json:"dividendsType"`
DividendsType int `json:"dividendsType"`
DividendsAmount float64 `json:"dividendsAmount"`
} `json:"accountDetail"` //结算明细
Operator struct {
UserId int `json:"userId,string,"` // 用户ID,
UserBaseId int `json:"userBaseId,string,"` // 用户基本id
UserName string `json:"userName"` // 用户姓名
UserPhone string `json:"userPhone"` // 用户手机号
UserInfo struct {
UserName string `json:"userName"` // 共创人员姓名
UserPhone string `json:"userPhone"` // 用户手机号
UserAccount string `json:"userAccount"` // 用户账号,
} `json:"userInfo"`
} `json:"operator"`
}
func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *CreditAccountItem {
... ... @@ -53,5 +64,11 @@ func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *Cred
data.Participator.UserName = param.Participator.UserName
data.Participator.UserPhone = param.Participator.UserPhone
data.Participator.UserType = param.Participator.UserType
data.Operator.UserId = param.Operator.UserId
data.Operator.UserBaseId = param.Operator.UserBaseId
data.Operator.UserName = param.Operator.UserName
data.Operator.UserPhone = param.Operator.UserPhone
data.Operator.UserInfo.UserName = param.Operator.UserName
data.Operator.UserInfo.UserPhone = param.Operator.UserPhone
return &data
}
... ...
package command
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
type ConfimDividendsEstimateCommand struct {
//操作人
Operator domain.Operator `json:"-"`
DividendsEstimateId []string `json:"dividendsEstimateId"`
}
... ...
... ... @@ -55,12 +55,14 @@ func (dividendsEstimateService *DividendsEstimateService) EstimateMoneyIncentive
item := map[string]interface{}{
"userId": result[i].DividendsUser.UserId,
"userName": result[i].DividendsUser.UserName,
"DividendsAmount": result[i].DividendsAmount,
"dividendsAmount": result[i].DividendsAmount,
}
data = append(data, item)
}
return data, nil
returnData := map[string]interface{}{
"list": data,
}
return returnData, nil
}
// 查询分红预算单列表
... ... @@ -170,3 +172,15 @@ func (dividendsEmmateService *DividendsEstimateService) MoneyIncentivesSelector(
}
return data, nil
}
//ConfimDividendsEstimate 确定分红预算
func (dividendsEstimateService *DividendsEstimateService) ConfimDividendsEstimate(confimDividendsEstimateCommand *command.ConfimDividendsEstimateCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(confimDividendsEstimateCommand.Operator)
_, 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
}
... ...
... ... @@ -164,3 +164,34 @@ func (gateway HttplibAlliedCreationCooperation) CreditAccountGet(param ReqCredit
err = gateway.GetResponseData(result, &data)
return &data, err
}
// CreditAccountsAdd 创建账期结算
func (gateway HttplibAlliedCreationCooperation) CreditAccountsAdd(param ReqCreditAccountsAdd) (*DataCreditAccountsAdd, error) {
url := gateway.baseUrL + "/credit-accounts"
method := "POST"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:创建账期结算。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求创建账期结算失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取创建账期结算失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:创建账期结算。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析创建账期结算:%w", err)
}
var data DataCreditAccountsAdd
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
... ... @@ -81,6 +81,7 @@ type (
CooperationApplicationIds []string `json:"cooperationApplicationIds"`
CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //描述
Action int `json:"action"` //审核动作,1同意,2拒绝
Code string `json:"code" ` //cname:"菜单编码"
}
DataCooperationApplicationBatchApproval struct {
... ...
... ... @@ -18,14 +18,20 @@ type CreditAccount struct {
Participator struct {
UserId int `json:"userId,string,"` // 用户ID,
UserBaseId int `json:"userBaseId,string,"` // 用户基本id
// Org domain.Org `json:"org"` // 用户所属的组织机构
// Department domain.Department `json:"department"` // 用户所属的部门
UserInfo domain.UserInfo `json:"userInfo"` //
UserName string `json:"userName"` // 用户姓名
UserPhone string `json:"userPhone"` // 用户手机号
UserType int `json:"userType"` // 用户类型,1员工,2共创用户,3公开
Status int `json:"status"` // 状态
} `json:"participator"` // 参与人
// 操作人
Operator struct {
UserId int `json:"userId,string,"` // 用户ID,
UserBaseId int `json:"userBaseId,string,"` // 用户基本id
UserName string `json:"userName"` // 用户姓名
UserPhone string `json:"userPhone"` // 用户手机号
UserInfo domain.UserInfo `json:"userInfo"` //
} `json:"operator"`
ParticipateType string `json:"participateType"` // 参与类型
PaymentDocumentAttachment domain.Attachment `json:"paymentDocumentAttachment"` // 支付凭证附件
Org domain.Org `json:"org"` // 数据所属组织机构
... ... @@ -34,7 +40,7 @@ type CreditAccount struct {
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
AccountDetail []struct {
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
DividendsType string `json:"dividendsType"`
DividendsType int `json:"dividendsType"`
DividendsAmount float64 `json:"dividendsAmount"`
} `json:"accountDetail"` //结算明细
}
... ... @@ -106,3 +112,13 @@ type (
CreditAccount
}
)
//创建账期结算
type (
ReqCreditAccountsAdd struct {
DividendsEstimateIds []string `json:"dividendsEstimateIdss"`
}
DataCreditAccountsAdd []struct {
}
)
... ...
... ... @@ -101,3 +101,16 @@ func (controller *DividendsEstimateController) MoneyIncentivesSelector() {
data, err := dividendsEstimateService.MoneyIncentivesSelector(moneyIncentivesSelectorQuery)
controller.Response(data, err)
}
//ConfimDividendsEstimate 确定分红预算
func (controller *DividendsEstimateController) ConfimDividendsEstimate() {
dividendsEstimateService := service.NewDividendsEstimateService(nil)
confimDividendsEstimateCommand := &command.ConfimDividendsEstimateCommand{}
err := controller.Unmarshal(confimDividendsEstimateCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
confimDividendsEstimateCommand.Operator = controller.GetOperator()
data, err := dividendsEstimateService.ConfimDividendsEstimate(confimDividendsEstimateCommand)
controller.Response(data, err)
}
... ...
... ... @@ -13,4 +13,6 @@ func init() {
web.Router("/v1/web/dividends-estimate/money-incentives/estimate", &web_client.DividendsEstimateController{}, "Post:EstimateMoneyIncentives")
web.Router("/v1/web/dividends-estimate/dividends-incentives/estimate", &web_client.DividendsEstimateController{}, "Post:EstimateDividendsIncentives")
web.Router("/v1/web/dividends-estimate/money-incentives/selector", &web_client.DividendsEstimateController{}, "Post:MoneyIncentivesSelector")
web.Router("/v1/web/dividends-estimate/confim", &web_client.DividendsEstimateController{}, "Post:ConfimDividendsEstimate")
}
... ...