作者 yangfu
... ... @@ -180,3 +180,36 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon
return &data
}
type CooperationContractUndertake struct {
Undertaker struct {
UsersName string `json:"userName"`
Phone string `json:"phone"`
UserId int `json:"userId,string,"`
UserCode string `json:"userCode"`
} `json:"undertaker"`
CooperationContractDescription string `json:"cooperationContractDescription"`
CooperationContractId int `json:"cooperationContractId,string,"`
CooperationContractName string `json:"cooperationContractName"`
CooperationContractNumber string `json:"cooperationContractNumber"`
CooperationContractSponsor struct {
UsersName string `json:"userName"`
Phone string `json:"phone"`
UserId int `json:"userId,string,"`
UserCode string `json:"userCode"`
} `json:"cooperationContractSponsor"`
CooperationMode struct {
CooperationModeId int `json:"cooperationModeId,string"`
CooperationModeName string `json:"cooperationModeName"`
CooperationModeNumber string `json:"cooperationModeNumber"`
} `json:"cooperationMode"`
Org struct {
OrgName string `json:"orgName"`
} `json:"org"`
Attachment []domain.Attachment `json:"attachment"`
}
func ToCooperationContractUndertake(allied_creation_cooperation.DataCooperationContractSearchByUndertaker) *CooperationContractUndertake {
data := CooperationContractUndertake{}
return &data
}
... ...
... ... @@ -201,14 +201,16 @@ func NewCooperationContractService(options map[string]interface{}) *CooperationC
return newCooperationContractService
}
func (cooperationContractService *CooperationContractService) SearchCooperationContractsByUndertake(queryParam query.SearchCooperationContractsByUndertake) (interface{}, error) {
func (cooperationContractService *CooperationContractService) SearchCooperationContractsByUndertake(queryParam *query.SearchCooperationContractsByUndertake) (
int, interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(queryParam.Operator)
result, err := creationCooperationGateway.CooperationContractsSearchByUndertaker(
_, err := creationCooperationGateway.CooperationContractsSearchByUndertaker(
allied_creation_cooperation.ReqCooperationContractSearchByUndertaker{
CooperationContractName: queryParam.CooperationContractName,
SponsorName: queryParam.ContractSponsor,
PageNumber: queryParam.PageNumber,
PageIndex: queryParam.PageSize,
})
return result, err
data := []dto.CooperationContractUndertake{{}}
return 10, data, err
}
... ...
... ... @@ -2,6 +2,7 @@ package command
import (
"fmt"
"strconv"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
... ... @@ -14,7 +15,7 @@ type CreateDividendsOrderCommand struct {
CustomerName string `json:"customerName" valid:"Required"`
//分红订单原单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum" valid:"Required"`
//订单产生时间 时间戳 秒
//订单产生时间 时间戳
OrderTime int64 `json:"orderTime" valid:"Required"`
//备注
Remarks string `json:"remarks" valid:"Required"`
... ... @@ -35,7 +36,12 @@ type CreateDividendsOrderCommand struct {
}
func (createDividendsOrderCommand *CreateDividendsOrderCommand) Valid(validation *validation.Validation) {
// 162 92522 89000
orderTimeStr := strconv.Itoa(int(createDividendsOrderCommand.OrderTime))
orderTimeStrRune := []rune(orderTimeStr)
if len(orderTimeStrRune) != 13 {
validation.AddError("订单产生时间", "格式错误")
}
}
func (createDividendsOrderCommand *CreateDividendsOrderCommand) ValidateCommand() error {
... ...
... ... @@ -2,6 +2,7 @@ package command
import (
"fmt"
"strconv"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
... ... @@ -18,7 +19,7 @@ type UpdateDividendsOrderCommand struct {
DividendsOrderAmount float64 `json:"dividendsOrderAmount" valid:"Required"`
//分红订单原单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum" valid:"Required"`
//订单产生时间
//订单产生时间 时间戳 毫秒
OrderTime int64 `json:"orderTime" valid:"Required"`
//备注
Remarks string `json:"remarks" valid:"Required"`
... ... @@ -37,7 +38,12 @@ type UpdateDividendsOrderCommand struct {
}
func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) Valid(validation *validation.Validation) {
// 162 92522 89000
orderTimeStr := strconv.Itoa(int(updateDividendsOrderCommand.OrderTime))
orderTimeStrRune := []rune(orderTimeStr)
if len(orderTimeStrRune) != 13 {
validation.AddError("订单产生时间", "格式错误")
}
}
func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) ValidateCommand() error {
... ...
... ... @@ -14,10 +14,10 @@ type DividendsOrder struct {
DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红
DividendTime int64 `json:"dividendTime"` //分红订单分红时间
DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
DividendsOrderID int `json:"dividendsOrderId,string"` //分红订单
DividendsOrderID int `json:"dividendsOrderId,string,"` //分红订单
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
OrderTime int64 `json:"orderTime"`
OrderTime int64 `json:"orderTime"` //订单日日期 13位毫秒输出
Org struct {
OrgID int `json:"orgId,string"`
OrgName string `json:"orgName"`
... ... @@ -25,7 +25,9 @@ type DividendsOrder struct {
Region struct {
RegionName string `json:"regionName"`
RegionNumber string `json:"regionNumber"`
}
} `json:"region"`
Remarks string `json:"remarks"`
Goods []allied_creation_cooperation.DividendsOrderGoods
}
func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *DividendsOrder {
... ... @@ -38,9 +40,11 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide
DividendsOrderID: param.DividendsOrderID,
DividendsOrderNumber: param.DividendsOrderNumber,
DividendsOriginalOrderNum: param.DividendsOriginalOrderNum,
OrderTime: param.OrderTime.Unix(),
OrderTime: param.OrderTime.UnixNano() / 1e6, //转为毫米输出
Org: param.Org,
Region: param.Region,
Remarks: param.Remarks,
Goods: param.Goods,
}
return &data
}
... ...
... ... @@ -39,7 +39,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
CustomerName: createDividendsOrderCommand.CustomerName,
DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum,
OperatorUid: int(createDividendsOrderCommand.Operator.UserId),
OrderTime: strconv.Itoa(int(createDividendsOrderCommand.OrderTime * 1000)),
OrderTime: strconv.Itoa(int(createDividendsOrderCommand.OrderTime)),
Remarks: createDividendsOrderCommand.Remarks,
RegionName: createDividendsOrderCommand.RegionName,
OrderGoods: orderGoods,
... ... @@ -131,7 +131,7 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD
DividendsOrderAmount: updateDividendsOrderCommand.DividendsOrderAmount,
DividendsOriginalOrderNum: updateDividendsOrderCommand.DividendsOriginalOrderNum,
OperatorUid: int(updateDividendsOrderCommand.Operator.UserId),
OrderTime: strconv.Itoa(int(updateDividendsOrderCommand.OrderTime * 1000)),
OrderTime: strconv.Itoa(int(updateDividendsOrderCommand.OrderTime)),
Remarks: updateDividendsOrderCommand.Remarks,
RegionName: updateDividendsOrderCommand.RegionName,
OrderGoods: orderGoods,
... ...
... ... @@ -7,14 +7,14 @@ import (
type DividendsReturnedOrderInfo struct {
// 公司
Company struct {
CompanyID int `json:"companyId"`
CompanyID int `json:"companyId,string"`
CompanyLogo string `json:"companyLogo"`
CompanyName string `json:"companyName"`
} `json:"company"`
CreatedAt int64 `json:"createdAt"`
DividendStatus int `json:"dividendStatus"` // 分红订单分红状态,1待分红,2已分红,3部分分红
DividendTime int64 `json:"dividendTime"` //分红订单分红时间
DividendsOrderNumber int `json:"dividendsOrderNumber"` //关联分红订单号
DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户姓名
DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期
DividendsReturnedOrderID string `json:"dividendsReturnedOrderId"` //分红退货单记录id
... ... @@ -24,8 +24,8 @@ type DividendsReturnedOrderInfo struct {
Remarks string `json:"remarks"` //备注
//更新时间
Org struct {
OrgID int `json:"orgId"` //
OrgName string `json:"orgName"` //
OrgID int `json:"orgId,string"` //
OrgName string `json:"orgName"` //
} `json:"org"` //归属组织机构
Region struct {
... ...
... ... @@ -79,11 +79,11 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
dataList := []dto.DividendsReturnedOrderInfo{}
for i := range result.List {
item := dto.ToDividendsReturnedOrderInfo(&result.List[i])
for i := range result.Grid.List {
item := dto.ToDividendsReturnedOrderInfo(&result.Grid.List[i])
dataList = append(dataList, *item)
}
return result.Total, dataList, nil
return result.Grid.Total, dataList, nil
}
// 更新分红退货单服务
... ... @@ -127,7 +127,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SelectorDivi
"dividendsOrderNumber": v.DividendsOrderNumber,
"dividendsOriginalOrderNum": v.DividendsOriginalOrderNum,
"dividendsOrderId": strconv.Itoa(v.DividendsOrderID),
"dividendTime": v.DividendTime.Unix(),
"orderTime": v.OrderTime.Unix(),
}
listData = append(listData, m)
}
... ...
... ... @@ -168,7 +168,7 @@ func (gateway HttplibAlliedCreationCooperation) DividendsReturnedOrderList(param
// DividendsReturnedOrderGet 返回分红退货单详情
func (gateway HttplibAlliedCreationCooperation) DividendsReturnedOrderGet(param ReqDividendsReturnedOrderGet) (*DataDividendsReturnedOrderGet, error) {
url := gateway.baseUrL + "/dividends-returned-orders" + strconv.Itoa(param.DividendsReturnedOrderId)
url := gateway.baseUrL + "/dividends-returned-orders/" + strconv.Itoa(param.DividendsReturnedOrderId)
method := "GET"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:返回分红退货单详情。", map[string]interface{}{
... ...
... ... @@ -48,6 +48,8 @@ type DividendsOrder struct {
RegionName string `json:"regionName"`
RegionNumber string `json:"regionNumber"`
} `json:"region"`
Remarks string `json:"remarks"`
Goods []DividendsOrderGoods `json:"goods"`
}
type (
... ... @@ -61,7 +63,7 @@ type (
OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量
OrderGoodQuantity int `json:"orderGoodQuantity,string"` //订单产品数量
OrderGoodDividendsStatus int32 `json:"OrderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红
}
ReqDividendsOrderAdd struct {
... ...
... ... @@ -10,21 +10,20 @@ type (
OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量
OrderGoodQuantity int `json:"orderGoodQuantity,string"` //订单产品数量
}
DividendsReturnedOrder struct {
// 公司
Company struct {
CompanyID int `json:"companyId"`
CompanyID int `json:"companyId,string"`
CompanyLogo string `json:"companyLogo"`
CompanyName string `json:"companyName"`
} `json:"company"`
CreatedAt time.Time `json:"createdAt"`
DividendStatus int `json:"dividendStatus"` // 分红订单分红状态,1待分红,2已分红,3部分分红
DividendTime time.Time `json:"dividendTime"` //分红订单分红时间
DividendsOrderNumber int `json:"dividendsOrderNumber"` //关联分红订单号
DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户姓名
DividendsReturnedDate time.Time `json:"dividendsReturnedDate"` //退货日期
DividendsReturnedOrderID string `json:"dividendsReturnedOrderId"` //分红退货单记录id
... ... @@ -36,8 +35,8 @@ type (
UpdatedAt string `json:"updatedAt"`
//更新时间
Org struct {
OrgID int `json:"orgId"` //
OrgName string `json:"orgName"` //
OrgID int `json:"orgId,string"` //
OrgName string `json:"orgName"` //
} `json:"org"` //归属组织机构
Region struct {
... ... @@ -72,7 +71,7 @@ type (
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号
OriginalOrderNum string `json:"originalOrderNum"`
OrderGoods []DividendsReturnedOrderGoods `json:"orderGoods"`
DividendsReturnedDate time.Time `json:"orderTime"`
DividendsReturnedDate time.Time `json:"dividendsReturnedDate"`
OrderData time.Time `json:"orderData"`
OrgId int `json:"orgId"`
Remarks string `json:"remarks"`
... ... @@ -97,8 +96,10 @@ type (
}
DataDividendsReturnedOrderSearch struct {
Total int `json:"total"`
List []DividendsReturnedOrder `json:"list"`
Grid struct {
Total int `json:"total"`
List []DividendsReturnedOrder `json:"list"`
} `json:"grid"`
}
)
... ...
... ... @@ -69,3 +69,15 @@ func (controller *CooperationContractController) EnableCooperationContract() {
data, err := cooperationContractService.EnableCooperationContract(enableCooperationContractCommand)
controller.Response(data, err)
}
func (controller *CooperationContractController) SearchCooperationContractsByUndertake() {
cooperationContractService := service.NewCooperationContractService(nil)
listCooperationContractQuery := &query.SearchCooperationContractsByUndertake{}
err := controller.Unmarshal(listCooperationContractQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
listCooperationContractQuery.Operator = controller.GetOperator()
cnt, data, err := cooperationContractService.SearchCooperationContractsByUndertake(listCooperationContractQuery)
controller.ReturnPageListData(int64(cnt), data, err, listCooperationContractQuery.PageNumber)
}
... ...
... ... @@ -11,4 +11,5 @@ func init() {
web.Router("/v1/web/cooperation-contracts/:contractId", &web_client.CooperationContractController{}, "Get:GetCooperationContract")
web.Router("/v1/web/cooperation-contracts/search", &web_client.CooperationContractController{}, "Post:ListCooperationContract")
web.Router("/v1/web/cooperation-contracts/enable", &web_client.CooperationContractController{}, "Put:EnableCooperationContract")
web.Router("/v1/web/cooperation-contracts/undertaker", &web_client.CooperationContractController{}, "Post:SearchCooperationContractsByUndertake")
}
... ...