作者 yangfu
{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628060696735619100}
\ No newline at end of file
{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628574006679578700}
\ No newline at end of file
... ...
... ... @@ -451,7 +451,7 @@ func (srv AuthService) CompanySignUp(companySignUpCommand *command.CompanySignUp
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
result, err := creationUserGateway.AuthCompanySignUp(allied_creation_user.ReqAuthCompanySignUp{
_, err := creationUserGateway.AuthCompanySignUp(allied_creation_user.ReqAuthCompanySignUp{
CompanyName: companySignUpCommand.CompanyName,
Phone: companySignUpCommand.Phone,
Password: companySignUpCommand.Password,
... ... @@ -462,7 +462,7 @@ func (srv AuthService) CompanySignUp(companySignUpCommand *command.CompanySignUp
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return result, err
return companySignUpCommand, err
}
// ResetPassword 重置密码(找回密码)
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type AuditAllCooperationApplicationCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 审核动作,1同意,2拒绝
CooperationApplicationStatus int `json:"cooperationApplicationStatus" valid:"Required"`
// 共创申请审核描述
CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription" valid:"Required"`
}
func (listCooperationApplicationQuery *AuditAllCooperationApplicationCommand) Valid(validation *validation.Validation) {
}
func (listCooperationApplicationQuery *AuditAllCooperationApplicationCommand) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(listCooperationApplicationQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
... ... @@ -5,47 +5,19 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
//合约模式
type CooperationMode struct {
CooperationModeId int `json:"cooperationModeId,string"`
CooperationModeName string `json:"cooperationModeName"`
CooperationModeNumber string `json:"cooperationModeNumber"`
}
//部门
type Department struct {
DepartmentNumber string `json:"departmentNumber"`
DepartmentId int `json:"departmentId,string,"`
DepartmentName string `json:"departmentName"`
}
//用户
type UserInfo struct {
UsersName string `json:"usersName"`
Phone string `json:"phone"`
UsersId int `json:"userId,string"`
}
//公司
type CompanyData struct {
CompanyID int `json:"companyId"`
CompanyLogo string `json:"companyLogo"`
CompanyName string `json:"companyName"`
}
//CooperationProjectItem 返回共创项目列表项
type CooperationProjectItem struct {
CooperationMode CooperationMode `json:"cooperationMode"` //项目模式
CooperationMode domain.CooperationMode `json:"cooperationMode"` //项目模式
CooperationProjectID int `json:"cooperationProjectId,string,"` //id
CooperationProjectName string `json:"cooperationProjectName"` //共创项目名称
CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号
CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"` //承接对象
Department Department `json:"department"` //项目发起部门
Department domain.Department `json:"department"` //项目发起部门
Status int `json:"status"` //项目状态
CooperationProjectPublishTime int `json:"cooperationProjectPublishTime"`
CooperationProjectSponsor struct {
UsersId int `json:"usersId"`
UserInfo UserInfo `json:"UserInfo"`
UserInfo domain.UserInfo `json:"UserInfo"`
} `json:"cooperationProjectSponsor"` //共创发起人
}
... ... @@ -69,18 +41,18 @@ func ToCooperationProjectItem(projecetParam *allied_creation_cooperation.Coopera
//CooperationProjectInfo 返回共创项目详情
type CooperationProjectInfo struct {
CooperationMode CooperationMode `json:"cooperationMode"` //共创模式
CooperationMode domain.CooperationMode `json:"cooperationMode"` //共创模式
CooperationProjectID int `json:"cooperationProjectId,string,"` //id
CooperationProjectName string `json:"cooperationProjectName"` //共创项目名称
CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号
CooperationProjectPublishTime int `json:"cooperationProjectPublishTime"` //共创项目发布时间
CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"` //承接对象
CooperationProjectDescription string `json:"cooperationProjectDescription"` //共创描述
Department Department `json:"department"` //项目发起部门
Department domain.Department `json:"department"` //项目发起部门
Status int `json:"status"` //项目状态
CooperationProjectSponsor struct {
UsersId int `json:"usersId"`
UserInfo UserInfo `json:"UserInfo"`
UserInfo domain.UserInfo `json:"UserInfo"`
} `json:"cooperationProjectSponsor"` //共创发起人
Attachment []domain.Attachment `json:"attachment"` //图片附件
}
... ... @@ -106,11 +78,11 @@ func ToCooperationProjectInfo(projecetParam *allied_creation_cooperation.Coopera
}
type CooperationApplication struct {
Company CompanyData `json:"company"`
Company domain.CompanyData `json:"company"`
CooperationApplicationApplicant struct {
UserId int `json:"userId"`
UserInfo UserInfo `json:"userInfo"`
Department Department `json:"department"` //申请人部门
UserInfo domain.UserInfo `json:"userInfo"`
Department domain.Department `json:"department"` //申请人部门
} `json:"cooperationApplicationApplicant"` //申请人
CooperationApplicationAttachment []domain.Attachment `json:"cooperationApplicationAttachment"` //附件信息
CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //申请描述
... ...
... ... @@ -40,7 +40,7 @@ func (srv CompanyStatisticsService) DividendsStatistics(userMenusCommand *comman
}, nil
}
// IndexStatistics TODO:企业的合约明细列表(分红预算信息)
// IndexStatistics 企业的合约明细列表(分红预算信息)
func (srv CompanyStatisticsService) SearchDividendsEstimates(userMenusCommand *command.SearchDividendsEstimatesCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
userMenusCommand.Operator)
... ...
... ... @@ -156,3 +156,18 @@ func (srv CooperationApplicationsService) PersonSearchCooperationApplications(ap
// }
return resultApplications, nil
}
// CooperationApplicationsOneclickApproval 企业一键审核申请
func (srv CooperationApplicationsService) CooperationApplicationsOneclickApproval(auditCommand *command.AuditAllCooperationApplicationCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
auditCommand.Operator)
_, err := creationCooperationGateway.CooperationApplicationsOneclickApproval(
allied_creation_cooperation.ReqCooperationApplicationOneclickApproval{
CooperationApplicationDescription: auditCommand.CooperationApplicationVerifyDescription,
Action: auditCommand.CooperationApplicationStatus,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return auditCommand, nil
}
... ...
... ... @@ -139,7 +139,7 @@ func (cooperationModeService *CooperationModeService) EnableCooperationMode(upda
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return nil, nil
return updateCooperationModeCommand, nil
}
func NewCooperationModeService(options map[string]interface{}) *CooperationModeService {
... ...
... ... @@ -75,29 +75,12 @@ func ToCooperationProjectInfo(param *allied_creation_cooperation.CooperationProj
type CooperationApplicationItem struct {
CooperationApplicationApplicant struct {
Company struct {
CompanyID int `json:"companyId"`
CompanyLogo string `json:"companyLogo"`
CompanyName string `json:"companyName"`
} `json:"company"`
Department struct {
DepartmentID int `json:"departmentId"`
DepartmentName string `json:"departmentName"`
DepartmentNumber string `json:"departmentNumber"`
} `json:"department"`
Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
} `json:"org"`
Company domain.CompanyData `json:"company"`
Department domain.Department `json:"department"`
Org domain.Org `json:"org"`
UserBaseID int `json:"userBaseId"`
UserID int `json:"userId"`
UserInfo struct {
UserAccount string `json:"userAccount"`
UserAvatar string `json:"userAvatar"`
UserEmail string `json:"userEmail"`
UserName string `json:"userName"`
UserPhone string `json:"userPhone"`
} `json:"userInfo"`
UserInfo domain.UserInfo `json:"userInfo"`
UserType int `json:"userType"`
} `json:"cooperationApplicationApplicant"` //申请人
CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //描述
... ... @@ -109,12 +92,24 @@ type CooperationApplicationItem struct {
func ToCooperationApplicationItem(param *allied_creation_cooperation.CooperationApplication) *CooperationApplicationItem {
data := CooperationApplicationItem{
CooperationApplicationApplicant: param.CooperationApplicationApplicant,
CooperationApplicationDescription: param.CooperationApplicationDescription,
CooperationApplicationID: param.CooperationApplicationID,
CooperationApplicationStatus: param.CooperationApplicationStatus,
CooperationApplyTime: int(param.CooperationApplyTime.Unix()),
CooperationApplicationAttachment: param.CooperationApplicationAttachment,
}
data.CooperationApplicationApplicant.Company.CompanyID = param.CooperationApplicationApplicant.Company.CompanyID
// data.CooperationApplicationApplicant.Company.CompanyLogo = param.CooperationApplicationApplicant.Company.CompanyLogo
data.CooperationApplicationApplicant.Company.CompanyName = param.CooperationApplicationApplicant.Company.CompanyName
data.CooperationApplicationApplicant.Department.DepartmentId = param.CooperationApplicationApplicant.Department.DepartmentID
data.CooperationApplicationApplicant.Department.DepartmentName = param.CooperationApplicationApplicant.Department.DepartmentName
data.CooperationApplicationApplicant.Department.DepartmentNumber = param.CooperationApplicationApplicant.Department.DepartmentNumber
data.CooperationApplicationApplicant.Org.OrgID = param.CooperationApplicationApplicant.Org.OrgID
data.CooperationApplicationApplicant.Org.OrgName = param.CooperationApplicationApplicant.Org.OrgName
data.CooperationApplicationApplicant.UserID = param.CooperationApplicationApplicant.UserID
data.CooperationApplicationApplicant.UserType = param.CooperationApplicationApplicant.UserType
data.CooperationApplicationApplicant.UserInfo.Phone = param.CooperationApplicationApplicant.UserInfo.UserPhone
data.CooperationApplicationApplicant.UserInfo.UsersName = param.CooperationApplicationApplicant.UserInfo.UserName
data.CooperationApplicationApplicant.UserInfo.UsersId = param.CooperationApplicationApplicant.UserID
return &data
}
... ...
... ... @@ -12,18 +12,12 @@ type CreateDividendsOrderCommand struct {
Operator domain.Operator `json:"-"`
//客户名称
CustomerName string `json:"customerName" valid:"Required"`
//分红订单金额
DividendsOrderAmount float64 `json:"dividendsOrderAmount" valid:"Required"`
//分红订单号
DividendsOrderNumber string `json:"dividendsOrderNumber" valid:"Required"`
//分红订单原单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum" valid:"Required"`
//订单产生时间 时间戳 秒
OrderTime int64 `json:"orderTime" valid:"Required"`
//备注
Remarks string `json:"remarks" valid:"Required"`
//订单业务员uid
SalesmanUid string `json:"salesmanUid"`
//订单操作人uid
OperatorUid string `json:"operatorUid"`
//区域名称
... ...
package service
import (
"strconv"
"time"
"github.com/linmadan/egglib-go/core/application"
... ... @@ -37,13 +36,10 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
result, err := creationCooperationGateway.DividendsOrderAdd(allied_creation_cooperation.ReqDividendsOrderAdd{
CompanyId: int(createDividendsOrderCommand.Operator.CompanyId),
CustomerName: createDividendsOrderCommand.CustomerName,
DividendsOrderAmount: createDividendsOrderCommand.DividendsOrderAmount,
DividendsOrderNumber: createDividendsOrderCommand.DividendsOrderNumber,
DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum,
OperatorUid: int(createDividendsOrderCommand.Operator.UserId),
OrderTime: t,
Remarks: createDividendsOrderCommand.Remarks,
SalesmanUid: createDividendsOrderCommand.SalesmanUid,
RegionName: createDividendsOrderCommand.RegionName,
OrderGoods: orderGoods,
})
... ... @@ -80,16 +76,15 @@ func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeD
if err := removeDividendsOrderCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
dividendsOrderId := []int{}
for _, v := range removeDividendsOrderCommand.DividendsOrderId {
id, _ := strconv.Atoi(v)
dividendsOrderId = append(dividendsOrderId, id)
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeDividendsOrderCommand.Operator)
creationCooperationGateway.DividendsOrderRemove(allied_creation_cooperation.ReqDividendsOrderRemove{
DividendsOrderId: 0, ///TODO 改换为批量删除
_, err := creationCooperationGateway.DividendsOrderBatchRemove(allied_creation_cooperation.ReqDividendsOrderBatchRemove{
DividendsOrderIds: removeDividendsOrderCommand.DividendsOrderId,
})
return nil, nil
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return removeDividendsOrderCommand, nil
}
// 查询分红订单方法
... ...
... ... @@ -9,7 +9,7 @@ const SERVICE_NAME = "allied-creation-gateway"
var LOG_LEVEL = "debug"
var HTTP_PORT int = 8081
var HTTP_PORT int = 8083
//天联共创基础模块
var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080"
... ...
package domain
//公司
type CompanyData struct {
CompanyID int `json:"companyId"`
CompanyLogo string `json:"companyLogo"`
CompanyName string `json:"companyName"`
}
... ...
package domain
//合约模式
type CooperationMode struct {
CooperationModeId int `json:"cooperationModeId,string"`
CooperationModeName string `json:"cooperationModeName"`
CooperationModeNumber string `json:"cooperationModeNumber"`
}
... ...
package domain
//部门
type Department struct {
DepartmentNumber string `json:"departmentNumber"`
DepartmentId int `json:"departmentId,string,"`
DepartmentName string `json:"departmentName"`
}
... ...
package domain
//组织
type Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
}
... ...
package domain
//用户
type UserInfo struct {
UsersName string `json:"usersName"`
Phone string `json:"phone"`
UsersId int `json:"userId,string"`
UserCode string `json:"userCode"`
}
... ...
... ... @@ -226,3 +226,34 @@ func (gateway HttplibAlliedCreationCooperation) DividendsOrderGet(param ReqDivid
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsOrderBatchRemove 批量移除分红订单
func (gateway HttplibAlliedCreationCooperation) DividendsOrderBatchRemove(param ReqDividendsOrderBatchRemove) (*DataDividendsOrderBatchRemove, error) {
url := gateway.baseUrL + "/dividends-orders/batch-remove"
method := "DELETE"
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 DataDividendsOrderBatchRemove
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
... ... @@ -64,14 +64,11 @@ type (
ReqDividendsOrderAdd struct {
CompanyId int `json:"companyId"`
CustomerName string `json:"customerName"` //客户名称
DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
OperatorUid int `json:"operatorUid"` //订单操作人id
OrderGoods []DividendsOrderGoods `json:"orderGoods"` //订单产品列表
OrderTime time.Time `json:"orderTime"` //订单产生时间
Remarks string `json:"remarks"` //备注
SalesmanUid string `json:"salesmanUid"` //订单业务员uid
UserId int `json:"userId"` //
RegionName string `json:"regionName"` //区域名称
}
... ... @@ -162,3 +159,13 @@ type (
DividendsOrder
}
)
//移除分红订单
type (
ReqDividendsOrderBatchRemove struct {
DividendsOrderIds []string `json:"dividendsOrderIds"`
}
DataDividendsOrderBatchRemove struct {
}
)
... ...
... ... @@ -11,6 +11,7 @@ type CooperationController struct {
}
/***** CooperationApplicationsService 共创申请服务 *****/
//SearchFeedback 承接人反馈
func (controller *CooperationController) SearchFeedback() {
svr := service.UndertakerFeedbackService{}
cmd := &command.SearchFeedbackCommand{}
... ... @@ -24,6 +25,7 @@ func (controller *CooperationController) SearchFeedback() {
controller.Response(data, err)
}
// SearchFeedback 创建承接人反馈
func (controller *CooperationController) CreateFeedback() {
svr := service.UndertakerFeedbackService{}
cmd := &command.CreateFeedbackCommand{}
... ... @@ -64,6 +66,20 @@ func (controller *CooperationController) AuditCooperationApplication() {
controller.Response(data, err)
}
//AuditAllCooperationApplication 公司一键审核申请
func (controller *CooperationController) AuditAllCooperationApplication() {
svr := service.CooperationApplicationsService{}
cmd := &command.AuditAllCooperationApplicationCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.CooperationApplicationsOneclickApproval(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) SearchCooperationApplication() {
svr := service.CooperationApplicationsService{}
cmd := &command.ListCooperationApplicationQuery{}
... ...
... ... @@ -13,6 +13,7 @@ func init() {
/***** 共创申请服务 企业端 *****/
web.Router("/v1/app/cooperation-applications/:applicationId", &mobile_client.CooperationController{}, "Get:GetCooperationApplication")
web.Router("/v1/app/cooperation-applications/audit", &mobile_client.CooperationController{}, "Put:AuditCooperationApplication")
web.Router("/v1/app/cooperation-applications/oneclick-approval", &mobile_client.CooperationController{}, "Post:AuditAllCooperationApplication")
web.Router("/v1/app/cooperation-applications/search", &mobile_client.CooperationController{}, "Post:SearchCooperationApplication")
/***** 共创申请服务 共创用户端 *****/
... ...