作者 yangfu
@@ -37,7 +37,7 @@ type CreditAccountItem struct { @@ -37,7 +37,7 @@ type CreditAccountItem struct {
37 UpdatedAt int64 `json:"updatedAt"` // 更新时间 37 UpdatedAt int64 `json:"updatedAt"` // 更新时间
38 AccountDetail []struct { 38 AccountDetail []struct {
39 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` 39 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
40 - DividendsType string `json:"dividendsType"` 40 + DividendsType int `json:"dividendsType"`
41 DividendsAmount float64 `json:"dividendsAmount"` 41 DividendsAmount float64 `json:"dividendsAmount"`
42 } `json:"accountDetail"` //结算明细 42 } `json:"accountDetail"` //结算明细
43 } 43 }
@@ -24,6 +24,7 @@ func (cooperationApplicationService *CooperationApplicationService) AuditCoopera @@ -24,6 +24,7 @@ func (cooperationApplicationService *CooperationApplicationService) AuditCoopera
24 CooperationApplicationIds: auditCooperationApplicationCommand.CooperationApplicationId, 24 CooperationApplicationIds: auditCooperationApplicationCommand.CooperationApplicationId,
25 CooperationApplicationDescription: auditCooperationApplicationCommand.CooperationApplicationVerifyDescription, 25 CooperationApplicationDescription: auditCooperationApplicationCommand.CooperationApplicationVerifyDescription,
26 Action: auditCooperationApplicationCommand.CooperationApplicationStatus, 26 Action: auditCooperationApplicationCommand.CooperationApplicationStatus,
  27 + Code: "BatchApproval",
27 }) 28 })
28 if err != nil { 29 if err != nil {
29 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 30 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -27,9 +27,20 @@ type CreditAccountItem struct { @@ -27,9 +27,20 @@ type CreditAccountItem struct {
27 UpdatedAt int64 `json:"updatedAt"` // 更新时间 27 UpdatedAt int64 `json:"updatedAt"` // 更新时间
28 AccountDetail []struct { 28 AccountDetail []struct {
29 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` 29 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
30 - DividendsType string `json:"dividendsType"` 30 + DividendsType int `json:"dividendsType"`
31 DividendsAmount float64 `json:"dividendsAmount"` 31 DividendsAmount float64 `json:"dividendsAmount"`
32 } `json:"accountDetail"` //结算明细 32 } `json:"accountDetail"` //结算明细
  33 + Operator struct {
  34 + UserId int `json:"userId,string,"` // 用户ID,
  35 + UserBaseId int `json:"userBaseId,string,"` // 用户基本id
  36 + UserName string `json:"userName"` // 用户姓名
  37 + UserPhone string `json:"userPhone"` // 用户手机号
  38 + UserInfo struct {
  39 + UserName string `json:"userName"` // 共创人员姓名
  40 + UserPhone string `json:"userPhone"` // 用户手机号
  41 + UserAccount string `json:"userAccount"` // 用户账号,
  42 + } `json:"userInfo"`
  43 + } `json:"operator"`
33 } 44 }
34 45
35 func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *CreditAccountItem { 46 func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *CreditAccountItem {
@@ -53,5 +64,11 @@ func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *Cred @@ -53,5 +64,11 @@ func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *Cred
53 data.Participator.UserName = param.Participator.UserName 64 data.Participator.UserName = param.Participator.UserName
54 data.Participator.UserPhone = param.Participator.UserPhone 65 data.Participator.UserPhone = param.Participator.UserPhone
55 data.Participator.UserType = param.Participator.UserType 66 data.Participator.UserType = param.Participator.UserType
  67 + data.Operator.UserId = param.Operator.UserId
  68 + data.Operator.UserBaseId = param.Operator.UserBaseId
  69 + data.Operator.UserName = param.Operator.UserName
  70 + data.Operator.UserPhone = param.Operator.UserPhone
  71 + data.Operator.UserInfo.UserName = param.Operator.UserName
  72 + data.Operator.UserInfo.UserPhone = param.Operator.UserPhone
56 return &data 73 return &data
57 } 74 }
  1 +package command
  2 +
  3 +import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  4 +
  5 +type ConfimDividendsEstimateCommand struct {
  6 + //操作人
  7 + Operator domain.Operator `json:"-"`
  8 + DividendsEstimateId []string `json:"dividendsEstimateId"`
  9 +}
@@ -55,12 +55,14 @@ func (dividendsEstimateService *DividendsEstimateService) EstimateMoneyIncentive @@ -55,12 +55,14 @@ func (dividendsEstimateService *DividendsEstimateService) EstimateMoneyIncentive
55 item := map[string]interface{}{ 55 item := map[string]interface{}{
56 "userId": result[i].DividendsUser.UserId, 56 "userId": result[i].DividendsUser.UserId,
57 "userName": result[i].DividendsUser.UserName, 57 "userName": result[i].DividendsUser.UserName,
58 - "DividendsAmount": result[i].DividendsAmount, 58 + "dividendsAmount": result[i].DividendsAmount,
59 } 59 }
60 data = append(data, item) 60 data = append(data, item)
61 } 61 }
62 -  
63 - return data, nil 62 + returnData := map[string]interface{}{
  63 + "list": data,
  64 + }
  65 + return returnData, nil
64 } 66 }
65 67
66 // 查询分红预算单列表 68 // 查询分红预算单列表
@@ -170,3 +172,15 @@ func (dividendsEmmateService *DividendsEstimateService) MoneyIncentivesSelector( @@ -170,3 +172,15 @@ func (dividendsEmmateService *DividendsEstimateService) MoneyIncentivesSelector(
170 } 172 }
171 return data, nil 173 return data, nil
172 } 174 }
  175 +
  176 +//ConfimDividendsEstimate 确定分红预算
  177 +func (dividendsEstimateService *DividendsEstimateService) ConfimDividendsEstimate(confimDividendsEstimateCommand *command.ConfimDividendsEstimateCommand) (interface{}, error) {
  178 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(confimDividendsEstimateCommand.Operator)
  179 + _, err := creationCooperationGateway.CreditAccountsAdd(allied_creation_cooperation.ReqCreditAccountsAdd{
  180 + DividendsEstimateIds: confimDividendsEstimateCommand.DividendsEstimateId,
  181 + })
  182 + if err != nil {
  183 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  184 + }
  185 + return confimDividendsEstimateCommand, nil
  186 +}
@@ -164,3 +164,34 @@ func (gateway HttplibAlliedCreationCooperation) CreditAccountGet(param ReqCredit @@ -164,3 +164,34 @@ func (gateway HttplibAlliedCreationCooperation) CreditAccountGet(param ReqCredit
164 err = gateway.GetResponseData(result, &data) 164 err = gateway.GetResponseData(result, &data)
165 return &data, err 165 return &data, err
166 } 166 }
  167 +
  168 +// CreditAccountsAdd 创建账期结算
  169 +func (gateway HttplibAlliedCreationCooperation) CreditAccountsAdd(param ReqCreditAccountsAdd) (*DataCreditAccountsAdd, error) {
  170 + url := gateway.baseUrL + "/credit-accounts"
  171 + method := "POST"
  172 + req := gateway.CreateRequest(url, method)
  173 + log.Logger.Debug("向业务模块请求数据:创建账期结算。", map[string]interface{}{
  174 + "api": method + ":" + url,
  175 + "param": param,
  176 + })
  177 + req, err := req.JSONBody(param)
  178 + if err != nil {
  179 + return nil, fmt.Errorf("请求创建账期结算失败:%w", err)
  180 + }
  181 +
  182 + byteResult, err := req.Bytes()
  183 + if err != nil {
  184 + return nil, fmt.Errorf("获取创建账期结算失败:%w", err)
  185 + }
  186 + log.Logger.Debug("获取业务模块请求数据:创建账期结算。", map[string]interface{}{
  187 + "result": string(byteResult),
  188 + })
  189 + var result service_gateway.GatewayResponse
  190 + err = json.Unmarshal(byteResult, &result)
  191 + if err != nil {
  192 + return nil, fmt.Errorf("解析创建账期结算:%w", err)
  193 + }
  194 + var data DataCreditAccountsAdd
  195 + err = gateway.GetResponseData(result, &data)
  196 + return &data, err
  197 +}
@@ -81,6 +81,7 @@ type ( @@ -81,6 +81,7 @@ type (
81 CooperationApplicationIds []string `json:"cooperationApplicationIds"` 81 CooperationApplicationIds []string `json:"cooperationApplicationIds"`
82 CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //描述 82 CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //描述
83 Action int `json:"action"` //审核动作,1同意,2拒绝 83 Action int `json:"action"` //审核动作,1同意,2拒绝
  84 + Code string `json:"code" ` //cname:"菜单编码"
84 } 85 }
85 86
86 DataCooperationApplicationBatchApproval struct { 87 DataCooperationApplicationBatchApproval struct {
@@ -18,14 +18,20 @@ type CreditAccount struct { @@ -18,14 +18,20 @@ type CreditAccount struct {
18 Participator struct { 18 Participator struct {
19 UserId int `json:"userId,string,"` // 用户ID, 19 UserId int `json:"userId,string,"` // 用户ID,
20 UserBaseId int `json:"userBaseId,string,"` // 用户基本id 20 UserBaseId int `json:"userBaseId,string,"` // 用户基本id
21 - // Org domain.Org `json:"org"` // 用户所属的组织机构  
22 - // Department domain.Department `json:"department"` // 用户所属的部门  
23 UserInfo domain.UserInfo `json:"userInfo"` // 21 UserInfo domain.UserInfo `json:"userInfo"` //
24 UserName string `json:"userName"` // 用户姓名 22 UserName string `json:"userName"` // 用户姓名
25 UserPhone string `json:"userPhone"` // 用户手机号 23 UserPhone string `json:"userPhone"` // 用户手机号
26 UserType int `json:"userType"` // 用户类型,1员工,2共创用户,3公开 24 UserType int `json:"userType"` // 用户类型,1员工,2共创用户,3公开
27 Status int `json:"status"` // 状态 25 Status int `json:"status"` // 状态
28 } `json:"participator"` // 参与人 26 } `json:"participator"` // 参与人
  27 + // 操作人
  28 + Operator struct {
  29 + UserId int `json:"userId,string,"` // 用户ID,
  30 + UserBaseId int `json:"userBaseId,string,"` // 用户基本id
  31 + UserName string `json:"userName"` // 用户姓名
  32 + UserPhone string `json:"userPhone"` // 用户手机号
  33 + UserInfo domain.UserInfo `json:"userInfo"` //
  34 + } `json:"operator"`
29 ParticipateType string `json:"participateType"` // 参与类型 35 ParticipateType string `json:"participateType"` // 参与类型
30 PaymentDocumentAttachment domain.Attachment `json:"paymentDocumentAttachment"` // 支付凭证附件 36 PaymentDocumentAttachment domain.Attachment `json:"paymentDocumentAttachment"` // 支付凭证附件
31 Org domain.Org `json:"org"` // 数据所属组织机构 37 Org domain.Org `json:"org"` // 数据所属组织机构
@@ -34,7 +40,7 @@ type CreditAccount struct { @@ -34,7 +40,7 @@ type CreditAccount struct {
34 UpdatedAt time.Time `json:"updatedAt"` // 更新时间 40 UpdatedAt time.Time `json:"updatedAt"` // 更新时间
35 AccountDetail []struct { 41 AccountDetail []struct {
36 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` 42 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
37 - DividendsType string `json:"dividendsType"` 43 + DividendsType int `json:"dividendsType"`
38 DividendsAmount float64 `json:"dividendsAmount"` 44 DividendsAmount float64 `json:"dividendsAmount"`
39 } `json:"accountDetail"` //结算明细 45 } `json:"accountDetail"` //结算明细
40 } 46 }
@@ -106,3 +112,13 @@ type ( @@ -106,3 +112,13 @@ type (
106 CreditAccount 112 CreditAccount
107 } 113 }
108 ) 114 )
  115 +
  116 +//创建账期结算
  117 +type (
  118 + ReqCreditAccountsAdd struct {
  119 + DividendsEstimateIds []string `json:"dividendsEstimateIdss"`
  120 + }
  121 +
  122 + DataCreditAccountsAdd []struct {
  123 + }
  124 +)
@@ -101,3 +101,16 @@ func (controller *DividendsEstimateController) MoneyIncentivesSelector() { @@ -101,3 +101,16 @@ func (controller *DividendsEstimateController) MoneyIncentivesSelector() {
101 data, err := dividendsEstimateService.MoneyIncentivesSelector(moneyIncentivesSelectorQuery) 101 data, err := dividendsEstimateService.MoneyIncentivesSelector(moneyIncentivesSelectorQuery)
102 controller.Response(data, err) 102 controller.Response(data, err)
103 } 103 }
  104 +
  105 +//ConfimDividendsEstimate 确定分红预算
  106 +func (controller *DividendsEstimateController) ConfimDividendsEstimate() {
  107 + dividendsEstimateService := service.NewDividendsEstimateService(nil)
  108 + confimDividendsEstimateCommand := &command.ConfimDividendsEstimateCommand{}
  109 + err := controller.Unmarshal(confimDividendsEstimateCommand)
  110 + if err != nil {
  111 + log.Logger.Debug("json err:" + err.Error())
  112 + }
  113 + confimDividendsEstimateCommand.Operator = controller.GetOperator()
  114 + data, err := dividendsEstimateService.ConfimDividendsEstimate(confimDividendsEstimateCommand)
  115 + controller.Response(data, err)
  116 +}
@@ -13,4 +13,6 @@ func init() { @@ -13,4 +13,6 @@ func init() {
13 web.Router("/v1/web/dividends-estimate/money-incentives/estimate", &web_client.DividendsEstimateController{}, "Post:EstimateMoneyIncentives") 13 web.Router("/v1/web/dividends-estimate/money-incentives/estimate", &web_client.DividendsEstimateController{}, "Post:EstimateMoneyIncentives")
14 web.Router("/v1/web/dividends-estimate/dividends-incentives/estimate", &web_client.DividendsEstimateController{}, "Post:EstimateDividendsIncentives") 14 web.Router("/v1/web/dividends-estimate/dividends-incentives/estimate", &web_client.DividendsEstimateController{}, "Post:EstimateDividendsIncentives")
15 web.Router("/v1/web/dividends-estimate/money-incentives/selector", &web_client.DividendsEstimateController{}, "Post:MoneyIncentivesSelector") 15 web.Router("/v1/web/dividends-estimate/money-incentives/selector", &web_client.DividendsEstimateController{}, "Post:MoneyIncentivesSelector")
  16 + web.Router("/v1/web/dividends-estimate/confim", &web_client.DividendsEstimateController{}, "Post:ConfimDividendsEstimate")
  17 +
16 } 18 }