作者 yangfu
... ... @@ -180,7 +180,7 @@ func (srv CooperationApplicationsService) CooperationApplicationsOneclickApprova
auditCommand.Operator)
_, err := creationCooperationGateway.CooperationApplicationsOneclickApproval(
allied_creation_cooperation.ReqCooperationApplicationOneclickApproval{
CooperationApplicationDescription: auditCommand.CooperationApplicationVerifyDescription,
CooperationApplicationVerifyDescription: auditCommand.CooperationApplicationVerifyDescription,
Action: auditCommand.CooperationApplicationStatus,
Code: "a1-2",
})
... ...
package dto
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
type ContractChangeLogItem struct {
CooperationContractNumber string `json:"cooperationContractNumber"`
CreatedAt string `json:"createdAt"`
IncentivesRule string `json:"incentivesRule"`
IncentivesRuleDetail string `json:"incentivesRuleDetail"`
Operation string `json:"operation"`
OperationType int `json:"operationType"`
Undertakers string `json:"undertakers"`
UpdatedAt string `json:"updatedAt"`
}
func ToContractChangeLogList(param *allied_creation_cooperation.DataContractChangeLogsSearch) []ContractChangeLogItem {
listData := []ContractChangeLogItem{}
for _, v := range param.Grid.List {
item := ContractChangeLogItem{
CooperationContractNumber: v.CooperationContractNumber,
CreatedAt: v.CreatedAt.Format("2006-01-02 15:04:05"),
IncentivesRule: v.IncentivesRule,
IncentivesRuleDetail: v.IncentivesRuleDetail,
Operation: v.Operator.UserName,
OperationType: int(v.OperationType),
Undertakers: v.Undertakers,
UpdatedAt: v.UpdatedAt.Format("2006-01-02 15:04:05"),
}
listData = append(listData, item)
}
return listData
}
... ...
package service
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/contractChangeLog/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/contractChangeLog/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
... ... @@ -12,7 +13,7 @@ func NewContractChangeLogService(options map[string]interface{}) *ContractChange
return newContractChangeLogService
}
func (srv ContractChangeLogService) ContractChangeLogSearch(queryParam *query.ListContractChangeLogQuery) (interface{}, error) {
func (srv ContractChangeLogService) ContractChangeLogSearch(queryParam *query.ListContractChangeLogQuery) (int, interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(queryParam.Operator)
result, err := creationCooperationGateway.CooperationContractChangeLogsSearch(allied_creation_cooperation.ReqContractChangeLogsSearch{
PageNumber: queryParam.PageNumber,
... ... @@ -20,5 +21,6 @@ func (srv ContractChangeLogService) ContractChangeLogSearch(queryParam *query.Li
CooperationContractNumber: queryParam.CooperationContractNumber,
OperationType: queryParam.OperationType,
})
return result, err
listData := dto.ToContractChangeLogList(result)
return result.Grid.Total, listData, err
}
... ...
... ... @@ -66,6 +66,7 @@ func (cooperationModeService *CooperationModeService) ListCooperationMode(listCo
OrganizationName: listCooperationModeQuery.OrganizationName,
CompanyId: listCooperationModeQuery.Operator.CompanyId,
UserId: 0,
OrgIds: listCooperationModeQuery.Operator.OrgIds,
OrgId: 0,
UserBaseId: 0,
})
... ...
... ... @@ -7,5 +7,5 @@ import (
type CooperationProjectSelectorQuery struct {
//操作人
Operator domain.Operator `json:"-"`
MatchCooperationProjectNumber string `json:"matchCooperationProjectNumber"` //匹配项目编号
MatchCooperationProjectNumber string `json:"matchCooperationProjectNumber"` //匹配项目编号 matchCooperationProjectNumber
}
... ...
... ... @@ -102,6 +102,7 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje
//项目名
CooperationProjectName: listCooperationProjectQuery.CooperationProjectName,
CompanyId: listCooperationProjectQuery.Operator.CompanyId,
OrgIds: listCooperationProjectQuery.Operator.OrgIds,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -146,16 +147,11 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
func (cooperationProjectService *CooperationProjectService) ListCooperationProjectSelector(listCooperationProjectQuery *query.CooperationProjectSelectorQuery) (int64, interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationProjectQuery.Operator)
orgIds := []string{}
for _, v := range listCooperationProjectQuery.Operator.OrgIds {
idStr := strconv.Itoa(int(v))
orgIds = append(orgIds, idStr)
}
result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
PageSize: 999,
CooperationProjectNumber: listCooperationProjectQuery.MatchCooperationProjectNumber,
CompanyId: listCooperationProjectQuery.Operator.CompanyId,
OrgIds: orgIds,
OrgIds: listCooperationProjectQuery.Operator.OrgIds,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -223,7 +223,7 @@ type (
//共创申请一键审核
type (
ReqCooperationApplicationOneclickApproval struct {
CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //审核描述
CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"` //审核描述
Action int `json:"action"` //审核动作,1同意,2拒绝
Code string `cname:"菜单编码" json:"code" valid:"Required"`
}
... ...
... ... @@ -165,6 +165,7 @@ type (
OrgId int64 `json:"orgId"`
UserId int64 `json:"userId"`
UserBaseId int64 `json:"userBaseId"`
OrgIds []int64 `json:"orgIds"`
//模式编码列表
CooperationModeNumbers []string `cname:"模式编码列表" json:"cooperationModeNumbers,omitempty"`
}
... ...
... ... @@ -158,7 +158,7 @@ type (
Status int `json:"status"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
OrgIds []string `json:"orgIds"`
OrgIds []int64 `json:"orgIds"`
CompanyId int64 `json:"companyId"`
CooperationProjectNumber string `json:"cooperationProjectNumber"`
//OffsetLimitFlag bool `json:"offsetLimitFlag"`
... ...
... ... @@ -20,6 +20,6 @@ func (controller *ContractChangeLogController) ContractChangeLogSearch() {
return
}
listContractChangeLogQuery.Operator = controller.GetOperator()
data, err := cooperationContractService.ContractChangeLogSearch(listContractChangeLogQuery)
controller.Response(data, err)
cnt, listData, err := cooperationContractService.ContractChangeLogSearch(listContractChangeLogQuery)
controller.ReturnPageListData(int64(cnt), listData, err, listContractChangeLogQuery.PageNumber)
}
... ...
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command"
"errors"
"path/filepath"
"strings"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command"
"github.com/beego/beego/v2/server/web/context"
"github.com/linmadan/egglib-go/utils/excel"
... ... @@ -29,6 +32,17 @@ func (controller *ExcelDataController) responseExcelByFile(ctx *context.Context,
return nil
}
func (controller *ExcelDataController) fieldValueAllEmpty(param map[string]string) bool {
isAllEmpty := true
for _, v := range param {
value := strings.TrimSpace(v)
if len(value) > 0 {
isAllEmpty = false
}
}
return isAllEmpty
}
//导出公司用户
func (controller ExcelDataController) ExportCompanyUser() {
excelService := service.NewExcelDataService(nil)
... ... @@ -91,12 +105,14 @@ func (controller ExcelDataController) ImportDividendsOrder() {
controller.Response(nil, err)
return
}
if filepath.Ext(fileHeader.Filename) == "" {
if filepath.Ext(fileHeader.Filename) != ".xlsx" {
//TODO 判断文件类型
log.Logger.Error("获取到的文件:" + fileHeader.Filename)
controller.Response(nil, errors.New("上传到的文件类型错误"))
return
}
excelImport := excel.NewExcelImport()
excelImport.RowBegin = 3 //第三行开始读取
excelImport.RowBegin = 2 //第2行开始读取
excelImport.DataFields = []excel.DataField{
{EnName: "OriginalOrderNum", CnName: "*来源单号"},
{EnName: "DividendsCustomerName", CnName: "*客户名称"},
... ... @@ -117,17 +133,21 @@ func (controller ExcelDataController) ImportDividendsOrder() {
//订单数据
var returnedOrderData []allied_creation_cooperation.ImportDividendsOrderData
for _, v := range excelData {
if allEmpty := controller.fieldValueAllEmpty(v); allEmpty {
//以全字段空跳过
continue
}
//TODO 按需转化
item := allied_creation_cooperation.ImportDividendsOrderData{
OriginalOrderNum: v["OriginalOrderNum"],
DividendsCustomerName: v["DividendsCustomerName"],
OrderGoodName: v["OrderGoodName"],
OrderTime: v["OrderTime"],
RegionName: v["RegionName"],
OrderGoodQuantity: v["OrderGoodQuantity"],
OrderGoodPrice: v["OrderGoodPrice"],
Expense: v["Expense"],
CooperationContractNumber: v["CooperationContractNumber"],
OriginalOrderNum: strings.TrimSpace(v["OriginalOrderNum"]),
DividendsCustomerName: strings.TrimSpace(v["DividendsCustomerName"]),
OrderGoodName: strings.TrimSpace(v["OrderGoodName"]),
OrderTime: strings.TrimSpace(v["OrderTime"]),
RegionName: strings.TrimSpace(v["RegionName"]),
OrderGoodQuantity: strings.TrimSpace(v["OrderGoodQuantity"]),
OrderGoodPrice: strings.TrimSpace(v["OrderGoodPrice"]),
Expense: strings.TrimSpace(v["Expense"]),
CooperationContractNumber: strings.TrimSpace(v["CooperationContractNumber"]),
}
returnedOrderData = append(returnedOrderData, item)
}
... ... @@ -150,12 +170,14 @@ func (controller ExcelDataController) ImportDividendsReturnedOrder() {
controller.Response(nil, err)
return
}
if filepath.Ext(fileHeader.Filename) == "" {
if filepath.Ext(fileHeader.Filename) != ".xlsx" {
//TODO 判断文件类型
log.Logger.Error("获取到的文件:" + fileHeader.Filename)
log.Logger.Error("获取到的文件:" + filepath.Ext(fileHeader.Filename))
controller.Response(nil, errors.New("上传的文件类型错误"))
return
}
excelImport := excel.NewExcelImport()
excelImport.RowBegin = 3 //第三行开始读取
excelImport.RowBegin = 2 //第2行表头开始读取
excelImport.DataFields = []excel.DataField{
{EnName: "OriginalOrderNum", CnName: "*来源单号"},
{EnName: "DividendsReturnedCustomerName", CnName: "*客户名称"},
... ... @@ -176,17 +198,21 @@ func (controller ExcelDataController) ImportDividendsReturnedOrder() {
//退货单数据
returnedOrderData := []allied_creation_cooperation.ImportDividendsReturnedOrderData{}
for _, v := range excelData {
if allEmpty := controller.fieldValueAllEmpty(v); allEmpty {
//以全字段空跳过
continue
}
//TODO 按需转化
item := allied_creation_cooperation.ImportDividendsReturnedOrderData{
OriginalOrderNum: v["OriginalOrderNum"],
DividendsReturnedCustomerName: v["DividendsReturnedCustomerName"],
OrderGoodName: v["OrderGoodName"],
DividendsReturnedDate: v["DividendsReturnedDate"],
OrderTime: v["OrderTime"],
RegionName: v["RegionName"],
OrderGoodQuantity: v["OrderGoodQuantity"],
OrderGoodPrice: v["OrderGoodPrice"],
CooperationContractNumber: v["CooperationContractNumber"],
OriginalOrderNum: strings.TrimSpace(v["OriginalOrderNum"]),
DividendsReturnedCustomerName: strings.TrimSpace(v["DividendsReturnedCustomerName"]),
OrderGoodName: strings.TrimSpace(v["OrderGoodName"]),
DividendsReturnedDate: strings.TrimSpace(v["DividendsReturnedDate"]),
OrderTime: strings.TrimSpace(v["OrderTime"]),
RegionName: strings.TrimSpace(v["RegionName"]),
OrderGoodQuantity: strings.TrimSpace(v["OrderGoodQuantity"]),
OrderGoodPrice: strings.TrimSpace(v["OrderGoodPrice"]),
CooperationContractNumber: strings.TrimSpace(v["CooperationContractNumber"]),
}
returnedOrderData = append(returnedOrderData, item)
}
... ...
... ... @@ -6,5 +6,5 @@ import (
)
func init() {
web.Router("/v1/web/contract-change-logs/search", &web_client.ContractChangeLogController{}, "Put:ContractChangeLogSearch")
web.Router("/v1/web/contract-change-logs/search", &web_client.ContractChangeLogController{}, "Post:ContractChangeLogSearch")
}
... ...